summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2020-11-18 14:37:44 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2020-11-18 14:37:44 +0100
commit9055db73d5b43b241730e643f220dfa5e35eb7c1 (patch)
tree972d9bf5049c7687702196c77281f4419ceba2df
parent8771390dfd3a98ae47b76b5f262af76aa8232cd7 (diff)
parent9b30212f15e280bef6d2a9be212c3295e912b959 (diff)
downloadmariadb-git-9055db73d5b43b241730e643f220dfa5e35eb7c1.tar.gz
Commit new source and all recent changes.
-rw-r--r--.clang-format2
-rw-r--r--.gitignore3
-rw-r--r--.travis.yml71
-rw-r--r--CMakeLists.txt20
-rw-r--r--VERSION2
-rw-r--r--client/client_priv.h1
-rw-r--r--client/mysql.cc16
-rw-r--r--client/mysql_plugin.c4
-rw-r--r--client/mysql_upgrade.c67
-rw-r--r--client/mysqlbinlog.cc29
-rw-r--r--client/mysqldump.c58
-rw-r--r--client/mysqlimport.c2
-rw-r--r--client/mysqlslap.c2
-rw-r--r--client/mysqltest.cc152
-rw-r--r--cmake/FindBISON.cmake8
-rw-r--r--cmake/build_configurations/mysql_release.cmake5
-rw-r--r--cmake/check_linker_flag.cmake27
-rw-r--r--cmake/configure.pl2
-rw-r--r--cmake/cpack_rpm.cmake13
-rw-r--r--cmake/cpack_source_ignore_files.cmake1
-rw-r--r--cmake/dtrace.cmake3
-rw-r--r--cmake/install_layout.cmake36
-rw-r--r--cmake/install_macros.cmake10
-rw-r--r--cmake/maintainer.cmake12
-rw-r--r--cmake/os/WindowsCache.cmake2
-rw-r--r--cmake/ssl.cmake1
-rw-r--r--cmake/submodules.cmake4
-rw-r--r--config.h.cmake2
-rw-r--r--configure.cmake9
-rw-r--r--dbug/dbug.c149
-rwxr-xr-xdbug/dbug_add_tags.pl2
-rwxr-xr-xdbug/remove_function_from_trace.pl2
-rw-r--r--dbug/tests.c4
-rw-r--r--debian/additions/innotop/innotop2
-rwxr-xr-xdebian/additions/mysqlreport2
-rwxr-xr-xdebian/autobake-deb.sh6
-rw-r--r--debian/libmariadb-dev.install2
-rw-r--r--debian/mariadb-server-10.2.install2
-rw-r--r--debian/mariadb-server-10.2.preinst2
-rwxr-xr-xdebian/rules12
-rw-r--r--extra/comp_err.c1
-rw-r--r--extra/mariabackup/CMakeLists.txt2
-rw-r--r--extra/mariabackup/backup_copy.cc35
-rw-r--r--extra/mariabackup/backup_copy.h4
-rw-r--r--extra/mariabackup/backup_mysql.cc469
-rw-r--r--extra/mariabackup/innobackupex.cc9
-rw-r--r--extra/mariabackup/xtrabackup.cc1104
-rw-r--r--extra/mariabackup/xtrabackup.h10
-rw-r--r--extra/resolve_stack_dump.c45
-rwxr-xr-xextra/yassl/include/openssl/generate_prefix_files.pl2
-rw-r--r--include/byte_order_generic.h53
-rw-r--r--include/byte_order_generic_x86.h23
-rw-r--r--include/byte_order_generic_x86_64.h7
-rw-r--r--include/ilist.h252
-rw-r--r--include/my_alarm.h7
-rw-r--r--include/my_compiler.h4
-rw-r--r--include/my_dbug.h8
-rw-r--r--include/my_global.h7
-rw-r--r--include/my_pthread.h5
-rw-r--r--include/my_stacktrace.h3
-rw-r--r--include/my_sys.h9
-rw-r--r--include/my_valgrind.h38
-rw-r--r--include/myisampack.h65
-rw-r--r--include/mysql/psi/mysql_file.h13
-rw-r--r--include/mysql/psi/mysql_idle.h13
-rw-r--r--include/mysql/psi/mysql_socket.h42
-rw-r--r--include/mysql/psi/mysql_stage.h13
-rw-r--r--include/mysql/psi/mysql_statement.h13
-rw-r--r--include/mysql/psi/mysql_table.h13
-rw-r--r--include/mysql/psi/mysql_thread.h13
-rw-r--r--include/mysql/psi/psi.h13
-rw-r--r--include/mysql/psi/psi_abi_v0.h13
-rw-r--r--include/mysql/psi/psi_abi_v1.h13
-rw-r--r--include/mysql/psi/psi_abi_v2.h13
-rw-r--r--include/mysql/service_my_snprintf.h6
-rw-r--r--include/mysql/service_wsrep.h5
-rw-r--r--include/mysql_version.h.in7
-rw-r--r--include/queues.h10
-rw-r--r--include/span.h161
-rw-r--r--include/sslopt-case.h2
-rw-r--r--include/violite.h3
m---------libmariadb0
-rw-r--r--libmysqld/lib_sql.cc3
-rw-r--r--libmysqld/libmysql.c2
-rw-r--r--man/CMakeLists.txt11
-rw-r--r--man/mysql-test-run.pl.16
-rw-r--r--man/mysql_upgrade.14
-rw-r--r--man/mysqlimport.126
-rw-r--r--mysql-test/disabled.def2
-rw-r--r--mysql-test/extra/binlog_tests/binlog_index.inc4
-rw-r--r--mysql-test/extra/binlog_tests/binlog_ioerr.inc3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_binlog_errors.inc43
-rw-r--r--mysql-test/extra/rpl_tests/rpl_checksum.inc12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_corruption.inc27
-rw-r--r--mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_incident.inc6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_parallel.inc20
-rw-r--r--mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stop_middle_group.test16
-rw-r--r--mysql-test/include/binlog_inject_error.inc4
-rw-r--r--mysql-test/include/binlog_parallel_replication_marks.test2
-rw-r--r--mysql-test/include/ctype_utf8mb4.inc2
-rw-r--r--mysql-test/include/galera_have_debug_sync.inc9
-rw-r--r--mysql-test/include/have_not_innodb_plugin.inc4
-rw-r--r--mysql-test/include/have_static_innodb.inc7
-rw-r--r--mysql-test/include/icp_debug_kill.inc50
-rw-r--r--mysql-test/include/innodb_prefix_index_cluster_optimization.combinations5
-rw-r--r--mysql-test/include/innodb_prefix_index_cluster_optimization.inc1
-rw-r--r--mysql-test/include/io_thd_fault_injection.inc9
-rw-r--r--mysql-test/include/mtr_check.sql1
-rw-r--r--mysql-test/include/restart_mysqld.inc2
-rw-r--r--mysql-test/include/rpl_stop_server.inc4
-rw-r--r--mysql-test/include/search_pattern_in_file.inc2
-rw-r--r--mysql-test/include/shutdown_mysqld.inc2
-rw-r--r--mysql-test/include/wait_for_line_count_in_file.inc18
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process_win.cc2
-rw-r--r--mysql-test/lib/My/Tee.pm2
-rw-r--r--mysql-test/lib/mtr_report.pm166
-rwxr-xr-xmysql-test/lib/process-purecov-annotations.pl2
-rwxr-xr-xmysql-test/lib/t/SafeProcessStress.pl2
-rw-r--r--mysql-test/lib/t/copytree.t2
-rw-r--r--mysql-test/lib/t/dummyd.pl2
-rw-r--r--mysql-test/lib/t/rmtree.t2
-rwxr-xr-xmysql-test/lib/t/testMyConfig.t2
-rwxr-xr-xmysql-test/lib/t/testMyConfigFactory.t2
-rwxr-xr-xmysql-test/lib/t/test_child.pl2
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rw-r--r--mysql-test/mtr.out-of-source2
-rwxr-xr-xmysql-test/mysql-stress-test.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl348
-rw-r--r--mysql-test/r/alter_table.result11
-rw-r--r--mysql-test/r/alter_user.result2
-rw-r--r--mysql-test/r/aria_icp_debug.result34
-rw-r--r--mysql-test/r/blackhole.result6
-rw-r--r--mysql-test/r/bootstrap_innodb.result7
-rw-r--r--mysql-test/r/cache_temporal_4265.result3
-rw-r--r--mysql-test/r/cast.result4
-rw-r--r--mysql-test/r/comment_table.result5
-rw-r--r--mysql-test/r/connect_debug.result10
-rw-r--r--mysql-test/r/create.result8
-rw-r--r--mysql-test/r/create_drop_function.result17
-rw-r--r--mysql-test/r/create_or_replace2.result4
-rw-r--r--mysql-test/r/cte_nonrecursive.result18
-rw-r--r--mysql-test/r/cte_recursive.result330
-rw-r--r--mysql-test/r/ctype_binary.result142
-rw-r--r--mysql-test/r/ctype_upgrade.result4
-rw-r--r--mysql-test/r/ctype_utf16.result2
-rw-r--r--mysql-test/r/ctype_utf16_uca.result41
-rw-r--r--mysql-test/r/ctype_utf16le.result2
-rw-r--r--mysql-test/r/ctype_utf32.result22
-rw-r--r--mysql-test/r/ctype_utf8.result16
-rw-r--r--mysql-test/r/ctype_utf8mb4.result4
-rw-r--r--mysql-test/r/ctype_utf8mb4_heap.result4
-rw-r--r--mysql-test/r/ctype_utf8mb4_innodb.result4
-rw-r--r--mysql-test/r/ctype_utf8mb4_myisam.result4
-rw-r--r--mysql-test/r/default_session.result28
-rw-r--r--mysql-test/r/derived.result2
-rw-r--r--mysql-test/r/derived_cond_pushdown.result58
-rw-r--r--mysql-test/r/drop.result4
-rw-r--r--mysql-test/r/drop_bad_db_type.result6
-rw-r--r--mysql-test/r/dyncol.result2
-rw-r--r--mysql-test/r/engine_error_in_alter-8453.result5
-rw-r--r--mysql-test/r/error_simulation.result11
-rw-r--r--mysql-test/r/errors.result13
-rw-r--r--mysql-test/r/events_2.result2
-rw-r--r--mysql-test/r/events_bugs.result4
-rw-r--r--mysql-test/r/events_restart.result27
-rw-r--r--mysql-test/r/fast_prefix_index_fetch_innodb.result68
-rw-r--r--mysql-test/r/foreign_key.result26
-rw-r--r--mysql-test/r/fulltext.result11
-rw-r--r--mysql-test/r/func_group.result4
-rw-r--r--mysql-test/r/func_json.result18
-rw-r--r--mysql-test/r/func_math.result799
-rw-r--r--mysql-test/r/func_misc.result21
-rw-r--r--mysql-test/r/func_regexp_pcre.result18
-rw-r--r--mysql-test/r/func_regexp_pcre_debug.result3
-rw-r--r--mysql-test/r/func_str.result2
-rw-r--r--mysql-test/r/func_test.result19
-rw-r--r--mysql-test/r/func_time.result17
-rw-r--r--mysql-test/r/gis-rtree.result4
-rw-r--r--mysql-test/r/gis.result9
-rw-r--r--mysql-test/r/grant.result47
-rw-r--r--mysql-test/r/grant5.result46
-rw-r--r--mysql-test/r/grant_lowercase.result2
-rw-r--r--mysql-test/r/group_by.result30
-rw-r--r--mysql-test/r/index_merge_innodb.result26
-rw-r--r--mysql-test/r/index_merge_myisam.result53
-rw-r--r--mysql-test/r/information_schema.result23
-rw-r--r--mysql-test/r/innodb_ext_key,off.rdiff295
-rw-r--r--mysql-test/r/innodb_ext_key.result421
-rw-r--r--mysql-test/r/innodb_icp_debug.result34
-rw-r--r--mysql-test/r/insert_debug.result29
-rw-r--r--mysql-test/r/limit_rows_examined.result15
-rw-r--r--mysql-test/r/locale.result2
-rw-r--r--mysql-test/r/lock.result14
-rw-r--r--mysql-test/r/lock_view.result231
-rw-r--r--mysql-test/r/log_slow_debug.result4
-rw-r--r--mysql-test/r/log_tables.result14
-rw-r--r--mysql-test/r/mdev6830.result2
-rw-r--r--mysql-test/r/merge-big.result2
-rw-r--r--mysql-test/r/merge_debug.result2
-rw-r--r--mysql-test/r/multi_update_big.result3
-rw-r--r--mysql-test/r/multi_update_debug.result3
-rw-r--r--mysql-test/r/myisam_debug.result4
-rw-r--r--mysql-test/r/myisam_icp_debug.result32
-rw-r--r--mysql-test/r/mysql.result2
-rw-r--r--mysql-test/r/mysql_tzinfo_to_sql_symlink.result44
-rw-r--r--mysql-test/r/mysql_upgrade.result170
-rw-r--r--mysql-test/r/mysqlbinlog_row_minimal.result44
-rw-r--r--mysql-test/r/mysqld--defaults-file.result10
-rw-r--r--mysql-test/r/mysqld--help,win.rdiff34
-rw-r--r--mysql-test/r/mysqld--help.result6
-rw-r--r--mysql-test/r/mysqldump.result21
-rw-r--r--mysql-test/r/mysqltest_tracking_info.result18
-rw-r--r--mysql-test/r/nested_profiling.result20
-rw-r--r--mysql-test/r/not_true.require2
-rw-r--r--mysql-test/r/order_by.result187
-rw-r--r--mysql-test/r/parser.result32
-rw-r--r--mysql-test/r/parser_precedence.result748
-rw-r--r--mysql-test/r/partition.result51
-rw-r--r--mysql-test/r/partition_alter.result44
-rw-r--r--mysql-test/r/partition_error.result14
-rw-r--r--mysql-test/r/partition_innodb.result12
-rw-r--r--mysql-test/r/perror-win.result2
-rw-r--r--mysql-test/r/perror.result2
-rw-r--r--mysql-test/r/plugin.result13
-rw-r--r--mysql-test/r/pool_of_threads.result5
-rw-r--r--mysql-test/r/precedence.result8020
-rw-r--r--mysql-test/r/precedence_bugs.result60
-rw-r--r--mysql-test/r/processlist_notembedded.result21
-rw-r--r--mysql-test/r/ps.result17
-rw-r--r--mysql-test/r/query_cache.result12
-rw-r--r--mysql-test/r/range.result125
-rw-r--r--mysql-test/r/range_innodb.result31
-rw-r--r--mysql-test/r/range_interrupted-13751.result4
-rw-r--r--mysql-test/r/range_mrr_icp.result125
-rw-r--r--mysql-test/r/range_vs_index_merge.result2
-rw-r--r--mysql-test/r/range_vs_index_merge_innodb.result2
-rw-r--r--mysql-test/r/repair.result21
-rw-r--r--mysql-test/r/rpl_mysql_upgrade_slave_repo_check.result33
-rw-r--r--mysql-test/r/select_debug.result2
-rw-r--r--mysql-test/r/selectivity.result15
-rw-r--r--mysql-test/r/selectivity_innodb.result15
-rw-r--r--mysql-test/r/show_explain.result178
-rw-r--r--mysql-test/r/show_explain_non_select.result8
-rw-r--r--mysql-test/r/show_explain_ps.result5
-rw-r--r--mysql-test/r/signal.result6
-rw-r--r--mysql-test/r/slowlog_enospace-10508.result5
-rw-r--r--mysql-test/r/sp-error.result25
-rw-r--r--mysql-test/r/sp.result2
-rw-r--r--mysql-test/r/sp2.result20
-rw-r--r--mysql-test/r/ssl_system_ca,bad.result1
-rw-r--r--mysql-test/r/ssl_system_ca.result2
-rw-r--r--mysql-test/r/stat_tables-enospc.result5
-rw-r--r--mysql-test/r/stat_tables_innodb.result24
-rw-r--r--mysql-test/r/stat_tables_partition.result34
-rw-r--r--mysql-test/r/stat_tables_rbr.result1
-rw-r--r--mysql-test/r/subselect4.result153
-rw-r--r--mysql-test/r/subselect_exists2in.result135
-rw-r--r--mysql-test/r/subselect_innodb.result14
-rw-r--r--mysql-test/r/sum_distinct-big.result37
-rw-r--r--mysql-test/r/temp_table.result18
-rw-r--r--mysql-test/r/temp_table_symlink.result13
-rw-r--r--mysql-test/r/trigger.result2
-rw-r--r--mysql-test/r/type_date.result20
-rw-r--r--mysql-test/r/type_datetime.result97
-rw-r--r--mysql-test/r/type_float.result21
-rw-r--r--mysql-test/r/type_int.result13
-rw-r--r--mysql-test/r/type_newdecimal.result47
-rw-r--r--mysql-test/r/type_set.result2
-rw-r--r--mysql-test/r/type_time.result78
-rw-r--r--mysql-test/r/udf.result20
-rw-r--r--mysql-test/r/union.result29
-rw-r--r--mysql-test/r/union_crash-714.result4
-rw-r--r--mysql-test/r/uniques_crash-7912.result11
-rw-r--r--mysql-test/r/view.result13
-rw-r--r--mysql-test/r/warnings_debug.result2
-rw-r--r--mysql-test/r/win.result232
-rw-r--r--mysql-test/r/win_ntile.result78
-rw-r--r--mysql-test/r/xml.result10
-rwxr-xr-xmysql-test/std_data/checkDBI_DBD-mysql.pl2
-rw-r--r--mysql-test/std_data/mysql57user.MYDbin0 -> 340 bytes
-rw-r--r--mysql-test/std_data/mysql57user.MYIbin0 -> 4096 bytes
-rw-r--r--mysql-test/std_data/mysql57user.frmbin0 -> 10816 bytes
-rw-r--r--mysql-test/suite/binlog/r/binlog_index.result3
-rw-r--r--mysql-test/suite/binlog/r/binlog_invalid_read_in_rotate.result18
-rw-r--r--mysql-test/suite/binlog/r/binlog_ioerr.result3
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result62
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result3
-rw-r--r--mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result44
-rw-r--r--mysql-test/suite/binlog/r/binlog_recover_checksum_error.result7
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_annotate.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result15
-rw-r--r--mysql-test/suite/binlog/r/binlog_write_error.result51
-rw-r--r--mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.combinations5
-rw-r--r--mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.test48
-rw-r--r--mysql-test/suite/binlog/t/binlog_max_extension.test4
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test14
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test8
-rw-r--r--mysql-test/suite/binlog/t/binlog_no_uniqfile_crash.test83
-rw-r--r--mysql-test/suite/binlog/t/binlog_recover_checksum_error.test37
-rw-r--r--mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.combinations5
-rw-r--r--mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test42
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_index.result3
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_ioerr.result3
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_row_annotate.result1
-rw-r--r--mysql-test/suite/binlog_encryption/binlog_write_error.result51
-rw-r--r--mysql-test/suite/binlog_encryption/restart_server.inc2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_binlog_errors.result71
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_checksum.result11
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_corruption.result27
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_incident.result2
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result3
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel.result18
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result2
-rw-r--r--mysql-test/suite/encryption/r/create_or_replace.result17
-rw-r--r--mysql-test/suite/encryption/r/create_or_replace_big.result19
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_compression.result18
-rw-r--r--mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result84
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_log.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result3
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result3896
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.opt2
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.test84
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace_big.opt1
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace_big.test86
-rw-r--r--mysql-test/suite/encryption/t/innochecksum.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_compression.test15
-rw-r--r--mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test68
-rw-r--r--mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb_encryption_tables.test2
-rw-r--r--mysql-test/suite/encryption/t/tempfiles_encrypted.opt1
-rw-r--r--mysql-test/suite/encryption/t/tempfiles_encrypted.test31
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_decimal.result4
-rwxr-xr-xmysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl2
-rwxr-xr-xmysql-test/suite/funcs_1/lib/DataGen_local.pl2
-rwxr-xr-xmysql-test/suite/funcs_1/lib/DataGen_modify.pl2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result56
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_02.result6
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraints.result (renamed from mysql-test/suite/funcs_1/r/is_check_constraint.result)26
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result56
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_02.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result56
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_02.result6
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result4
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result581
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraints.test (renamed from mysql-test/suite/funcs_1/t/is_check_constraint.test)33
-rwxr-xr-xmysql-test/suite/funcs_2/lib/gen_charset_utf8.pl2
-rw-r--r--mysql-test/suite/galera/disabled.def20
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf11
-rw-r--r--mysql-test/suite/galera/galera_3nodes_as_slave.cnf3
-rw-r--r--mysql-test/suite/galera/galera_4nodes.cnf4
-rw-r--r--mysql-test/suite/galera/include/galera_have_debug_sync.inc2
-rw-r--r--mysql-test/suite/galera/include/galera_st_clean_slave.inc6
-rw-r--r--mysql-test/suite/galera/include/galera_st_disconnect_slave.inc6
-rw-r--r--mysql-test/suite/galera/include/galera_st_kill_slave.inc6
-rw-r--r--mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc5
-rw-r--r--mysql-test/suite/galera/include/galera_st_shutdown_slave.inc9
-rw-r--r--mysql-test/suite/galera/r/MDEV-20225.result20
-rw-r--r--mysql-test/suite/galera/r/MDEV-22021.result55
-rw-r--r--mysql-test/suite/galera/r/MDEV-22707.result26
-rw-r--r--mysql-test/suite/galera/r/MW-284.result11
-rw-r--r--mysql-test/suite/galera/r/MW-328C.result23
-rw-r--r--mysql-test/suite/galera/r/MW-336.result52
-rw-r--r--mysql-test/suite/galera/r/MW-388.result4
-rw-r--r--mysql-test/suite/galera/r/MW-44.result13
-rw-r--r--mysql-test/suite/galera/r/galera_account_management.result65
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_gtid.result59
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result15
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_ctas.result28
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result35
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_nonprim.result15
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_preordered.result19
-rw-r--r--mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result69
-rw-r--r--mysql-test/suite/galera/r/galera_bf_lock_wait.result32
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result12
-rw-r--r--mysql-test/suite/galera/r/galera_drop_database.result25
-rw-r--r--mysql-test/suite/galera/r/galera_events2.result1
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete.result18
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result67
-rw-r--r--mysql-test/suite/galera/r/galera_flush.result88
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format.result6
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result10
-rw-r--r--mysql-test/suite/galera/r/galera_gtid.result10
-rw-r--r--mysql-test/suite/galera/r/galera_ist_progress.result9
-rw-r--r--mysql-test/suite/galera/r/galera_ist_restart_joiner.result1
-rw-r--r--mysql-test/suite/galera/r/galera_load_data.result25
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin.result2
-rw-r--r--mysql-test/suite/galera/r/galera_migrate.result79
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result8
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result2
-rw-r--r--mysql-test/suite/galera/r/galera_partition.result424
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_add_pk.result24
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_drop_pk.result50
-rw-r--r--mysql-test/suite/galera/r/galera_slave_replay.result95
-rw-r--r--mysql-test/suite/galera/r/galera_sp_bf_abort.result360
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result37
-rw-r--r--mysql-test/suite/galera/r/galera_toi_truncate.result24
-rw-r--r--mysql-test/suite/galera/r/galera_trigger.result32
-rw-r--r--mysql-test/suite/galera/r/galera_var_dirty_reads.result7
-rw-r--r--mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result33
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_cmd.result19
-rw-r--r--mysql-test/suite/galera/r/galera_var_reject_queries.result5
-rw-r--r--mysql-test/suite/galera/r/galera_wan_restart_ist.result55
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result73
-rw-r--r--mysql-test/suite/galera/r/mdev-22543.result17
-rw-r--r--mysql-test/suite/galera/suite.pm2
-rw-r--r--mysql-test/suite/galera/t/MDEV-20225.test52
-rw-r--r--mysql-test/suite/galera/t/MDEV-22021.combinations4
-rw-r--r--mysql-test/suite/galera/t/MDEV-22021.test60
-rw-r--r--mysql-test/suite/galera/t/MDEV-22707.test52
-rw-r--r--mysql-test/suite/galera/t/MW-284.test16
-rw-r--r--mysql-test/suite/galera/t/MW-313-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-313.cnf12
-rw-r--r--mysql-test/suite/galera/t/MW-328A.cnf7
-rw-r--r--mysql-test/suite/galera/t/MW-328A.test2
-rw-r--r--mysql-test/suite/galera/t/MW-328B.cnf7
-rw-r--r--mysql-test/suite/galera/t/MW-328B.test2
-rw-r--r--mysql-test/suite/galera/t/MW-328C.test36
-rw-r--r--mysql-test/suite/galera/t/MW-329-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-329.cnf9
-rw-r--r--mysql-test/suite/galera/t/MW-336.test68
-rw-r--r--mysql-test/suite/galera/t/MW-388.test10
-rw-r--r--mysql-test/suite/galera/t/MW-44-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-44.test30
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait1-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait1.test2
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8.cnf10
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8.test2
-rw-r--r--mysql-test/suite/galera/t/enforce_storage_engine2.cnf13
-rw-r--r--mysql-test/suite/galera/t/enforce_storage_engine2.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_account_management.test99
-rw-r--r--mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf14
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.cnf8
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid.test70
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf8
-rw-r--r--mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test54
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_ctas.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_ctas.test75
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid.inc93
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf6
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test77
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_preordered.test84
-rw-r--r--mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test97
-rw-r--r--mysql-test/suite/galera/t/galera_bf_background_statistics.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_bf_background_statistics.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_bf_lock_wait.test52
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test28
-rw-r--r--mysql-test/suite/galera/t/galera_drop_database.test20
-rw-r--r--mysql-test/suite/galera/t/galera_events2.test4
-rw-r--r--mysql-test/suite/galera/t/galera_fk_cascade_delete.test18
-rw-r--r--mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test98
-rw-r--r--mysql-test/suite/galera/t/galera_flush-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_flush.test273
-rw-r--r--mysql-test/suite/galera/t/galera_flush_local.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_flush_local.opt3
-rw-r--r--mysql-test/suite/galera/t/galera_forced_binlog_format.test6
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test10
-rw-r--r--mysql-test/suite/galera/t/galera_gtid-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_gtid.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_gtid.test8
-rw-r--r--mysql-test/suite/galera/t/galera_load_data.test28
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test5
-rw-r--r--mysql-test/suite/galera/t/galera_mdev_13787.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_mdev_13787.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_migrate.cnf59
-rw-r--r--mysql-test/suite/galera/t/galera_migrate.test204
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test8
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test2
-rw-r--r--mysql-test/suite/galera/t/galera_partition.cnf18
-rw-r--r--mysql-test/suite/galera/t/galera_partition.test450
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait.test2
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_add_pk.test14
-rw-r--r--mysql-test/suite/galera/t/galera_rsu_drop_pk.test28
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.cnf (renamed from mysql-test/suite/galera/t/galera_as_slave_preordered.cnf)2
-rw-r--r--mysql-test/suite/galera/t/galera_slave_replay.test199
-rw-r--r--mysql-test/suite/galera/t/galera_sp_bf_abort.inc36
-rw-r--r--mysql-test/suite/galera/t/galera_sp_bf_abort.test350
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test71
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_toi_truncate.test27
-rw-r--r--mysql-test/suite/galera/t/galera_trigger.test36
-rw-r--r--mysql-test/suite/galera/t/galera_udf-master.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_udf.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_dirty_reads.test9
-rw-r--r--mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test52
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.test14
-rw-r--r--mysql-test/suite/galera/t/galera_var_reject_queries.test6
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test2
-rw-r--r--mysql-test/suite/galera/t/galera_var_sst_auth.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_var_sst_auth.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wan_restart_ist.test76
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.test40
-rw-r--r--mysql-test/suite/galera/t/lp1376747-4.test17
-rw-r--r--mysql-test/suite/galera/t/mdev-22543.test58
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#201-master.opt1
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#201.cnf9
-rw-r--r--mysql-test/suite/galera/t/query_cache.cnf9
-rw-r--r--mysql-test/suite/galera/t/query_cache.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def14
-rw-r--r--mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf6
-rw-r--r--mysql-test/suite/galera_3nodes/r/GAL-501.result6
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result76
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result17
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result8
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result13
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result6
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result6
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result9
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result22
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result40
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result50
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result55
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result12
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result6
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result2
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm29
-rw-r--r--mysql-test/suite/galera_3nodes/t/GAL-501.cnf3
-rw-r--r--mysql-test/suite/galera_3nodes/t/GAL-501.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/GAL-501.test5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test14
-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.test80
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf8
-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.test11
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf12
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test13
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf3
-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.test5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf3
-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.test5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf11
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test5
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf29
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt1
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test58
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test262
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test273
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test299
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test16
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf10
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test15
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test7
-rw-r--r--mysql-test/suite/gcol/inc/gcol_keys.inc62
-rw-r--r--mysql-test/suite/gcol/r/gcol_bugfixes.result66
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result50
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_myisam.result50
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result61
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk.result50
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_index.result3
-rw-r--r--mysql-test/suite/gcol/t/gcol_bugfixes.test70
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test80
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk.test44
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_index.test3
-rw-r--r--mysql-test/suite/heap/heap.result2
-rw-r--r--mysql-test/suite/innodb/include/alter_table_pk_no_sort.inc7
-rw-r--r--mysql-test/suite/innodb/include/wait_all_purged.inc24
-rw-r--r--mysql-test/suite/innodb/r/alter_missing_tablespace.result4
-rw-r--r--mysql-test/suite/innodb/r/alter_table.result17
-rw-r--r--mysql-test/suite/innodb/r/analyze_table.result19
-rw-r--r--mysql-test/suite/innodb/r/blob-update-debug.result4
-rw-r--r--mysql-test/suite/innodb/r/buf_pool_resize_oom.result8
-rw-r--r--mysql-test/suite/innodb/r/corrupted_during_recovery.result16
-rw-r--r--mysql-test/suite/innodb/r/foreign-keys.result16
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result281
-rw-r--r--mysql-test/suite/innodb/r/foreign_key_debug.result60
-rw-r--r--mysql-test/suite/innodb/r/information_schema_grants.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k-crash.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k-crash.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k.result7
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result23
-rw-r--r--mysql-test/suite/innodb/r/innodb-blob.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-debug.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb-mdev-7513.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-online-alter-gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-replace-debug.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb-virtual-columns.result50
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-1.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result1050
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result578
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5980-alter.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result50
-rw-r--r--mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result109
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug11754376.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug30113362.result119
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug34053.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug56947.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_corrupt_bit.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_defrag_concurrent.result19
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result17
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_drop_locked.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result73
-rw-r--r--mysql-test/suite/innodb/r/innodb_wl6326.result371
-rw-r--r--mysql-test/suite/innodb/r/innodb_wl6326_big.result449
-rw-r--r--mysql-test/suite/innodb/r/innodb_xtradb_compat.result2
-rw-r--r--mysql-test/suite/innodb/r/log_file_name_debug.result2
-rw-r--r--mysql-test/suite/innodb/r/mvcc.result14
-rw-r--r--mysql-test/suite/innodb/r/read_only_recover_committed.result1
-rw-r--r--mysql-test/suite/innodb/r/redo_log_during_checkpoint.result6
-rw-r--r--mysql-test/suite/innodb/r/row_format_redundant.result5
-rw-r--r--mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result45
-rw-r--r--mysql-test/suite/innodb/r/stats_persistent.result18
-rw-r--r--mysql-test/suite/innodb/r/truncate.result11
-rw-r--r--mysql-test/suite/innodb/r/truncate_foreign.result1
-rw-r--r--mysql-test/suite/innodb/r/truncate_inject.result28
-rw-r--r--mysql-test/suite/innodb/r/undo_log.result1
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery.result10
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery_debug.result26
-rw-r--r--mysql-test/suite/innodb/t/alter_missing_tablespace.test4
-rw-r--r--mysql-test/suite/innodb/t/alter_table.test20
-rw-r--r--mysql-test/suite/innodb/t/analyze_table.test33
-rw-r--r--mysql-test/suite/innodb/t/blob-update-debug.test4
-rw-r--r--mysql-test/suite/innodb/t/buf_pool_resize_oom.opt1
-rw-r--r--mysql-test/suite/innodb/t/buf_pool_resize_oom.test28
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.test28
-rw-r--r--mysql-test/suite/innodb/t/foreign-keys.test19
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test288
-rw-r--r--mysql-test/suite/innodb/t/foreign_key_debug.test78
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k-crash.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k-crash.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test22
-rw-r--r--mysql-test/suite/innodb/t/innodb-blob.test7
-rw-r--r--mysql-test/suite/innodb/t/innodb-corrupted-table.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev-7513.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-replace-debug.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test770
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522.test105
-rw-r--r--mysql-test/suite/innodb/t/innodb.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test190
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test241
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug11754376.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug30113362.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug30113362.test242
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug34053.test57
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug56947.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug60196.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_corrupt_bit.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_defrag_concurrent.test31
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test35
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_drop_locked.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test70
-rw-r--r--mysql-test/suite/innodb/t/innodb_trx_weight.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_wl6326.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_wl6326.test506
-rw-r--r--mysql-test/suite/innodb/t/innodb_wl6326_big.test716
-rw-r--r--mysql-test/suite/innodb/t/log_file_name_debug.test2
-rw-r--r--mysql-test/suite/innodb/t/mvcc.test20
-rw-r--r--mysql-test/suite/innodb/t/read_only_recover_committed.test1
-rw-r--r--mysql-test/suite/innodb/t/redo_log_during_checkpoint.test6
-rw-r--r--mysql-test/suite/innodb/t/row_format_redundant.test3
-rw-r--r--mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test32
-rw-r--r--mysql-test/suite/innodb/t/stats_persistent.test27
-rw-r--r--mysql-test/suite/innodb/t/truncate.test10
-rw-r--r--mysql-test/suite/innodb/t/truncate_foreign.test1
-rw-r--r--mysql-test/suite/innodb/t/truncate_inject.test28
-rw-r--r--mysql-test/suite/innodb/t/undo_log.test2
-rw-r--r--mysql-test/suite/innodb/t/update-cascade.combinations5
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test13
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery_debug.test43
-rw-r--r--mysql-test/suite/innodb_fts/r/basic.result21
-rw-r--r--mysql-test/suite/innodb_fts/r/concurrent_insert.result3
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result7
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_misc.result7
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result42
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug.result9
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug2.result7
-rw-r--r--mysql-test/suite/innodb_fts/r/stopword.result744
-rw-r--r--mysql-test/suite/innodb_fts/r/sync.result14
-rw-r--r--mysql-test/suite/innodb_fts/r/sync_block.result4
-rw-r--r--mysql-test/suite/innodb_fts/t/basic.test20
-rw-r--r--mysql-test/suite/innodb_fts/t/concurrent_insert.test3
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test8
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_misc.test8
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test42
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug.test13
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug2.test12
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.opt1
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.test657
-rw-r--r--mysql-test/suite/innodb_fts/t/sync.test6
-rw-r--r--mysql-test/suite/innodb_fts/t/sync_block.test4
-rw-r--r--mysql-test/suite/innodb_gis/disabled.def6
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result6
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/bug16236208.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/bug16266012.result7
-rw-r--r--mysql-test/suite/innodb_gis/r/geometry.result255
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result6
-rw-r--r--mysql-test/suite/innodb_gis/r/gis_split_inf.result10
-rw-r--r--mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/point_basic.result27
-rw-r--r--mysql-test/suite/innodb_gis/r/point_big.result18
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree.result6
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_debug.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_multi_pk.result20
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_search.result8
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_split.result60
-rw-r--r--mysql-test/suite/innodb_gis/t/bug16236208.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/bug16266012.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/geometry.test65
-rw-r--r--mysql-test/suite/innodb_gis/t/gis_split_inf.test5
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_debug.test2
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_multi_pk.test13
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_rollback1.test3
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_rollback2.test3
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_split.test64
-rw-r--r--mysql-test/suite/innodb_zip/r/cmp_per_index.result31
-rw-r--r--mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result6
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result577
-rw-r--r--mysql-test/suite/innodb_zip/r/wl5522_zip.result194
-rw-r--r--mysql-test/suite/innodb_zip/t/cmp_per_index.test26
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test381
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_zip.test71
-rw-r--r--mysql-test/suite/maria/aria_pack_mdev14183.result22
-rw-r--r--mysql-test/suite/maria/aria_pack_mdev14183.test23
-rw-r--r--mysql-test/suite/maria/bulk_insert_crash.opt2
-rw-r--r--mysql-test/suite/maria/bulk_insert_crash.result13
-rw-r--r--mysql-test/suite/maria/bulk_insert_crash.test36
-rw-r--r--mysql-test/suite/maria/encrypt-no-key.result15
-rw-r--r--mysql-test/suite/maria/encrypt-no-key.test14
-rw-r--r--mysql-test/suite/mariabackup/backup_lock_wait_timeout.result11
-rw-r--r--mysql-test/suite/mariabackup/backup_lock_wait_timeout.test28
-rw-r--r--mysql-test/suite/mariabackup/ddl_incremental_encrypted.opt7
-rw-r--r--mysql-test/suite/mariabackup/ddl_incremental_encrypted.result26
-rw-r--r--mysql-test/suite/mariabackup/ddl_incremental_encrypted.test66
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn.result4
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn.test8
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.result4
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test68
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.result1
-rw-r--r--mysql-test/suite/mariabackup/incremental_ddl_during_backup.test6
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt1
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result2
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test20
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_overwrite.opt1
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_overwrite.result28
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_overwrite.test70
-rw-r--r--mysql-test/suite/mariabackup/innodb_xa_rollback.result45
-rw-r--r--mysql-test/suite/mariabackup/innodb_xa_rollback.test77
-rw-r--r--mysql-test/suite/mariabackup/mlog_index_load.result1
-rw-r--r--mysql-test/suite/mariabackup/mlog_index_load.test1
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.opt2
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.result3
-rw-r--r--mysql-test/suite/mariabackup/partial_exclude.test18
-rw-r--r--mysql-test/suite/mariabackup/rpl_slave_info.result37
-rw-r--r--mysql-test/suite/mariabackup/rpl_slave_info.test84
-rw-r--r--mysql-test/suite/multi_source/info_logs.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test3
-rw-r--r--mysql-test/suite/parts/inc/partition_auto_increment.inc11
-rw-r--r--mysql-test/suite/parts/r/longname.result36
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_innodb.result8
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_maria.result8
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_memory.result8
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_myisam.result8
-rw-r--r--mysql-test/suite/parts/r/partition_debug.result5
-rw-r--r--mysql-test/suite/parts/r/partition_syntax_innodb.result74
-rw-r--r--mysql-test/suite/parts/r/partition_syntax_myisam.result74
-rw-r--r--mysql-test/suite/parts/t/longname.test26
-rw-r--r--mysql-test/suite/parts/t/partition_debug.test8
-rw-r--r--mysql-test/suite/parts/t/partition_debug_innodb.test4
-rw-r--r--mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test2
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_format.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result3
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_peer_addr.result3
-rw-r--r--mysql-test/suite/perfschema/t/ddl_esms_by_digest.test13
-rw-r--r--mysql-test/suite/perfschema/t/dml_esms_by_digest.test13
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_format.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test4
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test4
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test3
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_peer_addr.test3
-rw-r--r--mysql-test/suite/plugins/r/audit_null_debug.result1
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result89
-rw-r--r--mysql-test/suite/plugins/t/audit_null_debug.test3
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test79
-rw-r--r--mysql-test/suite/roles/acl_load_mutex-5170.test2
-rw-r--r--mysql-test/suite/roles/drop_current_role.result5
-rw-r--r--mysql-test/suite/roles/drop_current_role.test9
-rw-r--r--mysql-test/suite/roles/set_default_role_clear.result1
-rw-r--r--mysql-test/suite/roles/set_default_role_for.result6
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid.result90
-rw-r--r--mysql-test/suite/roles/set_default_role_invalid.test107
-rw-r--r--mysql-test/suite/roles/set_default_role_new_connection.result2
-rw-r--r--mysql-test/suite/roles/set_role-recursive.result2
-rw-r--r--mysql-test/suite/rpl/disabled.def3
-rwxr-xr-xmysql-test/suite/rpl/extension/checksum.pl2
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc2
-rw-r--r--mysql-test/suite/rpl/r/circular_serverid0.result4
-rw-r--r--mysql-test/suite/rpl/r/kill_race_condition.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result47
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_errors.result71
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_index.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug33931.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug41902.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_checksum.result11
-rw-r--r--mysql-test/suite/rpl/r/rpl_conditional_comments.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_corruption.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_current_user.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result26
-rw-r--r--mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_fail_register.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_failed_drop_tbl_binlog.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result19
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_crash.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_reconnect.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_strict.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_debug.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_incident.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_init_slave_errors.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql_upgrade.result58
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel2.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_optimistic.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_optimistic_until.result291
-rw-r--r--mysql-test/suite/rpl/r/rpl_password_boundaries.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_big_table_id.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_corruption.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_select.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_find_row_debug.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_virt.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_show_slave_running.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_stop_slave.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_EE_err2.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result15
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_slave.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_view_debug.result2
-rw-r--r--mysql-test/suite/rpl/t/circular_serverid0.test5
-rw-r--r--mysql-test/suite/rpl/t/kill_race_condition.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test121
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_index.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test46
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug41902-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug41902.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_conditional_comments.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test27
-rw-r--r--mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test60
-rw-r--r--mysql-test/suite/rpl/t/rpl_fail_register.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_failed_drop_tbl_binlog.test64
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test9
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_reconnect.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_stop_start.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_strict.test17
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_debug.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev382.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test34
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel2.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_optimistic.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test465
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_partition.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_big_table_id.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_corruption.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_find_row_debug.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_index_choice.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_virt.test27
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_show_slave_running.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_grp_exec.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_view_debug.test3
-rw-r--r--mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test2
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.test2
-rw-r--r--mysql-test/suite/storage_engine/trx/xa_recovery.test2
-rw-r--r--mysql-test/suite/stress/r/misc.result9
-rw-r--r--mysql-test/suite/stress/t/misc.test32
-rw-r--r--mysql-test/suite/sys_vars/r/debug_dbug_func.result50
-rw-r--r--mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/host_cache_size_auto.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_compression_failure_threshold_pct_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_defragment_fill_factor_n_recs_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_merge_threshold_set_all_debug_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_purge_rseg_truncate_frequency_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result16
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_tmpdir_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/max_sort_length_basic.result36
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_selectivity_sampling_limit_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_basic.result22
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_use_condition_selectivity_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_do_db_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_init_slave_func.result16
-rw-r--r--mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result40
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result4
-rw-r--r--mysql-test/suite/sys_vars/r/unique_checks_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/t/debug_dbug_func.test36
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test13
-rw-r--r--mysql-test/suite/sys_vars/t/max_sort_length_basic.test8
-rw-r--r--mysql-test/suite/sys_vars/t/optimizer_switch_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_db_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_init_slave_func.test32
-rw-r--r--mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test2
-rw-r--r--mysql-test/suite/sys_vars/t/wsrep_on_basic.opt1
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_myisam.result9
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result58
-rw-r--r--mysql-test/suite/vcol/t/vcol_keys_myisam.test11
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test63
-rw-r--r--mysql-test/suite/wsrep/disabled.def1
-rw-r--r--mysql-test/suite/wsrep/my.cnf4
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result38
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result12
-rw-r--r--mysql-test/suite/wsrep/r/trans.result1
-rw-r--r--mysql-test/suite/wsrep/r/variables.result43
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.opt1
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.opt2
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.cnf15
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt (renamed from mysql-test/suite/wsrep/t/mdev_10186.opt)4
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt3
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test1
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.opt2
-rw-r--r--mysql-test/suite/wsrep/t/trans.test1
-rw-r--r--mysql-test/suite/wsrep/t/variables.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/variables.test35
-rw-r--r--mysql-test/t/alter_table.test14
-rw-r--r--mysql-test/t/alter_user.test2
-rw-r--r--mysql-test/t/aria_icp_debug.test5
-rw-r--r--mysql-test/t/blackhole.test16
-rw-r--r--mysql-test/t/bootstrap_innodb.test27
-rw-r--r--mysql-test/t/cache_temporal_4265.test6
-rw-r--r--mysql-test/t/comment_table.test11
-rw-r--r--mysql-test/t/connect_debug.test15
-rw-r--r--mysql-test/t/create_drop_function.test24
-rw-r--r--mysql-test/t/create_or_replace2.test4
-rw-r--r--mysql-test/t/cte_nonrecursive.test20
-rw-r--r--mysql-test/t/cte_recursive.test107
-rw-r--r--mysql-test/t/ctype_binary.test101
-rw-r--r--mysql-test/t/ctype_utf16.test2
-rw-r--r--mysql-test/t/ctype_utf16_uca.test25
-rw-r--r--mysql-test/t/ctype_utf16le.test2
-rw-r--r--mysql-test/t/ctype_utf32.test15
-rw-r--r--mysql-test/t/ctype_utf8.test14
-rw-r--r--mysql-test/t/ctype_utf8mb4.test2
-rw-r--r--mysql-test/t/default_session.test24
-rw-r--r--mysql-test/t/derived_cond_pushdown.test44
-rw-r--r--mysql-test/t/drop_bad_db_type.test6
-rw-r--r--mysql-test/t/empty_server_name-8224.test2
-rw-r--r--mysql-test/t/engine_error_in_alter-8453.test5
-rw-r--r--mysql-test/t/error_simulation.test11
-rw-r--r--mysql-test/t/errors.test21
-rw-r--r--mysql-test/t/events_bugs.test4
-rw-r--r--mysql-test/t/events_restart.test31
-rw-r--r--mysql-test/t/fast_prefix_index_fetch_innodb.test61
-rw-r--r--mysql-test/t/foreign_key.test24
-rw-r--r--mysql-test/t/fulltext.test14
-rw-r--r--mysql-test/t/func_json.test14
-rw-r--r--mysql-test/t/func_math.test93
-rw-r--r--mysql-test/t/func_misc.test15
-rw-r--r--mysql-test/t/func_regexp_pcre.test8
-rw-r--r--mysql-test/t/func_regexp_pcre_debug.test3
-rw-r--r--mysql-test/t/func_test.test17
-rw-r--r--mysql-test/t/func_time.test8
-rw-r--r--mysql-test/t/gis-rtree.test4
-rw-r--r--mysql-test/t/gis.test8
-rw-r--r--mysql-test/t/grant.test37
-rw-r--r--mysql-test/t/grant5.test40
-rw-r--r--mysql-test/t/group_by.test31
-rw-r--r--mysql-test/t/host_cache_size_functionality.test4
-rw-r--r--mysql-test/t/index_merge_innodb.test23
-rw-r--r--mysql-test/t/index_merge_myisam.test51
-rw-r--r--mysql-test/t/information_schema.test25
-rw-r--r--mysql-test/t/init_file_set_password-7656.test2
-rw-r--r--mysql-test/t/innodb_ext_key.combinations5
-rw-r--r--mysql-test/t/innodb_ext_key.test221
-rw-r--r--mysql-test/t/innodb_icp_debug.test6
-rw-r--r--mysql-test/t/insert_debug-master.opt1
-rw-r--r--mysql-test/t/insert_debug.test54
-rw-r--r--mysql-test/t/limit_rows_examined.test17
-rw-r--r--mysql-test/t/locale.opt1
-rw-r--r--mysql-test/t/lock.test14
-rw-r--r--mysql-test/t/lock_view.test76
-rw-r--r--mysql-test/t/log_errchk.test2
-rw-r--r--mysql-test/t/log_slow_debug.test4
-rw-r--r--mysql-test/t/log_tables.test28
-rw-r--r--mysql-test/t/mdev375.test2
-rw-r--r--mysql-test/t/mdev6830.test4
-rw-r--r--mysql-test/t/merge-big.test2
-rw-r--r--mysql-test/t/merge_debug.test2
-rw-r--r--mysql-test/t/multi_update_big.test21
-rw-r--r--mysql-test/t/multi_update_debug.test5
-rw-r--r--mysql-test/t/myisam_debug.test4
-rw-r--r--mysql-test/t/myisam_icp_debug.test1
-rw-r--r--mysql-test/t/mysql_client_test.test2
-rw-r--r--mysql-test/t/mysql_upgrade.test35
-rw-r--r--mysql-test/t/mysqlbinlog_row_minimal.test32
-rw-r--r--mysql-test/t/mysqld--defaults-file.test16
-rw-r--r--mysql-test/t/mysqld--help.test4
-rw-r--r--mysql-test/t/mysqldump.test39
-rw-r--r--mysql-test/t/mysqltest_tracking_info.test24
-rw-r--r--mysql-test/t/nested_profiling.test42
-rw-r--r--mysql-test/t/order_by.test93
-rw-r--r--mysql-test/t/parser.test19
-rw-r--r--mysql-test/t/parser_precedence.test335
-rw-r--r--mysql-test/t/partition.test44
-rw-r--r--mysql-test/t/partition_alter.test41
-rw-r--r--mysql-test/t/partition_innodb.test28
-rw-r--r--mysql-test/t/plugin.test20
-rw-r--r--mysql-test/t/plugin_innodb.test9
-rw-r--r--mysql-test/t/pool_of_threads.test6
-rw-r--r--mysql-test/t/precedence.test4788
-rw-r--r--mysql-test/t/precedence_bugs.test41
-rw-r--r--mysql-test/t/processlist_notembedded.test32
-rw-r--r--mysql-test/t/ps.test17
-rw-r--r--mysql-test/t/query_cache.test17
-rw-r--r--mysql-test/t/range.test104
-rw-r--r--mysql-test/t/range_innodb.test31
-rw-r--r--mysql-test/t/range_interrupted-13751.test4
-rw-r--r--mysql-test/t/repair.test21
-rw-r--r--mysql-test/t/rpl_mysql_upgrade_slave_repo_check.test127
-rw-r--r--mysql-test/t/select_debug.test2
-rw-r--r--mysql-test/t/selectivity.test12
-rw-r--r--mysql-test/t/show_explain.test182
-rw-r--r--mysql-test/t/show_explain_non_select.test8
-rw-r--r--mysql-test/t/show_explain_ps.test5
-rw-r--r--mysql-test/t/slowlog_enospace-10508.test5
-rw-r--r--mysql-test/t/sp-error.test19
-rw-r--r--mysql-test/t/sp2.test37
-rw-r--r--mysql-test/t/ssl_7937.test13
-rw-r--r--mysql-test/t/ssl_8k_key.test3
-rw-r--r--mysql-test/t/ssl_crl.test2
-rw-r--r--mysql-test/t/ssl_crl_clients.test14
-rw-r--r--mysql-test/t/ssl_system_ca.combinations11
-rw-r--r--mysql-test/t/ssl_system_ca.test22
-rw-r--r--mysql-test/t/stat_tables-enospc.test5
-rw-r--r--mysql-test/t/stat_tables_innodb.test20
-rw-r--r--mysql-test/t/stat_tables_partition.test30
-rw-r--r--mysql-test/t/subselect4.test125
-rw-r--r--mysql-test/t/subselect_exists2in.test120
-rw-r--r--mysql-test/t/subselect_innodb.test16
-rw-r--r--mysql-test/t/sum_distinct-big.test32
-rw-r--r--mysql-test/t/temp_table.test19
-rw-r--r--mysql-test/t/temp_table_symlink.test32
-rw-r--r--mysql-test/t/type_date.test24
-rw-r--r--mysql-test/t/type_datetime.test57
-rw-r--r--mysql-test/t/type_float.test14
-rw-r--r--mysql-test/t/type_int.test12
-rw-r--r--mysql-test/t/type_newdecimal.test26
-rw-r--r--mysql-test/t/type_set.test2
-rw-r--r--mysql-test/t/type_time.test43
-rw-r--r--mysql-test/t/udf.test24
-rw-r--r--mysql-test/t/union.test21
-rw-r--r--mysql-test/t/union_crash-714.test4
-rw-r--r--mysql-test/t/uniques_crash-7912.test26
-rw-r--r--mysql-test/t/view.test11
-rw-r--r--mysql-test/t/warnings_debug.test2
-rw-r--r--mysql-test/t/win.test181
-rw-r--r--mysql-test/t/win_ntile.test43
-rw-r--r--mysql-test/unstable-tests949
-rw-r--r--mysys/hash.c13
-rw-r--r--mysys/list.c4
-rw-r--r--mysys/mf_iocache.c14
-rw-r--r--mysys/my_addr_resolve.c39
-rw-r--r--mysys/my_alloc.c4
-rw-r--r--mysys/my_bitmap.c56
-rw-r--r--mysys/my_default.c10
-rw-r--r--mysys/my_error.c2
-rw-r--r--mysys/my_getncpus.c47
-rw-r--r--mysys/my_lib.c18
-rw-r--r--mysys/my_rdtsc.c4
-rw-r--r--mysys/my_sync.c3
-rw-r--r--mysys/my_thr_init.c14
-rw-r--r--mysys/queues.c169
-rw-r--r--mysys/stacktrace.c132
-rw-r--r--mysys_ssl/openssl.c4
-rw-r--r--pcre/AUTHORS6
-rw-r--r--pcre/ChangeLog29
-rw-r--r--pcre/LICENCE6
-rw-r--r--pcre/NEWS6
-rw-r--r--pcre/README9
-rw-r--r--pcre/configure.ac17
-rw-r--r--pcre/doc/html/README.txt9
-rw-r--r--pcre/doc/html/pcre.html2
-rw-r--r--pcre/doc/html/pcreapi.html6
-rw-r--r--pcre/doc/html/pcretest.html24
-rw-r--r--pcre/doc/pcre-config.txt42
-rw-r--r--pcre/doc/pcre.32
-rw-r--r--pcre/doc/pcre.txt3927
-rw-r--r--pcre/doc/pcreapi.36
-rw-r--r--pcre/doc/pcregrep.txt232
-rw-r--r--pcre/doc/pcretest.126
-rw-r--r--pcre/doc/pcretest.txt650
-rw-r--r--pcre/pcre_compile.c30
-rw-r--r--pcre/pcre_jit_compile.c6
-rw-r--r--pcre/pcrecpp.cc4
-rw-r--r--pcre/pcreposix.c5
-rw-r--r--pcre/pcretest.c12
-rw-r--r--pcre/testdata/testinput22
-rw-r--r--pcre/testdata/testoutput23
-rw-r--r--plugin/auth_gssapi/CMakeLists.txt11
-rw-r--r--plugin/auth_gssapi/gssapi_errmsg.cc4
-rw-r--r--plugin/auth_gssapi/gssapi_server.cc2
-rw-r--r--plugin/auth_pam/CMakeLists.txt42
-rw-r--r--plugin/auth_pam/auth_pam.c1
-rw-r--r--plugin/auth_pam/config.h.cmake5
-rw-r--r--plugin/auth_pam/mapper/pam_user_map.c58
-rw-r--r--plugin/auth_pam/mapper/user_map.conf13
-rw-r--r--plugin/disks/information_schema_disks.cc13
-rw-r--r--plugin/disks/mysql-test/disks/disks.result6
-rwxr-xr-xplugin/handler_socket/client/hspool_test.pl2
-rwxr-xr-xplugin/handler_socket/client/hstest.pl2
-rwxr-xr-xplugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test01.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test02.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test03.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test04.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test05.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test06.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test07.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test08.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test09.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test10.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test11.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test12.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test13.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test14.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test15.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test16.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test17.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test18.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test19.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test20.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test21.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test22.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test23.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test24.pl2
-rw-r--r--plugin/server_audit/server_audit.c130
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/my.cnf2
-rw-r--r--scripts/CMakeLists.txt59
-rw-r--r--scripts/galera_recovery.sh3
-rw-r--r--scripts/mysql_install_db.sh5
-rw-r--r--scripts/mysql_system_tables_fix.sql12
-rw-r--r--scripts/mysqld_multi.sh14
-rw-r--r--scripts/mysqld_safe.sh63
-rw-r--r--scripts/mytop.sh2
-rw-r--r--scripts/wsrep_sst_common.sh46
-rw-r--r--scripts/wsrep_sst_mariabackup.sh99
-rw-r--r--scripts/wsrep_sst_rsync.sh12
-rw-r--r--scripts/wsrep_sst_xtrabackup-v2.sh3
-rw-r--r--sql-bench/as3ap.sh2
-rw-r--r--sql-bench/bench-count-distinct.sh2
-rw-r--r--sql-bench/bench-init.pl.sh2
-rw-r--r--sql-bench/compare-results.sh2
-rw-r--r--sql-bench/copy-db.sh2
-rw-r--r--sql-bench/crash-me.sh2
-rwxr-xr-xsql-bench/graph-compare-results.sh2
-rw-r--r--sql-bench/innotest1.sh2
-rw-r--r--sql-bench/innotest1a.sh2
-rw-r--r--sql-bench/innotest1b.sh2
-rw-r--r--sql-bench/innotest2.sh2
-rw-r--r--sql-bench/innotest2a.sh2
-rw-r--r--sql-bench/innotest2b.sh2
-rw-r--r--sql-bench/run-all-tests.sh2
-rw-r--r--sql-bench/server-cfg.sh2
-rw-r--r--sql-bench/test-ATIS.sh2
-rw-r--r--sql-bench/test-alter-table.sh2
-rw-r--r--sql-bench/test-big-tables.sh2
-rw-r--r--sql-bench/test-connect.sh2
-rw-r--r--sql-bench/test-create.sh2
-rw-r--r--sql-bench/test-insert.sh2
-rw-r--r--sql-bench/test-select.sh2
-rwxr-xr-xsql-bench/test-table-elimination.sh2
-rw-r--r--sql-bench/test-transactions.sh2
-rw-r--r--sql-bench/test-wisconsin.sh2
-rw-r--r--sql-common/client.c31
-rw-r--r--sql/CMakeLists.txt9
-rw-r--r--sql/compat56.cc2
-rw-r--r--sql/debug_sync.cc8
-rw-r--r--sql/derror.cc81
-rw-r--r--sql/encryption.cc4
-rw-r--r--sql/event_data_objects.cc2
-rw-r--r--sql/event_db_repository.cc2
-rw-r--r--sql/event_parse_data.cc6
-rw-r--r--sql/event_queue.cc2
-rw-r--r--sql/event_scheduler.cc4
-rw-r--r--sql/events.cc10
-rw-r--r--sql/field.cc133
-rw-r--r--sql/field.h57
-rw-r--r--sql/field_conv.cc2
-rw-r--r--sql/filesort.cc33
-rw-r--r--sql/filesort_utils.cc2
-rw-r--r--sql/gcalc_slicescan.cc2
-rw-r--r--sql/gcalc_slicescan.h6
-rw-r--r--sql/gcalc_tools.cc4
-rw-r--r--sql/gen_win_tzname_data.ps12
-rw-r--r--sql/ha_partition.cc49
-rw-r--r--sql/ha_partition.h6
-rw-r--r--sql/handler.cc60
-rw-r--r--sql/handler.h42
-rw-r--r--sql/item.cc162
-rw-r--r--sql/item.h95
-rw-r--r--sql/item_buff.cc2
-rw-r--r--sql/item_cmpfunc.cc39
-rw-r--r--sql/item_cmpfunc.h13
-rw-r--r--sql/item_create.cc2
-rw-r--r--sql/item_func.cc81
-rw-r--r--sql/item_geofunc.cc33
-rw-r--r--sql/item_inetfunc.cc8
-rw-r--r--sql/item_jsonfunc.cc37
-rw-r--r--sql/item_jsonfunc.h1
-rw-r--r--sql/item_row.cc11
-rw-r--r--sql/item_strfunc.cc6
-rw-r--r--sql/item_strfunc.h10
-rw-r--r--sql/item_subselect.cc63
-rw-r--r--sql/item_subselect.h14
-rw-r--r--sql/item_sum.cc14
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/item_timefunc.cc56
-rw-r--r--sql/item_timefunc.h31
-rw-r--r--sql/item_windowfunc.cc9
-rw-r--r--sql/item_windowfunc.h12
-rw-r--r--sql/item_xmlfunc.cc57
-rw-r--r--sql/key.cc6
-rw-r--r--sql/lex.h2
-rw-r--r--sql/lock.cc2
-rw-r--r--sql/log.cc83
-rw-r--r--sql/log.h15
-rw-r--r--sql/log_event.cc237
-rw-r--r--sql/log_event.h37
-rw-r--r--sql/log_event_old.cc12
-rw-r--r--sql/mf_iocache_encr.cc10
-rw-r--r--sql/my_decimal.h11
-rw-r--r--sql/mysql_install_db.cc22
-rw-r--r--sql/mysqld.cc193
-rw-r--r--sql/net_serv.cc17
-rw-r--r--sql/opt_range.cc56
-rw-r--r--sql/opt_range.h1
-rw-r--r--sql/opt_range_mrr.cc1
-rw-r--r--sql/opt_subselect.cc18
-rw-r--r--sql/protocol.cc8
-rw-r--r--sql/records.cc20
-rw-r--r--sql/records.h1
-rw-r--r--sql/rpl_filter.cc52
-rw-r--r--sql/rpl_gtid.cc4
-rw-r--r--sql/rpl_parallel.cc33
-rw-r--r--sql/rpl_rli.cc73
-rw-r--r--sql/rpl_rli.h21
-rw-r--r--sql/session_tracker.cc16
-rw-r--r--sql/set_var.cc16
-rw-r--r--sql/set_var.h1
-rw-r--r--sql/share/errmsg-utf8.txt406
-rw-r--r--sql/signal_handler.cc2
-rw-r--r--sql/slave.cc111
-rw-r--r--sql/sp.cc4
-rw-r--r--sql/sp_cache.cc2
-rw-r--r--sql/sp_head.cc156
-rw-r--r--sql/sp_head.h17
-rw-r--r--sql/spatial.cc92
-rw-r--r--sql/spatial.h7
-rw-r--r--sql/sql_acl.cc338
-rw-r--r--sql/sql_acl.h2
-rw-r--r--sql/sql_admin.cc60
-rw-r--r--sql/sql_audit.h22
-rw-r--r--sql/sql_base.cc182
-rw-r--r--sql/sql_binlog.cc3
-rw-r--r--sql/sql_cache.cc16
-rw-r--r--sql/sql_class.cc31
-rw-r--r--sql/sql_class.h36
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_cte.cc1
-rw-r--r--sql/sql_derived.cc6
-rw-r--r--sql/sql_insert.cc66
-rw-r--r--sql/sql_lex.cc31
-rw-r--r--sql/sql_lex.h35
-rw-r--r--sql/sql_parse.cc149
-rw-r--r--sql/sql_partition.cc30
-rw-r--r--sql/sql_plugin.cc45
-rw-r--r--sql/sql_plugin_services.ic3
-rw-r--r--sql/sql_prepare.cc224
-rw-r--r--sql/sql_repl.cc80
-rw-r--r--sql/sql_select.cc151
-rw-r--r--sql/sql_select.h12
-rw-r--r--sql/sql_show.cc110
-rw-r--r--sql/sql_statistics.cc319
-rw-r--r--sql/sql_statistics.h19
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_string.h9
-rw-r--r--sql/sql_table.cc103
-rw-r--r--sql/sql_test.cc6
-rw-r--r--sql/sql_time.cc27
-rw-r--r--sql/sql_time.h9
-rw-r--r--sql/sql_trigger.cc17
-rw-r--r--sql/sql_type.h2
-rw-r--r--sql/sql_type_int.h20
-rw-r--r--sql/sql_udf.cc159
-rw-r--r--sql/sql_udf.h8
-rw-r--r--sql/sql_union.cc32
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/sql_view.cc5
-rw-r--r--sql/sql_window.cc11
-rw-r--r--sql/sql_yacc.yy123
-rw-r--r--sql/sys_vars.cc17
-rw-r--r--sql/sys_vars.ic13
-rw-r--r--sql/table.cc213
-rw-r--r--sql/table.h120
-rw-r--r--sql/temporary_tables.cc9
-rw-r--r--sql/threadpool_common.cc25
-rw-r--r--sql/threadpool_generic.cc13
-rw-r--r--sql/transaction.cc6
-rw-r--r--sql/tztime.cc34
-rw-r--r--sql/uniques.cc10
-rw-r--r--sql/uniques.h15
-rw-r--r--sql/unireg.cc26
-rw-r--r--sql/win_tzname_data.h8
-rw-r--r--sql/winservice.c66
-rw-r--r--sql/wsrep_applier.cc4
-rw-r--r--sql/wsrep_binlog.cc14
-rw-r--r--sql/wsrep_binlog.h2
-rw-r--r--sql/wsrep_dummy.cc10
-rw-r--r--sql/wsrep_hton.cc75
-rw-r--r--sql/wsrep_mysqld.cc81
-rw-r--r--sql/wsrep_mysqld.h21
-rw-r--r--sql/wsrep_sst.cc62
-rw-r--r--sql/wsrep_thd.cc188
-rw-r--r--sql/wsrep_thd.h6
-rw-r--r--sql/wsrep_utils.cc4
-rw-r--r--sql/wsrep_utils.h2
-rw-r--r--sql/wsrep_var.cc14
-rw-r--r--storage/blackhole/ha_blackhole.h5
-rw-r--r--storage/connect/json.cpp318
-rw-r--r--storage/connect/json.h45
-rw-r--r--storage/connect/jsonudf.cpp40
-rw-r--r--storage/connect/jsonudf.h2
-rw-r--r--storage/connect/mysql-test/connect/r/xml.result98
-rw-r--r--storage/connect/tabjson.cpp49
-rw-r--r--storage/connect/tabjson.h2
-rw-r--r--storage/connect/tabrest.cpp11
-rw-r--r--storage/innobase/CMakeLists.txt1
-rw-r--r--storage/innobase/btr/btr0btr.cc102
-rw-r--r--storage/innobase/btr/btr0bulk.cc137
-rw-r--r--storage/innobase/btr/btr0cur.cc514
-rw-r--r--storage/innobase/btr/btr0defragment.cc14
-rw-r--r--storage/innobase/btr/btr0pcur.cc65
-rw-r--r--storage/innobase/btr/btr0scrub.cc2
-rw-r--r--storage/innobase/btr/btr0sea.cc645
-rw-r--r--storage/innobase/buf/buf0block_hint.cc78
-rw-r--r--storage/innobase/buf/buf0buddy.cc43
-rw-r--r--storage/innobase/buf/buf0buf.cc577
-rw-r--r--storage/innobase/buf/buf0dblwr.cc165
-rw-r--r--storage/innobase/buf/buf0dump.cc13
-rw-r--r--storage/innobase/buf/buf0flu.cc66
-rw-r--r--storage/innobase/buf/buf0lru.cc280
-rw-r--r--storage/innobase/buf/buf0rea.cc38
-rw-r--r--storage/innobase/data/data0data.cc47
-rw-r--r--storage/innobase/dict/dict0boot.cc2
-rw-r--r--storage/innobase/dict/dict0crea.cc71
-rw-r--r--storage/innobase/dict/dict0dict.cc356
-rw-r--r--storage/innobase/dict/dict0load.cc20
-rw-r--r--storage/innobase/dict/dict0mem.cc150
-rw-r--r--storage/innobase/dict/dict0stats.cc369
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc14
-rw-r--r--storage/innobase/eval/eval0eval.cc295
-rw-r--r--storage/innobase/fil/fil0crypt.cc207
-rw-r--r--storage/innobase/fil/fil0fil.cc368
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc16
-rw-r--r--storage/innobase/fsp/fsp0file.cc21
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc290
-rw-r--r--storage/innobase/fts/fts0ast.cc8
-rw-r--r--storage/innobase/fts/fts0config.cc20
-rw-r--r--storage/innobase/fts/fts0fts.cc1852
-rw-r--r--storage/innobase/fts/fts0opt.cc101
-rw-r--r--storage/innobase/fts/fts0que.cc97
-rw-r--r--storage/innobase/fts/fts0sql.cc11
-rw-r--r--storage/innobase/gis/gis0geo.cc55
-rw-r--r--storage/innobase/gis/gis0rtree.cc71
-rw-r--r--storage/innobase/gis/gis0sea.cc293
-rw-r--r--storage/innobase/handler/ha_innodb.cc861
-rw-r--r--storage/innobase/handler/ha_innodb.h25
-rw-r--r--storage/innobase/handler/ha_xtradb.h23
-rw-r--r--storage/innobase/handler/handler0alter.cc105
-rw-r--r--storage/innobase/handler/i_s.cc134
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc102
-rw-r--r--storage/innobase/include/btr0btr.h11
-rw-r--r--storage/innobase/include/btr0btr.ic2
-rw-r--r--storage/innobase/include/btr0bulk.h10
-rw-r--r--storage/innobase/include/btr0cur.h85
-rw-r--r--storage/innobase/include/btr0defragment.h2
-rw-r--r--storage/innobase/include/btr0pcur.h22
-rw-r--r--storage/innobase/include/btr0pcur.ic8
-rw-r--r--storage/innobase/include/btr0sea.h72
-rw-r--r--storage/innobase/include/btr0sea.ic41
-rw-r--r--storage/innobase/include/buf0block_hint.h77
-rw-r--r--storage/innobase/include/buf0buf.h98
-rw-r--r--storage/innobase/include/buf0buf.ic49
-rw-r--r--storage/innobase/include/buf0lru.h11
-rw-r--r--storage/innobase/include/data0data.h6
-rw-r--r--storage/innobase/include/data0data.ic20
-rw-r--r--storage/innobase/include/dict0crea.h10
-rw-r--r--storage/innobase/include/dict0dict.h43
-rw-r--r--storage/innobase/include/dict0dict.ic10
-rw-r--r--storage/innobase/include/dict0load.h10
-rw-r--r--storage/innobase/include/dict0mem.h267
-rw-r--r--storage/innobase/include/dict0stats.h12
-rw-r--r--storage/innobase/include/dict0stats.ic50
-rw-r--r--storage/innobase/include/dyn0buf.h96
-rw-r--r--storage/innobase/include/fil0fil.h136
-rw-r--r--storage/innobase/include/fsp0fsp.h113
-rw-r--r--storage/innobase/include/fts0ast.h2
-rw-r--r--storage/innobase/include/fts0fts.h56
-rw-r--r--storage/innobase/include/fts0priv.h8
-rw-r--r--storage/innobase/include/fts0priv.ic10
-rw-r--r--storage/innobase/include/fts0types.h23
-rw-r--r--storage/innobase/include/fts0types.ic11
-rw-r--r--storage/innobase/include/gis0geo.h13
-rw-r--r--storage/innobase/include/gis0rtree.h39
-rw-r--r--storage/innobase/include/gis0rtree.ic22
-rw-r--r--storage/innobase/include/gis0type.h8
-rw-r--r--storage/innobase/include/ha_prototypes.h23
-rw-r--r--storage/innobase/include/handler0alter.h4
-rw-r--r--storage/innobase/include/hash0hash.h12
-rw-r--r--storage/innobase/include/ib0mutex.h6
-rw-r--r--storage/innobase/include/lock0lock.h19
-rw-r--r--storage/innobase/include/lock0priv.h3
-rw-r--r--storage/innobase/include/lock0priv.ic2
-rw-r--r--storage/innobase/include/log0log.h25
-rw-r--r--storage/innobase/include/log0log.ic25
-rw-r--r--storage/innobase/include/log0recv.h85
-rw-r--r--storage/innobase/include/mem0mem.h11
-rw-r--r--storage/innobase/include/mem0mem.ic34
-rw-r--r--storage/innobase/include/mtr0mtr.h12
-rw-r--r--storage/innobase/include/mtr0mtr.ic8
-rw-r--r--storage/innobase/include/mtr0types.h7
-rw-r--r--storage/innobase/include/os0file.h3
-rw-r--r--storage/innobase/include/os0once.h118
-rw-r--r--storage/innobase/include/page0cur.h15
-rw-r--r--storage/innobase/include/page0cur.ic4
-rw-r--r--storage/innobase/include/page0page.h41
-rw-r--r--storage/innobase/include/page0page.ic30
-rw-r--r--storage/innobase/include/page0size.h2
-rw-r--r--storage/innobase/include/page0types.h3
-rw-r--r--storage/innobase/include/page0zip.h25
-rw-r--r--storage/innobase/include/page0zip.ic4
-rw-r--r--storage/innobase/include/pars0grm.h158
-rw-r--r--storage/innobase/include/pars0pars.h35
-rw-r--r--storage/innobase/include/que0que.h15
-rw-r--r--storage/innobase/include/que0que.ic15
-rw-r--r--storage/innobase/include/rem0cmp.h68
-rw-r--r--storage/innobase/include/rem0cmp.ic35
-rw-r--r--storage/innobase/include/rem0rec.h147
-rw-r--r--storage/innobase/include/rem0rec.ic123
-rw-r--r--storage/innobase/include/rem0types.h4
-rw-r--r--storage/innobase/include/row0ftsort.h3
-rw-r--r--storage/innobase/include/row0ins.h15
-rw-r--r--storage/innobase/include/row0log.h8
-rw-r--r--storage/innobase/include/row0merge.h16
-rw-r--r--storage/innobase/include/row0mysql.h42
-rw-r--r--storage/innobase/include/row0row.h24
-rw-r--r--storage/innobase/include/row0row.ic8
-rw-r--r--storage/innobase/include/row0upd.h55
-rw-r--r--storage/innobase/include/row0upd.ic2
-rw-r--r--storage/innobase/include/row0vers.h6
-rw-r--r--storage/innobase/include/span.h145
-rw-r--r--storage/innobase/include/srv0mon.h10
-rw-r--r--storage/innobase/include/srv0srv.h24
-rw-r--r--storage/innobase/include/srv0start.h2
-rw-r--r--storage/innobase/include/sync0rw.h8
-rw-r--r--storage/innobase/include/sync0sync.h5
-rw-r--r--storage/innobase/include/sync0types.h16
-rw-r--r--storage/innobase/include/trx0rec.h4
-rw-r--r--storage/innobase/include/trx0roll.h11
-rw-r--r--storage/innobase/include/trx0trx.h32
-rw-r--r--storage/innobase/include/trx0undo.h2
-rw-r--r--storage/innobase/include/univ.i61
-rw-r--r--storage/innobase/include/ut0mutex.h16
-rw-r--r--storage/innobase/include/ut0pool.h23
-rw-r--r--storage/innobase/include/ut0rnd.h79
-rw-r--r--storage/innobase/include/ut0rnd.ic94
-rw-r--r--storage/innobase/include/ut0ut.h85
-rw-r--r--storage/innobase/innodb.cmake8
-rw-r--r--storage/innobase/lock/lock0lock.cc380
-rw-r--r--storage/innobase/lock/lock0wait.cc10
-rw-r--r--storage/innobase/log/log0log.cc22
-rw-r--r--storage/innobase/log/log0recv.cc478
-rw-r--r--storage/innobase/mem/mem0mem.cc14
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc87
-rw-r--r--storage/innobase/os/os0file.cc147
-rw-r--r--storage/innobase/os/os0proc.cc15
-rw-r--r--storage/innobase/os/os0thread.cc10
-rw-r--r--storage/innobase/page/page0cur.cc171
-rw-r--r--storage/innobase/page/page0page.cc116
-rw-r--r--storage/innobase/page/page0zip.cc269
-rw-r--r--storage/innobase/pars/lexyy.cc1166
-rw-r--r--storage/innobase/pars/pars0grm.cc2116
-rw-r--r--storage/innobase/pars/pars0grm.y118
-rw-r--r--storage/innobase/pars/pars0lex.l84
-rw-r--r--storage/innobase/pars/pars0pars.cc144
-rw-r--r--storage/innobase/que/que0que.cc4
-rw-r--r--storage/innobase/rem/rem0cmp.cc114
-rw-r--r--storage/innobase/rem/rem0rec.cc123
-rw-r--r--storage/innobase/row/row0ext.cc6
-rw-r--r--storage/innobase/row/row0ftsort.cc52
-rw-r--r--storage/innobase/row/row0import.cc211
-rw-r--r--storage/innobase/row/row0ins.cc352
-rw-r--r--storage/innobase/row/row0log.cc101
-rw-r--r--storage/innobase/row/row0merge.cc175
-rw-r--r--storage/innobase/row/row0mysql.cc207
-rw-r--r--storage/innobase/row/row0purge.cc36
-rw-r--r--storage/innobase/row/row0row.cc39
-rw-r--r--storage/innobase/row/row0sel.cc412
-rw-r--r--storage/innobase/row/row0trunc.cc13
-rw-r--r--storage/innobase/row/row0uins.cc10
-rw-r--r--storage/innobase/row/row0umod.cc30
-rw-r--r--storage/innobase/row/row0undo.cc23
-rw-r--r--storage/innobase/row/row0upd.cc291
-rw-r--r--storage/innobase/row/row0vers.cc98
-rw-r--r--storage/innobase/srv/srv0conc.cc11
-rw-r--r--storage/innobase/srv/srv0srv.cc66
-rw-r--r--storage/innobase/srv/srv0start.cc51
-rw-r--r--storage/innobase/sync/sync0arr.cc8
-rw-r--r--storage/innobase/sync/sync0debug.cc32
-rw-r--r--storage/innobase/sync/sync0rw.cc56
-rw-r--r--storage/innobase/sync/sync0sync.cc5
-rw-r--r--storage/innobase/trx/trx0i_s.cc15
-rw-r--r--storage/innobase/trx/trx0purge.cc13
-rw-r--r--storage/innobase/trx/trx0rec.cc43
-rw-r--r--storage/innobase/trx/trx0roll.cc80
-rw-r--r--storage/innobase/trx/trx0rseg.cc8
-rw-r--r--storage/innobase/trx/trx0sys.cc4
-rw-r--r--storage/innobase/trx/trx0trx.cc249
-rw-r--r--storage/innobase/trx/trx0undo.cc9
-rw-r--r--storage/innobase/ut/ut0crc32.cc27
-rw-r--r--storage/innobase/ut/ut0rnd.cc7
-rw-r--r--storage/innobase/ut/ut0ut.cc18
-rw-r--r--storage/maria/ha_maria.cc2
-rw-r--r--storage/maria/ma_bitmap.c1
-rw-r--r--storage/maria/ma_check.c1
-rw-r--r--storage/maria/ma_close.c3
-rw-r--r--storage/maria/ma_create.c9
-rw-r--r--storage/maria/ma_loghandler.c10
-rw-r--r--storage/maria/ma_packrec.c49
-rw-r--r--storage/maria/ma_page.c3
-rw-r--r--storage/maria/ma_pagecrc.c3
-rw-r--r--storage/maria/ma_recovery.c21
-rw-r--r--storage/maria/ma_write.c15
-rw-r--r--storage/maria/maria_pack.c16
-rw-r--r--storage/mroonga/mrn_table.cpp2
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result2
-rw-r--r--storage/mroonga/vendor/groonga/lib/db.c3
-rw-r--r--storage/mroonga/vendor/groonga/lib/grn_tokenizers.h1
-rw-r--r--storage/mroonga/vendor/groonga/lib/tokenizers.c30
-rw-r--r--storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c11
-rwxr-xr-xstorage/myisam/ftbench/Ecompare.pl2
-rwxr-xr-xstorage/myisam/ftbench/Ecreate.pl2
-rwxr-xr-xstorage/myisam/ftbench/Ereport.pl2
-rw-r--r--storage/myisam/mi_check.c6
-rw-r--r--storage/myisam/mi_close.c4
-rw-r--r--storage/myisam/mi_create.c9
-rw-r--r--storage/myisam/mi_packrec.c49
-rw-r--r--storage/myisammrg/myrg_extra.c2
-rw-r--r--storage/myisammrg/myrg_open.c13
-rw-r--r--storage/perfschema/CMakeLists.txt15
-rw-r--r--storage/perfschema/cursor_by_account.cc13
-rw-r--r--storage/perfschema/cursor_by_account.h13
-rw-r--r--storage/perfschema/cursor_by_host.cc13
-rw-r--r--storage/perfschema/cursor_by_host.h13
-rw-r--r--storage/perfschema/cursor_by_thread.cc13
-rw-r--r--storage/perfschema/cursor_by_thread.h13
-rw-r--r--storage/perfschema/cursor_by_thread_connect_attr.cc13
-rw-r--r--storage/perfschema/cursor_by_thread_connect_attr.h13
-rw-r--r--storage/perfschema/cursor_by_user.cc13
-rw-r--r--storage/perfschema/cursor_by_user.h13
-rw-r--r--storage/perfschema/gen_pfs_lex_token.cc13
-rw-r--r--storage/perfschema/ha_perfschema.cc13
-rw-r--r--storage/perfschema/ha_perfschema.h13
-rw-r--r--storage/perfschema/pfs.cc13
-rw-r--r--storage/perfschema/pfs.h13
-rw-r--r--storage/perfschema/pfs_account.cc13
-rw-r--r--storage/perfschema/pfs_account.h13
-rw-r--r--storage/perfschema/pfs_atomic.h13
-rw-r--r--storage/perfschema/pfs_autosize.cc13
-rw-r--r--storage/perfschema/pfs_column_types.h13
-rw-r--r--storage/perfschema/pfs_column_values.cc13
-rw-r--r--storage/perfschema/pfs_column_values.h13
-rw-r--r--storage/perfschema/pfs_con_slice.cc13
-rw-r--r--storage/perfschema/pfs_con_slice.h13
-rw-r--r--storage/perfschema/pfs_defaults.cc13
-rw-r--r--storage/perfschema/pfs_defaults.h13
-rw-r--r--storage/perfschema/pfs_digest.cc13
-rw-r--r--storage/perfschema/pfs_digest.h13
-rw-r--r--storage/perfschema/pfs_engine_table.cc13
-rw-r--r--storage/perfschema/pfs_engine_table.h13
-rw-r--r--storage/perfschema/pfs_events.h13
-rw-r--r--storage/perfschema/pfs_events_stages.cc13
-rw-r--r--storage/perfschema/pfs_events_stages.h13
-rw-r--r--storage/perfschema/pfs_events_statements.cc13
-rw-r--r--storage/perfschema/pfs_events_statements.h13
-rw-r--r--storage/perfschema/pfs_events_waits.cc13
-rw-r--r--storage/perfschema/pfs_events_waits.h13
-rw-r--r--storage/perfschema/pfs_global.cc13
-rw-r--r--storage/perfschema/pfs_global.h13
-rw-r--r--storage/perfschema/pfs_host.cc13
-rw-r--r--storage/perfschema/pfs_host.h13
-rw-r--r--storage/perfschema/pfs_instr.cc13
-rw-r--r--storage/perfschema/pfs_instr.h13
-rw-r--r--storage/perfschema/pfs_instr_class.cc15
-rw-r--r--storage/perfschema/pfs_instr_class.h13
-rw-r--r--storage/perfschema/pfs_lock.h13
-rw-r--r--storage/perfschema/pfs_server.cc13
-rw-r--r--storage/perfschema/pfs_server.h13
-rw-r--r--storage/perfschema/pfs_setup_actor.cc13
-rw-r--r--storage/perfschema/pfs_setup_actor.h13
-rw-r--r--storage/perfschema/pfs_setup_object.cc13
-rw-r--r--storage/perfschema/pfs_setup_object.h13
-rw-r--r--storage/perfschema/pfs_stat.h13
-rw-r--r--storage/perfschema/pfs_timer.cc13
-rw-r--r--storage/perfschema/pfs_timer.h13
-rw-r--r--storage/perfschema/pfs_user.cc13
-rw-r--r--storage/perfschema/pfs_user.h13
-rw-r--r--storage/perfschema/pfs_visitor.cc13
-rw-r--r--storage/perfschema/pfs_visitor.h13
-rw-r--r--storage/perfschema/table_accounts.cc13
-rw-r--r--storage/perfschema/table_accounts.h13
-rw-r--r--storage/perfschema/table_all_instr.cc13
-rw-r--r--storage/perfschema/table_all_instr.h13
-rw-r--r--storage/perfschema/table_esgs_by_account_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esgs_by_account_by_event_name.h13
-rw-r--r--storage/perfschema/table_esgs_by_host_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esgs_by_host_by_event_name.h13
-rw-r--r--storage/perfschema/table_esgs_by_thread_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esgs_by_thread_by_event_name.h13
-rw-r--r--storage/perfschema/table_esgs_by_user_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esgs_by_user_by_event_name.h13
-rw-r--r--storage/perfschema/table_esgs_global_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esgs_global_by_event_name.h13
-rw-r--r--storage/perfschema/table_esms_by_account_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esms_by_account_by_event_name.h13
-rw-r--r--storage/perfschema/table_esms_by_digest.cc13
-rw-r--r--storage/perfschema/table_esms_by_digest.h13
-rw-r--r--storage/perfschema/table_esms_by_host_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esms_by_host_by_event_name.h13
-rw-r--r--storage/perfschema/table_esms_by_thread_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esms_by_thread_by_event_name.h13
-rw-r--r--storage/perfschema/table_esms_by_user_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esms_by_user_by_event_name.h13
-rw-r--r--storage/perfschema/table_esms_global_by_event_name.cc13
-rw-r--r--storage/perfschema/table_esms_global_by_event_name.h13
-rw-r--r--storage/perfschema/table_events_stages.cc13
-rw-r--r--storage/perfschema/table_events_stages.h13
-rw-r--r--storage/perfschema/table_events_statements.cc13
-rw-r--r--storage/perfschema/table_events_statements.h13
-rw-r--r--storage/perfschema/table_events_waits.cc13
-rw-r--r--storage/perfschema/table_events_waits.h13
-rw-r--r--storage/perfschema/table_events_waits_summary.cc13
-rw-r--r--storage/perfschema/table_events_waits_summary.h13
-rw-r--r--storage/perfschema/table_ews_by_account_by_event_name.cc13
-rw-r--r--storage/perfschema/table_ews_by_account_by_event_name.h13
-rw-r--r--storage/perfschema/table_ews_by_host_by_event_name.cc13
-rw-r--r--storage/perfschema/table_ews_by_host_by_event_name.h13
-rw-r--r--storage/perfschema/table_ews_by_thread_by_event_name.cc13
-rw-r--r--storage/perfschema/table_ews_by_thread_by_event_name.h13
-rw-r--r--storage/perfschema/table_ews_by_user_by_event_name.cc13
-rw-r--r--storage/perfschema/table_ews_by_user_by_event_name.h13
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.cc13
-rw-r--r--storage/perfschema/table_ews_global_by_event_name.h13
-rw-r--r--storage/perfschema/table_file_instances.cc13
-rw-r--r--storage/perfschema/table_file_instances.h13
-rw-r--r--storage/perfschema/table_file_summary_by_event_name.cc13
-rw-r--r--storage/perfschema/table_file_summary_by_event_name.h13
-rw-r--r--storage/perfschema/table_file_summary_by_instance.cc13
-rw-r--r--storage/perfschema/table_file_summary_by_instance.h13
-rw-r--r--storage/perfschema/table_helper.cc13
-rw-r--r--storage/perfschema/table_helper.h13
-rw-r--r--storage/perfschema/table_host_cache.cc13
-rw-r--r--storage/perfschema/table_host_cache.h13
-rw-r--r--storage/perfschema/table_hosts.cc13
-rw-r--r--storage/perfschema/table_hosts.h13
-rw-r--r--storage/perfschema/table_os_global_by_type.cc13
-rw-r--r--storage/perfschema/table_os_global_by_type.h13
-rw-r--r--storage/perfschema/table_performance_timers.cc13
-rw-r--r--storage/perfschema/table_performance_timers.h13
-rw-r--r--storage/perfschema/table_session_account_connect_attrs.cc13
-rw-r--r--storage/perfschema/table_session_account_connect_attrs.h13
-rw-r--r--storage/perfschema/table_session_connect.cc13
-rw-r--r--storage/perfschema/table_session_connect.h13
-rw-r--r--storage/perfschema/table_session_connect_attrs.cc13
-rw-r--r--storage/perfschema/table_session_connect_attrs.h13
-rw-r--r--storage/perfschema/table_setup_actors.cc13
-rw-r--r--storage/perfschema/table_setup_actors.h13
-rw-r--r--storage/perfschema/table_setup_consumers.cc13
-rw-r--r--storage/perfschema/table_setup_consumers.h13
-rw-r--r--storage/perfschema/table_setup_instruments.cc13
-rw-r--r--storage/perfschema/table_setup_instruments.h13
-rw-r--r--storage/perfschema/table_setup_objects.cc13
-rw-r--r--storage/perfschema/table_setup_objects.h13
-rw-r--r--storage/perfschema/table_setup_timers.cc13
-rw-r--r--storage/perfschema/table_setup_timers.h13
-rw-r--r--storage/perfschema/table_socket_instances.cc13
-rw-r--r--storage/perfschema/table_socket_instances.h13
-rw-r--r--storage/perfschema/table_socket_summary_by_event_name.cc13
-rw-r--r--storage/perfschema/table_socket_summary_by_event_name.h13
-rw-r--r--storage/perfschema/table_socket_summary_by_instance.cc13
-rw-r--r--storage/perfschema/table_socket_summary_by_instance.h13
-rw-r--r--storage/perfschema/table_sync_instances.cc13
-rw-r--r--storage/perfschema/table_sync_instances.h13
-rw-r--r--storage/perfschema/table_threads.cc13
-rw-r--r--storage/perfschema/table_threads.h13
-rw-r--r--storage/perfschema/table_tiws_by_index_usage.cc13
-rw-r--r--storage/perfschema/table_tiws_by_index_usage.h13
-rw-r--r--storage/perfschema/table_tiws_by_table.cc13
-rw-r--r--storage/perfschema/table_tiws_by_table.h13
-rw-r--r--storage/perfschema/table_tlws_by_table.cc13
-rw-r--r--storage/perfschema/table_tlws_by_table.h13
-rw-r--r--storage/perfschema/table_users.cc13
-rw-r--r--storage/perfschema/table_users.h13
-rw-r--r--storage/perfschema/unittest/CMakeLists.txt15
-rw-r--r--storage/perfschema/unittest/conf.txt13
-rw-r--r--storage/perfschema/unittest/pfs-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_account-oom-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_connect_attr-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_host-oom-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_instr-oom-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_instr-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-oom-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_instr_class-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_misc-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_server_stubs.cc13
-rw-r--r--storage/perfschema/unittest/pfs_timer-t.cc13
-rw-r--r--storage/perfschema/unittest/pfs_user-oom-t.cc13
-rw-r--r--storage/perfschema/unittest/stub_pfs_defaults.h13
-rw-r--r--storage/perfschema/unittest/stub_pfs_global.h13
-rw-r--r--storage/perfschema/unittest/stub_print_error.h13
-rw-r--r--storage/rocksdb/CMakeLists.txt12
-rw-r--r--storage/rocksdb/build_rocksdb.cmake123
-rw-r--r--storage/rocksdb/ha_rocksdb.cc8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/include/restart_mysqld_with_option.inc2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/check_ignore_unknown_options.test2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/concurrent_alter.test2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/insert_optimized_config.test4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mysqldump2.test2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/optimize_table.test2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/persistent_cache.test4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/shutdown.test2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/validate_datadic.test8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_compaction_readahead_size_basic.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_force_index_records_in_range_basic.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_rate_limiter_bytes_per_sec_basic.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test4
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
m---------storage/rocksdb/rocksdb0
-rw-r--r--storage/rocksdb/ut0counter.h12
-rw-r--r--storage/spider/ha_spider.cc179
-rw-r--r--storage/spider/mysql-test/spider/r/pushdown_not_like.result63
-rw-r--r--storage/spider/mysql-test/spider/t/pushdown_not_like.test138
-rw-r--r--storage/spider/spd_conn.cc22
-rw-r--r--storage/spider/spd_db_conn.cc772
-rw-r--r--storage/spider/spd_db_include.h2
-rw-r--r--storage/spider/spd_db_mysql.cc613
-rw-r--r--storage/spider/spd_db_oracle.cc492
-rw-r--r--storage/spider/spd_include.h4
-rw-r--r--storage/spider/spd_table.cc7
-rw-r--r--storage/tokudb/CMakeLists.txt5
-rw-r--r--storage/tokudb/PerconaFT/DartConfig.cmake10
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake2
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake29
-rw-r--r--storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc10
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-flusher.cc44
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-internal.h21
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.cc56
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.h4
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-recount-rows.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-test-helpers.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-verify.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/ft.cc28
-rw-r--r--storage/tokudb/PerconaFT/ft/ft.h10
-rw-r--r--storage/tokudb/PerconaFT/ft/logger/logger.cc15
-rw-r--r--storage/tokudb/PerconaFT/ft/node.cc18
-rw-r--r--storage/tokudb/PerconaFT/ft/node.h21
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/block_table.cc4
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft-node-deserialize.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc12
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h1
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc10
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/ft-serialize-benchmark.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/ft-serialize-test.cc14
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/ft-test-header.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/make-tree.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/mempool-115.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/msnfilter.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/recovery-test5123.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc4
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc8
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc8
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-dirty-flushes-on-cleaner.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-flushes-on-cleaner.cc6
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test-pick-child-to-flush.cc20
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/test3884.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-bad-msn.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-bad-pivots.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-dup-in-leaf.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-dup-pivots.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-misrouted-msgs.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-unsorted-leaf.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/tests/verify-unsorted-pivots.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/rollback.cc4
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/txn.cc4
-rw-r--r--storage/tokudb/PerconaFT/ftcxx/cursor.hpp4
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.cc4
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc2
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc2
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc2
-rw-r--r--storage/tokudb/PerconaFT/portability/portability.cc2
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc9
l---------storage/tokudb/PerconaFT/scripts/tokuvalgrind1
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test.h4
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_mostly_seq.cc2
-rw-r--r--storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h6
-rw-r--r--storage/tokudb/PerconaFT/src/ydb.cc56
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_db.cc8
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_db.h1
-rw-r--r--storage/tokudb/PerconaFT/tools/tokuftdump.cc2
-rw-r--r--storage/tokudb/ha_tokudb.cc4
-rw-r--r--storage/tokudb/man/CMakeLists.txt2
-rw-r--r--storage/tokudb/man/tokuft_logprint.1 (renamed from man/tokuft_logprint.1)0
-rw-r--r--storage/tokudb/man/tokuftdump.1 (renamed from man/tokuftdump.1)0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb-slave.opt4
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result8
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/r/partition_syntax_tokudb.result74
-rw-r--r--storage/tokudb/tokudb_status.h4
-rw-r--r--storage/xtradb/CMakeLists.txt5
-rw-r--r--storage/xtradb/btr/btr0cur.cc18
-rw-r--r--storage/xtradb/buf/buf0buf.cc19
-rw-r--r--storage/xtradb/buf/buf0dblwr.cc18
-rw-r--r--storage/xtradb/buf/buf0dump.cc8
-rw-r--r--storage/xtradb/buf/buf0flu.cc9
-rw-r--r--storage/xtradb/buf/buf0lru.cc4
-rw-r--r--storage/xtradb/buf/buf0rea.cc65
-rw-r--r--storage/xtradb/dict/dict0dict.cc7
-rw-r--r--storage/xtradb/dict/dict0mem.cc66
-rw-r--r--storage/xtradb/fil/fil0crypt.cc181
-rw-r--r--storage/xtradb/fil/fil0fil.cc160
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc14
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc99
-rw-r--r--storage/xtradb/fts/fts0fts.cc87
-rw-r--r--storage/xtradb/fts/fts0que.cc19
-rw-r--r--storage/xtradb/handler/ha_innodb.cc266
-rw-r--r--storage/xtradb/handler/handler0alter.cc6
-rw-r--r--storage/xtradb/handler/i_s.cc30
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc71
-rw-r--r--storage/xtradb/include/buf0buf.h4
-rw-r--r--storage/xtradb/include/dict0dict.ic8
-rw-r--r--storage/xtradb/include/dict0mem.h4
-rw-r--r--storage/xtradb/include/fil0fil.h51
-rw-r--r--storage/xtradb/include/fts0ast.h15
-rw-r--r--storage/xtradb/include/fts0fts.h12
-rw-r--r--storage/xtradb/include/lock0lock.h3
-rw-r--r--storage/xtradb/include/mtr0mtr.h12
-rw-r--r--storage/xtradb/include/mtr0mtr.ic15
-rw-r--r--storage/xtradb/include/page0page.h17
-rw-r--r--storage/xtradb/include/sync0rw.h8
-rw-r--r--storage/xtradb/include/trx0trx.h14
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/lock/lock0lock.cc13
-rw-r--r--storage/xtradb/lock/lock0wait.cc7
-rw-r--r--storage/xtradb/mtr/mtr0mtr.cc10
-rw-r--r--storage/xtradb/os/os0file.cc1
-rw-r--r--storage/xtradb/page/page0cur.cc47
-rw-r--r--storage/xtradb/page/page0page.cc40
-rw-r--r--storage/xtradb/page/page0zip.cc37
-rw-r--r--storage/xtradb/row/row0import.cc32
-rw-r--r--storage/xtradb/row/row0ins.cc45
-rw-r--r--storage/xtradb/row/row0mysql.cc17
-rw-r--r--storage/xtradb/row/row0sel.cc32
-rw-r--r--storage/xtradb/row/row0upd.cc4
-rw-r--r--storage/xtradb/srv/srv0conc.cc11
-rw-r--r--storage/xtradb/srv/srv0srv.cc3
-rw-r--r--storage/xtradb/srv/srv0start.cc10
-rw-r--r--storage/xtradb/sync/sync0arr.cc4
-rw-r--r--storage/xtradb/trx/trx0roll.cc11
-rw-r--r--storage/xtradb/trx/trx0rseg.cc6
-rw-r--r--storage/xtradb/trx/trx0sys.cc4
-rw-r--r--storage/xtradb/trx/trx0trx.cc8
-rw-r--r--strings/ctype-mb.c6
-rw-r--r--strings/ctype-simple.c3
-rw-r--r--strings/ctype-ucs2.c2
-rw-r--r--strings/ctype-utf8.c26
-rw-r--r--strings/decimal.c18
-rw-r--r--strings/json_lib.c2
-rw-r--r--strings/my_strtoll10.c17
-rw-r--r--strings/my_vsnprintf.c105
-rw-r--r--support-files/CMakeLists.txt37
-rw-r--r--support-files/mariadb.pc.in2
-rw-r--r--support-files/mariadb.service.in13
-rw-r--r--support-files/mariadb@.service.in15
-rw-r--r--support-files/rpm/my.cnf4
-rw-r--r--support-files/use_galera_new_cluster.conf2
-rwxr-xr-xtests/big_record.pl2
-rwxr-xr-xtests/drop_test.pl2
-rwxr-xr-xtests/export.pl2
-rwxr-xr-xtests/fork2_test.pl2
-rwxr-xr-xtests/fork_big.pl2
-rw-r--r--tests/fork_big2.pl2
-rwxr-xr-xtests/grant.pl2
-rwxr-xr-xtests/index_corrupt.pl2
-rwxr-xr-xtests/insert_and_repair.pl2
-rwxr-xr-xtests/lock_test.pl2
-rwxr-xr-xtests/mail_to_db.pl2
-rw-r--r--tests/mysql_client_test.c213
-rwxr-xr-xtests/pmail.pl2
-rwxr-xr-xtests/rename_test.pl2
-rwxr-xr-xtests/table_types.pl2
-rwxr-xr-xtests/test_delayed_insert.pl2
-rwxr-xr-xtests/truncate.pl2
-rw-r--r--unittest/mysys/CMakeLists.txt2
-rw-r--r--unittest/mysys/my_vsnprintf-t.c38
-rw-r--r--unittest/mysys/queues-t.c139
-rw-r--r--unittest/mysys/stacktrace-t.c67
-rw-r--r--unittest/unit.pl2
-rw-r--r--vio/viosocket.c2
-rw-r--r--win/packaging/CMakeLists.txt14
-rw-r--r--win/packaging/ca/CustomAction.cpp97
-rw-r--r--win/packaging/create_msi.cmake.in2
-rw-r--r--win/packaging/custom_ui.wxs183
-rw-r--r--win/packaging/extra.wxs.in2
-rw-r--r--win/packaging/heidisql.cmake2
-rw-r--r--win/packaging/heidisql.wxi.in28
2072 files changed, 68466 insertions, 31214 deletions
diff --git a/.clang-format b/.clang-format
index 1ad93ead80a..5fc6ab23622 100644
--- a/.clang-format
+++ b/.clang-format
@@ -90,7 +90,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
-SortIncludes: true
+SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
diff --git a/.gitignore b/.gitignore
index 7974a539ee0..8477515105b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,6 +100,7 @@ pcre/pcre_chartables.c
pcre/pcregrep
pcre/pcretest
pcre/test*grep
+plugin/auth_pam/config_auth_pam.h
plugin/aws_key_management/aws-sdk-cpp
plugin/aws_key_management/aws_sdk_cpp
plugin/aws_key_management/aws_sdk_cpp-prefix
@@ -244,6 +245,8 @@ support-files/mysqld_multi.server
support-files/wsrep.cnf
support-files/wsrep_notify
support-files/policy/selinux/mysqld-safe.pp
+support-files/sysusers.conf
+support-files/tmpfiles.conf
support-files/mariadb.pp
tags
tests/async_queries
diff --git a/.travis.yml b/.travis.yml
index 8f21dc4d337..d38ba46b971 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,10 +8,8 @@ git:
depth: 2
language: cpp
-os:
- - linux
- - osx
-osx_image: xcode9.1
+os: linux
+
compiler:
- gcc
- clang
@@ -19,15 +17,9 @@ compiler:
cache:
apt: true
ccache: true
- directories:
- - /usr/local/Cellar
env:
matrix:
-# - GCC_VERSION=4.8 TYPE=Debug MYSQL_TEST_SUITES=rpl
-# - GCC_VERSION=5 TYPE=Debug MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
-# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
-# - GCC_VERSION=6 TYPE=Debug MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles
- GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
@@ -35,8 +27,8 @@ env:
matrix:
exclude:
- - os: osx
- compiler: gcc
+ - compiler: clang
+ env: GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
include:
- os: linux
compiler: gcc
@@ -48,6 +40,7 @@ matrix:
- cmake
- debhelper
- dh-apparmor
+ - dh-exec
- dpatch
- gdb
- libaio-dev
@@ -86,51 +79,6 @@ matrix:
- export MTR_MEM=/tmp
- env DEB_BUILD_OPTIONS="parallel=6" debian/autobake-deb.sh;
- ccache --show-stats
- # Until OSX becomes a bit more stable: MDEV-12435
- allow_failures:
- - os: osx
- compiler: clang
- env: GCC_VERSION=4.8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl
- - os: osx
- compiler: clang
- env: GCC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main,archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts
- - os: osx
- compiler: clang
- env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption,rocksdb
- - os: osx
- compiler: clang
- env: GCC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,percona,perfschema,plugins,multi_source,roles
-
-# Matrix include for coverity
-# - env:
-# - GCC_VERSION=6
-# addon:
-# coverity_scan:
-# # ref: https://scan.coverity.com/travis_ci
-# # GitHub project metadata
-# project:
-# - name: MariaDB/server
-# - description: MariaDB Server
-#
-# # Where email notification of build analysis results will be sent
-# notification_email: security@mariadb.org
-#
-# # Commands to prepare for build_command
-# build_command_prepend:
-# - source .travis.compiler.sh
-# - ${MYSQL_BUILD_CC} --version ; ${MYSQL_BUILD_CXX} --version
-# - cmake .
-# -DCMAKE_BUILD_TYPE=Debug
-# -DWITH_SSL=system -DWITH_ZLIB=system
-# -DWITHOUT_TOKUDB_STORAGE_ENGINE=ON -DWITHOUT_MROONGA_STORAGE_ENGINE=ON
-#
-# # The command that will be added as an argument to "cov-build" to compile your project for analysis,
-# build_command: make -j 4
-#
-# # Pattern to match selecting branches that will run analysis.
-# # Take care in resource usage, and consider the build frequency allowances per
-# # https://scan.coverity.com/faq#frequency - 7 per week is the current limit.
-# branch_pattern: .*coverity.*
addons:
apt:
@@ -177,15 +125,6 @@ addons:
- libzmq-dev
- uuid-dev
-# libsystemd-daemon-dev # https://github.com/travis-ci/apt-package-whitelist/issues/3882
-
-before_install:
- - if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then
- brew update;
- brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre;
- brew link ccache;
- fi
-
script:
- ccache --version
# Clang:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0dcc2a75587..4734c6f7d5f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
# explicitly set the policy to OLD
# (cannot use NEW, not everyone is on cmake-2.8.12 yet)
@@ -31,6 +31,9 @@ IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_POLICY(SET CMP0045 OLD)
CMAKE_POLICY(SET CMP0042 OLD)
ENDIF()
+IF(POLICY CMP0048)
+ CMAKE_POLICY(SET CMP0048 NEW)
+ENDIF()
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF()
@@ -144,8 +147,6 @@ INCLUDE(mysql_version)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
INCLUDE(wsrep)
-INCLUDE(cpack_rpm)
-INCLUDE(cpack_deb)
# Add macros
INCLUDE(character_sets)
@@ -186,6 +187,7 @@ ENDIF()
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
INCLUDE(check_compiler_flag)
+INCLUDE(check_linker_flag)
OPTION(WITH_ASAN "Enable address sanitizer" OFF)
IF (WITH_ASAN)
@@ -216,7 +218,7 @@ ENDIF()
OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF)
IF (WITH_UBSAN)
- MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
+ MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment -U_FORTIFY_SOURCE -DWITH_UBSAN" DEBUG RELWITHDEBINFO)
ENDIF()
OPTION(WITH_MSAN "Enable memory sanitizer" OFF)
@@ -238,11 +240,16 @@ IF(SECURITY_HARDENED)
ENDIF()
# security-enhancing flags
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
- MY_CHECK_AND_SET_COMPILER_FLAG("-Wl,-z,relro,-z,now")
+ MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now")
MY_CHECK_AND_SET_COMPILER_FLAG("-fstack-protector --param=ssp-buffer-size=4")
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF()
+OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON)
+IF(WITH_DBUG_TRACE)
+ ADD_DEFINITIONS(-DDBUG_TRACE)
+ENDIF()
+
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
@@ -385,6 +392,9 @@ IF(WITH_UNIT_TESTS)
ENDIF()
ENDIF()
+INCLUDE(cpack_rpm)
+INCLUDE(cpack_deb)
+
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
INCLUDE(submodules)
diff --git a/VERSION b/VERSION
index 49469df82da..b451aa8a789 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=2
-MYSQL_VERSION_PATCH=30
+MYSQL_VERSION_PATCH=36
diff --git a/client/client_priv.h b/client/client_priv.h
index 7c16ca17aab..5f2d62024a3 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -98,6 +98,7 @@ enum options_client
OPT_REPORT_PROGRESS,
OPT_SKIP_ANNOTATE_ROWS_EVENTS,
OPT_SSL_CRL, OPT_SSL_CRLPATH,
+ OPT_IGNORE_DATA,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 2247e93ca93..f61fab416d5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1303,8 +1303,8 @@ sig_handler mysql_end(int sig)
{
#ifndef _WIN32
/*
- Ingnoring SIGQUIT and SIGINT signals when cleanup process starts.
- This will help in resolving the double free issues, which occures in case
+ Ignoring SIGQUIT and SIGINT signals when cleanup process starts.
+ This will help in resolving the double free issues, which occurs in case
the signal handler function is started in between the clean up function.
*/
signal(SIGQUIT, SIG_IGN);
@@ -3213,7 +3213,7 @@ static int
com_go(String *buffer,char *line __attribute__((unused)))
{
char buff[200]; /* about 110 chars used so far */
- char time_buff[52+3+1]; /* time max + space&parens + NUL */
+ char time_buff[52+3+1]; /* time max + space & parens + NUL */
MYSQL_RES *result;
ulong timer, warnings= 0;
uint error= 0;
@@ -3232,7 +3232,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (buffer->is_empty())
{
- if (status.batch) // Ignore empty quries
+ if (status.batch) // Ignore empty queries.
return 0;
return put_info("No query specified\n",INFO_ERROR);
@@ -3297,7 +3297,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
else
time_buff[0]= '\0';
- /* Every branch must truncate buff . */
+ /* Every branch must truncate buff. */
if (result)
{
if (!mysql_num_rows(result) && ! quick && !column_types_flag)
@@ -4730,7 +4730,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
/*
CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
mysql_real_connect() and the server also supports it
- */
+*/
if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else
@@ -4799,7 +4799,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/*
Don't remove "limit 1",
- it is protection againts SQL_SELECT_LIMIT=0
+ it is protection against SQL_SELECT_LIMIT=0
*/
if (!mysql_store_result_for_lazy(&result))
{
@@ -5172,7 +5172,7 @@ static const char *construct_prompt()
time_t lclock = time(NULL); // Get the date struct
struct tm *t = localtime(&lclock);
- /* parse thru the settings for the prompt */
+ /* parse through the settings for the prompt */
for (char *c = current_prompt; *c ; c++)
{
if (*c != PROMPT_CHAR)
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 58b1608c560..a777bdbb482 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -1020,7 +1020,7 @@ static int find_plugin(char *tp_path)
/**
- Build the boostrap file.
+ Build the bootstrap file.
Create a new file and populate it with SQL commands to ENABLE or DISABLE
the plugin via REPLACE and DELETE operations on the mysql.plugin table.
@@ -1149,7 +1149,7 @@ exit:
Create a command line sequence to launch mysqld in bootstrap mode. This
will allow mysqld to launch a minimal server instance to read and
- execute SQL commands from a file piped in (the boostrap file). We use
+ execute SQL commands from a file piped in (the bootstrap file). We use
the --no-defaults option to skip reading values from the config file.
The bootstrap mode skips loading of plugins and many other subsystems.
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 835dd9fd00d..2c55251c71b 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -18,7 +18,7 @@
#include "client_priv.h"
#include <sslopt-vars.h>
-#include "../scripts/mysql_fix_privilege_tables_sql.c"
+#include <../scripts/mysql_fix_privilege_tables_sql.c>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
@@ -153,7 +153,7 @@ static struct my_option my_long_options[]=
&opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#define USER_OPT (array_elements(my_long_options) - 6)
- {"user", 'u', "User for login if not current user.", &opt_user,
+ {"user", 'u', "User for login.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -503,7 +503,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
len= (int)(last_fn_libchar - self_name);
- my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
+ my_snprintf(tool_executable_name, FN_REFLEN, "%.*b%c%s",
len, self_name, FN_LIBCHAR, tool_name);
}
@@ -999,6 +999,64 @@ static int install_used_engines(void)
return 0;
}
+static int check_slave_repositories(void)
+{
+ DYNAMIC_STRING ds_result;
+ int row_count= 0;
+ int error= 0;
+ const char *query = "SELECT COUNT(*) AS c1 FROM mysql.slave_master_info";
+
+ if (init_dynamic_string(&ds_result, "", 512, 512))
+ die("Out of memory");
+
+ run_query(query, &ds_result, TRUE);
+
+ if (ds_result.length)
+ {
+ row_count= atoi((char *)ds_result.str);
+ if (row_count)
+ {
+ fprintf(stderr,"Slave info repository compatibility check:"
+ " Found data in `mysql`.`slave_master_info` table.\n");
+ fprintf(stderr,"Warning: Content of `mysql`.`slave_master_info` table"
+ " will be ignored as MariaDB supports file based info "
+ "repository.\n");
+ error= 1;
+ }
+ }
+ dynstr_free(&ds_result);
+
+ query = "SELECT COUNT(*) AS c1 FROM mysql.slave_relay_log_info";
+
+ if (init_dynamic_string(&ds_result, "", 512, 512))
+ die("Out of memory");
+
+ run_query(query, &ds_result, TRUE);
+
+ if (ds_result.length)
+ {
+ row_count= atoi((char *)ds_result.str);
+ if (row_count)
+ {
+ fprintf(stderr, "Slave info repository compatibility check:"
+ " Found data in `mysql`.`slave_relay_log_info` table.\n");
+ fprintf(stderr, "Warning: Content of `mysql`.`slave_relay_log_info` "
+ "table will be ignored as MariaDB supports file based "
+ "repository.\n");
+ error= 1;
+ }
+ }
+ dynstr_free(&ds_result);
+ if (error)
+ {
+ fprintf(stderr,"Slave server may not possess the correct replication "
+ "metadata.\n");
+ fprintf(stderr, "Execution of CHANGE MASTER as per "
+ "`mysql`.`slave_master_info` and `mysql`.`slave_relay_log_info` "
+ "table content is recommended.\n");
+ }
+ return 0;
+}
/*
Update all system tables in MySQL Server to current
@@ -1210,7 +1268,8 @@ int main(int argc, char **argv)
run_mysqlcheck_views() ||
run_sql_fix_privilege_tables() ||
run_mysqlcheck_fixnames() ||
- run_mysqlcheck_upgrade(FALSE))
+ run_mysqlcheck_upgrade(FALSE) ||
+ check_slave_repositories())
die("Upgrade failed" );
verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index acccf0a3411..4e28876cdf6 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -176,7 +176,7 @@ enum Exit_status {
*/
static Annotate_rows_log_event *annotate_event= NULL;
-void free_annotate_event()
+static void free_annotate_event()
{
if (annotate_event)
{
@@ -739,7 +739,7 @@ static bool shall_skip_database(const char *log_dbname)
/**
Print "use <db>" statement when current db is to be changed.
- We have to control emiting USE statements according to rewrite-db options.
+ We have to control emitting USE statements according to rewrite-db options.
We have to do it here (see process_event() below) and to suppress
producing USE statements by corresponding log event print-functions.
*/
@@ -771,7 +771,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
// In case of rewrite rule print USE statement for db_to
my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter);
- // Copy the *original* db to pinfo to suppress emiting
+ // Copy the *original* db to pinfo to suppress emitting
// of USE stmts by log_event print-functions.
memcpy(pinfo->db, db, db_len + 1);
}
@@ -891,7 +891,8 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
ev->print(result_file, print_event_info);
return
print_event_info->head_cache.error == -1 ||
- print_event_info->body_cache.error == -1;
+ print_event_info->body_cache.error == -1 ||
+ print_event_info->tail_cache.error == -1;
}
@@ -921,7 +922,7 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
}
}
- /*
+ /*
end of statement check:
i) destroy/free ignored maps
ii) if skip event
@@ -932,21 +933,21 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/
if (is_stmt_end)
{
- /*
+ /*
Now is safe to clear ignored map (clear_tables will also
delete original table map events stored in the map).
*/
if (print_event_info->m_table_map_ignored.count() > 0)
print_event_info->m_table_map_ignored.clear_tables();
- /*
+ /*
If there is a kept Annotate event and all corresponding
rbr-events were filtered away, the Annotate event was not
freed and it is just the time to do it.
*/
- free_annotate_event();
+ free_annotate_event();
- /*
+ /*
One needs to take into account an event that gets
filtered but was last event in the statement. If this is
the case, previous rows events that were written into
@@ -962,8 +963,12 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
my_b_printf(body_cache, "'%s\n", print_event_info->delimiter);
// flush cache
- if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
- copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
+ if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
+ result_file) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->body_cache,
+ result_file) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->tail_cache,
+ result_file)))
return 1;
}
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index f0c53052a1f..b33c5ecc010 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -32,7 +32,7 @@
** master/autocommit code by Brian Aker <brian@tangent.org>
** SSL by
** Andrei Errapart <andreie@no.spam.ee>
-** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
+** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up
** and adapted to mysqldump 05/11/01 by Jani Tolonen
** Added --single-transaction option 06/06/2002 by Peter Zaitsev
@@ -90,6 +90,7 @@
/* Max length GTID position that we will output. */
#define MAX_GTID_LENGTH 1024
+static my_bool ignore_table_data(const uchar *hash_key, size_t len);
static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value);
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
@@ -143,7 +144,7 @@ static char * opt_mysql_unix_port=0;
static int first_error=0;
/*
multi_source is 0 if old server or 2 if server that support multi source
- This is choosen this was as multi_source has 2 extra columns first in
+ This is chosen this was as multi_source has 2 extra columns first in
SHOW ALL SLAVES STATUS.
*/
static uint multi_source= 0;
@@ -211,7 +212,7 @@ TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1,
#define MED_ENGINES "MRG_MyISAM, MRG_ISAM, CONNECT, OQGRAPH, SPIDER, VP, FEDERATED"
-HASH ignore_table;
+HASH ignore_table, ignore_data;
static struct my_option my_long_options[] =
{
@@ -375,6 +376,12 @@ static struct my_option my_long_options[] =
&opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &current_host,
&current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"ignore-table-data", OPT_IGNORE_DATA,
+ "Do not dump the specified table data. To specify more than one table "
+ "to ignore, use the directive multiple times, once for each table. "
+ "Each table must be specified with both database and table names, e.g., "
+ "--ignore-table-data=database.table.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-table", OPT_IGNORE_TABLE,
"Do not dump the specified table. To specify more than one table to ignore, "
"use the directive multiple times, once for each table. Each table must "
@@ -899,6 +906,18 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_TABLES:
opt_databases=0;
break;
+ case (int) OPT_IGNORE_DATA:
+ {
+ if (!strchr(argument, '.'))
+ {
+ fprintf(stderr,
+ "Illegal use of option --ignore-table-data=<database>.<table>\n");
+ exit(1);
+ }
+ if (my_hash_insert(&ignore_data, (uchar*)my_strdup(argument, MYF(0))))
+ exit(EX_EOM);
+ break;
+ }
case (int) OPT_IGNORE_TABLE:
{
if (!strchr(argument, '.'))
@@ -1001,6 +1020,10 @@ static int get_options(int *argc, char ***argv)
(uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))))
return(EX_EOM);
+ if (my_hash_init(&ignore_data, charset_info, 16, 0, 0,
+ (my_hash_get_key) get_table_key, my_free, 0))
+ return(EX_EOM);
+
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
return(ho_error);
@@ -1648,6 +1671,8 @@ static void free_resources()
free_root(&glob_root, MYF(0));
if (my_hash_inited(&ignore_table))
my_hash_free(&ignore_table);
+ if (my_hash_inited(&ignore_data))
+ my_hash_free(&ignore_data);
dynstr_free(&extended_row);
dynstr_free(&dynamic_where);
dynstr_free(&insert_pat);
@@ -2023,7 +2048,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
<stag_atr="sval" xsi:nil="true"/>
NOTE
sval MUST be a NULL terminated string.
- sval string will be qouted before output.
+ sval string will be quoted before output.
*/
static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
@@ -2095,7 +2120,7 @@ static void print_xml_cdata(FILE *xml_file, const char *str, ulong len)
Print tag with many attribute to the xml_file. Format is:
\t\t<row_name Atr1="Val1" Atr2="Val2"... />
NOTE
- All atributes and values will be quoted before output.
+ All attributes and values will be quoted before output.
*/
static void print_xml_row(FILE *xml_file, const char *row_name,
@@ -2566,7 +2591,7 @@ static uint dump_routines_for_db(char *db)
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
fix_for_comment(current_user));
- maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!",
+ maybe_die(EX_MYSQLERR,"%s has insufficient privileges to %s!",
current_user, query_buff);
}
else if (strlen(row[2]))
@@ -3622,7 +3647,7 @@ static char *alloc_query_str(ulong size)
*/
-static void dump_table(char *table, char *db)
+static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
{
char ignore_flag;
char buf[200], table_buff[NAME_LEN+3];
@@ -3650,7 +3675,7 @@ static void dump_table(char *table, char *db)
DBUG_VOID_RETURN;
/* Check --no-data flag */
- if (opt_no_data)
+ if (opt_no_data || (hash_key && ignore_table_data(hash_key, len)))
{
verbose_msg("-- Skipping dump data for table '%s', --no-data was used\n",
table);
@@ -4067,7 +4092,7 @@ static void dump_table(char *table, char *db)
}
}
- /* XML - close table tag and supress regular output */
+ /* XML - close table tag and suppress regular output */
if (opt_xml)
fputs("\t</table_data>\n", md_result_file);
else if (extended_insert && row_break)
@@ -4473,7 +4498,7 @@ static int dump_databases(char **db_names)
/*
-View Specific database initalization.
+View Specific database initialization.
SYNOPSIS
init_dumping_views
@@ -4490,7 +4515,7 @@ int init_dumping_views(char *qdatabase __attribute__((unused)))
/*
-Table Specific database initalization.
+Table Specific database initialization.
SYNOPSIS
init_dumping_tables
@@ -4578,10 +4603,14 @@ static int init_dumping(char *database, int init_func(char*))
/* Return 1 if we should copy the table */
-my_bool include_table(const uchar *hash_key, size_t len)
+static my_bool include_table(const uchar *hash_key, size_t len)
{
return ! my_hash_search(&ignore_table, hash_key, len);
}
+static my_bool ignore_table_data(const uchar *hash_key, size_t len)
+{
+ return my_hash_search(&ignore_data, hash_key, len) != NULL;
+}
static int dump_all_tables_in_db(char *database)
@@ -4646,7 +4675,7 @@ static int dump_all_tables_in_db(char *database)
char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key, end - hash_key))
{
- dump_table(table,database);
+ dump_table(table, database, (uchar*) hash_key, end - hash_key);
my_free(order_by);
order_by= 0;
if (opt_dump_triggers && mysql_get_server_version(mysql) >= 50009)
@@ -5035,7 +5064,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
for (pos= dump_tables; pos < end; pos++)
{
DBUG_PRINT("info",("Dumping table %s", *pos));
- dump_table(*pos, db);
+ dump_table(*pos, db, NULL, 0);
if (opt_dump_triggers &&
mysql_get_server_version(mysql) >= 50009)
{
@@ -6016,6 +6045,7 @@ int main(int argc, char **argv)
compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset;
bzero((char*) &ignore_table, sizeof(ignore_table));
+ bzero((char*) &ignore_data, sizeof(ignore_data));
exit_code= get_options(&argc, &argv);
if (exit_code)
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 9d8239fe6db..c6b160534d8 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -594,7 +594,7 @@ static char *field_escape(char *to,const char *from,uint length)
else
{
if (*from == '\'' && !end_backslashes)
- *to++= *from; /* We want a dublicate of "'" for MySQL */
+ *to++= *from; /* We want a duplicate of "'" for MySQL */
end_backslashes=0;
}
}
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index fae2553a188..7e93068977e 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -2302,7 +2302,7 @@ slap_connect(MYSQL *mysql)
opt_mysql_unix_port,
connect_flags))
{
- /* Connect suceeded */
+ /* Connect succeeded */
connect_error= 0;
break;
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 60a203ccedd..2a9560e8903 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -146,7 +146,7 @@ struct property {
my_bool *var; /* Actual variable */
my_bool set; /* Has been set for ONE command */
my_bool old; /* If set, thus is the old value */
- my_bool reverse; /* Varible is true if disabled */
+ my_bool reverse; /* Variable is true if disabled */
const char *env_name; /* Env. variable name */
};
@@ -185,7 +185,7 @@ static uint opt_tail_lines= 0;
static uint opt_connect_timeout= 0;
static uint opt_wait_for_pos_timeout= 0;
-
+static const uint default_wait_for_pos_timeout= 300;
static char delimiter[MAX_DELIMITER_LENGTH]= ";";
static uint delimiter_length= 1;
@@ -566,7 +566,7 @@ DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */
Temporary storage areas for substitutions. To reduce unnessary copying
and memory freeing/allocation, we pre-allocate two buffers, and alternate
their use, one for input/one for output, the roles changing on the next
-st_regex substition. At the end of substitutions buf points to the
+st_regex substitution. At the end of substitutions buf points to the
one containing the final result.
*/
char* buf;
@@ -587,10 +587,10 @@ ATTRIBUTE_NORETURN
static void cleanup_and_exit(int exit_code);
ATTRIBUTE_NORETURN
-void really_die(const char *msg);
-void report_or_die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
-ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
-void die(const char *fmt, ...);
+static void really_die(const char *msg);
+void report_or_die(const char *fmt, ...);
+ATTRIBUTE_NORETURN
+static void die(const char *fmt, ...);
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args);
ATTRIBUTE_NORETURN ATTRIBUTE_FORMAT(printf, 1, 2)
void abort_not_supported_test(const char *fmt, ...);
@@ -717,7 +717,7 @@ public:
DBUG_ASSERT(ds->str);
#ifdef EXTRA_DEBUG
- DBUG_PRINT("extra", ("str: %*s", (int) ds->length, ds->str));
+ DBUG_DUMP("extra", (uchar*) ds->str, ds->length);
#endif
if (fwrite(ds->str, 1, ds->length, m_file) != ds->length)
@@ -1155,71 +1155,6 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
/*
- Run query and dump the result to stderr in vertical format
-
- NOTE! This function should be safe to call when an error
- has occurred and thus any further errors will be ignored (although logged)
-
- SYNOPSIS
- show_query
- mysql - connection to use
- query - query to run
-
-*/
-
-static void show_query(MYSQL* mysql, const char* query)
-{
- MYSQL_RES* res;
- DBUG_ENTER("show_query");
-
- if (!mysql)
- DBUG_VOID_RETURN;
-
- if (mysql_query(mysql, query))
- {
- log_msg("Error running query '%s': %d %s",
- query, mysql_errno(mysql), mysql_error(mysql));
- DBUG_VOID_RETURN;
- }
-
- if ((res= mysql_store_result(mysql)) == NULL)
- {
- /* No result set returned */
- DBUG_VOID_RETURN;
- }
-
- {
- MYSQL_ROW row;
- unsigned int i;
- unsigned int row_num= 0;
- unsigned int num_fields= mysql_num_fields(res);
- MYSQL_FIELD *fields= mysql_fetch_fields(res);
-
- fprintf(stderr, "=== %s ===\n", query);
- while ((row= mysql_fetch_row(res)))
- {
- unsigned long *lengths= mysql_fetch_lengths(res);
- row_num++;
-
- fprintf(stderr, "---- %d. ----\n", row_num);
- for(i= 0; i < num_fields; i++)
- {
- fprintf(stderr, "%s\t%.*s\n",
- fields[i].name,
- (int)lengths[i], row[i] ? row[i] : "NULL");
- }
- }
- for (i= 0; i < strlen(query)+8; i++)
- fprintf(stderr, "=");
- fprintf(stderr, "\n\n");
- }
- mysql_free_result(res);
-
- DBUG_VOID_RETURN;
-}
-
-
-/*
Show any warnings just before the error. Since the last error
is added to the warning stack, only print @@warning_count-1 warnings.
@@ -1377,7 +1312,7 @@ void check_command_args(struct st_command *command,
/* Check required arg */
if (arg->ds->length == 0 && arg->required)
- die("Missing required argument '%s' to command '%.*s'", arg->argname,
+ die("Missing required argument '%s' to command '%.*b'", arg->argname,
command->first_word_len, command->query);
}
@@ -1386,7 +1321,7 @@ void check_command_args(struct st_command *command,
while(ptr <= command->end && *ptr != '#')
{
if (*ptr && *ptr != ' ')
- die("Extra argument '%s' passed to '%.*s'",
+ die("Extra argument '%s' passed to '%.*b'",
ptr, command->first_word_len, command->query);
ptr++;
}
@@ -1406,7 +1341,7 @@ void handle_command_error(struct st_command *command, uint error,
if (command->abort_on_error)
{
- report_or_die("command \"%.*s\" failed with error: %u my_errno: %d "
+ report_or_die("command \"%.*b\" failed with error: %u my_errno: %d "
"errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
@@ -1424,7 +1359,7 @@ void handle_command_error(struct st_command *command, uint error,
DBUG_VOID_RETURN;
}
if (command->expected_errors.count > 0)
- report_or_die("command \"%.*s\" failed with wrong error: %u "
+ report_or_die("command \"%.*b\" failed with wrong error: %u "
"my_errno: %d errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
@@ -1433,7 +1368,7 @@ void handle_command_error(struct st_command *command, uint error,
command->expected_errors.err[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
- report_or_die("command \"%.*s\" succeeded - should have failed with "
+ report_or_die("command \"%.*b\" succeeded - should have failed with "
"errno %d...",
command->first_word_len, command->query,
command->expected_errors.err[0].code.errnum);
@@ -1620,7 +1555,7 @@ static void make_error_message(char *buf, size_t len, const char *fmt, va_list a
s+= my_snprintf(s, end -s, "\n", start_lineno);
}
-void die(const char *fmt, ...)
+static void die(const char *fmt, ...)
{
char buff[DIE_BUFF_SIZE];
va_list args;
@@ -1629,7 +1564,7 @@ void die(const char *fmt, ...)
really_die(buff);
}
-void really_die(const char *msg)
+static void really_die(const char *msg)
{
static int dying= 0;
fflush(stdout);
@@ -2387,7 +2322,7 @@ static int strip_surrounding(char* str, char c1, char c2)
static void strip_parentheses(struct st_command *command)
{
if (strip_surrounding(command->first_argument, '(', ')'))
- die("%.*s - argument list started with '%c' must be ended with '%c'",
+ die("%.*b - argument list started with '%c' must be ended with '%c'",
command->first_word_len, command->query, '(', ')');
}
@@ -3043,7 +2978,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
/* Make sure there was just a $variable and nothing else */
const char* end= *p_end + 1;
if (end < expected_end && !open_end)
- die("Found junk '%.*s' after $variable in expression",
+ die("Found junk '%.*b' after $variable in expression",
(int)(expected_end - end - 1), end);
DBUG_VOID_RETURN;
@@ -3175,7 +3110,7 @@ void open_file(const char *name)
strxnmov(buff, sizeof(buff), opt_overlay_dir, suffix, name, NullS);
/*
- Overlayed rty/include/thing.inc can contain the line
+ Overlaid rty/include/thing.inc can contain the line
--source thing.inc
which would mean to include qwe/include/thing.inc.
But it looks like including "itself", so don't try to open the file,
@@ -3537,10 +3472,10 @@ int do_modify_var(struct st_command *command,
const char *p= command->first_argument;
VAR* v;
if (!*p)
- die("Missing argument to %.*s", command->first_word_len,
+ die("Missing argument to %.*b", command->first_word_len,
command->query);
if (*p != '$')
- die("The argument to %.*s must be a variable (start with $)",
+ die("The argument to %.*b must be a variable (start with $)",
command->first_word_len, command->query);
v= var_get(p, &p, 1, 0);
if (! v->is_int)
@@ -4808,9 +4743,6 @@ void do_sync_with_master2(struct st_command *command, long offset,
if (!result_str || result < 0)
{
/* master_pos_wait returned NULL or < 0 */
- show_query(mysql, "SHOW MASTER STATUS");
- show_query(mysql, "SHOW SLAVE STATUS");
- show_query(mysql, "SHOW PROCESSLIST");
fprintf(stderr, "analyze: sync_with_master\n");
if (!result_str)
@@ -4821,18 +4753,18 @@ void do_sync_with_master2(struct st_command *command, long offset,
information is not initialized, the arguments are
incorrect, or an error has occurred
*/
- die("%.*s failed: '%s' returned NULL " \
+ die("%.*b failed: '%s' returned NULL " \
"indicating slave SQL thread failure",
command->first_word_len, command->query, query_buf);
}
if (result == -1)
- die("%.*s failed: '%s' returned -1 " \
+ die("%.*b failed: '%s' returned -1 " \
"indicating timeout after %d seconds",
command->first_word_len, command->query, query_buf, timeout);
else
- die("%.*s failed: '%s' returned unknown result :%d",
+ die("%.*b failed: '%s' returned unknown result :%d",
command->first_word_len, command->query, query_buf, result);
}
@@ -4887,7 +4819,7 @@ int do_save_master_pos()
mysql_errno(mysql), mysql_error(mysql));
if (!(res = mysql_store_result(mysql)))
- die("mysql_store_result() retuned NULL for '%s'", query);
+ die("mysql_store_result() returned NULL for '%s'", query);
if (!(row = mysql_fetch_row(res)))
die("empty result in show master status");
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
@@ -4997,17 +4929,17 @@ int do_sleep(struct st_command *command, my_bool real_sleep)
while (my_isspace(charset_info, *p))
p++;
if (!*p)
- die("Missing argument to %.*s", command->first_word_len,
+ die("Missing argument to %.*b", command->first_word_len,
command->query);
sleep_start= p;
/* Check that arg starts with a digit, not handled by my_strtod */
if (!my_isdigit(charset_info, *sleep_start))
- die("Invalid argument to %.*s \"%s\"", command->first_word_len,
+ die("Invalid argument to %.*b \"%s\"", command->first_word_len,
command->query, sleep_start);
sleep_val= my_strtod(sleep_start, &sleep_end, &error);
check_eol_junk_line(sleep_end);
if (error)
- die("Invalid argument to %.*s \"%s\"", command->first_word_len,
+ die("Invalid argument to %.*b \"%s\"", command->first_word_len,
command->query, command->first_argument);
dynstr_free(&ds_sleep);
@@ -5142,6 +5074,8 @@ void do_shutdown_server(struct st_command *command)
};
DBUG_ENTER("do_shutdown_server");
+ /* the wait-for-pos' default based value of 'timeout' must fit to MDEV-23511 */
+ compile_time_assert(default_wait_for_pos_timeout / 5 >= 60);
check_command_args(command, command->first_argument, shutdown_args,
sizeof(shutdown_args)/sizeof(struct command_arg),
' ');
@@ -5405,7 +5339,7 @@ void do_get_errcodes(struct st_command *command)
p++;
}
- /* Convert the sting to int */
+ /* Convert the string to int */
if (!str2int(start, 10, (long) INT_MIN, (long) INT_MAX, &val))
die("Invalid argument to error: '%s'", command->first_argument);
@@ -5797,7 +5731,7 @@ int connect_n_handle_errors(struct st_command *command,
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
}
- /* Simlified logging if enabled */
+ /* Simplified logging if enabled */
if (!disable_connect_log && !disable_query_log)
{
replace_dynstr_append(ds, command->query);
@@ -6010,7 +5944,7 @@ void do_connect(struct st_command *command)
csname= strdup(con_options + sizeof("CHARSET=") - 1);
}
else
- die("Illegal option to connect: %.*s",
+ die("Illegal option to connect: %.*b",
(int) (end - con_options), con_options);
/* Process next option */
con_options= end;
@@ -6337,7 +6271,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
enum block_op operand= find_operand(curr_ptr);
if (operand == ILLEG_OP)
- die("Found junk '%.*s' after $variable in condition",
+ die("Found junk '%.*b' after $variable in condition",
(int)(expr_end - curr_ptr), curr_ptr);
/* We could silently allow this, but may be confusing */
@@ -7126,7 +7060,7 @@ static struct my_option my_long_options[] =
{"wait_for_pos_timeout", 0,
"Number of seconds to wait for master_pos_wait",
&opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT,
- REQUIRED_ARG, 300, 0, 3600 * 12, 0, 0, 0},
+ REQUIRED_ARG, default_wait_for_pos_timeout, 0, 3600 * 12, 0, 0, 0},
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -8261,7 +8195,7 @@ void handle_no_error(struct st_command *command)
SYNPOSIS
run_query_stmt
mysql - mysql handle
- command - currrent command pointer
+ command - current command pointer
query - query string to execute
query_len - length query string to execute
ds - output buffer where to store result form query
@@ -8501,7 +8435,7 @@ end:
/*
Create a util connection if one does not already exists
and use that to run the query
- This is done to avoid implict commit when creating/dropping objects such
+ This is done to avoid implicit commit when creating/dropping objects such
as view, sp etc.
*/
@@ -8542,7 +8476,7 @@ int util_query(MYSQL* org_mysql, const char* query){
SYNPOSIS
run_query()
mysql mysql handle
- command currrent command pointer
+ command current command pointer
flags control the phased/stages of query execution to be performed
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
@@ -9130,10 +9064,6 @@ static void init_signal_handling(void)
struct sigaction sa;
DBUG_ENTER("init_signal_handling");
-#ifdef HAVE_STACKTRACE
- my_init_stacktrace();
-#endif
-
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL);
@@ -9534,6 +9464,7 @@ int main(int argc, char **argv)
case Q_LET: do_let(command); break;
case Q_EVAL_RESULT:
die("'eval_result' command is deprecated");
+ break; // never called but keep compiler calm
case Q_EVAL:
case Q_EVALP:
case Q_QUERY_VERTICAL:
@@ -10258,6 +10189,7 @@ void append_replace_regex(char* expr, char *expr_end, struct st_replace_regex* r
return;
err:
+ my_free(res->regex_arr.buffer);
my_free(res);
die("Error parsing replace_regex \"%s\"", expr);
}
@@ -10303,7 +10235,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
in_buf, re.icase))
{
- /* if the buffer has been reallocated, make adjustements */
+ /* if the buffer has been reallocated, make adjustments */
if (save_out_buf != out_buf)
{
if (save_out_buf == r->even_buf)
@@ -10570,7 +10502,7 @@ typedef struct st_rep_set {
uint found_len; /* Best match to date */
int found_offset;
uint table_offset;
- uint size_of_bits; /* For convinience */
+ uint size_of_bits; /* For convenience */
} REP_SET;
typedef struct st_rep_sets {
@@ -10673,7 +10605,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
DBUG_RETURN(0);
}
(void) make_new_set(&sets); /* Set starting set */
- make_sets_invisible(&sets); /* Hide previus sets */
+ make_sets_invisible(&sets); /* Hide previous sets */
used_sets=-1;
word_states=make_new_set(&sets); /* Start of new word */
start_states=make_new_set(&sets); /* This is first state */
diff --git a/cmake/FindBISON.cmake b/cmake/FindBISON.cmake
new file mode 100644
index 00000000000..28ae3f8fecb
--- /dev/null
+++ b/cmake/FindBISON.cmake
@@ -0,0 +1,8 @@
+IF(DEFINED BISON_EXECUTABLE)
+ SET(bison_quiet QUIET)
+ENDIF()
+
+set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
+unset(CMAKE_MODULE_PATH)
+find_package(BISON ${BISON_FIND_VERSION} ${bison_quiet} ${BISON_FIND_REQUIRED})
+set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH})
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index b19a9437495..efd736809e0 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -104,6 +104,7 @@ ELSEIF(DEB)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
+ SET(WITH_PCRE bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "")
ENDIF()
@@ -121,7 +122,7 @@ ENDIF()
IF(UNIX)
SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
- SET(PLUGIN_AUTH_PAM YES)
+ SET(PLUGIN_AUTH_PAM YES CACHE BOOL "")
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT IGNORE_AIO_CHECK)
@@ -136,7 +137,7 @@ IF(UNIX)
RedHat/Fedora/Oracle Linux: yum install libaio-devel
SuSE: zypper install libaio-devel
- If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
+ If you really do not want it, pass -DIGNORE_AIO_CHECK=ON to cmake.
")
ENDIF()
diff --git a/cmake/check_linker_flag.cmake b/cmake/check_linker_flag.cmake
new file mode 100644
index 00000000000..1ea1772d79e
--- /dev/null
+++ b/cmake/check_linker_flag.cmake
@@ -0,0 +1,27 @@
+include(CheckCXXSourceCompiles)
+
+FUNCTION(MY_CHECK_AND_SET_LINKER_FLAG flag_to_set)
+ # Let's avoid expensive compiler tests on Windows:
+ IF(WIN32)
+ RETURN()
+ ENDIF()
+ STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_LINK_FLAG_${flag_to_set}")
+ SET(SAVE_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+ STRING(REGEX REPLACE "^-Wno-" "-W" flag_to_check ${flag_to_set})
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${flag_to_check})
+ CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result})
+ SET(CMAKE_REQUIRED_LIBRARIES "${SAVE_CMAKE_REQUIRED_LIBRARIES}")
+ IF (${result})
+ FOREACH(linktype SHARED MODULE EXE)
+ IF(ARGN)
+ FOREACH(type ${ARGN})
+ SET(CMAKE_${linktype}_LINKER_FLAGS_${type}
+ "${CMAKE_${linktype}_LINKER_FLAGS_${type}} ${flag_to_set}" PARENT_SCOPE)
+ ENDFOREACH()
+ ELSE()
+ SET(CMAKE_${linktype}_LINKER_FLAGS
+ "${CMAKE_${linktype}_LINKER_FLAGS} ${flag_to_set}" PARENT_SCOPE)
+ ENDIF()
+ ENDFOREACH()
+ ENDIF()
+ENDFUNCTION()
diff --git a/cmake/configure.pl b/cmake/configure.pl
index 90ccf6e1e3d..3139587a8e1 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 82fadd6b689..827b1e166a4 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -100,8 +100,13 @@ SET(ignored
"%ignore /etc"
"%ignore /etc/init.d"
"%ignore /etc/logrotate.d"
+ "%ignore /etc/security"
"%ignore /etc/systemd"
"%ignore /etc/systemd/system"
+ "%ignore /lib"
+ "%ignore /lib/security"
+ "%ignore /lib64"
+ "%ignore /lib64/security"
"%ignore ${CMAKE_INSTALL_PREFIX}"
"%ignore ${CMAKE_INSTALL_PREFIX}/bin"
"%ignore ${CMAKE_INSTALL_PREFIX}/include"
@@ -222,6 +227,14 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("test" "mariadb-test")
ELSEIF(RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3")
+ELSEIF(RPM MATCHES "sles")
+ ALTERNATIVE_NAME("server" "mariadb")
+ SETA(CPACK_RPM_server_PACKAGE_PROVIDES
+ "mysql = %{version}-%{release}"
+ "mariadb_${MAJOR_VERSION}${MINOR_VERSION} = %{version}-%{release}"
+ "mariadb-${MAJOR_VERSION}${MINOR_VERSION} = %{version}-%{release}"
+ "mariadb-server = %{version}-%{release}"
+ )
ENDIF()
# If we want to build build MariaDB-shared-compat,
diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake
index 5b103501a99..eb1ec191d17 100644
--- a/cmake/cpack_source_ignore_files.cmake
+++ b/cmake/cpack_source_ignore_files.cmake
@@ -15,6 +15,7 @@
SET(CPACK_SOURCE_IGNORE_FILES
\\\\.git/
+\\\\.git$
\\\\.gitignore$
\\\\.gitattributes$
CMakeCache\\\\.txt$
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake
index 4e0f7501045..d3dded99497 100644
--- a/cmake/dtrace.cmake
+++ b/cmake/dtrace.cmake
@@ -43,7 +43,8 @@ MACRO(CHECK_DTRACE)
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE
- AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS"
+ AND NOT WIN32)
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
# On GNU/Hurd, dtrace is not supported
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 7c3036be0a0..b2d9b7734ce 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -128,6 +128,8 @@ SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock")
+SET(INSTALL_PAMDIR_STANDALONE "share")
+SET(INSTALL_PAMDATADIR_STANDALONE "share")
#
# RPM layout
#
@@ -139,11 +141,10 @@ SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d")
#
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(INSTALL_LIBDIR_RPM "lib64")
- SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin")
ELSE()
SET(INSTALL_LIBDIR_RPM "lib")
- SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin")
ENDIF()
+SET(INSTALL_PLUGINDIR_RPM "${INSTALL_LIBDIR_RPM}/mysql/plugin")
#
SET(INSTALL_INCLUDEDIR_RPM "include/mysql")
#
@@ -164,6 +165,8 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock"
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
+SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security")
+SET(INSTALL_PAMDATADIR_RPM "/etc/security")
#
# DEB layout
@@ -174,7 +177,7 @@ SET(INSTALL_SCRIPTDIR_DEB "bin")
SET(INSTALL_SYSCONFDIR_DEB "/etc")
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d")
#
-SET(INSTALL_LIBDIR_DEB "lib")
+SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}")
SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin")
#
SET(INSTALL_INCLUDEDIR_DEB "include/mysql")
@@ -186,7 +189,7 @@ SET(INSTALL_INFODIR_DEB "share/info")
#
SET(INSTALL_SHAREDIR_DEB "share")
SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql")
-SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
+SET(INSTALL_MYSQLTESTDIR_DEB "share/mysql/mysql-test")
SET(INSTALL_SQLBENCHDIR_DEB ".")
SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql")
#
@@ -196,6 +199,8 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")
+SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security")
+SET(INSTALL_PAMDATADIR_DEB "/etc/security")
#
# SVR4 layout
@@ -235,17 +240,18 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR
# will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE
# layout is chosen)
-FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2
- INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR
- SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES)
- SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
- CACHE STRING "${var} installation directory" ${FORCE})
- MARK_AS_ADVANCED(INSTALL_${var}DIR)
-
- IF(IS_ABSOLUTE ${INSTALL_${var}DIR})
- SET(INSTALL_${var}DIRABS ${INSTALL_${var}DIR})
- ELSE()
- SET(INSTALL_${var}DIRABS "${CMAKE_INSTALL_PREFIX}/${INSTALL_${var}DIR}")
+GET_CMAKE_PROPERTY(ALL_VARS VARIABLES)
+FOREACH (V ${ALL_VARS})
+ IF (V MATCHES "^(INSTALL_([A-Z_0-9]+)DIR)_${INSTALL_LAYOUT}$")
+ SET(var ${CMAKE_MATCH_1})
+ SET(${var} "${${V}}" CACHE STRING "${CMAKE_MATCH_2} installation directory" ${FORCE})
+ MARK_AS_ADVANCED(${var})
+
+ IF(IS_ABSOLUTE "${${var}}")
+ SET(${var}ABS "${${var}}")
+ ELSE()
+ SET(${var}ABS "${CMAKE_INSTALL_PREFIX}/${${var}}")
+ ENDIF()
ENDIF()
ENDFOREACH()
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index 2afead700aa..c0802399e5d 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -154,17 +154,13 @@ ENDFUNCTION()
# and extension will be the same as for target file.
MACRO(INSTALL_SYMLINK linkname target destination component)
IF(UNIX)
- GET_TARGET_PROPERTY(location ${target} LOCATION)
- GET_FILENAME_COMPONENT(path ${location} PATH)
- GET_FILENAME_COMPONENT(name ${location} NAME)
- SET(output ${path}/${linkname})
+ SET(output ${CMAKE_CURRENT_BINARY_DIR}/${linkname})
ADD_CUSTOM_COMMAND(
OUTPUT ${output}
- COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
+ COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${linkname}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
- ${name}
+ $<TARGET_FILE_NAME:${target}>
${linkname}
- WORKING_DIRECTORY ${path}
DEPENDS ${target}
)
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 8c2deeb8e40..9c51cb797bb 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, 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
@@ -28,11 +29,16 @@ SET(MY_WARNING_FLAGS
-Woverloaded-virtual
-Wvla
-Wwrite-strings
- -Werror
)
+FOREACH(F ${MY_WARNING_FLAGS})
+ MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
+ENDFOREACH()
+
+SET(MY_ERROR_FLAGS -Werror)
+
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
- SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized)
+ SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF")
@@ -41,7 +47,7 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(WHERE DEBUG)
ENDIF()
-FOREACH(F ${MY_WARNING_FLAGS})
+FOREACH(F ${MY_ERROR_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} ${WHERE})
ENDFOREACH()
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 1cb6c81b627..fe976b96592 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -31,7 +31,6 @@ SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "")
SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "")
SET(HAVE_BFILL CACHE INTERNAL "")
SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")
-SET(HAVE_BSS_START CACHE INTERNAL "")
SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "")
SET(HAVE_COMPRESS CACHE INTERNAL "")
SET(HAVE_CRYPT CACHE INTERNAL "")
@@ -127,6 +126,7 @@ SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "")
+SET(HAVE_PTHREAD_GETAFFINITY_NP CACHE INTERNAL "")
SET(HAVE_PTHREAD_INIT CACHE INTERNAL "")
SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "")
SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "")
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index b00250cf367..d87d2c8fbd0 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -147,6 +147,7 @@ MACRO (MYSQL_CHECK_SSL)
SET(SSL_DEFINES "-DHAVE_OPENSSL")
SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES})
+ SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
HAVE_ERR_remove_thread_state)
CHECK_SYMBOL_EXISTS(EVP_aes_128_ctr "openssl/evp.h"
diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake
index 34d1f37c956..6e039bfeae3 100644
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@ -19,11 +19,11 @@ 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 --depth=1
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 --depth=1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE update_result)
ELSE()
diff --git a/config.h.cmake b/config.h.cmake
index 6e4af65c40e..0e19dd44694 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -200,6 +200,7 @@
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
+#cmakedefine HAVE_PTHREAD_GETAFFINITY_NP 1
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
#cmakedefine HAVE_PTHREAD_KILL 1
#cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1
@@ -249,7 +250,6 @@
/* Symbols we may use */
#cmakedefine HAVE_SYS_ERRLIST 1
/* used by stacktrace functions */
-#cmakedefine HAVE_BSS_START 1
#cmakedefine HAVE_BACKTRACE 1
#cmakedefine HAVE_BACKTRACE_SYMBOLS 1
#cmakedefine HAVE_BACKTRACE_SYMBOLS_FD 1
diff --git a/configure.cmake b/configure.cmake
index f94fb3642a5..58e1111bfc7 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -375,6 +375,7 @@ CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
+CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP)
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)
@@ -839,14 +840,6 @@ CHECK_CXX_SOURCE_COMPILES("
ENDIF()
CHECK_C_SOURCE_COMPILES("
- int main(int argc, char **argv)
- {
- extern char *__bss_start;
- return __bss_start ? 1 : 0;
- }"
-HAVE_BSS_START)
-
-CHECK_C_SOURCE_COMPILES("
int main()
{
extern void __attribute__((weak)) foo(void);
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 9845fee0948..831ea7fb431 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -320,8 +320,36 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args);
*/
#include <my_pthread.h>
+/*
+** Protects writing to all file descriptors, init_settings.keywords
+** pointer and it's pointee - a linked list with keywords.
+*/
static pthread_mutex_t THR_LOCK_dbug;
+static void LockMutex(CODE_STATE *cs)
+{
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
+ cs->locked++;
+}
+static void UnlockMutex(CODE_STATE *cs)
+{
+ --cs->locked;
+ assert(cs->locked >= 0);
+ if (cs->locked == 0)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+}
+static void LockIfInitSettings(CODE_STATE *cs)
+{
+ if (cs->stack == &init_settings)
+ LockMutex(cs);
+}
+static void UnlockIfInitSettings(CODE_STATE *cs)
+{
+ if (cs->stack == &init_settings)
+ UnlockMutex(cs);
+}
+
static CODE_STATE *code_state(void)
{
CODE_STATE *cs, **cs_ptr;
@@ -449,22 +477,16 @@ static int DbugParse(CODE_STATE *cs, const char *control)
const char *end;
int rel, f_used=0;
struct settings *stack;
- int org_cs_locked;
stack= cs->stack;
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
-
if (control[0] == '-' && control[1] == '#')
control+=2;
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
+ LockIfInitSettings(cs);
FreeState(cs, 0);
stack->flags= 0;
stack->delay= 0;
@@ -474,6 +496,7 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->functions= NULL;
stack->keywords= NULL;
stack->processes= NULL;
+ UnlockIfInitSettings(cs);
}
else if (!stack->out_file)
{
@@ -488,7 +511,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
{
/* never share with the global parent - it can change under your feet */
stack->functions= ListCopy(init_settings.functions);
+ LockMutex(cs);
stack->keywords= ListCopy(init_settings.keywords);
+ UnlockMutex(cs);
stack->processes= ListCopy(init_settings.processes);
}
else
@@ -512,21 +537,31 @@ static int DbugParse(CODE_STATE *cs, const char *control)
case 'd':
if (sign < 0 && control == end)
{
+ LockIfInitSettings(cs);
if (!is_shared(stack, keywords))
FreeList(stack->keywords);
stack->keywords=NULL;
+ UnlockIfInitSettings(cs);
stack->flags &= ~DEBUG_ON;
break;
}
+ LockIfInitSettings(cs);
if (rel && is_shared(stack, keywords))
stack->keywords= ListCopy(stack->keywords);
+ UnlockIfInitSettings(cs);
if (sign < 0)
{
if (DEBUGGING)
+ {
+ LockIfInitSettings(cs);
stack->keywords= ListDel(stack->keywords, control, end);
+ UnlockIfInitSettings(cs);
+ }
break;
}
+ LockIfInitSettings(cs);
stack->keywords= ListAdd(stack->keywords, control, end);
+ UnlockIfInitSettings(cs);
stack->flags |= DEBUG_ON;
break;
case 'D':
@@ -661,11 +696,6 @@ static int DbugParse(CODE_STATE *cs, const char *control)
control=end+1;
end= DbugStrTok(control);
}
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
return !rel || f_used;
}
@@ -998,7 +1028,9 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
get_code_state_if_not_set_or_return *buf=0;
+ LockIfInitSettings(cs);
op_list_to_buf('d', cs->stack->keywords, DEBUGGING);
+ UnlockIfInitSettings(cs);
op_int_to_buf ('D', cs->stack->delay, 0);
op_list_to_buf('f', cs->stack->functions, cs->stack->functions);
op_bool_to_buf('F', cs->stack->flags & FILE_ON);
@@ -1093,7 +1125,6 @@ int _db_explain_init_(char *buf, size_t len)
void _db_enter_(const char *_func_, const char *_file_,
uint _line_, struct _db_stack_frame_ *_stack_frame_)
{
- int save_errno, org_cs_locked;
CODE_STATE *cs;
if (!((cs=code_state())))
{
@@ -1101,7 +1132,6 @@ void _db_enter_(const char *_func_, const char *_file_,
_stack_frame_->prev= 0;
return;
}
- save_errno= errno;
_stack_frame_->line= -1;
_stack_frame_->func= cs->func;
@@ -1122,20 +1152,14 @@ void _db_enter_(const char *_func_, const char *_file_,
cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
+ int save_errno= errno;
+ LockMutex(cs);
DoPrefix(cs, _line_);
Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file->file, ">%s\n", cs->func);
- DbugFlush(cs); /* This does a unlock */
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
+ UnlockMutex(cs);
+ DbugFlush(cs);
+ errno=save_errno;
}
break;
case DISABLE_TRACE:
@@ -1144,7 +1168,6 @@ void _db_enter_(const char *_func_, const char *_file_,
case DONT_TRACE:
break;
}
- errno=save_errno;
}
/*
@@ -1169,7 +1192,6 @@ void _db_enter_(const char *_func_, const char *_file_,
void _db_return_(struct _db_stack_frame_ *_stack_frame_)
{
- int save_errno=errno;
uint _slevel_= _stack_frame_->level & ~TRACE_ON;
CODE_STATE *cs;
get_code_state_or_return;
@@ -1186,25 +1208,18 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
if (DoTrace(cs) & DO_TRACE)
{
- int org_cs_locked;
if ((cs->stack->flags & SANITY_CHECK_ON) && sf_sanity())
cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
+ int save_errno=errno;
+ LockMutex(cs);
DoPrefix(cs, _stack_frame_->line);
Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file->file, "<%s\n", cs->func);
+ UnlockMutex(cs);
DbugFlush(cs);
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
+ errno=save_errno;
}
}
/*
@@ -1216,7 +1231,6 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
cs->file= _stack_frame_->file;
if (cs->framep != NULL)
cs->framep= cs->framep->prev;
- errno=save_errno;
}
@@ -1281,18 +1295,14 @@ void _db_doprnt_(const char *format,...)
{
va_list args;
CODE_STATE *cs;
- int save_errno, org_cs_locked;
+ int save_errno;
get_code_state_or_return;
va_start(args,format);
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
save_errno=errno;
+ LockMutex(cs);
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
@@ -1300,12 +1310,8 @@ void _db_doprnt_(const char *format,...)
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->func);
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword);
DbugVfprintf(cs->stack->out_file->file, format, args);
+ UnlockMutex(cs);
DbugFlush(cs);
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
errno=save_errno;
va_end(args);
@@ -1345,17 +1351,13 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args)
void _db_dump_(uint _line_, const char *keyword,
const unsigned char *memory, size_t length)
{
- int pos, org_cs_locked;
+ int pos;
CODE_STATE *cs;
get_code_state_or_return;
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
if (_db_keyword_(cs, keyword, 0))
{
+ LockMutex(cs);
DoPrefix(cs, _line_);
if (TRACING)
{
@@ -1383,13 +1385,9 @@ void _db_dump_(uint _line_, const char *keyword,
fputc(' ',cs->stack->out_file->file);
}
(void) fputc('\n',cs->stack->out_file->file);
+ UnlockMutex(cs);
DbugFlush(cs);
}
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
}
@@ -1617,8 +1615,13 @@ static void PushState(CODE_STATE *cs)
static void FreeState(CODE_STATE *cs, int free_state)
{
struct settings *state= cs->stack;
+ LockIfInitSettings(cs);
if (!is_shared(state, keywords))
+ {
FreeList(state->keywords);
+ state->keywords= NULL;
+ }
+ UnlockIfInitSettings(cs);
if (!is_shared(state, functions))
FreeList(state->functions);
if (!is_shared(state, processes))
@@ -1697,8 +1700,6 @@ void _db_end_()
static int DoTrace(CODE_STATE *cs)
{
int res= DONT_TRACE;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
if ((cs->stack->maxdepth == 0 || cs->level <= cs->stack->maxdepth) &&
InList(cs->stack->processes, cs->process, 0) & (MATCHED|INCLUDE))
{
@@ -1723,8 +1724,6 @@ static int DoTrace(CODE_STATE *cs)
break;
}
}
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
return res;
}
@@ -1764,11 +1763,9 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword, int strict)
if (!(DEBUGGING && (DoTrace(cs) & DO_TRACE)))
return 0;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
+ LockIfInitSettings(cs);
res= (InList(cs->stack->keywords, keyword, strict) & match);
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
+ UnlockIfInitSettings(cs);
return res != 0;
}
@@ -1995,16 +1992,16 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
sFILE *fp;
if (!cs || !cs->stack || !cs->stack->out_file)
return;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
fp= cs->stack->out_file;
if (--fp->used == 0)
{
if (fclose(fp->file) == EOF)
{
+ LockMutex(cs);
(void) fprintf(stderr, ERR_CLOSE, cs->process);
perror("");
+ UnlockMutex(cs);
}
else
{
@@ -2012,8 +2009,6 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
}
}
cs->stack->out_file= new_value;
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
}
@@ -2196,9 +2191,7 @@ void _db_flush_()
get_code_state_or_return;
if (DEBUGGING)
{
- pthread_mutex_lock(&THR_LOCK_dbug);
(void) fflush(cs->stack->out_file->file);
- pthread_mutex_unlock(&THR_LOCK_dbug);
}
}
@@ -2226,16 +2219,14 @@ void _db_lock_file_()
{
CODE_STATE *cs;
get_code_state_or_return;
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked=1;
+ LockMutex(cs);
}
void _db_unlock_file_()
{
CODE_STATE *cs;
get_code_state_or_return;
- cs->locked=0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
+ UnlockMutex(cs);
}
const char* _db_get_func_(void)
diff --git a/dbug/dbug_add_tags.pl b/dbug/dbug_add_tags.pl
index 7be8fb9b18d..f117bdcd65b 100755
--- a/dbug/dbug_add_tags.pl
+++ b/dbug/dbug_add_tags.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2002 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/dbug/remove_function_from_trace.pl b/dbug/remove_function_from_trace.pl
index 380df168caf..67d7fa54b6a 100755
--- a/dbug/remove_function_from_trace.pl
+++ b/dbug/remove_function_from_trace.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
die <<EEE unless @ARGV;
Usage: $0 func1 [func2 [ ...] ]
diff --git a/dbug/tests.c b/dbug/tests.c
index 70424046bf4..3e77bf82236 100644
--- a/dbug/tests.c
+++ b/dbug/tests.c
@@ -4,6 +4,10 @@
char *push1=0;
+#ifndef DBUG_TRACE
+#define DBUG_TRACE
+#endif
+
#include <my_global.h> /* This includes dbug.h */
#include <my_sys.h>
#include <my_pthread.h>
diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop
index ee0488580f6..b995f44a007 100644
--- a/debian/additions/innotop/innotop
+++ b/debian/additions/innotop/innotop
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/bin/perl
# vim: tw=160:nowrap:expandtab:tabstop=3:shiftwidth=3:softtabstop=3
diff --git a/debian/additions/mysqlreport b/debian/additions/mysqlreport
index 64eaf93783a..86a57bff19c 100755
--- a/debian/additions/mysqlreport
+++ b/debian/additions/mysqlreport
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
# mysqlreport v4.0 Oct 23 2015
# http://hackmysql.com/mysqlreport
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 687f2356153..ddef69bb350 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -26,6 +26,12 @@ then
# Don't include test suite package on Travis-CI to make the build time shorter
sed '/Package: mariadb-test-data/,/^$/d' -i debian/control
sed '/Package: mariadb-test/,/^$/d' -i debian/control
+ sed '/Package: mariadb-plugin-tokudb/,/^$/d' -i debian/control
+ sed '/Package: mariadb-plugin-mroonga/,/^$/d' -i debian/control
+ sed '/Package: mariadb-plugin-spider/,/^$/d' -i debian/control
+ sed '/Package: mariadb-plugin-oqgraph/,/^$/d' -i debian/control
+ export MYSQL_COMPILER_LAUNCHER=ccache
+ sed 's|-DDEB|-DPLUGIN_TOKUDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_PERFSCHEMA=NO -WITH_EMBEDDED_SERVER=OFF -DDEB|' -i debian/rules
fi
diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install
index e62aad1b43f..856cdacfd95 100644
--- a/debian/libmariadb-dev.install
+++ b/debian/libmariadb-dev.install
@@ -5,5 +5,5 @@ usr/lib/*/libmysqlclient.so
usr/lib/*/libmariadbclient.so
usr/lib/*/libmariadbclient.a
usr/lib/*/libmysqlservices.a
+usr/lib/*/pkgconfig/mariadb.pc
usr/share/aclocal/mysql.m4
-usr/share/pkgconfig/mariadb.pc
diff --git a/debian/mariadb-server-10.2.install b/debian/mariadb-server-10.2.install
index 1ac1c67472c..d35fdf87b94 100644
--- a/debian/mariadb-server-10.2.install
+++ b/debian/mariadb-server-10.2.install
@@ -3,7 +3,9 @@ debian/additions/debian-start.inc.sh usr/share/mysql
debian/additions/echo_stderr usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
etc/apparmor.d/usr.sbin.mysqld
+etc/security/user_map.conf
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
+lib/*/security/pam_user_map.so
usr/bin/aria_chk
usr/bin/aria_dump_log
usr/bin/aria_ftdump
diff --git a/debian/mariadb-server-10.2.preinst b/debian/mariadb-server-10.2.preinst
index ed987507d18..161d9caee6e 100644
--- a/debian/mariadb-server-10.2.preinst
+++ b/debian/mariadb-server-10.2.preinst
@@ -25,7 +25,7 @@ stop_server() {
# Return immediately if there are no mysql processes running
# as there is no point in trying to shutdown in that case.
- if ! pgrep mysqld > /dev/null; then return; fi
+ if ! pgrep --ns $$ mysqld > /dev/null; then return; fi
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
diff --git a/debian/rules b/debian/rules
index 3b1952ad2b9..809911d4179 100755
--- a/debian/rules
+++ b/debian/rules
@@ -86,9 +86,6 @@ endif
$${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_C_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_BUILD_ARCH) \
-DBUILD_CONFIG=mysql_release \
- -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
- -DINSTALL_PLUGINDIR=lib/mysql/plugin \
- -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \
-DDEB=$(DISTRIBUTION) ..'
touch $@
@@ -124,8 +121,13 @@ endif
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service
cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.2.mariadb@.service
- # make install
- cd $(BUILDDIR) && $(MAKE) install DESTDIR=$(TMP)
+ # Run 'make install' without output since it is uninteresting and
+ # silencing it helps to make overall build log shorter and more readable
+ @echo "Running $(MAKE) install DESTDIR=$(TMP) ..."
+ cd $(BUILDDIR) && $(MAKE) install DESTDIR=$(TMP) > /dev/null
+
+ # If mariadb-test package is removed, also remove most of it's files
+ grep --quiet "Package: mariadb-test" debian/control || rm -rf $(TMP)/usr/share/mysql/mysql-test
# Delete runnable files we don't want to have in the test data package.
# This avoids triggering multiple Lintian errors.
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 39b2915bc00..9408d925a2d 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -787,6 +787,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'x':
case 's':
case 'M':
+ case 'T':
chksum= my_checksum(chksum, (uchar*) start, (uint) (p + 1 - start));
start= 0; /* Not in format specifier anymore */
break;
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt
index 8562ded85a1..fd3ebd68d64 100644
--- a/extra/mariabackup/CMakeLists.txt
+++ b/extra/mariabackup/CMakeLists.txt
@@ -93,7 +93,7 @@ ENDIF()
########################################################################
-# xbstream binary
+# mbstream binary
########################################################################
MYSQL_ADD_EXECUTABLE(mbstream
ds_buffer.cc
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 524177d7e33..0ba220364e2 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1448,7 +1448,7 @@ out:
void backup_fix_ddl(void);
-static lsn_t get_current_lsn(MYSQL *connection)
+lsn_t get_current_lsn(MYSQL *connection)
{
static const char lsn_prefix[] = "\nLog sequence number ";
lsn_t lsn = 0;
@@ -1669,6 +1669,9 @@ ibx_copy_incremental_over_full()
}
}
+ if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir)))
+ goto cleanup;
+
/* copy buffer pool dump */
if (innobase_buffer_pool_filename) {
const char *src_name;
@@ -1783,7 +1786,7 @@ apply_log_finish()
bool
copy_back()
{
- bool ret;
+ bool ret = false;
datadir_iter_t *it = NULL;
datadir_node_t node;
char *dst_dir;
@@ -2180,20 +2183,26 @@ static bool backup_files_from_datadir(const char *dir_path)
if (info.type != OS_FILE_TYPE_FILE)
continue;
- const char *pname = strrchr(info.name, IF_WIN('\\', '/'));
+ const char *pname = strrchr(info.name, OS_PATH_SEPARATOR);
if (!pname)
pname = info.name;
- /* Copy aria log files, and aws keys for encryption plugins.*/
- const char *prefixes[] = { "aria_log", "aws-kms-key" };
- for (size_t i = 0; i < array_elements(prefixes); i++) {
- if (starts_with(pname, prefixes[i])) {
- ret = copy_file(ds_data, info.name, info.name, 1);
- if (!ret) {
- break;
- }
- }
- }
+ if (!starts_with(pname, "aws-kms-key") &&
+ !starts_with(pname, "aria_log"))
+ /* For ES exchange the above line with the following code:
+ (!xtrabackup_prepare || !xtrabackup_incremental_dir ||
+ !starts_with(pname, "aria_log")))
+ */
+ continue;
+
+ if (xtrabackup_prepare && xtrabackup_incremental_dir &&
+ file_exists(info.name))
+ unlink(info.name);
+
+ std::string full_path(dir_path);
+ full_path.append(1, OS_PATH_SEPARATOR).append(info.name);
+ if (!(ret = copy_file(ds_data, full_path.c_str() , info.name, 1)))
+ break;
}
os_file_closedir(dir);
return ret;
diff --git a/extra/mariabackup/backup_copy.h b/extra/mariabackup/backup_copy.h
index fbc09eaded3..7c886719f37 100644
--- a/extra/mariabackup/backup_copy.h
+++ b/extra/mariabackup/backup_copy.h
@@ -3,6 +3,7 @@
#define XTRABACKUP_BACKUP_COPY_H
#include <my_global.h>
+#include <mysql.h>
#include "datasink.h"
/* special files */
@@ -48,4 +49,7 @@ is_path_separator(char);
bool
directory_exists(const char *dir, bool create);
+lsn_t
+get_current_lsn(MYSQL *connection);
+
#endif
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index 843ebf2663e..1d7242c5c75 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -326,194 +326,212 @@ check_server_version(unsigned long version_number,
/*********************************************************************//**
Receive options important for XtraBackup from MySQL server.
@return true on success. */
-bool
-get_mysql_vars(MYSQL *connection)
+bool get_mysql_vars(MYSQL *connection)
{
- char *gtid_mode_var = NULL;
- char *version_var = NULL;
- char *version_comment_var = NULL;
- char *innodb_version_var = NULL;
- char *have_backup_locks_var = NULL;
- char *log_bin_var = NULL;
- char *lock_wait_timeout_var= NULL;
- char *wsrep_on_var = NULL;
- char *slave_parallel_workers_var = NULL;
- char *gtid_slave_pos_var = NULL;
- char *innodb_buffer_pool_filename_var = NULL;
- char *datadir_var = NULL;
- char *innodb_log_group_home_dir_var = NULL;
- char *innodb_log_file_size_var = NULL;
- char *innodb_log_files_in_group_var = NULL;
- char *innodb_data_file_path_var = NULL;
- char *innodb_data_home_dir_var = NULL;
- char *innodb_undo_directory_var = NULL;
- char *innodb_page_size_var = NULL;
- char *innodb_undo_tablespaces_var = NULL;
- char *page_zip_level_var = NULL;
- char *endptr;
- unsigned long server_version = mysql_get_server_version(connection);
-
- bool ret = true;
-
- mysql_variable mysql_vars[] = {
- {"have_backup_locks", &have_backup_locks_var},
- {"log_bin", &log_bin_var},
- {"lock_wait_timeout", &lock_wait_timeout_var},
- {"gtid_mode", &gtid_mode_var},
- {"version", &version_var},
- {"version_comment", &version_comment_var},
- {"innodb_version", &innodb_version_var},
- {"wsrep_on", &wsrep_on_var},
- {"slave_parallel_workers", &slave_parallel_workers_var},
- {"gtid_slave_pos", &gtid_slave_pos_var},
- {"innodb_buffer_pool_filename",
- &innodb_buffer_pool_filename_var},
- {"datadir", &datadir_var},
- {"innodb_log_group_home_dir", &innodb_log_group_home_dir_var},
- {"innodb_log_file_size", &innodb_log_file_size_var},
- {"innodb_log_files_in_group", &innodb_log_files_in_group_var},
- {"innodb_data_file_path", &innodb_data_file_path_var},
- {"innodb_data_home_dir", &innodb_data_home_dir_var},
- {"innodb_undo_directory", &innodb_undo_directory_var},
- {"innodb_page_size", &innodb_page_size_var},
- {"innodb_undo_tablespaces", &innodb_undo_tablespaces_var},
- {"innodb_compression_level", &page_zip_level_var},
- {NULL, NULL}
- };
-
- read_mysql_variables(connection, "SHOW VARIABLES",
- mysql_vars, true);
+ char *gtid_mode_var= NULL;
+ char *version_var= NULL;
+ char *version_comment_var= NULL;
+ char *innodb_version_var= NULL;
+ char *have_backup_locks_var= NULL;
+ char *log_bin_var= NULL;
+ char *lock_wait_timeout_var= NULL;
+ char *wsrep_on_var= NULL;
+ char *slave_parallel_workers_var= NULL;
+ char *gtid_slave_pos_var= NULL;
+ char *innodb_buffer_pool_filename_var= NULL;
+ char *datadir_var= NULL;
+ char *innodb_log_group_home_dir_var= NULL;
+ char *innodb_log_file_size_var= NULL;
+ char *innodb_log_files_in_group_var= NULL;
+ char *innodb_data_file_path_var= NULL;
+ char *innodb_data_home_dir_var= NULL;
+ char *innodb_undo_directory_var= NULL;
+ char *innodb_page_size_var= NULL;
+ char *innodb_undo_tablespaces_var= NULL;
+ char *page_zip_level_var= NULL;
+ char *ignore_db_dirs= NULL;
+ char *endptr;
+ unsigned long server_version= mysql_get_server_version(connection);
+
+ bool ret= true;
+
+ mysql_variable mysql_vars[]= {
+ {"have_backup_locks", &have_backup_locks_var},
+ {"log_bin", &log_bin_var},
+ {"lock_wait_timeout", &lock_wait_timeout_var},
+ {"gtid_mode", &gtid_mode_var},
+ {"version", &version_var},
+ {"version_comment", &version_comment_var},
+ {"innodb_version", &innodb_version_var},
+ {"wsrep_on", &wsrep_on_var},
+ {"slave_parallel_workers", &slave_parallel_workers_var},
+ {"gtid_slave_pos", &gtid_slave_pos_var},
+ {"innodb_buffer_pool_filename", &innodb_buffer_pool_filename_var},
+ {"datadir", &datadir_var},
+ {"innodb_log_group_home_dir", &innodb_log_group_home_dir_var},
+ {"innodb_log_file_size", &innodb_log_file_size_var},
+ {"innodb_log_files_in_group", &innodb_log_files_in_group_var},
+ {"innodb_data_file_path", &innodb_data_file_path_var},
+ {"innodb_data_home_dir", &innodb_data_home_dir_var},
+ {"innodb_undo_directory", &innodb_undo_directory_var},
+ {"innodb_page_size", &innodb_page_size_var},
+ {"innodb_undo_tablespaces", &innodb_undo_tablespaces_var},
+ {"innodb_compression_level", &page_zip_level_var},
+ {"ignore_db_dirs", &ignore_db_dirs},
+ {NULL, NULL}};
+
+ read_mysql_variables(connection, "SHOW VARIABLES", mysql_vars, true);
+
+ if (have_backup_locks_var != NULL && !opt_no_backup_locks)
+ {
+ have_backup_locks= true;
+ }
- if (have_backup_locks_var != NULL && !opt_no_backup_locks) {
- have_backup_locks = true;
- }
+ if (opt_binlog_info == BINLOG_INFO_AUTO)
+ {
+ if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
+ opt_binlog_info= BINLOG_INFO_ON;
+ else
+ opt_binlog_info= BINLOG_INFO_OFF;
+ }
- if (opt_binlog_info == BINLOG_INFO_AUTO) {
- if (log_bin_var != NULL && !strcmp(log_bin_var, "ON"))
- opt_binlog_info = BINLOG_INFO_ON;
- else
- opt_binlog_info = BINLOG_INFO_OFF;
- }
+ if (lock_wait_timeout_var != NULL)
+ {
+ have_lock_wait_timeout= true;
+ }
- if (lock_wait_timeout_var != NULL) {
- have_lock_wait_timeout = true;
- }
+ if (wsrep_on_var != NULL)
+ {
+ have_galera_enabled= true;
+ }
- if (wsrep_on_var != NULL) {
- have_galera_enabled = true;
- }
+ /* Check server version compatibility and detect server flavor */
- /* Check server version compatibility and detect server flavor */
+ if (!(ret= check_server_version(server_version, version_var,
+ version_comment_var, innodb_version_var)))
+ {
+ goto out;
+ }
- if (!(ret = check_server_version(server_version, version_var,
- version_comment_var,
- innodb_version_var))) {
- goto out;
- }
+ if (server_version > 50500)
+ {
+ have_flush_engine_logs= true;
+ }
- if (server_version > 50500) {
- have_flush_engine_logs = true;
- }
+ if (slave_parallel_workers_var != NULL &&
+ atoi(slave_parallel_workers_var) > 0)
+ {
+ have_multi_threaded_slave= true;
+ }
- if (slave_parallel_workers_var != NULL
- && atoi(slave_parallel_workers_var) > 0) {
- have_multi_threaded_slave = true;
- }
+ if (innodb_buffer_pool_filename_var != NULL)
+ {
+ buffer_pool_filename= strdup(innodb_buffer_pool_filename_var);
+ }
- if (innodb_buffer_pool_filename_var != NULL) {
- buffer_pool_filename = strdup(innodb_buffer_pool_filename_var);
- }
+ if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) ||
+ (gtid_slave_pos_var && *gtid_slave_pos_var))
+ {
+ have_gtid_slave= true;
+ }
- if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) ||
- (gtid_slave_pos_var && *gtid_slave_pos_var)) {
- have_gtid_slave = true;
- }
+ msg("Using server version %s", version_var);
- msg("Using server version %s", version_var);
+ if (!(ret= detect_mysql_capabilities_for_backup()))
+ {
+ goto out;
+ }
- if (!(ret = detect_mysql_capabilities_for_backup())) {
- goto out;
- }
+ /* make sure datadir value is the same in configuration file */
+ if (check_if_param_set("datadir"))
+ {
+ if (!directory_exists(mysql_data_home, false))
+ {
+ msg("Warning: option 'datadir' points to "
+ "nonexistent directory '%s'",
+ mysql_data_home);
+ }
+ if (!directory_exists(datadir_var, false))
+ {
+ msg("Warning: MySQL variable 'datadir' points to "
+ "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",
+ mysql_data_home, datadir_var);
+ }
+ }
- /* make sure datadir value is the same in configuration file */
- if (check_if_param_set("datadir")) {
- if (!directory_exists(mysql_data_home, false)) {
- msg("Warning: option 'datadir' points to "
- "nonexistent directory '%s'", mysql_data_home);
- }
- if (!directory_exists(datadir_var, false)) {
- msg("Warning: MySQL variable 'datadir' points to "
- "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",
- mysql_data_home, datadir_var);
- }
- }
+ /* get some default values is they are missing from my.cnf */
+ if (datadir_var && *datadir_var)
+ {
+ strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1);
+ mysql_data_home= mysql_real_data_home;
+ }
- /* get some default values is they are missing from my.cnf */
- if (datadir_var && *datadir_var) {
- strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1);
- mysql_data_home= mysql_real_data_home;
- }
+ if (innodb_data_file_path_var && *innodb_data_file_path_var)
+ {
+ innobase_data_file_path= my_strdup(innodb_data_file_path_var, MYF(MY_FAE));
+ }
- if (innodb_data_file_path_var && *innodb_data_file_path_var) {
- innobase_data_file_path = my_strdup(
- innodb_data_file_path_var, MYF(MY_FAE));
- }
+ if (innodb_data_home_dir_var)
+ {
+ innobase_data_home_dir= my_strdup(innodb_data_home_dir_var, MYF(MY_FAE));
+ }
- if (innodb_data_home_dir_var) {
- innobase_data_home_dir = my_strdup(
- innodb_data_home_dir_var, MYF(MY_FAE));
- }
+ if (innodb_log_group_home_dir_var && *innodb_log_group_home_dir_var)
+ {
+ srv_log_group_home_dir=
+ my_strdup(innodb_log_group_home_dir_var, MYF(MY_FAE));
+ }
- if (innodb_log_group_home_dir_var
- && *innodb_log_group_home_dir_var) {
- srv_log_group_home_dir = my_strdup(
- innodb_log_group_home_dir_var, MYF(MY_FAE));
- }
+ if (innodb_undo_directory_var && *innodb_undo_directory_var)
+ {
+ srv_undo_dir= my_strdup(innodb_undo_directory_var, MYF(MY_FAE));
+ }
- if (innodb_undo_directory_var && *innodb_undo_directory_var) {
- srv_undo_dir = my_strdup(
- innodb_undo_directory_var, MYF(MY_FAE));
- }
+ if (innodb_log_files_in_group_var)
+ {
+ srv_n_log_files= strtol(innodb_log_files_in_group_var, &endptr, 10);
+ ut_ad(*endptr == 0);
+ }
- if (innodb_log_files_in_group_var) {
- srv_n_log_files = strtol(
- innodb_log_files_in_group_var, &endptr, 10);
- ut_ad(*endptr == 0);
- }
+ if (innodb_log_file_size_var)
+ {
+ srv_log_file_size= strtoll(innodb_log_file_size_var, &endptr, 10);
+ ut_ad(*endptr == 0);
+ }
- if (innodb_log_file_size_var) {
- srv_log_file_size = strtoll(
- innodb_log_file_size_var, &endptr, 10);
- ut_ad(*endptr == 0);
- }
+ if (innodb_page_size_var)
+ {
+ innobase_page_size= strtoll(innodb_page_size_var, &endptr, 10);
+ ut_ad(*endptr == 0);
+ }
- if (innodb_page_size_var) {
- innobase_page_size = strtoll(
- innodb_page_size_var, &endptr, 10);
- ut_ad(*endptr == 0);
- }
+ if (innodb_undo_tablespaces_var)
+ {
+ srv_undo_tablespaces= strtoul(innodb_undo_tablespaces_var, &endptr, 10);
+ ut_ad(*endptr == 0);
+ }
- if (innodb_undo_tablespaces_var) {
- srv_undo_tablespaces = strtoul(innodb_undo_tablespaces_var,
- &endptr, 10);
- ut_ad(*endptr == 0);
- }
+ if (page_zip_level_var != NULL)
+ {
+ page_zip_level= strtoul(page_zip_level_var, &endptr, 10);
+ ut_ad(*endptr == 0);
+ }
- if (page_zip_level_var != NULL) {
- page_zip_level = strtoul(page_zip_level_var, &endptr, 10);
- ut_ad(*endptr == 0);
- }
+ if (ignore_db_dirs)
+ xb_load_list_string(ignore_db_dirs, ",", register_ignore_db_dirs_filter);
out:
- free_mysql_variables(mysql_vars);
+ free_mysql_variables(mysql_vars);
- return(ret);
+ return (ret);
}
/*********************************************************************//**
@@ -941,79 +959,93 @@ Function acquires either a backup tables lock, if supported
by the server, or a global read lock (FLUSH TABLES WITH READ LOCK)
otherwise.
@returns true if lock acquired */
-bool
-lock_tables(MYSQL *connection)
+bool lock_tables(MYSQL *connection)
{
- if (have_lock_wait_timeout) {
- /* Set the maximum supported session value for
- lock_wait_timeout to prevent unnecessary timeouts when the
- global value is changed from the default */
- xb_mysql_query(connection,
- "SET SESSION lock_wait_timeout=31536000", false);
- }
+ if (have_lock_wait_timeout || opt_lock_wait_timeout)
+ {
+ char buf[FN_REFLEN];
+ /* Set the maximum supported session value for
+ lock_wait_timeout if opt_lock_wait_timeout is not set to prevent
+ unnecessary timeouts when the global value is changed from the default */
+ snprintf(buf, sizeof(buf), "SET SESSION lock_wait_timeout=%u",
+ opt_lock_wait_timeout ? opt_lock_wait_timeout : 31536000);
+ xb_mysql_query(connection, buf, false);
+ }
- if (have_backup_locks) {
- msg("Executing LOCK TABLES FOR BACKUP...");
- xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
- return(true);
- }
+ if (have_backup_locks)
+ {
+ 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_ddl_per_table)
+ {
+ start_mdl_waiters_killer();
+ }
- if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) {
+ 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.
+ /* 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.
- */
+ Option lock_wait_timeout serve the same purpose and is not
+ compatible with this trick.
+ */
- msg("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...");
+ msg("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...");
- xb_mysql_query(connection,
- "FLUSH NO_WRITE_TO_BINLOG TABLES", false);
- }
+ 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)) {
- return(false);
- }
- }
+ if (opt_lock_wait_timeout)
+ {
+ if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
+ opt_lock_wait_threshold))
+ {
+ return (false);
+ }
+ }
- msg("Executing FLUSH TABLES WITH READ LOCK...");
+ msg("Executing FLUSH TABLES WITH READ LOCK...");
- if (opt_kill_long_queries_timeout) {
- start_query_killer();
- }
+ if (opt_kill_long_queries_timeout)
+ {
+ start_query_killer();
+ }
- if (have_galera_enabled) {
- xb_mysql_query(connection,
- "SET SESSION wsrep_causal_reads=0", false);
- }
+ if (have_galera_enabled)
+ {
+ xb_mysql_query(connection, "SET SESSION wsrep_causal_reads=0", false);
+ }
- xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false);
+ xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false, true);
+ /* Set the maximum supported session value for
+ lock_wait_timeout to prevent unnecessary timeouts when the
+ global value is changed from the default */
+ if (opt_lock_wait_timeout)
+ xb_mysql_query(connection, "SET SESSION lock_wait_timeout=31536000",
+ false);
- if (opt_lock_ddl_per_table) {
- stop_mdl_waiters_killer();
- }
+ if (opt_lock_ddl_per_table)
+ {
+ stop_mdl_waiters_killer();
+ }
- if (opt_kill_long_queries_timeout) {
- stop_query_killer();
- }
+ if (opt_kill_long_queries_timeout)
+ {
+ stop_query_killer();
+ }
- return(true);
+ return (true);
}
-
/*********************************************************************//**
If backup locks are used, execute LOCK BINLOG FOR BACKUP provided that we are
not in the --no-lock mode and the lock has not been acquired already.
@@ -1167,6 +1199,7 @@ write_slave_info(MYSQL *connection)
char *master = NULL;
char *filename = NULL;
char *gtid_executed = NULL;
+ char *using_gtid = NULL;
char *position = NULL;
char *gtid_slave_pos = NULL;
char *ptr;
@@ -1177,6 +1210,7 @@ write_slave_info(MYSQL *connection)
{"Relay_Master_Log_File", &filename},
{"Exec_Master_Log_Pos", &position},
{"Executed_Gtid_Set", &gtid_executed},
+ {"Using_Gtid", &using_gtid},
{NULL, NULL}
};
@@ -1217,7 +1251,8 @@ write_slave_info(MYSQL *connection)
ut_a(asprintf(&mysql_slave_position,
"master host '%s', purge list '%s'",
master, gtid_executed) != -1);
- } else if (gtid_slave_pos && *gtid_slave_pos) {
+ } else if (gtid_slave_pos && *gtid_slave_pos &&
+ !(using_gtid && !strncmp(using_gtid, "No", 2))) {
/* MariaDB >= 10.0 with GTID enabled */
result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
"SET GLOBAL gtid_slave_pos = '%s';\n"
diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc
index 952d1f4ec63..f1627dd1bc5 100644
--- a/extra/mariabackup/innobackupex.cc
+++ b/extra/mariabackup/innobackupex.cc
@@ -586,8 +586,8 @@ static struct my_option ibx_long_options[] =
{"stream", OPT_STREAM, "This option specifies the format in which to "
"do the streamed backup. The option accepts a string argument. The "
"backup will be done to STDOUT in the specified format. Currently, "
- "the only supported formats are tar and xbstream. This option is "
- "passed directly to xtrabackup's --stream option.",
+ "the only supported formats are tar and mbstream/xbstream. This "
+ "option is passed directly to xtrabackup's --stream option.",
(uchar*) &ibx_xtrabackup_stream_str,
(uchar*) &ibx_xtrabackup_stream_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -655,7 +655,7 @@ innobackupex [--compress] [--compress-threads=NUMBER-OF-THREADS] [--compress-chu
[--include=REGEXP] [--user=NAME]\n\
[--password=WORD] [--port=PORT] [--socket=SOCKET]\n\
[--no-timestamp] [--ibbackup=IBBACKUP-BINARY]\n\
- [--slave-info] [--galera-info] [--stream=tar|xbstream]\n\
+ [--slave-info] [--galera-info] [--stream=tar|mbstream|xbstream]\n\
[--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME]\n\
[--databases=LIST] [--no-lock] \n\
[--tmpdir=DIRECTORY] [--tables-file=FILE]\n\
@@ -751,7 +751,8 @@ ibx_get_one_option(int optid,
}
break;
case OPT_STREAM:
- if (!strcasecmp(argument, "xbstream"))
+ if (!strcasecmp(argument, "mbstream") ||
+ !strcasecmp(argument, "xbstream"))
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
else {
ibx_msg("Invalid --stream argument: %s\n", argument);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index ec53554e2d8..364d1242b29 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -71,6 +71,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <srv0start.h>
#include "trx0sys.h"
#include <buf0dblwr.h>
+#include "ha_innodb.h"
#include <list>
#include <sstream>
@@ -102,6 +103,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <srv0srv.h>
#include <crc_glue.h>
#include <log.h>
+#include <derror.h>
int sys_var_init();
@@ -119,6 +121,8 @@ my_bool xtrabackup_print_param;
my_bool xtrabackup_export;
+my_bool xtrabackup_rollback_xa;
+
longlong xtrabackup_use_memory;
uint opt_protocol;
@@ -735,11 +739,12 @@ typedef struct {
enum options_xtrabackup
{
- OPT_XTRA_TARGET_DIR = 1000, /* make sure it is larger
- than OPT_MAX_CLIENT_OPTION */
+ OPT_XTRA_TARGET_DIR= 1000, /* make sure it is larger
+ than OPT_MAX_CLIENT_OPTION */
OPT_XTRA_BACKUP,
OPT_XTRA_PREPARE,
OPT_XTRA_EXPORT,
+ OPT_XTRA_ROLLBACK_XA,
OPT_XTRA_PRINT_PARAM,
OPT_XTRA_USE_MEMORY,
OPT_XTRA_THROTTLE,
@@ -835,358 +840,405 @@ enum options_xtrabackup
OPT_XTRA_CHECK_PRIVILEGES
};
-struct my_option xb_client_options[] =
-{
- {"verbose", 'V', "display verbose output",
- (G_PTR*) &verbose, (G_PTR*) &verbose, 0, GET_BOOL, NO_ARG,
- FALSE, 0, 0, 0, 0, 0},
- {"version", 'v', "print xtrabackup version information",
- (G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL,
- NO_ARG, 0, 0, 0, 0, 0, 0},
- {"target-dir", OPT_XTRA_TARGET_DIR, "destination directory", (G_PTR*) &xtrabackup_target_dir,
- (G_PTR*) &xtrabackup_target_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"backup", OPT_XTRA_BACKUP, "take backup to target-dir",
- (G_PTR*) &xtrabackup_backup, (G_PTR*) &xtrabackup_backup,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"prepare", OPT_XTRA_PREPARE, "prepare a backup for starting mysql server on the backup.",
- (G_PTR*) &xtrabackup_prepare, (G_PTR*) &xtrabackup_prepare,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"export", OPT_XTRA_EXPORT, "create files to import to another database when prepare.",
- (G_PTR*) &xtrabackup_export, (G_PTR*) &xtrabackup_export,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"print-param", OPT_XTRA_PRINT_PARAM, "print parameter of mysqld needed for copyback.",
- (G_PTR*) &xtrabackup_print_param, (G_PTR*) &xtrabackup_print_param,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"use-memory", OPT_XTRA_USE_MEMORY, "The value is used instead of buffer_pool_size",
- (G_PTR*) &xtrabackup_use_memory, (G_PTR*) &xtrabackup_use_memory,
- 0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
- 1024*1024L, 0},
- {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS values (for '--backup')",
- (G_PTR*) &xtrabackup_throttle, (G_PTR*) &xtrabackup_throttle,
- 0, GET_LONG, REQUIRED_ARG, 0, 0, LONG_MAX, 0, 1, 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},
- {"log-copy-interval", OPT_XTRA_LOG_COPY_INTERVAL, "time interval between checks done by log copying thread in milliseconds (default is 1 second).",
- (G_PTR*) &xtrabackup_log_copy_interval, (G_PTR*) &xtrabackup_log_copy_interval,
- 0, GET_LONG, REQUIRED_ARG, 1000, 0, LONG_MAX, 0, 1, 0},
- {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR, "(for --backup): save an extra copy of the xtrabackup_checkpoints file in this directory.",
- (G_PTR*) &xtrabackup_extra_lsndir, (G_PTR*) &xtrabackup_extra_lsndir,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"incremental-lsn", OPT_XTRA_INCREMENTAL, "(for --backup): copy only .ibd pages newer than specified LSN 'high:low'. ##ATTENTION##: If a wrong LSN value is specified, it is impossible to diagnose this, causing the backup to be unusable. Be careful!",
- (G_PTR*) &xtrabackup_incremental, (G_PTR*) &xtrabackup_incremental,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"incremental-basedir", OPT_XTRA_INCREMENTAL_BASEDIR, "(for --backup): copy only .ibd pages newer than backup at specified directory.",
- (G_PTR*) &xtrabackup_incremental_basedir, (G_PTR*) &xtrabackup_incremental_basedir,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"incremental-dir", OPT_XTRA_INCREMENTAL_DIR, "(for --prepare): apply .delta files and logfile in the specified directory.",
- (G_PTR*) &xtrabackup_incremental_dir, (G_PTR*) &xtrabackup_incremental_dir,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"tables", OPT_XTRA_TABLES, "filtering by regexp for table names.",
- (G_PTR*) &xtrabackup_tables, (G_PTR*) &xtrabackup_tables,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"tables_file", OPT_XTRA_TABLES_FILE, "filtering by list of the exact database.table name in the file.",
- (G_PTR*) &xtrabackup_tables_file, (G_PTR*) &xtrabackup_tables_file,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"databases", OPT_XTRA_DATABASES, "filtering by list of databases.",
- (G_PTR*) &xtrabackup_databases, (G_PTR*) &xtrabackup_databases,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"databases_file", OPT_XTRA_DATABASES_FILE,
- "filtering by list of databases in the file.",
- (G_PTR*) &xtrabackup_databases_file, (G_PTR*) &xtrabackup_databases_file,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"tables-exclude", OPT_XTRA_TABLES_EXCLUDE, "filtering by regexp for table names. "
- "Operates the same way as --tables, but matched names are excluded from backup. "
- "Note that this option has a higher priority than --tables.",
- (G_PTR*) &xtrabackup_tables_exclude, (G_PTR*) &xtrabackup_tables_exclude,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"databases-exclude", OPT_XTRA_DATABASES_EXCLUDE, "Excluding databases based on name, "
- "Operates the same way as --databases, but matched names are excluded from backup. "
- "Note that this option has a higher priority than --databases.",
- (G_PTR*) &xtrabackup_databases_exclude, (G_PTR*) &xtrabackup_databases_exclude,
- 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output "
- "in the specified format."
- "Supported format is 'xbstream'."
- ,
- (G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"compress", OPT_XTRA_COMPRESS, "Compress individual backup files using the "
- "specified compression algorithm. Currently the only supported algorithm "
- "is 'quicklz'. It is also the default algorithm, i.e. the one used when "
- "--compress is used without an argument.",
- (G_PTR*) &xtrabackup_compress_alg, (G_PTR*) &xtrabackup_compress_alg, 0,
- GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-
- {"compress-threads", OPT_XTRA_COMPRESS_THREADS,
- "Number of threads for parallel data compression. The default value is 1.",
- (G_PTR*) &xtrabackup_compress_threads, (G_PTR*) &xtrabackup_compress_threads,
- 0, GET_UINT, REQUIRED_ARG, 1, 1, UINT_MAX, 0, 0, 0},
-
- {"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE,
- "Size of working buffer(s) for compression threads in bytes. The default value is 64K.",
- (G_PTR*) &xtrabackup_compress_chunk_size, (G_PTR*) &xtrabackup_compress_chunk_size,
- 0, GET_ULL, REQUIRED_ARG, (1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0},
-
- {"incremental-force-scan", OPT_XTRA_INCREMENTAL_FORCE_SCAN,
- "Perform a full-scan incremental backup even in the presence of changed "
- "page bitmap data",
- (G_PTR*)&xtrabackup_incremental_force_scan,
- (G_PTR*)&xtrabackup_incremental_force_scan, 0, GET_BOOL, NO_ARG,
- 0, 0, 0, 0, 0, 0},
-
-
- {"close_files", OPT_CLOSE_FILES, "do not keep files opened. Use at your own "
- "risk.", (G_PTR*) &xb_close_files, (G_PTR*) &xb_close_files, 0, GET_BOOL,
- NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"core-file", OPT_CORE_FILE, "Write core on fatal signals", 0, 0, 0,
- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-
-
- {"copy-back", OPT_COPY_BACK, "Copy all the files in a previously made "
- "backup from the backup directory to their original locations.",
- (uchar *) &xtrabackup_copy_back, (uchar *) &xtrabackup_copy_back, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"move-back", OPT_MOVE_BACK, "Move all the files in a previously made "
- "backup from the backup directory to the actual datadir location. "
- "Use with caution, as it removes backup files.",
- (uchar *) &xtrabackup_move_back, (uchar *) &xtrabackup_move_back, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"galera-info", OPT_GALERA_INFO, "This options creates the "
- "xtrabackup_galera_info file which contains the local node state at "
- "the time of the backup. Option should be used when performing the "
- "backup of MariaDB Galera Cluster. Has no effect when backup locks "
- "are used to create the backup.",
- (uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"slave-info", OPT_SLAVE_INFO, "This option is useful when backing "
- "up a replication slave server. It prints the binary log position "
- "and name of the master server. It also writes this information to "
- "the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. "
- "A new slave for this master can be set up by starting a slave server "
- "on this backup and issuing a \"CHANGE MASTER\" command with the "
- "binary log position saved in the \"xtrabackup_slave_info\" file.",
- (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"no-lock", OPT_NO_LOCK, "Use this option to disable table lock "
- "with \"FLUSH TABLES WITH READ LOCK\". Use it only if ALL your "
- "tables are InnoDB and you DO NOT CARE about the binary log "
- "position of the backup. This option shouldn't be used if there "
- "are any DDL statements being executed or if any updates are "
- "happening on non-InnoDB tables (this includes the system MyISAM "
- "tables in the mysql database), otherwise it could lead to an "
- "inconsistent backup. If you are considering to use --no-lock "
- "because your backups are failing to acquire the lock, this could "
- "be because of incoming replication events preventing the lock "
- "from succeeding. Please try using --safe-slave-backup to "
- "momentarily stop the replication slave thread, this may help "
- "the backup to succeed and you then don't need to resort to "
- "using this option.",
- (uchar *) &opt_no_lock, (uchar *) &opt_no_lock, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"safe-slave-backup", OPT_SAFE_SLAVE_BACKUP, "Stop slave SQL thread "
- "and wait to start backup until Slave_open_temp_tables in "
- "\"SHOW STATUS\" is zero. If there are no open temporary tables, "
- "the backup will take place, otherwise the SQL thread will be "
- "started and stopped until there are no open temporary tables. "
- "The backup will fail if Slave_open_temp_tables does not become "
- "zero after --safe-slave-backup-timeout seconds. The slave SQL "
- "thread will be restarted when the backup finishes.",
- (uchar *) &opt_safe_slave_backup,
- (uchar *) &opt_safe_slave_backup,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"rsync", OPT_RSYNC, "Uses the rsync utility to optimize local file "
- "transfers. When this option is specified, innobackupex uses rsync "
- "to copy all non-InnoDB files instead of spawning a separate cp for "
- "each file, which can be much faster for servers with a large number "
- "of databases or tables. This option cannot be used together with "
- "--stream.",
- (uchar *) &opt_rsync, (uchar *) &opt_rsync,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS, "This "
- "option, when specified, makes --copy-back or --move-back transfer "
- "files to non-empty directories. Note that no existing files will be "
- "overwritten. If --copy-back or --nove-back has to copy a file from "
- "the backup directory which already exists in the destination "
- "directory, it will still fail with an error.",
- (uchar *) &opt_force_non_empty_dirs,
- (uchar *) &opt_force_non_empty_dirs,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"no-version-check", OPT_NO_VERSION_CHECK, "This option disables the "
- "version check which is enabled by the --version-check option.",
- (uchar *) &opt_noversioncheck,
- (uchar *) &opt_noversioncheck,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"no-backup-locks", OPT_NO_BACKUP_LOCKS, "This option controls if "
- "backup locks should be used instead of FLUSH TABLES WITH READ LOCK "
- "on the backup stage. The option has no effect when backup locks are "
- "not supported by the server. This option is enabled by default, "
- "disable with --no-backup-locks.",
- (uchar *) &opt_no_backup_locks,
- (uchar *) &opt_no_backup_locks,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"decompress", OPT_DECOMPRESS, "Decompresses all files with the .qp "
- "extension in a backup previously made with the --compress option.",
- (uchar *) &opt_decompress,
- (uchar *) &opt_decompress,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"user", 'u', "This option specifies the MySQL username used "
- "when connecting to the server, if that's not the current user. "
- "The option accepts a string argument. See mysql --help for details.",
- (uchar*) &opt_user, (uchar*) &opt_user, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"host", 'H', "This option specifies the host to use when "
- "connecting to the database server with TCP/IP. The option accepts "
- "a string argument. See mysql --help for details.",
- (uchar*) &opt_host, (uchar*) &opt_host, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"port", 'P', "This option specifies the port to use when "
- "connecting to the database server with TCP/IP. The option accepts "
- "a string argument. See mysql --help for details.",
- &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG,
- 0, 0, 0, 0, 0, 0},
-
- {"password", 'p', "This option specifies the password to use "
- "when connecting to the database. It accepts a string argument. "
- "See mysql --help for details.",
- 0, 0, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"protocol", OPT_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"socket", 'S', "This option specifies the socket to use when "
- "connecting to the local database server with a UNIX domain socket. "
- "The option accepts a string argument. See mysql --help for details.",
- (uchar*) &opt_socket, (uchar*) &opt_socket, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME,
- "This option specifies the name of the backup series stored in the "
- "PERCONA_SCHEMA.xtrabackup_history history record to base an "
- "incremental backup on. Xtrabackup will search the history table "
- "looking for the most recent (highest innodb_to_lsn), successful "
- "backup in the series and take the to_lsn value to use as the "
- "starting lsn for the incremental backup. This will be mutually "
- "exclusive with --incremental-history-uuid, --incremental-basedir "
- "and --incremental-lsn. If no valid lsn can be found (no series by "
- "that name, no successful backups by that name) xtrabackup will "
- "return with an error. It is used with the --incremental option.",
- (uchar*) &opt_incremental_history_name,
- (uchar*) &opt_incremental_history_name, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID,
- "This option specifies the UUID of the specific history record "
- "stored in the PERCONA_SCHEMA.xtrabackup_history to base an "
- "incremental backup on. --incremental-history-name, "
- "--incremental-basedir and --incremental-lsn. If no valid lsn can be "
- "found (no success record with that uuid) xtrabackup will return "
- "with an error. It is used with the --incremental option.",
- (uchar*) &opt_incremental_history_uuid,
- (uchar*) &opt_incremental_history_uuid, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"remove-original", OPT_REMOVE_ORIGINAL, "Remove .qp files after decompression.",
- (uchar *) &opt_remove_original,
- (uchar *) &opt_remove_original,
- 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-
- {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE,
- "This option specifies which types of queries are allowed to complete "
- "before innobackupex will issue the global lock. Default is all.",
- (uchar*) &opt_lock_wait_query_type,
- (uchar*) &opt_lock_wait_query_type, &query_type_typelib,
- GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0, 0},
-
- {"kill-long-query-type", OPT_KILL_LONG_QUERY_TYPE,
- "This option specifies which types of queries should be killed to "
- "unblock the global lock. Default is \"all\".",
- (uchar*) &opt_kill_long_query_type,
- (uchar*) &opt_kill_long_query_type, &query_type_typelib,
- GET_ENUM, REQUIRED_ARG, QUERY_TYPE_SELECT, 0, 0, 0, 0, 0},
-
- {"history", OPT_HISTORY,
- "This option enables the tracking of backup history in the "
- "PERCONA_SCHEMA.xtrabackup_history table. An optional history "
- "series name may be specified that will be placed with the history "
- "record for the current backup being taken.",
- NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-
- {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT,
- "This option specifies the number of seconds innobackupex waits "
- "between starting FLUSH TABLES WITH READ LOCK and killing those "
- "queries that block it. Default is 0 seconds, which means "
- "innobackupex will not attempt to kill any queries.",
- (uchar*) &opt_kill_long_queries_timeout,
- (uchar*) &opt_kill_long_queries_timeout, 0, GET_UINT,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT,
- "This option specifies time in seconds that innobackupex should wait "
- "for queries that would block FTWRL before running it. If there are "
- "still such queries when the timeout expires, innobackupex terminates "
- "with an error. Default is 0, in which case innobackupex does not "
- "wait for queries to complete and starts FTWRL immediately.",
- (uchar*) &opt_lock_wait_timeout,
- (uchar*) &opt_lock_wait_timeout, 0, GET_UINT,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD,
- "This option specifies the query run time threshold which is used by "
- "innobackupex to detect long-running queries with a non-zero value "
- "of --ftwrl-wait-timeout. FTWRL is not started until such "
- "long-running queries exist. This option has no effect if "
- "--ftwrl-wait-timeout is 0. Default value is 60 seconds.",
- (uchar*) &opt_lock_wait_threshold,
- (uchar*) &opt_lock_wait_threshold, 0, GET_UINT,
- REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
-
- {"debug-sleep-before-unlock", OPT_DEBUG_SLEEP_BEFORE_UNLOCK,
- "This is a debug-only option used by the XtraBackup test suite.",
- (uchar*) &opt_debug_sleep_before_unlock,
- (uchar*) &opt_debug_sleep_before_unlock, 0, GET_UINT,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-
- {"safe-slave-backup-timeout", OPT_SAFE_SLAVE_BACKUP_TIMEOUT,
- "How many seconds --safe-slave-backup should wait for "
- "Slave_open_temp_tables to become zero. (default 300)",
- (uchar*) &opt_safe_slave_backup_timeout,
- (uchar*) &opt_safe_slave_backup_timeout, 0, GET_UINT,
- REQUIRED_ARG, 300, 0, 0, 0, 0, 0},
-
- {"binlog-info", OPT_BINLOG_INFO,
- "This option controls how XtraBackup should retrieve server's binary log "
- "coordinates corresponding to the backup. Possible values are OFF, ON, "
- "LOCKLESS and AUTO. See the XtraBackup manual for more information",
- &opt_binlog_info, &opt_binlog_info,
- &binlog_info_typelib, GET_ENUM, OPT_ARG, BINLOG_INFO_AUTO, 0, 0, 0, 0, 0},
-
- {"secure-auth", OPT_XB_SECURE_AUTH, "Refuse client connecting to server if it"
- " uses old (pre-4.1.1) protocol.", &opt_secure_auth,
- &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+struct my_option xb_client_options[]= {
+ {"verbose", 'V', "display verbose output", (G_PTR *) &verbose,
+ (G_PTR *) &verbose, 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0},
+ {"version", 'v', "print xtrabackup version information",
+ (G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"target-dir", OPT_XTRA_TARGET_DIR, "destination directory",
+ (G_PTR *) &xtrabackup_target_dir, (G_PTR *) &xtrabackup_target_dir, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"backup", OPT_XTRA_BACKUP, "take backup to target-dir",
+ (G_PTR *) &xtrabackup_backup, (G_PTR *) &xtrabackup_backup, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"prepare", OPT_XTRA_PREPARE,
+ "prepare a backup for starting mysql server on the backup.",
+ (G_PTR *) &xtrabackup_prepare, (G_PTR *) &xtrabackup_prepare, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"export", OPT_XTRA_EXPORT,
+ "create files to import to another database when prepare.",
+ (G_PTR *) &xtrabackup_export, (G_PTR *) &xtrabackup_export, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"rollback-xa", OPT_XTRA_ROLLBACK_XA,
+ "Rollback prepared XA's on --prepare. "
+ "After preparing target directory with this option "
+ "it can no longer be a base for incremental backup.",
+ (G_PTR *) &xtrabackup_rollback_xa, (G_PTR *) &xtrabackup_rollback_xa, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"print-param", OPT_XTRA_PRINT_PARAM,
+ "print parameter of mysqld needed for copyback.",
+ (G_PTR *) &xtrabackup_print_param, (G_PTR *) &xtrabackup_print_param, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"use-memory", OPT_XTRA_USE_MEMORY,
+ "The value is used instead of buffer_pool_size",
+ (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0,
+ GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0,
+ 1024 * 1024L, 0},
+ {"throttle", OPT_XTRA_THROTTLE,
+ "limit count of IO operations (pairs of read&write) per second to IOS "
+ "values (for '--backup')",
+ (G_PTR *) &xtrabackup_throttle, (G_PTR *) &xtrabackup_throttle, 0,
+ GET_LONG, REQUIRED_ARG, 0, 0, LONG_MAX, 0, 1, 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},
+ {"log-copy-interval", OPT_XTRA_LOG_COPY_INTERVAL,
+ "time interval between checks done by log copying thread in milliseconds "
+ "(default is 1 second).",
+ (G_PTR *) &xtrabackup_log_copy_interval,
+ (G_PTR *) &xtrabackup_log_copy_interval, 0, GET_LONG, REQUIRED_ARG, 1000,
+ 0, LONG_MAX, 0, 1, 0},
+ {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR,
+ "(for --backup): save an extra copy of the xtrabackup_checkpoints file "
+ "in this directory.",
+ (G_PTR *) &xtrabackup_extra_lsndir, (G_PTR *) &xtrabackup_extra_lsndir, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"incremental-lsn", OPT_XTRA_INCREMENTAL,
+ "(for --backup): copy only .ibd pages newer than specified LSN "
+ "'high:low'. ##ATTENTION##: If a wrong LSN value is specified, it is "
+ "impossible to diagnose this, causing the backup to be unusable. Be "
+ "careful!",
+ (G_PTR *) &xtrabackup_incremental, (G_PTR *) &xtrabackup_incremental, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"incremental-basedir", OPT_XTRA_INCREMENTAL_BASEDIR,
+ "(for --backup): copy only .ibd pages newer than backup at specified "
+ "directory.",
+ (G_PTR *) &xtrabackup_incremental_basedir,
+ (G_PTR *) &xtrabackup_incremental_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+ {"incremental-dir", OPT_XTRA_INCREMENTAL_DIR,
+ "(for --prepare): apply .delta files and logfile in the specified "
+ "directory.",
+ (G_PTR *) &xtrabackup_incremental_dir,
+ (G_PTR *) &xtrabackup_incremental_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ 0, 0, 0},
+ {"tables", OPT_XTRA_TABLES, "filtering by regexp for table names.",
+ (G_PTR *) &xtrabackup_tables, (G_PTR *) &xtrabackup_tables, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"tables_file", OPT_XTRA_TABLES_FILE,
+ "filtering by list of the exact database.table name in the file.",
+ (G_PTR *) &xtrabackup_tables_file, (G_PTR *) &xtrabackup_tables_file, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"databases", OPT_XTRA_DATABASES, "filtering by list of databases.",
+ (G_PTR *) &xtrabackup_databases, (G_PTR *) &xtrabackup_databases, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"databases_file", OPT_XTRA_DATABASES_FILE,
+ "filtering by list of databases in the file.",
+ (G_PTR *) &xtrabackup_databases_file,
+ (G_PTR *) &xtrabackup_databases_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ 0, 0, 0},
+ {"tables-exclude", OPT_XTRA_TABLES_EXCLUDE,
+ "filtering by regexp for table names. "
+ "Operates the same way as --tables, but matched names are excluded from "
+ "backup. "
+ "Note that this option has a higher priority than --tables.",
+ (G_PTR *) &xtrabackup_tables_exclude,
+ (G_PTR *) &xtrabackup_tables_exclude, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
+ 0, 0, 0},
+ {"databases-exclude", OPT_XTRA_DATABASES_EXCLUDE,
+ "Excluding databases based on name, "
+ "Operates the same way as --databases, but matched names are excluded "
+ "from backup. "
+ "Note that this option has a higher priority than --databases.",
+ (G_PTR *) &xtrabackup_databases_exclude,
+ (G_PTR *) &xtrabackup_databases_exclude, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"stream", OPT_XTRA_STREAM,
+ "Stream all backup files to the standard output "
+ "in the specified format."
+ "Supported format is 'mbstream' or 'xbstream'.",
+ (G_PTR *) &xtrabackup_stream_str, (G_PTR *) &xtrabackup_stream_str, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"compress", OPT_XTRA_COMPRESS,
+ "Compress individual backup files using the "
+ "specified compression algorithm. Currently the only supported algorithm "
+ "is 'quicklz'. It is also the default algorithm, i.e. the one used when "
+ "--compress is used without an argument.",
+ (G_PTR *) &xtrabackup_compress_alg, (G_PTR *) &xtrabackup_compress_alg, 0,
+ GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"compress-threads", OPT_XTRA_COMPRESS_THREADS,
+ "Number of threads for parallel data compression. The default value is "
+ "1.",
+ (G_PTR *) &xtrabackup_compress_threads,
+ (G_PTR *) &xtrabackup_compress_threads, 0, GET_UINT, REQUIRED_ARG, 1, 1,
+ UINT_MAX, 0, 0, 0},
+
+ {"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE,
+ "Size of working buffer(s) for compression threads in bytes. The default "
+ "value is 64K.",
+ (G_PTR *) &xtrabackup_compress_chunk_size,
+ (G_PTR *) &xtrabackup_compress_chunk_size, 0, GET_ULL, REQUIRED_ARG,
+ (1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0},
+
+ {"incremental-force-scan", OPT_XTRA_INCREMENTAL_FORCE_SCAN,
+ "Perform a full-scan incremental backup even in the presence of changed "
+ "page bitmap data",
+ (G_PTR *) &xtrabackup_incremental_force_scan,
+ (G_PTR *) &xtrabackup_incremental_force_scan, 0, GET_BOOL, NO_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"close_files", OPT_CLOSE_FILES,
+ "do not keep files opened. Use at your own "
+ "risk.",
+ (G_PTR *) &xb_close_files, (G_PTR *) &xb_close_files, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
+
+ {"core-file", OPT_CORE_FILE, "Write core on fatal signals", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"copy-back", OPT_COPY_BACK,
+ "Copy all the files in a previously made "
+ "backup from the backup directory to their original locations.",
+ (uchar *) &xtrabackup_copy_back, (uchar *) &xtrabackup_copy_back, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"move-back", OPT_MOVE_BACK,
+ "Move all the files in a previously made "
+ "backup from the backup directory to the actual datadir location. "
+ "Use with caution, as it removes backup files.",
+ (uchar *) &xtrabackup_move_back, (uchar *) &xtrabackup_move_back, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"galera-info", OPT_GALERA_INFO,
+ "This options creates the "
+ "xtrabackup_galera_info file which contains the local node state at "
+ "the time of the backup. Option should be used when performing the "
+ "backup of MariaDB Galera Cluster. Has no effect when backup locks "
+ "are used to create the backup.",
+ (uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"slave-info", OPT_SLAVE_INFO,
+ "This option is useful when backing "
+ "up a replication slave server. It prints the binary log position "
+ "and name of the master server. It also writes this information to "
+ "the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. "
+ "A new slave for this master can be set up by starting a slave server "
+ "on this backup and issuing a \"CHANGE MASTER\" command with the "
+ "binary log position saved in the \"xtrabackup_slave_info\" file.",
+ (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
+
+ {"no-lock", OPT_NO_LOCK,
+ "Use this option to disable table lock "
+ "with \"FLUSH TABLES WITH READ LOCK\". Use it only if ALL your "
+ "tables are InnoDB and you DO NOT CARE about the binary log "
+ "position of the backup. This option shouldn't be used if there "
+ "are any DDL statements being executed or if any updates are "
+ "happening on non-InnoDB tables (this includes the system MyISAM "
+ "tables in the mysql database), otherwise it could lead to an "
+ "inconsistent backup. If you are considering to use --no-lock "
+ "because your backups are failing to acquire the lock, this could "
+ "be because of incoming replication events preventing the lock "
+ "from succeeding. Please try using --safe-slave-backup to "
+ "momentarily stop the replication slave thread, this may help "
+ "the backup to succeed and you then don't need to resort to "
+ "using this option.",
+ (uchar *) &opt_no_lock, (uchar *) &opt_no_lock, 0, GET_BOOL, NO_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"safe-slave-backup", OPT_SAFE_SLAVE_BACKUP,
+ "Stop slave SQL thread "
+ "and wait to start backup until Slave_open_temp_tables in "
+ "\"SHOW STATUS\" is zero. If there are no open temporary tables, "
+ "the backup will take place, otherwise the SQL thread will be "
+ "started and stopped until there are no open temporary tables. "
+ "The backup will fail if Slave_open_temp_tables does not become "
+ "zero after --safe-slave-backup-timeout seconds. The slave SQL "
+ "thread will be restarted when the backup finishes.",
+ (uchar *) &opt_safe_slave_backup, (uchar *) &opt_safe_slave_backup, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"rsync", OPT_RSYNC,
+ "Uses the rsync utility to optimize local file "
+ "transfers. When this option is specified, innobackupex uses rsync "
+ "to copy all non-InnoDB files instead of spawning a separate cp for "
+ "each file, which can be much faster for servers with a large number "
+ "of databases or tables. This option cannot be used together with "
+ "--stream.",
+ (uchar *) &opt_rsync, (uchar *) &opt_rsync, 0, GET_BOOL, NO_ARG, 0, 0, 0,
+ 0, 0, 0},
+
+ {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS,
+ "This "
+ "option, when specified, makes --copy-back or --move-back transfer "
+ "files to non-empty directories. Note that no existing files will be "
+ "overwritten. If --copy-back or --nove-back has to copy a file from "
+ "the backup directory which already exists in the destination "
+ "directory, it will still fail with an error.",
+ (uchar *) &opt_force_non_empty_dirs, (uchar *) &opt_force_non_empty_dirs,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"no-version-check", OPT_NO_VERSION_CHECK,
+ "This option disables the "
+ "version check which is enabled by the --version-check option.",
+ (uchar *) &opt_noversioncheck, (uchar *) &opt_noversioncheck, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"no-backup-locks", OPT_NO_BACKUP_LOCKS,
+ "This option controls if "
+ "backup locks should be used instead of FLUSH TABLES WITH READ LOCK "
+ "on the backup stage. The option has no effect when backup locks are "
+ "not supported by the server. This option is enabled by default, "
+ "disable with --no-backup-locks.",
+ (uchar *) &opt_no_backup_locks, (uchar *) &opt_no_backup_locks, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"decompress", OPT_DECOMPRESS,
+ "Decompresses all files with the .qp "
+ "extension in a backup previously made with the --compress option.",
+ (uchar *) &opt_decompress, (uchar *) &opt_decompress, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
+
+ {"user", 'u',
+ "This option specifies the MySQL username used "
+ "when connecting to the server, if that's not the current user. "
+ "The option accepts a string argument. See mysql --help for details.",
+ (uchar *) &opt_user, (uchar *) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"host", 'H',
+ "This option specifies the host to use when "
+ "connecting to the database server with TCP/IP. The option accepts "
+ "a string argument. See mysql --help for details.",
+ (uchar *) &opt_host, (uchar *) &opt_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"port", 'P',
+ "This option specifies the port to use when "
+ "connecting to the database server with TCP/IP. The option accepts "
+ "a string argument. See mysql --help for details.",
+ &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"password", 'p',
+ "This option specifies the password to use "
+ "when connecting to the database. It accepts a string argument. "
+ "See mysql --help for details.",
+ 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"protocol", OPT_PROTOCOL,
+ "The protocol to use for connection (tcp, socket, pipe, memory).", 0, 0,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"socket", 'S',
+ "This option specifies the socket to use when "
+ "connecting to the local database server with a UNIX domain socket. "
+ "The option accepts a string argument. See mysql --help for details.",
+ (uchar *) &opt_socket, (uchar *) &opt_socket, 0, GET_STR, REQUIRED_ARG, 0,
+ 0, 0, 0, 0, 0},
+
+ {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME,
+ "This option specifies the name of the backup series stored in the "
+ "PERCONA_SCHEMA.xtrabackup_history history record to base an "
+ "incremental backup on. Xtrabackup will search the history table "
+ "looking for the most recent (highest innodb_to_lsn), successful "
+ "backup in the series and take the to_lsn value to use as the "
+ "starting lsn for the incremental backup. This will be mutually "
+ "exclusive with --incremental-history-uuid, --incremental-basedir "
+ "and --incremental-lsn. If no valid lsn can be found (no series by "
+ "that name, no successful backups by that name) xtrabackup will "
+ "return with an error. It is used with the --incremental option.",
+ (uchar *) &opt_incremental_history_name,
+ (uchar *) &opt_incremental_history_name, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID,
+ "This option specifies the UUID of the specific history record "
+ "stored in the PERCONA_SCHEMA.xtrabackup_history to base an "
+ "incremental backup on. --incremental-history-name, "
+ "--incremental-basedir and --incremental-lsn. If no valid lsn can be "
+ "found (no success record with that uuid) xtrabackup will return "
+ "with an error. It is used with the --incremental option.",
+ (uchar *) &opt_incremental_history_uuid,
+ (uchar *) &opt_incremental_history_uuid, 0, GET_STR, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"remove-original", OPT_REMOVE_ORIGINAL,
+ "Remove .qp files after decompression.", (uchar *) &opt_remove_original,
+ (uchar *) &opt_remove_original, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE,
+ "This option specifies which types of queries are allowed to complete "
+ "before innobackupex will issue the global lock. Default is all.",
+ (uchar *) &opt_lock_wait_query_type, (uchar *) &opt_lock_wait_query_type,
+ &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0,
+ 0},
+
+ {"kill-long-query-type", OPT_KILL_LONG_QUERY_TYPE,
+ "This option specifies which types of queries should be killed to "
+ "unblock the global lock. Default is \"all\".",
+ (uchar *) &opt_kill_long_query_type, (uchar *) &opt_kill_long_query_type,
+ &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_SELECT, 0, 0, 0,
+ 0, 0},
+
+ {"history", OPT_HISTORY,
+ "This option enables the tracking of backup history in the "
+ "PERCONA_SCHEMA.xtrabackup_history table. An optional history "
+ "series name may be specified that will be placed with the history "
+ "record for the current backup being taken.",
+ NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT,
+ "This option specifies the number of seconds innobackupex waits "
+ "between starting FLUSH TABLES WITH READ LOCK and killing those "
+ "queries that block it. Default is 0 seconds, which means "
+ "innobackupex will not attempt to kill any queries.",
+ (uchar *) &opt_kill_long_queries_timeout,
+ (uchar *) &opt_kill_long_queries_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT,
+ "This option specifies time in seconds that innobackupex should wait "
+ "for queries that would block FTWRL before running it. If there are "
+ "still such queries when the timeout expires, innobackupex terminates "
+ "with an error. Default is 0, in which case innobackupex does not "
+ "wait for queries to complete and starts FTWRL immediately.",
+ (uchar *) &opt_lock_wait_timeout, (uchar *) &opt_lock_wait_timeout, 0,
+ GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+
+ {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD,
+ "This option specifies the query run time threshold which is used by "
+ "innobackupex to detect long-running queries with a non-zero value "
+ "of --ftwrl-wait-timeout. FTWRL is not started until such "
+ "long-running queries exist. This option has no effect if "
+ "--ftwrl-wait-timeout is 0. Default value is 60 seconds.",
+ (uchar *) &opt_lock_wait_threshold, (uchar *) &opt_lock_wait_threshold, 0,
+ GET_UINT, REQUIRED_ARG, 60, 0, 0, 0, 0, 0},
+
+ {"debug-sleep-before-unlock", OPT_DEBUG_SLEEP_BEFORE_UNLOCK,
+ "This is a debug-only option used by the XtraBackup test suite.",
+ (uchar *) &opt_debug_sleep_before_unlock,
+ (uchar *) &opt_debug_sleep_before_unlock, 0, GET_UINT, REQUIRED_ARG, 0, 0,
+ 0, 0, 0, 0},
+
+ {"safe-slave-backup-timeout", OPT_SAFE_SLAVE_BACKUP_TIMEOUT,
+ "How many seconds --safe-slave-backup should wait for "
+ "Slave_open_temp_tables to become zero. (default 300)",
+ (uchar *) &opt_safe_slave_backup_timeout,
+ (uchar *) &opt_safe_slave_backup_timeout, 0, GET_UINT, REQUIRED_ARG, 300,
+ 0, 0, 0, 0, 0},
+
+ {"binlog-info", OPT_BINLOG_INFO,
+ "This option controls how XtraBackup should retrieve server's binary log "
+ "coordinates corresponding to the backup. Possible values are OFF, ON, "
+ "LOCKLESS and AUTO. See the XtraBackup manual for more information",
+ &opt_binlog_info, &opt_binlog_info, &binlog_info_typelib, GET_ENUM,
+ OPT_ARG, BINLOG_INFO_AUTO, 0, 0, 0, 0, 0},
+
+ {"secure-auth", OPT_XB_SECURE_AUTH,
+ "Refuse client connecting to server if it"
+ " uses old (pre-4.1.1) protocol.",
+ &opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
+ 0},
#define MYSQL_CLIENT
#include "sslopt-longopts.h"
#undef MYSQL_CLIENT
- { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
-};
+ {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}};
uint xb_client_options_count = array_elements(xb_client_options);
@@ -1717,7 +1769,8 @@ xb_get_one_option(int optid,
xtrabackup_target_dir= xtrabackup_real_target_dir;
break;
case OPT_XTRA_STREAM:
- if (!strcasecmp(argument, "xbstream"))
+ if (!strcasecmp(argument, "mbstream") ||
+ !strcasecmp(argument, "xbstream"))
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
else
{
@@ -1976,10 +2029,6 @@ innodb_init_param(void)
srv_undo_dir = (char*) ".";
}
- log_checksum_algorithm_ptr = innodb_log_checksums || srv_encrypt_log
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
-
return(FALSE);
error:
@@ -2322,7 +2371,7 @@ check_if_skip_database(
if (databases_exclude_hash &&
find_filter_in_hashtable(name, databases_exclude_hash,
&database) &&
- !database->has_tables) {
+ (!database->has_tables || !databases_include_hash)) {
/* Database is found and there are no tables specified,
skip entire db. */
return DATABASE_SKIP;
@@ -2488,17 +2537,24 @@ xb_get_copy_action(const char *dflt)
return(action);
}
-/* TODO: We may tune the behavior (e.g. by fil_aio)*/
-static
-my_bool
-xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=0, ulonglong max_size=ULLONG_MAX)
+/** Copy innodb data file to the specified destination.
+
+@param[in] node file node of a tablespace
+@param[in] thread_n thread id, used in the text of diagnostic messages
+@param[in] dest_name destination file name
+@param[in] write_filter write filter to copy data, can be pass-through filter
+for full backup, pages filter for incremental backup, etc.
+
+@return FALSE on success and TRUE on error */
+static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
+ const char *dest_name,
+ const xb_write_filt_t &write_filter)
{
char dst_name[FN_REFLEN];
ds_file_t *dstfile = NULL;
xb_fil_cur_t cursor;
xb_fil_cur_result_t res;
- xb_write_filt_t *write_filter = NULL;
xb_write_filt_ctxt_t write_filt_ctxt;
const char *action;
xb_read_filt_t *read_filter;
@@ -2522,6 +2578,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
return(FALSE);
}
+ memset(&write_filt_ctxt, 0, sizeof(xb_write_filt_ctxt_t));
+
bool was_dropped;
pthread_mutex_lock(&backup_mutex);
was_dropped = (ddl_tracker.drops.find(node->space->id) != ddl_tracker.drops.end());
@@ -2538,7 +2596,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
read_filter = &rf_bitmap;
}
- res = xb_fil_cur_open(&cursor, read_filter, node, thread_n,max_size);
+ res = xb_fil_cur_open(&cursor, read_filter, node, thread_n, ULLONG_MAX);
if (res == XB_FIL_CUR_SKIP) {
goto skip;
} else if (res == XB_FIL_CUR_ERROR) {
@@ -2549,18 +2607,10 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
sizeof dst_name - 1);
dst_name[sizeof dst_name - 1] = '\0';
- /* Setup the page write filter */
- if (xtrabackup_incremental) {
- write_filter = &wf_incremental;
- } else {
- write_filter = &wf_write_through;
- }
+ ut_a(write_filter.process != NULL);
- memset(&write_filt_ctxt, 0, sizeof(xb_write_filt_ctxt_t));
- ut_a(write_filter->process != NULL);
-
- if (write_filter->init != NULL &&
- !write_filter->init(&write_filt_ctxt, dst_name, &cursor)) {
+ if (write_filter.init != NULL &&
+ !write_filter.init(&write_filt_ctxt, dst_name, &cursor)) {
msg (thread_n, "mariabackup: error: failed to initialize page write filter.");
goto error;
}
@@ -2581,7 +2631,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
/* The main copy loop */
while ((res = xb_fil_cur_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
- if (!write_filter->process(&write_filt_ctxt, dstfile)) {
+ if (!write_filter.process(&write_filt_ctxt, dstfile)) {
goto error;
}
}
@@ -2590,8 +2640,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
goto error;
}
- if (write_filter->finalize
- && !write_filter->finalize(&write_filt_ctxt, dstfile)) {
+ if (write_filter.finalize
+ && !write_filter.finalize(&write_filt_ctxt, dstfile)) {
goto error;
}
@@ -2605,8 +2655,8 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name=
if (ds_close(dstfile)) {
rc = TRUE;
}
- if (write_filter && write_filter->deinit) {
- write_filter->deinit(&write_filt_ctxt);
+ if (write_filter.deinit) {
+ write_filter.deinit(&write_filt_ctxt);
}
return(rc);
@@ -2615,8 +2665,8 @@ error:
if (dstfile != NULL) {
ds_close(dstfile);
}
- if (write_filter && write_filter->deinit) {
- write_filter->deinit(&write_filt_ctxt);;
+ if (write_filter.deinit) {
+ write_filter.deinit(&write_filt_ctxt);;
}
msg(thread_n, "mariabackup: xtrabackup_copy_datafile() failed.");
return(TRUE); /*ERROR*/
@@ -2626,8 +2676,8 @@ skip:
if (dstfile != NULL) {
ds_close(dstfile);
}
- if (write_filter && write_filter->deinit) {
- write_filter->deinit(&write_filt_ctxt);
+ if (write_filter.deinit) {
+ write_filter.deinit(&write_filt_ctxt);
}
msg(thread_n,"Warning: We assume the table was dropped during xtrabackup execution and ignore the tablespace %s", node_name);
return(FALSE);
@@ -2674,7 +2724,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
scanned_lsn += data_len;
} else if (data_len
>= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE
- || data_len <= LOG_BLOCK_HDR_SIZE) {
+ || data_len < LOG_BLOCK_HDR_SIZE) {
/* We got a garbage block (abrupt end of the log). */
msg(0,"garbage block: " LSN_PF ",%zu",scanned_lsn, data_len);
break;
@@ -2685,7 +2735,9 @@ 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)) {
+ store_t store = STORE_NO;
+
+ if (more_data && recv_parse_log_recs(0, &store, 0, false)) {
msg("Error: copying the log failed");
@@ -2722,6 +2774,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
ut_a(dst_log_file != NULL);
ut_ad(recv_sys != NULL);
+ bool overwritten_block = false;
lsn_t start_lsn;
lsn_t end_lsn;
@@ -2748,6 +2801,12 @@ static bool xtrabackup_copy_logfile(bool last = false)
}
if (lsn == start_lsn) {
+ overwritten_block= !recv_sys->found_corrupt_log
+ && (innodb_log_checksums || log_sys->log.is_encrypted())
+ && log_block_calc_checksum_crc32(log_sys->buf) ==
+ log_block_get_checksum(log_sys->buf)
+ && log_block_get_hdr_no(log_sys->buf) >
+ log_block_convert_lsn_to_no(start_lsn);
start_lsn = 0;
} else {
mutex_enter(&recv_sys->mutex);
@@ -2758,9 +2817,15 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
- msg(recv_sys->found_corrupt_log
- ? "xtrabackup_copy_logfile() failed: corrupt log."
- : "xtrabackup_copy_logfile() failed.");
+ const char *reason = recv_sys->found_corrupt_log
+ ? "corrupt log."
+ : (overwritten_block
+ ? "redo log block is overwritten, please increase redo log size with innodb_log_file_size parameter."
+ : ((innodb_log_checksums || log_sys->log.is_encrypted())
+ ? "redo log block checksum does not match."
+ : "unknown reason as innodb_log_checksums is switched off and redo"
+ " log is not encrypted."));
+ die("xtrabackup_copy_logfile() failed: %s", reason);
return true;
}
} while (start_lsn == end_lsn);
@@ -2883,8 +2948,14 @@ static void dbug_mariabackup_event(const char *event,const char *key)
}
#define DBUG_MARIABACKUP_EVENT(A, B) DBUG_EXECUTE_IF("mariabackup_events", dbug_mariabackup_event(A,B););
+#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE) \
+ DBUG_EXECUTE_IF("mariabackup_inject_code", {\
+ char *env = getenv(EVENT); \
+ if (env && !strcmp(env, KEY)) { CODE } \
+ })
#else
#define DBUG_MARIABACKUP_EVENT(A,B)
+#define DBUG_MB_INJECT_CODE(EVENT, KEY, CODE)
#endif
/**************************************************************************
@@ -2909,10 +2980,12 @@ data_copy_thread_func(
while ((node = datafiles_iter_next(ctxt->it)) != NULL) {
DBUG_MARIABACKUP_EVENT("before_copy", node->space->name);
+ DBUG_MB_INJECT_CODE("wait_innodb_redo_before_copy", node->space->name,
+ backup_wait_for_lsn(get_current_lsn(mysql_connection)););
/* copy the datafile */
- if(xtrabackup_copy_datafile(node, num)) {
+ if (xtrabackup_copy_datafile(node, num, NULL,
+ xtrabackup_incremental ? wf_incremental : wf_write_through))
die("failed to copy datafile.");
- }
DBUG_MARIABACKUP_EVENT("after_copy", node->space->name);
@@ -3128,13 +3201,13 @@ xb_load_single_table_tablespace(
}
}
- ut_free(name);
-
delete file;
if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) {
die("Failed to not validate first page of the file %s, error %d",name, (int)err);
}
+
+ ut_free(name);
}
/** Scan the database directories under the MySQL datadir, looking for
@@ -3577,6 +3650,11 @@ xb_register_exclude_filter_entry(
&tables_exclude_hash);
}
+void register_ignore_db_dirs_filter(const char *name)
+{
+ xb_add_filter(name, &databases_exclude_hash);
+}
+
/***********************************************************************
Register new table for the filter. */
static
@@ -3639,26 +3717,24 @@ xb_register_exclude_regex(
typedef void (*insert_entry_func_t)(const char*);
-/***********************************************************************
-Scan string and load filter entries from it. */
-static
-void
-xb_load_list_string(
-/*================*/
- char* list, /*!< in: string representing a list */
- const char* delimiters, /*!< in: delimiters of entries */
- insert_entry_func_t ins) /*!< in: callback to add entry */
+/* Scan string and load filter entries from it.
+@param[in] list string representing a list
+@param[in] delimiters delimiters of entries
+@param[in] ins callback to add entry */
+void xb_load_list_string(char *list, const char *delimiters,
+ insert_entry_func_t ins)
{
- char* p;
- char* saveptr;
+ char *p;
+ char *saveptr;
- p = strtok_r(list, delimiters, &saveptr);
- while (p) {
+ p= strtok_r(list, delimiters, &saveptr);
+ while (p)
+ {
- ins(p);
+ ins(p);
- p = strtok_r(NULL, delimiters, &saveptr);
- }
+ p= strtok_r(NULL, delimiters, &saveptr);
+ }
}
/***********************************************************************
@@ -4280,6 +4356,8 @@ fail_before_log_copying_thread_start:
if (xtrabackup_copy_logfile())
goto fail_before_log_copying_thread_start;
+ DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started",0);
+
log_copying_stop = os_event_create(0);
os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
@@ -4551,7 +4629,7 @@ void backup_fix_ddl(void)
continue;
std::string dest_name(node->space->name);
dest_name.append(".new");
- xtrabackup_copy_datafile(node, 0, dest_name.c_str()/*, do_full_copy ? ULONGLONG_MAX:UNIV_PAGE_SIZE */);
+ xtrabackup_copy_datafile(node, 0, dest_name.c_str(), wf_write_through);
}
datafiles_iter_free(it);
@@ -5107,22 +5185,66 @@ static void rename_force(const char *from, const char *to) {
rename_file(from,to);
}
-/* During prepare phase, rename ".new" files , that were created in backup_fix_ddl(),
- to ".ibd".*/
-static ibool prepare_handle_new_files(
- const char* data_home_dir, /*!<in: path to datadir */
- const char* db_name, /*!<in: database name */
- const char* file_name, /*!<in: file name with suffix */
- void *)
-{
+/** During prepare phase, rename ".new" files, that were created in
+backup_fix_ddl() and backup_optimized_ddl_op(), to ".ibd". In the case of
+incremental backup, i.e. of arg argument is set, move ".new" files to
+destination directory and rename them to ".ibd", remove existing ".ibd.delta"
+and ".idb.meta" files in incremental directory to avoid applying delta to
+".ibd" file.
+
+@param[in] data_home_dir path to datadir
+@param[in] db_name database name
+@param[in] file_name file name with suffix
+@param[in] arg destination path, used in incremental backup to notify, that
+*.new file must be moved to destibation directory
+
+@return true */
+static ibool prepare_handle_new_files(const char *data_home_dir,
+ const char *db_name,
+ const char *file_name, void *arg)
+{
+ const char *dest_dir = static_cast<const char *>(arg);
std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/' + file_name;
- std::string dest_path = src_path;
+ /* Copy "*.new" files from incremental to base dir for incremental backup */
+ std::string dest_path=
+ dest_dir ? std::string(dest_dir) + '/' + std::string(db_name) +
+ '/' + file_name : src_path;
size_t index = dest_path.find(".new");
DBUG_ASSERT(index != std::string::npos);
- dest_path.replace(index, 4, ".ibd");
+ dest_path.replace(index, strlen(".ibd"), ".ibd");
rename_force(src_path.c_str(),dest_path.c_str());
+
+ if (dest_dir) {
+ /* remove delta and meta files to avoid delta applying for new file */
+ index = src_path.find(".new");
+ DBUG_ASSERT(index != std::string::npos);
+ src_path.replace(index, std::string::npos, ".ibd.delta");
+ if (access(src_path.c_str(), R_OK) == 0) {
+ msg("Removing %s", src_path.c_str());
+ if (my_delete(src_path.c_str(), MYF(MY_WME)))
+ die("Can't remove %s, errno %d", src_path.c_str(), errno);
+ }
+ src_path.replace(index, std::string::npos, ".ibd.meta");
+ if (access(src_path.c_str(), R_OK) == 0) {
+ msg("Removing %s", src_path.c_str());
+ if (my_delete(src_path.c_str(), MYF(MY_WME)))
+ die("Can't remove %s, errno %d", src_path.c_str(), errno);
+ }
+
+ /* add table name to the container to avoid it's deletion at the end of
+ prepare */
+ std::string table_name = std::string(db_name) + '/'
+ + std::string(file_name, file_name + strlen(file_name) - strlen(".new"));
+ xb_filter_entry_t *table = static_cast<xb_filter_entry_t *>
+ (malloc(sizeof(xb_filter_entry_t) + table_name.size() + 1));
+ table->name = ((char*)table) + sizeof(xb_filter_entry_t);
+ strcpy(table->name, table_name.c_str());
+ HASH_INSERT(xb_filter_entry_t, name_hash, inc_dir_tables_hash,
+ ut_fold_string(table->name), table);
+ }
+
return TRUE;
}
@@ -5159,17 +5281,18 @@ rm_if_not_found(
return(TRUE);
}
-/************************************************************************
-Function enumerates files in datadir (provided by path) which are matched
+/** Function enumerates files in datadir (provided by path) which are matched
by provided suffix. For each entry callback is called.
+
+@param[in] path datadir path
+@param[in] suffix suffix to match against
+@param[in] func callback
+@param[in] func_arg arguments for the above callback
+
@return FALSE if callback for some entry returned FALSE */
-static
-ibool
-xb_process_datadir(
- const char* path, /*!<in: datadir path */
- const char* suffix, /*!<in: suffix to match
- against */
- handle_datadir_entry_func_t func) /*!<in: callback */
+static ibool xb_process_datadir(const char *path, const char *suffix,
+ handle_datadir_entry_func_t func,
+ void *func_arg = NULL)
{
ulint ret;
char dbpath[OS_FILE_MAX_PATH];
@@ -5204,7 +5327,7 @@ xb_process_datadir(
suffix)) {
if (!func(
path, NULL,
- fileinfo.name, NULL))
+ fileinfo.name, func_arg))
{
os_file_closedir(dbdir);
return(FALSE);
@@ -5268,7 +5391,7 @@ next_file_item_1:
if (!func(
path,
dbinfo.name,
- fileinfo.name, NULL))
+ fileinfo.name, func_arg))
{
os_file_closedir(dbdir);
os_file_closedir(dir);
@@ -5428,6 +5551,12 @@ static bool xtrabackup_prepare_func(char** argv)
fil_path_to_mysql_datadir = ".";
+ ut_ad(xtrabackup_incremental == xtrabackup_incremental_dir);
+ if (xtrabackup_incremental) {
+ inc_dir_tables_hash = hash_create(1000);
+ ut_ad(inc_dir_tables_hash);
+ }
+
/* Fix DDL for prepare. Process .del,.ren, and .new files.
The order in which files are processed, is important
(see MDEV-18185, MDEV-18201)
@@ -5439,6 +5568,8 @@ static bool xtrabackup_prepare_func(char** argv)
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);
+ xb_process_datadir(xtrabackup_incremental_dir, ".new",
+ prepare_handle_new_files, (void *)".");
}
else {
xb_process_datadir(".", ".new", prepare_handle_new_files);
@@ -5523,8 +5654,6 @@ static bool xtrabackup_prepare_func(char** argv)
goto error_cleanup;
}
- inc_dir_tables_hash = hash_create(1000);
-
ok = xtrabackup_apply_deltas();
xb_data_files_close();
@@ -5548,10 +5677,13 @@ static bool xtrabackup_prepare_func(char** argv)
if (!ok) goto error_cleanup;
}
- srv_operation = xtrabackup_export
- ? SRV_OPERATION_RESTORE_EXPORT : SRV_OPERATION_RESTORE;
+ srv_operation=
+ xtrabackup_export
+ ? SRV_OPERATION_RESTORE_EXPORT
+ : (xtrabackup_rollback_xa ? SRV_OPERATION_RESTORE_ROLLBACK_XA
+ : SRV_OPERATION_RESTORE);
- if (innodb_init_param()) {
+ if (innodb_init_param()) {
goto error_cleanup;
}
@@ -5572,11 +5704,51 @@ static bool xtrabackup_prepare_func(char** argv)
srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct;
}
- if (innodb_init()) {
+ if (xtrabackup_rollback_xa)
+ srv_fast_shutdown= 0;
+
+ if (innodb_init()) {
goto error_cleanup;
}
- if (ok) {
+ if (xtrabackup_rollback_xa)
+ {
+ /* Please do not merge MDEV-21168 fix in 10.5+ */
+ compile_time_assert(MYSQL_VERSION_ID < 10 * 10000 + 5 * 100);
+ XID *xid_list=
+ (XID *) my_malloc(MAX_XID_LIST_SIZE * sizeof(XID), MYF(0));
+ if (!xid_list)
+ {
+ msg("Can't allocate %i bytes for XID's list", MAX_XID_LIST_SIZE);
+ ok= false;
+ goto error_cleanup;
+ }
+ int got;
+ ut_ad(recv_no_log_write);
+ ut_d(recv_no_log_write= false);
+ while ((got= trx_recover_for_mysql(xid_list, MAX_XID_LIST_SIZE)) > 0)
+ {
+ for (int i= 0; i < got; i++)
+ {
+#ifndef DBUG_OFF
+ int rc=
+#endif // !DBUG_OFF
+ innobase_rollback_by_xid(NULL, xid_list + i);
+#ifndef DBUG_OFF
+ if (rc == 0)
+ {
+ char buf[XIDDATASIZE * 4 + 6]; // see xid_to_str
+ DBUG_PRINT("info",
+ ("rollback xid %s", xid_to_str(buf, xid_list[i])));
+ }
+#endif // !DBUG_OFF
+ }
+ }
+ ut_d(recv_no_log_write= true);
+ my_free(xid_list);
+ }
+
+ if (ok) {
mtr_t mtr;
mtr.start();
const trx_sysf_t* sys_header = trx_sysf_get(&mtr);
@@ -5611,8 +5783,25 @@ static bool xtrabackup_prepare_func(char** argv)
else if (ok) xb_write_galera_info(xtrabackup_incremental);
#endif
- innodb_shutdown();
- innodb_free_param();
+ if (xtrabackup_rollback_xa)
+ {
+ // See innobase_end() and thd_destructor_proxy()
+ while (srv_fast_shutdown == 0 &&
+ (trx_sys_any_active_transactions() ||
+ (uint) thread_count > srv_n_purge_threads + 1))
+ {
+ os_thread_sleep(1000);
+ }
+ srv_shutdown_bg_undo_sources();
+ srv_purge_shutdown();
+ buf_flush_sync_all_buf_pools();
+ innodb_shutdown();
+ innobase_space_shutdown();
+ }
+ else
+ innodb_shutdown();
+
+ innodb_free_param();
/* output to metadata file */
if (ok) {
@@ -5650,7 +5839,7 @@ static bool xtrabackup_prepare_func(char** argv)
error_cleanup:
xb_filters_free();
- return ok;
+ return ok && !ib::error::was_logged();
}
/**************************************************************************
@@ -5914,41 +6103,12 @@ extern void init_signals(void);
#include <sql_locale.h>
-/* Messages . Avoid loading errmsg.sys file */
+
void setup_error_messages()
{
- static const char *my_msgs[ERRORS_PER_RANGE];
- static const char **all_msgs[] = { my_msgs, my_msgs, my_msgs, my_msgs };
my_default_lc_messages = &my_locale_en_US;
- my_default_lc_messages->errmsgs->errmsgs = all_msgs;
-
- /* Populate the necessary error messages */
- struct {
- int id;
- const char *fmt;
- }
- xb_msgs[] =
- {
- { ER_DATABASE_NAME,"Database" },
- { ER_TABLE_NAME,"Table"},
- { ER_PARTITION_NAME, "Partition" },
- { ER_SUBPARTITION_NAME, "Subpartition" },
- { ER_TEMPORARY_NAME, "Temporary"},
- { ER_RENAMED_NAME, "Renamed"},
- { ER_CANT_FIND_DL_ENTRY, "Can't find symbol '%-.128s' in library"},
- { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
- { ER_OUTOFMEMORY, "Out of memory; restart server and try again (needed %d bytes)" },
- { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
- { ER_UDF_NO_PATHS, "No paths allowed for shared library" },
- { ER_CANT_INITIALIZE_UDF,"Can't initialize function '%-.192s'; %-.80s"},
- { ER_PLUGIN_IS_NOT_LOADED,"Plugin '%-.192s' is not loaded" }
- };
-
- for (int i = 0; i < (int)array_elements(all_msgs); i++)
- all_msgs[0][i] = "Unknown error";
-
- for (int i = 0; i < (int)array_elements(xb_msgs); i++)
- all_msgs[0][xb_msgs[i].id - ER_ERROR_FIRST] = xb_msgs[i].fmt;
+ if (init_errmessage())
+ die("could not initialize error messages");
}
void
@@ -6220,6 +6380,8 @@ int main(int argc, char **argv)
(void) pthread_key_delete(THR_THD);
logger.cleanup_base();
+ cleanup_errmsgs();
+ free_error_messages();
mysql_mutex_destroy(&LOCK_error_log);
if (status == EXIT_SUCCESS) {
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index c56e83f7a32..2dbdd442f95 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -194,4 +194,14 @@ void mdl_lock_init();
void mdl_lock_table(ulint space_id);
void mdl_unlock_all();
bool ends_with(const char *str, const char *suffix);
+
+typedef void (*insert_entry_func_t)(const char*);
+
+/* Scan string and load filter entries from it.
+@param[in] list string representing a list
+@param[in] delimiters delimiters of entries
+@param[in] ins callback to add entry */
+void xb_load_list_string(char *list, const char *delimiters,
+ insert_entry_func_t ins);
+void register_ignore_db_dirs_filter(const char *name);
#endif /* XB_XTRABACKUP_H */
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c
index 92cd4c0de18..6d6adccfe32 100644
--- a/extra/resolve_stack_dump.c
+++ b/extra/resolve_stack_dump.c
@@ -53,7 +53,7 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"symbols-file", 's', "Use specified symbols file.", &sym_fname,
+ {"symbols-file", 's', "Use specified symbols file", &sym_fname,
&sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"numeric-dump-file", 'n', "Read the dump from specified file.",
&dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG,
@@ -63,7 +63,7 @@ static struct my_option my_long_options[] =
static void verify_sort();
-
+static void clean_up();
static void print_version(void)
{
@@ -97,9 +97,18 @@ static void die(const char* fmt, ...)
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
+ clean_up();
+ my_end(0);
exit(1);
}
+void local_exit(int error)
+{
+ clean_up();
+ my_end(0);
+ exit(error);
+}
+
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
@@ -108,10 +117,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
switch(optid) {
case 'V':
print_version();
- exit(0);
+ local_exit(0);
+ break;
case '?':
usage();
- exit(0);
+ local_exit(0);
+ break;
}
return 0;
}
@@ -122,7 +133,7 @@ static int parse_args(int argc, char **argv)
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
- exit(ho_error);
+ local_exit(ho_error);
/*
The following code is to make the command compatible with the old
@@ -143,13 +154,13 @@ static int parse_args(int argc, char **argv)
else
{
usage();
- exit(1);
+ local_exit(1);
}
}
else if (argc != 0 || !sym_fname)
{
usage();
- exit(1);
+ local_exit(1);
}
return 0;
}
@@ -242,6 +253,10 @@ static void init_sym_table()
static void clean_up()
{
delete_dynamic(&sym_table);
+ if (fp_dump && fp_dump != stdin)
+ my_fclose(fp_dump, MYF(0));
+ if (fp_sym)
+ my_fclose(fp_sym, MYF(0));
}
static void verify_sort()
@@ -283,7 +298,7 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
/*
- Resolve anything that starts with [0x or (+0x or start of line and 0x
+ Resolve anything that starts with [0x or (+0x or 0x
Skip '_end' as this is an indication of a wrong symbol (stack?)
*/
@@ -299,9 +314,7 @@ static void do_resolve()
found= 3;
if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x')
found= 4;
-
- /* For stdin */
- if (p == buf && p[0] == '0' && p[1] == 'x')
+ if (p[0] == '0' && p[1] == 'x')
found= 2;
if (found)
@@ -312,14 +325,15 @@ static void do_resolve()
addr= (uchar*)read_addr(&tmp);
if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end"))
{
- fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol,
- (int) (addr - se.addr));
+ found-= 2; /* Don't print 0x as it's added by %p */
+ while (found--)
+ fputc(*p++, stdout);
+ fprintf(fp_out, "%p %s + %d", addr,
+ se.symbol, (int) (addr - se.addr));
p= tmp-1;
}
else
- {
fputc(*p, stdout);
- }
}
else
fputc(*p, stdout);
@@ -336,5 +350,6 @@ int main(int argc, char** argv)
init_sym_table();
do_resolve();
clean_up();
+ my_end(0);
return 0;
}
diff --git a/extra/yassl/include/openssl/generate_prefix_files.pl b/extra/yassl/include/openssl/generate_prefix_files.pl
index d7609aebaf3..b66ffae6642 100755
--- a/extra/yassl/include/openssl/generate_prefix_files.pl
+++ b/extra/yassl/include/openssl/generate_prefix_files.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2006 MySQL AB
# Use is subject to license terms
diff --git a/include/byte_order_generic.h b/include/byte_order_generic.h
index 451202be3b6..8381941b9b9 100644
--- a/include/byte_order_generic.h
+++ b/include/byte_order_generic.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2020, 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
@@ -17,7 +18,7 @@
Endianness-independent definitions for architectures other
than the x86 architecture.
*/
-#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
+#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) |\
((int16) ((int16) (A)[1]) << 8))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
@@ -27,38 +28,38 @@
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
-#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
- (((int32) ((uchar) (A)[1]) << 8)) +\
- (((int32) ((uchar) (A)[2]) << 16)) +\
+#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) |\
+ (((int32) ((uchar) (A)[1]) << 8)) |\
+ (((int32) ((uchar) (A)[2]) << 16)) |\
(((int32) ((int16) (A)[3]) << 24)))
#define sint8korr(A) (longlong) uint8korr(A)
-#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
+#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) |\
((uint16) ((uchar) (A)[1]) << 8))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
-#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
+#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
+ (((uint32) ((uchar) (A)[2])) << 16) |\
(((uint32) ((uchar) (A)[3])) << 24))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
+#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
+ (((uint32) ((uchar) (A)[2])) << 16) |\
+ (((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
- (((uint32) ((uchar) (A)[1])) << 8) + \
- (((uint32) ((uchar) (A)[2])) << 16) + \
- (((uint32) ((uchar) (A)[3])) << 24)) + \
- (((ulonglong) ((uchar) (A)[4])) << 32) + \
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
+ (((uint32) ((uchar) (A)[1])) << 8) | \
+ (((uint32) ((uchar) (A)[2])) << 16) | \
+ (((uint32) ((uchar) (A)[3])) << 24)) | \
+ (((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
-#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
- (((ulonglong) (((uint32) ((uchar) (A)[4])) +\
- (((uint32) ((uchar) (A)[5])) << 8) +\
- (((uint32) ((uchar) (A)[6])) << 16) +\
+#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
+ (((uint32) ((uchar) (A)[2])) << 16) |\
+ (((uint32) ((uchar) (A)[3])) << 24)) |\
+ (((ulonglong) (((uint32) ((uchar) (A)[4])) |\
+ (((uint32) ((uchar) (A)[5])) << 8) |\
+ (((uint32) ((uchar) (A)[6])) << 16) |\
(((uint32) ((uchar) (A)[7])) << 24))) <<\
32))
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h
index 4b2cbbe5584..72e00be8c2c 100644
--- a/include/byte_order_generic_x86.h
+++ b/include/byte_order_generic_x86.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2020, 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
@@ -27,20 +28,20 @@
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((const long *) (A)))
#define uint2korr(A) (*((const uint16 *) (A)))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (*((const uint32 *) (A)))
-#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
- (((uint32) ((uchar) (A)[2])) << 16) +\
- (((uint32) ((uchar) (A)[3])) << 24)) +\
+#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
+ (((uint32) ((uchar) (A)[2])) << 16) |\
+ (((uint32) ((uchar) (A)[3])) << 24)) |\
(((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
- (((uint32) ((uchar) (A)[1])) << 8) + \
- (((uint32) ((uchar) (A)[2])) << 16) + \
- (((uint32) ((uchar) (A)[3])) << 24)) + \
- (((ulonglong) ((uchar) (A)[4])) << 32) + \
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) | \
+ (((uint32) ((uchar) (A)[1])) << 8) | \
+ (((uint32) ((uchar) (A)[2])) << 16) | \
+ (((uint32) ((uchar) (A)[3])) << 24)) | \
+ (((ulonglong) ((uchar) (A)[4])) << 32) | \
(((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((const ulonglong *) (A)))
#define sint8korr(A) (*((const longlong *) (A)))
diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h
index 68001ca941f..a25e6a2ab08 100644
--- a/include/byte_order_generic_x86_64.h
+++ b/include/byte_order_generic_x86_64.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2020, 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
@@ -28,8 +29,8 @@
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (*((int32 *) (A)))
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
-#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
- (((uint32) ((uchar) (A)[1])) << 8) +\
+#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) |\
+ (((uint32) ((uchar) (A)[1])) << 8) |\
(((uint32) ((uchar) (A)[2])) << 16))
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
@@ -53,7 +54,7 @@ static inline ulonglong uint6korr(const void *p)
#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
*((uint16*)(pT))= (uint16) (A);\
} while (0)
-
+
#define int3store(T,A) do { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16));\
diff --git a/include/ilist.h b/include/ilist.h
new file mode 100644
index 00000000000..ed1d978a0d6
--- /dev/null
+++ b/include/ilist.h
@@ -0,0 +1,252 @@
+/*
+ Copyright (c) 2019, 2020, 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 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-1335 USA
+*/
+
+#pragma once
+
+#include "my_dbug.h"
+
+#include <cstddef>
+#include <iterator>
+
+// Derive your class from this struct to insert to a linked list.
+template <class Tag= void> struct ilist_node
+{
+ ilist_node()
+#ifndef DBUG_OFF
+ : next(NULL), prev(NULL)
+#endif
+ {
+ }
+
+ ilist_node(ilist_node *next, ilist_node *prev) : next(next), prev(prev) {}
+
+ ilist_node *next;
+ ilist_node *prev;
+};
+
+// Modelled after std::list<T>
+template <class T, class Tag= void> class ilist
+{
+public:
+ typedef ilist_node<Tag> ListNode;
+ class Iterator;
+
+ // All containers in C++ should define these types to implement generic
+ // container interface.
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type &reference;
+ typedef const value_type &const_reference;
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef Iterator iterator;
+ typedef const Iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const iterator> const_reverse_iterator;
+
+ class Iterator
+ {
+ public:
+ // All iterators in C++ should define these types to implement generic
+ // iterator interface.
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef T value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T *pointer;
+ typedef T &reference;
+
+ Iterator(ListNode *node) : node_(node) { DBUG_ASSERT(node_ != NULL); }
+
+ Iterator &operator++()
+ {
+ node_= node_->next;
+ DBUG_ASSERT(node_ != NULL);
+ return *this;
+ }
+ Iterator operator++(int)
+ {
+ Iterator tmp(*this);
+ operator++();
+ return tmp;
+ }
+
+ Iterator &operator--()
+ {
+ node_= node_->prev;
+ DBUG_ASSERT(node_);
+ return *this;
+ }
+ Iterator operator--(int)
+ {
+ Iterator tmp(*this);
+ operator--();
+ return tmp;
+ }
+
+ reference operator*() { return *static_cast<pointer>(node_); }
+ pointer operator->() { return static_cast<pointer>(node_); }
+
+ friend bool operator==(const Iterator &lhs, const Iterator &rhs)
+ {
+ return lhs.node_ == rhs.node_;
+ }
+ friend bool operator!=(const Iterator &lhs, const Iterator &rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ private:
+ ListNode *node_;
+
+ friend class ilist;
+ };
+
+ ilist() : sentinel_(&sentinel_, &sentinel_) {}
+
+ reference front() { return *begin(); }
+ reference back() { return *--end(); }
+
+ iterator begin() { return iterator(sentinel_.next); }
+ const_iterator begin() const
+ {
+ return iterator(const_cast<ListNode *>(sentinel_.next));
+ }
+ iterator end() { return iterator(&sentinel_); }
+ const_iterator end() const
+ {
+ return iterator(const_cast<ListNode *>(&sentinel_));
+ }
+
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return reverse_iterator(begin()); }
+
+ bool empty() const { return sentinel_.next == &sentinel_; }
+
+ // Not implemented because it's O(N)
+ // size_type size() const
+ // {
+ // return static_cast<size_type>(std::distance(begin(), end()));
+ // }
+
+ void clear()
+ {
+ sentinel_.next= &sentinel_;
+ sentinel_.prev= &sentinel_;
+ }
+
+ iterator insert(iterator pos, reference value)
+ {
+ ListNode *curr= pos.node_;
+ ListNode *prev= pos.node_->prev;
+
+ prev->next= &value;
+ curr->prev= &value;
+
+ static_cast<ListNode &>(value).prev= prev;
+ static_cast<ListNode &>(value).next= curr;
+
+ return iterator(&value);
+ }
+
+ iterator erase(iterator pos)
+ {
+ ListNode *prev= pos.node_->prev;
+ ListNode *next= pos.node_->next;
+
+ prev->next= next;
+ next->prev= prev;
+
+#ifndef DBUG_OFF
+ ListNode *curr= pos.node_;
+ curr->prev= NULL;
+ curr->next= NULL;
+#endif
+
+ return next;
+ }
+
+ void push_back(reference value) { insert(end(), value); }
+ void pop_back() { erase(end()); }
+
+ void push_front(reference value) { insert(begin(), value); }
+ void pop_front() { erase(begin()); }
+
+ // STL version is O(n) but this is O(1) because an element can't be inserted
+ // several times in the same ilist.
+ void remove(reference value) { erase(iterator(&value)); }
+
+private:
+ ListNode sentinel_;
+};
+
+// Similar to ilist but also has O(1) size() method.
+template <class T, class Tag= void> class sized_ilist : public ilist<T, Tag>
+{
+ typedef ilist<T, Tag> BASE;
+
+public:
+ // All containers in C++ should define these types to implement generic
+ // container interface.
+ typedef T value_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type &reference;
+ typedef const value_type &const_reference;
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef typename BASE::Iterator iterator;
+ typedef const typename BASE::Iterator const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const iterator> const_reverse_iterator;
+
+ sized_ilist() : size_(0) {}
+
+ size_type size() const { return size_; }
+
+ void clear()
+ {
+ BASE::clear();
+ size_= 0;
+ }
+
+ iterator insert(iterator pos, reference value)
+ {
+ ++size_;
+ return BASE::insert(pos, value);
+ }
+
+ iterator erase(iterator pos)
+ {
+ --size_;
+ return BASE::erase(pos);
+ }
+
+ void push_back(reference value) { insert(BASE::end(), value); }
+ void pop_back() { erase(BASE::end()); }
+
+ void push_front(reference value) { insert(BASE::begin(), value); }
+ void pop_front() { erase(BASE::begin()); }
+
+ void remove(reference value) { erase(iterator(&value)); }
+
+private:
+ size_type size_;
+};
diff --git a/include/my_alarm.h b/include/my_alarm.h
index 6010da6e2c3..bc0004476ca 100644
--- a/include/my_alarm.h
+++ b/include/my_alarm.h
@@ -29,6 +29,13 @@ extern ulong my_time_to_wait_for_lock;
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
#include <signal.h>
+#ifdef HAVE_SIGHANDLER_T
+#define sig_return sighandler_t
+#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__)
+typedef void (*sig_return)(int); /* Returns type from signal */
+#else
+typedef void (*sig_return)(void); /* Returns type from signal */
+#endif
#define ALARM_VARIABLES uint alarm_old=0; \
sig_return alarm_signal=0
#define ALARM_INIT my_have_got_alarm=0 ; \
diff --git a/include/my_compiler.h b/include/my_compiler.h
index 12e6c1a087c..faffd852b5d 100644
--- a/include/my_compiler.h
+++ b/include/my_compiler.h
@@ -2,6 +2,7 @@
#define MY_COMPILER_INCLUDED
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2017, 2020, 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
@@ -150,6 +151,7 @@ struct my_aligned_storage
#ifdef __GNUC__
# define ATTRIBUTE_NORETURN __attribute__((noreturn))
+# define ATTRIBUTE_NOINLINE __attribute__((noinline))
# if MY_GNUC_PREREQ(4,3)
/** Starting with GCC 4.3, the "cold" attribute is used to inform the
compiler that a function is unlikely executed. The function is
@@ -163,8 +165,10 @@ rarely invoked function for size instead for speed. */
# endif
#elif defined _MSC_VER
# define ATTRIBUTE_NORETURN __declspec(noreturn)
+# define ATTRIBUTE_NOINLINE __declspec(noinline)
#else
# define ATTRIBUTE_NORETURN /* empty */
+# define ATTRIBUTE_NOINLINE /* empty */
#endif
#ifndef ATTRIBUTE_COLD
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 0fe40a9e8cb..debcfc50505 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -64,6 +64,7 @@ extern void dbug_swap_code_state(void **code_state_store);
extern void dbug_free_code_state(void **code_state_store);
extern const char* _db_get_func_(void);
+#ifdef DBUG_TRACE
#define DBUG_LEAVE do { \
_db_stack_frame_.line= __LINE__; \
_db_return_ (&_db_stack_frame_); \
@@ -82,6 +83,13 @@ extern const char* _db_get_func_(void);
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#endif
+#else
+#define DBUG_LEAVE
+#define DBUG_ENTER(a)
+#define DBUG_RETURN(a1) return(a1)
+#define DBUG_VOID_RETURN return
+#endif
+
#define DBUG_EXECUTE(keyword,a1) \
do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \
diff --git a/include/my_global.h b/include/my_global.h
index 8103f82a7e2..5e96400eac1 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -531,13 +531,6 @@ typedef int my_socket; /* File descriptor for sockets */
#endif
/* Type for fuctions that handles signals */
#define sig_handler RETSIGTYPE
-C_MODE_START
-#ifdef HAVE_SIGHANDLER_T
-#define sig_return sighandler_t
-#else
-typedef void (*sig_return)(void); /* Returns type from signal */
-#endif
-C_MODE_END
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */
typedef char puchar; /* Mixed prototypes can take char */
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 2b3f4f14ea3..f369b765edd 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -693,7 +693,7 @@ extern void my_mutex_end(void);
We need to have at least 256K stack to handle calls to myisamchk_init()
with the current number of keys and key parts.
*/
-#ifdef __SANITIZE_ADDRESS__
+#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
#define DEFAULT_THREAD_STACK (364*1024L)
#else
#define DEFAULT_THREAD_STACK (292*1024L)
@@ -729,13 +729,14 @@ struct st_my_thread_var
#endif
};
-extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
+struct st_my_thread_var *_my_thread_var(void);
extern void **my_thread_var_dbug(void);
extern safe_mutex_t **my_thread_var_mutex_in_use(void);
extern uint my_thread_end_wait_time;
extern my_bool safe_mutex_deadlock_detector;
#define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno
+int set_mysys_var(struct st_my_thread_var *mysys_var);
/*
Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 6aaf6728c72..6eb6359cf2d 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -43,7 +43,6 @@
C_MODE_START
#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
-void my_init_stacktrace();
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
int my_safe_print_str(const char* val, int max_len);
void my_write_core(int sig);
@@ -53,8 +52,6 @@ char *my_demangle(const char *mangled_name, int *status);
#ifdef __WIN__
void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
#endif /* __WIN__ */
-#else
-#define my_init_stacktrace() do { } while(0)
#endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */
#ifndef _WIN32
diff --git a/include/my_sys.h b/include/my_sys.h
index fe66aeef48c..08b06951d0d 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -476,18 +476,19 @@ typedef struct st_io_cache /* Used when cacheing files */
partial.
*/
int seek_not_done,error;
- /* buffer_length is memory size allocated for buffer or write_buffer */
+ /* length of the buffer used for storing un-encrypted data */
size_t buffer_length;
/* read_length is the same as buffer_length except when we use async io */
size_t read_length;
myf myflags; /* Flags used to my_read/my_write */
/*
- alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
- 0 if it was supplied by the user.
+ alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
+ Includes the overhead(storing key to ecnrypt and decrypt) for encryption.
+ Set to 0 if nothing is allocated.
Currently READ_NET is the only one that will use a buffer allocated
somewhere else
*/
- my_bool alloced_buffer;
+ size_t alloced_buffer;
#ifdef HAVE_AIOWAIT
/*
As inidicated by ifdef, this is for async I/O, which is not currently
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 04116e556ce..a4fc738fd59 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, 2019, MariaDB Corporation.
+/* Copyright (C) 2010, 2020, 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
@@ -32,35 +32,59 @@
#if defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
# include <valgrind/memcheck.h>
+# define HAVE_valgrind_or_MSAN
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_MAKE_DEFINED(a,len) VALGRIND_MAKE_MEM_DEFINED(a,len)
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+# define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len)
+# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len)
# define REDZONE_SIZE 8
#elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
+# define MEM_MAKE_DEFINED(a,len) ((void) 0)
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+# define MEM_GET_VBITS(a,b,len) ((void) 0)
+# define MEM_SET_VBITS(a,b,len) ((void) 0)
+# define REDZONE_SIZE 8
+#elif __has_feature(memory_sanitizer)
+# include <sanitizer/msan_interface.h>
+# define HAVE_valgrind_or_MSAN
+# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len)
+# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len)
+# define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len)
+# define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len)
# define REDZONE_SIZE 8
#else
# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
+# define MEM_MAKE_DEFINED(a,len) ((void) 0)
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+# define MEM_GET_VBITS(a,b,len) ((void) 0)
+# define MEM_SET_VBITS(a,b,len) ((void) 0)
# define REDZONE_SIZE 0
#endif /* HAVE_VALGRIND_MEMCHECK_H */
#ifndef DBUG_OFF
-/* NOTE: Do not invoke TRASH_FILL directly! Use TRASH_ALLOC or TRASH_FREE.
-
-The MEM_UNDEFINED() call before memset() is for canceling the effect
-of any previous MEM_NOACCESS(). We must invoke MEM_UNDEFINED() after
-writing the dummy pattern, unless MEM_NOACCESS() is going to be invoked.
-On AddressSanitizer, the MEM_UNDEFINED() in TRASH_ALLOC() has no effect. */
+/*
+ TRASH_FILL() has to call MEM_UNDEFINED() to cancel any effect of TRASH_FREE().
+ This can happen in the case one does
+ TRASH_ALLOC(A,B) ; TRASH_FREE(A,B) ; TRASH_ALLOC(A,B)
+ to reuse the same memory in an internal memory allocator like MEM_ROOT.
+ For my_malloc() and safemalloc() the extra MEM_UNDEFINED is bit of an
+ overkill.
+ TRASH_FILL() is an internal function and should not be used externally.
+*/
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
#else
#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
diff --git a/include/myisampack.h b/include/myisampack.h
index eb5baf5fc56..6bfe1958fbc 100644
--- a/include/myisampack.h
+++ b/include/myisampack.h
@@ -2,6 +2,7 @@
#define MYISAMPACK_INCLUDED
/* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc.
+ Copyright (c) 2020, MariaDB Corporation.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
@@ -28,7 +29,7 @@
#define mi_sint1korr(A) ((int8)(*A))
#define mi_uint1korr(A) ((uint8)(*A))
-#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\
+#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) |\
((int16) ((int16) ((const char*) (A))[0]) << 8)))
#define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \
(((uint32) 255L << 24) | \
@@ -38,58 +39,58 @@
(((uint32) ((const uchar*) (A))[0]) << 16) |\
(((uint32) ((const uchar*) (A))[1]) << 8) | \
((uint32) ((const uchar*) (A))[2])))
-#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\
- ((int32) (((const uchar*) (A))[2]) << 8) +\
- ((int32) (((const uchar*) (A))[1]) << 16) +\
+#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) |\
+ ((int32) (((const uchar*) (A))[2]) << 8) |\
+ ((int32) (((const uchar*) (A))[1]) << 16) |\
((int32) ((int16) ((const char*) (A))[0]) << 24)))
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
-#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\
+#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) |\
((uint16) (((const uchar*) (A))[0]) << 8)))
-#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\
- (((uint32) (((const uchar*) (A))[1])) << 8) +\
+#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) |\
+ (((uint32) (((const uchar*) (A))[1])) << 8) |\
(((uint32) (((const uchar*) (A))[0])) << 16)))
-#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\
- (((uint32) (((const uchar*) (A))[2])) << 8) +\
- (((uint32) (((const uchar*) (A))[1])) << 16) +\
+#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) |\
+ (((uint32) (((const uchar*) (A))[2])) << 8) |\
+ (((uint32) (((const uchar*) (A))[1])) << 16) |\
(((uint32) (((const uchar*) (A))[0])) << 24)))
#ifndef HAVE_mi_uint5korr
-#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\
- (((uint32) (((const uchar*) (A))[3])) << 8) +\
- (((uint32) (((const uchar*) (A))[2])) << 16) +\
- (((uint32) (((const uchar*) (A))[1])) << 24)) +\
+#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) |\
+ (((uint32) (((const uchar*) (A))[3])) << 8) |\
+ (((uint32) (((const uchar*) (A))[2])) << 16) |\
+ (((uint32) (((const uchar*) (A))[1])) << 24)) |\
(((ulonglong) (((const uchar*) (A))[0])) << 32))
#endif /* HAVE_mi_uint5korr */
#ifndef HAVE_mi_uint6korr
-#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\
- (((uint32) (((const uchar*) (A))[4])) << 8) +\
- (((uint32) (((const uchar*) (A))[3])) << 16) +\
- (((uint32) (((const uchar*) (A))[2])) << 24)) +\
- (((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\
+#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) |\
+ (((uint32) (((const uchar*) (A))[4])) << 8) |\
+ (((uint32) (((const uchar*) (A))[3])) << 16) |\
+ (((uint32) (((const uchar*) (A))[2])) << 24)) |\
+ (((ulonglong) (((uint32) (((const uchar*) (A))[1])) |\
(((uint32) (((const uchar*) (A))[0]) << 8)))) <<\
32))
#endif /* HAVE_mi_uint6korr */
#ifndef HAVE_mi_uint7korr
-#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\
- (((uint32) (((const uchar*) (A))[5])) << 8) +\
- (((uint32) (((const uchar*) (A))[4])) << 16) +\
- (((uint32) (((const uchar*) (A))[3])) << 24)) +\
- (((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\
- (((uint32) (((const uchar*) (A))[1])) << 8) +\
+#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) |\
+ (((uint32) (((const uchar*) (A))[5])) << 8) |\
+ (((uint32) (((const uchar*) (A))[4])) << 16) |\
+ (((uint32) (((const uchar*) (A))[3])) << 24)) |\
+ (((ulonglong) (((uint32) (((const uchar*) (A))[2])) |\
+ (((uint32) (((const uchar*) (A))[1])) << 8) |\
(((uint32) (((const uchar*) (A))[0])) << 16))) <<\
32))
#endif /* HAVE_mi_uint7korr */
#ifndef HAVE_mi_uint8korr
-#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\
- (((uint32) (((const uchar*) (A))[6])) << 8) +\
- (((uint32) (((const uchar*) (A))[5])) << 16) +\
- (((uint32) (((const uchar*) (A))[4])) << 24)) +\
- (((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\
- (((uint32) (((const uchar*) (A))[2])) << 8) +\
- (((uint32) (((const uchar*) (A))[1])) << 16) +\
+#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) |\
+ (((uint32) (((const uchar*) (A))[6])) << 8) |\
+ (((uint32) (((const uchar*) (A))[5])) << 16) |\
+ (((uint32) (((const uchar*) (A))[4])) << 24)) |\
+ (((ulonglong) (((uint32) (((const uchar*) (A))[3])) |\
+ (((uint32) (((const uchar*) (A))[2])) << 8) |\
+ (((uint32) (((const uchar*) (A))[1])) << 16) |\
(((uint32) (((const uchar*) (A))[0])) << 24))) <<\
32))
#endif /* HAVE_mi_uint8korr */
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index 0b7d73e5953..bd01cff69e4 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/mysql_idle.h b/include/mysql/psi/mysql_idle.h
index b37495ebb7d..834a1908e35 100644
--- a/include/mysql/psi/mysql_idle.h
+++ b/include/mysql/psi/mysql_idle.h
@@ -2,13 +2,20 @@
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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index bdb60c4ad57..918acb65ebe 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -1,15 +1,21 @@
/* Copyright (c) 2010, 2012, 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 free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License, version 2.0,
+as published by the Free Software Foundation.
+
+This program is also distributed with certain software (including
+but not limited to OpenSSL) that is licensed under separate terms,
+as designated in a particular file or component or in included license
+documentation. The authors of MySQL hereby grant you an additional
+permission to link the program and your derivative works with the
+separately licensed software that they have included with MySQL.
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License, version 2.0, 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
@@ -1037,10 +1043,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
- flags= fcntl(socket_accept.fd, F_GETFD);
- if (flags != -1) {
- flags |= FD_CLOEXEC;
- fcntl(socket_accept.fd, F_SETFD, flags);
+ if (socket_accept.fd != INVALID_SOCKET)
+ {
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1)
+ {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
}
#endif
#endif
@@ -1059,10 +1069,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
- flags= fcntl(socket_accept.fd, F_GETFD);
- if (flags != -1) {
- flags |= FD_CLOEXEC;
- fcntl(socket_accept.fd, F_SETFD, flags);
+ if (socket_accept.fd != INVALID_SOCKET)
+ {
+ flags= fcntl(socket_accept.fd, F_GETFD);
+ if (flags != -1)
+ {
+ flags |= FD_CLOEXEC;
+ fcntl(socket_accept.fd, F_SETFD, flags);
+ }
}
#endif
#endif
diff --git a/include/mysql/psi/mysql_stage.h b/include/mysql/psi/mysql_stage.h
index b6ab09fef55..1dbaed6c682 100644
--- a/include/mysql/psi/mysql_stage.h
+++ b/include/mysql/psi/mysql_stage.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index 33c61a63505..28543ba95a2 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -2,13 +2,20 @@
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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h
index 7584fec2243..8c216ba2d65 100644
--- a/include/mysql/psi/mysql_table.h
+++ b/include/mysql/psi/mysql_table.h
@@ -2,13 +2,20 @@
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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index c9ea4251ad3..b93aee622db 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates.
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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 6feb1f87fa7..3f7b04b0841 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/psi_abi_v0.h b/include/mysql/psi/psi_abi_v0.h
index 0601b61a5c7..ca4373f847b 100644
--- a/include/mysql/psi/psi_abi_v0.h
+++ b/include/mysql/psi/psi_abi_v0.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/psi_abi_v1.h b/include/mysql/psi/psi_abi_v1.h
index 2d5e81f5972..488e832c3ed 100644
--- a/include/mysql/psi/psi_abi_v1.h
+++ b/include/mysql/psi/psi_abi_v1.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/psi/psi_abi_v2.h b/include/mysql/psi/psi_abi_v2.h
index 420cc63fc13..67c054848a1 100644
--- a/include/mysql/psi/psi_abi_v2.h
+++ b/include/mysql/psi/psi_abi_v2.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h
index bd1f069c527..6757a658fb6 100644
--- a/include/mysql/service_my_snprintf.h
+++ b/include/mysql/service_my_snprintf.h
@@ -55,7 +55,8 @@
Supported formats are 's' (null pointer is accepted, printed as
"(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o',
- 'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below).
+ 'X', 'p' (works as 0x%x), 'f', 'g', 'M' (extension, see below),
+ 'T' (extension, see below).
Standard syntax for positional arguments $n is supported.
@@ -69,6 +70,9 @@
Format 'M': takes one integer, prints this integer, space, double quote
error message, double quote. In other words
printf("%M", n) === printf("%d \"%s\"", n, strerror(n))
+
+ Format 'T': takes string and print it like s but if the strints should be
+ truncated puts "..." at the end.
*/
#ifdef __cplusplus
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index 923ba57fcdc..54b9eb9250c 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -115,6 +115,8 @@ extern struct wsrep_service_st {
void (*wsrep_unlock_rollback_func)();
void (*wsrep_set_data_home_dir_func)(const char *data_dir);
my_bool (*wsrep_thd_is_applier_func)(MYSQL_THD);
+ void (*wsrep_report_bf_lock_wait_func)(MYSQL_THD thd,
+ unsigned long long trx_id);
} *wsrep_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -161,6 +163,7 @@ extern struct wsrep_service_st {
#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_thd_is_applier(T) wsrep_service->wsrep_thd_is_applier_func(T)
+#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait_func(T,I)
#define wsrep_debug get_wsrep_debug()
#define wsrep_log_conflicts get_wsrep_log_conflicts()
@@ -223,6 +226,8 @@ bool wsrep_thd_ignore_table(THD *thd);
void wsrep_unlock_rollback();
void wsrep_set_data_home_dir(const char *data_dir);
my_bool wsrep_thd_is_applier(MYSQL_THD thd);
+void wsrep_report_bf_lock_wait(THD *thd,
+ unsigned long long trx_id);
#endif
#ifdef __cplusplus
diff --git a/include/mysql_version.h.in b/include/mysql_version.h.in
index f22e00dabb9..16876dbfedd 100644
--- a/include/mysql_version.h.in
+++ b/include/mysql_version.h.in
@@ -17,12 +17,15 @@
#define MYSQL_SERVER_SUFFIX_DEF "@MYSQL_SERVER_SUFFIX@"
#define FRM_VER @DOT_FRM_VERSION@
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
-#define MYSQL_PORT @MYSQL_TCP_PORT@
+#define MARIADB_PORT @MYSQL_TCP_PORT@
#define MYSQL_PORT_DEFAULT @MYSQL_TCP_PORT_DEFAULT@
-#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
+#define MARIADB_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
#define MYSQL_CONFIG_NAME "my"
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
+#define MYSQL_PORT MARIADB_PORT
+#define MYSQL_UNIX_ADDR MARIADB_UNIX_ADDR
+
#ifdef WITH_WSREP
#define WSREP_PATCH_VERSION "@WSREP_PATCH_VERSION@"
#endif
diff --git a/include/queues.h b/include/queues.h
index f341bbb8148..99e640413e3 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -55,7 +55,7 @@ typedef struct st_queue {
#define queue_top(queue) ((queue)->root[1])
#define queue_element(queue,index) ((queue)->root[index])
#define queue_end(queue) ((queue)->root[(queue)->elements])
-#define queue_replace_top(queue) _downheap(queue, 1, (queue)->root[1])
+#define queue_replace_top(queue) _downheap(queue, 1)
#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? -1 : 1
@@ -63,23 +63,23 @@ typedef struct st_queue {
typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
- pbool max_at_top, queue_compare compare,
+ my_bool max_at_top, queue_compare compare,
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
- pbool max_at_top, queue_compare compare,
+ my_bool max_at_top, queue_compare compare,
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
-void queue_insert(QUEUE *queue,uchar *element);
+void queue_insert(QUEUE *queue, uchar *element);
int queue_insert_safe(QUEUE *queue, uchar *element);
uchar *queue_remove(QUEUE *queue,uint idx);
void queue_replace(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
#define queue_is_full(queue) (queue->elements == queue->max_elements)
-void _downheap(QUEUE *queue, uint idx, uchar *element);
+void _downheap(QUEUE *queue, uint idx);
void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0)
diff --git a/include/span.h b/include/span.h
new file mode 100644
index 00000000000..0e8516933c6
--- /dev/null
+++ b/include/span.h
@@ -0,0 +1,161 @@
+/*****************************************************************************
+
+Copyright (c) 2019, 2020 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 02110-1335 USA
+
+*****************************************************************************/
+
+#pragma once
+
+#include <cstddef>
+#include <iterator>
+
+namespace st_
+{
+
+namespace detail
+{
+
+template <class T> struct remove_cv
+{
+ typedef T type;
+};
+template <class T> struct remove_cv<const T>
+{
+ typedef T type;
+};
+template <class T> struct remove_cv<volatile T>
+{
+ typedef T type;
+};
+template <class T> struct remove_cv<const volatile T>
+{
+ typedef T type;
+};
+
+} // namespace detail
+
+template <class ElementType> class span
+{
+public:
+ typedef ElementType element_type;
+ typedef typename detail::remove_cv<ElementType>::type value_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef element_type *pointer;
+ typedef const element_type *const_pointer;
+ typedef element_type &reference;
+ typedef const element_type &const_reference;
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
+ span() : data_(NULL), size_(0) {}
+
+ span(pointer ptr, size_type count) : data_(ptr), size_(count) {}
+
+ span(pointer first, pointer last) : data_(first), size_(last - first) {}
+
+ template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N) {}
+
+ template <class Container>
+ span(Container &cont) : data_(cont.data()), size_(cont.size())
+ {
+ }
+
+ template <class Container>
+ span(const Container &cont) : data_(cont.data()), size_(cont.size())
+ {
+ }
+
+ span(const span &other) : data_(other.data_), size_(other.size_) {}
+
+ ~span(){};
+
+ span &operator=(const span &other)
+ {
+ data_= other.data();
+ size_= other.size();
+ return *this;
+ }
+
+ template <size_t Count> span<element_type> first() const
+ {
+ assert(!empty());
+ return span(data(), 1);
+ }
+ template <size_t Count> span<element_type> last() const
+ {
+ assert(!empty());
+ return span(data() + size() - 1, 1);
+ }
+
+ span<element_type> first(size_type count) const
+ {
+ assert(!empty());
+ return span(data(), 1);
+ }
+ span<element_type> last(size_type count) const
+ {
+ assert(!empty());
+ return span(data() + size() - 1, 1);
+ }
+ span<element_type> subspan(size_type offset, size_type count) const
+ {
+ assert(!empty());
+ assert(size() >= offset + count);
+ return span(data() + offset, count);
+ }
+
+ size_type size() const { return size_; }
+ size_type size_bytes() const { return size() * sizeof(ElementType); }
+ bool empty() const __attribute__((warn_unused_result))
+ {
+ return size() == 0;
+ }
+
+ reference operator[](size_type idx) const
+ {
+ assert(size() > idx);
+ return data()[idx];
+ }
+ reference front() const
+ {
+ assert(!empty());
+ return data()[0];
+ }
+ reference back() const
+ {
+ assert(!empty());
+ return data()[size() - 1];
+ }
+ pointer data() const { return data_; }
+
+ iterator begin() const { return data_; }
+ iterator end() const { return data_ + size_; }
+ reverse_iterator rbegin() const
+ {
+ return std::reverse_iterator<iterator>(end());
+ }
+ reverse_iterator rend() const
+ {
+ return std::reverse_iterator<iterator>(begin());
+ }
+
+private:
+ pointer data_;
+ size_type size_;
+};
+
+} // namespace st_
diff --git a/include/sslopt-case.h b/include/sslopt-case.h
index fe53088e89b..fe83051c275 100644
--- a/include/sslopt-case.h
+++ b/include/sslopt-case.h
@@ -30,7 +30,7 @@
*/
opt_use_ssl= 1;
/* crl has no effect in yaSSL */
-#ifdef HAVE_YASSL
+#if defined (HAVE_YASSL) && (!defined (_WIN32) || defined (MYSQL_SERVER))
opt_ssl_crl= NULL;
opt_ssl_crlpath= NULL;
#endif
diff --git a/include/violite.h b/include/violite.h
index 45273ac5f24..b9ab7aeb99a 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -138,6 +138,9 @@ typedef my_socket YASSL_SOCKET_T;
#define YASSL_SOCKET_T_DEFINED
#include <openssl/ssl.h>
#include <openssl/err.h>
+#ifdef DEPRECATED
+#undef DEPRECATED
+#endif
enum enum_ssl_init_error
{
diff --git a/libmariadb b/libmariadb
-Subproject 980f2dbea6586091333057bb2994b1874746694
+Subproject e38244220646a7e95c9be22576460aa7a4eb715
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d278bd39834..229e4e69e6a 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -330,7 +330,7 @@ static my_bool emb_read_query_result(MYSQL *mysql)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
- uchar header[5];
+ uchar header[9];
THD *thd;
my_bool res;
@@ -342,6 +342,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
int4store(header, stmt->stmt_id);
header[4]= (uchar) stmt->flags;
+ header[5]= header[6]= header[7]= header[8]= 0; // safety
thd= (THD*)stmt->mysql->thd;
thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params;
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index 13f7f074d80..970076393d0 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -154,8 +154,10 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
*/
#if MYSQL_PORT_DEFAULT == 0
+# if !__has_feature(memory_sanitizer) // Work around MSAN deficiency
if ((serv_ptr= getservbyname("mysql", "tcp")))
mysql_port= (uint) ntohs((ushort) serv_ptr->s_port);
+# endif
#endif
if ((env= getenv("MYSQL_TCP_PORT")))
mysql_port=(uint) atoi(env);
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index 0dd4004f22f..5acec2ede67 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2012, Monty Program Ab
+# Copyright (c) 2012, 2020, 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
@@ -21,12 +21,12 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysql_secure_installation.1 mysql_setpermission.1
mysql_tzinfo_to_sql.1 mysql_upgrade.1
mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1
- mysqltest.1 perror.1 replace.1 resolve_stack_dump.1
+ perror.1 replace.1 resolve_stack_dump.1
resolveip.1 mariadb-service-convert.1
- mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
+ mysqld_safe_helper.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
+ galera_recovery.1 galera_new_cluster.1
mysql_ldb.1
wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1
wsrep_sst_rsync_wan.1)
@@ -37,7 +37,8 @@ SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysql_plugin.1 mysql_embedded.1)
SET(MAN1_DEVEL mysql_config.1)
SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1
- mysqltest_embedded.1 mysql_client_test_embedded.1 my_safe_process.1)
+ mysqltest.1 mysqltest_embedded.1 mysql_client_test_embedded.1
+ my_safe_process.1)
INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer)
INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)
diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index a2153ac57fe..e5489e5219e 100644
--- a/man/mysql-test-run.pl.1
+++ b/man/mysql-test-run.pl.1
@@ -1937,8 +1937,10 @@ Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are se
.\" suite option: mysql-test-run.pl
\fB\-\-suite[s]=\fR\fB\fIsuite_name...\fR\fR
.sp
-Comma separated list of suite names to run. The default is: "main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,handler-,heap-,innodb-,innodb_fts-,
-innodb_zip-,maria-,multi_source-,optimizer_unfixed_bugs-,parts-,percona-,perfschema-,
+Comma separated list of suite names to run. The default is:
+"main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,
+handler-,heap-,innodb-,innodb_fts-,innodb_zip-,maria-,
+multi_source-,optimizer_unfixed_bugs-,parts-,perfschema-,
plugins-,roles-,rpl-,sys_vars-,unit-,vcol-"\&.
.RE
.sp
diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1
index af899b3e64e..29e9478781c 100644
--- a/man/mysql_upgrade.1
+++ b/man/mysql_upgrade.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQL_UPGRADE\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System"
+.TH "\FBMYSQL_UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.2" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -165,6 +165,8 @@ in the data directory\&. This is used to quickly check whether all tables have b
\fB\-\-force\fR
option\&.
.PP
+For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&.
+.PP
If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&.
\fBmysql_upgrade\fR
is included in the server RPM but requires the client RPM because the latter includes
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index 98d68e956c5..16112399dab 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -57,13 +57,13 @@ all would be imported into a table named
patient\&.
.PP
.PP
-\fBmysqldump\fR
+\fBmysqlimport\fR
supports the following options, which can be specified on the command line or in the
-[mysqldump]
+[mysqlimport]
and
[client]
option file groups\&.
-\fBmysqldump\fR
+\fBmysqlimport\fR
also supports the options for processing option files\&.
.sp
.RS 4
@@ -267,17 +267,17 @@ Empty the table before importing the text file\&.
.sp -1
.IP \(bu 2.3
.\}
-.\" mysqldump: fields-terminated-by option
-.\" fields-terminated-by option: mysqldump
+.\" mysqlimport: fields-terminated-by option
+.\" fields-terminated-by option: mysqlimport
\fB\-\-fields\-terminated\-by=\&.\&.\&.\fR,
-.\" mysqldump: fields-enclosed-by option
-.\" fields-enclosed-by option: mysqldump
+.\" mysqlimport: fields-enclosed-by option
+.\" fields-enclosed-by option: mysqlimport
\fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR,
-.\" mysqldump: fields-optionally-enclosed-by option
-.\" fields-optionally-enclosed-by option: mysqldump
+.\" mysqlimport: fields-optionally-enclosed-by option
+.\" fields-optionally-enclosed-by option: mysqlimport
\fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR,
-.\" mysqldump: fields-escaped-by option
-.\" fields-escaped-by option: mysqldump
+.\" mysqlimport: fields-escaped-by option
+.\" fields-escaped-by option: mysqlimport
\fB\-\-fields\-escaped\-by=\&.\&.\&.\fR
.sp
These options have the same meaning as the corresponding clauses for
@@ -379,8 +379,8 @@ lines of the data file\&.
.sp -1
.IP \(bu 2.3
.\}
-.\" mysqldump: lines-terminated-by option
-.\" lines-terminated-by option: mysqldump
+.\" mysqlimport: lines-terminated-by option
+.\" lines-terminated-by option: mysqlimport
\fB\-\-lines\-terminated\-by=\&.\&.\&.\fR
.sp
This option has the same meaning as the corresponding clause for
diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def
index 93fff886791..8ba5b271c2b 100644
--- a/mysql-test/disabled.def
+++ b/mysql-test/disabled.def
@@ -14,8 +14,6 @@ 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.
-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
partition_open_files_limit : open_files_limit check broken by MDEV-18360
diff --git a/mysql-test/extra/binlog_tests/binlog_index.inc b/mysql-test/extra/binlog_tests/binlog_index.inc
index 50215aef9a9..47adcb8df7a 100644
--- a/mysql-test/extra/binlog_tests/binlog_index.inc
+++ b/mysql-test/extra/binlog_tests/binlog_index.inc
@@ -22,7 +22,7 @@ call mtr.add_suppression('Could not open .*');
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;
-let $old=`select @@debug`;
+SET @saved_dbug = @@SESSION.debug_dbug;
RESET MASTER;
@@ -273,6 +273,6 @@ SELECT @index;
-- replace_regex /\.[\\\/]master/master/
SELECT @index;
-eval SET SESSION debug_dbug="$old";
+SET @@SESSION.debug_dbug = @saved_dbug;
--echo End of tests
diff --git a/mysql-test/extra/binlog_tests/binlog_ioerr.inc b/mysql-test/extra/binlog_tests/binlog_ioerr.inc
index 8d1069bacb0..da6fb5ac727 100644
--- a/mysql-test/extra/binlog_tests/binlog_ioerr.inc
+++ b/mysql-test/extra/binlog_tests/binlog_ioerr.inc
@@ -15,12 +15,13 @@ RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
--error ER_ERROR_ON_WRITE
INSERT INTO t1 VALUES(1);
--error ER_ERROR_ON_WRITE
INSERT INTO t1 VALUES(2);
-SET SESSION debug_dbug='';
+SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc b/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc
index 49ab4f386bf..72049a65f15 100644
--- a/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_errors.inc
@@ -49,6 +49,7 @@
call mtr.add_suppression("Can't generate a unique log-filename");
call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
call mtr.add_suppression("Error writing file .*");
+call mtr.add_suppression("Could not use master-bin for logging");
SET @old_debug= @@global.debug_dbug;
@@ -84,14 +85,14 @@ FLUSH LOGS;
### (should show just one binlog)
RESET MASTER;
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
-- error ER_NO_UNIQUE_LOGFILE
FLUSH LOGS;
-- echo # assert: must show one binlog
-- source include/show_binary_logs.inc
### ACTION: clean up and move to next test
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
-- echo ###################### TEST #3
@@ -116,7 +117,7 @@ RESET MASTER;
-- source include/show_binary_logs.inc
# clean up the table and the binlog to be used in next part of test
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
@@ -127,7 +128,7 @@ RESET MASTER;
### changes performed despite the fact that it reported an
### error.
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- error ER_NO_UNIQUE_LOGFILE
-- eval LOAD DATA INFILE '$load_file' INTO TABLE t2
@@ -137,7 +138,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename";
SELECT count(*) FROM t2;
# clean up the table and the binlog to be used in next part of test
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
@@ -146,7 +147,7 @@ RESET MASTER;
### ASSERTION: load the small file into a transactional table and
### check that it succeeds
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval LOAD DATA INFILE '$load_file2' INTO TABLE t2
@@ -155,7 +156,7 @@ SET GLOBAL debug_dbug="+d,error_unique_log_filename";
SELECT count(*) FROM t2;
# clean up the table and the binlog to be used in next part of test
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
@@ -166,7 +167,7 @@ RESET MASTER;
### fails we get the error. Transaction is not rolledback
### because rotation happens after the commit.
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse');
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -181,7 +182,7 @@ SELECT count(*) FROM t2;
### ACTION: clean up and move to the next test
SET AUTOCOMMIT= 1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
@@ -191,7 +192,7 @@ RESET MASTER;
### fails then an error is reported and an incident event
### is written to the current binary log.
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
# Disable logging Annotate_rows events to preserve events count.
let $binlog_annotate_row_events_saved= `SELECT @@binlog_annotate_row_events`;
@@ -206,7 +207,7 @@ SELECT count(*) FROM t4;
SELECT count(*) FROM t4;
-- echo ### check that the incident event is written to the current log
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
if (!$binlog_limit)
{
-- let $binlog_limit= 4,1
@@ -227,7 +228,7 @@ RESET MASTER;
### ASSERTION: check that statements end up in error but they succeed
### on changing the data.
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
-- echo # must show 0 entries
SELECT count(*) FROM t4;
SELECT count(*) FROM t2;
@@ -258,13 +259,13 @@ SELECT count(*) FROM t4;
SELECT count(*) FROM t2;
# remove fault injection
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
-- echo ###################### TEST #9
### ASSERTION: check that if we disable binlogging, then statements
### succeed.
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@@ -277,7 +278,7 @@ DELETE FROM t4;
SELECT count(*) FROM t2;
SELECT count(*) FROM t4;
SET SQL_LOG_BIN=1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
-- echo ###################### TEST #10
@@ -292,11 +293,11 @@ RESET MASTER;
SHOW WARNINGS;
# +d,fault_injection_registering_index => injects fault on MYSQL_BIN_LOG::open
-SET GLOBAL debug_dbug="+d,fault_injection_registering_index";
+SET @@global.debug_dbug="d,fault_injection_registering_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
FLUSH LOGS;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
-- error ER_NO_BINARY_LOGGING
SHOW BINARY LOGS;
@@ -321,11 +322,11 @@ flush tables;
--source include/rpl_restart_server.inc
# +d,fault_injection_openning_index => injects fault on MYSQL_BIN_LOG::open_index_file
-SET GLOBAL debug_dbug="+d,fault_injection_openning_index";
+SET @@global.debug_dbug="d,fault_injection_openning_index";
-- replace_regex /\.[\\\/]master/master/
-- error ER_CANT_OPEN_FILE
FLUSH LOGS;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
-- error ER_FLUSH_MASTER_BINLOG_CLOSED
RESET MASTER;
@@ -350,10 +351,10 @@ flush tables;
### file.
# +d,fault_injection_new_file_rotate_event => injects fault on MYSQL_BIN_LOG::MYSQL_BIN_LOG::new_file_impl
-SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event";
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
-- error ER_ERROR_ON_WRITE
FLUSH LOGS;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
-- error ER_FLUSH_MASTER_BINLOG_CLOSED
RESET MASTER;
diff --git a/mysql-test/extra/rpl_tests/rpl_checksum.inc b/mysql-test/extra/rpl_tests/rpl_checksum.inc
index b5e70abe4d0..17a986dc308 100644
--- a/mysql-test/extra/rpl_tests/rpl_checksum.inc
+++ b/mysql-test/extra/rpl_tests/rpl_checksum.inc
@@ -108,6 +108,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
# instruction to the dump thread
connection slave;
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
--let $slave_io_errno= 1236
@@ -116,8 +117,7 @@ source include/wait_for_slave_io_error.inc;
select count(*) as zero from t1;
-###connection master;
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
connection slave;
source include/start_slave.inc;
@@ -129,10 +129,11 @@ source include/start_slave.inc;
# C1. Failure by a client thread
connection master;
set @@global.master_verify_checksum = 1;
+set @save_dbug = @@session.debug_dbug;
set @@session.debug_dbug='d,simulate_checksum_test_failure';
--error ER_ERROR_WHEN_EXECUTING_COMMAND
show binlog events;
-set @@session.debug_dbug='';
+SET debug_dbug= @save_dbug;
set @@global.master_verify_checksum = default;
#connection master;
@@ -149,6 +150,7 @@ connection slave;
# C2. Failure by IO thread
# instruction to io thread
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave io_thread;
# When the checksum error is detected, the slave sets error code 1913
@@ -158,7 +160,7 @@ start slave io_thread;
--let $slave_io_errno= 1595,1913
--let $show_slave_io_error= 0
source include/wait_for_slave_io_error.inc;
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
# to make IO thread re-read it again w/o the failure
start slave io_thread;
@@ -179,7 +181,7 @@ source include/wait_for_slave_sql_error.inc;
# resuming SQL thread to parse out the event w/o the failure
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
source include/start_slave.inc;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_corruption.inc b/mysql-test/extra/rpl_tests/rpl_corruption.inc
index 1726ee4ba2f..c7a913af9d7 100644
--- a/mysql-test/extra/rpl_tests/rpl_corruption.inc
+++ b/mysql-test/extra/rpl_tests/rpl_corruption.inc
@@ -73,7 +73,8 @@ while ($i) {
# Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing
--echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @saved_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
--echo SHOW BINLOG EVENTS;
--disable_query_log
send_eval SHOW BINLOG EVENTS FROM $pos;
@@ -81,7 +82,7 @@ send_eval SHOW BINLOG EVENTS FROM $pos;
--error ER_ERROR_WHEN_EXECUTING_COMMAND
reap;
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
+SET @@global.debug_dbug=@saved_dbug;
# Emulate corruption on master with crc checking on master
--echo # 3. Master read a corrupted event from binlog and send the error to slave
@@ -106,20 +107,20 @@ let $wait_condition=
SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE command = 'Binlog Dump';
--source include/wait_condition.inc
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
let $slave_io_errno= 1236;
--let $slave_timeout= 10
--source include/wait_for_slave_io_error.inc
--connection master
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug=@saved_dbug;
# Emulate corruption on master without crc checking on master
--echo # 4. Master read a corrupted event from binlog and send it to slave
--connection master
SET GLOBAL master_verify_checksum=0;
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
--connection slave
START SLAVE IO_THREAD;
# When the checksum error is detected, the slave sets error code 1743
@@ -129,30 +130,29 @@ START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
--connection master
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1;
# Emulate corruption in network
--echo # 5. Slave. Corruption in network
--connection slave
-SET GLOBAL debug_dbug="+d,corrupt_queue_event";
+SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
--source include/wait_for_slave_io_error.inc
-SET GLOBAL debug_dbug="-d,corrupt_queue_event";
+SET @@global.debug_dbug=@saved_dbug_slave;
# Emulate corruption in relay log
--echo # 6. Slave. Corruption in relay log
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD;
let $slave_sql_errno= 1593;
--source include/wait_for_slave_sql_error.inc
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug_slave;
# Start normal replication and compare same table on master
# and slave
@@ -167,10 +167,9 @@ let $diff_tables= master:test.t1, slave:test.t1;
# Clean up
--echo # 8. Clean up
--connection master
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
DROP TABLE t1;
--sync_slave_with_master
-SET GLOBAL debug_dbug= "";
--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
index eb0e5e21d62..181759283e2 100644
--- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
+++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
@@ -41,8 +41,8 @@ if (!$debug_sync_action)
# Restart slave
--source include/stop_slave.inc
-
-eval SET @@global.debug_dbug= "+d,$dbug_sync_point";
+SET @old_dbug = @@global.debug_dbug;
+eval SET @@global.debug_dbug= "d,$dbug_sync_point";
--source include/start_slave.inc
--echo slave is going to hang in get_master_version_and_clock
@@ -70,7 +70,7 @@ source include/wait_for_slave_io_error.inc;
# now to avoid restarting IO-thread to re-enter it.
# There will be a new IO thread forked out with its @@session.debug
# unset.
-eval set @@global.debug_dbug= "-d,$dbug_sync_point";
+set @@global.debug_dbug= @old_dbug;
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_incident.inc b/mysql-test/extra/rpl_tests/rpl_incident.inc
index 350a2086681..75d28d6a6c6 100644
--- a/mysql-test/extra/rpl_tests/rpl_incident.inc
+++ b/mysql-test/extra/rpl_tests/rpl_incident.inc
@@ -20,7 +20,7 @@ CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
-let $debug_save= `SELECT @@GLOBAL.debug`;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
# This will generate an incident log event and store it in the binary
@@ -29,9 +29,7 @@ REPLACE INTO t1 VALUES (4);
--save_master_pos
SELECT * FROM t1;
---disable_query_log
-eval SET GLOBAL debug_dbug= '$debug_save';
---enable_query_log
+set @@global.debug_dbug = @saved_dbug;
connection slave;
# Wait until SQL thread stops with error LOST_EVENT on master
diff --git a/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc
index 4fdea651edd..46673ea4764 100644
--- a/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc
+++ b/mysql-test/extra/rpl_tests/rpl_init_slave_errors.inc
@@ -51,6 +51,7 @@ reset slave;
connection slave;
# Set debug flags on slave to force errors to occur
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
@@ -66,7 +67,7 @@ start slave;
call mtr.add_suppression("Failed during slave.* thread initialization");
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
######################################################################
# Injecting faults in the init_slave option
diff --git a/mysql-test/extra/rpl_tests/rpl_parallel.inc b/mysql-test/extra/rpl_tests/rpl_parallel.inc
index 42354343084..b88d2126d4d 100644
--- a/mysql-test/extra/rpl_tests/rpl_parallel.inc
+++ b/mysql-test/extra/rpl_tests/rpl_parallel.inc
@@ -1951,7 +1951,6 @@ SELECT * FROM t2 WHERE a >= 1040 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
-
--echo *** MDEV-6676 - test disabling domain-based parallel replication ***
--connection server_1
# Let's do a bunch of transactions that will conflict if run out-of-order in
@@ -2000,7 +1999,7 @@ SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
# so sleep is ok here. And it's in general not possible to trigger reliably
# the race with debug_sync, since the bugfix makes the race impossible).
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
# Group commit with cid=10000, two event groups.
@@ -2012,7 +2011,7 @@ INSERT INTO t3 VALUES (120, 0);
SET @commit_id= 10001;
INSERT INTO t3 VALUES (121, 0);
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
--source include/save_master_gtid.inc
@@ -2044,7 +2043,7 @@ SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
# We inject a small sleep in the corresponding record_gtid() to make the race
# easier to hit.
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
# Group commit with cid=10010, two event groups.
@@ -2059,8 +2058,7 @@ INSERT INTO t3 VALUES (130, 0);
SET @commit_id= 10011;
INSERT INTO t3 VALUES (131, 0);
-SET SESSION debug_dbug=@old_dbug;
-
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
--source include/save_master_gtid.inc
@@ -2097,7 +2095,7 @@ SET GLOBAL debug_dbug= '+d,inject_mdev8031';
# complete. Finally an extra KILL check catches an unhandled, lingering
# deadlock kill. So rather artificial, but at least it exercises the
# relevant code paths.
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10200;
@@ -2119,7 +2117,7 @@ UPDATE t3 SET b=b+1 WHERE a=204;
UPDATE t3 SET b=b+1 WHERE a=203;
UPDATE t3 SET b=b+1 WHERE a=205;
UPDATE t3 SET b=b+1 WHERE a=205;
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
--source include/save_master_gtid.inc
@@ -2144,7 +2142,7 @@ SET @old_max= @@GLOBAL.max_relay_log_size;
SET GLOBAL max_relay_log_size= 4096;
--connection server_1
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
--let $large= `SELECT REPEAT("*", 8192)`
@@ -2167,7 +2165,7 @@ eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
--enable_query_log
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
--source include/save_master_gtid.inc
@@ -2178,7 +2176,7 @@ SELECT * FROM t3 WHERE a>=200 ORDER BY a;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
--source include/stop_slave.inc
-SET GLOBAL debug_dbug= @old_debg;
+SET GLOBAL debug_dbug= @old_dbug;
SET GLOBAL max_relay_log_size= @old_max;
--source include/start_slave.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc
index 7801498adb4..cddc9286bd2 100644
--- a/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc
+++ b/mysql-test/extra/rpl_tests/rpl_parallel_show_binlog_events_purge_logs.inc
@@ -15,6 +15,7 @@
# that with the fix local variable linfo is valid along all
# mysql_show_binlog_events function scope.
#
+--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
index 43c561c5b85..ac01fb04d16 100644
--- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
+++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
@@ -13,7 +13,8 @@ create table tm (a int auto_increment primary key) engine=myisam;
create table ti (a int auto_increment primary key) engine=innodb;
sync_slave_with_master;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+set @@global.debug_dbug="d,stop_slave_middle_group";
connection master;
@@ -43,7 +44,7 @@ eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as one from ti;
-set @@global.debug_dbug="-d";
+set @@global.debug_dbug=@saved_dbug;
#
# bug#45940 issues around rli->last_event_start_time
@@ -67,8 +68,7 @@ truncate table ti;
#connection slave;
sync_slave_with_master;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
-set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
+set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
connection master;
@@ -96,7 +96,7 @@ eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as zero from ti;
-set @@global.debug_dbug="-d";
+set @@global.debug_dbug=@saved_dbug;
#
# The mixed multi-table update
@@ -109,8 +109,7 @@ connection master;
#connection slave;
sync_slave_with_master;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
-set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
+set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
@@ -135,8 +134,7 @@ eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select max(a) as two from tm;
select max(a) as one from ti;
-set @@global.debug_dbug="-d";
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
#
# clean-up
#
diff --git a/mysql-test/include/binlog_inject_error.inc b/mysql-test/include/binlog_inject_error.inc
index 383f66ba843..ce940352723 100644
--- a/mysql-test/include/binlog_inject_error.inc
+++ b/mysql-test/include/binlog_inject_error.inc
@@ -13,10 +13,10 @@
# let query= 'CREATE TABLE t1 (a INT)';
# source include/binlog_inject_error.inc;
#
-
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
--echo $query;
--replace_regex /(errno: .*)/(errno: #)/
--error ER_ERROR_ON_WRITE
--eval $query
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
diff --git a/mysql-test/include/binlog_parallel_replication_marks.test b/mysql-test/include/binlog_parallel_replication_marks.test
index 82fa997822d..3976088ca43 100644
--- a/mysql-test/include/binlog_parallel_replication_marks.test
+++ b/mysql-test/include/binlog_parallel_replication_marks.test
@@ -80,7 +80,7 @@ while (<F>) {
s/table id \d+/table id #/;
s/mapped to number \d+/mapped to number #/;
s/CRC32 0x[0-9a-f]+/CRC32 0x########/;
- print if /GTID|BEGIN|COMMIT|Table_map|Write_rows|Update_rows|Delete_rows|generated by server|40005 TEMPORARY/;
+ print if /\b(GTID|BEGIN|COMMIT|Table_map|Write_rows|Update_rows|Delete_rows|generated by server|40005 TEMPORARY)\b/;
}
close F;
EOF
diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc
index edd58ee32e7..862afe96f6c 100644
--- a/mysql-test/include/ctype_utf8mb4.inc
+++ b/mysql-test/include/ctype_utf8mb4.inc
@@ -1585,7 +1585,7 @@ drop table t1;
--echo #
--echo # Check strnxfrm() with odd length
--echo #
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
eval create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine $engine;
insert into t1 values ('a'),('b'),('c');
diff --git a/mysql-test/include/galera_have_debug_sync.inc b/mysql-test/include/galera_have_debug_sync.inc
new file mode 100644
index 00000000000..21e7b3c88c3
--- /dev/null
+++ b/mysql-test/include/galera_have_debug_sync.inc
@@ -0,0 +1,9 @@
+--disable_query_log
+
+--let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'`
+
+--if (!$galera_have_debug_sync) {
+ --skip Test requires Galera debug library with debug_sync functionality
+}
+
+--enable_query_log
diff --git a/mysql-test/include/have_not_innodb_plugin.inc b/mysql-test/include/have_not_innodb_plugin.inc
deleted file mode 100644
index e40fd811021..00000000000
--- a/mysql-test/include/have_not_innodb_plugin.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-disable_query_log;
---require r/not_true.require
-select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%' OR PLUGIN_DESCRIPTION LIKE '%xtradb%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
-enable_query_log;
diff --git a/mysql-test/include/have_static_innodb.inc b/mysql-test/include/have_static_innodb.inc
new file mode 100644
index 00000000000..0d7bb856f4f
--- /dev/null
+++ b/mysql-test/include/have_static_innodb.inc
@@ -0,0 +1,7 @@
+source include/have_innodb.inc;
+
+if (!`select count(*) from information_schema.plugins
+ where plugin_name = 'innodb' and plugin_status = 'active' and
+ plugin_library is null`) {
+ skip Need compiled-in InnoDB;
+}
diff --git a/mysql-test/include/icp_debug_kill.inc b/mysql-test/include/icp_debug_kill.inc
new file mode 100644
index 00000000000..d0ecc842869
--- /dev/null
+++ b/mysql-test/include/icp_debug_kill.inc
@@ -0,0 +1,50 @@
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
+
+--disable_warnings
+drop table if exists t0,t1,t2;
+--enable_warnings
+
+create table t0(a int primary key);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1(a int primary key);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+
+create table t2 (
+ kp1 int,
+ kp2 int,
+ col char(100),
+ key(kp1, kp2)
+);
+insert into t2 select a, a, a from t1;
+
+select engine from information_schema.tables
+where table_schema=database() and table_name='t2';
+
+explain
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+
+let $target_id= `select connection_id()`;
+
+set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
+send
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+
+connect (con1, localhost, root,,);
+connection con1;
+set debug_sync='now WAIT_FOR at_icp_check';
+evalp kill query $target_id;
+set debug_sync='now SIGNAL go';
+
+connection default;
+
+--error ER_QUERY_INTERRUPTED
+reap;
+set debug_sync='RESET';
+
+disconnect con1;
+drop table t0,t1,t2;
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/include/innodb_prefix_index_cluster_optimization.combinations b/mysql-test/include/innodb_prefix_index_cluster_optimization.combinations
new file mode 100644
index 00000000000..ad82f82aa9d
--- /dev/null
+++ b/mysql-test/include/innodb_prefix_index_cluster_optimization.combinations
@@ -0,0 +1,5 @@
+[covering]
+innodb_prefix_index_cluster_optimization=on
+
+[unoptimized]
+innodb_prefix_index_cluster_optimization=off
diff --git a/mysql-test/include/innodb_prefix_index_cluster_optimization.inc b/mysql-test/include/innodb_prefix_index_cluster_optimization.inc
new file mode 100644
index 00000000000..c841fece702
--- /dev/null
+++ b/mysql-test/include/innodb_prefix_index_cluster_optimization.inc
@@ -0,0 +1 @@
+--source include/have_innodb.inc
diff --git a/mysql-test/include/io_thd_fault_injection.inc b/mysql-test/include/io_thd_fault_injection.inc
index 11479b3a66c..67b41371913 100644
--- a/mysql-test/include/io_thd_fault_injection.inc
+++ b/mysql-test/include/io_thd_fault_injection.inc
@@ -1,20 +1,19 @@
#
# Takes the flag as an argument:
-# -- let $io_thd_injection_fault_flag=+d,fault_injection_new_file_rotate_event
+# -- let $io_thd_injection_fault_flag=d,fault_injection_new_file_rotate_event
# -- source include/io_thd_fault_injection.inc
#
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
-- disable_warnings
-- source include/stop_slave.inc
-- enable_warnings
--- eval SET GLOBAL debug_dbug="+d,$io_thd_injection_fault_flag"
+-- eval SET @@global.debug_dbug="d,$io_thd_injection_fault_flag"
START SLAVE io_thread;
-- source include/wait_for_slave_io_error.inc
--- eval SET GLOBAL debug_dbug="-d,$io_thd_injection_fault_flag"
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
# restart because slave is in bad shape
--let $rpl_server_number= 2
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
index 95f0f5420a4..e0b7fcdd2ad 100644
--- a/mysql-test/include/mtr_check.sql
+++ b/mysql-test/include/mtr_check.sql
@@ -35,6 +35,7 @@ BEGIN
AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'
AND variable_name not like 'GTID%POS'
AND variable_name != 'GTID_BINLOG_STATE'
+ AND variable_name != 'THREAD_POOL_SIZE'
ORDER BY variable_name;
-- Dump all databases, there should be none
diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc
index 3d3e55db4ac..689f3b8cc1f 100644
--- a/mysql-test/include/restart_mysqld.inc
+++ b/mysql-test/include/restart_mysqld.inc
@@ -1,6 +1,6 @@
# ==== Usage ====
#
-# [--let $shutdown_timeout= 30]
+# [--let $shutdown_timeout= 60]
# [--let $allow_rpl_inited= 1]
# --source include/restart_mysqld.inc
diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc
index 978cfec1885..049c3d5bbd2 100644
--- a/mysql-test/include/rpl_stop_server.inc
+++ b/mysql-test/include/rpl_stop_server.inc
@@ -47,8 +47,8 @@ if ($rpl_debug)
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
# Send shutdown to the connected server and give
-# it 60 seconds to die before zapping it
-shutdown_server 60;
+# it 60 seconds (of mysqltest's default) to die before zapping it
+shutdown_server;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc
index 6bead628fb0..5e66bbb7db0 100644
--- a/mysql-test/include/search_pattern_in_file.inc
+++ b/mysql-test/include/search_pattern_in_file.inc
@@ -36,7 +36,7 @@
# # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file
-# --shutdown_server 10
+# --shutdown_server
# --source include/wait_until_disconnected.inc
#
# --error 1
diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc
index c8ab6d00f0d..74a3028946d 100644
--- a/mysql-test/include/shutdown_mysqld.inc
+++ b/mysql-test/include/shutdown_mysqld.inc
@@ -1,6 +1,6 @@
# ==== Usage ====
#
-# [--let $shutdown_timeout= 30]
+# [--let $shutdown_timeout= 60]
# [--let $allow_rpl_inited= 1]
# --source include/shutdown_mysqld.inc
diff --git a/mysql-test/include/wait_for_line_count_in_file.inc b/mysql-test/include/wait_for_line_count_in_file.inc
new file mode 100644
index 00000000000..838a3ff342b
--- /dev/null
+++ b/mysql-test/include/wait_for_line_count_in_file.inc
@@ -0,0 +1,18 @@
+perl;
+ use strict;
+ use Time::HiRes qw(sleep);
+ my $search_count= $ENV{'SEARCH_COUNT'} or die "SEARCH_COUNT not set";
+ my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set";
+ my $wait_counter= 100; # 10 seconds
+ while (1)
+ {
+ my $cnt= 0;
+ open(FILE, $search_file) or die("Unable to open '$search_file': $!\n");
+ $cnt++ while (<FILE>);
+ close(FILE);
+ last if ($cnt == $search_count);
+ $wait_counter-- or
+ die "Timeout waiting for $search_count lines in $search_file\n";
+ sleep(0.1);
+ }
+EOF
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index 7d81bf1a1b4..4dd4e24f30d 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -206,7 +206,7 @@ int main(int argc, const char** argv )
} else {
if (strcmp(arg, "--verbose") == 0)
verbose++;
- else if (strncmp(arg, "--parent-pid", 10) == 0)
+ else if (strncmp(arg, "--parent-pid", 12) == 0)
{
/* Override parent_pid with a value provided by user */
const char* start;
diff --git a/mysql-test/lib/My/Tee.pm b/mysql-test/lib/My/Tee.pm
index 5985fe33739..8d6b4ddd52f 100644
--- a/mysql-test/lib/My/Tee.pm
+++ b/mysql-test/lib/My/Tee.pm
@@ -10,7 +10,7 @@ sub PUSHED
open($copyfh, '>', "$::opt_vardir/log/stdout.log")
or die "open(>$::opt_vardir/log/stdout.log): $!"
unless $copyfh;
- bless { }, shift;
+ bless { }, shift;
}
sub WRITE
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 3701ad79b15..a58fb369a13 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -20,7 +20,9 @@
# same name.
package mtr_report;
+
use strict;
+use Sys::Hostname;
use base qw(Exporter);
our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
@@ -35,8 +37,20 @@ use My::Platform;
use POSIX qw[ _exit ];
use IO::Handle qw[ flush ];
use mtr_results;
-
use Term::ANSIColor;
+use English;
+
+my $tot_real_time= 0;
+my $tests_done= 0;
+my $tests_failed= 0;
+
+our $timestamp= 0;
+our $timediff= 0;
+our $name;
+our $verbose;
+our $verbose_restart= 0;
+our $timer= 1;
+our $tests_total;
my %color_map = qw/pass green
retry-pass green
@@ -45,20 +59,39 @@ my %color_map = qw/pass green
disabled bright_black
skipped yellow
reset reset/;
-sub xterm_color {
- if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
- syswrite STDOUT, color($color_map{$_[0]});
+
+my $set_titlebar;
+my $set_color= sub { };
+
+if (-t STDOUT) {
+ if (IS_WINDOWS) {
+ eval {
+ require Win32::Console;
+ $set_titlebar = sub { &Win32::Console::Title($_[0]);};
+ }
+ } elsif ($ENV{TERM} =~ /xterm/) {
+ $set_titlebar = sub { syswrite STDOUT, "\e]0;$_[0]\a"; };
+ $set_color = sub { syswrite STDOUT, color($color_map{$_[0]}); }
}
}
-my $tot_real_time= 0;
+sub titlebar_stat($) {
-our $timestamp= 0;
-our $timediff= 0;
-our $name;
-our $verbose;
-our $verbose_restart= 0;
-our $timer= 1;
+ sub time_format($) {
+ sprintf '%d:%02d:%02d', $_[0]/3600, ($_[0]/60)%60, $_[0]%60;
+ }
+
+ $tests_done++;
+ $tests_failed++ if $_[0] =~ /fail/;
+ $tests_total++ if $_[0] =~ /retry/;
+
+ my $spent = time - $BASETIME;
+ my $left = $tests_total - $tests_done;
+
+ &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left, %d failed",
+ time_format($spent), $tests_done,
+ time_format($spent/$tests_done * $left), $left, $tests_failed);
+}
sub report_option {
my ($opt, $value)= @_;
@@ -253,6 +286,7 @@ sub mtr_report_stats ($$$$) {
# Find out how we where doing
# ----------------------------------------------------------------------
+ my $tot_disabled = 0;
my $tot_skipped= 0;
my $tot_skipdetect= 0;
my $tot_passed= 0;
@@ -273,6 +307,7 @@ sub mtr_report_stats ($$$$) {
{
# Test was skipped (disabled not counted)
$tot_skipped++ unless $tinfo->{'disable'};
+ $tot_disabled++ if $tinfo->{'disable'};
$tot_skipdetect++ if $tinfo->{'skip_detected_by_test'};
}
elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
@@ -317,8 +352,6 @@ sub mtr_report_stats ($$$$) {
if ( $timer )
{
- use English;
-
mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
time - $BASETIME, "seconds executing testcases");
}
@@ -402,6 +435,106 @@ sub mtr_report_stats ($$$$) {
print "All $tot_tests tests were successful.\n\n";
}
+ if ($::opt_xml_report) {
+ my $xml_report = "";
+ my @sorted_tests = sort {$a->{'name'} cmp $b->{'name'}} @$tests;
+ my $last_suite = "";
+ my $current_suite = "";
+ my $timest = isotime(time);
+ my %suite_totals;
+ my %suite_time;
+ my %suite_tests;
+ my %suite_failed;
+ my %suite_disabled;
+ my %suite_skipped;
+ my $host = hostname;
+ my $suiteNo = 0;
+
+ # loop through test results to count totals
+ foreach my $test ( @sorted_tests ) {
+ $current_suite = $test->{'suite'}->{'name'};
+
+ if ($test->{'timer'} eq "") {
+ $test->{'timer'} = 0;
+ }
+
+ $suite_time{$current_suite} = $suite_time{$current_suite} + $test->{'timer'};
+ $suite_tests{$current_suite} = $suite_tests{$current_suite} + 1;
+
+ if ($test->{'result'} eq "MTR_RES_FAILED") {
+ $suite_failed{$current_suite} = $suite_failed{$current_suite} + 1;
+ } elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) {
+ $suite_disabled{$current_suite} = $suite_disabled{$current_suite} + 1;
+ } elsif ($test->{'result'} eq "MTR_RES_SKIPPED") {
+ $suite_skipped{$current_suite} = $suite_skipped{$current_suite} + 1;
+ }
+
+ $suite_totals{"all_time"} = $suite_totals{"all_time"} + $test->{'timer'};
+ }
+
+ my $all_time = sprintf("%.3f", $suite_totals{"all_time"} / 1000);
+ my $suite_time = 0;
+ my $test_time = 0;
+
+ # generate xml
+ $xml_report = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ $xml_report .= qq(<testsuites disabled="$tot_disabled" errors="" failures="$tot_failed" name="" tests="$tot_tests" time="$all_time">\n);
+
+ foreach my $test ( @sorted_tests ) {
+ $current_suite = $test->{'suite'}->{'name'};
+
+ if ($current_suite ne $last_suite) {
+ if ($last_suite ne "") {
+ $xml_report .= "\t</testsuite>\n";
+ $suiteNo++;
+ }
+
+ $suite_time = sprintf("%.3f", $suite_time{$current_suite} / 1000);
+ $xml_report .= qq(\t<testsuite disabled="$suite_disabled{$current_suite}" errors="" failures="$suite_failed{$current_suite}" hostname="$host" id="$suiteNo" name="$current_suite" package="" skipped="$suite_skipped{$current_suite}" tests="$suite_tests{$current_suite}" time="$suite_time" timestamp="$timest">\n);
+ $last_suite = $current_suite;
+ }
+
+ $test_time = sprintf("%.3f", $test->{timer} / 1000);
+ $test->{'name'} =~ s/$current_suite\.//;
+
+ my $test_result;
+
+ # if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
+ if ($test->{'retries'} > 0) {
+ $test_result = "MTR_RES_FAILED";
+ } else {
+ $test_result = $test->{'result'};
+ }
+
+ $xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" status="$test_result" time="$test_time");
+
+ my $comment = $test->{'comment'};
+ $comment =~ s/[\"]//g;
+
+ # if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
+ if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) {
+ my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
+
+ $xml_report .= qq(>\n\t\t\t<failure message="" type="MTR_RES_FAILED">\n<![CDATA[$logcontents]]>\n\t\t\t</failure>\n\t\t</testcase>\n);
+ } elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) {
+ $xml_report .= qq(>\n\t\t\t<disabled message="$comment" type="MTR_RES_SKIPPED"/>\n\t\t</testcase>\n);
+ } elsif ($test->{'result'} eq "MTR_RES_SKIPPED") {
+ $xml_report .= qq(>\n\t\t\t<skipped message="$comment" type="MTR_RES_SKIPPED"/>\n\t\t</testcase>\n);
+ } else {
+ $xml_report .= " />\n";
+ }
+ }
+
+ $xml_report .= "\t</testsuite>\n</testsuites>\n";
+
+ # save to file
+ my $xml_file = $::opt_xml_report;
+
+ open XML_FILE, ">", $xml_file or die "Cannot create file $xml_file: $!";
+ print XML_FILE $xml_report;
+ close XML_FILE;
+ }
+
if (@$extra_warnings)
{
print <<MSG;
@@ -516,10 +649,11 @@ sub mtr_report (@) {
my @s = split /\[ (\S+) \]/, _name() . "@_\n";
if (@s > 1) {
print $s[0];
- xterm_color($s[1]);
+ &$set_color($s[1]);
print "[ $s[1] ]";
- xterm_color('reset');
+ &$set_color('reset');
print $s[2];
+ titlebar_stat($s[1]) if $set_titlebar;
} else {
print $s[0];
}
@@ -545,6 +679,8 @@ sub mtr_error (@) {
}
else
{
+ use Carp qw(cluck);
+ cluck "Error happened" if $verbose > 0;
exit(1);
}
}
diff --git a/mysql-test/lib/process-purecov-annotations.pl b/mysql-test/lib/process-purecov-annotations.pl
index d533bd02fd6..4381aae4c64 100755
--- a/mysql-test/lib/process-purecov-annotations.pl
+++ b/mysql-test/lib/process-purecov-annotations.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# This script processes a .gcov coverage report to honor purecov
diff --git a/mysql-test/lib/t/SafeProcessStress.pl b/mysql-test/lib/t/SafeProcessStress.pl
index f591e9665dd..352b956d803 100755
--- a/mysql-test/lib/t/SafeProcessStress.pl
+++ b/mysql-test/lib/t/SafeProcessStress.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007, 2008 MySQL AB
diff --git a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t
index 15a41081b24..76a3d644751 100644
--- a/mysql-test/lib/t/copytree.t
+++ b/mysql-test/lib/t/copytree.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/dummyd.pl b/mysql-test/lib/t/dummyd.pl
index 15164428b95..e78648cfacf 100644
--- a/mysql-test/lib/t/dummyd.pl
+++ b/mysql-test/lib/t/dummyd.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t
index 40c9e96eabd..033bc59ad21 100644
--- a/mysql-test/lib/t/rmtree.t
+++ b/mysql-test/lib/t/rmtree.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
index cd0a3a41b7a..99647c14ba1 100755
--- a/mysql-test/lib/t/testMyConfig.t
+++ b/mysql-test/lib/t/testMyConfig.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t
index f38f660e85a..5ba63b3d823 100755
--- a/mysql-test/lib/t/testMyConfigFactory.t
+++ b/mysql-test/lib/t/testMyConfigFactory.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
diff --git a/mysql-test/lib/t/test_child.pl b/mysql-test/lib/t/test_child.pl
index efbec4a9620..8a23c3d7541 100755
--- a/mysql-test/lib/t/test_child.pl
+++ b/mysql-test/lib/t/test_child.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index af95ecbaa58..6fe5f66fbfc 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
diff --git a/mysql-test/mtr.out-of-source b/mysql-test/mtr.out-of-source
index 51713517ae1..30e2e65c569 100644
--- a/mysql-test/mtr.out-of-source
+++ b/mysql-test/mtr.out-of-source
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Call mtr in out-of-source build
$ENV{MTR_BINDIR} = '@CMAKE_BINARY_DIR@';
chdir('@CMAKE_SOURCE_DIR@/mysql-test');
diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl
index ef7d97453a3..3ccf965024d 100755
--- a/mysql-test/mysql-stress-test.pl
+++ b/mysql-test/mysql-stress-test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index e1561d6794a..900ef736a45 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1,8 +1,8 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
-# Copyright (c) 2009, 2018, MariaDB Corporation
+# Copyright (c) 2009, 2020, 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
@@ -128,6 +128,8 @@ our $path_testlog;
our $default_vardir;
our $opt_vardir; # Path to use for var/ dir
our $plugindir;
+our $opt_xml_report; # XML output
+
my $path_vardir_trace; # unix formatted opt_vardir for trace files
my $opt_tmpdir; # Path to use for tmp/ dir
my $opt_tmpdir_pid;
@@ -198,6 +200,7 @@ my @DEFAULT_SUITES= qw(
plugins-
roles-
rpl-
+ stress-
sys_vars-
unit-
vcol-
@@ -258,8 +261,12 @@ our %gprof_dirs;
our $glob_debugger= 0;
our $opt_gdb;
+my $opt_rr;
+my $opt_rr_dir;
+my @rr_record_args;
our $opt_client_gdb;
my $opt_boot_gdb;
+my $opt_boot_rr;
our $opt_dbx;
our $opt_client_dbx;
my $opt_boot_dbx;
@@ -321,7 +328,8 @@ my $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0;
my @valgrind_args;
my $opt_strace= 0;
-my $opt_strace_client;
+my $opt_stracer;
+my $opt_client_strace = 0;
my @strace_args;
my $opt_valgrind_path;
my $valgrind_reports= 0;
@@ -603,7 +611,7 @@ sub main {
}
#######################################################################
- my $num_tests= @$tests;
+ my $num_tests= $mtr_report::tests_total= @$tests;
if ( $opt_parallel eq "auto" ) {
# Try to find a suitable value for number of workers
if (IS_WINDOWS)
@@ -613,10 +621,7 @@ sub main {
else
{
my $sys_info= My::SysInfo->new();
- $opt_parallel= $sys_info->num_cpus();
- for my $limit (2000, 1500, 1000, 500){
- $opt_parallel-- if ($sys_info->min_bogomips() < $limit);
- }
+ $opt_parallel= $sys_info->num_cpus()+int($sys_info->min_bogomips()/500)-4;
}
my $max_par= $ENV{MTR_MAX_PARALLEL} || 8;
$opt_parallel= $max_par if ($opt_parallel > $max_par);
@@ -713,6 +718,7 @@ sub main {
# Create minimalistic "test" for the reporting
my $tinfo = My::Test->new
(
+ suite => { name => 'valgrind', },
name => 'valgrind_report',
);
# Set dummy worker id to align report with normal tests
@@ -732,7 +738,6 @@ sub main {
mtr_print_line();
print_total_times($opt_parallel) if $opt_report_times;
-
mtr_report_stats($prefix, $fail, $completed, $extra_warnings);
if ($opt_gcov) {
@@ -843,8 +848,7 @@ sub run_test_server ($$$) {
My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel);
# Limit number of core files saved
- if ($opt_max_save_core > 0 &&
- $num_saved_cores >= $opt_max_save_core)
+ if ($num_saved_cores >= $opt_max_save_core)
{
mtr_report(" - deleting it, already saved",
"$opt_max_save_core");
@@ -860,8 +864,7 @@ sub run_test_server ($$$) {
},
$worker_savedir);
- if ($opt_max_save_datadir > 0 &&
- $num_saved_datadir >= $opt_max_save_datadir)
+ if ($num_saved_datadir >= $opt_max_save_datadir)
{
mtr_report(" - skipping '$worker_savedir/'");
rmtree($worker_savedir);
@@ -870,9 +873,9 @@ sub run_test_server ($$$) {
{
mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
rename($worker_savedir, $savedir);
+ $num_saved_datadir++;
}
resfile_print_test();
- $num_saved_datadir++;
$num_failed_test++ unless ($result->{retries} ||
$result->{exp_fail});
@@ -916,7 +919,14 @@ sub run_test_server ($$$) {
if ( $result->is_failed() ) {
my $worker_logdir= $result->{savedir};
my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
- rename $log_file_name,$log_file_name.".failed";
+
+ if (-e $log_file_name) {
+ $result->{'logfile-failed'} = mtr_lastlinesfromfile($log_file_name, 20);
+ } else {
+ $result->{'logfile-failed'} = "";
+ }
+
+ rename $log_file_name, $log_file_name.".failed";
}
delete($result->{result});
$result->{retries}= $retries+1;
@@ -1040,8 +1050,6 @@ sub run_test_server ($$$) {
delete $next->{reserved};
}
- xterm_stat(scalar(@$tests));
-
if ($next) {
# We don't need this any more
delete $next->{criteria};
@@ -1235,6 +1243,7 @@ sub print_global_resfile {
resfile_global("warnings", $opt_warnings ? 1 : 0);
resfile_global("max-connections", $opt_max_connections);
resfile_global("product", "MySQL");
+ resfile_global("xml-report", $opt_xml_report);
# Somewhat hacky code to convert numeric version back to dot notation
my $v1= int($mysql_version_id / 10000);
my $v2= int(($mysql_version_id % 10000)/100);
@@ -1309,10 +1318,14 @@ sub command_line_setup {
'debug-common' => \$opt_debug_common,
'debug-server' => \$opt_debug_server,
'gdb=s' => \$opt_gdb,
+ 'rr' => \$opt_rr,
+ 'rr-arg=s' => \@rr_record_args,
+ 'rr-dir=s' => \$opt_rr_dir,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
'manual-lldb' => \$opt_manual_lldb,
'boot-gdb' => \$opt_boot_gdb,
+ 'boot-rr' => \$opt_boot_rr,
'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd,
@@ -1324,9 +1337,10 @@ sub command_line_setup {
'debugger=s' => \$opt_debugger,
'boot-dbx' => \$opt_boot_dbx,
'client-debugger=s' => \$opt_client_debugger,
- 'strace' => \$opt_strace,
- 'strace-client' => \$opt_strace_client,
- 'strace-option=s' => \@strace_args,
+ 'strace' => \$opt_strace,
+ 'strace-option=s' => \@strace_args,
+ 'client-strace' => \$opt_client_strace,
+ 'stracer=s' => \$opt_stracer,
'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
'max-test-fail=i' => \$opt_max_test_fail,
@@ -1399,7 +1413,8 @@ sub command_line_setup {
'help|h' => \$opt_usage,
# list-options is internal, not listed in help
'list-options' => \$opt_list_options,
- 'skip-test-list=s' => \@opt_skip_test_list
+ 'skip-test-list=s' => \@opt_skip_test_list,
+ 'xml-report=s' => \$opt_xml_report
);
# fix options (that take an optional argument and *only* after = sign
@@ -1416,6 +1431,17 @@ sub command_line_setup {
report_option('verbose', $opt_verbose);
}
+ # Negative values aren't meaningful on integer options
+ foreach(grep(/=i$/, keys %options))
+ {
+ if (defined ${$options{$_}} &&
+ do { no warnings "numeric"; int ${$options{$_}} < 0})
+ {
+ my $v= (split /=/)[0];
+ die("$v doesn't accept a negative value:");
+ }
+ }
+
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ($glob_mysql_test_dir =~ / /)
@@ -1773,8 +1799,8 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Check debug related options
# --------------------------------------------------------------------------
- if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
- $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
+ if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || $opt_rr ||
+ $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
$opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger )
{
@@ -1794,6 +1820,16 @@ sub command_line_setup {
$opt_shutdown_timeout= 24 * 60;
# One day for PID file creation (this is given in seconds not minutes)
$opt_start_timeout= 24 * 60 * 60;
+ if ($opt_rr && open(my $fh, '<', '/proc/sys/kernel/perf_event_paranoid'))
+ {
+ my $perf_event_paranoid= <$fh>;
+ close $fh;
+ chomp $perf_event_paranoid;
+ if ($perf_event_paranoid == 0)
+ {
+ mtr_error("rr requires kernel.perf_event_paranoid set to 1");
+ }
+ }
}
# --------------------------------------------------------------------------
@@ -1921,7 +1957,7 @@ sub command_line_setup {
join(" ", @valgrind_args), "\"");
}
- if (@strace_args)
+ if (@strace_args || $opt_stracer)
{
$opt_strace=1;
}
@@ -3055,15 +3091,43 @@ 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'),
+ if (!sleep_until_file_created($mysqld->value('pid-file'),
$opt_start_timeout,
$mysqld->{'proc'},
- $warn_seconds);
+ $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 {
@@ -3329,7 +3393,8 @@ sub mysql_install_db {
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
- $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
+ $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args)
+ unless defined $ENV{'MYSQLD_BOOTSTRAP_CMD'};
# Extra options can come not only from the command line, but also
# from option files or combinations. We want them on a command line
@@ -3360,6 +3425,13 @@ sub mysql_install_db {
ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
+ if ($opt_boot_rr) {
+ $args= ["record", @rr_record_args, $exe_mysqld_bootstrap, @$args];
+ $exe_mysqld_bootstrap= "rr";
+ my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr.boot";
+ $ENV{'_RR_TRACE_DIR'}= $rr_dir;
+ mkpath($rr_dir);
+ }
my $path_sql= my_find_file($install_basedir,
["mysql", "sql/share", "share/mariadb",
@@ -3551,8 +3623,11 @@ sub do_before_run_mysqltest($)
# to be able to distinguish them from manually created
# version-controlled results, and to ignore them in git.
my $dest = "$base_file$suites.result~";
- my @cmd = ($exe_patch, qw/--binary -r - -f -s -o/,
- $dest, $base_result, $resfile);
+ my @cmd = ($exe_patch);
+ if ($^O eq "MSWin32") {
+ push @cmd, '--binary';
+ }
+ push @cmd, (qw/-r - -f -s -o/, $dest, $base_result, $resfile);
if (-w $resdir) {
# don't rebuild a file if it's up to date
unless (-e $dest and -M $dest < -M $resfile
@@ -4591,6 +4666,8 @@ sub extract_warning_lines ($$) {
qr/missing DBUG_RETURN/,
qr/Attempting backtrace/,
qr/Assertion .* failed/,
+ qr/Sanitizer/,
+ qr/runtime error:/,
);
# These are taken from the include/mtr_warnings.sql global suppression
# list. They occur delayed, so they can be parsed during shutdown rather
@@ -4685,8 +4762,8 @@ sub extract_warning_lines ($$) {
qr/InnoDB: See also */,
qr/InnoDB: Cannot open .*ib_buffer_pool.* for reading: No such file or directory*/,
qr/InnoDB: Table .*mysql.*innodb_table_stats.* not found./,
- qr/InnoDB: User stopword table .* does not exist./
-
+ qr/InnoDB: User stopword table .* does not exist./,
+ qr/Detected table cache mutex contention at instance .* waits. Additional table cache instance cannot be activated: consider raising table_open_cache_instances. Number of active instances/
);
my $matched_lines= [];
@@ -5325,6 +5402,14 @@ sub mysqld_start ($$) {
# Indicate the exe should not be started
$exe= undef;
}
+ elsif ( $opt_rr )
+ {
+ $args= ["record", @rr_record_args, "$exe", @$args];
+ $exe= "rr";
+ my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr". $mysqld->after('mysqld');
+ $ENV{'_RR_TRACE_DIR'}= $rr_dir;
+ mkpath($rr_dir);
+ }
else
{
# Default to not wait until pid file has been created
@@ -5482,12 +5567,12 @@ sub server_need_restart {
exists $server->{'restart_opts'})
{
my $use_dynamic_option_switch= 0;
- delete $server->{'restart_opts'};
+ my $restart_opts = delete $server->{'restart_opts'} || [];
if (!$use_dynamic_option_switch)
{
mtr_verbose_restart($server, "running with different options '" .
join(" ", @{$extra_opts}) . "' != '" .
- join(" ", @{$started_opts}) . "'" );
+ join(" ", @{$started_opts}, @{$restart_opts}) . "'" );
return 1;
}
@@ -5577,6 +5662,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
@@ -5596,7 +5793,7 @@ sub start_servers($) {
for (all_servers()) {
next unless $_->{WAIT} and started($_);
- if ($_->{WAIT}->($_)) {
+ if ($_->{WAIT}->($_, $tinfo)) {
$tinfo->{comment}= "Failed to start ".$_->name() . "\n";
return 1;
}
@@ -5705,14 +5902,6 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "--non-blocking-api");
}
- if ( $opt_strace_client )
- {
- $exe= $opt_strace_client || "strace";
- mtr_add_arg($args, "-o");
- mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
- mtr_add_arg($args, "$exe_mysqltest");
- }
-
mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
if ( $opt_compress )
@@ -5778,6 +5967,17 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "%s", $_) for @args_saved;
}
+ # ----------------------------------------------------------------------
+ # Prefix the strace options to the argument list.
+ # ----------------------------------------------------------------------
+ if ( $opt_client_strace )
+ {
+ my @args_saved = @$args;
+ mtr_init_args(\$args);
+ strace_arguments($args, \$exe, "mysqltest");
+ mtr_add_arg($args, "%s", $_) for @args_saved;
+ }
+
if ($opt_force > 1)
{
mtr_add_arg($args, "--continue-on-error");
@@ -6102,16 +6302,17 @@ sub strace_arguments {
my $args= shift;
my $exe= shift;
my $mysqld_name= shift;
+ my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name);
mtr_add_arg($args, "-f");
- mtr_add_arg($args, "-o%s/var/log/%s.strace", $glob_mysql_test_dir, $mysqld_name);
+ mtr_add_arg($args, "-o%s", $output);
- # Add strace options, can be overridden by user
+ # Add strace options
mtr_add_arg($args, '%s', $_) for (@strace_args);
mtr_add_arg($args, $$exe);
- $$exe= "strace";
+ $$exe= $opt_stracer || "strace";
if ($exe_libtool)
{
@@ -6217,7 +6418,7 @@ Examples:
alias
main.alias 'main' is the name of the suite for the 't' directory.
-rpl.rpl_invoked_features,mix,xtradb_plugin
+rpl.rpl_invoked_features,mix,innodb
suite/rpl/t/rpl.rpl_invoked_features
Options to control what engine/variation to run:
@@ -6345,7 +6546,7 @@ Options for debugging the product
debug-server Use debug version of server, but without turning on
tracing
debugger=NAME Start mysqld in the selected debugger
- gdb Start the mysqld(s) in gdb
+ gdb[=gdb_arguments] Start the mysqld(s) in gdb
manual-debug Let user manually start mysqld in debugger, before
running test(s)
manual-gdb Let user manually start mysqld in gdb, before running
@@ -6358,12 +6559,12 @@ Options for debugging the product
test(s)
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
- $opt_max_save_core, set to 0 for no limit. Set
- it's default with MTR_MAX_SAVE_CORE
+ $opt_max_save_core. Set its default with
+ MTR_MAX_SAVE_CORE
max-save-datadir Limit the number of datadir saved (to avoid filling
up disks for heavily crashing server). Defaults to
- $opt_max_save_datadir, set to 0 for no limit. Set
- it's default with MTR_MAX_SAVE_DATADIR
+ $opt_max_save_datadir. Set its default with
+ MTR_MAX_SAVE_DATADIR
max-test-fail Limit the number of test failures before aborting
the current test run. Defaults to
$opt_max_test_fail, set to 0 for no limit. Set
@@ -6387,11 +6588,20 @@ Options for valgrind
Options for strace
strace Run the "mysqld" executables using strace. Default
- options are -f -o var/log/'mysqld-name'.strace
- strace-option=ARGS Option to give strace, replaces default option(s),
- strace-client=[path] Create strace output for mysqltest client, optionally
- specifying name and path to the trace program to use.
- Example: $0 --strace-client=ktrace
+ options are -f -o 'vardir'/log/'mysqld-name'.strace.
+ client-strace Trace the "mysqltest".
+ strace-option=ARGS Option to give strace, appends to existing options.
+ stracer=<EXE> Specify name and path to the trace program to use.
+ Default is "strace". Example: $0 --stracer=ktrace.
+
+Options for rr (Record and Replay)
+ rr Run the "mysqld" executables using rr. Default run
+ option is "rr record mysqld mysqld_options"
+ boot-rr Start bootstrap server in rr
+ rr-arg=ARG Option to give rr record, can be specified more then once
+ rr-dir=DIR The directory where rr recordings are stored. Defaults
+ to 'vardir'/rr.0 (rr.boot for bootstrap instance and
+ rr.1, ..., rr.N for slave instances).
Misc options
user=USER User for connecting to mysqld(default: $opt_user)
@@ -6458,6 +6668,7 @@ Misc options
phases of test execution.
stress=ARGS Run stress test, providing options to
mysql-stress-test.pl. Options are separated by comma.
+ xml-report=<file> Output jUnit xml file of the results.
Some options that control enabling a feature for normal test runs,
can be turned off by prepending 'no' to the option, e.g. --notimer.
@@ -6479,26 +6690,3 @@ sub list_options ($) {
exit(1);
}
-
-sub time_format($) {
- sprintf '%d:%02d:%02d', $_[0]/3600, ($_[0]/60)%60, $_[0]%60;
-}
-
-our $num_tests;
-
-sub xterm_stat {
- if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
- my ($left) = @_;
-
- # 2.5 -> best by test
- $num_tests = $left + 2.5 unless $num_tests;
-
- my $done = $num_tests - $left;
- my $spent = time - $^T;
-
- syswrite STDOUT, sprintf
- "\e];mtr: spent %s on %d tests. %s (%d tests) left\a",
- time_format($spent), $done,
- time_format($spent/$done * $left), $left;
- }
-}
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index b4379f49c7e..69322bb9028 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -2506,5 +2506,16 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2, t1;
#
+# MDEV-18163: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+# m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion
+# `table_list->table' failed in find_field_in_table_ref / ERROR 1901
+# (on optimized builds)
+#
+CREATE TABLE t1 (k1 varchar(10) DEFAULT 5);
+CREATE TABLE t2 (i1 int);
+ALTER TABLE t1 ALTER COLUMN k1 SET DEFAULT (SELECT 1 FROM t2 limit 1);
+ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `k1`
+DROP TABLE t1,t2;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/alter_user.result b/mysql-test/r/alter_user.result
index ac668bba8fa..b67705c4fc4 100644
--- a/mysql-test/r/alter_user.result
+++ b/mysql-test/r/alter_user.result
@@ -43,7 +43,7 @@ SET GLOBAL read_only = @start_read_only;
alter user boo;
ERROR HY000: Operation ALTER USER failed for 'boo'
#--warning ER_CANNOT_USER
-alter if exists user boo;
+alter user if exists boo;
Warnings:
Error 1133 Can't find any matching row in the user table
Note 1396 Operation ALTER USER failed for 'boo'
diff --git a/mysql-test/r/aria_icp_debug.result b/mysql-test/r/aria_icp_debug.result
new file mode 100644
index 00000000000..fc01ee4fb3b
--- /dev/null
+++ b/mysql-test/r/aria_icp_debug.result
@@ -0,0 +1,34 @@
+set default_storage_engine=aria;
+drop table if exists t0,t1,t2;
+create table t0(a int primary key);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int primary key);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (
+kp1 int,
+kp2 int,
+col char(100),
+key(kp1, kp2)
+);
+insert into t2 select a, a, a from t1;
+select engine from information_schema.tables
+where table_schema=database() and table_name='t2';
+engine
+Aria
+explain
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range kp1 kp1 5 NULL 10 Using index condition
+set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+connect con1, localhost, root,,;
+connection con1;
+set debug_sync='now WAIT_FOR at_icp_check';
+kill query $target_id;
+set debug_sync='now SIGNAL go';
+connection default;
+ERROR 70100: Query execution was interrupted
+set debug_sync='RESET';
+disconnect con1;
+drop table t0,t1,t2;
+set default_storage_engine=default;
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
index 36f5459ff85..a7281c42ca7 100644
--- a/mysql-test/r/blackhole.result
+++ b/mysql-test/r/blackhole.result
@@ -24,3 +24,9 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
0
DROP TABLE t1;
End of 5.6 tests
+CREATE TABLE `t` (
+`a` varchar(3000) NOT NULL default '',
+PRIMARY KEY (`a`)
+) ENGINE=BLACKHOLE;
+DROP TABLE `t`;
+End of 10.1 tests
diff --git a/mysql-test/r/bootstrap_innodb.result b/mysql-test/r/bootstrap_innodb.result
new file mode 100644
index 00000000000..2fc7800843b
--- /dev/null
+++ b/mysql-test/r/bootstrap_innodb.result
@@ -0,0 +1,7 @@
+create table t1(a int) engine=innodb;
+select * from t1;
+a
+1
+2
+5
+drop table t1;
diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result
index 7f215de43fb..1cda7004a6f 100644
--- a/mysql-test/r/cache_temporal_4265.result
+++ b/mysql-test/r/cache_temporal_4265.result
@@ -1,13 +1,12 @@
create table t1 (a date);
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
-set debug_dbug='d,str_to_datetime_warn';
+SET STATEMENT debug_dbug='d,str_to_datetime_warn' for
select * from t1 where a > date_add('2000-01-01', interval 5 day);
a
2001-02-03
2002-03-04
Warnings:
Note 1003 2000-01-01
-set debug_dbug='';
drop table t1;
create table t1 (id int not null, ut timestamp(6) not null);
insert into t1 values(1, '2001-01-01 00:00:00.2');
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 43f3a2ac28c..2a78401dc79 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -757,8 +757,8 @@ SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
-Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...'
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/comment_table.result b/mysql-test/r/comment_table.result
index 99ecb04a362..d0af71b4540 100644
--- a/mysql-test/r/comment_table.result
+++ b/mysql-test/r/comment_table.result
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS t1;
create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
@@ -125,3 +124,7 @@ SELECT table_comment,char_length(table_comment) FROM information_schema.tables W
table_comment char_length(table_comment)
SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
column_comment char_length(column_comment)
+set names utf8;
+create table t1 (x int comment 'a');
+ERROR HY000: Invalid utf8 character string: 'a'
+set names latin1;
diff --git a/mysql-test/r/connect_debug.result b/mysql-test/r/connect_debug.result
index 6c066c16731..cc3da50ec6b 100644
--- a/mysql-test/r/connect_debug.result
+++ b/mysql-test/r/connect_debug.result
@@ -8,3 +8,13 @@ create user 'bad' identified by 'worse';
ERROR 1045 (28000): Plugin foo/bar could not be loaded: invalid plugin name
set global debug_dbug=@old_dbug;
drop user bad;
+set global debug_dbug='+d,increase_srv_handshake_scramble_len';
+connect(localhost,root,,test,MASTER_MYPORT,MYSQL_TMP_DIR/mysqld.1.sock);
+connect con1,localhost,root;
+ERROR HY000: received malformed packet
+set global debug_dbug=@old_dbug;
+set global debug_dbug='+d,poison_srv_handshake_scramble_len';
+connect(localhost,root,,test,MASTER_MYPORT,MYSQL_TMP_DIR/mysqld.1.sock);
+connect con2,localhost,root;
+ERROR HY000: received malformed packet
+set global debug_dbug=@old_dbug;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index ab9a13143d5..3e5efbe74dd 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1092,9 +1092,9 @@ drop trigger имя_триггера_в_кодировке_утф8_длиной_
create trigger
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длин...' is too long
drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длин...' is too long
create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
begin
end;
@@ -1106,7 +1106,7 @@ drop procedure имя_процедуры_в_кодировке_утф8_длин
create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
begin
end;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длин...' is too long
create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49()
returns int
return 0;
@@ -1118,7 +1118,7 @@ drop function имя_функции_в_кодировке_утф8_длиной_
create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
returns int
return 0;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длин...' is too long
drop view имя_вью_кодировке_утф8_длиной_больше_чем_42;
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
set @@character_set_client=@save_character_set_client;
diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result
index 8e529a587fa..115e00ebe38 100644
--- a/mysql-test/r/create_drop_function.result
+++ b/mysql-test/r/create_drop_function.result
@@ -52,3 +52,20 @@ body
DROP FUNCTION IF EXISTS f1;
Warnings:
Note 1305 FUNCTION test.f1 does not exist
+#
+# 10.1 Test
+#
+# MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
+#
+SET GLOBAL log_bin_trust_function_creators=0;
+CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;
+CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;
+ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;
+ERROR 42000: Identifier name 'sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934' is too long
+DROP FUNCTION IF EXISTS f;
+Warnings:
+Note 1305 FUNCTION test.f does not exist
+SET GLOBAL log_bin_trust_function_creators=1;
+# End of 10.1 Test
diff --git a/mysql-test/r/create_or_replace2.result b/mysql-test/r/create_or_replace2.result
index 47431212492..6be0d46bdc1 100644
--- a/mysql-test/r/create_or_replace2.result
+++ b/mysql-test/r/create_or_replace2.result
@@ -4,9 +4,9 @@ drop table if exists t1;
SET @old_debug= @@session.debug;
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
-set debug_dbug='+d,send_kill_after_delete';
+SET debug_dbug='+d,send_kill_after_delete';
CREATE OR REPLACE TABLE t1 LIKE tmp;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
SHOW TABLES;
Tables_in_test
t1
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 8ad3818b453..746fcbcf051 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -1673,3 +1673,21 @@ with columns as (select 1 as t) select * from columns;
t
1
use test;
+#
+# MDEV-18460: Server crashed in strmake / tdc_create_key /
+# THD::create_tmp_table_def_key
+#
+connect con1,localhost,root,,;
+CREATE TEMPORARY TABLE test.t (a INT);
+WITH cte AS (SELECT 1) SELECT * FROM cte;
+1
+1
+WITH t AS (SELECT 1) SELECT * FROM t;
+1
+1
+WITH cte AS (SELECT 1) SELECT * FROM t;
+ERROR 3D000: No database selected
+DROP TABLE test.t;
+connection default;
+disconnect con1;
+# End of 10.2 tests
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index 667b8c4289d..640493142bd 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -691,13 +691,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00
1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00
-2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
Warnings:
Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
# simple mutual recursion
@@ -1302,12 +1302,12 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24
4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12
+5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
+NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
2 RECURSIVE UNION folks ALL PRIMARY NULL NULL NULL 12
2 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
-5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
-NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
explain FORMAT=JSON
with recursive
prev_gen
@@ -3326,13 +3326,13 @@ select * from cte1, cte2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 6 100.00
1 PRIMARY <derived5> ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join)
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
4 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
5 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
-2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
-3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
-NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1003 with recursive rcte as (select 1 AS `a` union select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)select `cte1`.`c1` AS `c1`,`cte2`.`c2` AS `c2` from `cte1` join `cte2`
prepare stmt from "with recursive
@@ -3391,6 +3391,65 @@ cte2 as
(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
select * from cte1, cte2 where cte1.c1 = 3;
c1 c2
+with recursive
+rcte(a) as
+(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),
+cte1 as
+(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3),
+cte2 as
+(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
+select * from cte2, cte1;
+c2 c1
+1 2
+explain extended with recursive
+rcte(a) as
+(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),
+cte1 as
+(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3),
+cte2 as
+(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
+select * from cte2, cte1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived5> ALL NULL NULL NULL NULL 6 100.00
+1 PRIMARY <derived4> ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join)
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+5 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+4 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 with recursive rcte as (select 1 AS `a` union select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)select `cte2`.`c2` AS `c2`,`cte1`.`c1` AS `c1` from `cte2` join `cte1`
+prepare stmt from "with recursive
+rcte(a) as
+(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),
+cte1 as
+(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3),
+cte2 as
+(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
+select * from cte2, cte1";
+execute stmt;
+c2 c1
+1 2
+execute stmt;
+c2 c1
+1 2
+drop procedure p;
+drop table t2;
+create table t2 (c1 int, c2 int);
+create procedure p() insert into t2 with recursive
+rcte(a) as
+(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),
+cte1 as
+(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3),
+cte2 as
+(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
+select * from cte2, cte1;
+call p();
+select * from t2;
+c1 c2
+1 2
drop procedure p;
drop table t1,t2;
#
@@ -3648,3 +3707,262 @@ 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;
+#
+# MDEV-22042: ANALYZE of query using stored function and recursive CTE
+#
+create table t1 (a1 varchar(20),a2 varchar(20)) engine=myisam;
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (
+a2 varchar(20) primary key, b1 varchar(20), key (b1)
+) engine=myisam;
+insert into t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+insert into t2 values (11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17);
+create function f1(id varchar(20)) returns varchar(50)
+begin
+declare res varchar (50);
+select a2 into res from t2 where a2=id and b1=1 limit 1;
+return res;
+end$$
+select fv
+from (select t1.a1, f1(t1.a2) fv from t1) dt
+where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2'
+ union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2)
+select a2 from cte);
+fv
+NULL
+explain select fv
+from (select t1.a1, f1(t1.a2) fv from t1) dt
+where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2'
+ union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2)
+select a2 from cte);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 2
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2
+4 DERIVED t2 const PRIMARY PRIMARY 22 const 1 Using index
+5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2
+5 RECURSIVE UNION tt2 ref b1 b1 23 cte.a2 2
+NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
+analyze format=json select fv
+from (select t1.a1, f1(t1.a2) fv from t1) dt
+where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2'
+ union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2)
+select a2 from cte);
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<subquery3>",
+ "access_type": "ALL",
+ "possible_keys": ["distinct_key"],
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "unique": 1,
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100,
+ "materialized": {
+ "query_block": {
+ "recursive_union": {
+ "table_name": "<union4,5>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 4,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "t2",
+ "access_type": "const",
+ "possible_keys": ["PRIMARY"],
+ "key": "PRIMARY",
+ "key_length": "22",
+ "used_key_parts": ["a2"],
+ "ref": ["const"],
+ "r_loops": 0,
+ "rows": 1,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "using_index": true
+ }
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 5,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "table": {
+ "table_name": "<derived4>",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "table": {
+ "table_name": "tt2",
+ "access_type": "ref",
+ "possible_keys": ["b1"],
+ "key": "b1",
+ "key_length": "23",
+ "used_key_parts": ["b1"],
+ "ref": ["cte.a2"],
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 1,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "block-nl-join": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ },
+ "buffer_type": "flat",
+ "buffer_size": "256Kb",
+ "join_type": "BNL",
+ "attached_condition": "t1.a1 = cte.a2",
+ "r_filtered": 33.333
+ }
+ }
+}
+drop function f1;
+drop table t1,t2;
+#
+# MDEV-22748: two materialized CTEs using the same recursive CTE
+# (see also test case for MDEV-17024)
+#
+CREATE TABLE t1 (YEAR int(4), d1 date , d2 date) ;
+INSERT INTO t1 VALUES (2018,'2018-01-01','2018-09-20');
+CREATE TABLE t2 (id int, tm date);
+INSERT INTO t2 VALUES (1,'2018-08-30'),(2,'2018-08-30'),(3,'2018-08-30');
+CREATE TABLE t3 (id int, tm date);
+INSERT INTO t3 VALUES (1,'2018-08-30'),(2,'2018-08-30');
+WITH RECURSIVE
+cte AS
+(SELECT YEAR(t1.d1) AS YEAR, t1.d1 AS st, t1.d1 + INTERVAL 1 MONTH AS fn
+FROM t1
+UNION ALL
+SELECT YEAR(cte.st + INTERVAL 1 MONTH),
+cte.st + INTERVAL 1 MONTH, t1.d2 + INTERVAL 1 DAY
+FROM cte JOIN t1
+WHERE cte.st + INTERVAL 1 MONTH < t1.d2 ),
+cte2 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn),
+cte3 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn)
+SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR);
+YEAR d1 d2
+2018 2018-01-01 2018-09-20
+EXPLAIN EXTENDED WITH RECURSIVE
+cte AS
+(SELECT YEAR(t1.d1) AS YEAR, t1.d1 AS st, t1.d1 + INTERVAL 1 MONTH AS fn
+FROM t1
+UNION ALL
+SELECT YEAR(cte.st + INTERVAL 1 MONTH),
+cte.st + INTERVAL 1 MONTH, t1.d2 + INTERVAL 1 DAY
+FROM cte JOIN t1
+WHERE cte.st + INTERVAL 1 MONTH < t1.d2 ),
+cte2 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn),
+cte3 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn)
+SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
+1 PRIMARY <derived5> ref key0 key0 9 const 0 0.00 Using where
+1 PRIMARY <derived4> ref key0 key0 9 const 0 0.00 Using where
+2 DERIVED t1 system NULL NULL NULL NULL 1 100.00
+3 RECURSIVE UNION t1 system NULL NULL NULL NULL 1 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
+4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00
+5 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 with recursive cte as (select year(`test`.`t1`.`d1`) AS `YEAR`,`test`.`t1`.`d1` AS `st`,`test`.`t1`.`d1` + interval 1 month AS `fn` from `test`.`t1` union all select year(`cte`.`st` + interval 1 month) AS `YEAR(cte.st + INTERVAL 1 MONTH)`,`cte`.`st` + interval 1 month AS `cte.st + INTERVAL 1 MONTH`,`test`.`t1`.`d2` + interval 1 day AS `t1.d2 + INTERVAL 1 DAY` from `cte` join `test`.`t1` where `cte`.`st` + interval 1 month < `test`.`t1`.`d2`), cte2 as (select `cte`.`YEAR` AS `YEAR`,count(0) AS `COUNT(*)` from `cte` join `test`.`t2` where `test`.`t2`.`tm` between `cte`.`st` and `cte`.`fn`), cte3 as (select `cte`.`YEAR` AS `YEAR`,count(0) AS `COUNT(*)` from `cte` join `test`.`t3` where `test`.`t3`.`tm` between `cte`.`st` and `cte`.`fn`)select 2018 AS `YEAR`,'2018-01-01' AS `d1`,'2018-09-20' AS `d2` from `cte2` join `cte3` where 2018 = `cte3`.`YEAR` and 2018 = `cte2`.`YEAR`
+PREPARE stmt FROM "WITH RECURSIVE
+cte AS
+(SELECT YEAR(t1.d1) AS YEAR, t1.d1 AS st, t1.d1 + INTERVAL 1 MONTH AS fn
+FROM t1
+UNION ALL
+SELECT YEAR(cte.st + INTERVAL 1 MONTH),
+cte.st + INTERVAL 1 MONTH, t1.d2 + INTERVAL 1 DAY
+FROM cte JOIN t1
+WHERE cte.st + INTERVAL 1 MONTH < t1.d2 ),
+cte2 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn),
+cte3 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn)
+SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR)";
+EXECUTE stmt;
+YEAR d1 d2
+2018 2018-01-01 2018-09-20
+EXECUTE stmt;
+YEAR d1 d2
+2018 2018-01-01 2018-09-20
+CREATE TABLE t4 (YEAR int(4), d1 date , d2 date);
+CREATE PROCEDURE p() INSERT INTO t4 WITH RECURSIVE
+cte AS
+(SELECT YEAR(t1.d1) AS YEAR, t1.d1 AS st, t1.d1 + INTERVAL 1 MONTH AS fn
+FROM t1
+UNION ALL
+SELECT YEAR(cte.st + INTERVAL 1 MONTH),
+cte.st + INTERVAL 1 MONTH, t1.d2 + INTERVAL 1 DAY
+FROM cte JOIN t1
+WHERE cte.st + INTERVAL 1 MONTH < t1.d2 ),
+cte2 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn),
+cte3 AS (SELECT YEAR, COUNT(*)
+FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn)
+SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR);
+CALL p();
+SELECT * FROM t4;
+YEAR d1 d2
+2018 2018-01-01 2018-09-20
+DROP PROCEDURE p;
+DROP TABLE t1,t2,t3,t4;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index af1d0c0e155..e71e600b81f 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -3172,5 +3172,147 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and weight_string(`test`.`t1`.`a`,0,0,1) = 'a'
DROP TABLE t1;
#
+# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+#
+CREATE TABLE t1(a ENUM(0x6100,0x6200,0x6300) CHARACTER SET 'Binary');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a\0','b\0','c\0') CHARACTER SET binary DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+6100
+6200
+6300
+DROP TABLE t1;
+0x00 in the middle or in the end of a value
+CREATE TABLE t1 (a ENUM(0x6100));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a\0') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1);
+SELECT HEX(a) FROM t1;
+HEX(a)
+6100
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM(0x610062));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a\0b') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1);
+SELECT HEX(a) FROM t1;
+HEX(a)
+610062
+DROP TABLE t1;
+0x00 in the beginning of the first value:
+CREATE TABLE t1 (a ENUM(0x0061));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('\0a') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(1);
+SELECT HEX(a) FROM t1;
+HEX(a)
+0061
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM(0x0061), b ENUM('b'));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('\0a') DEFAULT NULL,
+ `b` enum('b') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1,1);
+SELECT HEX(a), HEX(b) FROM t1;
+HEX(a) HEX(b)
+0061 62
+DROP TABLE t1;
+# 0x00 in the beginning of the second (and following) value of the *last* ENUM/SET in the table:
+CREATE TABLE t1 (a ENUM('a',0x0061));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a','\0a') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1),(2);
+SELECT HEX(a) FROM t1 ORDER BY a;
+HEX(a)
+61
+0061
+DROP TABLE t1;
+CREATE TABLE t1 (a ENUM('a'), b ENUM('b',0x0061));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('a') DEFAULT NULL,
+ `b` enum('b','\0a') DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (1,2);
+SELECT HEX(a), HEX(b) FROM t1 ORDER BY a, b;
+HEX(a) HEX(b)
+61 62
+61 0061
+DROP TABLE t1;
+0x00 in the beginning of a value of a non-last ENUM/SET causes an error:
+CREATE TABLE t1 (a ENUM('a',0x0061), b ENUM('b'));
+ERROR HY000: Incorrect information in file: 'DIR/t1.frm'
+#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+# 10.2 tests
+#
+SET NAMES latin1;
+CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary', d JSON);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a') CHARACTER SET binary DEFAULT NULL,
+ `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+HEX(c)
+0061
+DROP TABLE t1;
+CREATE TABLE t1(
+c ENUM(0x0061) CHARACTER SET 'Binary',
+d INT DEFAULT NULL CHECK (d>0)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a') CHARACTER SET binary DEFAULT NULL,
+ `d` int(11) DEFAULT NULL CHECK (`d` > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1,1);
+SELECT HEX(c), d FROM t1;
+HEX(c) d
+0061 1
+DROP TABLE t1;
+CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary' CHECK (c>0));
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a') CHARACTER SET binary DEFAULT NULL CHECK (`c` > 0)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1);
+SELECT HEX(c) FROM t1;
+HEX(c)
+0061
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result
index 53cb858035b..fac6c937608 100644
--- a/mysql-test/r/ctype_upgrade.result
+++ b/mysql-test/r/ctype_upgrade.result
@@ -8,7 +8,7 @@ CHECK TABLE maria050313_utf8_croatian_ci FOR UPGRADE;
Table Op Msg_type Msg_text
test.maria050313_utf8_croatian_ci check error Upgrade required. Please do "REPAIR TABLE `maria050313_utf8_croatian_ci`" or dump/reload to fix it!
SHOW CREATE TABLE maria050313_utf8_croatian_ci;
-ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_utf8_croatian_c` FORCE" or dump/reload to fix it!
+ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_utf8_croatia...` FORCE" or dump/reload to fix it!
REPAIR TABLE maria050313_utf8_croatian_ci;
Table Op Msg_type Msg_text
test.maria050313_utf8_croatian_ci repair status OK
@@ -45,7 +45,7 @@ CHECK TABLE maria050313_ucs2_croatian_ci_def FOR UPGRADE;
Table Op Msg_type Msg_text
test.maria050313_ucs2_croatian_ci_def check error Upgrade required. Please do "REPAIR TABLE `maria050313_ucs2_croatian_ci_def`" or dump/reload to fix it!
SELECT count(*) FROM maria050313_ucs2_croatian_ci_def;
-ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_ucs2_croatian_c` FORCE" or dump/reload to fix it!
+ERROR HY000: Table rebuild required. Please do "ALTER TABLE `test.maria050313_ucs2_croatia...` FORCE" or dump/reload to fix it!
REPAIR TABLE maria050313_ucs2_croatian_ci_def;
Table Op Msg_type Msg_text
test.maria050313_ucs2_croatian_ci_def repair status OK
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index 371ccc01a22..491e01b7361 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -1491,7 +1491,7 @@ ab
ab
AE
AE
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
s1
ab
diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result
index de7852f9a41..fdfc22a94e0 100644
--- a/mysql-test/r/ctype_utf16_uca.result
+++ b/mysql-test/r/ctype_utf16_uca.result
@@ -7899,5 +7899,46 @@ a b
DROP TABLE t1;
SET NAMES utf8;
#
+# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+# 10.2 tests
+#
+SET NAMES utf8, COLLATION_CONNECTION=utf16_hungarian_ci;
+CREATE TABLE t1(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
+ `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+HEX(c)
+00610061006100610061006100610061
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaa') CHARACTER SET 'Binary',d JSON);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
+ `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+HEX(c)
+006100610061006100610061006100610061
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
+ `d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+HEX(c)
+0061006100610061006100610061006100610061
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index a9e5cd5a417..d98c113840b 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -1764,7 +1764,7 @@ ab
ab
AE
AE
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
s1
ab
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 7bab78a10bf..8f40a90859b 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1504,7 +1504,7 @@ ab
ab
AE
AE
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
s1
ab
@@ -2868,5 +2868,25 @@ DROP TABLE t1;
#
SET STORAGE_ENGINE=Default;
#
+# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+# 10.2 tests
+#
+SET NAMES utf8, COLLATION_CONNECTION=utf32_bin;
+CREATE TABLE t1(c1 ENUM('a','b','ac') CHARACTER SET 'Binary',c2 JSON,c3 INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` enum('\0\0\0a','\0\0\0b','\0\0\0a\0\0\0c') CHARACTER SET binary DEFAULT NULL,
+ `c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
+ `c3` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 (c1) VALUES (1),(2),(3);
+SELECT HEX(c1) FROM t1 ORDER BY c1;
+HEX(c1)
+00000061
+00000062
+0000006100000063
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 5ffed278f83..d7f13b4053f 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -6754,10 +6754,10 @@ DFFFDFFF9CFF9DFF9EFF
#
# Checking strnxfrm() with odd length
#
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
@@max_sort_length
-5
+9
create table t1 (a varchar(128) character set utf8 collate utf8_general_ci);
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
@@ -10532,6 +10532,18 @@ SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
CONVERT(1, CHAR) IN ('100', '10', '1')
1
#
+# MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
+#
+SET NAMES utf8;
+CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('2019-03-10 02:55:05');
+CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM;
+INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
+SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
+a
+2019-03-10 02:55:05
+DROP TABLE t1, t2;
+#
# End of 10.1 tests
#
#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index b0777a0b9f0..691ac51e241 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -2371,10 +2371,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
@@max_sort_length
-5
+9
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci);
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result
index 127b72674ac..4aef2d8cb66 100644
--- a/mysql-test/r/ctype_utf8mb4_heap.result
+++ b/mysql-test/r/ctype_utf8mb4_heap.result
@@ -2203,10 +2203,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
@@max_sort_length
-5
+9
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine heap;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result
index bce039d436f..7c95906a742 100644
--- a/mysql-test/r/ctype_utf8mb4_innodb.result
+++ b/mysql-test/r/ctype_utf8mb4_innodb.result
@@ -2331,10 +2331,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
@@max_sort_length
-5
+9
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine InnoDB;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result
index b834448b2fd..f06a1fc53f3 100644
--- a/mysql-test/r/ctype_utf8mb4_myisam.result
+++ b/mysql-test/r/ctype_utf8mb4_myisam.result
@@ -2331,10 +2331,10 @@ drop table t1;
#
# Check strnxfrm() with odd length
#
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
@@max_sort_length
-5
+9
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine MyISAM;
insert into t1 values ('a'),('b'),('c');
select * from t1 order by a;
diff --git a/mysql-test/r/default_session.result b/mysql-test/r/default_session.result
index 6c0bcad0cb3..1b0c5f3f67a 100644
--- a/mysql-test/r/default_session.result
+++ b/mysql-test/r/default_session.result
@@ -92,3 +92,31 @@ a
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
drop table t1;
+set time_zone='+00:00';
+create table t1 (a int, b datetime default from_unixtime(a), c datetime);
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+set time_zone='+01:00';
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+flush tables;
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+select * from t1;
+a b c
+1569495327 2019-09-26 10:55:27 2019-09-26 10:55:27
+1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27
+1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27
+drop table t1;
+set time_zone = "+00:00";
+create table t1 (a int, b timestamp as (from_unixtime(a)) virtual);
+insert into t1 (a) value (1569495327);
+select a, b, from_unixtime(a) from t1;
+a b from_unixtime(a)
+1569495327 2019-09-26 10:55:27 2019-09-26 10:55:27
+set time_zone = "+01:00";
+select a, b, from_unixtime(a) from t1;
+a b from_unixtime(a)
+1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27
+flush tables;
+select a, b, from_unixtime(a) from t1;
+a b from_unixtime(a)
+1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27
+drop table t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index da580158181..2106ba504a9 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -217,7 +217,7 @@ a
2
drop table t1;
select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
-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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' 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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mx...' at line 1
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index ac16dac73de..d4e8feff740 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -10052,11 +10052,11 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1",
+ "attached_condition": "case when tab2.max_a = 1 or tab2.max_a = 2 then 1 else 0 end = 1",
"materialized": {
"query_block": {
"select_id": 3,
- "having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1",
+ "having_condition": "case when max_a = 1 or max_a = 2 then 1 else 0 end = 1",
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
@@ -10101,11 +10101,11 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1",
+ "attached_condition": "case when tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4 then 1 else 0 end = 1",
"materialized": {
"query_block": {
"select_id": 3,
- "having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1",
+ "having_condition": "case when max_a = 1 or max_a > 2 and max_a < 4 then 1 else 0 end = 1",
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
@@ -10150,11 +10150,11 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1",
+ "attached_condition": "case when tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2) then 1 else 0 end = 1",
"materialized": {
"query_block": {
"select_id": 3,
- "having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1",
+ "having_condition": "case when max_a > 1 and (max_a = 2 or max_a > 2) then 1 else 0 end = 1",
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
@@ -10199,7 +10199,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1",
+ "attached_condition": "case when tab2.b = 2 or tab2.b = 4 then 1 else 0 end = 1",
"materialized": {
"query_block": {
"select_id": 3,
@@ -10211,7 +10211,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1"
+ "attached_condition": "case when t1.b = 2 or t1.b = 4 then 1 else 0 end = 1"
}
}
}
@@ -10551,4 +10551,46 @@ EXPLAIN
}
DROP TABLE t1;
DROP VIEW v1;
+#
+# MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+#
+CREATE TABLE t1 (a INT, b DATE, c INT);
+INSERT INTO t1 VALUES
+(1,'2001-01-21',345),
+(6,'2001-01-20',315),
+(6,'2001-01-20',214);
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (2,19), (7,20);
+CREATE VIEW v1 AS SELECT a, b, max(c) AS max_c FROM t1
+GROUP BY a,b HAVING max_c < 707;
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a);
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+6 2001-01-20 315 7 20 Saturday
+SET optimizer_switch='condition_pushdown_for_derived=off';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+SET optimizer_switch='condition_pushdown_for_derived=on';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+DROP VIEW v1;
+DROP TABLE t1, t2;
+SET optimizer_switch=DEFAULT;
+#
+# MDEV-17177: an attempt to push down IN predicate when one of
+# the arguments is too complex to be cloned
+#
+CREATE TABLE t1 (a VARCHAR(8));
+INSERT INTO t1 VALUES ('abc'),('def');
+CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a;
+SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar');
+a
+abc
+DROP VIEW v1;
+DROP TABLE t1;
# End of 10.2 tests
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 1a06380e66f..13179682465 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -31,13 +31,13 @@ table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28;
-ERROR 42S02: Unknown table 'mysqltest.table1,mysqltest.table2,mysqltest.table3,mysqltest.table4,mysqltest.table5,mysqltest.table'
+ERROR 42S02: Unknown table 'mysqltest.table1,mysqltest.table2,mysqltest.table3,mysqltest.table4,mysqltest.table5,mysqltest.ta...'
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28, table29, table30;
-ERROR 42S02: Unknown table 'mysqltest.table1,mysqltest.table2,mysqltest.table3,mysqltest.table4,mysqltest.table5,mysqltest.table'
+ERROR 42S02: Unknown table 'mysqltest.table1,mysqltest.table2,mysqltest.table3,mysqltest.table4,mysqltest.table5,mysqltest.ta...'
use test;
drop database mysqltest;
flush tables with read lock;
diff --git a/mysql-test/r/drop_bad_db_type.result b/mysql-test/r/drop_bad_db_type.result
index 1b691957877..ae6fe708e60 100644
--- a/mysql-test/r/drop_bad_db_type.result
+++ b/mysql-test/r/drop_bad_db_type.result
@@ -1,5 +1,5 @@
-SET @save_dbug = @@debug_dbug;
-set debug_dbug='+d,unstable_db_type';
+SET @saved_dbug = @@debug_dbug;
+SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
insert t1 values (1),(2),(3);
@@ -33,4 +33,4 @@ t1.frm
drop table t1;
db.opt
uninstall soname 'ha_archive';
-set debug_dbug=@save_dbug;
+SET debug_dbug=@saved_dbug;
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index 9e6c5a7747a..16040ab6791 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -1261,7 +1261,7 @@ select id from t1 where column_get(str,4 as char(100)) = repeat("a", 100);
id
5
Warnings:
-Warning 1292 Truncated incorrect CHAR(100) value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+Warning 1292 Truncated incorrect CHAR(100) value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...'
update t1 set str=column_add(str, 4, repeat("b", 10000)) where id=5;
select id from t1 where column_get(str,4 as char(100000)) = repeat("b", 10000);
id
diff --git a/mysql-test/r/engine_error_in_alter-8453.result b/mysql-test/r/engine_error_in_alter-8453.result
index c5a3375f33c..2c823f83038 100644
--- a/mysql-test/r/engine_error_in_alter-8453.result
+++ b/mysql-test/r/engine_error_in_alter-8453.result
@@ -1,6 +1,7 @@
create table t1 (a int, b int);
-set debug_dbug='+d,external_lock_failure';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,external_lock_failure';
alter table t1 add column c int;
ERROR HY000: Got error 168 'KABOOM!' from MyISAM
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
drop table t1;
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 7e728d24fc8..457e5c8ec9c 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -10,6 +10,7 @@ INSERT INTO t1 VALUES
('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
set tmp_table_size=1024;
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,raise_error";
SELECT MAX(a) FROM t1 GROUP BY a,b;
ERROR 23000: Can't write; duplicate key in table '(temporary)'
@@ -22,7 +23,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL);
INSERT INTO t1 VALUES (1), (0), (2);
SET SESSION debug_dbug='+d,alter_table_only_index_change';
ALTER TABLE t1 ADD INDEX a(a);
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -42,7 +43,7 @@ CREATE TABLE t1(a BLOB);
SET SESSION debug_dbug="+d,bug42064_simulate_oom";
INSERT INTO t1 VALUES("");
Got one of the listed errors
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
DROP TABLE t1;
#
# Bug#41660: Sort-index_merge for non-first join table may require
@@ -79,7 +80,7 @@ a a b filler
7 1 1 data
8 1 1 data
9 1 1 data
-SET SESSION debug_dbug= DEFAULT;
+SET debug_dbug= @saved_dbug;
SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1, t2;
#
@@ -92,7 +93,7 @@ INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error";
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
ERROR 70100: Query execution was interrupted
-SET SESSION debug_dbug = DEFAULT;
+SET debug_dbug= @saved_dbug;
DROP TABLE t1,t2;
#
# End of 5.1 tests
@@ -126,4 +127,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
SELECT f1(1);
Got one of the listed errors
DROP FUNCTION f1;
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index 2be04abb15d..6718a8658b0 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -172,7 +172,20 @@ UPDATE t1 SET a = 'new'
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
ERROR 22007: Illegal value used as argument of dynamic column function
drop table t1;
+set @max_session_mem_used_save= @@max_session_mem_used;
set max_session_mem_used = 50000;
select * from seq_1_to_1000;
set max_session_mem_used = 8192;
select * from seq_1_to_1000;
+set max_session_mem_used = @max_session_mem_used_save;
+#
+# MDEV-20604: Duplicate key value is silently truncated to 64
+# characters in print_keydup_error
+#
+create table t1 (a varchar(100), UNIQUE KEY akey (a));
+insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
+# The value in the error message should show truncation with "..."
+insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
+ERROR 23000: Duplicate entry '1234567890123456789012345678901234567890123456789012345678901...' for key 'akey'
+drop table t1;
+# End of 10.2 tests
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result
index 6dd1a9e5dc6..ec8dc0ff305 100644
--- a/mysql-test/r/events_2.result
+++ b/mysql-test/r/events_2.result
@@ -348,7 +348,7 @@ drop event имя_события_в_кодировке_утф8_длиной_бо
create event
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
on schedule every 2 year do select 1;
-ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
+ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длин...' is too long
create event event_35981 on schedule every 6 month on completion preserve
disable
do
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index cb8850112a5..4870c464fff 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -692,7 +692,7 @@ SET GLOBAL READ_ONLY = 1;
connect u1_con,localhost,mysqltest_u1,,events_test;
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
+CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
ALTER EVENT e1 COMMENT 'comment';
@@ -703,7 +703,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can
connect root_con,localhost,root,,events_test;
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
+CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
diff --git a/mysql-test/r/events_restart.result b/mysql-test/r/events_restart.result
index e22cfa011f2..ab90f7ff2f7 100644
--- a/mysql-test/r/events_restart.result
+++ b/mysql-test/r/events_restart.result
@@ -110,3 +110,30 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT e1;
# end test for bug#11748899
+#
+# Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
+#
+create event ev on schedule every 1 minute do set @a= 1;
+select name, originator, status from mysql.event;
+name originator status
+ev 1 ENABLED
+#
+# Restarting server with server_id=100
+#
+select @@global.server_id;
+@@global.server_id
+100
+select name, originator, status from mysql.event;
+name originator status
+ev 1 ENABLED
+set global server_id= 1;
+#
+# Restarting server with the original server_id=1
+#
+select @@global.server_id;
+@@global.server_id
+1
+select name, originator, status from mysql.event;
+name originator status
+ev 1 ENABLED
+drop event ev;
diff --git a/mysql-test/r/fast_prefix_index_fetch_innodb.result b/mysql-test/r/fast_prefix_index_fetch_innodb.result
index c6d96389b08..ef297e5c6b5 100644
--- a/mysql-test/r/fast_prefix_index_fetch_innodb.result
+++ b/mysql-test/r/fast_prefix_index_fetch_innodb.result
@@ -1,4 +1,4 @@
-drop table if exists prefixinno;
+SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value
@@ -346,10 +346,10 @@ f1
🐱🌑
select @cluster_lookups;
@cluster_lookups
-2
+1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
-0
+1
# Eligible - record length is shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
f1
@@ -366,10 +366,10 @@ f1
🌒
select @cluster_lookups;
@cluster_lookups
-1
+0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
-1
+2
DROP TABLE t1;
CREATE TABLE t1(
col1 INT,
@@ -398,4 +398,60 @@ select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
DROP TABLE t1;
-set global innodb_prefix_index_cluster_optimization = OFF;
+#
+# MDEV-20464 Division by 0 in row_search_with_covering_prefix()
+#
+CREATE TABLE t1 (f1 INT, f2 INT AS (f1), f3 INT AS (f1), f4 INT AS (f1),
+KEY (f1,f2,f3)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (NULL),(0);
+SELECT f1, MAX(f3), COUNT(f4) FROM t1 GROUP BY f1;
+f1 MAX(f3) COUNT(f4)
+NULL NULL 0
+0 0 1
+DROP TABLE t1;
+#
+# MDEV-23600 Division by 0 in row_search_with_covering_prefix()
+#
+CREATE TABLE t(c POINT UNIQUE) ENGINE=InnoDB;
+INSERT t SET c=POINT(1,1);
+SELECT * FROM t WHERE c > (SELECT MAX(c) FROM t);
+c
+DROP TABLE t;
+#
+# MDEV-12486 Wrong results with innodb_prefix_index_cluster_optimization
+#
+CREATE TABLE wp_blogs (
+blog_id bigint(20) NOT NULL auto_increment,
+site_id bigint(20) NOT NULL default '0',
+domain varchar(200) NOT NULL default '',
+path varchar(100) NOT NULL default '',
+registered datetime NOT NULL default '0000-00-00 00:00:00',
+last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+public tinyint(2) NOT NULL default '1',
+archived tinyint(2) NOT NULL default '0',
+mature tinyint(2) NOT NULL default '0',
+spam tinyint(2) NOT NULL default '0',
+deleted tinyint(2) NOT NULL default '0',
+lang_id int(11) NOT NULL default '0',
+PRIMARY KEY (blog_id),
+KEY domain (domain(50),path(5)),
+KEY lang_id (lang_id)
+) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+INSERT INTO wp_blogs (domain, path) VALUES
+('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'),
+('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
+('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
+SET GLOBAL innodb_prefix_index_cluster_optimization=off;
+SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
+AND path IN ( '/fondsinvesteringer/', '/' );
+blog_id
+2
+1
+SET GLOBAL innodb_prefix_index_cluster_optimization=on;
+SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
+AND path IN ( '/fondsinvesteringer/', '/' );
+blog_id
+2
+1
+DROP TABLE wp_blogs;
+SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
diff --git a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result
index a82151ddec0..c412be6bbdb 100644
--- a/mysql-test/r/foreign_key.result
+++ b/mysql-test/r/foreign_key.result
@@ -82,3 +82,29 @@ add foreign key (a) references t3 (a)
on update set default on update set default);
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 'update set default)' at line 3
drop table t_34455;
+#
+# MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
+#
+CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+DROP TABLE tfk;
+CREATE TABLE tfk (c1 INT, c2 INT,
+CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
+show create table tfk;
+Table Create Table
+tfk CREATE TABLE `tfk` (
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) DEFAULT NULL,
+ KEY `sid` (`c1`),
+ CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `tpk` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
+ERROR 42000: Duplicate key name 'sid'
+DROP TABLE tfk;
+DROP TABLE tpk;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 2844f053728..5118cc38fdf 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -776,3 +776,14 @@ CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
Warnings:
Note 1061 Duplicate key name 'ft1'
DROP TABLE t1;
+#
+# MDEV-22275 (Memory leak)
+#
+CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
+ALTER TABLE tmp ADD FULLTEXT (a);
+INSERT INTO tmp VALUES ('foo');
+DROP TABLE tmp;
+CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
+ALTER TABLE tmp ADD FULLTEXT (a);
+INSERT INTO tmp VALUES ('foo');
+DROP TABLE tmp;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 2a4a17e04ba..0f9fdefb81a 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2110,8 +2110,8 @@ avg(export_set( 3, 'y', sha(i))) group_concat(d)
0 2008-10-02
0 2010-12-12
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: 'y,y,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,3'
-Warning 1292 Truncated incorrect DOUBLE value: 'y,y,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,d'
+Warning 1292 Truncated incorrect DOUBLE value: 'y,y,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428a...'
+Warning 1292 Truncated incorrect DOUBLE value: 'y,y,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b...'
drop table t1;
#
# MDEV-4290: crash in st_select_lex::mark_as_dependent
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index 94adf310fec..8f014c89733 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -898,6 +898,11 @@ NULL
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
JSON_MERGE_PATCH(NULL, '[1,2,3]')
[1, 2, 3]
+SELECT JSON_MERGE_PATCH(NULL, 'a');
+JSON_MERGE_PATCH(NULL, 'a')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 2 to function 'json_merge_patch' at position 1
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}')
{"d": "e"}
@@ -916,5 +921,18 @@ NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch'
#
+# MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
+#
+SELECT
+CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
+CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
+cf cd
+1 1
+SELECT
+CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
+CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
+cf cd
+0 0
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 66ee73de88e..1a01a4ed150 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -727,7 +727,7 @@ foo
2
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '53064635.445796e3130837'
-Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,'
+Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,0...'
#
# Bug #58137 char(0) column cause:
# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
@@ -939,13 +939,13 @@ STDDEV_SAMP(EXPORT_SET(t1, -1379790335835635712, (i1 + 'o'), (MD5(d1))))
NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: '98e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde242'
+Warning 1292 Truncated incorrect DOUBLE value: '98e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde24200f376303-13797903358356357128e466c7ff40fe6b95cde...'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e315'
+Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e315457d879863c6ccf2ddee5562fc24-1379790335835635712e...'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: '7b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b527974-1379790335835635712b4dd517b6'
+Warning 1292 Truncated incorrect DOUBLE value: '7b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b5279747b4dd517b633f1f6304b773523b527974-1379790335835635712b4dd51...'
Warning 1292 Truncated incorrect DOUBLE value: 'o'
-Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b0e1'
+Warning 1292 Truncated incorrect DOUBLE value: '-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b0e107767ea830fd3318893e40412a43-1379790335835635712b...'
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(128));
INSERT INTO t1 VALUES ('1e310');
@@ -967,6 +967,790 @@ STDDEV_SAMP(a)
NULL
DROP TABLE t1;
#
+# MDEV-21977 main.func_math fails due to undefined behaviour
+#
+SELECT 9223372036854775808 DIV 1;
+9223372036854775808 DIV 1
+9223372036854775808
+SELECT 9223372036854775808 DIV -1;
+ERROR 22003: BIGINT UNSIGNED value is out of range in '9223372036854775808 DIV -1'
+SELECT -9223372036854775808 DIV 1;
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV 1'
+SELECT -9223372036854775808 DIV -1;
+ERROR 22003: BIGINT value is out of range in '-9223372036854775808 DIV -1'
+SELECT 9223372036854775808 MOD 1;
+9223372036854775808 MOD 1
+0
+SELECT 9223372036854775808 MOD -1;
+9223372036854775808 MOD -1
+0
+SELECT -9223372036854775808 MOD 1;
+-9223372036854775808 MOD 1
+0
+SELECT -9223372036854775808 MOD -1;
+-9223372036854775808 MOD -1
+0
+SELECT 1 MOD 9223372036854775808;
+1 MOD 9223372036854775808
+1
+SELECT -1 MOD 9223372036854775808;
+-1 MOD 9223372036854775808
+-1
+SELECT 1 MOD -9223372036854775808;
+1 MOD -9223372036854775808
+1
+SELECT -1 MOD -9223372036854775808;
+-1 MOD -9223372036854775808
+-1
+SELECT 9223372036854775808 MOD 9223372036854775808;
+9223372036854775808 MOD 9223372036854775808
+0
+SELECT 9223372036854775808 MOD -9223372036854775808;
+9223372036854775808 MOD -9223372036854775808
+0
+SELECT -9223372036854775808 MOD 9223372036854775808;
+-9223372036854775808 MOD 9223372036854775808
+0
+SELECT -9223372036854775808 MOD -9223372036854775808;
+-9223372036854775808 MOD -9223372036854775808
+0
+#
+# MDEV-22502 MDB crashes in CREATE TABLE AS SELECT when the precision of returning type = 0
+#
+CREATE TABLE t1 (d decimal(5,5));
+INSERT INTO t1 VALUES (0.55555);
+SELECT TRUNCATE(d,0) FROM t1;
+TRUNCATE(d,0)
+0
+CREATE TABLE t2 AS SELECT TRUNCATE(d,0) FROM t1;
+SELECT * FROM t2;
+TRUNCATE(d,0)
+0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `TRUNCATE(d,0)` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+#
+# MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with floor/ceil over DECIMAL(X,Y) where X > 16
+#
+CREATE TABLE t44 (d1 decimal(38,0) DEFAULT NULL);
+INSERT INTO t44 VALUES (12345678901234567890123456789012345678);
+SELECT FLOOR(d1) FROM t44;
+FLOOR(d1)
+12345678901234567890123456789012345678
+CREATE TABLE t45 AS SELECT FLOOR(d1) FROM t44;
+SELECT * FROM t45;
+FLOOR(d1)
+12345678901234567890123456789012345678
+SHOW CREATE TABLE t45;
+Table Create Table
+t45 CREATE TABLE `t45` (
+ `FLOOR(d1)` decimal(38,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t44, t45;
+CREATE PROCEDURE p1(prec INT, scale INT)
+BEGIN
+DECLARE maxval VARCHAR(128) DEFAULT '';
+SET @type= CONCAT('DECIMAL(', prec, ',', scale,')');
+SET @stmt= CONCAT('CREATE TABLE t1 (a ', @type, ',b ', @type, 'unsigned)');
+PREPARE stmt FROM @stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+SET maxval= CONCAT(REPEAT('9', prec-scale), '.', REPEAT('9',scale));
+INSERT INTO t1 VALUES (maxval, maxval);
+CREATE TABLE t2 AS SELECT a, b, FLOOR(a) AS fa, FLOOR(b) AS fb FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t1, t2;
+END;
+$$
+CREATE PROCEDURE p2(prec INT)
+BEGIN
+DECLARE scale INT DEFAULT 0;
+WHILE scale < prec AND scale <= 30 DO
+CALL p1(prec, scale);
+SET scale= scale + 1;
+END WHILE;
+END;
+$$
+CALL p2(38);
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,0) DEFAULT NULL,
+ `b` decimal(38,0) unsigned DEFAULT NULL,
+ `fa` decimal(38,0) DEFAULT NULL,
+ `fb` decimal(38,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999999999999999
+b 99999999999999999999999999999999999999
+fa 99999999999999999999999999999999999999
+fb 99999999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,1) DEFAULT NULL,
+ `b` decimal(38,1) unsigned DEFAULT NULL,
+ `fa` decimal(37,0) DEFAULT NULL,
+ `fb` decimal(37,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999999999999999.9
+b 9999999999999999999999999999999999999.9
+fa 9999999999999999999999999999999999999
+fb 9999999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,2) DEFAULT NULL,
+ `b` decimal(38,2) unsigned DEFAULT NULL,
+ `fa` decimal(36,0) DEFAULT NULL,
+ `fb` decimal(36,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999999999999.99
+b 999999999999999999999999999999999999.99
+fa 999999999999999999999999999999999999
+fb 999999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,3) DEFAULT NULL,
+ `b` decimal(38,3) unsigned DEFAULT NULL,
+ `fa` decimal(35,0) DEFAULT NULL,
+ `fb` decimal(35,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999999999999.999
+b 99999999999999999999999999999999999.999
+fa 99999999999999999999999999999999999
+fb 99999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,4) DEFAULT NULL,
+ `b` decimal(38,4) unsigned DEFAULT NULL,
+ `fa` decimal(34,0) DEFAULT NULL,
+ `fb` decimal(34,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999999999999.9999
+b 9999999999999999999999999999999999.9999
+fa 9999999999999999999999999999999999
+fb 9999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,5) DEFAULT NULL,
+ `b` decimal(38,5) unsigned DEFAULT NULL,
+ `fa` decimal(33,0) DEFAULT NULL,
+ `fb` decimal(33,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999999999.99999
+b 999999999999999999999999999999999.99999
+fa 999999999999999999999999999999999
+fb 999999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,6) DEFAULT NULL,
+ `b` decimal(38,6) unsigned DEFAULT NULL,
+ `fa` decimal(32,0) DEFAULT NULL,
+ `fb` decimal(32,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999999999.999999
+b 99999999999999999999999999999999.999999
+fa 99999999999999999999999999999999
+fb 99999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,7) DEFAULT NULL,
+ `b` decimal(38,7) unsigned DEFAULT NULL,
+ `fa` decimal(31,0) DEFAULT NULL,
+ `fb` decimal(31,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999999999.9999999
+b 9999999999999999999999999999999.9999999
+fa 9999999999999999999999999999999
+fb 9999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,8) DEFAULT NULL,
+ `b` decimal(38,8) unsigned DEFAULT NULL,
+ `fa` decimal(30,0) DEFAULT NULL,
+ `fb` decimal(30,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999999.99999999
+b 999999999999999999999999999999.99999999
+fa 999999999999999999999999999999
+fb 999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,9) DEFAULT NULL,
+ `b` decimal(38,9) unsigned DEFAULT NULL,
+ `fa` decimal(29,0) DEFAULT NULL,
+ `fb` decimal(29,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999999.999999999
+b 99999999999999999999999999999.999999999
+fa 99999999999999999999999999999
+fb 99999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,10) DEFAULT NULL,
+ `b` decimal(38,10) unsigned DEFAULT NULL,
+ `fa` decimal(28,0) DEFAULT NULL,
+ `fb` decimal(28,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999999.9999999999
+b 9999999999999999999999999999.9999999999
+fa 9999999999999999999999999999
+fb 9999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,11) DEFAULT NULL,
+ `b` decimal(38,11) unsigned DEFAULT NULL,
+ `fa` decimal(27,0) DEFAULT NULL,
+ `fb` decimal(27,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999.99999999999
+b 999999999999999999999999999.99999999999
+fa 999999999999999999999999999
+fb 999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,12) DEFAULT NULL,
+ `b` decimal(38,12) unsigned DEFAULT NULL,
+ `fa` decimal(26,0) DEFAULT NULL,
+ `fb` decimal(26,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999.999999999999
+b 99999999999999999999999999.999999999999
+fa 99999999999999999999999999
+fb 99999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,13) DEFAULT NULL,
+ `b` decimal(38,13) unsigned DEFAULT NULL,
+ `fa` decimal(25,0) DEFAULT NULL,
+ `fb` decimal(25,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999.9999999999999
+b 9999999999999999999999999.9999999999999
+fa 9999999999999999999999999
+fb 9999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,14) DEFAULT NULL,
+ `b` decimal(38,14) unsigned DEFAULT NULL,
+ `fa` decimal(24,0) DEFAULT NULL,
+ `fb` decimal(24,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999.99999999999999
+b 999999999999999999999999.99999999999999
+fa 999999999999999999999999
+fb 999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,15) DEFAULT NULL,
+ `b` decimal(38,15) unsigned DEFAULT NULL,
+ `fa` decimal(23,0) DEFAULT NULL,
+ `fb` decimal(23,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999.999999999999999
+b 99999999999999999999999.999999999999999
+fa 99999999999999999999999
+fb 99999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,16) DEFAULT NULL,
+ `b` decimal(38,16) unsigned DEFAULT NULL,
+ `fa` decimal(22,0) DEFAULT NULL,
+ `fb` decimal(22,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999.9999999999999999
+b 9999999999999999999999.9999999999999999
+fa 9999999999999999999999
+fb 9999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,17) DEFAULT NULL,
+ `b` decimal(38,17) unsigned DEFAULT NULL,
+ `fa` decimal(21,0) DEFAULT NULL,
+ `fb` decimal(21,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999.99999999999999999
+b 999999999999999999999.99999999999999999
+fa 999999999999999999999
+fb 999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,18) DEFAULT NULL,
+ `b` decimal(38,18) unsigned DEFAULT NULL,
+ `fa` decimal(20,0) DEFAULT NULL,
+ `fb` decimal(20,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999.999999999999999999
+b 99999999999999999999.999999999999999999
+fa 99999999999999999999
+fb 99999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,19) DEFAULT NULL,
+ `b` decimal(38,19) unsigned DEFAULT NULL,
+ `fa` decimal(19,0) DEFAULT NULL,
+ `fb` decimal(19,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999.9999999999999999999
+b 9999999999999999999.9999999999999999999
+fa 9999999999999999999
+fb 9999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,20) DEFAULT NULL,
+ `b` decimal(38,20) unsigned DEFAULT NULL,
+ `fa` decimal(18,0) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999.99999999999999999999
+b 999999999999999999.99999999999999999999
+fa 999999999999999999
+fb 999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,21) DEFAULT NULL,
+ `b` decimal(38,21) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999.999999999999999999999
+b 99999999999999999.999999999999999999999
+fa 99999999999999999
+fb 99999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,22) DEFAULT NULL,
+ `b` decimal(38,22) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999.9999999999999999999999
+b 9999999999999999.9999999999999999999999
+fa 9999999999999999
+fb 9999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,23) DEFAULT NULL,
+ `b` decimal(38,23) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999.99999999999999999999999
+b 999999999999999.99999999999999999999999
+fa 999999999999999
+fb 999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,24) DEFAULT NULL,
+ `b` decimal(38,24) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(16) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999.999999999999999999999999
+b 99999999999999.999999999999999999999999
+fa 99999999999999
+fb 99999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,25) DEFAULT NULL,
+ `b` decimal(38,25) unsigned DEFAULT NULL,
+ `fa` bigint(16) DEFAULT NULL,
+ `fb` bigint(15) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999.9999999999999999999999999
+b 9999999999999.9999999999999999999999999
+fa 9999999999999
+fb 9999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,26) DEFAULT NULL,
+ `b` decimal(38,26) unsigned DEFAULT NULL,
+ `fa` bigint(15) DEFAULT NULL,
+ `fb` bigint(14) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999.99999999999999999999999999
+b 999999999999.99999999999999999999999999
+fa 999999999999
+fb 999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,27) DEFAULT NULL,
+ `b` decimal(38,27) unsigned DEFAULT NULL,
+ `fa` bigint(14) DEFAULT NULL,
+ `fb` bigint(13) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999.999999999999999999999999999
+b 99999999999.999999999999999999999999999
+fa 99999999999
+fb 99999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,28) DEFAULT NULL,
+ `b` decimal(38,28) unsigned DEFAULT NULL,
+ `fa` bigint(13) DEFAULT NULL,
+ `fb` bigint(12) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999.9999999999999999999999999999
+b 9999999999.9999999999999999999999999999
+fa 9999999999
+fb 9999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,29) DEFAULT NULL,
+ `b` decimal(38,29) unsigned DEFAULT NULL,
+ `fa` bigint(12) DEFAULT NULL,
+ `fb` int(11) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999.99999999999999999999999999999
+b 999999999.99999999999999999999999999999
+fa 999999999
+fb 999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,30) DEFAULT NULL,
+ `b` decimal(38,30) unsigned DEFAULT NULL,
+ `fa` int(11) DEFAULT NULL,
+ `fb` int(10) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999.999999999999999999999999999999
+b 99999999.999999999999999999999999999999
+fa 99999999
+fb 99999999
+CALL p2(30);
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,0) DEFAULT NULL,
+ `b` decimal(30,0) unsigned DEFAULT NULL,
+ `fa` decimal(30,0) DEFAULT NULL,
+ `fb` decimal(31,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999999
+b 999999999999999999999999999999
+fa 999999999999999999999999999999
+fb 999999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,1) DEFAULT NULL,
+ `b` decimal(30,1) unsigned DEFAULT NULL,
+ `fa` decimal(29,0) DEFAULT NULL,
+ `fb` decimal(30,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999999.9
+b 99999999999999999999999999999.9
+fa 99999999999999999999999999999
+fb 99999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,2) DEFAULT NULL,
+ `b` decimal(30,2) unsigned DEFAULT NULL,
+ `fa` decimal(28,0) DEFAULT NULL,
+ `fb` decimal(29,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999999.99
+b 9999999999999999999999999999.99
+fa 9999999999999999999999999999
+fb 9999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,3) DEFAULT NULL,
+ `b` decimal(30,3) unsigned DEFAULT NULL,
+ `fa` decimal(27,0) DEFAULT NULL,
+ `fb` decimal(28,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999999.999
+b 999999999999999999999999999.999
+fa 999999999999999999999999999
+fb 999999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,4) DEFAULT NULL,
+ `b` decimal(30,4) unsigned DEFAULT NULL,
+ `fa` decimal(26,0) DEFAULT NULL,
+ `fb` decimal(27,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999999.9999
+b 99999999999999999999999999.9999
+fa 99999999999999999999999999
+fb 99999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,5) DEFAULT NULL,
+ `b` decimal(30,5) unsigned DEFAULT NULL,
+ `fa` decimal(25,0) DEFAULT NULL,
+ `fb` decimal(26,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999999.99999
+b 9999999999999999999999999.99999
+fa 9999999999999999999999999
+fb 9999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,6) DEFAULT NULL,
+ `b` decimal(30,6) unsigned DEFAULT NULL,
+ `fa` decimal(24,0) DEFAULT NULL,
+ `fb` decimal(25,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999999.999999
+b 999999999999999999999999.999999
+fa 999999999999999999999999
+fb 999999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,7) DEFAULT NULL,
+ `b` decimal(30,7) unsigned DEFAULT NULL,
+ `fa` decimal(23,0) DEFAULT NULL,
+ `fb` decimal(24,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999999.9999999
+b 99999999999999999999999.9999999
+fa 99999999999999999999999
+fb 99999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,8) DEFAULT NULL,
+ `b` decimal(30,8) unsigned DEFAULT NULL,
+ `fa` decimal(22,0) DEFAULT NULL,
+ `fb` decimal(23,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999999.99999999
+b 9999999999999999999999.99999999
+fa 9999999999999999999999
+fb 9999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,9) DEFAULT NULL,
+ `b` decimal(30,9) unsigned DEFAULT NULL,
+ `fa` decimal(21,0) DEFAULT NULL,
+ `fb` decimal(22,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999999.999999999
+b 999999999999999999999.999999999
+fa 999999999999999999999
+fb 999999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,10) DEFAULT NULL,
+ `b` decimal(30,10) unsigned DEFAULT NULL,
+ `fa` decimal(20,0) DEFAULT NULL,
+ `fb` decimal(21,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999999.9999999999
+b 99999999999999999999.9999999999
+fa 99999999999999999999
+fb 99999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,11) DEFAULT NULL,
+ `b` decimal(30,11) unsigned DEFAULT NULL,
+ `fa` decimal(19,0) DEFAULT NULL,
+ `fb` decimal(20,0) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999999.99999999999
+b 9999999999999999999.99999999999
+fa 9999999999999999999
+fb 9999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,12) DEFAULT NULL,
+ `b` decimal(30,12) unsigned DEFAULT NULL,
+ `fa` decimal(18,0) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999999.999999999999
+b 999999999999999999.999999999999
+fa 999999999999999999
+fb 999999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,13) DEFAULT NULL,
+ `b` decimal(30,13) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999999.9999999999999
+b 99999999999999999.9999999999999
+fa 99999999999999999
+fb 99999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,14) DEFAULT NULL,
+ `b` decimal(30,14) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999999.99999999999999
+b 9999999999999999.99999999999999
+fa 9999999999999999
+fb 9999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,15) DEFAULT NULL,
+ `b` decimal(30,15) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(17) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999999.999999999999999
+b 999999999999999.999999999999999
+fa 999999999999999
+fb 999999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,16) DEFAULT NULL,
+ `b` decimal(30,16) unsigned DEFAULT NULL,
+ `fa` bigint(17) DEFAULT NULL,
+ `fb` bigint(16) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999999.9999999999999999
+b 99999999999999.9999999999999999
+fa 99999999999999
+fb 99999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,17) DEFAULT NULL,
+ `b` decimal(30,17) unsigned DEFAULT NULL,
+ `fa` bigint(16) DEFAULT NULL,
+ `fb` bigint(15) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999999.99999999999999999
+b 9999999999999.99999999999999999
+fa 9999999999999
+fb 9999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,18) DEFAULT NULL,
+ `b` decimal(30,18) unsigned DEFAULT NULL,
+ `fa` bigint(15) DEFAULT NULL,
+ `fb` bigint(14) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999999.999999999999999999
+b 999999999999.999999999999999999
+fa 999999999999
+fb 999999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,19) DEFAULT NULL,
+ `b` decimal(30,19) unsigned DEFAULT NULL,
+ `fa` bigint(14) DEFAULT NULL,
+ `fb` bigint(13) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999999.9999999999999999999
+b 99999999999.9999999999999999999
+fa 99999999999
+fb 99999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,20) DEFAULT NULL,
+ `b` decimal(30,20) unsigned DEFAULT NULL,
+ `fa` bigint(13) DEFAULT NULL,
+ `fb` bigint(12) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999999.99999999999999999999
+b 9999999999.99999999999999999999
+fa 9999999999
+fb 9999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,21) DEFAULT NULL,
+ `b` decimal(30,21) unsigned DEFAULT NULL,
+ `fa` bigint(12) DEFAULT NULL,
+ `fb` int(11) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999999.999999999999999999999
+b 999999999.999999999999999999999
+fa 999999999
+fb 999999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,22) DEFAULT NULL,
+ `b` decimal(30,22) unsigned DEFAULT NULL,
+ `fa` int(11) DEFAULT NULL,
+ `fb` int(10) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999999.9999999999999999999999
+b 99999999.9999999999999999999999
+fa 99999999
+fb 99999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,23) DEFAULT NULL,
+ `b` decimal(30,23) unsigned DEFAULT NULL,
+ `fa` int(10) DEFAULT NULL,
+ `fb` int(9) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999999.99999999999999999999999
+b 9999999.99999999999999999999999
+fa 9999999
+fb 9999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,24) DEFAULT NULL,
+ `b` decimal(30,24) unsigned DEFAULT NULL,
+ `fa` int(9) DEFAULT NULL,
+ `fb` int(8) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999999.999999999999999999999999
+b 999999.999999999999999999999999
+fa 999999
+fb 999999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,25) DEFAULT NULL,
+ `b` decimal(30,25) unsigned DEFAULT NULL,
+ `fa` int(8) DEFAULT NULL,
+ `fb` int(7) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99999.9999999999999999999999999
+b 99999.9999999999999999999999999
+fa 99999
+fb 99999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,26) DEFAULT NULL,
+ `b` decimal(30,26) unsigned DEFAULT NULL,
+ `fa` int(7) DEFAULT NULL,
+ `fb` int(6) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9999.99999999999999999999999999
+b 9999.99999999999999999999999999
+fa 9999
+fb 9999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,27) DEFAULT NULL,
+ `b` decimal(30,27) unsigned DEFAULT NULL,
+ `fa` int(6) DEFAULT NULL,
+ `fb` int(5) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 999.999999999999999999999999999
+b 999.999999999999999999999999999
+fa 999
+fb 999
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,28) DEFAULT NULL,
+ `b` decimal(30,28) unsigned DEFAULT NULL,
+ `fa` int(5) DEFAULT NULL,
+ `fb` int(4) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 99.9999999999999999999999999999
+b 99.9999999999999999999999999999
+fa 99
+fb 99
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(30,29) DEFAULT NULL,
+ `b` decimal(30,29) unsigned DEFAULT NULL,
+ `fa` int(4) DEFAULT NULL,
+ `fb` int(3) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 9.99999999999999999999999999999
+b 9.99999999999999999999999999999
+fa 9
+fb 9
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+#
# End of 10.1 tests
#
#
@@ -982,8 +1766,3 @@ select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678');
CRC32(NULL) CRC32('') CRC32('MySQL') CRC32('mysql') CRC32('01234567') CRC32('012345678')
NULL 0 3259397556 2501908538 763378421 939184570
-explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
-Warnings:
-Note 1003 select 3 - 2 + 1 AS `(3-2)+1`,3 / 2 * 1 AS `(3/2)*1`,3 - (2 + 1) AS `3-(2+1)`,3 / (2 * 1) AS `3/(2*1)`
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index a19676168c2..36f13784cfb 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -815,13 +815,13 @@ select release_lock(repeat('a', 192));
release_lock(repeat('a', 192))
1
select get_lock(repeat('a', 193), 0);
-ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' is too long
select is_used_lock(repeat('a', 193));
-ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' is too long
select is_free_lock(repeat('a', 193));
-ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' is too long
select release_lock(repeat('a', 193));
-ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' is too long
# --
# -- WL#5787: IPv6-capable INET_ATON and INET_NTOA functions.
@@ -1491,6 +1491,19 @@ x
x
DEALLOCATE PREPARE stmt;
#
+# MDEV-19680: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) ||
+# (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))'
+# or alike failed upon SELECT with mix of functions from simple view
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT ISNULL( BENCHMARK(1, MIN(a))) FROM v1;
+ISNULL( BENCHMARK(1, MIN(a)))
+0
+DROP VIEW v1;
+DROP TABLE t1;
+#
# Start of 10.2 tests
#
#
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index e030df99756..494fe917dc6 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -888,33 +888,33 @@ Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
1
-SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
-CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
+SELECT CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
0
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
1
-SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
-REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
0
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
243
-SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
-LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
0
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''))
0
-SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
-LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''))
-803
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''))
+1603
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT REGEXP_INSTR('a_kollision', 'oll');
diff --git a/mysql-test/r/func_regexp_pcre_debug.result b/mysql-test/r/func_regexp_pcre_debug.result
index e44492fca72..40a379a077d 100644
--- a/mysql-test/r/func_regexp_pcre_debug.result
+++ b/mysql-test/r/func_regexp_pcre_debug.result
@@ -1,10 +1,9 @@
-SET debug_dbug='+d,pcre_exec_error_123';
+SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for
SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
0
Warnings:
Warning 1139 Got error 'pcre_exec: Internal error (-123)' from regexp
-SET debug_dbug='';
SELECT 'a' RLIKE 'a';
'a' RLIKE 'a'
1
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 0907adf460f..798b4f9ff09 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2947,7 +2947,7 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
-Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
+Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...'
connection conn1;
SET @@global.max_allowed_packet:= @tmp_max;
disconnect newconn;
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 8f175a6805b..c2a1ea1137d 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -89,15 +89,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select -1 AS `- a` from dual
drop table t1;
-select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
-5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
-0 1
-select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
-1 and 2 between 2 and 10 2 between 2 and 10 and 1
-1 1
-select 1 and 0 or 2, 2 or 1 and 0;
-1 and 0 or 2 2 or 1 and 0
-1 1
select _koi8r'a' = _koi8r'A';
_koi8r'a' = _koi8r'A'
1
@@ -273,16 +264,6 @@ NULL
select mod(NULL, 2.0) as 'NULL';
NULL
NULL
-create table t1 (a int, b int);
-insert into t1 values (1,2), (2,3), (3,4), (4,5);
-select * from t1 where a not between 1 and 2;
-a b
-3 4
-4 5
-select * from t1 where a not between 1 and 2 and b not between 3 and 4;
-a b
-4 5
-drop table t1;
SELECT GREATEST(1,NULL) FROM DUAL;
GREATEST(1,NULL)
NULL
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index b0c69a5334f..a82cf3c19c2 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -159,7 +159,9 @@ date_format('1999-12-31','%x-%v') date_format('2000-01-01','%x-%v')
1999-52 1999-52
select dayname("1962-03-03"),dayname("1962-03-03")+0;
dayname("1962-03-03") dayname("1962-03-03")+0
-Saturday 5
+Saturday 0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'Saturday'
select monthname("1972-03-04"),monthname("1972-03-04")+0;
monthname("1972-03-04") monthname("1972-03-04")+0
March 0
@@ -3508,5 +3510,18 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
#
+# MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+#
+SELECT DAYNAME('2019-01-05')+0;
+DAYNAME('2019-01-05')+0
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'Saturday'
+SELECT CAST(DAYNAME('2019-01-05') AS SIGNED);
+CAST(DAYNAME('2019-01-05') AS SIGNED)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'Saturday'
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 2450da8a811..82e7cb84275 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 828fbd9d0e7..48618a7c2d8 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -1689,7 +1689,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 `test`.`t1`.`pt` at row 1
+ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' 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))
@@ -2283,5 +2283,12 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
SET timestamp=default;
#
+# MDEV-21056 Memory leak after query with DEFAULT on a geometry field
+#
+CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
+SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
+x
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index a6675682a1f..bd24c5bf380 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1127,7 +1127,7 @@ USE test;
connection default;
disconnect master;
create user longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.t1 (
int_field INTEGER UNSIGNED NOT NULL,
@@ -1213,27 +1213,27 @@ DROP USER mysqltest_1@localhost;
DROP DATABASE mysqltest1;
USE test;
GRANT CREATE ON mysqltest.* TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON mysqltest.* FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
REVOKE CREATE ON mysqltest.* FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT CREATE ON t1 TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
GRANT CREATE ON t1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE CREATE ON t1 FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
REVOKE CREATE ON t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
GRANT EXECUTE ON PROCEDURE p1 TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
GRANT EXECUTE ON PROCEDURE p1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
REVOKE EXECUTE ON PROCEDURE p1 FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
CREATE USER bug23556@localhost;
@@ -1707,7 +1707,7 @@ drop database mysqltest1;
End of 5.0 tests
set names utf8;
grant select on test.* to очень_длинный_юзер890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890@localhost;
-ERROR HY000: String 'очень_длинный_юзер890123456789012345678901234567890123' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'очень_длинный_юзер890123456789012345678901234567890...' is too long for user name (should be no longer than 80)
set names default;
create database mysqltest;
use mysqltest;
@@ -2727,6 +2727,19 @@ DROP USER untrusted@localhost;
DROP DATABASE secret;
set GLOBAL sql_mode=default;
#
+# MDEV-22755 CREATE USER leads to indirect SIGABRT in __stack_chk_fail () from fill_schema_user_privileges + *** stack smashing detected *** (on optimized builds)
+#
+SET NAMES utf8;
+SET SQL_MODE='';
+CREATE USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
+SELECT * FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE "'abcdefghijklmnopqrstuvwxyz'%";
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+SELECT GRANTEE FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE '%觻%';
+GRANTEE
+'觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻'@'localhost'
+DROP USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
+SET SQL_MODE=DEFAULT;
+#
# Start of 10.2 tests
#
#
@@ -2754,5 +2767,23 @@ root@localhost
DROP TABLE t1;
DROP USER dummy@localhost;
#
+# MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated, and
+# inaccurately
+#
+CREATE USER foo;
+CREATE DATABASE db;
+CREATE TABLE db.t (a INT);
+connect con1,localhost,foo,,;
+GRANT ALL ON db.t TO foo;
+ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES,
+INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON db.t TO foo;
+ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't'
+connection default;
+disconnect con1;
+DROP USER foo;
+DROP TABLE db.t;
+DROP DATABASE db;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/grant5.result b/mysql-test/r/grant5.result
index c0fecf0c369..a69070e8399 100644
--- a/mysql-test/r/grant5.result
+++ b/mysql-test/r/grant5.result
@@ -16,6 +16,7 @@ GRANT USAGE ON *.* TO 'foo'
show grants for foo@'%';
ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
connection default;
+disconnect conn_1;
drop user test, foo;
drop role foo;
CREATE TABLE t1 (a INT);
@@ -25,3 +26,48 @@ ERROR HY000: Table 'user' was not locked with LOCK TABLES
REVOKE PROCESS ON *.* FROM u;
ERROR HY000: Table 'user' was not locked with LOCK TABLES
DROP TABLE t1;
+create database mysqltest1;
+use mysqltest1;
+create table t1(id int);
+insert t1 values(2);
+create user u1@localhost;
+grant select on mysqltest1.t1 to u1@localhost;
+grant update on mysqltest1.* to u1@localhost;
+connect u1, localhost, u1;
+update mysqltest1.t1 set id=1 where id=2;
+connection default;
+disconnect u1;
+drop user u1@localhost;
+drop database mysqltest1;
+CREATE ROLE test_role;
+CREATE USER test_user;
+GRANT test_role TO test_user;
+SET DEFAULT ROLE test_role FOR test_user;
+SHOW GRANTS FOR test_user;
+Grants for test_user@%
+GRANT test_role TO 'test_user'@'%'
+GRANT USAGE ON *.* TO 'test_user'@'%'
+SET DEFAULT ROLE test_role FOR 'test_user'@'%'
+SET DEFAULT ROLE NONE for test_user;
+SHOW GRANTS FOR test_user;
+Grants for test_user@%
+GRANT test_role TO 'test_user'@'%'
+GRANT USAGE ON *.* TO 'test_user'@'%'
+SET ROLE test_role;
+SET DEFAULT ROLE test_role;
+SHOW GRANTS;
+Grants for root@localhost
+GRANT test_role TO 'root'@'localhost' WITH ADMIN OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON *.* TO 'test_role'
+SET DEFAULT ROLE test_role FOR 'root'@'localhost'
+SET DEFAULT ROLE NONE;
+SHOW GRANTS;
+Grants for root@localhost
+GRANT test_role TO 'root'@'localhost' WITH ADMIN OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON *.* TO 'test_role'
+DROP USER test_user;
+DROP ROLE test_role;
diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result
index d4a1667595e..997ae20c8fb 100644
--- a/mysql-test/r/grant_lowercase.result
+++ b/mysql-test/r/grant_lowercase.result
@@ -4,7 +4,7 @@ grant select on `a%`.* to user1@localhost with grant option;
connect conn1,localhost,user1,,;
connection conn1;
grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
-ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...'
connection default;
disconnect conn1;
drop user user1@localhost;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index aaf0a3e5288..c996627486c 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2827,6 +2827,22 @@ SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 );
0
drop table t1;
#
+# MDEV-20922: Adding an order by changes the query results
+#
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 values (1, 100), (2, 200), (3, 100), (4, 200), (5, 200);
+create view v1 as select a, b+1 as x from t1;
+SELECT x, COUNT(DISTINCT a) AS y FROM v1 GROUP BY x ORDER BY y;
+x y
+101 2
+201 3
+SELECT b+1 AS x, COUNT(DISTINCT a) AS y FROM t1 GROUP BY x ORDER BY y;
+x y
+101 2
+201 3
+drop view v1;
+drop table t1;
+#
# MDEV-10694 - SIGFPE and/or huge memory allocation in maria_create with distinct/group by/ rollup
#
create table t1 (a int,b int) ;
@@ -2845,3 +2861,17 @@ 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-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double
+# GROUP BY leads to crash
+#
+CALL mtr.add_suppression("Out of sort memory");
+CALL mtr.add_suppression("Sort aborted");
+SET @save_max_sort_length= @@max_sort_length;
+SET max_sort_length=2000000;
+SELECT * FROM information_schema.tables t JOIN information_schema.columns c
+ON t.table_schema=c.table_schema
+WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type)
+GROUP BY t.table_name;
+ERROR HY001: Out of sort memory, consider increasing server sort buffer size
+SET max_sort_length= @save_max_sort_length;
diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result
index 6705ef29280..5bf7aceb597 100644
--- a/mysql-test/r/index_merge_innodb.result
+++ b/mysql-test/r/index_merge_innodb.result
@@ -807,4 +807,30 @@ sum(col1)
33632261
drop table t1;
set optimizer_switch=@tmp_optimizer_switch;
+#
+# MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect
+# on optimized builds
+#
+SET @save_sort_buffer_size=@@sort_buffer_size;
+SET @save_innodb_file_format= @@innodb_file_format;
+SET @save_innodb_large_prefix= @@innodb_large_prefix;
+SET sort_buffer_size=2048;
+CREATE TABLE t1 (
+a VARCHAR(1024) CHARACTER SET UTF8 PRIMARY KEY,
+b INT,
+c INT,
+INDEX (b)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_100;
+EXPLAIN SELECT * FROM t1 WHERE a='1' OR b < 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,b b,PRIMARY 5,3074 NULL 5 Using sort_union(b,PRIMARY); Using where
+SELECT * FROM t1 WHERE a='1' OR b < 5;
+a b c
+2 2 2
+3 3 3
+4 4 4
+1 1 1
+DROP TABLE t1;
+SET sort_buffer_size= @save_sort_buffer_size;
disconnect disable_purge;
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index ccb7a65ecc3..5a23092457d 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -1688,6 +1688,58 @@ id select_type table type possible_keys key key_len ref rows Extra
DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;
#
+# MDEV-21932: ROR union with index_merge_sort_union=off
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+insert into t0 select a+10 from t0;
+insert into t0 select a+20 from t0;
+insert into t0 select a+40 from t0;
+insert into t0 select a+80 from t0;
+insert into t0 select a+160 from t0;
+delete from t0 where a > 300;
+create table t1 (
+f1 int, f2 int, f3 int, f4 int,
+primary key (f1), key (f3), key(f4)
+) engine=myisam;
+insert into t1 select a+100, a+100, a+100, a+100 from t0;
+insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+set optimizer_switch='index_merge_sort_union=off';
+set optimizer_switch='index_merge_union=on';
+explain select * from t1
+where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where
+select * from t1
+where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+f1 f2 f3 f4
+9 0 2 6
+insert into t1 values (52,0,1,0),(53,0,1,0);
+insert into t1 values (50,0,1,0),(51,0,1,0);
+insert into t1 values (48,0,1,0),(49,0,1,0);
+insert into t1 values (46,0,1,0),(47,0,1,0);
+insert into t1 values (44,0,1,0),(45,0,1,0);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+explain select * from t1
+where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 Using union(f3,PRIMARY,f3); Using where
+select * from t1
+where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+f1 f2 f3 f4
+9 0 2 6
+drop table t0,t1;
+set optimizer_switch= @optimizer_switch_save;
+#
# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
#
create table t0
@@ -1722,3 +1774,4 @@ key1 key2 key3 key8
3 3 3 1021
set @@optimizer_switch= @optimizer_switch_save;
drop table t0;
+# End of 10.1 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index ca76cc8100a..7644ff4e7a2 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -2174,3 +2174,26 @@ column_name
c1
c2
DROP TABLE tt1, tt2;
+#
+# MDEV-13242 Wrong results for queries with row constructors and information_schema
+#
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+SCHEMA_NAME
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a',193);
+SCHEMA_NAME
+#
+# End of 10.1 tests
+#
+#
+# Start of 10.2 Test
+#
+# MDEV-14836: Assertion `m_status == DA_ERROR' failed in
+# Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
+#
+SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
+Warnings:
+Warning 1931 Query execution was interrupted. The query examined at least 666 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
+#
+# End of 10.2 Test
+#
diff --git a/mysql-test/r/innodb_ext_key,off.rdiff b/mysql-test/r/innodb_ext_key,off.rdiff
new file mode 100644
index 00000000000..47ca1e6849a
--- /dev/null
+++ b/mysql-test/r/innodb_ext_key,off.rdiff
@@ -0,0 +1,295 @@
+@@ -4,7 +4,7 @@
+ explain
+ select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index
++1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
+ flush status;
+ select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
+ count(*)
+@@ -14,7 +14,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 1
++Handler_read_next 5
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -45,7 +45,7 @@
+ select count(*) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index
++1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
+ flush status;
+ select count(*) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
+@@ -56,7 +56,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 1
++Handler_read_next 6
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -66,7 +66,7 @@
+ select l_orderkey, l_linenumber from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index
++1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
+ flush status;
+ select l_orderkey, l_linenumber from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
+@@ -79,7 +79,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 3
++Handler_read_next 6
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -88,7 +88,7 @@
+ explain
+ select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
+ 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
++1 SIMPLE lineitem ref i_l_shipdate i_l_shipdate 4 const 6 Using index
+ flush status;
+ select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
+ min(l_orderkey)
+@@ -98,7 +98,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 0
++Handler_read_next 6
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -108,7 +108,7 @@
+ select min(l_orderkey) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
+ 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
++1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
+ flush status;
+ select min(l_orderkey) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
+@@ -119,7 +119,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 0
++Handler_read_next 6
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -129,7 +129,7 @@
+ select max(l_linenumber) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey=130;
+ 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
++1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
+ flush status;
+ select max(l_linenumber) from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey=130;
+@@ -140,7 +140,7 @@
+ Handler_read_first 0
+ Handler_read_key 1
+ Handler_read_last 0
+-Handler_read_next 0
++Handler_read_next 5
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -152,7 +152,7 @@
+ where l_shipdate='1992-07-01' and l_orderkey=130
+ or l_receiptdate='1992-07-01' and l_orderkey=5603;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where
++1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
+ flush status;
+ select l_orderkey, l_linenumber
+ from lineitem use index (i_l_shipdate, i_l_receiptdate)
+@@ -166,10 +166,10 @@
+ Handler_read_first 0
+ Handler_read_key 2
+ Handler_read_last 0
+-Handler_read_next 2
++Handler_read_next 9
+ Handler_read_prev 0
+ Handler_read_retry 0
+-Handler_read_rnd 2
++Handler_read_rnd 9
+ Handler_read_rnd_deleted 0
+ Handler_read_rnd_next 0
+ explain
+@@ -178,7 +178,7 @@
+ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
+ or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
++1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
+ flush status;
+ select l_orderkey, l_linenumber
+ from lineitem use index (i_l_shipdate, i_l_receiptdate)
+@@ -193,10 +193,10 @@
+ Handler_read_first 0
+ Handler_read_key 2
+ Handler_read_last 0
+-Handler_read_next 3
++Handler_read_next 9
+ Handler_read_prev 0
+ Handler_read_retry 0
+-Handler_read_rnd 3
++Handler_read_rnd 9
+ Handler_read_rnd_deleted 0
+ Handler_read_rnd_next 0
+ explain
+@@ -204,7 +204,7 @@
+ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
+ or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
++1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY 4,4,4,4 NULL 2 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where
+ flush status;
+ select l_orderkey, l_linenumber from lineitem
+ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
+@@ -218,7 +218,7 @@
+ Handler_read_first 0
+ Handler_read_key 2
+ Handler_read_last 0
+-Handler_read_next 3
++Handler_read_next 9
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 3
+@@ -228,7 +228,7 @@
+ select max(l_orderkey) from lineitem
+ where l_partkey between 1 and 10 group by l_partkey;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by
++1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index
+ flush status;
+ select max(l_orderkey) from lineitem
+ where l_partkey between 1 and 10 group by l_partkey;
+@@ -246,9 +246,9 @@
+ show status like 'handler_read%';
+ Variable_name Value
+ Handler_read_first 0
+-Handler_read_key 21
+-Handler_read_last 1
+-Handler_read_next 0
++Handler_read_key 1
++Handler_read_last 0
++Handler_read_next 294
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -258,7 +258,7 @@
+ select max(l_orderkey) from lineitem
+ where l_suppkey in (1,4) group by l_suppkey;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by
++1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index
+ flush status;
+ select max(l_orderkey) from lineitem
+ where l_suppkey in (1,4) group by l_suppkey;
+@@ -268,9 +268,9 @@
+ show status like 'handler_read%';
+ Variable_name Value
+ Handler_read_first 0
+-Handler_read_key 6
+-Handler_read_last 1
+-Handler_read_next 0
++Handler_read_key 2
++Handler_read_last 0
++Handler_read_next 1230
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -286,7 +286,7 @@
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index
+ 1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index
+-1 SIMPLE lineitem ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index
++1 SIMPLE lineitem ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index
+ flush status;
+ select o_orderkey, p_partkey
+ from part use index (i_p_retailprice),
+@@ -300,7 +300,7 @@
+ Handler_read_first 0
+ Handler_read_key 3
+ Handler_read_last 0
+-Handler_read_next 3
++Handler_read_next 26
+ Handler_read_prev 0
+ Handler_read_retry 0
+ Handler_read_rnd 0
+@@ -317,8 +317,8 @@
+ select * from t0, part ignore index (primary)
+ where p_partkey=t0.a and p_size=1;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where
+-1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1
++1 SIMPLE t0 ALL NULL NULL NULL NULL 5
++1 SIMPLE part ref i_p_size i_p_size 5 const 5 Using index condition
+ select * from t0, part ignore index (primary)
+ where p_partkey=t0.a and p_size=1;
+ a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment
+@@ -495,7 +495,7 @@
+ select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
+-1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index
++1 SIMPLE t3 ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index
+ drop table t1,t2,t3;
+ #
+ # Bug mdev-4340: performance regression with extended_keys=on
+@@ -705,13 +705,13 @@
+ select * from t1 force index(index_date_updated)
+ where index_date_updated= 10 and index_id < 800;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition
++1 SIMPLE t1 ref index_date_updated index_date_updated 5 const # Using index condition
+ # This used to work from the start:
+ explain
+ select * from t2 force index(index_date_updated)
+ where index_date_updated= 10 and index_id < 800;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition
++1 SIMPLE t2 ref index_date_updated index_date_updated 5 const # Using index condition
+ drop table t0,t1,t2;
+ #
+ # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
+@@ -746,11 +746,12 @@
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+- "access_type": "range",
++ "access_type": "ref",
+ "possible_keys": ["f2"],
+ "key": "f2",
+- "key_length": "3070",
+- "used_key_parts": ["f2", "pk1"],
++ "key_length": "3066",
++ "used_key_parts": ["f2"],
++ "ref": ["const"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
+@@ -779,8 +780,8 @@
+ "access_type": "range",
+ "possible_keys": ["k1"],
+ "key": "k1",
+- "key_length": "3011",
+- "used_key_parts": ["pk1", "f2", "pk2"],
++ "key_length": "3007",
++ "used_key_parts": ["pk1", "f2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index 1ab44135f90..c7a5b1a80ca 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -1,30 +1,6 @@
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-DROP DATABASE IF EXISTS dbt3_s001;
SET SESSION STORAGE_ENGINE='InnoDB';
CREATE DATABASE dbt3_s001;
use dbt3_s001;
-set @save_ext_key_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
-flush status;
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-count(*)
-1
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 5
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
@@ -44,29 +20,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
-where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem const PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 8 const,const 1
-flush status;
-select count(*) from lineitem
-where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-count(*)
-1
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 0
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
@@ -88,29 +41,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
-flush status;
-select count(*) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-count(*)
-1
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 6
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
@@ -132,31 +62,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
-flush status;
-select l_orderkey, l_linenumber from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-l_orderkey l_linenumber
-1088 3
-1217 1
-1221 3
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 6
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -180,27 +85,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref i_l_shipdate i_l_shipdate 4 const 6 Using index
-flush status;
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-min(l_orderkey)
-130
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 6
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
@@ -220,29 +104,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select min(l_orderkey) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
-flush status;
-select min(l_orderkey) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-min(l_orderkey)
-1088
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 6
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -264,29 +125,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select max(l_linenumber) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey=130;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
-flush status;
-select max(l_linenumber) from lineitem
-where l_shipdate='1992-07-01' and l_orderkey=130;
-max(l_linenumber)
-2
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 5
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@@ -308,34 +146,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber
-from lineitem use index (i_l_shipdate, i_l_receiptdate)
-where l_shipdate='1992-07-01' and l_orderkey=130
-or l_receiptdate='1992-07-01' and l_orderkey=5603;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
-flush status;
-select l_orderkey, l_linenumber
-from lineitem use index (i_l_shipdate, i_l_receiptdate)
-where l_shipdate='1992-07-01' and l_orderkey=130
-or l_receiptdate='1992-07-01' and l_orderkey=5603;
-l_orderkey l_linenumber
-130 2
-5603 2
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 2
-Handler_read_last 0
-Handler_read_next 9
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 9
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -362,35 +172,6 @@ Handler_read_retry 0
Handler_read_rnd 2
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber
-from lineitem use index (i_l_shipdate, i_l_receiptdate)
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
-or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
-flush status;
-select l_orderkey, l_linenumber
-from lineitem use index (i_l_shipdate, i_l_receiptdate)
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
-or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-l_orderkey l_linenumber
-130 2
-5603 2
-5959 3
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 2
-Handler_read_last 0
-Handler_read_next 9
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 9
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -418,33 +199,6 @@ Handler_read_retry 0
Handler_read_rnd 3
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
-or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY 4,4,4,4 NULL 2 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where
-flush status;
-select l_orderkey, l_linenumber from lineitem
-where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
-or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-l_orderkey l_linenumber
-130 2
-5603 2
-5959 3
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 2
-Handler_read_last 0
-Handler_read_next 9
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 3
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
@@ -470,38 +224,6 @@ Handler_read_retry 0
Handler_read_rnd 3
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select max(l_orderkey) from lineitem
-where l_partkey between 1 and 10 group by l_partkey;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index
-flush status;
-select max(l_orderkey) from lineitem
-where l_partkey between 1 and 10 group by l_partkey;
-max(l_orderkey)
-5984
-5957
-5892
-5856
-5959
-5957
-5794
-5894
-5859
-5632
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 1
-Handler_read_last 0
-Handler_read_next 294
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
@@ -532,30 +254,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=off';
-explain
-select max(l_orderkey) from lineitem
-where l_suppkey in (1,4) group by l_suppkey;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index
-flush status;
-select max(l_orderkey) from lineitem
-where l_suppkey in (1,4) group by l_suppkey;
-max(l_orderkey)
-5988
-5984
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 2
-Handler_read_last 0
-Handler_read_next 1230
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
@@ -579,37 +277,6 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
create index i_p_retailprice on part(p_retailprice);
-set optimizer_switch='extended_keys=off';
-explain
-select o_orderkey, p_partkey
-from part use index (i_p_retailprice),
-lineitem use index (i_l_partkey), orders
-where p_retailprice > 1100 and o_orderdate='1997-01-01'
-and o_orderkey=l_orderkey and p_partkey=l_partkey;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index
-1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index
-1 SIMPLE lineitem ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index
-flush status;
-select o_orderkey, p_partkey
-from part use index (i_p_retailprice),
-lineitem use index (i_l_partkey), orders
-where p_retailprice > 1100 and o_orderdate='1997-01-01'
-and o_orderkey=l_orderkey and p_partkey=l_partkey;
-o_orderkey p_partkey
-5895 200
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 3
-Handler_read_last 0
-Handler_read_next 26
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 0
-set optimizer_switch='extended_keys=on';
explain
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
@@ -646,7 +313,6 @@ Handler_read_rnd_next 0
create table t0 (a int);
insert into t0 values (1), (2), (3), (4), (5);
create index i_p_size on part(p_size);
-set optimizer_switch='extended_keys=on';
explain
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
@@ -667,7 +333,6 @@ use test;
#
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
-SET optimizer_switch='extended_keys=on';
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,2);
SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2);
@@ -688,9 +353,7 @@ set optimizer_switch=@save_optimizer_switch;
# + extended_keys = on
# (valgrinf complains fixed by the patch for bug #914560)
#
-set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
-SET optimizer_switch = 'extended_keys=on';
CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('j'), ('v');
CREATE TABLE t2 (b varchar(1)) ENGINE=MyISAM;
@@ -720,21 +383,6 @@ c int NOT NULL PRIMARY KEY
INSERT INTO t2 VALUES
(10), (11), (12), (13), (14),
(15), (16), (17), (18), (19), (24);
-set @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'extended_keys=off';
-EXPLAIN
-SELECT a FROM t1 AS t, t2
-WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t index a,b b 7 NULL 10 Using index
-1 PRIMARY t1 ref b b 3 test.t.b 2 Using index
-1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; FirstMatch(t)
-1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index
-SELECT a FROM t1 AS t, t2
-WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-a
-24
-SET optimizer_switch = 'extended_keys=on';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
@@ -747,7 +395,6 @@ SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
a
24
-set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
#
# LP Bug #923236: hash join + extended_keys = on
@@ -756,12 +403,10 @@ CREATE TABLE t1 (a int) ENGINE=MyISAM;
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
-set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
-SET optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 WHERE b=a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -786,26 +431,16 @@ UNIQUE KEY uq (c2,c3),
KEY c3 (c3),
KEY c4 (c4)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-set @save_optimizer_switch=@@optimizer_switch;
-set session optimizer_switch='extended_keys=off';
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
-ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-DELETE FROM t1;
-set session optimizer_switch='extended_keys=on';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
-ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
#
# Bug mdev-4220: using ref instead of eq_ref
# with extended_keys=on
# (performance regression introduced in the patch for mdev-3851)
#
-set @save_optimizer_switch=@@optimizer_switch;
create table t1 (a int not null) engine=innodb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (
@@ -815,29 +450,6 @@ insert into t2
select
A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
from t1 A, t1 B;
-set optimizer_switch='extended_keys=off';
-explain
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 10
-1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
-flush status;
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-a pk a b
-0 0 0 0
-1 1 1 1
-show status like 'handler_read%';
-Variable_name Value
-Handler_read_first 0
-Handler_read_key 10
-Handler_read_last 0
-Handler_read_next 0
-Handler_read_prev 0
-Handler_read_retry 0
-Handler_read_rnd 0
-Handler_read_rnd_deleted 0
-Handler_read_rnd_next 11
-set optimizer_switch='extended_keys=on';
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
id select_type table type possible_keys key key_len ref rows Extra
@@ -874,18 +486,6 @@ analyze table t1,t3;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t3 analyze status OK
-set optimizer_switch='extended_keys=off';
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
-1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
-1 SIMPLE t3 ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index
-set optimizer_switch='extended_keys=on';
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -900,7 +500,6 @@ drop table t1,t2,t3;
#
# Bug mdev-4340: performance regression with extended_keys=on
#
-set @save_optimizer_switch=@@optimizer_switch;
CREATE TABLE t1 (
page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
page_namespace int(11) NOT NULL DEFAULT '0',
@@ -1000,16 +599,6 @@ INSERT INTO t3 VALUES
(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
-set optimizer_switch='extended_keys=off';
-EXPLAIN
-SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
-WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
-ORDER BY rev_timestamp ASC LIMIT 10;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
-1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
-1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
-set optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
@@ -1027,7 +616,6 @@ create table t1 (a bigint not null unique auto_increment, b varchar(10), primary
create table t2 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = innodb default character set utf8;
insert into t1 (b) values (null), (null), (null);
insert into t2 (b) values (null), (null), (null);
-set optimizer_switch='extended_keys=on';
explain select a from t1 where b is null order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b PRIMARY 8 NULL 3 Using where
@@ -1042,14 +630,6 @@ select a from t2 where b is null order by a desc limit 2;
a
3
2
-set optimizer_switch='extended_keys=off';
-explain select a from t2 where b is null order by a desc limit 2;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range b b 9 NULL 3 Using where; Using filesort
-select a from t2 where b is null order by a desc limit 2;
-a
-3
-2
explain select a from t2 where b is null order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where
@@ -1067,7 +647,6 @@ a
2
1
drop table t1, t2;
-set optimizer_switch=@save_optimizer_switch;
#
# MDEV-10325: Queries examines all rows of a tables when it should not
#
diff --git a/mysql-test/r/innodb_icp_debug.result b/mysql-test/r/innodb_icp_debug.result
new file mode 100644
index 00000000000..5a169650c8e
--- /dev/null
+++ b/mysql-test/r/innodb_icp_debug.result
@@ -0,0 +1,34 @@
+set default_storage_engine=innodb;
+drop table if exists t0,t1,t2;
+create table t0(a int primary key);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int primary key);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (
+kp1 int,
+kp2 int,
+col char(100),
+key(kp1, kp2)
+);
+insert into t2 select a, a, a from t1;
+select engine from information_schema.tables
+where table_schema=database() and table_name='t2';
+engine
+InnoDB
+explain
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
+set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+connect con1, localhost, root,,;
+connection con1;
+set debug_sync='now WAIT_FOR at_icp_check';
+kill query $target_id;
+set debug_sync='now SIGNAL go';
+connection default;
+ERROR 70100: Query execution was interrupted
+set debug_sync='RESET';
+disconnect con1;
+drop table t0,t1,t2;
+set default_storage_engine=default;
diff --git a/mysql-test/r/insert_debug.result b/mysql-test/r/insert_debug.result
new file mode 100644
index 00000000000..eed8688a04c
--- /dev/null
+++ b/mysql-test/r/insert_debug.result
@@ -0,0 +1,29 @@
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+connect con1, localhost, root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+connection default;
+CREATE TABLE t1(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
+INSERT INTO t1(c1, c2, c3) VALUES('A1','B1','IT1'), ('A2','B2','IT1'), ('A3','B3','IT1'), ('A4','B4','IT1'), ('A5','B5','IT1'), ('A6','B6','IT1'), ('A7','B7','IT1');
+CREATE TABLE t2(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
+INSERT INTO t2(c1, c2, c3) VALUES ('A3','B3','IT2'), ('A2','B2','IT2'), ('A4','B4','IT2'), ('A5','B5','II2');
+CREATE TABLE result(id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10),
+c3 VARCHAR(10), update_count INT DEFAULT 0, UNIQUE KEY uniq_idx (c1,c2), PRIMARY KEY (id)) ENGINE = innodb;
+SET DEBUG_SYNC = "ha_write_row_end WAIT_FOR flushed EXECUTE 1";
+INSERT INTO result(c1, c2, c3) SELECT * FROM t1 ON DUPLICATE KEY UPDATE c2=t1.c2, c3='UT1', update_count=update_count+1;
+connection con1;
+INSERT INTO result(c1, c2, c3) SELECT * FROM t2 ON DUPLICATE KEY UPDATE c2=t2.c2, c3='UT2', update_count=update_count+1;
+SET DEBUG_SYNC = "now SIGNAL flushed";
+connection default;
+SELECT * FROM result;
+id c1 c2 c3 update_count
+1 A1 B1 IT1 0
+2 A3 B3 UT1 1
+3 A2 B2 UT1 1
+4 A4 B4 UT1 1
+5 A5 B5 UT1 1
+9 A6 B6 IT1 0
+10 A7 B7 IT1 0
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE result;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index 2b5bca2fb47..8d9ebab7631 100644
--- a/mysql-test/r/limit_rows_examined.result
+++ b/mysql-test/r/limit_rows_examined.result
@@ -861,3 +861,18 @@ Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
drop view v;
drop table t1, t2;
+#
+# 10.1 Test
+#
+# MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
+# failed in Diagnostics_area::set_error_status
+#
+set @old_mode= @@sql_mode;
+CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
+INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
+SET @@sql_mode='STRICT_TRANS_TABLES';
+INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
+Warnings:
+Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete
+SET @@sql_mode=@old_mode;
+DROP TABLE t1;
diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result
index a02e80ed21e..b08913fa390 100644
--- a/mysql-test/r/locale.result
+++ b/mysql-test/r/locale.result
@@ -51,7 +51,7 @@ DROP TABLE t1;
#
SET lc_messages=sr_YU;
Warnings:
-Warning 1287 'sr_YU' is deprecated and will be removed in a future release. Please use sr_RS instead
+Warning 1287 'sr_YU' ist veraltet. Bitte benutzen Sie 'sr_RS'
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages sr_RS
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 339cfcaa441..2801407130d 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -505,3 +505,17 @@ disconnect con1;
connection default;
UNLOCK TABLES;
DROP TABLE t1, t2;
+#
+# MDEV-21398 Deadlock (server hang) or assertion failure in
+# Diagnostics_area::set_error_status upon ALTER under lock
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+LOCK TABLE t1 WRITE, t1 AS t1a READ;
+ALTER TABLE t1 CHANGE COLUMN IF EXISTS x xx INT;
+Warnings:
+Note 1054 Unknown column 'x' in 't1'
+UNLOCK TABLES;
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/lock_view.result b/mysql-test/r/lock_view.result
new file mode 100644
index 00000000000..4d375bace42
--- /dev/null
+++ b/mysql-test/r/lock_view.result
@@ -0,0 +1,231 @@
+create database mysqltest1;
+create database mysqltest2;
+create database mysqltest3;
+create user invoker@localhost;
+create user definer@localhost;
+grant select,show view on mysqltest1.* to invoker@localhost;
+grant select,show view on mysqltest1.* to definer@localhost;
+grant select,show view on mysqltest2.* to invoker@localhost;
+grant select,show view on mysqltest2.* to definer@localhost;
+grant select,show view on mysqltest3.* to invoker@localhost;
+grant select on performance_schema.* to definer@localhost;
+create table mysqltest1.t1 (a int);
+create definer=definer@localhost view mysqltest2.v2 as select * from mysqltest1.t1;
+create definer=definer@localhost view mysqltest3.v3 as select * from mysqltest2.v2;
+create definer=definer@localhost view mysqltest3.v3is as select schema_name from information_schema.schemata order by schema_name;
+create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user;
+create definer=definer@localhost view mysqltest3.v3nt as select 1;
+create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqltest1`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqltest2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v2` (
+ `a` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest3` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysqltest3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v3` (
+ `a` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v3i` (
+ `a` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v3is` (
+ `schema_name` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v3nt` (
+ `1` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+/*!50001 CREATE TABLE `v3ps` (
+ `user` tinyint NOT NULL
+) ENGINE=MyISAM */;
+SET character_set_client = @saved_cs_client;
+
+USE `mysqltest1`;
+
+USE `mysqltest2`;
+/*!50001 DROP TABLE IF EXISTS `v2`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+
+USE `mysqltest3`;
+/*!50001 DROP TABLE IF EXISTS `v3`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v3` AS select `v2`.`a` AS `a` from `mysqltest2`.`v2` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!50001 DROP TABLE IF EXISTS `v3i`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY INVOKER */
+/*!50001 VIEW `v3i` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!50001 DROP TABLE IF EXISTS `v3is`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v3is` AS select `information_schema`.`schemata`.`SCHEMA_NAME` AS `schema_name` from `information_schema`.`schemata` order by `information_schema`.`schemata`.`SCHEMA_NAME` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!50001 DROP TABLE IF EXISTS `v3nt`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v3nt` AS select 1 AS `1` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+/*!50001 DROP TABLE IF EXISTS `v3ps`*/;
+/*!50001 SET @saved_cs_client = @@character_set_client */;
+/*!50001 SET @saved_cs_results = @@character_set_results */;
+/*!50001 SET @saved_col_connection = @@collation_connection */;
+/*!50001 SET character_set_client = latin1 */;
+/*!50001 SET character_set_results = latin1 */;
+/*!50001 SET collation_connection = latin1_swedish_ci */;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`definer`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v3ps` AS select `performance_schema`.`users`.`USER` AS `user` from `performance_schema`.`users` where `performance_schema`.`users`.`CURRENT_CONNECTIONS` > 0 order by `performance_schema`.`users`.`USER` */;
+/*!50001 SET character_set_client = @saved_cs_client */;
+/*!50001 SET character_set_results = @saved_cs_results */;
+/*!50001 SET collation_connection = @saved_col_connection */;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3 write;
+ERROR 42000: Access denied for user 'invoker'@'localhost' to database 'mysqltest3'
+disconnect inv;
+connection default;
+grant lock tables on mysqltest3.* to invoker@localhost;
+connect inv,localhost,invoker;
+show create view mysqltest3.v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3` AS select `v2`.`a` AS `a` from `mysqltest2`.`v2` latin1 latin1_swedish_ci
+show create view mysqltest3.v3is;
+View Create View character_set_client collation_connection
+v3is CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3is` AS select `information_schema`.`schemata`.`SCHEMA_NAME` AS `schema_name` from `information_schema`.`schemata` order by `information_schema`.`schemata`.`SCHEMA_NAME` latin1 latin1_swedish_ci
+show create view mysqltest3.v3ps;
+View Create View character_set_client collation_connection
+v3ps CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3ps` AS select `performance_schema`.`users`.`USER` AS `user` from `performance_schema`.`users` where `performance_schema`.`users`.`CURRENT_CONNECTIONS` > 0 order by `performance_schema`.`users`.`USER` latin1 latin1_swedish_ci
+show create view mysqltest3.v3nt;
+View Create View character_set_client collation_connection
+v3nt CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest3`.`v3nt` AS select 1 AS `1` latin1 latin1_swedish_ci
+show create view mysqltest3.v3i;
+View Create View character_set_client collation_connection
+v3i CREATE ALGORITHM=UNDEFINED DEFINER=`definer`@`localhost` SQL SECURITY INVOKER VIEW `mysqltest3`.`v3i` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
+lock table mysqltest3.v3 write;
+ERROR HY000: View 'mysqltest3.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+lock table mysqltest3.v3i write;
+ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+lock table mysqltest3.v3is write;
+select * from mysqltest3.v3is;
+schema_name
+information_schema
+mysqltest1
+mysqltest2
+performance_schema
+test
+lock table mysqltest3.v3ps write;
+select * from mysqltest3.v3ps;
+user
+NULL
+invoker
+root
+lock table mysqltest3.v3nt write;
+select * from mysqltest3.v3nt;
+1
+1
+disconnect inv;
+connection default;
+grant lock tables on mysqltest2.* to invoker@localhost;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3 write;
+ERROR HY000: View 'mysqltest3.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+lock table mysqltest3.v3i write;
+ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+disconnect inv;
+connection default;
+grant lock tables on mysqltest1.* to definer@localhost;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3 write;
+select * from mysqltest3.v3;
+a
+lock table mysqltest3.v3i write;
+ERROR HY000: View 'mysqltest3.v3i' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+disconnect inv;
+connection default;
+grant lock tables on mysqltest1.* to invoker@localhost;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3i write;
+select * from mysqltest3.v3i;
+a
+disconnect inv;
+connection default;
+drop user invoker@localhost;
+drop user definer@localhost;
+drop database mysqltest1;
+drop database mysqltest2;
+drop database mysqltest3;
diff --git a/mysql-test/r/log_slow_debug.result b/mysql-test/r/log_slow_debug.result
index 09460fa5d01..a21cc1ce744 100644
--- a/mysql-test/r/log_slow_debug.result
+++ b/mysql-test/r/log_slow_debug.result
@@ -6,7 +6,7 @@ SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
-SET @save_dbug = @@debug_dbug;
+SET @saved_dbug = @@debug_dbug;
SET SESSION debug_dbug="+d,simulate_slow_query";
CREATE PROCEDURE show_slow_log()
BEGIN
@@ -130,7 +130,7 @@ sql_text
#
# Clean up
#
-SET SESSION debug_dbug=@save_dbug;
+SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index aed5dbfba3d..925dce117e9 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -259,6 +259,12 @@ Warning 1286 Unknown storage engine 'NonExistentEngine'
alter table mysql.slow_log engine=memory;
ERROR HY000: Storage engine MEMORY cannot be used for log tables
set storage_engine= @save_storage_engine;
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ERROR HY000: Only non-transactional Aria table can be used for logging
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ERROR HY000: Only non-transactional Aria table can be used for logging
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
drop table mysql.slow_log;
drop table mysql.general_log;
drop table mysql.general_log;
@@ -374,6 +380,14 @@ slow_log
slow_log_new
drop table slow_log_new, general_log_new;
use test;
+SET GLOBAL LOG_OUTPUT = 'FILE';
+SET GLOBAL slow_query_log = 1;
+SET GLOBAL general_log = 1;
+ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
+ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
+SET GLOBAL LOG_OUTPUT = 'NONE';
+ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
+ALTER TABLE mysql.general_log DROP COLUMN comment_text;
SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL general_log = 0;
FLUSH LOGS;
diff --git a/mysql-test/r/mdev6830.result b/mysql-test/r/mdev6830.result
index d1cf8c98ac1..0048aa174bc 100644
--- a/mysql-test/r/mdev6830.result
+++ b/mysql-test/r/mdev6830.result
@@ -1,3 +1,4 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (
@@ -46,3 +47,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
pk f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f1 f2
drop table t1,t2,t3,t4;
drop view v2,v3;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/r/merge-big.result b/mysql-test/r/merge-big.result
index 3b6e116986e..bd188d7a856 100644
--- a/mysql-test/r/merge-big.result
+++ b/mysql-test/r/merge-big.result
@@ -7,7 +7,7 @@ drop table if exists t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
LOCK TABLE t1 WRITE;
connect con1,localhost,root,,;
-SET @orig_debug=@@debug;
+SET @orig_debug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
INSERT INTO t1 VALUES (1);
connection default;
diff --git a/mysql-test/r/merge_debug.result b/mysql-test/r/merge_debug.result
index 51905e52d24..29858810ff1 100644
--- a/mysql-test/r/merge_debug.result
+++ b/mysql-test/r/merge_debug.result
@@ -3,7 +3,7 @@ set global storage_engine=myisam;
set session storage_engine=myisam;
call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair it");
drop table if exists crashed,t2,t3,t4;
-SET @orig_debug=@@debug;
+SET @orig_debug=@@global.debug_dbug;
CREATE TABLE crashed (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE t3 (c1 INT);
diff --git a/mysql-test/r/multi_update_big.result b/mysql-test/r/multi_update_big.result
index 3712e638f40..746a158f21f 100644
--- a/mysql-test/r/multi_update_big.result
+++ b/mysql-test/r/multi_update_big.result
@@ -1,6 +1,5 @@
-DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
-# The protocolling of many inserts into t1 is suppressed.
+INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/r/multi_update_debug.result b/mysql-test/r/multi_update_debug.result
index 799b6821e48..8649172d0c9 100644
--- a/mysql-test/r/multi_update_debug.result
+++ b/mysql-test/r/multi_update_debug.result
@@ -5,9 +5,10 @@ insert t2 values (5,6),(7,8);
create table t0 (x int);
insert t0 values (11), (22);
create trigger tr1 before update on t1 for each row insert t0 values (new.b);
-set debug_sync='open_tables_after_open_and_process_table WAIT_FOR cont';
+set debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR cont';
update t1 join t2 on (a=c+4) set b=d;
connect con1, localhost, root;
+set debug_sync='now WAIT_FOR ready';
set debug_sync='mdl_acquire_lock_wait SIGNAL cont';
lock table t1 write, t0 write;
disconnect con1;
diff --git a/mysql-test/r/myisam_debug.result b/mysql-test/r/myisam_debug.result
index 6232e3eac0e..1428473c850 100644
--- a/mysql-test/r/myisam_debug.result
+++ b/mysql-test/r/myisam_debug.result
@@ -34,10 +34,10 @@ create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
-set debug_dbug='+d,mi_lock_database_failure';
+SET debug_dbug='+d,mi_lock_database_failure';
unlock tables;
Warnings:
Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it
Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
-set debug_dbug=@old_dbug;
+SET debug_dbug=@old_dbug;
drop table t1;
diff --git a/mysql-test/r/myisam_icp_debug.result b/mysql-test/r/myisam_icp_debug.result
new file mode 100644
index 00000000000..cb45a0e2274
--- /dev/null
+++ b/mysql-test/r/myisam_icp_debug.result
@@ -0,0 +1,32 @@
+drop table if exists t0,t1,t2;
+create table t0(a int primary key);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int primary key);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (
+kp1 int,
+kp2 int,
+col char(100),
+key(kp1, kp2)
+);
+insert into t2 select a, a, a from t1;
+select engine from information_schema.tables
+where table_schema=database() and table_name='t2';
+engine
+MyISAM
+explain
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition
+set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go';
+select * from t2 where kp1 between 10 and 20 and kp2 +1 >100;
+connect con1, localhost, root,,;
+connection con1;
+set debug_sync='now WAIT_FOR at_icp_check';
+kill query $target_id;
+set debug_sync='now SIGNAL go';
+connection default;
+ERROR 70100: Query execution was interrupted
+set debug_sync='RESET';
+disconnect con1;
+drop table t0,t1,t2;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index b9ffd25ec0b..ec2760ce8a7 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -177,7 +177,7 @@ ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (errn
The commands reported in the bug report
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyril has found a bug :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
Too long dbname
-ERROR 1102 (42000) at line 1: Incorrect database name 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ERROR 1102 (42000) at line 1: Incorrect database name 'test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...'
Too long hostname
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
1
diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
index e33a519e897..f56a2df2012 100644
--- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result
@@ -4,7 +4,7 @@
# Verbose run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,11 +33,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -46,7 +48,7 @@ END IF|
# Silent run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,11 +74,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -85,6 +89,15 @@ END IF|
#
# Testing with explicit timezonefile
#
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
@@ -93,7 +106,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -105,21 +118,30 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone_leap_second;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=MyISAM;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -131,7 +153,7 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -142,11 +164,13 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index a6a5da8f8c8..b6fb56a63e0 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -561,3 +561,173 @@ t1 CREATE TABLE `t1` (
DROP TABLE test.t1;
SET GLOBAL enforce_storage_engine=NULL;
End of 10.1 tests
+#
+# MDEV-23201 'Roles' are created incorrectly on an install that was previously MySQL 5.7
+#
+#
+FLUSH TABLES mysql.user;
+FLUSH PRIVILEGES;
+SHOW CREATE TABLE mysql.user;
+Table Create Table
+user CREATE TABLE `user` (
+ `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+ `User` char(32) COLLATE utf8_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',
+ `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) unsigned NOT NULL DEFAULT 0,
+ `plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT 'mysql_native_password',
+ `authentication_string` text COLLATE utf8_bin DEFAULT NULL,
+ `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ `password_last_changed` timestamp NULL DEFAULT NULL,
+ `password_lifetime` smallint(5) unsigned DEFAULT NULL,
+ `account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.index_stats OK
+mysql.innodb_index_stats OK
+mysql.innodb_table_stats OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+Upgrading from a version before MariaDB-10.1
+Phase 2/7: Installing used storage engines
+Checking for tables with unknown storage engine
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+SHOW CREATE TABLE mysql.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',
+ `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,
+ `password_last_changed` timestamp NULL DEFAULT NULL,
+ `password_lifetime` smallint(5) unsigned DEFAULT NULL,
+ `account_locked` enum('N','Y') COLLATE utf8_bin NOT NULL DEFAULT 'N',
+ PRIMARY KEY (`Host`,`User`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
+CREATE ROLE `aRole`;
+SET ROLE `aRole`;
+FLUSH PRIVILEGES;
+SET ROLE `aRole`;
+SELECT `User`, `is_role` FROM `mysql`.`user`;
+User is_role
+mysql.session N
+root N
+mysql.sys N
+aRole Y
+DROP ROLE `aRole`;
+FLUSH PRIVILEGES;
+End of 10.2 tests
diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result
index e78c3ca3a40..776c7ac5b53 100644
--- a/mysql-test/r/mysqlbinlog_row_minimal.result
+++ b/mysql-test/r/mysqlbinlog_row_minimal.result
@@ -319,6 +319,24 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP TABLE t1,t2;
+#
+# MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log with system table
+#
+FLUSH BINARY LOGS;
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1), (2) ON DUPLICATE KEY UPDATE pk= pk + 10;
+FLUSH BINARY LOGS;
+Proof: two subsequent patterns must be found
+FOUND 1 /### UPDATE `test`.`t1`/ in mysqlbinlog.sql
+FOUND 2 /### INSERT INTO `test`.`t1`/ in mysqlbinlog.sql
+DROP TABLE t1;
+SELECT * FROM t1;
+pk
+2
+11
+# Cleanup
+DROP TABLE t1;
CREATE TABLE `t1` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`is_deleted` BIT(1) DEFAULT b'0',
@@ -343,33 +361,33 @@ FLUSH BINARY LOGS;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
-# at 387
-#<date> server id 1 end_log_pos 429 CRC32 XXX GTID 0-1-16
+# at POS
+#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX GTID D-S-N
/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
-/*!100001 SET @@session.gtid_seq_no=16*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=21*//*!*/;
BEGIN
/*!*/;
-# at 429
-# at 543
-#<date> server id 1 end_log_pos 543 CRC32 XXX Annotate_rows:
+# at POS
+# at POS
+#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Annotate_rows:
#Q> UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
#Q> SET t1.is_deleted = TRUE
#Q> WHERE t1.id =
-#<date> server id 1 end_log_pos 594 CRC32 XXX Table_map: `test`.`t1` mapped to number 34
-# at 594
-#<date> server id 1 end_log_pos 643 CRC32 XXX Update_rows: table id 34 flags: STMT_END_F
+#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Table_map: `test`.`t1` mapped to number TID
+# at POS
+#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Update_rows: table id TID flags: STMT_END_F
### UPDATE `test`.`t1`
### WHERE
### @1=1 /* LONGINT meta=0 nullable=0 is_null=0 */
### SET
### @2=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @3=X /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */
-# at 643
-#<date> server id 1 end_log_pos 725 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+# at POS
+#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Query thread_id=TID exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
-SET @@session.pseudo_thread_id=5/*!*/;
+SET @@session.pseudo_thread_id=TID/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=#/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@@ -379,8 +397,6 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
COMMIT
/*!*/;
-# at 725
-#<date> server id 1 end_log_pos 773 CRC32 XXX Rotate to master-bin.000004 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/r/mysqld--defaults-file.result b/mysql-test/r/mysqld--defaults-file.result
index 5fd5ca8d95a..ccad1d119fc 100644
--- a/mysql-test/r/mysqld--defaults-file.result
+++ b/mysql-test/r/mysqld--defaults-file.result
@@ -10,3 +10,13 @@ Could not open required defaults file: MYSQL_TEST_DIR/with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/no_extension
Fatal error in defaults handling. Program aborted
+#
+# MDEV-21374: When "--help --verbose" prints out configuration file paths,
+# the --defaults-file option is not considered
+#
+# Test on `defaults-file`
+Default options are read from the following files in the given order:
+MYSQLTEST_VARDIR/my.cnf
+# Test on `defaults-extra-file`
+Default options are read from the following files in the given order:
+<first-defaults> MYSQLTEST_VARDIR/my_test.cnf ~/.my.cnf
diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff
index 7ef9ec5da5f..4e93c2ade69 100644
--- a/mysql-test/r/mysqld--help,win.rdiff
+++ b/mysql-test/r/mysqld--help,win.rdiff
@@ -1,6 +1,6 @@
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
-@@ -334,7 +334,6 @@
+@@ -341,7 +341,6 @@
The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead.
@@ -8,7 +8,7 @@
--lc-messages=name Set the language used for the error messages.
-L, --lc-messages-dir=name
Directory where error messages are
-@@ -543,6 +542,7 @@
+@@ -551,6 +550,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
@@ -16,7 +16,7 @@
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
-@@ -957,6 +957,9 @@
+@@ -965,6 +965,9 @@
characteristics (isolation level, read only/read
write,snapshot - but not any work done / data modified
within the transaction).
@@ -26,7 +26,7 @@
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
-@@ -1069,6 +1072,10 @@
+@@ -1077,6 +1080,10 @@
Log slow queries to given log file. Defaults logging to
'hostname'-slow.log. Must be enabled to activate other
slow log options
@@ -37,7 +37,7 @@
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
-@@ -1087,6 +1094,7 @@
+@@ -1095,6 +1102,7 @@
NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
@@ -45,7 +45,7 @@
--standard-compliant-cte
Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.)
-@@ -1135,6 +1143,11 @@
+@@ -1143,6 +1151,11 @@
--thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread
pool
@@ -57,7 +57,7 @@
--thread-pool-oversubscribe=#
How many additional active worker threads in a group are
allowed.
-@@ -1173,8 +1186,8 @@
+@@ -1181,8 +1194,8 @@
automatically convert it to an on-disk MyISAM or Aria
table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
@@ -68,7 +68,7 @@
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
-@@ -1299,7 +1312,6 @@
+@@ -1308,7 +1321,6 @@
key-cache-division-limit 100
key-cache-file-hash-size 512
key-cache-segments 0
@@ -76,7 +76,7 @@
lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/
lc-time-names en_US
-@@ -1369,6 +1381,7 @@
+@@ -1378,6 +1390,7 @@
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
@@ -84,7 +84,7 @@
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
-@@ -1470,6 +1483,8 @@
+@@ -1479,6 +1492,8 @@
session-track-state-change FALSE
session-track-system-variables
session-track-transaction-info OFF
@@ -93,7 +93,7 @@
show-slave-auth-info FALSE
silent-startup FALSE
skip-grant-tables TRUE
-@@ -1494,6 +1509,7 @@
+@@ -1503,6 +1518,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
@@ -101,17 +101,7 @@
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
stack-trace TRUE
-@@ -1507,14 +1523,16 @@
- sync-relay-log 10000
- sync-relay-log-info 10000
- sysdate-is-now FALSE
--table-cache 421
-+table-cache 2000
- table-definition-cache 400
--table-open-cache 421
-+table-open-cache 2000
- table-open-cache-instances 8
- tc-heuristic-recover OFF
+@@ -1516,6 +1532,8 @@
thread-cache-size 151
thread-pool-idle-timeout 60
thread-pool-max-threads 65536
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 8bdf994f908..94f2ea0a28c 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -1343,7 +1343,6 @@ max-binlog-cache-size 18446744073709547520
max-binlog-size 1073741824
max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 100
-max-connections 151
max-delayed-threads 20
max-digest-length 1024
max-error-count 64
@@ -1516,10 +1515,7 @@ sync-master-info 10000
sync-relay-log 10000
sync-relay-log-info 10000
sysdate-is-now FALSE
-table-cache 421
table-definition-cache 400
-table-open-cache 421
-table-open-cache-instances 8
tc-heuristic-recover OFF
thread-cache-size 151
thread-pool-idle-timeout 60
@@ -1544,5 +1540,5 @@ userstat FALSE
verbose TRUE
wait-timeout 28800
-To see what values a running MySQL server is using, type
+To see what variables a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index e83edb8c121..e527dbffe43 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5647,9 +5647,27 @@ count(*)
2
drop tables t2, t1;
#
-# Test for --add-drop-trigger
+# MDEV-22037: Add ability to skip content of some tables
+# (work around for MDEV-20939)
#
+use mysql;
+# check that all tables we need are not empty
+select count(*) >= 1 from mysql.proc;
+count(*) >= 1
+1
+select count(*) >= 1 from mysql.db;
+count(*) >= 1
+1
+# for proc we have CREATE and INSERT for all other only CREATE
+FOUND 1 /INSERT INTO `proc`/ in MDEV-20939.sql
+NOT FOUND /INSERT INTO `db`/ in MDEV-20939.sql
+FOUND 1 /CREATE TABLE `db`/ in MDEV-20939.sql
+FOUND 1 /CREATE TABLE `proc`/ in MDEV-20939.sql
use test;
+# End of 10.1 tests
+#
+# Test for --add-drop-trigger
+#
CREATE TABLE t1 (a int, b int);
CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.b=NEW.a + 10;
@@ -5695,3 +5713,4 @@ DELIMITER ;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
+# End of 10.2 tests
diff --git a/mysql-test/r/mysqltest_tracking_info.result b/mysql-test/r/mysqltest_tracking_info.result
index df966ae1d39..142f5237876 100644
--- a/mysql-test/r/mysqltest_tracking_info.result
+++ b/mysql-test/r/mysqltest_tracking_info.result
@@ -1,3 +1,4 @@
+set @save_session_track_system_variables=@@session_track_system_variables;
SELECT @@session.character_set_connection;
@@session.character_set_connection
latin1
@@ -28,4 +29,19 @@ SET NAMES 'utf8';
# tracking info off once
SET NAMES 'big5';
-SET @@session.session_track_system_variables= default;
+SET @@session.session_track_system_variables= @save_session_track_system_variables;
+#
+# MDEV-22504: session tracking return incorrectly long traking data
+#
+set @save_optimizer_switch=@@optimizer_switch;
+SET @@session.session_track_system_variables='optimizer_switch';
+set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
+-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
+-- optimizer_switch
+-- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+
+Warnings:
+Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
+set @@optimizer_switch=@save_optimizer_switch;
+SET @@session.session_track_system_variables= @save_session_track_system_variables;
+# End of 10.2 tests
diff --git a/mysql-test/r/nested_profiling.result b/mysql-test/r/nested_profiling.result
new file mode 100644
index 00000000000..b8bceba480a
--- /dev/null
+++ b/mysql-test/r/nested_profiling.result
@@ -0,0 +1,20 @@
+SET @saved_profiling=@@GLOBAL.profiling;
+SET @saved_init_connect=@@GLOBAL.init_connect;
+SET GLOBAL init_connect="set @a=2;set @b=3";
+SET GLOBAL profiling=on;
+create user mysqltest1@localhost;
+connect con1,localhost,mysqltest1,,;
+connection con1;
+SELECT @a, @b;
+@a @b
+2 3
+SHOW PROFILES;
+Query_ID Duration Query
+1 # set @a=2;set @b=3
+2 # set @b=3
+3 # SELECT @a, @b
+connection default;
+disconnect con1;
+DROP USER mysqltest1@localhost;
+SET GLOBAL profiling=@saved_profiling;
+SET GLOBAL init_connect=@saved_init_connect;
diff --git a/mysql-test/r/not_true.require b/mysql-test/r/not_true.require
deleted file mode 100644
index 0032832f3d1..00000000000
--- a/mysql-test/r/not_true.require
+++ /dev/null
@@ -1,2 +0,0 @@
-TRUE
-NULL
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 28b63dab22e..7bc8f562f1b 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -3206,6 +3206,172 @@ pk
3
DROP TABLE t1;
#
+# MDEV-21044: Wrong result when using a smaller size for sort buffer
+#
+create table t1(a varchar(765),b int);
+insert into t1 values ("a",1),("b",2),("c",3),("e",4);
+insert into t1 values ("d",5),("f",6),("g",7),("h",8);
+insert into t1 values ("k",11),("l",12),("i",9),("j",10);
+insert into t1 values ("m",13),("n",14),("o",15),("p",16);
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size=1024;
+select * from t1 order by b;
+a b
+a 1
+b 2
+c 3
+e 4
+d 5
+f 6
+g 7
+h 8
+i 9
+j 10
+k 11
+l 12
+m 13
+n 14
+o 15
+p 16
+set @@sort_buffer_size= @save_sort_buffer_size;
+drop table t1;
+#
+# MDEV-22715: SIGSEGV in radixsort_for_str_ptr and in native_compare/my_qsort2 (optimized builds)
+#
+SET @save_sort_buffer_size= @@sort_buffer_size;
+SET @save_max_sort_length= @@max_sort_length;
+SET max_sort_length=8;
+SET sort_buffer_size=1024;
+CREATE TABLE t1(a INT, b DECIMAL(65), c BLOB);
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25;
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25;
+SELECT * FROM t1 ORDER BY a,b;
+a b c
+1 1 1
+1 1 1
+2 2 2
+2 2 2
+3 3 3
+3 3 3
+4 4 4
+4 4 4
+5 5 5
+5 5 5
+6 6 6
+6 6 6
+7 7 7
+7 7 7
+8 8 8
+8 8 8
+9 9 9
+9 9 9
+10 10 10
+10 10 10
+11 11 11
+11 11 11
+12 12 12
+12 12 12
+13 13 13
+13 13 13
+14 14 14
+14 14 14
+15 15 15
+15 15 15
+16 16 16
+16 16 16
+17 17 17
+17 17 17
+18 18 18
+18 18 18
+19 19 19
+19 19 19
+20 20 20
+20 20 20
+21 21 21
+21 21 21
+22 22 22
+22 22 22
+23 23 23
+23 23 23
+24 24 24
+24 24 24
+25 25 25
+25 25 25
+SET @@sort_buffer_size= @save_sort_buffer_size;
+SET @@max_sort_length= @save_max_sort_length;
+DROP TABLE t1;
+#
+# MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
+# SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
+#
+SET @save_max_sort_length= @@max_sort_length;
+SET @save_sort_buffer_size= @@sort_buffer_size;
+SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
+SET max_sort_length=8;
+SET sort_buffer_size=1024;
+SET max_length_for_sort_data=7000;
+CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
+INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
+ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "read_sorted_file": {
+ "r_rows": 5,
+ "filesort": {
+ "sort_key": "t1.a",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_limit": 5,
+ "r_used_priority_queue": false,
+ "r_output_rows": 35,
+ "r_sort_passes": 1,
+ "r_buffer_size": "REPLACED",
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 100,
+ "r_rows": 100,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ }
+}
+SELECT * FROM t1 ORDER BY a LIMIT 5;
+a b
+1 1
+10 10
+100 100
+11 11
+12 12
+SET max_sort_length= @save_max_sort_length;
+SET sort_buffer_size= @save_sort_buffer_size;
+SET max_length_for_sort_data= @save_max_length_for_sort_data;
+DROP TABLE t1;
+#
+# MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b));
+INSERT INTO t1 VALUES (0, 1),(1, 2);
+CREATE TABLE t2 SELECT * FROM t1;
+EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBQUERY t1 index PRIMARY b 5 NULL 1 Using where
+SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
+c
+1
+NULL
+DROP TABLE t1,t2;
+# end of 10.1 tests
+#
# MDEV-13994: Bad join results with orderby_uses_equalities=on
#
CREATE TABLE books (
@@ -3266,3 +3432,24 @@ NULLIF(GROUP_CONCAT(v1), null)
C
B
DROP TABLE t1;
+#
+# MDEV-24033: SIGSEGV in __memcmp_avx2_movbe from queue_insert | SIGSEGV in __memcmp_avx2_movbe from native_compare
+#
+SET @save_max_length_for_sort_data=@@max_length_for_sort_data;
+SET @save_max_sort_length= @@max_sort_length;
+SET @save_sql_select_limit= @@sql_select_limit;
+CREATE TABLE t1 (a DECIMAL(64,0), b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
+SET max_length_for_sort_data= 30;
+SET sql_select_limit = 3;
+SET max_sort_length=8;
+SELECT * FROM t1 ORDER BY a+1;
+a b
+1 1
+2 2
+3 3
+SET max_length_for_sort_data=@save_max_length_for_sort_data;
+SET max_sort_length= @save_max_sort_length;
+SET sql_select_limit= @save_sql_select_limit;
+DROP TABLE t1;
+# End of 10.2 tests
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index 09bbd7cf176..9ae5b654eed 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -943,11 +943,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
-a
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
-a
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
# UNION with a parenthesed term
CREATE TABLE t1 (a INT);
@@ -1010,14 +1008,11 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
-a
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
-a
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
-a
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
# Derived table with ROLLUP
CREATE TABLE t1 (a INT);
@@ -1326,3 +1321,20 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 between 2 between 3 and 4 and 5 AS `1 between (2 between 3 and 4) and 5`
+create or replace view v1 as select 1 between (2 in (3,4)) and 5;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 between 2 in (3,4) and 5 AS `1 between (2 in (3,4)) and 5`
+create or replace view v1 as select 1 between (2 like 3) and 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 between 2 like 3 and 4 AS `1 between (2 like 3) and 4`
+create or replace view v1 as select 1 not between (2 like 3) and 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 not between 2 like 3 and 4 AS `1 not between (2 like 3) and 4`
+drop view v1;
diff --git a/mysql-test/r/parser_precedence.result b/mysql-test/r/parser_precedence.result
deleted file mode 100644
index 4330c8a2045..00000000000
--- a/mysql-test/r/parser_precedence.result
+++ /dev/null
@@ -1,748 +0,0 @@
-drop table if exists t1_30237_bool;
-set sql_mode=NO_UNSIGNED_SUBTRACTION;
-create table t1_30237_bool(A boolean, B boolean, C boolean);
-insert into t1_30237_bool values
-(FALSE, FALSE, FALSE),
-(FALSE, FALSE, NULL),
-(FALSE, FALSE, TRUE),
-(FALSE, NULL, FALSE),
-(FALSE, NULL, NULL),
-(FALSE, NULL, TRUE),
-(FALSE, TRUE, FALSE),
-(FALSE, TRUE, NULL),
-(FALSE, TRUE, TRUE),
-(NULL, FALSE, FALSE),
-(NULL, FALSE, NULL),
-(NULL, FALSE, TRUE),
-(NULL, NULL, FALSE),
-(NULL, NULL, NULL),
-(NULL, NULL, TRUE),
-(NULL, TRUE, FALSE),
-(NULL, TRUE, NULL),
-(NULL, TRUE, TRUE),
-(TRUE, FALSE, FALSE),
-(TRUE, FALSE, NULL),
-(TRUE, FALSE, TRUE),
-(TRUE, NULL, FALSE),
-(TRUE, NULL, NULL),
-(TRUE, NULL, TRUE),
-(TRUE, TRUE, FALSE),
-(TRUE, TRUE, NULL),
-(TRUE, TRUE, TRUE) ;
-Testing OR, XOR, AND
-select A, B, A OR B, A XOR B, A AND B
-from t1_30237_bool where C is null order by A, B;
-A B A OR B A XOR B A AND B
-NULL NULL NULL NULL NULL
-NULL 0 NULL NULL 0
-NULL 1 1 NULL NULL
-0 NULL NULL NULL 0
-0 0 0 0 0
-0 1 1 1 0
-1 NULL 1 NULL NULL
-1 0 1 1 0
-1 1 1 0 1
-Testing that OR is associative
-select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
-from t1_30237_bool order by A, B, C;
-A B C (A OR B) OR C A OR (B OR C) A OR B OR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 1 1 1
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 NULL NULL NULL
-NULL 0 1 1 1 1
-NULL 1 NULL 1 1 1
-NULL 1 0 1 1 1
-NULL 1 1 1 1 1
-0 NULL NULL NULL NULL NULL
-0 NULL 0 NULL NULL NULL
-0 NULL 1 1 1 1
-0 0 NULL NULL NULL NULL
-0 0 0 0 0 0
-0 0 1 1 1 1
-0 1 NULL 1 1 1
-0 1 0 1 1 1
-0 1 1 1 1 1
-1 NULL NULL 1 1 1
-1 NULL 0 1 1 1
-1 NULL 1 1 1 1
-1 0 NULL 1 1 1
-1 0 0 1 1 1
-1 0 1 1 1 1
-1 1 NULL 1 1 1
-1 1 0 1 1 1
-1 1 1 1 1 1
-select count(*) from t1_30237_bool
-where ((A OR B) OR C) != (A OR (B OR C));
-count(*)
-0
-Testing that XOR is associative
-select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
-from t1_30237_bool order by A, B, C;
-A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 NULL NULL NULL
-NULL 0 1 NULL NULL NULL
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 NULL NULL NULL
-NULL 1 1 NULL NULL NULL
-0 NULL NULL NULL NULL NULL
-0 NULL 0 NULL NULL NULL
-0 NULL 1 NULL NULL NULL
-0 0 NULL NULL NULL NULL
-0 0 0 0 0 0
-0 0 1 1 1 1
-0 1 NULL NULL NULL NULL
-0 1 0 1 1 1
-0 1 1 0 0 0
-1 NULL NULL NULL NULL NULL
-1 NULL 0 NULL NULL NULL
-1 NULL 1 NULL NULL NULL
-1 0 NULL NULL NULL NULL
-1 0 0 1 1 1
-1 0 1 0 0 0
-1 1 NULL NULL NULL NULL
-1 1 0 0 0 0
-1 1 1 1 1 1
-select count(*) from t1_30237_bool
-where ((A XOR B) XOR C) != (A XOR (B XOR C));
-count(*)
-0
-Testing that AND is associative
-select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
-from t1_30237_bool order by A, B, C;
-A B C (A AND B) AND C A AND (B AND C) A AND B AND C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 0 0 0
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL 0 0 0
-NULL 0 0 0 0 0
-NULL 0 1 0 0 0
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 0 0 0
-NULL 1 1 NULL NULL NULL
-0 NULL NULL 0 0 0
-0 NULL 0 0 0 0
-0 NULL 1 0 0 0
-0 0 NULL 0 0 0
-0 0 0 0 0 0
-0 0 1 0 0 0
-0 1 NULL 0 0 0
-0 1 0 0 0 0
-0 1 1 0 0 0
-1 NULL NULL NULL NULL NULL
-1 NULL 0 0 0 0
-1 NULL 1 NULL NULL NULL
-1 0 NULL 0 0 0
-1 0 0 0 0 0
-1 0 1 0 0 0
-1 1 NULL NULL NULL NULL
-1 1 0 0 0 0
-1 1 1 1 1 1
-select count(*) from t1_30237_bool
-where ((A AND B) AND C) != (A AND (B AND C));
-count(*)
-0
-Testing that AND has precedence over OR
-select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
-from t1_30237_bool order by A, B, C;
-A B C (A OR B) AND C A OR (B AND C) A OR B AND C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 0 NULL NULL
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 0 NULL NULL
-NULL 0 1 NULL NULL NULL
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 0 NULL NULL
-NULL 1 1 1 1 1
-0 NULL NULL NULL NULL NULL
-0 NULL 0 0 0 0
-0 NULL 1 NULL NULL NULL
-0 0 NULL 0 0 0
-0 0 0 0 0 0
-0 0 1 0 0 0
-0 1 NULL NULL NULL NULL
-0 1 0 0 0 0
-0 1 1 1 1 1
-1 NULL NULL NULL 1 1
-1 NULL 0 0 1 1
-1 NULL 1 1 1 1
-1 0 NULL NULL 1 1
-1 0 0 0 1 1
-1 0 1 1 1 1
-1 1 NULL NULL 1 1
-1 1 0 0 1 1
-1 1 1 1 1 1
-select count(*) from t1_30237_bool
-where (A OR (B AND C)) != (A OR B AND C);
-count(*)
-0
-select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
-from t1_30237_bool order by A, B, C;
-A B C (A AND B) OR C A AND (B OR C) A AND B OR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 1 NULL 1
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 0 0 0
-NULL 0 1 1 NULL 1
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 NULL NULL NULL
-NULL 1 1 1 NULL 1
-0 NULL NULL NULL 0 NULL
-0 NULL 0 0 0 0
-0 NULL 1 1 0 1
-0 0 NULL NULL 0 NULL
-0 0 0 0 0 0
-0 0 1 1 0 1
-0 1 NULL NULL 0 NULL
-0 1 0 0 0 0
-0 1 1 1 0 1
-1 NULL NULL NULL NULL NULL
-1 NULL 0 NULL NULL NULL
-1 NULL 1 1 1 1
-1 0 NULL NULL NULL NULL
-1 0 0 0 0 0
-1 0 1 1 1 1
-1 1 NULL 1 1 1
-1 1 0 1 1 1
-1 1 1 1 1 1
-select count(*) from t1_30237_bool
-where ((A AND B) OR C) != (A AND B OR C);
-count(*)
-0
-Testing that AND has precedence over XOR
-select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
-from t1_30237_bool order by A, B, C;
-A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 0 NULL NULL
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 0 NULL NULL
-NULL 0 1 NULL NULL NULL
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 0 NULL NULL
-NULL 1 1 NULL NULL NULL
-0 NULL NULL NULL NULL NULL
-0 NULL 0 0 0 0
-0 NULL 1 NULL NULL NULL
-0 0 NULL 0 0 0
-0 0 0 0 0 0
-0 0 1 0 0 0
-0 1 NULL NULL NULL NULL
-0 1 0 0 0 0
-0 1 1 1 1 1
-1 NULL NULL NULL NULL NULL
-1 NULL 0 0 1 1
-1 NULL 1 NULL NULL NULL
-1 0 NULL NULL 1 1
-1 0 0 0 1 1
-1 0 1 1 1 1
-1 1 NULL 0 NULL NULL
-1 1 0 0 1 1
-1 1 1 0 0 0
-select count(*) from t1_30237_bool
-where (A XOR (B AND C)) != (A XOR B AND C);
-count(*)
-0
-select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
-from t1_30237_bool order by A, B, C;
-A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 0 0 0
-NULL 0 1 1 NULL 1
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 NULL NULL NULL
-NULL 1 1 NULL 0 NULL
-0 NULL NULL NULL 0 NULL
-0 NULL 0 0 0 0
-0 NULL 1 1 0 1
-0 0 NULL NULL 0 NULL
-0 0 0 0 0 0
-0 0 1 1 0 1
-0 1 NULL NULL 0 NULL
-0 1 0 0 0 0
-0 1 1 1 0 1
-1 NULL NULL NULL NULL NULL
-1 NULL 0 NULL NULL NULL
-1 NULL 1 NULL NULL NULL
-1 0 NULL NULL NULL NULL
-1 0 0 0 0 0
-1 0 1 1 1 1
-1 1 NULL NULL NULL NULL
-1 1 0 1 1 1
-1 1 1 0 0 0
-select count(*) from t1_30237_bool
-where ((A AND B) XOR C) != (A AND B XOR C);
-count(*)
-0
-Testing that XOR has precedence over OR
-select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
-from t1_30237_bool order by A, B, C;
-A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 1 NULL 1
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 NULL NULL NULL
-NULL 0 1 1 NULL 1
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 NULL NULL NULL
-NULL 1 1 1 NULL 1
-0 NULL NULL NULL NULL NULL
-0 NULL 0 NULL NULL NULL
-0 NULL 1 1 1 1
-0 0 NULL NULL NULL NULL
-0 0 0 0 0 0
-0 0 1 1 1 1
-0 1 NULL 1 1 1
-0 1 0 1 1 1
-0 1 1 1 1 1
-1 NULL NULL NULL NULL NULL
-1 NULL 0 NULL NULL NULL
-1 NULL 1 1 0 1
-1 0 NULL 1 NULL 1
-1 0 0 1 1 1
-1 0 1 1 0 1
-1 1 NULL NULL 0 NULL
-1 1 0 0 0 0
-1 1 1 1 0 1
-select count(*) from t1_30237_bool
-where ((A XOR B) OR C) != (A XOR B OR C);
-count(*)
-0
-select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
-from t1_30237_bool order by A, B, C;
-A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
-NULL NULL NULL NULL NULL NULL
-NULL NULL 0 NULL NULL NULL
-NULL NULL 1 NULL NULL NULL
-NULL 0 NULL NULL NULL NULL
-NULL 0 0 NULL NULL NULL
-NULL 0 1 NULL 1 1
-NULL 1 NULL NULL NULL NULL
-NULL 1 0 1 1 1
-NULL 1 1 0 NULL NULL
-0 NULL NULL NULL NULL NULL
-0 NULL 0 NULL NULL NULL
-0 NULL 1 NULL NULL NULL
-0 0 NULL NULL NULL NULL
-0 0 0 0 0 0
-0 0 1 1 1 1
-0 1 NULL NULL NULL NULL
-0 1 0 1 1 1
-0 1 1 0 0 0
-1 NULL NULL NULL 1 1
-1 NULL 0 1 1 1
-1 NULL 1 0 1 1
-1 0 NULL NULL 1 1
-1 0 0 1 1 1
-1 0 1 0 1 1
-1 1 NULL NULL 1 1
-1 1 0 1 1 1
-1 1 1 0 1 1
-select count(*) from t1_30237_bool
-where (A OR (B XOR C)) != (A OR B XOR C);
-count(*)
-0
-drop table t1_30237_bool;
-Testing that NOT has precedence over OR
-select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
-(NOT FALSE) OR TRUE NOT (FALSE OR TRUE) NOT FALSE OR TRUE
-1 0 1
-Testing that NOT has precedence over XOR
-select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
-(NOT FALSE) XOR FALSE NOT (FALSE XOR FALSE) NOT FALSE XOR FALSE
-1 1 1
-Testing that NOT has precedence over AND
-select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
-(NOT FALSE) AND FALSE NOT (FALSE AND FALSE) NOT FALSE AND FALSE
-0 1 0
-Testing that NOT is associative
-select NOT NOT TRUE, NOT NOT NOT FALSE;
-NOT NOT TRUE NOT NOT NOT FALSE
-1 1
-Testing that IS has precedence over NOT
-select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
-(NOT NULL) IS TRUE NOT (NULL IS TRUE) NOT NULL IS TRUE
-0 1 1
-select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
-(NOT NULL) IS NOT TRUE NOT (NULL IS NOT TRUE) NOT NULL IS NOT TRUE
-1 0 0
-select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
-(NOT NULL) IS FALSE NOT (NULL IS FALSE) NOT NULL IS FALSE
-0 1 1
-select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
-(NOT NULL) IS NOT FALSE NOT (NULL IS NOT FALSE) NOT NULL IS NOT FALSE
-1 0 0
-select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
-(NOT TRUE) IS UNKNOWN NOT (TRUE IS UNKNOWN) NOT TRUE IS UNKNOWN
-0 1 1
-select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
-(NOT TRUE) IS NOT UNKNOWN NOT (TRUE IS NOT UNKNOWN) NOT TRUE IS NOT UNKNOWN
-1 0 0
-select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
-(NOT TRUE) IS NULL NOT (TRUE IS NULL) NOT TRUE IS NULL
-0 1 1
-select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
-(NOT TRUE) IS NOT NULL NOT (TRUE IS NOT NULL) NOT TRUE IS NOT NULL
-1 0 0
-Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
-select TRUE IS TRUE IS TRUE IS TRUE;
-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 'IS TRUE IS TRUE' at line 1
-select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
-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 'IS NOT TRUE IS NOT TRUE' at line 1
-select NULL IS FALSE IS FALSE IS FALSE;
-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 'IS FALSE IS FALSE' at line 1
-select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
-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 'IS NOT FALSE IS NOT FALSE' at line 1
-select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
-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 'IS UNKNOWN IS UNKNOWN' at line 1
-select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
-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 'IS NOT UNKNOWN IS NOT UNKNOWN' at line 1
-Testing that IS [NOT] NULL predicates are associative
-select FALSE IS NULL IS NULL IS NULL;
-FALSE IS NULL IS NULL IS NULL
-0
-select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
-TRUE IS NOT NULL IS NOT NULL IS NOT NULL
-1
-Testing that comparison operators are left associative
-select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
-1 <=> 2 <=> 2 (1 <=> 2) <=> 2 1 <=> (2 <=> 2)
-0 0 1
-select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
-1 = 2 = 2 (1 = 2) = 2 1 = (2 = 2)
-0 0 1
-select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
-1 != 2 != 3 (1 != 2) != 3 1 != (2 != 3)
-1 1 0
-select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
-1 <> 2 <> 3 (1 <> 2) <> 3 1 <> (2 <> 3)
-1 1 0
-select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
-1 < 2 < 3 (1 < 2) < 3 1 < (2 < 3)
-1 1 0
-select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
-3 <= 2 <= 1 (3 <= 2) <= 1 3 <= (2 <= 1)
-1 1 0
-select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
-1 > 2 > 3 (1 > 2) > 3 1 > (2 > 3)
-0 0 1
-select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
-1 >= 2 >= 3 (1 >= 2) >= 3 1 >= (2 >= 3)
-0 0 1
-Testing that | is associative
-select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
-0xF0 | 0x0F | 0x55 (0xF0 | 0x0F) | 0x55 0xF0 | (0x0F | 0x55)
-255 255 255
-Testing that & is associative
-select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
-0xF5 & 0x5F & 0x55 (0xF5 & 0x5F) & 0x55 0xF5 & (0x5F & 0x55)
-85 85 85
-Testing that << is left associative
-select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
-4 << 3 << 2 (4 << 3) << 2 4 << (3 << 2)
-128 128 16384
-Testing that >> is left associative
-select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
-256 >> 3 >> 2 (256 >> 3) >> 2 256 >> (3 >> 2)
-8 8 256
-Testing that & has precedence over |
-select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
-0xF0 & 0x0F | 0x55 (0xF0 & 0x0F) | 0x55 0xF0 & (0x0F | 0x55)
-85 85 80
-select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
-0x55 | 0xF0 & 0x0F (0x55 | 0xF0) & 0x0F 0x55 | (0xF0 & 0x0F)
-85 5 85
-Testing that << has precedence over |
-select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
-0x0F << 4 | 0x0F (0x0F << 4) | 0x0F 0x0F << (4 | 0x0F)
-255 255 491520
-select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
-0x0F | 0x0F << 4 (0x0F | 0x0F) << 4 0x0F | (0x0F << 4)
-255 240 255
-Testing that >> has precedence over |
-select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
-0xF0 >> 4 | 0xFF (0xF0 >> 4) | 0xFF 0xF0 >> (4 | 0xFF)
-255 255 0
-select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
-0xFF | 0xF0 >> 4 (0xFF | 0xF0) >> 4 0xFF | (0xF0 >> 4)
-255 15 255
-Testing that << has precedence over &
-select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
-0x0F << 4 & 0xF0 (0x0F << 4) & 0xF0 0x0F << (4 & 0xF0)
-240 240 15
-select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
-0xF0 & 0x0F << 4 (0xF0 & 0x0F) << 4 0xF0 & (0x0F << 4)
-240 0 240
-Testing that >> has precedence over &
-select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
-0xF0 >> 4 & 0x55 (0xF0 >> 4) & 0x55 0xF0 >> (4 & 0x55)
-5 5 15
-select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
-0x0F & 0xF0 >> 4 (0x0F & 0xF0) >> 4 0x0F & (0xF0 >> 4)
-15 0 15
-Testing that >> and << have the same precedence
-select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
-0xFF >> 4 << 2 (0xFF >> 4) << 2 0xFF >> (4 << 2)
-60 60 0
-select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
-0x0F << 4 >> 2 (0x0F << 4) >> 2 0x0F << (4 >> 2)
-60 60 30
-Testing that binary + is associative
-select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
-1 + 2 + 3 (1 + 2) + 3 1 + (2 + 3)
-6 6 6
-Testing that binary - is left associative
-select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
-1 - 2 - 3 (1 - 2) - 3 1 - (2 - 3)
--4 -4 2
-Testing that binary + and binary - have the same precedence
-select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
-1 + 2 - 3 (1 + 2) - 3 1 + (2 - 3)
-0 0 0
-select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
-1 - 2 + 3 (1 - 2) + 3 1 - (2 + 3)
-2 2 -4
-Testing that binary + has precedence over |
-select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
-0xF0 + 0x0F | 0x55 (0xF0 + 0x0F) | 0x55 0xF0 + (0x0F | 0x55)
-255 255 335
-select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
-0x55 | 0xF0 + 0x0F (0x55 | 0xF0) + 0x0F 0x55 | (0xF0 + 0x0F)
-255 260 255
-Testing that binary + has precedence over &
-select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
-0xF0 + 0x0F & 0x55 (0xF0 + 0x0F) & 0x55 0xF0 + (0x0F & 0x55)
-85 85 245
-select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
-0x55 & 0xF0 + 0x0F (0x55 & 0xF0) + 0x0F 0x55 & (0xF0 + 0x0F)
-85 95 85
-Testing that binary + has precedence over <<
-select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
-2 + 3 << 4 (2 + 3) << 4 2 + (3 << 4)
-80 80 50
-select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
-3 << 4 + 2 (3 << 4) + 2 3 << (4 + 2)
-192 50 192
-Testing that binary + has precedence over >>
-select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
-4 + 3 >> 2 (4 + 3) >> 2 4 + (3 >> 2)
-1 1 4
-select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
-3 >> 2 + 1 (3 >> 2) + 1 3 >> (2 + 1)
-0 1 0
-Testing that binary - has precedence over |
-select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
-0xFF - 0x0F | 0x55 (0xFF - 0x0F) | 0x55 0xFF - (0x0F | 0x55)
-245 245 160
-select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
-0x55 | 0xFF - 0xF0 (0x55 | 0xFF) - 0xF0 0x55 | (0xFF - 0xF0)
-95 15 95
-Testing that binary - has precedence over &
-select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
-0xFF - 0xF0 & 0x55 (0xFF - 0xF0) & 0x55 0xFF - (0xF0 & 0x55)
-5 5 175
-select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
-0x55 & 0xFF - 0xF0 (0x55 & 0xFF) - 0xF0 0x55 & (0xFF - 0xF0)
-5 -155 5
-Testing that binary - has precedence over <<
-select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
-16 - 3 << 2 (16 - 3) << 2 16 - (3 << 2)
-52 52 4
-select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
-4 << 3 - 2 (4 << 3) - 2 4 << (3 - 2)
-8 30 8
-Testing that binary - has precedence over >>
-select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
-16 - 3 >> 2 (16 - 3) >> 2 16 - (3 >> 2)
-3 3 16
-select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
-16 >> 3 - 2 (16 >> 3) - 2 16 >> (3 - 2)
-8 0 8
-Testing that * is associative
-select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
-2 * 3 * 4 (2 * 3) * 4 2 * (3 * 4)
-24 24 24
-Testing that * has precedence over |
-select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
-2 * 0x40 | 0x0F (2 * 0x40) | 0x0F 2 * (0x40 | 0x0F)
-143 143 158
-select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
-0x0F | 2 * 0x40 (0x0F | 2) * 0x40 0x0F | (2 * 0x40)
-143 960 143
-Testing that * has precedence over &
-select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
-2 * 0x40 & 0x55 (2 * 0x40) & 0x55 2 * (0x40 & 0x55)
-0 0 128
-select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
-0xF0 & 2 * 0x40 (0xF0 & 2) * 0x40 0xF0 & (2 * 0x40)
-128 0 128
-Testing that * has precedence over <<
-select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
-5 * 3 << 4 (5 * 3) << 4 5 * (3 << 4)
-240 240 240
-select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
-2 << 3 * 4 (2 << 3) * 4 2 << (3 * 4)
-8192 64 8192
-Testing that * has precedence over >>
-select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
-3 * 4 >> 2 (3 * 4) >> 2 3 * (4 >> 2)
-3 3 3
-select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
-4 >> 2 * 3 (4 >> 2) * 3 4 >> (2 * 3)
-0 3 0
-Testing that * has precedence over binary +
-select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
-2 * 3 + 4 (2 * 3) + 4 2 * (3 + 4)
-10 10 14
-select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
-2 + 3 * 4 (2 + 3) * 4 2 + (3 * 4)
-14 20 14
-Testing that * has precedence over binary -
-select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
-4 * 3 - 2 (4 * 3) - 2 4 * (3 - 2)
-10 10 4
-select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
-4 - 3 * 2 (4 - 3) * 2 4 - (3 * 2)
--2 2 -2
-Testing that / is left associative
-select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
-15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
-1.00000000 1.00000000 9.0000
-Testing that / has precedence over |
-select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
-105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)
-23 23 15.0000
-select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
-105 | 2 / 5 (105 | 2) / 5 105 | (2 / 5)
-105 21.4000 105
-Testing that / has precedence over &
-select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
-105 / 5 & 0x0F (105 / 5) & 0x0F 105 / (5 & 0x0F)
-5 5 21.0000
-select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
-0x0F & 105 / 5 (0x0F & 105) / 5 0x0F & (105 / 5)
-5 1.8000 5
-Testing that / has precedence over <<
-select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
-0x80 / 4 << 2 (0x80 / 4) << 2 0x80 / (4 << 2)
-128 128 8.0000
-select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
-0x80 << 4 / 2 (0x80 << 4) / 2 0x80 << (4 / 2)
-512 1024.0000 512
-Testing that / has precedence over >>
-select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
-0x80 / 4 >> 2 (0x80 / 4) >> 2 0x80 / (4 >> 2)
-8 8 128.0000
-select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
-0x80 >> 4 / 2 (0x80 >> 4) / 2 0x80 >> (4 / 2)
-32 4.0000 32
-Testing that / has precedence over binary +
-select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
-0x80 / 2 + 2 (0x80 / 2) + 2 0x80 / (2 + 2)
-66.0000 66.0000 32.0000
-select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
-0x80 + 2 / 2 (0x80 + 2) / 2 0x80 + (2 / 2)
-129.0000 65.0000 129.0000
-Testing that / has precedence over binary -
-select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
-0x80 / 4 - 2 (0x80 / 4) - 2 0x80 / (4 - 2)
-30.0000 30.0000 64.0000
-select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
-0x80 - 4 / 2 (0x80 - 4) / 2 0x80 - (4 / 2)
-126.0000 62.0000 126.0000
-Testing that ^ is associative
-select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
-0xFF ^ 0xF0 ^ 0x0F (0xFF ^ 0xF0) ^ 0x0F 0xFF ^ (0xF0 ^ 0x0F)
-0 0 0
-select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
-0xFF ^ 0xF0 ^ 0x55 (0xFF ^ 0xF0) ^ 0x55 0xFF ^ (0xF0 ^ 0x55)
-90 90 90
-Testing that ^ has precedence over |
-select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
-0xFF ^ 0xF0 | 0x0F (0xFF ^ 0xF0) | 0x0F 0xFF ^ (0xF0 | 0x0F)
-15 15 0
-select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
-0xF0 | 0xFF ^ 0xF0 (0xF0 | 0xFF) ^ 0xF0 0xF0 | (0xFF ^ 0xF0)
-255 15 255
-Testing that ^ has precedence over &
-select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
-0xFF ^ 0xF0 & 0x0F (0xFF ^ 0xF0) & 0x0F 0xFF ^ (0xF0 & 0x0F)
-15 15 255
-select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
-0x0F & 0xFF ^ 0xF0 (0x0F & 0xFF) ^ 0xF0 0x0F & (0xFF ^ 0xF0)
-15 255 15
-Testing that ^ has precedence over <<
-select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
-0xFF ^ 0xF0 << 2 (0xFF ^ 0xF0) << 2 0xFF ^ (0xF0 << 2)
-60 60 831
-select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
-0x0F << 2 ^ 0xFF (0x0F << 2) ^ 0xFF 0x0F << (2 ^ 0xFF)
-0 195 0
-Testing that ^ has precedence over >>
-select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
-0xFF ^ 0xF0 >> 2 (0xFF ^ 0xF0) >> 2 0xFF ^ (0xF0 >> 2)
-3 3 195
-select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
-0xFF >> 2 ^ 0xF0 (0xFF >> 2) ^ 0xF0 0xFF >> (2 ^ 0xF0)
-0 207 0
-Testing that ^ has precedence over binary +
-select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
-0xFF ^ 0xF0 + 0x0F (0xFF ^ 0xF0) + 0x0F 0xFF ^ (0xF0 + 0x0F)
-30 30 0
-select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
-0x0F + 0xFF ^ 0xF0 (0x0F + 0xFF) ^ 0xF0 0x0F + (0xFF ^ 0xF0)
-30 510 30
-Testing that ^ has precedence over binary -
-select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
-0xFF ^ 0xF0 - 1 (0xFF ^ 0xF0) - 1 0xFF ^ (0xF0 - 1)
-14 14 16
-select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
-0x55 - 0x0F ^ 0x55 (0x55 - 0x0F) ^ 0x55 0x55 - (0x0F ^ 0x55)
--5 19 -5
-Testing that ^ has precedence over *
-select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
-0xFF ^ 0xF0 * 2 (0xFF ^ 0xF0) * 2 0xFF ^ (0xF0 * 2)
-30 30 287
-select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
-2 * 0xFF ^ 0xF0 (2 * 0xFF) ^ 0xF0 2 * (0xFF ^ 0xF0)
-30 270 30
-Testing that ^ has precedence over /
-select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
-0xFF ^ 0xF0 / 2 (0xFF ^ 0xF0) / 2 0xFF ^ (0xF0 / 2)
-7.5000 7.5000 135
-select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
-0xF2 / 2 ^ 0xF0 (0xF2 / 2) ^ 0xF0 0xF2 / (2 ^ 0xF0)
-1.0000 137 1.0000
-Testing that ^ has precedence over %
-select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
-0xFF ^ 0xF0 % 0x20 (0xFF ^ 0xF0) % 0x20 0xFF ^ (0xF0 % 0x20)
-15 15 239
-select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
-0xFF % 0x20 ^ 0xF0 (0xFF % 0x20) ^ 0xF0 0xFF % (0x20 ^ 0xF0)
-47 239 47
-Testing that ^ has precedence over DIV
-select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
-0xFF ^ 0xF0 DIV 2 (0xFF ^ 0xF0) DIV 2 0xFF ^ (0xF0 DIV 2)
-7 7 135
-select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
-0xF2 DIV 2 ^ 0xF0 (0xF2 DIV 2) ^ 0xF0 0xF2 DIV (2 ^ 0xF0)
-1 137 1
-Testing that ^ has precedence over MOD
-select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
-0xFF ^ 0xF0 MOD 0x20 (0xFF ^ 0xF0) MOD 0x20 0xFF ^ (0xF0 MOD 0x20)
-15 15 239
-select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
-0xFF MOD 0x20 ^ 0xF0 (0xFF MOD 0x20) ^ 0xF0 0xFF MOD (0x20 ^ 0xF0)
-47 239 47
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index af22654e330..b70d4235c01 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2756,5 +2756,56 @@ SELECT 1 FROM t1 WHERE a XOR 'a';
1
DROP TABLE t1;
#
+# Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE
+# WITH A COMPOSITE PREFIX INDEX
+#
+create table t1(id int unsigned not null,
+data varchar(2) default null,
+key data_idx (data(1),id)
+) default charset=utf8
+partition by range (id) (
+partition p10 values less than (10),
+partition p20 values less than (20)
+);
+insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
+select id from t1 where data = 'ab' order by id;
+id
+4
+5
+6
+14
+15
+16
+drop table t1;
+create table t1(id int unsigned not null,
+data text default null,
+key data_idx (data(1),id)
+) default charset=utf8
+partition by range (id) (
+partition p10 values less than (10),
+partition p20 values less than (20)
+);
+insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
+select id from t1 where data = 'ab' order by id;
+id
+4
+5
+6
+14
+15
+16
+drop table t1;
+#
+# MDEV-5628: Assertion `! is_set()' or `!is_set() ||
+# (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
+# partitioned table with subquery (MySQL:71630)
+#
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1,t2;
+#
# End of 10.1 tests
#
diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result
index 1dced95b17a..699377751d1 100644
--- a/mysql-test/r/partition_alter.result
+++ b/mysql-test/r/partition_alter.result
@@ -122,3 +122,47 @@ t1 CREATE TABLE `t1` (
PARTITION `p02` ENGINE = MyISAM,
PARTITION `p03` ENGINE = MyISAM)
drop table t1;
+#
+# MDEV-19751 Wrong partitioning by KEY() after key dropped
+#
+create or replace table t1 (pk int, x timestamp(6), primary key (pk, x)) engine innodb
+partition by key() partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+# Inplace for DROP PRIMARY KEY when partitioned by default field list is denied
+alter table t1 drop primary key, drop column x, add primary key (pk), algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+alter table t1 drop primary key, drop column x, add primary key (pk);
+select * from t1 partition (p0);
+pk
+1
+drop table t1;
+create or replace table t1 (pk int not null, x timestamp(6), unique u(pk, x)) engine innodb
+partition by key() partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+# Same for NOT NULL UNIQUE KEY as this is actually primary key
+alter table t1 drop key u, drop column x, add unique (pk), algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+alter table t1 drop key u, drop column x, add unique (pk);
+select * from t1 partition (p0);
+pk
+1
+drop table t1;
+create or replace table t1 (pk int, x timestamp(6), primary key (pk)) engine innodb
+partition by key(pk) partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+# Inplace for DROP PRIMARY KEY when partitioned by explicit field list is allowed
+alter table t1 drop primary key, add primary key (pk, x), algorithm=inplace;
+select * from t1 partition (p0);
+pk x
+1 2000-01-01 00:00:00.000000
+drop table t1;
+create or replace table t1 (k int, x timestamp(6), unique key u (x, k)) engine innodb
+partition by key(k) partitions 2;
+insert into t1 (k, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+# Inplace for DROP KEY is allowed
+alter table t1 drop key u, algorithm=inplace;
+select * from t1 partition (p0);
+k x
+1 2000-01-01 00:00:00.000000
+drop table t1;
+# End of 10.2 tests
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 349e9771367..9052d3ca859 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -851,7 +851,7 @@ partition x2 values in (3, 11, 5, 7) tablespace ts2,
partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
ERROR 42000: Partitioning can not be used stand-alone in query near 'partition by list (a)
partitions 3
-(partition x1 values in (1,2,9,4) tablespace ' at line 1
+(partition x1 values in (1,2,9,4) tablespa...' at line 1
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -885,7 +885,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
-part' at line 6
+p...' at line 6
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -965,7 +965,7 @@ partitions 2
(partition x1 values less than (0), partition x2 values less than (2));
ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ')
partitions 2
-(partition x1 values less than (0), partition x2 values less than' at line 6
+(partition x1 values less than (0), partition x2 values less t...' at line 6
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -1114,7 +1114,7 @@ subpartition by key (a+b)
partition x2 values less than (2) (subpartition x21, subpartition x22));
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 '+b)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
-par' at line 7
+...' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -1284,7 +1284,7 @@ subpartition x22 nodegroup 1)
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
partition x2 values in (3,5,6)
( subpartition x21 nodegroup 0,
-subpartition x' at line 11
+subpartitio...' at line 11
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -1319,7 +1319,7 @@ subpartition x22 engine myisam)
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 'list (a+b)
( partition x1
( subpartition x11 engine myisam,
-subpartition x12 eng' at line 7
+subpartition x12 ...' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
@@ -1337,7 +1337,7 @@ subpartition x22 engine myisam values in (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 'list (a+b)
( partition x1
( subpartition x11 engine myisam values in (0),
-subpar' at line 7
+sub...' at line 7
CREATE TABLE t1 (
a int not null,
b int not null,
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 8c0950e3643..6770b64552f 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -386,33 +386,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
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
-t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL # NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
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
-t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL Create_time NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (0), (1), (2), (3);
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
-t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 NULL Create_time Update_time NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
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
-t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 1 Create_time NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
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
-t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 5 Create_time Update_time NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
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
-t1 InnoDB 10 Dynamic 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Dynamic 8 2048 16384 0 0 0 9 Create_time Update_time NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
partition by key (a)
diff --git a/mysql-test/r/perror-win.result b/mysql-test/r/perror-win.result
index 139b566757f..12200c88d5a 100644
--- a/mysql-test/r/perror-win.result
+++ b/mysql-test/r/perror-win.result
@@ -2,6 +2,6 @@ MySQL 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
+MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d
Win32 error code 1062: The service has not been started.
Illegal error code: 30000
diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result
index 46554442721..e5eb9a083ee 100644
--- a/mysql-test/r/perror.result
+++ b/mysql-test/r/perror.result
@@ -1,5 +1,5 @@
Illegal error code: 10000
-MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
+MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d
MySQL 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!
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 93a150ae424..04931001901 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -341,3 +341,16 @@ RENAME TABLE t1 TO t2;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
# End of 10.1 test
+#
+# MDEV-21258: Can't uninstall plugin if the library file doesn't exist
+#
+insert into mysql.plugin values ("unexisting_plugin", "soname");
+select * from mysql.plugin WHERE name='unexisting_plugin';
+name dl
+unexisting_plugin soname
+UNINSTALL PLUGIN unexisting_plugin;
+select * from mysql.plugin WHERE name='unexisting_plugin';
+name dl
+UNINSTALL PLUGIN unexisting_plugin;
+ERROR 42000: PLUGIN unexisting_plugin does not exist
+# End of 10.2 tests
diff --git a/mysql-test/r/pool_of_threads.result b/mysql-test/r/pool_of_threads.result
index 9c02dfac9cd..5f501eb1b68 100644
--- a/mysql-test/r/pool_of_threads.result
+++ b/mysql-test/r/pool_of_threads.result
@@ -2188,3 +2188,8 @@ sleep(50)
connection extracon;
sleep(5.5)
0
+connect comp_con,localhost,root,,,,,COMPRESS;
+SELECT 1;
+1
+1
+disconnect comp_con;
diff --git a/mysql-test/r/precedence.result b/mysql-test/r/precedence.result
new file mode 100644
index 00000000000..986af631346
--- /dev/null
+++ b/mysql-test/r/precedence.result
@@ -0,0 +1,8020 @@
+create or replace view v1 as select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(NULL is true) AS `NOT NULL IS TRUE`,!(NULL is true) AS `NOT (NULL IS TRUE)`,!NULL is true AS `(NOT NULL) IS TRUE`
+select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE union select * from v1;
+NOT NULL IS TRUE NOT (NULL IS TRUE) (NOT NULL) IS TRUE
+1 1 0
+create or replace view v1 as select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !NULL is true AS `! NULL IS TRUE`,!(NULL is true) AS `! (NULL IS TRUE)`,!NULL is true AS `(! NULL) IS TRUE`
+select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE union select * from v1;
+! NULL IS TRUE ! (NULL IS TRUE) (! NULL) IS TRUE
+0 1 0
+create or replace view v1 as select charset(NOT 2 COLLATE latin1_bin), charset(NOT (2 COLLATE latin1_bin)), charset((NOT 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(!2 collate latin1_bin) AS `charset(NOT 2 COLLATE latin1_bin)`,charset(!2 collate latin1_bin) AS `charset(NOT (2 COLLATE latin1_bin))`,charset((!2) collate latin1_bin) AS `charset((NOT 2) COLLATE latin1_bin)`
+select charset(NOT 2 COLLATE latin1_bin), charset(NOT (2 COLLATE latin1_bin)), charset((NOT 2) COLLATE latin1_bin) union select * from v1;
+charset(NOT 2 COLLATE latin1_bin) charset(NOT (2 COLLATE latin1_bin)) charset((NOT 2) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select NOT 2 IN (0,2), NOT (2 IN (0,2)), (NOT 2) IN (0,2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 not in (0,2) AS `NOT 2 IN (0,2)`,2 not in (0,2) AS `NOT (2 IN (0,2))`,!2 in (0,2) AS `(NOT 2) IN (0,2)`
+select NOT 2 IN (0,2), NOT (2 IN (0,2)), (NOT 2) IN (0,2) union select * from v1;
+NOT 2 IN (0,2) NOT (2 IN (0,2)) (NOT 2) IN (0,2)
+0 0 1
+create or replace view v1 as select NOT 2 OR 3, NOT (2 OR 3), (NOT 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 or 3 AS `NOT 2 OR 3`,!2 and !3 AS `NOT (2 OR 3)`,!2 or 3 AS `(NOT 2) OR 3`
+select NOT 2 OR 3, NOT (2 OR 3), (NOT 2) OR 3 union select * from v1;
+NOT 2 OR 3 NOT (2 OR 3) (NOT 2) OR 3
+1 0 1
+create or replace view v1 as select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 or 3 AS `NOT 2 || 3`,!2 and !3 AS `NOT (2 || 3)`,!2 or 3 AS `(NOT 2) || 3`
+select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3 union select * from v1;
+NOT 2 || 3 NOT (2 || 3) (NOT 2) || 3
+1 0 1
+create or replace view v1 as select NOT 2 AND 0, NOT (2 AND 0), (NOT 2) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 and 0 AS `NOT 2 AND 0`,!2 or !0 AS `NOT (2 AND 0)`,!2 and 0 AS `(NOT 2) AND 0`
+select NOT 2 AND 0, NOT (2 AND 0), (NOT 2) AND 0 union select * from v1;
+NOT 2 AND 0 NOT (2 AND 0) (NOT 2) AND 0
+0 1 0
+create or replace view v1 as select NOT 2 && 0, NOT (2 && 0), (NOT 2) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 and 0 AS `NOT 2 && 0`,!2 or !0 AS `NOT (2 && 0)`,!2 and 0 AS `(NOT 2) && 0`
+select NOT 2 && 0, NOT (2 && 0), (NOT 2) && 0 union select * from v1;
+NOT 2 && 0 NOT (2 && 0) (NOT 2) && 0
+0 1 0
+create or replace view v1 as select NOT 2 = 3, NOT (2 = 3), (NOT 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 AS `NOT 2 = 3`,2 <> 3 AS `NOT (2 = 3)`,!2 = 3 AS `(NOT 2) = 3`
+select NOT 2 = 3, NOT (2 = 3), (NOT 2) = 3 union select * from v1;
+NOT 2 = 3 NOT (2 = 3) (NOT 2) = 3
+1 1 0
+create or replace view v1 as select NOT 2 <=> 3, NOT (2 <=> 3), (NOT 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 <=> 3) AS `NOT 2 <=> 3`,!(2 <=> 3) AS `NOT (2 <=> 3)`,!2 <=> 3 AS `(NOT 2) <=> 3`
+select NOT 2 <=> 3, NOT (2 <=> 3), (NOT 2) <=> 3 union select * from v1;
+NOT 2 <=> 3 NOT (2 <=> 3) (NOT 2) <=> 3
+1 1 0
+create or replace view v1 as select NOT 2 >= 3, NOT (2 >= 3), (NOT 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 AS `NOT 2 >= 3`,2 < 3 AS `NOT (2 >= 3)`,!2 >= 3 AS `(NOT 2) >= 3`
+select NOT 2 >= 3, NOT (2 >= 3), (NOT 2) >= 3 union select * from v1;
+NOT 2 >= 3 NOT (2 >= 3) (NOT 2) >= 3
+1 1 0
+create or replace view v1 as select NOT 2 <= 3, NOT (2 <= 3), (NOT 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 AS `NOT 2 <= 3`,2 > 3 AS `NOT (2 <= 3)`,!2 <= 3 AS `(NOT 2) <= 3`
+select NOT 2 <= 3, NOT (2 <= 3), (NOT 2) <= 3 union select * from v1;
+NOT 2 <= 3 NOT (2 <= 3) (NOT 2) <= 3
+0 0 1
+create or replace view v1 as select NOT 2 < 3, NOT (2 < 3), (NOT 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 AS `NOT 2 < 3`,2 >= 3 AS `NOT (2 < 3)`,!2 < 3 AS `(NOT 2) < 3`
+select NOT 2 < 3, NOT (2 < 3), (NOT 2) < 3 union select * from v1;
+NOT 2 < 3 NOT (2 < 3) (NOT 2) < 3
+0 0 1
+create or replace view v1 as select NOT 2 <> 3, NOT (2 <> 3), (NOT 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 AS `NOT 2 <> 3`,2 = 3 AS `NOT (2 <> 3)`,!2 <> 3 AS `(NOT 2) <> 3`
+select NOT 2 <> 3, NOT (2 <> 3), (NOT 2) <> 3 union select * from v1;
+NOT 2 <> 3 NOT (2 <> 3) (NOT 2) <> 3
+0 0 1
+create or replace view v1 as select NOT 2 > 3, NOT (2 > 3), (NOT 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 AS `NOT 2 > 3`,2 <= 3 AS `NOT (2 > 3)`,!2 > 3 AS `(NOT 2) > 3`
+select NOT 2 > 3, NOT (2 > 3), (NOT 2) > 3 union select * from v1;
+NOT 2 > 3 NOT (2 > 3) (NOT 2) > 3
+1 1 0
+create or replace view v1 as select NOT 2 != 3, NOT (2 != 3), (NOT 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 AS `NOT 2 != 3`,2 = 3 AS `NOT (2 != 3)`,!2 <> 3 AS `(NOT 2) != 3`
+select NOT 2 != 3, NOT (2 != 3), (NOT 2) != 3 union select * from v1;
+NOT 2 != 3 NOT (2 != 3) (NOT 2) != 3
+0 0 1
+create or replace view v1 as select NOT 2 LIKE 3, NOT (2 LIKE 3), (NOT 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 not like 3 AS `NOT 2 LIKE 3`,2 not like 3 AS `NOT (2 LIKE 3)`,!2 like 3 AS `(NOT 2) LIKE 3`
+select NOT 2 LIKE 3, NOT (2 LIKE 3), (NOT 2) LIKE 3 union select * from v1;
+NOT 2 LIKE 3 NOT (2 LIKE 3) (NOT 2) LIKE 3
+1 1 0
+create or replace view v1 as select NOT 2 REGEXP 3, NOT (2 REGEXP 3), (NOT 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 regexp 3) AS `NOT 2 REGEXP 3`,!(2 regexp 3) AS `NOT (2 REGEXP 3)`,!2 regexp 3 AS `(NOT 2) REGEXP 3`
+select NOT 2 REGEXP 3, NOT (2 REGEXP 3), (NOT 2) REGEXP 3 union select * from v1;
+NOT 2 REGEXP 3 NOT (2 REGEXP 3) (NOT 2) REGEXP 3
+1 1 0
+create or replace view v1 as select NOT 2 | 3, NOT (2 | 3), (NOT 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 | 3) AS `NOT 2 | 3`,!(2 | 3) AS `NOT (2 | 3)`,!2 | 3 AS `(NOT 2) | 3`
+select NOT 2 | 3, NOT (2 | 3), (NOT 2) | 3 union select * from v1;
+NOT 2 | 3 NOT (2 | 3) (NOT 2) | 3
+0 0 3
+create or replace view v1 as select NOT 0 & 2, NOT (0 & 2), (NOT 0) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(0 & 2) AS `NOT 0 & 2`,!(0 & 2) AS `NOT (0 & 2)`,!0 & 2 AS `(NOT 0) & 2`
+select NOT 0 & 2, NOT (0 & 2), (NOT 0) & 2 union select * from v1;
+NOT 0 & 2 NOT (0 & 2) (NOT 0) & 2
+1 1 0
+create or replace view v1 as select NOT 0 << 3, NOT (0 << 3), (NOT 0) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(0 << 3) AS `NOT 0 << 3`,!(0 << 3) AS `NOT (0 << 3)`,!0 << 3 AS `(NOT 0) << 3`
+select NOT 0 << 3, NOT (0 << 3), (NOT 0) << 3 union select * from v1;
+NOT 0 << 3 NOT (0 << 3) (NOT 0) << 3
+1 1 8
+create or replace view v1 as select NOT 2 >> 3, NOT (2 >> 3), (NOT 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 >> 3) AS `NOT 2 >> 3`,!(2 >> 3) AS `NOT (2 >> 3)`,!2 >> 3 AS `(NOT 2) >> 3`
+select NOT 2 >> 3, NOT (2 >> 3), (NOT 2) >> 3 union select * from v1;
+NOT 2 >> 3 NOT (2 >> 3) (NOT 2) >> 3
+1 1 0
+create or replace view v1 as select NOT '2000-01-01' +INTERVAL 1 DAY, NOT ('2000-01-01' +INTERVAL 1 DAY), (NOT '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !('2000-01-01' + interval 1 day) AS `NOT '2000-01-01' +INTERVAL 1 DAY`,!('2000-01-01' + interval 1 day) AS `NOT ('2000-01-01' +INTERVAL 1 DAY)`,!'2000-01-01' + interval 1 day AS `(NOT '2000-01-01') +INTERVAL 1 DAY`
+select NOT '2000-01-01' +INTERVAL 1 DAY, NOT ('2000-01-01' +INTERVAL 1 DAY), (NOT '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+NOT '2000-01-01' +INTERVAL 1 DAY NOT ('2000-01-01' +INTERVAL 1 DAY) (NOT '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select NOT 2 + 3, NOT (2 + 3), (NOT 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 + 3) AS `NOT 2 + 3`,!(2 + 3) AS `NOT (2 + 3)`,!2 + 3 AS `(NOT 2) + 3`
+select NOT 2 + 3, NOT (2 + 3), (NOT 2) + 3 union select * from v1;
+NOT 2 + 3 NOT (2 + 3) (NOT 2) + 3
+0 0 3
+create or replace view v1 as select NOT 2 - 3, NOT (2 - 3), (NOT 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 - 3) AS `NOT 2 - 3`,!(2 - 3) AS `NOT (2 - 3)`,!2 - 3 AS `(NOT 2) - 3`
+select NOT 2 - 3, NOT (2 - 3), (NOT 2) - 3 union select * from v1;
+NOT 2 - 3 NOT (2 - 3) (NOT 2) - 3
+0 0 -3
+create or replace view v1 as select NOT 0 * 3, NOT (0 * 3), (NOT 0) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(0 * 3) AS `NOT 0 * 3`,!(0 * 3) AS `NOT (0 * 3)`,!0 * 3 AS `(NOT 0) * 3`
+select NOT 0 * 3, NOT (0 * 3), (NOT 0) * 3 union select * from v1;
+NOT 0 * 3 NOT (0 * 3) (NOT 0) * 3
+1 1 3
+create or replace view v1 as select NOT 0 / 3, NOT (0 / 3), (NOT 0) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(0 / 3) AS `NOT 0 / 3`,!(0 / 3) AS `NOT (0 / 3)`,!0 / 3 AS `(NOT 0) / 3`
+select NOT 0 / 3, NOT (0 / 3), (NOT 0) / 3 union select * from v1;
+NOT 0 / 3 NOT (0 / 3) (NOT 0) / 3
+1 1 0.3333
+create or replace view v1 as select NOT 2 DIV 3, NOT (2 DIV 3), (NOT 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 DIV 3) AS `NOT 2 DIV 3`,!(2 DIV 3) AS `NOT (2 DIV 3)`,!2 DIV 3 AS `(NOT 2) DIV 3`
+select NOT 2 DIV 3, NOT (2 DIV 3), (NOT 2) DIV 3 union select * from v1;
+NOT 2 DIV 3 NOT (2 DIV 3) (NOT 2) DIV 3
+1 1 0
+create or replace view v1 as select NOT 6 MOD 3, NOT (6 MOD 3), (NOT 6) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(6 % 3) AS `NOT 6 MOD 3`,!(6 % 3) AS `NOT (6 MOD 3)`,!6 % 3 AS `(NOT 6) MOD 3`
+select NOT 6 MOD 3, NOT (6 MOD 3), (NOT 6) MOD 3 union select * from v1;
+NOT 6 MOD 3 NOT (6 MOD 3) (NOT 6) MOD 3
+1 1 0
+create or replace view v1 as select NOT 6 % 3, NOT (6 % 3), (NOT 6) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(6 % 3) AS `NOT 6 % 3`,!(6 % 3) AS `NOT (6 % 3)`,!6 % 3 AS `(NOT 6) % 3`
+select NOT 6 % 3, NOT (6 % 3), (NOT 6) % 3 union select * from v1;
+NOT 6 % 3 NOT (6 % 3) (NOT 6) % 3
+1 1 0
+create or replace view v1 as select NOT 2 ^ 3, NOT (2 ^ 3), (NOT 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 ^ 3) AS `NOT 2 ^ 3`,!(2 ^ 3) AS `NOT (2 ^ 3)`,!2 ^ 3 AS `(NOT 2) ^ 3`
+select NOT 2 ^ 3, NOT (2 ^ 3), (NOT 2) ^ 3 union select * from v1;
+NOT 2 ^ 3 NOT (2 ^ 3) (NOT 2) ^ 3
+0 0 3
+create or replace view v1 as select NOT 2 BETWEEN 3 AND 4, NOT (2 BETWEEN 3 AND 4), (NOT 2) BETWEEN 3 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 not between 3 and 4 AS `NOT 2 BETWEEN 3 AND 4`,2 not between 3 and 4 AS `NOT (2 BETWEEN 3 AND 4)`,!2 between 3 and 4 AS `(NOT 2) BETWEEN 3 AND 4`
+select NOT 2 BETWEEN 3 AND 4, NOT (2 BETWEEN 3 AND 4), (NOT 2) BETWEEN 3 AND 4 union select * from v1;
+NOT 2 BETWEEN 3 AND 4 NOT (2 BETWEEN 3 AND 4) (NOT 2) BETWEEN 3 AND 4
+1 1 0
+create or replace view v1 as select - 2 IS TRUE, - (2 IS TRUE), (- 2) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 is true AS `- 2 IS TRUE`,-(2 is true) AS `- (2 IS TRUE)`,-2 is true AS `(- 2) IS TRUE`
+select - 2 IS TRUE, - (2 IS TRUE), (- 2) IS TRUE union select * from v1;
+- 2 IS TRUE - (2 IS TRUE) (- 2) IS TRUE
+1 -1 1
+create or replace view v1 as select charset(- "2" COLLATE latin1_bin), charset(- ("2" COLLATE latin1_bin)), charset((- "2") COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(-'2' collate latin1_bin) AS `charset(- "2" COLLATE latin1_bin)`,charset(-'2' collate latin1_bin) AS `charset(- ("2" COLLATE latin1_bin))`,charset((-'2') collate latin1_bin) AS `charset((- "2") COLLATE latin1_bin)`
+select charset(- "2" COLLATE latin1_bin), charset(- ("2" COLLATE latin1_bin)), charset((- "2") COLLATE latin1_bin) union select * from v1;
+charset(- "2" COLLATE latin1_bin) charset(- ("2" COLLATE latin1_bin)) charset((- "2") COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select - 2 IN (2,1), - (2 IN (2,1)), (- 2) IN (2,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 in (2,1) AS `- 2 IN (2,1)`,-(2 in (2,1)) AS `- (2 IN (2,1))`,-2 in (2,1) AS `(- 2) IN (2,1)`
+select - 2 IN (2,1), - (2 IN (2,1)), (- 2) IN (2,1) union select * from v1;
+- 2 IN (2,1) - (2 IN (2,1)) (- 2) IN (2,1)
+0 -1 0
+create or replace view v1 as select - 2 OR 3, - (2 OR 3), (- 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 or 3 AS `- 2 OR 3`,-(2 or 3) AS `- (2 OR 3)`,-2 or 3 AS `(- 2) OR 3`
+select - 2 OR 3, - (2 OR 3), (- 2) OR 3 union select * from v1;
+- 2 OR 3 - (2 OR 3) (- 2) OR 3
+1 -1 1
+create or replace view v1 as select - 2 || 3, - (2 || 3), (- 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 or 3 AS `- 2 || 3`,-(2 or 3) AS `- (2 || 3)`,-2 or 3 AS `(- 2) || 3`
+select - 2 || 3, - (2 || 3), (- 2) || 3 union select * from v1;
+- 2 || 3 - (2 || 3) (- 2) || 3
+1 -1 1
+create or replace view v1 as select - 0 XOR 3, - (0 XOR 3), (- 0) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 xor 3 AS `- 0 XOR 3`,-(0 xor 3) AS `- (0 XOR 3)`,0 xor 3 AS `(- 0) XOR 3`
+select - 0 XOR 3, - (0 XOR 3), (- 0) XOR 3 union select * from v1;
+- 0 XOR 3 - (0 XOR 3) (- 0) XOR 3
+1 -1 1
+create or replace view v1 as select - 2 AND 3, - (2 AND 3), (- 2) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 and 3 AS `- 2 AND 3`,-(2 and 3) AS `- (2 AND 3)`,-2 and 3 AS `(- 2) AND 3`
+select - 2 AND 3, - (2 AND 3), (- 2) AND 3 union select * from v1;
+- 2 AND 3 - (2 AND 3) (- 2) AND 3
+1 -1 1
+create or replace view v1 as select - 2 && 3, - (2 && 3), (- 2) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 and 3 AS `- 2 && 3`,-(2 and 3) AS `- (2 && 3)`,-2 and 3 AS `(- 2) && 3`
+select - 2 && 3, - (2 && 3), (- 2) && 3 union select * from v1;
+- 2 && 3 - (2 && 3) (- 2) && 3
+1 -1 1
+create or replace view v1 as select - 2 = 2, - (2 = 2), (- 2) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 = 2 AS `- 2 = 2`,-(2 = 2) AS `- (2 = 2)`,-2 = 2 AS `(- 2) = 2`
+select - 2 = 2, - (2 = 2), (- 2) = 2 union select * from v1;
+- 2 = 2 - (2 = 2) (- 2) = 2
+0 -1 0
+create or replace view v1 as select - 2 <=> 2, - (2 <=> 2), (- 2) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 <=> 2 AS `- 2 <=> 2`,-(2 <=> 2) AS `- (2 <=> 2)`,-2 <=> 2 AS `(- 2) <=> 2`
+select - 2 <=> 2, - (2 <=> 2), (- 2) <=> 2 union select * from v1;
+- 2 <=> 2 - (2 <=> 2) (- 2) <=> 2
+0 -1 0
+create or replace view v1 as select - 2 >= 1, - (2 >= 1), (- 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 >= 1 AS `- 2 >= 1`,-(2 >= 1) AS `- (2 >= 1)`,-2 >= 1 AS `(- 2) >= 1`
+select - 2 >= 1, - (2 >= 1), (- 2) >= 1 union select * from v1;
+- 2 >= 1 - (2 >= 1) (- 2) >= 1
+0 -1 0
+create or replace view v1 as select - 2 <= 3, - (2 <= 3), (- 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 <= 3 AS `- 2 <= 3`,-(2 <= 3) AS `- (2 <= 3)`,-2 <= 3 AS `(- 2) <= 3`
+select - 2 <= 3, - (2 <= 3), (- 2) <= 3 union select * from v1;
+- 2 <= 3 - (2 <= 3) (- 2) <= 3
+1 -1 1
+create or replace view v1 as select - 2 < 3, - (2 < 3), (- 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 < 3 AS `- 2 < 3`,-(2 < 3) AS `- (2 < 3)`,-2 < 3 AS `(- 2) < 3`
+select - 2 < 3, - (2 < 3), (- 2) < 3 union select * from v1;
+- 2 < 3 - (2 < 3) (- 2) < 3
+1 -1 1
+create or replace view v1 as select - 2 <> 3, - (2 <> 3), (- 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 <> 3 AS `- 2 <> 3`,-(2 <> 3) AS `- (2 <> 3)`,-2 <> 3 AS `(- 2) <> 3`
+select - 2 <> 3, - (2 <> 3), (- 2) <> 3 union select * from v1;
+- 2 <> 3 - (2 <> 3) (- 2) <> 3
+1 -1 1
+create or replace view v1 as select - 2 > 1, - (2 > 1), (- 2) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 > 1 AS `- 2 > 1`,-(2 > 1) AS `- (2 > 1)`,-2 > 1 AS `(- 2) > 1`
+select - 2 > 1, - (2 > 1), (- 2) > 1 union select * from v1;
+- 2 > 1 - (2 > 1) (- 2) > 1
+0 -1 0
+create or replace view v1 as select - 2 != 3, - (2 != 3), (- 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 <> 3 AS `- 2 != 3`,-(2 <> 3) AS `- (2 != 3)`,-2 <> 3 AS `(- 2) != 3`
+select - 2 != 3, - (2 != 3), (- 2) != 3 union select * from v1;
+- 2 != 3 - (2 != 3) (- 2) != 3
+1 -1 1
+create or replace view v1 as select - 2 LIKE 2, - (2 LIKE 2), (- 2) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 like 2 AS `- 2 LIKE 2`,-(2 like 2) AS `- (2 LIKE 2)`,-2 like 2 AS `(- 2) LIKE 2`
+select - 2 LIKE 2, - (2 LIKE 2), (- 2) LIKE 2 union select * from v1;
+- 2 LIKE 2 - (2 LIKE 2) (- 2) LIKE 2
+0 -1 0
+create or replace view v1 as select - 2 REGEXP 2, - (2 REGEXP 2), (- 2) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 regexp 2 AS `- 2 REGEXP 2`,-(2 regexp 2) AS `- (2 REGEXP 2)`,-2 regexp 2 AS `(- 2) REGEXP 2`
+select - 2 REGEXP 2, - (2 REGEXP 2), (- 2) REGEXP 2 union select * from v1;
+- 2 REGEXP 2 - (2 REGEXP 2) (- 2) REGEXP 2
+1 -1 1
+create or replace view v1 as select - 2 | 3, - (2 | 3), (- 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 | 3 AS `- 2 | 3`,-(2 | 3) AS `- (2 | 3)`,-2 | 3 AS `(- 2) | 3`
+select - 2 | 3, - (2 | 3), (- 2) | 3 union select * from v1;
+- 2 | 3 - (2 | 3) (- 2) | 3
+18446744073709551615 -3 18446744073709551615
+create or replace view v1 as select - 2 & 3, - (2 & 3), (- 2) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 & 3 AS `- 2 & 3`,-(2 & 3) AS `- (2 & 3)`,-2 & 3 AS `(- 2) & 3`
+select - 2 & 3, - (2 & 3), (- 2) & 3 union select * from v1;
+- 2 & 3 - (2 & 3) (- 2) & 3
+2 -2 2
+create or replace view v1 as select - 2 << 3, - (2 << 3), (- 2) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 << 3 AS `- 2 << 3`,-(2 << 3) AS `- (2 << 3)`,-2 << 3 AS `(- 2) << 3`
+select - 2 << 3, - (2 << 3), (- 2) << 3 union select * from v1;
+- 2 << 3 - (2 << 3) (- 2) << 3
+18446744073709551600 -16 18446744073709551600
+create or replace view v1 as select - 2 >> 3, - (2 >> 3), (- 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 >> 3 AS `- 2 >> 3`,-(2 >> 3) AS `- (2 >> 3)`,-2 >> 3 AS `(- 2) >> 3`
+select - 2 >> 3, - (2 >> 3), (- 2) >> 3 union select * from v1;
+- 2 >> 3 - (2 >> 3) (- 2) >> 3
+2305843009213693951 0 2305843009213693951
+create or replace view v1 as select - '2000-01-01' +INTERVAL 1 DAY, - ('2000-01-01' +INTERVAL 1 DAY), (- '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -'2000-01-01' + interval 1 day AS `- '2000-01-01' +INTERVAL 1 DAY`,-('2000-01-01' + interval 1 day) AS `- ('2000-01-01' +INTERVAL 1 DAY)`,-'2000-01-01' + interval 1 day AS `(- '2000-01-01') +INTERVAL 1 DAY`
+select - '2000-01-01' +INTERVAL 1 DAY, - ('2000-01-01' +INTERVAL 1 DAY), (- '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+- '2000-01-01' +INTERVAL 1 DAY - ('2000-01-01' +INTERVAL 1 DAY) (- '2000-01-01') +INTERVAL 1 DAY
+NULL -20000102 NULL
+create or replace view v1 as select - 2 + 3, - (2 + 3), (- 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 + 3 AS `- 2 + 3`,-(2 + 3) AS `- (2 + 3)`,-2 + 3 AS `(- 2) + 3`
+select - 2 + 3, - (2 + 3), (- 2) + 3 union select * from v1;
+- 2 + 3 - (2 + 3) (- 2) + 3
+1 -5 1
+create or replace view v1 as select - 2 - 3, - (2 - 3), (- 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 - 3 AS `- 2 - 3`,-(2 - 3) AS `- (2 - 3)`,-2 - 3 AS `(- 2) - 3`
+select - 2 - 3, - (2 - 3), (- 2) - 3 union select * from v1;
+- 2 - 3 - (2 - 3) (- 2) - 3
+-5 1 -5
+create or replace view v1 as select - 2 ^ 3, - (2 ^ 3), (- 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 ^ 3 AS `- 2 ^ 3`,-(2 ^ 3) AS `- (2 ^ 3)`,-2 ^ 3 AS `(- 2) ^ 3`
+select - 2 ^ 3, - (2 ^ 3), (- 2) ^ 3 union select * from v1;
+- 2 ^ 3 - (2 ^ 3) (- 2) ^ 3
+18446744073709551613 -1 18446744073709551613
+create or replace view v1 as select - 2 BETWEEN 1 AND 3, - (2 BETWEEN 1 AND 3), (- 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 between 1 and 3 AS `- 2 BETWEEN 1 AND 3`,-(2 between 1 and 3) AS `- (2 BETWEEN 1 AND 3)`,-2 between 1 and 3 AS `(- 2) BETWEEN 1 AND 3`
+select - 2 BETWEEN 1 AND 3, - (2 BETWEEN 1 AND 3), (- 2) BETWEEN 1 AND 3 union select * from v1;
+- 2 BETWEEN 1 AND 3 - (2 BETWEEN 1 AND 3) (- 2) BETWEEN 1 AND 3
+0 -1 0
+create or replace view v1 as select ~ 2 IS TRUE, ~ (2 IS TRUE), (~ 2) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 is true AS `~ 2 IS TRUE`,~(2 is true) AS `~ (2 IS TRUE)`,~2 is true AS `(~ 2) IS TRUE`
+select ~ 2 IS TRUE, ~ (2 IS TRUE), (~ 2) IS TRUE union select * from v1;
+~ 2 IS TRUE ~ (2 IS TRUE) (~ 2) IS TRUE
+1 18446744073709551614 1
+create or replace view v1 as select charset(~ 2 COLLATE latin1_bin), charset(~ (2 COLLATE latin1_bin)), charset((~ 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(~2 collate latin1_bin) AS `charset(~ 2 COLLATE latin1_bin)`,charset(~2 collate latin1_bin) AS `charset(~ (2 COLLATE latin1_bin))`,charset((~2) collate latin1_bin) AS `charset((~ 2) COLLATE latin1_bin)`
+select charset(~ 2 COLLATE latin1_bin), charset(~ (2 COLLATE latin1_bin)), charset((~ 2) COLLATE latin1_bin) union select * from v1;
+charset(~ 2 COLLATE latin1_bin) charset(~ (2 COLLATE latin1_bin)) charset((~ 2) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select ~ 2 IN (0,1), ~ (2 IN (0,1)), (~ 2) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 in (0,1) AS `~ 2 IN (0,1)`,~(2 in (0,1)) AS `~ (2 IN (0,1))`,~2 in (0,1) AS `(~ 2) IN (0,1)`
+select ~ 2 IN (0,1), ~ (2 IN (0,1)), (~ 2) IN (0,1) union select * from v1;
+~ 2 IN (0,1) ~ (2 IN (0,1)) (~ 2) IN (0,1)
+0 18446744073709551615 0
+create or replace view v1 as select ~ 2 OR 3, ~ (2 OR 3), (~ 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 or 3 AS `~ 2 OR 3`,~(2 or 3) AS `~ (2 OR 3)`,~2 or 3 AS `(~ 2) OR 3`
+select ~ 2 OR 3, ~ (2 OR 3), (~ 2) OR 3 union select * from v1;
+~ 2 OR 3 ~ (2 OR 3) (~ 2) OR 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 or 3 AS `~ 2 || 3`,~(2 or 3) AS `~ (2 || 3)`,~2 or 3 AS `(~ 2) || 3`
+select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3 union select * from v1;
+~ 2 || 3 ~ (2 || 3) (~ 2) || 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 XOR 3, ~ (2 XOR 3), (~ 2) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 xor 3 AS `~ 2 XOR 3`,~(2 xor 3) AS `~ (2 XOR 3)`,~2 xor 3 AS `(~ 2) XOR 3`
+select ~ 2 XOR 3, ~ (2 XOR 3), (~ 2) XOR 3 union select * from v1;
+~ 2 XOR 3 ~ (2 XOR 3) (~ 2) XOR 3
+0 18446744073709551615 0
+create or replace view v1 as select ~ 2 AND 3, ~ (2 AND 3), (~ 2) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 and 3 AS `~ 2 AND 3`,~(2 and 3) AS `~ (2 AND 3)`,~2 and 3 AS `(~ 2) AND 3`
+select ~ 2 AND 3, ~ (2 AND 3), (~ 2) AND 3 union select * from v1;
+~ 2 AND 3 ~ (2 AND 3) (~ 2) AND 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 && 3, ~ (2 && 3), (~ 2) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 and 3 AS `~ 2 && 3`,~(2 and 3) AS `~ (2 && 3)`,~2 and 3 AS `(~ 2) && 3`
+select ~ 2 && 3, ~ (2 && 3), (~ 2) && 3 union select * from v1;
+~ 2 && 3 ~ (2 && 3) (~ 2) && 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 = 3, ~ (2 = 3), (~ 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 = 3 AS `~ 2 = 3`,~(2 = 3) AS `~ (2 = 3)`,~2 = 3 AS `(~ 2) = 3`
+select ~ 2 = 3, ~ (2 = 3), (~ 2) = 3 union select * from v1;
+~ 2 = 3 ~ (2 = 3) (~ 2) = 3
+0 18446744073709551615 0
+create or replace view v1 as select ~ 2 <=> 3, ~ (2 <=> 3), (~ 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 <=> 3 AS `~ 2 <=> 3`,~(2 <=> 3) AS `~ (2 <=> 3)`,~2 <=> 3 AS `(~ 2) <=> 3`
+select ~ 2 <=> 3, ~ (2 <=> 3), (~ 2) <=> 3 union select * from v1;
+~ 2 <=> 3 ~ (2 <=> 3) (~ 2) <=> 3
+0 18446744073709551615 0
+create or replace view v1 as select ~ 2 >= 3, ~ (2 >= 3), (~ 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 >= 3 AS `~ 2 >= 3`,~(2 >= 3) AS `~ (2 >= 3)`,~2 >= 3 AS `(~ 2) >= 3`
+select ~ 2 >= 3, ~ (2 >= 3), (~ 2) >= 3 union select * from v1;
+~ 2 >= 3 ~ (2 >= 3) (~ 2) >= 3
+1 18446744073709551615 1
+create or replace view v1 as select ~ 2 <= 3, ~ (2 <= 3), (~ 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 <= 3 AS `~ 2 <= 3`,~(2 <= 3) AS `~ (2 <= 3)`,~2 <= 3 AS `(~ 2) <= 3`
+select ~ 2 <= 3, ~ (2 <= 3), (~ 2) <= 3 union select * from v1;
+~ 2 <= 3 ~ (2 <= 3) (~ 2) <= 3
+0 18446744073709551614 0
+create or replace view v1 as select ~ 2 < 3, ~ (2 < 3), (~ 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 < 3 AS `~ 2 < 3`,~(2 < 3) AS `~ (2 < 3)`,~2 < 3 AS `(~ 2) < 3`
+select ~ 2 < 3, ~ (2 < 3), (~ 2) < 3 union select * from v1;
+~ 2 < 3 ~ (2 < 3) (~ 2) < 3
+0 18446744073709551614 0
+create or replace view v1 as select ~ 2 <> 3, ~ (2 <> 3), (~ 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 <> 3 AS `~ 2 <> 3`,~(2 <> 3) AS `~ (2 <> 3)`,~2 <> 3 AS `(~ 2) <> 3`
+select ~ 2 <> 3, ~ (2 <> 3), (~ 2) <> 3 union select * from v1;
+~ 2 <> 3 ~ (2 <> 3) (~ 2) <> 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 > 3, ~ (2 > 3), (~ 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 > 3 AS `~ 2 > 3`,~(2 > 3) AS `~ (2 > 3)`,~2 > 3 AS `(~ 2) > 3`
+select ~ 2 > 3, ~ (2 > 3), (~ 2) > 3 union select * from v1;
+~ 2 > 3 ~ (2 > 3) (~ 2) > 3
+1 18446744073709551615 1
+create or replace view v1 as select ~ 2 != 3, ~ (2 != 3), (~ 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 <> 3 AS `~ 2 != 3`,~(2 <> 3) AS `~ (2 != 3)`,~2 <> 3 AS `(~ 2) != 3`
+select ~ 2 != 3, ~ (2 != 3), (~ 2) != 3 union select * from v1;
+~ 2 != 3 ~ (2 != 3) (~ 2) != 3
+1 18446744073709551614 1
+create or replace view v1 as select ~ 2 LIKE 3, ~ (2 LIKE 3), (~ 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 like 3 AS `~ 2 LIKE 3`,~(2 like 3) AS `~ (2 LIKE 3)`,~2 like 3 AS `(~ 2) LIKE 3`
+select ~ 2 LIKE 3, ~ (2 LIKE 3), (~ 2) LIKE 3 union select * from v1;
+~ 2 LIKE 3 ~ (2 LIKE 3) (~ 2) LIKE 3
+0 18446744073709551615 0
+create or replace view v1 as select ~ 2 REGEXP 3, ~ (2 REGEXP 3), (~ 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 regexp 3 AS `~ 2 REGEXP 3`,~(2 regexp 3) AS `~ (2 REGEXP 3)`,~2 regexp 3 AS `(~ 2) REGEXP 3`
+select ~ 2 REGEXP 3, ~ (2 REGEXP 3), (~ 2) REGEXP 3 union select * from v1;
+~ 2 REGEXP 3 ~ (2 REGEXP 3) (~ 2) REGEXP 3
+1 18446744073709551615 1
+create or replace view v1 as select ~ 2 | 3, ~ (2 | 3), (~ 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 | 3 AS `~ 2 | 3`,~(2 | 3) AS `~ (2 | 3)`,~2 | 3 AS `(~ 2) | 3`
+select ~ 2 | 3, ~ (2 | 3), (~ 2) | 3 union select * from v1;
+~ 2 | 3 ~ (2 | 3) (~ 2) | 3
+18446744073709551615 18446744073709551612 18446744073709551615
+create or replace view v1 as select ~ 2 & 3, ~ (2 & 3), (~ 2) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 & 3 AS `~ 2 & 3`,~(2 & 3) AS `~ (2 & 3)`,~2 & 3 AS `(~ 2) & 3`
+select ~ 2 & 3, ~ (2 & 3), (~ 2) & 3 union select * from v1;
+~ 2 & 3 ~ (2 & 3) (~ 2) & 3
+1 18446744073709551613 1
+create or replace view v1 as select ~ 2 << 3, ~ (2 << 3), (~ 2) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 << 3 AS `~ 2 << 3`,~(2 << 3) AS `~ (2 << 3)`,~2 << 3 AS `(~ 2) << 3`
+select ~ 2 << 3, ~ (2 << 3), (~ 2) << 3 union select * from v1;
+~ 2 << 3 ~ (2 << 3) (~ 2) << 3
+18446744073709551592 18446744073709551599 18446744073709551592
+create or replace view v1 as select ~ 2 >> 3, ~ (2 >> 3), (~ 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 >> 3 AS `~ 2 >> 3`,~(2 >> 3) AS `~ (2 >> 3)`,~2 >> 3 AS `(~ 2) >> 3`
+select ~ 2 >> 3, ~ (2 >> 3), (~ 2) >> 3 union select * from v1;
+~ 2 >> 3 ~ (2 >> 3) (~ 2) >> 3
+2305843009213693951 18446744073709551615 2305843009213693951
+create or replace view v1 as select ~ '2000-01-01' +INTERVAL 1 DAY, ~ ('2000-01-01' +INTERVAL 1 DAY), (~ '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~'2000-01-01' + interval 1 day AS `~ '2000-01-01' +INTERVAL 1 DAY`,~('2000-01-01' + interval 1 day) AS `~ ('2000-01-01' +INTERVAL 1 DAY)`,~'2000-01-01' + interval 1 day AS `(~ '2000-01-01') +INTERVAL 1 DAY`
+select ~ '2000-01-01' +INTERVAL 1 DAY, ~ ('2000-01-01' +INTERVAL 1 DAY), (~ '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+~ '2000-01-01' +INTERVAL 1 DAY ~ ('2000-01-01' +INTERVAL 1 DAY) (~ '2000-01-01') +INTERVAL 1 DAY
+NULL 18446744073689551513 NULL
+create or replace view v1 as select ~ 10000 + 3, ~ (10000 + 3), (~ 10000) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~10000 + 3 AS `~ 10000 + 3`,~(10000 + 3) AS `~ (10000 + 3)`,~10000 + 3 AS `(~ 10000) + 3`
+select ~ 10000 + 3, ~ (10000 + 3), (~ 10000) + 3 union select * from v1;
+~ 10000 + 3 ~ (10000 + 3) (~ 10000) + 3
+18446744073709541618 18446744073709541612 18446744073709541618
+create or replace view v1 as select ~ 2 - 3, ~ (2 - 3), (~ 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 - 3 AS `~ 2 - 3`,~(2 - 3) AS `~ (2 - 3)`,~2 - 3 AS `(~ 2) - 3`
+select ~ 2 - 3, ~ (2 - 3), (~ 2) - 3 union select * from v1;
+~ 2 - 3 ~ (2 - 3) (~ 2) - 3
+18446744073709551610 0 18446744073709551610
+create or replace view v1 as select ~ 10000000000000000000 * 2, ~ (100 * 2), (~ 10000000000000000000) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~10000000000000000000 * 2 AS `~ 10000000000000000000 * 2`,~(100 * 2) AS `~ (100 * 2)`,~10000000000000000000 * 2 AS `(~ 10000000000000000000) * 2`
+select ~ 10000000000000000000 * 2, ~ (100 * 2), (~ 10000000000000000000) * 2 union select * from v1;
+~ 10000000000000000000 * 2 ~ (100 * 2) (~ 10000000000000000000) * 2
+16893488147419103230 18446744073709551415 16893488147419103230
+create or replace view v1 as select ~ 2 / 3, ~ (2 / 3), (~ 2) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 / 3 AS `~ 2 / 3`,~(2 / 3) AS `~ (2 / 3)`,~2 / 3 AS `(~ 2) / 3`
+select ~ 2 / 3, ~ (2 / 3), (~ 2) / 3 union select * from v1;
+~ 2 / 3 ~ (2 / 3) (~ 2) / 3
+6148914691236517204.3333 18446744073709551614 6148914691236517204.3333
+create or replace view v1 as select ~ 2 DIV 3, ~ (2 DIV 3), (~ 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 DIV 3 AS `~ 2 DIV 3`,~(2 DIV 3) AS `~ (2 DIV 3)`,~2 DIV 3 AS `(~ 2) DIV 3`
+select ~ 2 DIV 3, ~ (2 DIV 3), (~ 2) DIV 3 union select * from v1;
+~ 2 DIV 3 ~ (2 DIV 3) (~ 2) DIV 3
+6148914691236517204 18446744073709551615 6148914691236517204
+create or replace view v1 as select ~ 2 MOD 3, ~ (2 MOD 3), (~ 2) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 % 3 AS `~ 2 MOD 3`,~(2 % 3) AS `~ (2 MOD 3)`,~2 % 3 AS `(~ 2) MOD 3`
+select ~ 2 MOD 3, ~ (2 MOD 3), (~ 2) MOD 3 union select * from v1;
+~ 2 MOD 3 ~ (2 MOD 3) (~ 2) MOD 3
+1 18446744073709551613 1
+create or replace view v1 as select ~ 2 % 3, ~ (2 % 3), (~ 2) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 % 3 AS `~ 2 % 3`,~(2 % 3) AS `~ (2 % 3)`,~2 % 3 AS `(~ 2) % 3`
+select ~ 2 % 3, ~ (2 % 3), (~ 2) % 3 union select * from v1;
+~ 2 % 3 ~ (2 % 3) (~ 2) % 3
+1 18446744073709551613 1
+create or replace view v1 as select ~ 2 BETWEEN 1 AND 3, ~ (2 BETWEEN 1 AND 3), (~ 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 between 1 and 3 AS `~ 2 BETWEEN 1 AND 3`,~(2 between 1 and 3) AS `~ (2 BETWEEN 1 AND 3)`,~2 between 1 and 3 AS `(~ 2) BETWEEN 1 AND 3`
+select ~ 2 BETWEEN 1 AND 3, ~ (2 BETWEEN 1 AND 3), (~ 2) BETWEEN 1 AND 3 union select * from v1;
+~ 2 BETWEEN 1 AND 3 ~ (2 BETWEEN 1 AND 3) (~ 2) BETWEEN 1 AND 3
+0 18446744073709551614 0
+create or replace view v1 as select charset(! 2 COLLATE latin1_bin), charset(! (2 COLLATE latin1_bin)), charset((! 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(!2 collate latin1_bin) AS `charset(! 2 COLLATE latin1_bin)`,charset(!2 collate latin1_bin) AS `charset(! (2 COLLATE latin1_bin))`,charset((!2) collate latin1_bin) AS `charset((! 2) COLLATE latin1_bin)`
+select charset(! 2 COLLATE latin1_bin), charset(! (2 COLLATE latin1_bin)), charset((! 2) COLLATE latin1_bin) union select * from v1;
+charset(! 2 COLLATE latin1_bin) charset(! (2 COLLATE latin1_bin)) charset((! 2) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select ! 2 IN (0,2), ! (2 IN (0,2)), (! 2) IN (0,2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 in (0,2) AS `! 2 IN (0,2)`,2 not in (0,2) AS `! (2 IN (0,2))`,!2 in (0,2) AS `(! 2) IN (0,2)`
+select ! 2 IN (0,2), ! (2 IN (0,2)), (! 2) IN (0,2) union select * from v1;
+! 2 IN (0,2) ! (2 IN (0,2)) (! 2) IN (0,2)
+1 0 1
+create or replace view v1 as select ! 2 OR 3, ! (2 OR 3), (! 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 or 3 AS `! 2 OR 3`,!2 and !3 AS `! (2 OR 3)`,!2 or 3 AS `(! 2) OR 3`
+select ! 2 OR 3, ! (2 OR 3), (! 2) OR 3 union select * from v1;
+! 2 OR 3 ! (2 OR 3) (! 2) OR 3
+1 0 1
+create or replace view v1 as select ! 2 || 3, ! (2 || 3), (! 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 or 3 AS `! 2 || 3`,!2 and !3 AS `! (2 || 3)`,!2 or 3 AS `(! 2) || 3`
+select ! 2 || 3, ! (2 || 3), (! 2) || 3 union select * from v1;
+! 2 || 3 ! (2 || 3) (! 2) || 3
+1 0 1
+create or replace view v1 as select ! 2 AND 0, ! (2 AND 0), (! 2) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 and 0 AS `! 2 AND 0`,!2 or !0 AS `! (2 AND 0)`,!2 and 0 AS `(! 2) AND 0`
+select ! 2 AND 0, ! (2 AND 0), (! 2) AND 0 union select * from v1;
+! 2 AND 0 ! (2 AND 0) (! 2) AND 0
+0 1 0
+create or replace view v1 as select ! 2 && 0, ! (2 && 0), (! 2) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 and 0 AS `! 2 && 0`,!2 or !0 AS `! (2 && 0)`,!2 and 0 AS `(! 2) && 0`
+select ! 2 && 0, ! (2 && 0), (! 2) && 0 union select * from v1;
+! 2 && 0 ! (2 && 0) (! 2) && 0
+0 1 0
+create or replace view v1 as select ! 2 = 3, ! (2 = 3), (! 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 = 3 AS `! 2 = 3`,2 <> 3 AS `! (2 = 3)`,!2 = 3 AS `(! 2) = 3`
+select ! 2 = 3, ! (2 = 3), (! 2) = 3 union select * from v1;
+! 2 = 3 ! (2 = 3) (! 2) = 3
+0 1 0
+create or replace view v1 as select ! 2 <=> 3, ! (2 <=> 3), (! 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 <=> 3 AS `! 2 <=> 3`,!(2 <=> 3) AS `! (2 <=> 3)`,!2 <=> 3 AS `(! 2) <=> 3`
+select ! 2 <=> 3, ! (2 <=> 3), (! 2) <=> 3 union select * from v1;
+! 2 <=> 3 ! (2 <=> 3) (! 2) <=> 3
+0 1 0
+create or replace view v1 as select ! 2 >= 3, ! (2 >= 3), (! 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 >= 3 AS `! 2 >= 3`,2 < 3 AS `! (2 >= 3)`,!2 >= 3 AS `(! 2) >= 3`
+select ! 2 >= 3, ! (2 >= 3), (! 2) >= 3 union select * from v1;
+! 2 >= 3 ! (2 >= 3) (! 2) >= 3
+0 1 0
+create or replace view v1 as select ! 2 <= 3, ! (2 <= 3), (! 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 <= 3 AS `! 2 <= 3`,2 > 3 AS `! (2 <= 3)`,!2 <= 3 AS `(! 2) <= 3`
+select ! 2 <= 3, ! (2 <= 3), (! 2) <= 3 union select * from v1;
+! 2 <= 3 ! (2 <= 3) (! 2) <= 3
+1 0 1
+create or replace view v1 as select ! 2 < 3, ! (2 < 3), (! 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 < 3 AS `! 2 < 3`,2 >= 3 AS `! (2 < 3)`,!2 < 3 AS `(! 2) < 3`
+select ! 2 < 3, ! (2 < 3), (! 2) < 3 union select * from v1;
+! 2 < 3 ! (2 < 3) (! 2) < 3
+1 0 1
+create or replace view v1 as select ! 2 <> 3, ! (2 <> 3), (! 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 <> 3 AS `! 2 <> 3`,2 = 3 AS `! (2 <> 3)`,!2 <> 3 AS `(! 2) <> 3`
+select ! 2 <> 3, ! (2 <> 3), (! 2) <> 3 union select * from v1;
+! 2 <> 3 ! (2 <> 3) (! 2) <> 3
+1 0 1
+create or replace view v1 as select ! 2 > 3, ! (2 > 3), (! 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 > 3 AS `! 2 > 3`,2 <= 3 AS `! (2 > 3)`,!2 > 3 AS `(! 2) > 3`
+select ! 2 > 3, ! (2 > 3), (! 2) > 3 union select * from v1;
+! 2 > 3 ! (2 > 3) (! 2) > 3
+0 1 0
+create or replace view v1 as select ! 2 != 3, ! (2 != 3), (! 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 <> 3 AS `! 2 != 3`,2 = 3 AS `! (2 != 3)`,!2 <> 3 AS `(! 2) != 3`
+select ! 2 != 3, ! (2 != 3), (! 2) != 3 union select * from v1;
+! 2 != 3 ! (2 != 3) (! 2) != 3
+1 0 1
+create or replace view v1 as select ! 2 LIKE 3, ! (2 LIKE 3), (! 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 like 3 AS `! 2 LIKE 3`,2 not like 3 AS `! (2 LIKE 3)`,!2 like 3 AS `(! 2) LIKE 3`
+select ! 2 LIKE 3, ! (2 LIKE 3), (! 2) LIKE 3 union select * from v1;
+! 2 LIKE 3 ! (2 LIKE 3) (! 2) LIKE 3
+0 1 0
+create or replace view v1 as select ! 2 REGEXP 3, ! (2 REGEXP 3), (! 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 regexp 3 AS `! 2 REGEXP 3`,!(2 regexp 3) AS `! (2 REGEXP 3)`,!2 regexp 3 AS `(! 2) REGEXP 3`
+select ! 2 REGEXP 3, ! (2 REGEXP 3), (! 2) REGEXP 3 union select * from v1;
+! 2 REGEXP 3 ! (2 REGEXP 3) (! 2) REGEXP 3
+0 1 0
+create or replace view v1 as select ! 2 | 3, ! (2 | 3), (! 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 | 3 AS `! 2 | 3`,!(2 | 3) AS `! (2 | 3)`,!2 | 3 AS `(! 2) | 3`
+select ! 2 | 3, ! (2 | 3), (! 2) | 3 union select * from v1;
+! 2 | 3 ! (2 | 3) (! 2) | 3
+3 0 3
+create or replace view v1 as select ! 2 & 0, ! (2 & 0), (! 2) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 & 0 AS `! 2 & 0`,!(2 & 0) AS `! (2 & 0)`,!2 & 0 AS `(! 2) & 0`
+select ! 2 & 0, ! (2 & 0), (! 2) & 0 union select * from v1;
+! 2 & 0 ! (2 & 0) (! 2) & 0
+0 1 0
+create or replace view v1 as select ! 0 << 3, ! (0 << 3), (! 0) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !0 << 3 AS `! 0 << 3`,!(0 << 3) AS `! (0 << 3)`,!0 << 3 AS `(! 0) << 3`
+select ! 0 << 3, ! (0 << 3), (! 0) << 3 union select * from v1;
+! 0 << 3 ! (0 << 3) (! 0) << 3
+8 1 8
+create or replace view v1 as select ! 2 >> 3, ! (2 >> 3), (! 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 >> 3 AS `! 2 >> 3`,!(2 >> 3) AS `! (2 >> 3)`,!2 >> 3 AS `(! 2) >> 3`
+select ! 2 >> 3, ! (2 >> 3), (! 2) >> 3 union select * from v1;
+! 2 >> 3 ! (2 >> 3) (! 2) >> 3
+0 1 0
+create or replace view v1 as select ! '2000-01-01' +INTERVAL 1 DAY, ! ('2000-01-01' +INTERVAL 1 DAY), (! '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !'2000-01-01' + interval 1 day AS `! '2000-01-01' +INTERVAL 1 DAY`,!('2000-01-01' + interval 1 day) AS `! ('2000-01-01' +INTERVAL 1 DAY)`,!'2000-01-01' + interval 1 day AS `(! '2000-01-01') +INTERVAL 1 DAY`
+select ! '2000-01-01' +INTERVAL 1 DAY, ! ('2000-01-01' +INTERVAL 1 DAY), (! '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+! '2000-01-01' +INTERVAL 1 DAY ! ('2000-01-01' +INTERVAL 1 DAY) (! '2000-01-01') +INTERVAL 1 DAY
+NULL 0 NULL
+create or replace view v1 as select ! 2 + 3, ! (2 + 3), (! 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 + 3 AS `! 2 + 3`,!(2 + 3) AS `! (2 + 3)`,!2 + 3 AS `(! 2) + 3`
+select ! 2 + 3, ! (2 + 3), (! 2) + 3 union select * from v1;
+! 2 + 3 ! (2 + 3) (! 2) + 3
+3 0 3
+create or replace view v1 as select ! 2 - 3, ! (2 - 3), (! 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 - 3 AS `! 2 - 3`,!(2 - 3) AS `! (2 - 3)`,!2 - 3 AS `(! 2) - 3`
+select ! 2 - 3, ! (2 - 3), (! 2) - 3 union select * from v1;
+! 2 - 3 ! (2 - 3) (! 2) - 3
+-3 0 -3
+create or replace view v1 as select ! 0 * 3, ! (0 * 3), (! 0) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !0 * 3 AS `! 0 * 3`,!(0 * 3) AS `! (0 * 3)`,!0 * 3 AS `(! 0) * 3`
+select ! 0 * 3, ! (0 * 3), (! 0) * 3 union select * from v1;
+! 0 * 3 ! (0 * 3) (! 0) * 3
+3 1 3
+create or replace view v1 as select ! 0 / 3, ! (0 / 3), (! 0) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !0 / 3 AS `! 0 / 3`,!(0 / 3) AS `! (0 / 3)`,!0 / 3 AS `(! 0) / 3`
+select ! 0 / 3, ! (0 / 3), (! 0) / 3 union select * from v1;
+! 0 / 3 ! (0 / 3) (! 0) / 3
+0.3333 1 0.3333
+create or replace view v1 as select ! 2 DIV 3, ! (2 DIV 3), (! 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 DIV 3 AS `! 2 DIV 3`,!(2 DIV 3) AS `! (2 DIV 3)`,!2 DIV 3 AS `(! 2) DIV 3`
+select ! 2 DIV 3, ! (2 DIV 3), (! 2) DIV 3 union select * from v1;
+! 2 DIV 3 ! (2 DIV 3) (! 2) DIV 3
+0 1 0
+create or replace view v1 as select ! 6 MOD 3, ! (6 MOD 3), (! 6) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !6 % 3 AS `! 6 MOD 3`,!(6 % 3) AS `! (6 MOD 3)`,!6 % 3 AS `(! 6) MOD 3`
+select ! 6 MOD 3, ! (6 MOD 3), (! 6) MOD 3 union select * from v1;
+! 6 MOD 3 ! (6 MOD 3) (! 6) MOD 3
+0 1 0
+create or replace view v1 as select ! 6 % 3, ! (6 % 3), (! 6) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !6 % 3 AS `! 6 % 3`,!(6 % 3) AS `! (6 % 3)`,!6 % 3 AS `(! 6) % 3`
+select ! 6 % 3, ! (6 % 3), (! 6) % 3 union select * from v1;
+! 6 % 3 ! (6 % 3) (! 6) % 3
+0 1 0
+create or replace view v1 as select ! 2 ^ 3, ! (2 ^ 3), (! 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 ^ 3 AS `! 2 ^ 3`,!(2 ^ 3) AS `! (2 ^ 3)`,!2 ^ 3 AS `(! 2) ^ 3`
+select ! 2 ^ 3, ! (2 ^ 3), (! 2) ^ 3 union select * from v1;
+! 2 ^ 3 ! (2 ^ 3) (! 2) ^ 3
+3 0 3
+create or replace view v1 as select ! 2 BETWEEN 3 AND 4, ! (2 BETWEEN 3 AND 4), (! 2) BETWEEN 3 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 between 3 and 4 AS `! 2 BETWEEN 3 AND 4`,2 not between 3 and 4 AS `! (2 BETWEEN 3 AND 4)`,!2 between 3 and 4 AS `(! 2) BETWEEN 3 AND 4`
+select ! 2 BETWEEN 3 AND 4, ! (2 BETWEEN 3 AND 4), (! 2) BETWEEN 3 AND 4 union select * from v1;
+! 2 BETWEEN 3 AND 4 ! (2 BETWEEN 3 AND 4) (! 2) BETWEEN 3 AND 4
+0 1 0
+create or replace view v1 as select CHARSET(BINARY '2' COLLATE latin1_bin), CHARSET(BINARY ('2' COLLATE latin1_bin)), 'error'/*CHARSET((BINARY '2') COLLATE latin1_bin)*/;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(cast('2' collate latin1_bin as char charset binary)) AS `CHARSET(BINARY '2' COLLATE latin1_bin)`,charset(cast('2' collate latin1_bin as char charset binary)) AS `CHARSET(BINARY ('2' COLLATE latin1_bin))`,'error' AS `error`
+select CHARSET(BINARY '2' COLLATE latin1_bin), CHARSET(BINARY ('2' COLLATE latin1_bin)), 'error'/*CHARSET((BINARY '2') COLLATE latin1_bin)*/ union select * from v1;
+CHARSET(BINARY '2' COLLATE latin1_bin) CHARSET(BINARY ('2' COLLATE latin1_bin)) error
+binary binary error
+create or replace view v1 as select BINARY 'c' IN ('C','X'), BINARY ('c' IN ('C','X')), (BINARY 'c') IN ('C','X');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) in ('C','X') AS `BINARY 'c' IN ('C','X')`,cast('c' in ('C','X') as char charset binary) AS `BINARY ('c' IN ('C','X'))`,cast('c' as char charset binary) in ('C','X') AS `(BINARY 'c') IN ('C','X')`
+select BINARY 'c' IN ('C','X'), BINARY ('c' IN ('C','X')), (BINARY 'c') IN ('C','X') union select * from v1;
+BINARY 'c' IN ('C','X') BINARY ('c' IN ('C','X')) (BINARY 'c') IN ('C','X')
+0 1 0
+create or replace view v1 as select BINARY 'c' = 'C', BINARY ('c' = 'C'), (BINARY 'c') = 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) = 'C' AS `BINARY 'c' = 'C'`,cast('c' = 'C' as char charset binary) AS `BINARY ('c' = 'C')`,cast('c' as char charset binary) = 'C' AS `(BINARY 'c') = 'C'`
+select BINARY 'c' = 'C', BINARY ('c' = 'C'), (BINARY 'c') = 'C' union select * from v1;
+BINARY 'c' = 'C' BINARY ('c' = 'C') (BINARY 'c') = 'C'
+0 1 0
+create or replace view v1 as select BINARY 'c' <=> 'C', BINARY ('c' <=> 'C'), (BINARY 'c') <=> 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) <=> 'C' AS `BINARY 'c' <=> 'C'`,cast('c' <=> 'C' as char charset binary) AS `BINARY ('c' <=> 'C')`,cast('c' as char charset binary) <=> 'C' AS `(BINARY 'c') <=> 'C'`
+select BINARY 'c' <=> 'C', BINARY ('c' <=> 'C'), (BINARY 'c') <=> 'C' union select * from v1;
+BINARY 'c' <=> 'C' BINARY ('c' <=> 'C') (BINARY 'c') <=> 'C'
+0 1 0
+create or replace view v1 as select BINARY 'c' >= 'D', BINARY ('c' >= 'D'), (BINARY 'c') >= 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) >= 'D' AS `BINARY 'c' >= 'D'`,cast('c' >= 'D' as char charset binary) AS `BINARY ('c' >= 'D')`,cast('c' as char charset binary) >= 'D' AS `(BINARY 'c') >= 'D'`
+select BINARY 'c' >= 'D', BINARY ('c' >= 'D'), (BINARY 'c') >= 'D' union select * from v1;
+BINARY 'c' >= 'D' BINARY ('c' >= 'D') (BINARY 'c') >= 'D'
+1 0 1
+create or replace view v1 as select BINARY 'c' <= 'C', BINARY ('c' <= 'C'), (BINARY 'c') <= 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) <= 'C' AS `BINARY 'c' <= 'C'`,cast('c' <= 'C' as char charset binary) AS `BINARY ('c' <= 'C')`,cast('c' as char charset binary) <= 'C' AS `(BINARY 'c') <= 'C'`
+select BINARY 'c' <= 'C', BINARY ('c' <= 'C'), (BINARY 'c') <= 'C' union select * from v1;
+BINARY 'c' <= 'C' BINARY ('c' <= 'C') (BINARY 'c') <= 'C'
+0 1 0
+create or replace view v1 as select BINARY 'c' < 'D', BINARY ('c' < 'D'), (BINARY 'c') < 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) < 'D' AS `BINARY 'c' < 'D'`,cast('c' < 'D' as char charset binary) AS `BINARY ('c' < 'D')`,cast('c' as char charset binary) < 'D' AS `(BINARY 'c') < 'D'`
+select BINARY 'c' < 'D', BINARY ('c' < 'D'), (BINARY 'c') < 'D' union select * from v1;
+BINARY 'c' < 'D' BINARY ('c' < 'D') (BINARY 'c') < 'D'
+0 1 0
+create or replace view v1 as select BINARY 'c' <> 'C', BINARY ('c' <> 'C'), (BINARY 'c') <> 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) <> 'C' AS `BINARY 'c' <> 'C'`,cast('c' <> 'C' as char charset binary) AS `BINARY ('c' <> 'C')`,cast('c' as char charset binary) <> 'C' AS `(BINARY 'c') <> 'C'`
+select BINARY 'c' <> 'C', BINARY ('c' <> 'C'), (BINARY 'c') <> 'C' union select * from v1;
+BINARY 'c' <> 'C' BINARY ('c' <> 'C') (BINARY 'c') <> 'C'
+1 0 1
+create or replace view v1 as select BINARY 'c' > 'C', BINARY ('c' > 'C'), (BINARY 'c') > 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) > 'C' AS `BINARY 'c' > 'C'`,cast('c' > 'C' as char charset binary) AS `BINARY ('c' > 'C')`,cast('c' as char charset binary) > 'C' AS `(BINARY 'c') > 'C'`
+select BINARY 'c' > 'C', BINARY ('c' > 'C'), (BINARY 'c') > 'C' union select * from v1;
+BINARY 'c' > 'C' BINARY ('c' > 'C') (BINARY 'c') > 'C'
+1 0 1
+create or replace view v1 as select BINARY 'c' != 'C', BINARY ('c' != 'C'), (BINARY 'c') != 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) <> 'C' AS `BINARY 'c' != 'C'`,cast('c' <> 'C' as char charset binary) AS `BINARY ('c' != 'C')`,cast('c' as char charset binary) <> 'C' AS `(BINARY 'c') != 'C'`
+select BINARY 'c' != 'C', BINARY ('c' != 'C'), (BINARY 'c') != 'C' union select * from v1;
+BINARY 'c' != 'C' BINARY ('c' != 'C') (BINARY 'c') != 'C'
+1 0 1
+create or replace view v1 as select BINARY 'c' LIKE 'C', BINARY ('c' LIKE 'C'), (BINARY 'c') LIKE 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) like 'C' AS `BINARY 'c' LIKE 'C'`,cast('c' like 'C' as char charset binary) AS `BINARY ('c' LIKE 'C')`,cast('c' as char charset binary) like 'C' AS `(BINARY 'c') LIKE 'C'`
+select BINARY 'c' LIKE 'C', BINARY ('c' LIKE 'C'), (BINARY 'c') LIKE 'C' union select * from v1;
+BINARY 'c' LIKE 'C' BINARY ('c' LIKE 'C') (BINARY 'c') LIKE 'C'
+0 1 0
+create or replace view v1 as select BINARY 'c' REGEXP 'C', BINARY ('c' REGEXP 'C'), (BINARY 'c') REGEXP 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) regexp 'C' AS `BINARY 'c' REGEXP 'C'`,cast('c' regexp 'C' as char charset binary) AS `BINARY ('c' REGEXP 'C')`,cast('c' as char charset binary) regexp 'C' AS `(BINARY 'c') REGEXP 'C'`
+select BINARY 'c' REGEXP 'C', BINARY ('c' REGEXP 'C'), (BINARY 'c') REGEXP 'C' union select * from v1;
+BINARY 'c' REGEXP 'C' BINARY ('c' REGEXP 'C') (BINARY 'c') REGEXP 'C'
+0 1 0
+create or replace view v1 as select BINARY 'c' BETWEEN 'A' AND 'D', BINARY ('c' BETWEEN 'A' AND 'D'), (BINARY 'c') BETWEEN 'A' AND 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) between 'A' and 'D' AS `BINARY 'c' BETWEEN 'A' AND 'D'`,cast('c' between 'A' and 'D' as char charset binary) AS `BINARY ('c' BETWEEN 'A' AND 'D')`,cast('c' as char charset binary) between 'A' and 'D' AS `(BINARY 'c') BETWEEN 'A' AND 'D'`
+select BINARY 'c' BETWEEN 'A' AND 'D', BINARY ('c' BETWEEN 'A' AND 'D'), (BINARY 'c') BETWEEN 'A' AND 'D' union select * from v1;
+BINARY 'c' BETWEEN 'A' AND 'D' BINARY ('c' BETWEEN 'A' AND 'D') (BINARY 'c') BETWEEN 'A' AND 'D'
+0 1 0
+create or replace view v1 as select 2 OR 3 IS FALSE, 2 OR (3 IS FALSE), (2 OR 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 is false AS `2 OR 3 IS FALSE`,2 or 3 is false AS `2 OR (3 IS FALSE)`,(2 or 3) is false AS `(2 OR 3) IS FALSE`
+select 2 OR 3 IS FALSE, 2 OR (3 IS FALSE), (2 OR 3) IS FALSE union select * from v1;
+2 OR 3 IS FALSE 2 OR (3 IS FALSE) (2 OR 3) IS FALSE
+1 1 0
+create or replace view v1 as select charset(2 OR 3 COLLATE latin1_bin), charset(2 OR (3 COLLATE latin1_bin)), charset((2 OR 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 or 3 collate latin1_bin) AS `charset(2 OR 3 COLLATE latin1_bin)`,charset(2 or 3 collate latin1_bin) AS `charset(2 OR (3 COLLATE latin1_bin))`,charset((2 or 3) collate latin1_bin) AS `charset((2 OR 3) COLLATE latin1_bin)`
+select charset(2 OR 3 COLLATE latin1_bin), charset(2 OR (3 COLLATE latin1_bin)), charset((2 OR 3) COLLATE latin1_bin) union select * from v1;
+charset(2 OR 3 COLLATE latin1_bin) charset(2 OR (3 COLLATE latin1_bin)) charset((2 OR 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 0 OR 3 IN (3,10), 0 OR (3 IN (3,10)), (0 OR 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 in (3,10) AS `0 OR 3 IN (3,10)`,0 or 3 in (3,10) AS `0 OR (3 IN (3,10))`,(0 or 3) in (3,10) AS `(0 OR 3) IN (3,10)`
+select 0 OR 3 IN (3,10), 0 OR (3 IN (3,10)), (0 OR 3) IN (3,10) union select * from v1;
+0 OR 3 IN (3,10) 0 OR (3 IN (3,10)) (0 OR 3) IN (3,10)
+1 1 0
+create or replace view v1 as select 1 OR 0 XOR 1, 1 OR (0 XOR 1), (1 OR 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 0 xor 1 AS `1 OR 0 XOR 1`,1 or 0 xor 1 AS `1 OR (0 XOR 1)`,(1 or 0) xor 1 AS `(1 OR 0) XOR 1`
+select 1 OR 0 XOR 1, 1 OR (0 XOR 1), (1 OR 0) XOR 1 union select * from v1;
+1 OR 0 XOR 1 1 OR (0 XOR 1) (1 OR 0) XOR 1
+1 1 0
+create or replace view v1 as select 1 OR 1 AND 0, 1 OR (1 AND 0), (1 OR 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 1 and 0 AS `1 OR 1 AND 0`,1 or 1 and 0 AS `1 OR (1 AND 0)`,(1 or 1) and 0 AS `(1 OR 1) AND 0`
+select 1 OR 1 AND 0, 1 OR (1 AND 0), (1 OR 1) AND 0 union select * from v1;
+1 OR 1 AND 0 1 OR (1 AND 0) (1 OR 1) AND 0
+1 1 0
+create or replace view v1 as select 1 OR 1 && 0, 1 OR (1 && 0), (1 OR 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 1 and 0 AS `1 OR 1 && 0`,1 or 1 and 0 AS `1 OR (1 && 0)`,(1 or 1) and 0 AS `(1 OR 1) && 0`
+select 1 OR 1 && 0, 1 OR (1 && 0), (1 OR 1) && 0 union select * from v1;
+1 OR 1 && 0 1 OR (1 && 0) (1 OR 1) && 0
+1 1 0
+create or replace view v1 as select 2 OR 3 = 3, 2 OR (3 = 3), (2 OR 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 = 3 AS `2 OR 3 = 3`,2 or 3 = 3 AS `2 OR (3 = 3)`,(2 or 3) = 3 AS `(2 OR 3) = 3`
+select 2 OR 3 = 3, 2 OR (3 = 3), (2 OR 3) = 3 union select * from v1;
+2 OR 3 = 3 2 OR (3 = 3) (2 OR 3) = 3
+1 1 0
+create or replace view v1 as select 2 OR 3 <=> 3, 2 OR (3 <=> 3), (2 OR 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 <=> 3 AS `2 OR 3 <=> 3`,2 or 3 <=> 3 AS `2 OR (3 <=> 3)`,(2 or 3) <=> 3 AS `(2 OR 3) <=> 3`
+select 2 OR 3 <=> 3, 2 OR (3 <=> 3), (2 OR 3) <=> 3 union select * from v1;
+2 OR 3 <=> 3 2 OR (3 <=> 3) (2 OR 3) <=> 3
+1 1 0
+create or replace view v1 as select 2 OR 3 >= 3, 2 OR (3 >= 3), (2 OR 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 >= 3 AS `2 OR 3 >= 3`,2 or 3 >= 3 AS `2 OR (3 >= 3)`,(2 or 3) >= 3 AS `(2 OR 3) >= 3`
+select 2 OR 3 >= 3, 2 OR (3 >= 3), (2 OR 3) >= 3 union select * from v1;
+2 OR 3 >= 3 2 OR (3 >= 3) (2 OR 3) >= 3
+1 1 0
+create or replace view v1 as select 2 OR 3 <= 0, 2 OR (3 <= 0), (2 OR 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 <= 0 AS `2 OR 3 <= 0`,2 or 3 <= 0 AS `2 OR (3 <= 0)`,(2 or 3) <= 0 AS `(2 OR 3) <= 0`
+select 2 OR 3 <= 0, 2 OR (3 <= 0), (2 OR 3) <= 0 union select * from v1;
+2 OR 3 <= 0 2 OR (3 <= 0) (2 OR 3) <= 0
+1 1 0
+create or replace view v1 as select 2 OR 3 < 0, 2 OR (3 < 0), (2 OR 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 < 0 AS `2 OR 3 < 0`,2 or 3 < 0 AS `2 OR (3 < 0)`,(2 or 3) < 0 AS `(2 OR 3) < 0`
+select 2 OR 3 < 0, 2 OR (3 < 0), (2 OR 3) < 0 union select * from v1;
+2 OR 3 < 0 2 OR (3 < 0) (2 OR 3) < 0
+1 1 0
+create or replace view v1 as select 0 OR 3 <> 3, 0 OR (3 <> 3), (0 OR 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 <> 3 AS `0 OR 3 <> 3`,0 or 3 <> 3 AS `0 OR (3 <> 3)`,(0 or 3) <> 3 AS `(0 OR 3) <> 3`
+select 0 OR 3 <> 3, 0 OR (3 <> 3), (0 OR 3) <> 3 union select * from v1;
+0 OR 3 <> 3 0 OR (3 <> 3) (0 OR 3) <> 3
+0 0 1
+create or replace view v1 as select 2 OR 3 > 3, 2 OR (3 > 3), (2 OR 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 > 3 AS `2 OR 3 > 3`,2 or 3 > 3 AS `2 OR (3 > 3)`,(2 or 3) > 3 AS `(2 OR 3) > 3`
+select 2 OR 3 > 3, 2 OR (3 > 3), (2 OR 3) > 3 union select * from v1;
+2 OR 3 > 3 2 OR (3 > 3) (2 OR 3) > 3
+1 1 0
+create or replace view v1 as select 0 OR 3 != 3, 0 OR (3 != 3), (0 OR 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 <> 3 AS `0 OR 3 != 3`,0 or 3 <> 3 AS `0 OR (3 != 3)`,(0 or 3) <> 3 AS `(0 OR 3) != 3`
+select 0 OR 3 != 3, 0 OR (3 != 3), (0 OR 3) != 3 union select * from v1;
+0 OR 3 != 3 0 OR (3 != 3) (0 OR 3) != 3
+0 0 1
+create or replace view v1 as select 2 OR 3 LIKE 3, 2 OR (3 LIKE 3), (2 OR 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 like 3 AS `2 OR 3 LIKE 3`,2 or 3 like 3 AS `2 OR (3 LIKE 3)`,(2 or 3) like 3 AS `(2 OR 3) LIKE 3`
+select 2 OR 3 LIKE 3, 2 OR (3 LIKE 3), (2 OR 3) LIKE 3 union select * from v1;
+2 OR 3 LIKE 3 2 OR (3 LIKE 3) (2 OR 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 OR 3 REGEXP 3, 2 OR (3 REGEXP 3), (2 OR 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 regexp 3 AS `2 OR 3 REGEXP 3`,2 or 3 regexp 3 AS `2 OR (3 REGEXP 3)`,(2 or 3) regexp 3 AS `(2 OR 3) REGEXP 3`
+select 2 OR 3 REGEXP 3, 2 OR (3 REGEXP 3), (2 OR 3) REGEXP 3 union select * from v1;
+2 OR 3 REGEXP 3 2 OR (3 REGEXP 3) (2 OR 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 OR 3 | 3, 2 OR (3 | 3), (2 OR 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 | 3 AS `2 OR 3 | 3`,2 or 3 | 3 AS `2 OR (3 | 3)`,(2 or 3) | 3 AS `(2 OR 3) | 3`
+select 2 OR 3 | 3, 2 OR (3 | 3), (2 OR 3) | 3 union select * from v1;
+2 OR 3 | 3 2 OR (3 | 3) (2 OR 3) | 3
+1 1 3
+create or replace view v1 as select 0 OR 2 & 2, 0 OR (2 & 2), (0 OR 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 2 & 2 AS `0 OR 2 & 2`,0 or 2 & 2 AS `0 OR (2 & 2)`,(0 or 2) & 2 AS `(0 OR 2) & 2`
+select 0 OR 2 & 2, 0 OR (2 & 2), (0 OR 2) & 2 union select * from v1;
+0 OR 2 & 2 0 OR (2 & 2) (0 OR 2) & 2
+1 1 0
+create or replace view v1 as select 2 OR 3 << 3, 2 OR (3 << 3), (2 OR 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 << 3 AS `2 OR 3 << 3`,2 or 3 << 3 AS `2 OR (3 << 3)`,(2 or 3) << 3 AS `(2 OR 3) << 3`
+select 2 OR 3 << 3, 2 OR (3 << 3), (2 OR 3) << 3 union select * from v1;
+2 OR 3 << 3 2 OR (3 << 3) (2 OR 3) << 3
+1 1 8
+create or replace view v1 as select 2 OR 3 >> 3, 2 OR (3 >> 3), (2 OR 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 >> 3 AS `2 OR 3 >> 3`,2 or 3 >> 3 AS `2 OR (3 >> 3)`,(2 or 3) >> 3 AS `(2 OR 3) >> 3`
+select 2 OR 3 >> 3, 2 OR (3 >> 3), (2 OR 3) >> 3 union select * from v1;
+2 OR 3 >> 3 2 OR (3 >> 3) (2 OR 3) >> 3
+1 1 0
+create or replace view v1 as select 2 OR '2000-01-01' +INTERVAL 1 DAY, 2 OR ('2000-01-01' +INTERVAL 1 DAY), (2 OR '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or '2000-01-01' + interval 1 day AS `2 OR '2000-01-01' +INTERVAL 1 DAY`,2 or '2000-01-01' + interval 1 day AS `2 OR ('2000-01-01' +INTERVAL 1 DAY)`,(2 or '2000-01-01') + interval 1 day AS `(2 OR '2000-01-01') +INTERVAL 1 DAY`
+select 2 OR '2000-01-01' +INTERVAL 1 DAY, 2 OR ('2000-01-01' +INTERVAL 1 DAY), (2 OR '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 OR '2000-01-01' +INTERVAL 1 DAY 2 OR ('2000-01-01' +INTERVAL 1 DAY) (2 OR '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 OR 3 + 3, 2 OR (3 + 3), (2 OR 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 + 3 AS `2 OR 3 + 3`,2 or 3 + 3 AS `2 OR (3 + 3)`,(2 or 3) + 3 AS `(2 OR 3) + 3`
+select 2 OR 3 + 3, 2 OR (3 + 3), (2 OR 3) + 3 union select * from v1;
+2 OR 3 + 3 2 OR (3 + 3) (2 OR 3) + 3
+1 1 4
+create or replace view v1 as select 2 OR 3 - 3, 2 OR (3 - 3), (2 OR 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 - 3 AS `2 OR 3 - 3`,2 or 3 - 3 AS `2 OR (3 - 3)`,(2 or 3) - 3 AS `(2 OR 3) - 3`
+select 2 OR 3 - 3, 2 OR (3 - 3), (2 OR 3) - 3 union select * from v1;
+2 OR 3 - 3 2 OR (3 - 3) (2 OR 3) - 3
+1 1 -2
+create or replace view v1 as select 2 OR 3 * 3, 2 OR (3 * 3), (2 OR 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 * 3 AS `2 OR 3 * 3`,2 or 3 * 3 AS `2 OR (3 * 3)`,(2 or 3) * 3 AS `(2 OR 3) * 3`
+select 2 OR 3 * 3, 2 OR (3 * 3), (2 OR 3) * 3 union select * from v1;
+2 OR 3 * 3 2 OR (3 * 3) (2 OR 3) * 3
+1 1 3
+create or replace view v1 as select 2 OR 3 / 3, 2 OR (3 / 3), (2 OR 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 / 3 AS `2 OR 3 / 3`,2 or 3 / 3 AS `2 OR (3 / 3)`,(2 or 3) / 3 AS `(2 OR 3) / 3`
+select 2 OR 3 / 3, 2 OR (3 / 3), (2 OR 3) / 3 union select * from v1;
+2 OR 3 / 3 2 OR (3 / 3) (2 OR 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 OR 3 DIV 3, 2 OR (3 DIV 3), (2 OR 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 DIV 3 AS `2 OR 3 DIV 3`,2 or 3 DIV 3 AS `2 OR (3 DIV 3)`,(2 or 3) DIV 3 AS `(2 OR 3) DIV 3`
+select 2 OR 3 DIV 3, 2 OR (3 DIV 3), (2 OR 3) DIV 3 union select * from v1;
+2 OR 3 DIV 3 2 OR (3 DIV 3) (2 OR 3) DIV 3
+1 1 0
+create or replace view v1 as select 0 OR 3 MOD 3, 0 OR (3 MOD 3), (0 OR 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 % 3 AS `0 OR 3 MOD 3`,0 or 3 % 3 AS `0 OR (3 MOD 3)`,(0 or 3) % 3 AS `(0 OR 3) MOD 3`
+select 0 OR 3 MOD 3, 0 OR (3 MOD 3), (0 OR 3) MOD 3 union select * from v1;
+0 OR 3 MOD 3 0 OR (3 MOD 3) (0 OR 3) MOD 3
+0 0 1
+create or replace view v1 as select 0 OR 3 % 3, 0 OR (3 % 3), (0 OR 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 % 3 AS `0 OR 3 % 3`,0 or 3 % 3 AS `0 OR (3 % 3)`,(0 or 3) % 3 AS `(0 OR 3) % 3`
+select 0 OR 3 % 3, 0 OR (3 % 3), (0 OR 3) % 3 union select * from v1;
+0 OR 3 % 3 0 OR (3 % 3) (0 OR 3) % 3
+0 0 1
+create or replace view v1 as select 2 OR 3 ^ 3, 2 OR (3 ^ 3), (2 OR 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 ^ 3 AS `2 OR 3 ^ 3`,2 or 3 ^ 3 AS `2 OR (3 ^ 3)`,(2 or 3) ^ 3 AS `(2 OR 3) ^ 3`
+select 2 OR 3 ^ 3, 2 OR (3 ^ 3), (2 OR 3) ^ 3 union select * from v1;
+2 OR 3 ^ 3 2 OR (3 ^ 3) (2 OR 3) ^ 3
+1 1 2
+create or replace view v1 as select 2 OR 3 BETWEEN 2 AND 3, 2 OR (3 BETWEEN 2 AND 3), (2 OR 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 between 2 and 3 AS `2 OR 3 BETWEEN 2 AND 3`,2 or 3 between 2 and 3 AS `2 OR (3 BETWEEN 2 AND 3)`,(2 or 3) between 2 and 3 AS `(2 OR 3) BETWEEN 2 AND 3`
+select 2 OR 3 BETWEEN 2 AND 3, 2 OR (3 BETWEEN 2 AND 3), (2 OR 3) BETWEEN 2 AND 3 union select * from v1;
+2 OR 3 BETWEEN 2 AND 3 2 OR (3 BETWEEN 2 AND 3) (2 OR 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 is false AS `2 || 3 IS FALSE`,2 or 3 is false AS `2 || (3 IS FALSE)`,(2 or 3) is false AS `(2 || 3) IS FALSE`
+select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE union select * from v1;
+2 || 3 IS FALSE 2 || (3 IS FALSE) (2 || 3) IS FALSE
+1 1 0
+create or replace view v1 as select charset(2 || 3 COLLATE latin1_bin), charset(2 || (3 COLLATE latin1_bin)), charset((2 || 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 or 3 collate latin1_bin) AS `charset(2 || 3 COLLATE latin1_bin)`,charset(2 or 3 collate latin1_bin) AS `charset(2 || (3 COLLATE latin1_bin))`,charset((2 or 3) collate latin1_bin) AS `charset((2 || 3) COLLATE latin1_bin)`
+select charset(2 || 3 COLLATE latin1_bin), charset(2 || (3 COLLATE latin1_bin)), charset((2 || 3) COLLATE latin1_bin) union select * from v1;
+charset(2 || 3 COLLATE latin1_bin) charset(2 || (3 COLLATE latin1_bin)) charset((2 || 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 in (3,10) AS `0 || 3 IN (3,10)`,0 or 3 in (3,10) AS `0 || (3 IN (3,10))`,(0 or 3) in (3,10) AS `(0 || 3) IN (3,10)`
+select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10) union select * from v1;
+0 || 3 IN (3,10) 0 || (3 IN (3,10)) (0 || 3) IN (3,10)
+1 1 0
+create or replace view v1 as select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 0 xor 1 AS `1 || 0 XOR 1`,1 or 0 xor 1 AS `1 || (0 XOR 1)`,(1 or 0) xor 1 AS `(1 || 0) XOR 1`
+select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1 union select * from v1;
+1 || 0 XOR 1 1 || (0 XOR 1) (1 || 0) XOR 1
+1 1 0
+create or replace view v1 as select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 1 and 0 AS `1 || 1 AND 0`,1 or 1 and 0 AS `1 || (1 AND 0)`,(1 or 1) and 0 AS `(1 || 1) AND 0`
+select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0 union select * from v1;
+1 || 1 AND 0 1 || (1 AND 0) (1 || 1) AND 0
+1 1 0
+create or replace view v1 as select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 or 1 and 0 AS `1 || 1 && 0`,1 or 1 and 0 AS `1 || (1 && 0)`,(1 or 1) and 0 AS `(1 || 1) && 0`
+select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0 union select * from v1;
+1 || 1 && 0 1 || (1 && 0) (1 || 1) && 0
+1 1 0
+create or replace view v1 as select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 = 3 AS `2 || 3 = 3`,2 or 3 = 3 AS `2 || (3 = 3)`,(2 or 3) = 3 AS `(2 || 3) = 3`
+select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3 union select * from v1;
+2 || 3 = 3 2 || (3 = 3) (2 || 3) = 3
+1 1 0
+create or replace view v1 as select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 <=> 3 AS `2 || 3 <=> 3`,2 or 3 <=> 3 AS `2 || (3 <=> 3)`,(2 or 3) <=> 3 AS `(2 || 3) <=> 3`
+select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3 union select * from v1;
+2 || 3 <=> 3 2 || (3 <=> 3) (2 || 3) <=> 3
+1 1 0
+create or replace view v1 as select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 >= 3 AS `2 || 3 >= 3`,2 or 3 >= 3 AS `2 || (3 >= 3)`,(2 or 3) >= 3 AS `(2 || 3) >= 3`
+select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3 union select * from v1;
+2 || 3 >= 3 2 || (3 >= 3) (2 || 3) >= 3
+1 1 0
+create or replace view v1 as select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 <= 0 AS `2 || 3 <= 0`,2 or 3 <= 0 AS `2 || (3 <= 0)`,(2 or 3) <= 0 AS `(2 || 3) <= 0`
+select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0 union select * from v1;
+2 || 3 <= 0 2 || (3 <= 0) (2 || 3) <= 0
+1 1 0
+create or replace view v1 as select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 < 0 AS `2 || 3 < 0`,2 or 3 < 0 AS `2 || (3 < 0)`,(2 or 3) < 0 AS `(2 || 3) < 0`
+select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0 union select * from v1;
+2 || 3 < 0 2 || (3 < 0) (2 || 3) < 0
+1 1 0
+create or replace view v1 as select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 <> 3 AS `0 || 3 <> 3`,0 or 3 <> 3 AS `0 || (3 <> 3)`,(0 or 3) <> 3 AS `(0 || 3) <> 3`
+select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3 union select * from v1;
+0 || 3 <> 3 0 || (3 <> 3) (0 || 3) <> 3
+0 0 1
+create or replace view v1 as select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 > 3 AS `2 || 3 > 3`,2 or 3 > 3 AS `2 || (3 > 3)`,(2 or 3) > 3 AS `(2 || 3) > 3`
+select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3 union select * from v1;
+2 || 3 > 3 2 || (3 > 3) (2 || 3) > 3
+1 1 0
+create or replace view v1 as select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 <> 3 AS `0 || 3 != 3`,0 or 3 <> 3 AS `0 || (3 != 3)`,(0 or 3) <> 3 AS `(0 || 3) != 3`
+select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3 union select * from v1;
+0 || 3 != 3 0 || (3 != 3) (0 || 3) != 3
+0 0 1
+create or replace view v1 as select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 like 3 AS `2 || 3 LIKE 3`,2 or 3 like 3 AS `2 || (3 LIKE 3)`,(2 or 3) like 3 AS `(2 || 3) LIKE 3`
+select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3 union select * from v1;
+2 || 3 LIKE 3 2 || (3 LIKE 3) (2 || 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 regexp 3 AS `2 || 3 REGEXP 3`,2 or 3 regexp 3 AS `2 || (3 REGEXP 3)`,(2 or 3) regexp 3 AS `(2 || 3) REGEXP 3`
+select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3 union select * from v1;
+2 || 3 REGEXP 3 2 || (3 REGEXP 3) (2 || 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 || 3 | 3, 2 || (3 | 3), (2 || 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 | 3 AS `2 || 3 | 3`,2 or 3 | 3 AS `2 || (3 | 3)`,(2 or 3) | 3 AS `(2 || 3) | 3`
+select 2 || 3 | 3, 2 || (3 | 3), (2 || 3) | 3 union select * from v1;
+2 || 3 | 3 2 || (3 | 3) (2 || 3) | 3
+1 1 3
+create or replace view v1 as select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 2 & 2 AS `0 || 2 & 2`,0 or 2 & 2 AS `0 || (2 & 2)`,(0 or 2) & 2 AS `(0 || 2) & 2`
+select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2 union select * from v1;
+0 || 2 & 2 0 || (2 & 2) (0 || 2) & 2
+1 1 0
+create or replace view v1 as select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 << 3 AS `2 || 3 << 3`,2 or 3 << 3 AS `2 || (3 << 3)`,(2 or 3) << 3 AS `(2 || 3) << 3`
+select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3 union select * from v1;
+2 || 3 << 3 2 || (3 << 3) (2 || 3) << 3
+1 1 8
+create or replace view v1 as select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 >> 3 AS `2 || 3 >> 3`,2 or 3 >> 3 AS `2 || (3 >> 3)`,(2 or 3) >> 3 AS `(2 || 3) >> 3`
+select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3 union select * from v1;
+2 || 3 >> 3 2 || (3 >> 3) (2 || 3) >> 3
+1 1 0
+create or replace view v1 as select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or '2000-01-01' + interval 1 day AS `2 || '2000-01-01' +INTERVAL 1 DAY`,2 or '2000-01-01' + interval 1 day AS `2 || ('2000-01-01' +INTERVAL 1 DAY)`,(2 or '2000-01-01') + interval 1 day AS `(2 || '2000-01-01') +INTERVAL 1 DAY`
+select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 || '2000-01-01' +INTERVAL 1 DAY 2 || ('2000-01-01' +INTERVAL 1 DAY) (2 || '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 || 3 + 3, 2 || (3 + 3), (2 || 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 + 3 AS `2 || 3 + 3`,2 or 3 + 3 AS `2 || (3 + 3)`,(2 or 3) + 3 AS `(2 || 3) + 3`
+select 2 || 3 + 3, 2 || (3 + 3), (2 || 3) + 3 union select * from v1;
+2 || 3 + 3 2 || (3 + 3) (2 || 3) + 3
+1 1 4
+create or replace view v1 as select 2 || 3 - 3, 2 || (3 - 3), (2 || 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 - 3 AS `2 || 3 - 3`,2 or 3 - 3 AS `2 || (3 - 3)`,(2 or 3) - 3 AS `(2 || 3) - 3`
+select 2 || 3 - 3, 2 || (3 - 3), (2 || 3) - 3 union select * from v1;
+2 || 3 - 3 2 || (3 - 3) (2 || 3) - 3
+1 1 -2
+create or replace view v1 as select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 * 3 AS `2 || 3 * 3`,2 or 3 * 3 AS `2 || (3 * 3)`,(2 or 3) * 3 AS `(2 || 3) * 3`
+select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3 union select * from v1;
+2 || 3 * 3 2 || (3 * 3) (2 || 3) * 3
+1 1 3
+create or replace view v1 as select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 / 3 AS `2 || 3 / 3`,2 or 3 / 3 AS `2 || (3 / 3)`,(2 or 3) / 3 AS `(2 || 3) / 3`
+select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3 union select * from v1;
+2 || 3 / 3 2 || (3 / 3) (2 || 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 DIV 3 AS `2 || 3 DIV 3`,2 or 3 DIV 3 AS `2 || (3 DIV 3)`,(2 or 3) DIV 3 AS `(2 || 3) DIV 3`
+select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3 union select * from v1;
+2 || 3 DIV 3 2 || (3 DIV 3) (2 || 3) DIV 3
+1 1 0
+create or replace view v1 as select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 % 3 AS `0 || 3 MOD 3`,0 or 3 % 3 AS `0 || (3 MOD 3)`,(0 or 3) % 3 AS `(0 || 3) MOD 3`
+select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3 union select * from v1;
+0 || 3 MOD 3 0 || (3 MOD 3) (0 || 3) MOD 3
+0 0 1
+create or replace view v1 as select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 % 3 AS `0 || 3 % 3`,0 or 3 % 3 AS `0 || (3 % 3)`,(0 or 3) % 3 AS `(0 || 3) % 3`
+select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3 union select * from v1;
+0 || 3 % 3 0 || (3 % 3) (0 || 3) % 3
+0 0 1
+create or replace view v1 as select 2 || 3 ^ 3, 2 || (3 ^ 3), (2 || 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 ^ 3 AS `2 || 3 ^ 3`,2 or 3 ^ 3 AS `2 || (3 ^ 3)`,(2 or 3) ^ 3 AS `(2 || 3) ^ 3`
+select 2 || 3 ^ 3, 2 || (3 ^ 3), (2 || 3) ^ 3 union select * from v1;
+2 || 3 ^ 3 2 || (3 ^ 3) (2 || 3) ^ 3
+1 1 2
+create or replace view v1 as select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or 3 between 2 and 3 AS `2 || 3 BETWEEN 2 AND 3`,2 or 3 between 2 and 3 AS `2 || (3 BETWEEN 2 AND 3)`,(2 or 3) between 2 and 3 AS `(2 || 3) BETWEEN 2 AND 3`
+select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3 union select * from v1;
+2 || 3 BETWEEN 2 AND 3 2 || (3 BETWEEN 2 AND 3) (2 || 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select charset(2 XOR 3 COLLATE latin1_bin), charset(2 XOR (3 COLLATE latin1_bin)), charset((2 XOR 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 xor 3 collate latin1_bin) AS `charset(2 XOR 3 COLLATE latin1_bin)`,charset(2 xor 3 collate latin1_bin) AS `charset(2 XOR (3 COLLATE latin1_bin))`,charset((2 xor 3) collate latin1_bin) AS `charset((2 XOR 3) COLLATE latin1_bin)`
+select charset(2 XOR 3 COLLATE latin1_bin), charset(2 XOR (3 COLLATE latin1_bin)), charset((2 XOR 3) COLLATE latin1_bin) union select * from v1;
+charset(2 XOR 3 COLLATE latin1_bin) charset(2 XOR (3 COLLATE latin1_bin)) charset((2 XOR 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 XOR 3 IN (4,5), 2 XOR (3 IN (4,5)), (2 XOR 3) IN (4,5);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 in (4,5) AS `2 XOR 3 IN (4,5)`,2 xor 3 in (4,5) AS `2 XOR (3 IN (4,5))`,(2 xor 3) in (4,5) AS `(2 XOR 3) IN (4,5)`
+select 2 XOR 3 IN (4,5), 2 XOR (3 IN (4,5)), (2 XOR 3) IN (4,5) union select * from v1;
+2 XOR 3 IN (4,5) 2 XOR (3 IN (4,5)) (2 XOR 3) IN (4,5)
+1 1 0
+create or replace view v1 as select 2 XOR 3 OR 3, 2 XOR (3 OR 3), (2 XOR 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 or 3 AS `2 XOR 3 OR 3`,2 xor (3 or 3) AS `2 XOR (3 OR 3)`,2 xor 3 or 3 AS `(2 XOR 3) OR 3`
+select 2 XOR 3 OR 3, 2 XOR (3 OR 3), (2 XOR 3) OR 3 union select * from v1;
+2 XOR 3 OR 3 2 XOR (3 OR 3) (2 XOR 3) OR 3
+1 0 1
+create or replace view v1 as select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 or 3 AS `2 XOR 3 || 3`,2 xor (3 or 3) AS `2 XOR (3 || 3)`,2 xor 3 or 3 AS `(2 XOR 3) || 3`
+select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3 union select * from v1;
+2 XOR 3 || 3 2 XOR (3 || 3) (2 XOR 3) || 3
+1 0 1
+create or replace view v1 as select 2 XOR 0 AND 0, 2 XOR (0 AND 0), (2 XOR 0) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 0 and 0 AS `2 XOR 0 AND 0`,2 xor 0 and 0 AS `2 XOR (0 AND 0)`,(2 xor 0) and 0 AS `(2 XOR 0) AND 0`
+select 2 XOR 0 AND 0, 2 XOR (0 AND 0), (2 XOR 0) AND 0 union select * from v1;
+2 XOR 0 AND 0 2 XOR (0 AND 0) (2 XOR 0) AND 0
+1 1 0
+create or replace view v1 as select 2 XOR 0 && 0, 2 XOR (0 && 0), (2 XOR 0) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 0 and 0 AS `2 XOR 0 && 0`,2 xor 0 and 0 AS `2 XOR (0 && 0)`,(2 xor 0) and 0 AS `(2 XOR 0) && 0`
+select 2 XOR 0 && 0, 2 XOR (0 && 0), (2 XOR 0) && 0 union select * from v1;
+2 XOR 0 && 0 2 XOR (0 && 0) (2 XOR 0) && 0
+1 1 0
+create or replace view v1 as select 2 XOR 2 = 3, 2 XOR (2 = 3), (2 XOR 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 2 = 3 AS `2 XOR 2 = 3`,2 xor 2 = 3 AS `2 XOR (2 = 3)`,(2 xor 2) = 3 AS `(2 XOR 2) = 3`
+select 2 XOR 2 = 3, 2 XOR (2 = 3), (2 XOR 2) = 3 union select * from v1;
+2 XOR 2 = 3 2 XOR (2 = 3) (2 XOR 2) = 3
+1 1 0
+create or replace view v1 as select NULL XOR 3 <=> 3, NULL XOR (3 <=> 3), (NULL XOR 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select NULL xor 3 <=> 3 AS `NULL XOR 3 <=> 3`,NULL xor 3 <=> 3 AS `NULL XOR (3 <=> 3)`,(NULL xor 3) <=> 3 AS `(NULL XOR 3) <=> 3`
+select NULL XOR 3 <=> 3, NULL XOR (3 <=> 3), (NULL XOR 3) <=> 3 union select * from v1;
+NULL XOR 3 <=> 3 NULL XOR (3 <=> 3) (NULL XOR 3) <=> 3
+NULL NULL 0
+create or replace view v1 as select 2 XOR 1 >= 3, 2 XOR (1 >= 3), (2 XOR 1) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 1 >= 3 AS `2 XOR 1 >= 3`,2 xor 1 >= 3 AS `2 XOR (1 >= 3)`,(2 xor 1) >= 3 AS `(2 XOR 1) >= 3`
+select 2 XOR 1 >= 3, 2 XOR (1 >= 3), (2 XOR 1) >= 3 union select * from v1;
+2 XOR 1 >= 3 2 XOR (1 >= 3) (2 XOR 1) >= 3
+1 1 0
+create or replace view v1 as select 2 XOR 3 <= 3, 2 XOR (3 <= 3), (2 XOR 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 <= 3 AS `2 XOR 3 <= 3`,2 xor 3 <= 3 AS `2 XOR (3 <= 3)`,(2 xor 3) <= 3 AS `(2 XOR 3) <= 3`
+select 2 XOR 3 <= 3, 2 XOR (3 <= 3), (2 XOR 3) <= 3 union select * from v1;
+2 XOR 3 <= 3 2 XOR (3 <= 3) (2 XOR 3) <= 3
+0 0 1
+create or replace view v1 as select 2 XOR 1 < 3, 2 XOR (1 < 3), (2 XOR 1) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 1 < 3 AS `2 XOR 1 < 3`,2 xor 1 < 3 AS `2 XOR (1 < 3)`,(2 xor 1) < 3 AS `(2 XOR 1) < 3`
+select 2 XOR 1 < 3, 2 XOR (1 < 3), (2 XOR 1) < 3 union select * from v1;
+2 XOR 1 < 3 2 XOR (1 < 3) (2 XOR 1) < 3
+0 0 1
+create or replace view v1 as select 2 XOR 2 <> 3, 2 XOR (2 <> 3), (2 XOR 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 2 <> 3 AS `2 XOR 2 <> 3`,2 xor 2 <> 3 AS `2 XOR (2 <> 3)`,(2 xor 2) <> 3 AS `(2 XOR 2) <> 3`
+select 2 XOR 2 <> 3, 2 XOR (2 <> 3), (2 XOR 2) <> 3 union select * from v1;
+2 XOR 2 <> 3 2 XOR (2 <> 3) (2 XOR 2) <> 3
+0 0 1
+create or replace view v1 as select 2 XOR 3 > 3, 2 XOR (3 > 3), (2 XOR 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 > 3 AS `2 XOR 3 > 3`,2 xor 3 > 3 AS `2 XOR (3 > 3)`,(2 xor 3) > 3 AS `(2 XOR 3) > 3`
+select 2 XOR 3 > 3, 2 XOR (3 > 3), (2 XOR 3) > 3 union select * from v1;
+2 XOR 3 > 3 2 XOR (3 > 3) (2 XOR 3) > 3
+1 1 0
+create or replace view v1 as select 2 XOR 2 != 3, 2 XOR (2 != 3), (2 XOR 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 2 <> 3 AS `2 XOR 2 != 3`,2 xor 2 <> 3 AS `2 XOR (2 != 3)`,(2 xor 2) <> 3 AS `(2 XOR 2) != 3`
+select 2 XOR 2 != 3, 2 XOR (2 != 3), (2 XOR 2) != 3 union select * from v1;
+2 XOR 2 != 3 2 XOR (2 != 3) (2 XOR 2) != 3
+0 0 1
+create or replace view v1 as select 2 XOR 1 LIKE 3, 2 XOR (1 LIKE 3), (2 XOR 1) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 1 like 3 AS `2 XOR 1 LIKE 3`,2 xor 1 like 3 AS `2 XOR (1 LIKE 3)`,(2 xor 1) like 3 AS `(2 XOR 1) LIKE 3`
+select 2 XOR 1 LIKE 3, 2 XOR (1 LIKE 3), (2 XOR 1) LIKE 3 union select * from v1;
+2 XOR 1 LIKE 3 2 XOR (1 LIKE 3) (2 XOR 1) LIKE 3
+1 1 0
+create or replace view v1 as select 2 XOR 1 REGEXP 3, 2 XOR (1 REGEXP 3), (2 XOR 1) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 1 regexp 3 AS `2 XOR 1 REGEXP 3`,2 xor 1 regexp 3 AS `2 XOR (1 REGEXP 3)`,(2 xor 1) regexp 3 AS `(2 XOR 1) REGEXP 3`
+select 2 XOR 1 REGEXP 3, 2 XOR (1 REGEXP 3), (2 XOR 1) REGEXP 3 union select * from v1;
+2 XOR 1 REGEXP 3 2 XOR (1 REGEXP 3) (2 XOR 1) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 XOR 3 | 3, 2 XOR (3 | 3), (2 XOR 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 | 3 AS `2 XOR 3 | 3`,2 xor 3 | 3 AS `2 XOR (3 | 3)`,(2 xor 3) | 3 AS `(2 XOR 3) | 3`
+select 2 XOR 3 | 3, 2 XOR (3 | 3), (2 XOR 3) | 3 union select * from v1;
+2 XOR 3 | 3 2 XOR (3 | 3) (2 XOR 3) | 3
+0 0 3
+create or replace view v1 as select 2 XOR 0 & 0, 2 XOR (0 & 0), (2 XOR 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 0 & 0 AS `2 XOR 0 & 0`,2 xor 0 & 0 AS `2 XOR (0 & 0)`,(2 xor 0) & 0 AS `(2 XOR 0) & 0`
+select 2 XOR 0 & 0, 2 XOR (0 & 0), (2 XOR 0) & 0 union select * from v1;
+2 XOR 0 & 0 2 XOR (0 & 0) (2 XOR 0) & 0
+1 1 0
+create or replace view v1 as select 0 XOR 3 << 3, 0 XOR (3 << 3), (0 XOR 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 xor 3 << 3 AS `0 XOR 3 << 3`,0 xor 3 << 3 AS `0 XOR (3 << 3)`,(0 xor 3) << 3 AS `(0 XOR 3) << 3`
+select 0 XOR 3 << 3, 0 XOR (3 << 3), (0 XOR 3) << 3 union select * from v1;
+0 XOR 3 << 3 0 XOR (3 << 3) (0 XOR 3) << 3
+1 1 8
+create or replace view v1 as select 2 XOR 3 >> 3, 2 XOR (3 >> 3), (2 XOR 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 >> 3 AS `2 XOR 3 >> 3`,2 xor 3 >> 3 AS `2 XOR (3 >> 3)`,(2 xor 3) >> 3 AS `(2 XOR 3) >> 3`
+select 2 XOR 3 >> 3, 2 XOR (3 >> 3), (2 XOR 3) >> 3 union select * from v1;
+2 XOR 3 >> 3 2 XOR (3 >> 3) (2 XOR 3) >> 3
+1 1 0
+create or replace view v1 as select 2 XOR '2000-01-01' +INTERVAL 1 DAY, 2 XOR ('2000-01-01' +INTERVAL 1 DAY), (2 XOR '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor '2000-01-01' + interval 1 day AS `2 XOR '2000-01-01' +INTERVAL 1 DAY`,2 xor '2000-01-01' + interval 1 day AS `2 XOR ('2000-01-01' +INTERVAL 1 DAY)`,(2 xor '2000-01-01') + interval 1 day AS `(2 XOR '2000-01-01') +INTERVAL 1 DAY`
+select 2 XOR '2000-01-01' +INTERVAL 1 DAY, 2 XOR ('2000-01-01' +INTERVAL 1 DAY), (2 XOR '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 XOR '2000-01-01' +INTERVAL 1 DAY 2 XOR ('2000-01-01' +INTERVAL 1 DAY) (2 XOR '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 XOR 3 + 3, 2 XOR (3 + 3), (2 XOR 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 + 3 AS `2 XOR 3 + 3`,2 xor 3 + 3 AS `2 XOR (3 + 3)`,(2 xor 3) + 3 AS `(2 XOR 3) + 3`
+select 2 XOR 3 + 3, 2 XOR (3 + 3), (2 XOR 3) + 3 union select * from v1;
+2 XOR 3 + 3 2 XOR (3 + 3) (2 XOR 3) + 3
+0 0 3
+create or replace view v1 as select 2 XOR 3 - 3, 2 XOR (3 - 3), (2 XOR 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 - 3 AS `2 XOR 3 - 3`,2 xor 3 - 3 AS `2 XOR (3 - 3)`,(2 xor 3) - 3 AS `(2 XOR 3) - 3`
+select 2 XOR 3 - 3, 2 XOR (3 - 3), (2 XOR 3) - 3 union select * from v1;
+2 XOR 3 - 3 2 XOR (3 - 3) (2 XOR 3) - 3
+1 1 -3
+create or replace view v1 as select 0 XOR 3 * 3, 0 XOR (3 * 3), (0 XOR 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 xor 3 * 3 AS `0 XOR 3 * 3`,0 xor 3 * 3 AS `0 XOR (3 * 3)`,(0 xor 3) * 3 AS `(0 XOR 3) * 3`
+select 0 XOR 3 * 3, 0 XOR (3 * 3), (0 XOR 3) * 3 union select * from v1;
+0 XOR 3 * 3 0 XOR (3 * 3) (0 XOR 3) * 3
+1 1 3
+create or replace view v1 as select 0 XOR 3 / 3, 0 XOR (3 / 3), (0 XOR 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 xor 3 / 3 AS `0 XOR 3 / 3`,0 xor 3 / 3 AS `0 XOR (3 / 3)`,(0 xor 3) / 3 AS `(0 XOR 3) / 3`
+select 0 XOR 3 / 3, 0 XOR (3 / 3), (0 XOR 3) / 3 union select * from v1;
+0 XOR 3 / 3 0 XOR (3 / 3) (0 XOR 3) / 3
+1 1 0.3333
+create or replace view v1 as select 0 XOR 3 DIV 3, 0 XOR (3 DIV 3), (0 XOR 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 xor 3 DIV 3 AS `0 XOR 3 DIV 3`,0 xor 3 DIV 3 AS `0 XOR (3 DIV 3)`,(0 xor 3) DIV 3 AS `(0 XOR 3) DIV 3`
+select 0 XOR 3 DIV 3, 0 XOR (3 DIV 3), (0 XOR 3) DIV 3 union select * from v1;
+0 XOR 3 DIV 3 0 XOR (3 DIV 3) (0 XOR 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 XOR 3 MOD 3, 2 XOR (3 MOD 3), (2 XOR 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 % 3 AS `2 XOR 3 MOD 3`,2 xor 3 % 3 AS `2 XOR (3 MOD 3)`,(2 xor 3) % 3 AS `(2 XOR 3) MOD 3`
+select 2 XOR 3 MOD 3, 2 XOR (3 MOD 3), (2 XOR 3) MOD 3 union select * from v1;
+2 XOR 3 MOD 3 2 XOR (3 MOD 3) (2 XOR 3) MOD 3
+1 1 0
+create or replace view v1 as select 2 XOR 3 % 3, 2 XOR (3 % 3), (2 XOR 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 % 3 AS `2 XOR 3 % 3`,2 xor 3 % 3 AS `2 XOR (3 % 3)`,(2 xor 3) % 3 AS `(2 XOR 3) % 3`
+select 2 XOR 3 % 3, 2 XOR (3 % 3), (2 XOR 3) % 3 union select * from v1;
+2 XOR 3 % 3 2 XOR (3 % 3) (2 XOR 3) % 3
+1 1 0
+create or replace view v1 as select 2 XOR 3 ^ 3, 2 XOR (3 ^ 3), (2 XOR 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 ^ 3 AS `2 XOR 3 ^ 3`,2 xor 3 ^ 3 AS `2 XOR (3 ^ 3)`,(2 xor 3) ^ 3 AS `(2 XOR 3) ^ 3`
+select 2 XOR 3 ^ 3, 2 XOR (3 ^ 3), (2 XOR 3) ^ 3 union select * from v1;
+2 XOR 3 ^ 3 2 XOR (3 ^ 3) (2 XOR 3) ^ 3
+1 1 3
+create or replace view v1 as select 2 XOR 3 BETWEEN 0 AND 3, 2 XOR (3 BETWEEN 0 AND 3), (2 XOR 3) BETWEEN 0 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 between 0 and 3 AS `2 XOR 3 BETWEEN 0 AND 3`,2 xor 3 between 0 and 3 AS `2 XOR (3 BETWEEN 0 AND 3)`,(2 xor 3) between 0 and 3 AS `(2 XOR 3) BETWEEN 0 AND 3`
+select 2 XOR 3 BETWEEN 0 AND 3, 2 XOR (3 BETWEEN 0 AND 3), (2 XOR 3) BETWEEN 0 AND 3 union select * from v1;
+2 XOR 3 BETWEEN 0 AND 3 2 XOR (3 BETWEEN 0 AND 3) (2 XOR 3) BETWEEN 0 AND 3
+0 0 1
+create or replace view v1 as select 0 AND 3 IS FALSE, 0 AND (3 IS FALSE), (0 AND 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 is false AS `0 AND 3 IS FALSE`,0 and 3 is false AS `0 AND (3 IS FALSE)`,(0 and 3) is false AS `(0 AND 3) IS FALSE`
+select 0 AND 3 IS FALSE, 0 AND (3 IS FALSE), (0 AND 3) IS FALSE union select * from v1;
+0 AND 3 IS FALSE 0 AND (3 IS FALSE) (0 AND 3) IS FALSE
+0 0 1
+create or replace view v1 as select charset(2 AND 3 COLLATE latin1_bin), charset(2 AND (3 COLLATE latin1_bin)), charset((2 AND 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 and 3 collate latin1_bin) AS `charset(2 AND 3 COLLATE latin1_bin)`,charset(2 and 3 collate latin1_bin) AS `charset(2 AND (3 COLLATE latin1_bin))`,charset((2 and 3) collate latin1_bin) AS `charset((2 AND 3) COLLATE latin1_bin)`
+select charset(2 AND 3 COLLATE latin1_bin), charset(2 AND (3 COLLATE latin1_bin)), charset((2 AND 3) COLLATE latin1_bin) union select * from v1;
+charset(2 AND 3 COLLATE latin1_bin) charset(2 AND (3 COLLATE latin1_bin)) charset((2 AND 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 AND 3 IN (0,1), 2 AND (3 IN (0,1)), (2 AND 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 in (0,1) AS `2 AND 3 IN (0,1)`,2 and 3 in (0,1) AS `2 AND (3 IN (0,1))`,(2 and 3) in (0,1) AS `(2 AND 3) IN (0,1)`
+select 2 AND 3 IN (0,1), 2 AND (3 IN (0,1)), (2 AND 3) IN (0,1) union select * from v1;
+2 AND 3 IN (0,1) 2 AND (3 IN (0,1)) (2 AND 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 0 AND 3 OR 3, 0 AND (3 OR 3), (0 AND 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 or 3 AS `0 AND 3 OR 3`,0 and (3 or 3) AS `0 AND (3 OR 3)`,0 and 3 or 3 AS `(0 AND 3) OR 3`
+select 0 AND 3 OR 3, 0 AND (3 OR 3), (0 AND 3) OR 3 union select * from v1;
+0 AND 3 OR 3 0 AND (3 OR 3) (0 AND 3) OR 3
+1 0 1
+create or replace view v1 as select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 or 3 AS `0 AND 3 || 3`,0 and (3 or 3) AS `0 AND (3 || 3)`,0 and 3 or 3 AS `(0 AND 3) || 3`
+select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3 union select * from v1;
+0 AND 3 || 3 0 AND (3 || 3) (0 AND 3) || 3
+1 0 1
+create or replace view v1 as select 0 AND 3 XOR 3, 0 AND (3 XOR 3), (0 AND 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 xor 3 AS `0 AND 3 XOR 3`,0 and (3 xor 3) AS `0 AND (3 XOR 3)`,0 and 3 xor 3 AS `(0 AND 3) XOR 3`
+select 0 AND 3 XOR 3, 0 AND (3 XOR 3), (0 AND 3) XOR 3 union select * from v1;
+0 AND 3 XOR 3 0 AND (3 XOR 3) (0 AND 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 AND 3 = 3, 2 AND (3 = 3), (2 AND 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 = 3 AS `2 AND 3 = 3`,2 and 3 = 3 AS `2 AND (3 = 3)`,(2 and 3) = 3 AS `(2 AND 3) = 3`
+select 2 AND 3 = 3, 2 AND (3 = 3), (2 AND 3) = 3 union select * from v1;
+2 AND 3 = 3 2 AND (3 = 3) (2 AND 3) = 3
+1 1 0
+create or replace view v1 as select 2 AND 3 <=> 3, 2 AND (3 <=> 3), (2 AND 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <=> 3 AS `2 AND 3 <=> 3`,2 and 3 <=> 3 AS `2 AND (3 <=> 3)`,(2 and 3) <=> 3 AS `(2 AND 3) <=> 3`
+select 2 AND 3 <=> 3, 2 AND (3 <=> 3), (2 AND 3) <=> 3 union select * from v1;
+2 AND 3 <=> 3 2 AND (3 <=> 3) (2 AND 3) <=> 3
+1 1 0
+create or replace view v1 as select 2 AND 3 >= 3, 2 AND (3 >= 3), (2 AND 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 >= 3 AS `2 AND 3 >= 3`,2 and 3 >= 3 AS `2 AND (3 >= 3)`,(2 and 3) >= 3 AS `(2 AND 3) >= 3`
+select 2 AND 3 >= 3, 2 AND (3 >= 3), (2 AND 3) >= 3 union select * from v1;
+2 AND 3 >= 3 2 AND (3 >= 3) (2 AND 3) >= 3
+1 1 0
+create or replace view v1 as select 2 AND 4 <= 3, 2 AND (4 <= 3), (2 AND 4) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 4 <= 3 AS `2 AND 4 <= 3`,2 and 4 <= 3 AS `2 AND (4 <= 3)`,(2 and 4) <= 3 AS `(2 AND 4) <= 3`
+select 2 AND 4 <= 3, 2 AND (4 <= 3), (2 AND 4) <= 3 union select * from v1;
+2 AND 4 <= 3 2 AND (4 <= 3) (2 AND 4) <= 3
+0 0 1
+create or replace view v1 as select 2 AND 3 < 3, 2 AND (3 < 3), (2 AND 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 < 3 AS `2 AND 3 < 3`,2 and 3 < 3 AS `2 AND (3 < 3)`,(2 and 3) < 3 AS `(2 AND 3) < 3`
+select 2 AND 3 < 3, 2 AND (3 < 3), (2 AND 3) < 3 union select * from v1;
+2 AND 3 < 3 2 AND (3 < 3) (2 AND 3) < 3
+0 0 1
+create or replace view v1 as select 2 AND 3 <> 3, 2 AND (3 <> 3), (2 AND 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <> 3 AS `2 AND 3 <> 3`,2 and 3 <> 3 AS `2 AND (3 <> 3)`,(2 and 3) <> 3 AS `(2 AND 3) <> 3`
+select 2 AND 3 <> 3, 2 AND (3 <> 3), (2 AND 3) <> 3 union select * from v1;
+2 AND 3 <> 3 2 AND (3 <> 3) (2 AND 3) <> 3
+0 0 1
+create or replace view v1 as select 2 AND 3 > 1, 2 AND (3 > 1), (2 AND 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 > 1 AS `2 AND 3 > 1`,2 and 3 > 1 AS `2 AND (3 > 1)`,(2 and 3) > 1 AS `(2 AND 3) > 1`
+select 2 AND 3 > 1, 2 AND (3 > 1), (2 AND 3) > 1 union select * from v1;
+2 AND 3 > 1 2 AND (3 > 1) (2 AND 3) > 1
+1 1 0
+create or replace view v1 as select 2 AND 3 != 3, 2 AND (3 != 3), (2 AND 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <> 3 AS `2 AND 3 != 3`,2 and 3 <> 3 AS `2 AND (3 != 3)`,(2 and 3) <> 3 AS `(2 AND 3) != 3`
+select 2 AND 3 != 3, 2 AND (3 != 3), (2 AND 3) != 3 union select * from v1;
+2 AND 3 != 3 2 AND (3 != 3) (2 AND 3) != 3
+0 0 1
+create or replace view v1 as select 2 AND 3 LIKE 3, 2 AND (3 LIKE 3), (2 AND 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 like 3 AS `2 AND 3 LIKE 3`,2 and 3 like 3 AS `2 AND (3 LIKE 3)`,(2 and 3) like 3 AS `(2 AND 3) LIKE 3`
+select 2 AND 3 LIKE 3, 2 AND (3 LIKE 3), (2 AND 3) LIKE 3 union select * from v1;
+2 AND 3 LIKE 3 2 AND (3 LIKE 3) (2 AND 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 AND 3 REGEXP 3, 2 AND (3 REGEXP 3), (2 AND 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 regexp 3 AS `2 AND 3 REGEXP 3`,2 and 3 regexp 3 AS `2 AND (3 REGEXP 3)`,(2 and 3) regexp 3 AS `(2 AND 3) REGEXP 3`
+select 2 AND 3 REGEXP 3, 2 AND (3 REGEXP 3), (2 AND 3) REGEXP 3 union select * from v1;
+2 AND 3 REGEXP 3 2 AND (3 REGEXP 3) (2 AND 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 AND 3 | 3, 2 AND (3 | 3), (2 AND 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 | 3 AS `2 AND 3 | 3`,2 and 3 | 3 AS `2 AND (3 | 3)`,(2 and 3) | 3 AS `(2 AND 3) | 3`
+select 2 AND 3 | 3, 2 AND (3 | 3), (2 AND 3) | 3 union select * from v1;
+2 AND 3 | 3 2 AND (3 | 3) (2 AND 3) | 3
+1 1 3
+create or replace view v1 as select 2 AND 2 & 2, 2 AND (2 & 2), (2 AND 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 2 & 2 AS `2 AND 2 & 2`,2 and 2 & 2 AS `2 AND (2 & 2)`,(2 and 2) & 2 AS `(2 AND 2) & 2`
+select 2 AND 2 & 2, 2 AND (2 & 2), (2 AND 2) & 2 union select * from v1;
+2 AND 2 & 2 2 AND (2 & 2) (2 AND 2) & 2
+1 1 0
+create or replace view v1 as select 2 AND 3 << 3, 2 AND (3 << 3), (2 AND 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 << 3 AS `2 AND 3 << 3`,2 and 3 << 3 AS `2 AND (3 << 3)`,(2 and 3) << 3 AS `(2 AND 3) << 3`
+select 2 AND 3 << 3, 2 AND (3 << 3), (2 AND 3) << 3 union select * from v1;
+2 AND 3 << 3 2 AND (3 << 3) (2 AND 3) << 3
+1 1 8
+create or replace view v1 as select 2 AND 3 >> 1, 2 AND (3 >> 1), (2 AND 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 >> 1 AS `2 AND 3 >> 1`,2 and 3 >> 1 AS `2 AND (3 >> 1)`,(2 and 3) >> 1 AS `(2 AND 3) >> 1`
+select 2 AND 3 >> 1, 2 AND (3 >> 1), (2 AND 3) >> 1 union select * from v1;
+2 AND 3 >> 1 2 AND (3 >> 1) (2 AND 3) >> 1
+1 1 0
+create or replace view v1 as select 2 AND '2000-01-01' +INTERVAL 1 DAY, 2 AND ('2000-01-01' +INTERVAL 1 DAY), (2 AND '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and '2000-01-01' + interval 1 day AS `2 AND '2000-01-01' +INTERVAL 1 DAY`,2 and '2000-01-01' + interval 1 day AS `2 AND ('2000-01-01' +INTERVAL 1 DAY)`,(2 and '2000-01-01') + interval 1 day AS `(2 AND '2000-01-01') +INTERVAL 1 DAY`
+select 2 AND '2000-01-01' +INTERVAL 1 DAY, 2 AND ('2000-01-01' +INTERVAL 1 DAY), (2 AND '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 AND '2000-01-01' +INTERVAL 1 DAY 2 AND ('2000-01-01' +INTERVAL 1 DAY) (2 AND '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 AND 3 + 3, 2 AND (3 + 3), (2 AND 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 + 3 AS `2 AND 3 + 3`,2 and 3 + 3 AS `2 AND (3 + 3)`,(2 and 3) + 3 AS `(2 AND 3) + 3`
+select 2 AND 3 + 3, 2 AND (3 + 3), (2 AND 3) + 3 union select * from v1;
+2 AND 3 + 3 2 AND (3 + 3) (2 AND 3) + 3
+1 1 4
+create or replace view v1 as select 2 AND 3 - 3, 2 AND (3 - 3), (2 AND 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 - 3 AS `2 AND 3 - 3`,2 and 3 - 3 AS `2 AND (3 - 3)`,(2 and 3) - 3 AS `(2 AND 3) - 3`
+select 2 AND 3 - 3, 2 AND (3 - 3), (2 AND 3) - 3 union select * from v1;
+2 AND 3 - 3 2 AND (3 - 3) (2 AND 3) - 3
+0 0 -2
+create or replace view v1 as select 2 AND 3 * 3, 2 AND (3 * 3), (2 AND 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 * 3 AS `2 AND 3 * 3`,2 and 3 * 3 AS `2 AND (3 * 3)`,(2 and 3) * 3 AS `(2 AND 3) * 3`
+select 2 AND 3 * 3, 2 AND (3 * 3), (2 AND 3) * 3 union select * from v1;
+2 AND 3 * 3 2 AND (3 * 3) (2 AND 3) * 3
+1 1 3
+create or replace view v1 as select 2 AND 3 / 3, 2 AND (3 / 3), (2 AND 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 / 3 AS `2 AND 3 / 3`,2 and 3 / 3 AS `2 AND (3 / 3)`,(2 and 3) / 3 AS `(2 AND 3) / 3`
+select 2 AND 3 / 3, 2 AND (3 / 3), (2 AND 3) / 3 union select * from v1;
+2 AND 3 / 3 2 AND (3 / 3) (2 AND 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 AND 3 DIV 3, 2 AND (3 DIV 3), (2 AND 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 DIV 3 AS `2 AND 3 DIV 3`,2 and 3 DIV 3 AS `2 AND (3 DIV 3)`,(2 and 3) DIV 3 AS `(2 AND 3) DIV 3`
+select 2 AND 3 DIV 3, 2 AND (3 DIV 3), (2 AND 3) DIV 3 union select * from v1;
+2 AND 3 DIV 3 2 AND (3 DIV 3) (2 AND 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 AND 3 MOD 3, 2 AND (3 MOD 3), (2 AND 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 % 3 AS `2 AND 3 MOD 3`,2 and 3 % 3 AS `2 AND (3 MOD 3)`,(2 and 3) % 3 AS `(2 AND 3) MOD 3`
+select 2 AND 3 MOD 3, 2 AND (3 MOD 3), (2 AND 3) MOD 3 union select * from v1;
+2 AND 3 MOD 3 2 AND (3 MOD 3) (2 AND 3) MOD 3
+0 0 1
+create or replace view v1 as select 2 AND 3 % 3, 2 AND (3 % 3), (2 AND 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 % 3 AS `2 AND 3 % 3`,2 and 3 % 3 AS `2 AND (3 % 3)`,(2 and 3) % 3 AS `(2 AND 3) % 3`
+select 2 AND 3 % 3, 2 AND (3 % 3), (2 AND 3) % 3 union select * from v1;
+2 AND 3 % 3 2 AND (3 % 3) (2 AND 3) % 3
+0 0 1
+create or replace view v1 as select 2 AND 3 ^ 3, 2 AND (3 ^ 3), (2 AND 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 ^ 3 AS `2 AND 3 ^ 3`,2 and 3 ^ 3 AS `2 AND (3 ^ 3)`,(2 and 3) ^ 3 AS `(2 AND 3) ^ 3`
+select 2 AND 3 ^ 3, 2 AND (3 ^ 3), (2 AND 3) ^ 3 union select * from v1;
+2 AND 3 ^ 3 2 AND (3 ^ 3) (2 AND 3) ^ 3
+0 0 2
+create or replace view v1 as select 2 AND 3 BETWEEN 2 AND 3, 2 AND (3 BETWEEN 2 AND 3), (2 AND 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 between 2 and 3 AS `2 AND 3 BETWEEN 2 AND 3`,2 and 3 between 2 and 3 AS `2 AND (3 BETWEEN 2 AND 3)`,(2 and 3) between 2 and 3 AS `(2 AND 3) BETWEEN 2 AND 3`
+select 2 AND 3 BETWEEN 2 AND 3, 2 AND (3 BETWEEN 2 AND 3), (2 AND 3) BETWEEN 2 AND 3 union select * from v1;
+2 AND 3 BETWEEN 2 AND 3 2 AND (3 BETWEEN 2 AND 3) (2 AND 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select 0 && 3 IS FALSE, 0 && (3 IS FALSE), (0 && 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 is false AS `0 && 3 IS FALSE`,0 and 3 is false AS `0 && (3 IS FALSE)`,(0 and 3) is false AS `(0 && 3) IS FALSE`
+select 0 && 3 IS FALSE, 0 && (3 IS FALSE), (0 && 3) IS FALSE union select * from v1;
+0 && 3 IS FALSE 0 && (3 IS FALSE) (0 && 3) IS FALSE
+0 0 1
+create or replace view v1 as select charset(2 && 3 COLLATE latin1_bin), charset(2 && (3 COLLATE latin1_bin)), charset((2 && 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 and 3 collate latin1_bin) AS `charset(2 && 3 COLLATE latin1_bin)`,charset(2 and 3 collate latin1_bin) AS `charset(2 && (3 COLLATE latin1_bin))`,charset((2 and 3) collate latin1_bin) AS `charset((2 && 3) COLLATE latin1_bin)`
+select charset(2 && 3 COLLATE latin1_bin), charset(2 && (3 COLLATE latin1_bin)), charset((2 && 3) COLLATE latin1_bin) union select * from v1;
+charset(2 && 3 COLLATE latin1_bin) charset(2 && (3 COLLATE latin1_bin)) charset((2 && 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 && 3 IN (0,1), 2 && (3 IN (0,1)), (2 && 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 in (0,1) AS `2 && 3 IN (0,1)`,2 and 3 in (0,1) AS `2 && (3 IN (0,1))`,(2 and 3) in (0,1) AS `(2 && 3) IN (0,1)`
+select 2 && 3 IN (0,1), 2 && (3 IN (0,1)), (2 && 3) IN (0,1) union select * from v1;
+2 && 3 IN (0,1) 2 && (3 IN (0,1)) (2 && 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 0 && 3 OR 3, 0 && (3 OR 3), (0 && 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 or 3 AS `0 && 3 OR 3`,0 and (3 or 3) AS `0 && (3 OR 3)`,0 and 3 or 3 AS `(0 && 3) OR 3`
+select 0 && 3 OR 3, 0 && (3 OR 3), (0 && 3) OR 3 union select * from v1;
+0 && 3 OR 3 0 && (3 OR 3) (0 && 3) OR 3
+1 0 1
+create or replace view v1 as select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 or 3 AS `0 && 3 || 3`,0 and (3 or 3) AS `0 && (3 || 3)`,0 and 3 or 3 AS `(0 && 3) || 3`
+select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3 union select * from v1;
+0 && 3 || 3 0 && (3 || 3) (0 && 3) || 3
+1 0 1
+create or replace view v1 as select 0 && 3 XOR 3, 0 && (3 XOR 3), (0 && 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and 3 xor 3 AS `0 && 3 XOR 3`,0 and (3 xor 3) AS `0 && (3 XOR 3)`,0 and 3 xor 3 AS `(0 && 3) XOR 3`
+select 0 && 3 XOR 3, 0 && (3 XOR 3), (0 && 3) XOR 3 union select * from v1;
+0 && 3 XOR 3 0 && (3 XOR 3) (0 && 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 && 3 = 3, 2 && (3 = 3), (2 && 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 = 3 AS `2 && 3 = 3`,2 and 3 = 3 AS `2 && (3 = 3)`,(2 and 3) = 3 AS `(2 && 3) = 3`
+select 2 && 3 = 3, 2 && (3 = 3), (2 && 3) = 3 union select * from v1;
+2 && 3 = 3 2 && (3 = 3) (2 && 3) = 3
+1 1 0
+create or replace view v1 as select 2 && 3 <=> 3, 2 && (3 <=> 3), (2 && 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <=> 3 AS `2 && 3 <=> 3`,2 and 3 <=> 3 AS `2 && (3 <=> 3)`,(2 and 3) <=> 3 AS `(2 && 3) <=> 3`
+select 2 && 3 <=> 3, 2 && (3 <=> 3), (2 && 3) <=> 3 union select * from v1;
+2 && 3 <=> 3 2 && (3 <=> 3) (2 && 3) <=> 3
+1 1 0
+create or replace view v1 as select 2 && 3 >= 3, 2 && (3 >= 3), (2 && 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 >= 3 AS `2 && 3 >= 3`,2 and 3 >= 3 AS `2 && (3 >= 3)`,(2 and 3) >= 3 AS `(2 && 3) >= 3`
+select 2 && 3 >= 3, 2 && (3 >= 3), (2 && 3) >= 3 union select * from v1;
+2 && 3 >= 3 2 && (3 >= 3) (2 && 3) >= 3
+1 1 0
+create or replace view v1 as select 2 && 4 <= 3, 2 && (4 <= 3), (2 && 4) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 4 <= 3 AS `2 && 4 <= 3`,2 and 4 <= 3 AS `2 && (4 <= 3)`,(2 and 4) <= 3 AS `(2 && 4) <= 3`
+select 2 && 4 <= 3, 2 && (4 <= 3), (2 && 4) <= 3 union select * from v1;
+2 && 4 <= 3 2 && (4 <= 3) (2 && 4) <= 3
+0 0 1
+create or replace view v1 as select 2 && 3 < 3, 2 && (3 < 3), (2 && 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 < 3 AS `2 && 3 < 3`,2 and 3 < 3 AS `2 && (3 < 3)`,(2 and 3) < 3 AS `(2 && 3) < 3`
+select 2 && 3 < 3, 2 && (3 < 3), (2 && 3) < 3 union select * from v1;
+2 && 3 < 3 2 && (3 < 3) (2 && 3) < 3
+0 0 1
+create or replace view v1 as select 2 && 3 <> 3, 2 && (3 <> 3), (2 && 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <> 3 AS `2 && 3 <> 3`,2 and 3 <> 3 AS `2 && (3 <> 3)`,(2 and 3) <> 3 AS `(2 && 3) <> 3`
+select 2 && 3 <> 3, 2 && (3 <> 3), (2 && 3) <> 3 union select * from v1;
+2 && 3 <> 3 2 && (3 <> 3) (2 && 3) <> 3
+0 0 1
+create or replace view v1 as select 2 && 3 > 1, 2 && (3 > 1), (2 && 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 > 1 AS `2 && 3 > 1`,2 and 3 > 1 AS `2 && (3 > 1)`,(2 and 3) > 1 AS `(2 && 3) > 1`
+select 2 && 3 > 1, 2 && (3 > 1), (2 && 3) > 1 union select * from v1;
+2 && 3 > 1 2 && (3 > 1) (2 && 3) > 1
+1 1 0
+create or replace view v1 as select 2 && 3 != 3, 2 && (3 != 3), (2 && 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 <> 3 AS `2 && 3 != 3`,2 and 3 <> 3 AS `2 && (3 != 3)`,(2 and 3) <> 3 AS `(2 && 3) != 3`
+select 2 && 3 != 3, 2 && (3 != 3), (2 && 3) != 3 union select * from v1;
+2 && 3 != 3 2 && (3 != 3) (2 && 3) != 3
+0 0 1
+create or replace view v1 as select 2 && 3 LIKE 3, 2 && (3 LIKE 3), (2 && 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 like 3 AS `2 && 3 LIKE 3`,2 and 3 like 3 AS `2 && (3 LIKE 3)`,(2 and 3) like 3 AS `(2 && 3) LIKE 3`
+select 2 && 3 LIKE 3, 2 && (3 LIKE 3), (2 && 3) LIKE 3 union select * from v1;
+2 && 3 LIKE 3 2 && (3 LIKE 3) (2 && 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 && 3 REGEXP 3, 2 && (3 REGEXP 3), (2 && 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 regexp 3 AS `2 && 3 REGEXP 3`,2 and 3 regexp 3 AS `2 && (3 REGEXP 3)`,(2 and 3) regexp 3 AS `(2 && 3) REGEXP 3`
+select 2 && 3 REGEXP 3, 2 && (3 REGEXP 3), (2 && 3) REGEXP 3 union select * from v1;
+2 && 3 REGEXP 3 2 && (3 REGEXP 3) (2 && 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 && 3 | 3, 2 && (3 | 3), (2 && 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 | 3 AS `2 && 3 | 3`,2 and 3 | 3 AS `2 && (3 | 3)`,(2 and 3) | 3 AS `(2 && 3) | 3`
+select 2 && 3 | 3, 2 && (3 | 3), (2 && 3) | 3 union select * from v1;
+2 && 3 | 3 2 && (3 | 3) (2 && 3) | 3
+1 1 3
+create or replace view v1 as select 2 && 2 & 2, 2 && (2 & 2), (2 && 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 2 & 2 AS `2 && 2 & 2`,2 and 2 & 2 AS `2 && (2 & 2)`,(2 and 2) & 2 AS `(2 && 2) & 2`
+select 2 && 2 & 2, 2 && (2 & 2), (2 && 2) & 2 union select * from v1;
+2 && 2 & 2 2 && (2 & 2) (2 && 2) & 2
+1 1 0
+create or replace view v1 as select 2 && 3 << 3, 2 && (3 << 3), (2 && 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 << 3 AS `2 && 3 << 3`,2 and 3 << 3 AS `2 && (3 << 3)`,(2 and 3) << 3 AS `(2 && 3) << 3`
+select 2 && 3 << 3, 2 && (3 << 3), (2 && 3) << 3 union select * from v1;
+2 && 3 << 3 2 && (3 << 3) (2 && 3) << 3
+1 1 8
+create or replace view v1 as select 2 && 3 >> 1, 2 && (3 >> 1), (2 && 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 >> 1 AS `2 && 3 >> 1`,2 and 3 >> 1 AS `2 && (3 >> 1)`,(2 and 3) >> 1 AS `(2 && 3) >> 1`
+select 2 && 3 >> 1, 2 && (3 >> 1), (2 && 3) >> 1 union select * from v1;
+2 && 3 >> 1 2 && (3 >> 1) (2 && 3) >> 1
+1 1 0
+create or replace view v1 as select 2 && '2000-01-01' +INTERVAL 1 DAY, 2 && ('2000-01-01' +INTERVAL 1 DAY), (2 && '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and '2000-01-01' + interval 1 day AS `2 && '2000-01-01' +INTERVAL 1 DAY`,2 and '2000-01-01' + interval 1 day AS `2 && ('2000-01-01' +INTERVAL 1 DAY)`,(2 and '2000-01-01') + interval 1 day AS `(2 && '2000-01-01') +INTERVAL 1 DAY`
+select 2 && '2000-01-01' +INTERVAL 1 DAY, 2 && ('2000-01-01' +INTERVAL 1 DAY), (2 && '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 && '2000-01-01' +INTERVAL 1 DAY 2 && ('2000-01-01' +INTERVAL 1 DAY) (2 && '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 && 3 + 3, 2 && (3 + 3), (2 && 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 + 3 AS `2 && 3 + 3`,2 and 3 + 3 AS `2 && (3 + 3)`,(2 and 3) + 3 AS `(2 && 3) + 3`
+select 2 && 3 + 3, 2 && (3 + 3), (2 && 3) + 3 union select * from v1;
+2 && 3 + 3 2 && (3 + 3) (2 && 3) + 3
+1 1 4
+create or replace view v1 as select 2 && 3 - 3, 2 && (3 - 3), (2 && 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 - 3 AS `2 && 3 - 3`,2 and 3 - 3 AS `2 && (3 - 3)`,(2 and 3) - 3 AS `(2 && 3) - 3`
+select 2 && 3 - 3, 2 && (3 - 3), (2 && 3) - 3 union select * from v1;
+2 && 3 - 3 2 && (3 - 3) (2 && 3) - 3
+0 0 -2
+create or replace view v1 as select 2 && 3 * 3, 2 && (3 * 3), (2 && 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 * 3 AS `2 && 3 * 3`,2 and 3 * 3 AS `2 && (3 * 3)`,(2 and 3) * 3 AS `(2 && 3) * 3`
+select 2 && 3 * 3, 2 && (3 * 3), (2 && 3) * 3 union select * from v1;
+2 && 3 * 3 2 && (3 * 3) (2 && 3) * 3
+1 1 3
+create or replace view v1 as select 2 && 3 / 3, 2 && (3 / 3), (2 && 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 / 3 AS `2 && 3 / 3`,2 and 3 / 3 AS `2 && (3 / 3)`,(2 and 3) / 3 AS `(2 && 3) / 3`
+select 2 && 3 / 3, 2 && (3 / 3), (2 && 3) / 3 union select * from v1;
+2 && 3 / 3 2 && (3 / 3) (2 && 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 && 3 DIV 3, 2 && (3 DIV 3), (2 && 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 DIV 3 AS `2 && 3 DIV 3`,2 and 3 DIV 3 AS `2 && (3 DIV 3)`,(2 and 3) DIV 3 AS `(2 && 3) DIV 3`
+select 2 && 3 DIV 3, 2 && (3 DIV 3), (2 && 3) DIV 3 union select * from v1;
+2 && 3 DIV 3 2 && (3 DIV 3) (2 && 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 && 3 MOD 3, 2 && (3 MOD 3), (2 && 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 % 3 AS `2 && 3 MOD 3`,2 and 3 % 3 AS `2 && (3 MOD 3)`,(2 and 3) % 3 AS `(2 && 3) MOD 3`
+select 2 && 3 MOD 3, 2 && (3 MOD 3), (2 && 3) MOD 3 union select * from v1;
+2 && 3 MOD 3 2 && (3 MOD 3) (2 && 3) MOD 3
+0 0 1
+create or replace view v1 as select 2 && 3 % 3, 2 && (3 % 3), (2 && 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 % 3 AS `2 && 3 % 3`,2 and 3 % 3 AS `2 && (3 % 3)`,(2 and 3) % 3 AS `(2 && 3) % 3`
+select 2 && 3 % 3, 2 && (3 % 3), (2 && 3) % 3 union select * from v1;
+2 && 3 % 3 2 && (3 % 3) (2 && 3) % 3
+0 0 1
+create or replace view v1 as select 2 && 3 ^ 3, 2 && (3 ^ 3), (2 && 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 ^ 3 AS `2 && 3 ^ 3`,2 and 3 ^ 3 AS `2 && (3 ^ 3)`,(2 and 3) ^ 3 AS `(2 && 3) ^ 3`
+select 2 && 3 ^ 3, 2 && (3 ^ 3), (2 && 3) ^ 3 union select * from v1;
+2 && 3 ^ 3 2 && (3 ^ 3) (2 && 3) ^ 3
+0 0 2
+create or replace view v1 as select 2 && 3 BETWEEN 2 AND 3, 2 && (3 BETWEEN 2 AND 3), (2 && 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 between 2 and 3 AS `2 && 3 BETWEEN 2 AND 3`,2 and 3 between 2 and 3 AS `2 && (3 BETWEEN 2 AND 3)`,(2 and 3) between 2 and 3 AS `(2 && 3) BETWEEN 2 AND 3`
+select 2 && 3 BETWEEN 2 AND 3, 2 && (3 BETWEEN 2 AND 3), (2 && 3) BETWEEN 2 AND 3 union select * from v1;
+2 && 3 BETWEEN 2 AND 3 2 && (3 BETWEEN 2 AND 3) (2 && 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select 2 = 3 IS FALSE, 2 = (3 IS FALSE), (2 = 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 is false AS `2 = 3 IS FALSE`,2 = (3 is false) AS `2 = (3 IS FALSE)`,2 = 3 is false AS `(2 = 3) IS FALSE`
+select 2 = 3 IS FALSE, 2 = (3 IS FALSE), (2 = 3) IS FALSE union select * from v1;
+2 = 3 IS FALSE 2 = (3 IS FALSE) (2 = 3) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 = 3 COLLATE latin1_bin), charset(2 = (3 COLLATE latin1_bin)), charset((2 = 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 = 3 collate latin1_bin) AS `charset(2 = 3 COLLATE latin1_bin)`,charset(2 = 3 collate latin1_bin) AS `charset(2 = (3 COLLATE latin1_bin))`,charset((2 = 3) collate latin1_bin) AS `charset((2 = 3) COLLATE latin1_bin)`
+select charset(2 = 3 COLLATE latin1_bin), charset(2 = (3 COLLATE latin1_bin)), charset((2 = 3) COLLATE latin1_bin) union select * from v1;
+charset(2 = 3 COLLATE latin1_bin) charset(2 = (3 COLLATE latin1_bin)) charset((2 = 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 = 3 IN (0,1), 2 = (3 IN (0,1)), (2 = 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 in (0,1) AS `2 = 3 IN (0,1)`,2 = 3 in (0,1) AS `2 = (3 IN (0,1))`,(2 = 3) in (0,1) AS `(2 = 3) IN (0,1)`
+select 2 = 3 IN (0,1), 2 = (3 IN (0,1)), (2 = 3) IN (0,1) union select * from v1;
+2 = 3 IN (0,1) 2 = (3 IN (0,1)) (2 = 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 2 = 3 OR 3, 2 = (3 OR 3), (2 = 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 or 3 AS `2 = 3 OR 3`,2 = (3 or 3) AS `2 = (3 OR 3)`,2 = 3 or 3 AS `(2 = 3) OR 3`
+select 2 = 3 OR 3, 2 = (3 OR 3), (2 = 3) OR 3 union select * from v1;
+2 = 3 OR 3 2 = (3 OR 3) (2 = 3) OR 3
+1 0 1
+create or replace view v1 as select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 or 3 AS `2 = 3 || 3`,2 = (3 or 3) AS `2 = (3 || 3)`,2 = 3 or 3 AS `(2 = 3) || 3`
+select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3 union select * from v1;
+2 = 3 || 3 2 = (3 || 3) (2 = 3) || 3
+1 0 1
+create or replace view v1 as select 2 = 3 XOR 3, 2 = (3 XOR 3), (2 = 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 xor 3 AS `2 = 3 XOR 3`,2 = (3 xor 3) AS `2 = (3 XOR 3)`,2 = 3 xor 3 AS `(2 = 3) XOR 3`
+select 2 = 3 XOR 3, 2 = (3 XOR 3), (2 = 3) XOR 3 union select * from v1;
+2 = 3 XOR 3 2 = (3 XOR 3) (2 = 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 = 2 AND 2, 2 = (2 AND 2), (2 = 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 2 and 2 AS `2 = 2 AND 2`,2 = (2 and 2) AS `2 = (2 AND 2)`,2 = 2 and 2 AS `(2 = 2) AND 2`
+select 2 = 2 AND 2, 2 = (2 AND 2), (2 = 2) AND 2 union select * from v1;
+2 = 2 AND 2 2 = (2 AND 2) (2 = 2) AND 2
+1 0 1
+create or replace view v1 as select 2 = 2 && 2, 2 = (2 && 2), (2 = 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 2 and 2 AS `2 = 2 && 2`,2 = (2 and 2) AS `2 = (2 && 2)`,2 = 2 and 2 AS `(2 = 2) && 2`
+select 2 = 2 && 2, 2 = (2 && 2), (2 = 2) && 2 union select * from v1;
+2 = 2 && 2 2 = (2 && 2) (2 = 2) && 2
+1 0 1
+create or replace view v1 as select 1 = 3 = 3, 1 = (3 = 3), (1 = 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 = 3 AS `1 = 3 = 3`,1 = (3 = 3) AS `1 = (3 = 3)`,1 = 3 = 3 AS `(1 = 3) = 3`
+select 1 = 3 = 3, 1 = (3 = 3), (1 = 3) = 3 union select * from v1;
+1 = 3 = 3 1 = (3 = 3) (1 = 3) = 3
+0 1 0
+create or replace view v1 as select 1 = 3 <=> 3, 1 = (3 <=> 3), (1 = 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 <=> 3 AS `1 = 3 <=> 3`,1 = (3 <=> 3) AS `1 = (3 <=> 3)`,1 = 3 <=> 3 AS `(1 = 3) <=> 3`
+select 1 = 3 <=> 3, 1 = (3 <=> 3), (1 = 3) <=> 3 union select * from v1;
+1 = 3 <=> 3 1 = (3 <=> 3) (1 = 3) <=> 3
+0 1 0
+create or replace view v1 as select 1 = 3 >= 3, 1 = (3 >= 3), (1 = 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 >= 3 AS `1 = 3 >= 3`,1 = (3 >= 3) AS `1 = (3 >= 3)`,1 = 3 >= 3 AS `(1 = 3) >= 3`
+select 1 = 3 >= 3, 1 = (3 >= 3), (1 = 3) >= 3 union select * from v1;
+1 = 3 >= 3 1 = (3 >= 3) (1 = 3) >= 3
+0 1 0
+create or replace view v1 as select 2 = 3 <= 3, 2 = (3 <= 3), (2 = 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 <= 3 AS `2 = 3 <= 3`,2 = (3 <= 3) AS `2 = (3 <= 3)`,2 = 3 <= 3 AS `(2 = 3) <= 3`
+select 2 = 3 <= 3, 2 = (3 <= 3), (2 = 3) <= 3 union select * from v1;
+2 = 3 <= 3 2 = (3 <= 3) (2 = 3) <= 3
+1 0 1
+create or replace view v1 as select 2 = 3 < 3, 2 = (3 < 3), (2 = 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 < 3 AS `2 = 3 < 3`,2 = (3 < 3) AS `2 = (3 < 3)`,2 = 3 < 3 AS `(2 = 3) < 3`
+select 2 = 3 < 3, 2 = (3 < 3), (2 = 3) < 3 union select * from v1;
+2 = 3 < 3 2 = (3 < 3) (2 = 3) < 3
+1 0 1
+create or replace view v1 as select 2 = 3 <> 3, 2 = (3 <> 3), (2 = 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 <> 3 AS `2 = 3 <> 3`,2 = (3 <> 3) AS `2 = (3 <> 3)`,2 = 3 <> 3 AS `(2 = 3) <> 3`
+select 2 = 3 <> 3, 2 = (3 <> 3), (2 = 3) <> 3 union select * from v1;
+2 = 3 <> 3 2 = (3 <> 3) (2 = 3) <> 3
+1 0 1
+create or replace view v1 as select 0 = 3 > 3, 0 = (3 > 3), (0 = 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 = 3 > 3 AS `0 = 3 > 3`,0 = (3 > 3) AS `0 = (3 > 3)`,0 = 3 > 3 AS `(0 = 3) > 3`
+select 0 = 3 > 3, 0 = (3 > 3), (0 = 3) > 3 union select * from v1;
+0 = 3 > 3 0 = (3 > 3) (0 = 3) > 3
+0 1 0
+create or replace view v1 as select 2 = 3 != 3, 2 = (3 != 3), (2 = 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 <> 3 AS `2 = 3 != 3`,2 = (3 <> 3) AS `2 = (3 != 3)`,2 = 3 <> 3 AS `(2 = 3) != 3`
+select 2 = 3 != 3, 2 = (3 != 3), (2 = 3) != 3 union select * from v1;
+2 = 3 != 3 2 = (3 != 3) (2 = 3) != 3
+1 0 1
+create or replace view v1 as select 1 = 3 LIKE 3, 1 = (3 LIKE 3), (1 = 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 like 3 AS `1 = 3 LIKE 3`,1 = 3 like 3 AS `1 = (3 LIKE 3)`,(1 = 3) like 3 AS `(1 = 3) LIKE 3`
+select 1 = 3 LIKE 3, 1 = (3 LIKE 3), (1 = 3) LIKE 3 union select * from v1;
+1 = 3 LIKE 3 1 = (3 LIKE 3) (1 = 3) LIKE 3
+1 1 0
+create or replace view v1 as select 1 = 3 REGEXP 3, 1 = (3 REGEXP 3), (1 = 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 regexp 3 AS `1 = 3 REGEXP 3`,1 = 3 regexp 3 AS `1 = (3 REGEXP 3)`,(1 = 3) regexp 3 AS `(1 = 3) REGEXP 3`
+select 1 = 3 REGEXP 3, 1 = (3 REGEXP 3), (1 = 3) REGEXP 3 union select * from v1;
+1 = 3 REGEXP 3 1 = (3 REGEXP 3) (1 = 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 = 3 | 3, 2 = (3 | 3), (2 = 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 | 3 AS `2 = 3 | 3`,2 = 3 | 3 AS `2 = (3 | 3)`,(2 = 3) | 3 AS `(2 = 3) | 3`
+select 2 = 3 | 3, 2 = (3 | 3), (2 = 3) | 3 union select * from v1;
+2 = 3 | 3 2 = (3 | 3) (2 = 3) | 3
+0 0 3
+create or replace view v1 as select 2 = 3 & 2, 2 = (3 & 2), (2 = 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 & 2 AS `2 = 3 & 2`,2 = 3 & 2 AS `2 = (3 & 2)`,(2 = 3) & 2 AS `(2 = 3) & 2`
+select 2 = 3 & 2, 2 = (3 & 2), (2 = 3) & 2 union select * from v1;
+2 = 3 & 2 2 = (3 & 2) (2 = 3) & 2
+1 1 0
+create or replace view v1 as select 3 = 3 << 3, 3 = (3 << 3), (3 = 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 3 << 3 AS `3 = 3 << 3`,3 = 3 << 3 AS `3 = (3 << 3)`,(3 = 3) << 3 AS `(3 = 3) << 3`
+select 3 = 3 << 3, 3 = (3 << 3), (3 = 3) << 3 union select * from v1;
+3 = 3 << 3 3 = (3 << 3) (3 = 3) << 3
+0 0 8
+create or replace view v1 as select 1 = 3 >> 1, 1 = (3 >> 1), (1 = 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 >> 1 AS `1 = 3 >> 1`,1 = 3 >> 1 AS `1 = (3 >> 1)`,(1 = 3) >> 1 AS `(1 = 3) >> 1`
+select 1 = 3 >> 1, 1 = (3 >> 1), (1 = 3) >> 1 union select * from v1;
+1 = 3 >> 1 1 = (3 >> 1) (1 = 3) >> 1
+1 1 0
+create or replace view v1 as select 2 = '2000-01-01' +INTERVAL 1 DAY, 2 = ('2000-01-01' +INTERVAL 1 DAY), (2 = '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = '2000-01-01' + interval 1 day AS `2 = '2000-01-01' +INTERVAL 1 DAY`,2 = '2000-01-01' + interval 1 day AS `2 = ('2000-01-01' +INTERVAL 1 DAY)`,(2 = '2000-01-01') + interval 1 day AS `(2 = '2000-01-01') +INTERVAL 1 DAY`
+select 2 = '2000-01-01' +INTERVAL 1 DAY, 2 = ('2000-01-01' +INTERVAL 1 DAY), (2 = '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 = '2000-01-01' +INTERVAL 1 DAY 2 = ('2000-01-01' +INTERVAL 1 DAY) (2 = '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 = 3 + 3, 2 = (3 + 3), (2 = 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 + 3 AS `2 = 3 + 3`,2 = 3 + 3 AS `2 = (3 + 3)`,(2 = 3) + 3 AS `(2 = 3) + 3`
+select 2 = 3 + 3, 2 = (3 + 3), (2 = 3) + 3 union select * from v1;
+2 = 3 + 3 2 = (3 + 3) (2 = 3) + 3
+0 0 3
+create or replace view v1 as select 2 = 3 - 3, 2 = (3 - 3), (2 = 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 - 3 AS `2 = 3 - 3`,2 = 3 - 3 AS `2 = (3 - 3)`,(2 = 3) - 3 AS `(2 = 3) - 3`
+select 2 = 3 - 3, 2 = (3 - 3), (2 = 3) - 3 union select * from v1;
+2 = 3 - 3 2 = (3 - 3) (2 = 3) - 3
+0 0 -3
+create or replace view v1 as select 3 = 3 * 3, 3 = (3 * 3), (3 = 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 3 * 3 AS `3 = 3 * 3`,3 = 3 * 3 AS `3 = (3 * 3)`,(3 = 3) * 3 AS `(3 = 3) * 3`
+select 3 = 3 * 3, 3 = (3 * 3), (3 = 3) * 3 union select * from v1;
+3 = 3 * 3 3 = (3 * 3) (3 = 3) * 3
+0 0 3
+create or replace view v1 as select 3 = 9 / 3, 3 = (9 / 3), (3 = 9) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 9 / 3 AS `3 = 9 / 3`,3 = 9 / 3 AS `3 = (9 / 3)`,(3 = 9) / 3 AS `(3 = 9) / 3`
+select 3 = 9 / 3, 3 = (9 / 3), (3 = 9) / 3 union select * from v1;
+3 = 9 / 3 3 = (9 / 3) (3 = 9) / 3
+1 1 0.0000
+create or replace view v1 as select 3 = 9 DIV 3, 3 = (9 DIV 3), (3 = 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 9 DIV 3 AS `3 = 9 DIV 3`,3 = 9 DIV 3 AS `3 = (9 DIV 3)`,(3 = 9) DIV 3 AS `(3 = 9) DIV 3`
+select 3 = 9 DIV 3, 3 = (9 DIV 3), (3 = 9) DIV 3 union select * from v1;
+3 = 9 DIV 3 3 = (9 DIV 3) (3 = 9) DIV 3
+1 1 0
+create or replace view v1 as select 3 = 3 MOD 3, 3 = (3 MOD 3), (3 = 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 3 % 3 AS `3 = 3 MOD 3`,3 = 3 % 3 AS `3 = (3 MOD 3)`,(3 = 3) % 3 AS `(3 = 3) MOD 3`
+select 3 = 3 MOD 3, 3 = (3 MOD 3), (3 = 3) MOD 3 union select * from v1;
+3 = 3 MOD 3 3 = (3 MOD 3) (3 = 3) MOD 3
+0 0 1
+create or replace view v1 as select 3 = 3 % 3, 3 = (3 % 3), (3 = 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 = 3 % 3 AS `3 = 3 % 3`,3 = 3 % 3 AS `3 = (3 % 3)`,(3 = 3) % 3 AS `(3 = 3) % 3`
+select 3 = 3 % 3, 3 = (3 % 3), (3 = 3) % 3 union select * from v1;
+3 = 3 % 3 3 = (3 % 3) (3 = 3) % 3
+0 0 1
+create or replace view v1 as select 2 = 3 ^ 3, 2 = (3 ^ 3), (2 = 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 ^ 3 AS `2 = 3 ^ 3`,2 = 3 ^ 3 AS `2 = (3 ^ 3)`,(2 = 3) ^ 3 AS `(2 = 3) ^ 3`
+select 2 = 3 ^ 3, 2 = (3 ^ 3), (2 = 3) ^ 3 union select * from v1;
+2 = 3 ^ 3 2 = (3 ^ 3) (2 = 3) ^ 3
+0 0 3
+create or replace view v1 as select 1 = 3 BETWEEN 1 AND 3, 1 = (3 BETWEEN 1 AND 3), (1 = 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 = 3 between 1 and 3 AS `1 = 3 BETWEEN 1 AND 3`,1 = 3 between 1 and 3 AS `1 = (3 BETWEEN 1 AND 3)`,(1 = 3) between 1 and 3 AS `(1 = 3) BETWEEN 1 AND 3`
+select 1 = 3 BETWEEN 1 AND 3, 1 = (3 BETWEEN 1 AND 3), (1 = 3) BETWEEN 1 AND 3 union select * from v1;
+1 = 3 BETWEEN 1 AND 3 1 = (3 BETWEEN 1 AND 3) (1 = 3) BETWEEN 1 AND 3
+1 1 0
+create or replace view v1 as select 2 <=> 3 IS FALSE, 2 <=> (3 IS FALSE), (2 <=> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 is false AS `2 <=> 3 IS FALSE`,2 <=> (3 is false) AS `2 <=> (3 IS FALSE)`,2 <=> 3 is false AS `(2 <=> 3) IS FALSE`
+select 2 <=> 3 IS FALSE, 2 <=> (3 IS FALSE), (2 <=> 3) IS FALSE union select * from v1;
+2 <=> 3 IS FALSE 2 <=> (3 IS FALSE) (2 <=> 3) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 <=> 3 COLLATE latin1_bin), charset(2 <=> (3 COLLATE latin1_bin)), charset((2 <=> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 <=> 3 collate latin1_bin) AS `charset(2 <=> 3 COLLATE latin1_bin)`,charset(2 <=> 3 collate latin1_bin) AS `charset(2 <=> (3 COLLATE latin1_bin))`,charset((2 <=> 3) collate latin1_bin) AS `charset((2 <=> 3) COLLATE latin1_bin)`
+select charset(2 <=> 3 COLLATE latin1_bin), charset(2 <=> (3 COLLATE latin1_bin)), charset((2 <=> 3) COLLATE latin1_bin) union select * from v1;
+charset(2 <=> 3 COLLATE latin1_bin) charset(2 <=> (3 COLLATE latin1_bin)) charset((2 <=> 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 <=> 3 IN (0,1), 2 <=> (3 IN (0,1)), (2 <=> 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 in (0,1) AS `2 <=> 3 IN (0,1)`,2 <=> 3 in (0,1) AS `2 <=> (3 IN (0,1))`,(2 <=> 3) in (0,1) AS `(2 <=> 3) IN (0,1)`
+select 2 <=> 3 IN (0,1), 2 <=> (3 IN (0,1)), (2 <=> 3) IN (0,1) union select * from v1;
+2 <=> 3 IN (0,1) 2 <=> (3 IN (0,1)) (2 <=> 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 2 <=> 3 OR 3, 2 <=> (3 OR 3), (2 <=> 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 or 3 AS `2 <=> 3 OR 3`,2 <=> (3 or 3) AS `2 <=> (3 OR 3)`,2 <=> 3 or 3 AS `(2 <=> 3) OR 3`
+select 2 <=> 3 OR 3, 2 <=> (3 OR 3), (2 <=> 3) OR 3 union select * from v1;
+2 <=> 3 OR 3 2 <=> (3 OR 3) (2 <=> 3) OR 3
+1 0 1
+create or replace view v1 as select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 or 3 AS `2 <=> 3 || 3`,2 <=> (3 or 3) AS `2 <=> (3 || 3)`,2 <=> 3 or 3 AS `(2 <=> 3) || 3`
+select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3 union select * from v1;
+2 <=> 3 || 3 2 <=> (3 || 3) (2 <=> 3) || 3
+1 0 1
+create or replace view v1 as select 2 <=> 3 XOR 3, 2 <=> (3 XOR 3), (2 <=> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 xor 3 AS `2 <=> 3 XOR 3`,2 <=> (3 xor 3) AS `2 <=> (3 XOR 3)`,2 <=> 3 xor 3 AS `(2 <=> 3) XOR 3`
+select 2 <=> 3 XOR 3, 2 <=> (3 XOR 3), (2 <=> 3) XOR 3 union select * from v1;
+2 <=> 3 XOR 3 2 <=> (3 XOR 3) (2 <=> 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 <=> 2 AND 2, 2 <=> (2 AND 2), (2 <=> 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 2 and 2 AS `2 <=> 2 AND 2`,2 <=> (2 and 2) AS `2 <=> (2 AND 2)`,2 <=> 2 and 2 AS `(2 <=> 2) AND 2`
+select 2 <=> 2 AND 2, 2 <=> (2 AND 2), (2 <=> 2) AND 2 union select * from v1;
+2 <=> 2 AND 2 2 <=> (2 AND 2) (2 <=> 2) AND 2
+1 0 1
+create or replace view v1 as select 2 <=> 2 && 2, 2 <=> (2 && 2), (2 <=> 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 2 and 2 AS `2 <=> 2 && 2`,2 <=> (2 and 2) AS `2 <=> (2 && 2)`,2 <=> 2 and 2 AS `(2 <=> 2) && 2`
+select 2 <=> 2 && 2, 2 <=> (2 && 2), (2 <=> 2) && 2 union select * from v1;
+2 <=> 2 && 2 2 <=> (2 && 2) (2 <=> 2) && 2
+1 0 1
+create or replace view v1 as select 1 <=> 3 = 3, 1 <=> (3 = 3), (1 <=> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 = 3 AS `1 <=> 3 = 3`,1 <=> (3 = 3) AS `1 <=> (3 = 3)`,1 <=> 3 = 3 AS `(1 <=> 3) = 3`
+select 1 <=> 3 = 3, 1 <=> (3 = 3), (1 <=> 3) = 3 union select * from v1;
+1 <=> 3 = 3 1 <=> (3 = 3) (1 <=> 3) = 3
+0 1 0
+create or replace view v1 as select 1 <=> 3 <=> 3, 1 <=> (3 <=> 3), (1 <=> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 <=> 3 AS `1 <=> 3 <=> 3`,1 <=> (3 <=> 3) AS `1 <=> (3 <=> 3)`,1 <=> 3 <=> 3 AS `(1 <=> 3) <=> 3`
+select 1 <=> 3 <=> 3, 1 <=> (3 <=> 3), (1 <=> 3) <=> 3 union select * from v1;
+1 <=> 3 <=> 3 1 <=> (3 <=> 3) (1 <=> 3) <=> 3
+0 1 0
+create or replace view v1 as select 1 <=> 3 >= 3, 1 <=> (3 >= 3), (1 <=> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 >= 3 AS `1 <=> 3 >= 3`,1 <=> (3 >= 3) AS `1 <=> (3 >= 3)`,1 <=> 3 >= 3 AS `(1 <=> 3) >= 3`
+select 1 <=> 3 >= 3, 1 <=> (3 >= 3), (1 <=> 3) >= 3 union select * from v1;
+1 <=> 3 >= 3 1 <=> (3 >= 3) (1 <=> 3) >= 3
+0 1 0
+create or replace view v1 as select 2 <=> 3 <= 3, 2 <=> (3 <= 3), (2 <=> 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 <= 3 AS `2 <=> 3 <= 3`,2 <=> (3 <= 3) AS `2 <=> (3 <= 3)`,2 <=> 3 <= 3 AS `(2 <=> 3) <= 3`
+select 2 <=> 3 <= 3, 2 <=> (3 <= 3), (2 <=> 3) <= 3 union select * from v1;
+2 <=> 3 <= 3 2 <=> (3 <= 3) (2 <=> 3) <= 3
+1 0 1
+create or replace view v1 as select 2 <=> 3 < 3, 2 <=> (3 < 3), (2 <=> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 < 3 AS `2 <=> 3 < 3`,2 <=> (3 < 3) AS `2 <=> (3 < 3)`,2 <=> 3 < 3 AS `(2 <=> 3) < 3`
+select 2 <=> 3 < 3, 2 <=> (3 < 3), (2 <=> 3) < 3 union select * from v1;
+2 <=> 3 < 3 2 <=> (3 < 3) (2 <=> 3) < 3
+1 0 1
+create or replace view v1 as select 2 <=> 3 <> 3, 2 <=> (3 <> 3), (2 <=> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 <> 3 AS `2 <=> 3 <> 3`,2 <=> (3 <> 3) AS `2 <=> (3 <> 3)`,2 <=> 3 <> 3 AS `(2 <=> 3) <> 3`
+select 2 <=> 3 <> 3, 2 <=> (3 <> 3), (2 <=> 3) <> 3 union select * from v1;
+2 <=> 3 <> 3 2 <=> (3 <> 3) (2 <=> 3) <> 3
+1 0 1
+create or replace view v1 as select 0 <=> 3 > 3, 0 <=> (3 > 3), (0 <=> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <=> 3 > 3 AS `0 <=> 3 > 3`,0 <=> (3 > 3) AS `0 <=> (3 > 3)`,0 <=> 3 > 3 AS `(0 <=> 3) > 3`
+select 0 <=> 3 > 3, 0 <=> (3 > 3), (0 <=> 3) > 3 union select * from v1;
+0 <=> 3 > 3 0 <=> (3 > 3) (0 <=> 3) > 3
+0 1 0
+create or replace view v1 as select 2 <=> 3 != 3, 2 <=> (3 != 3), (2 <=> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 <> 3 AS `2 <=> 3 != 3`,2 <=> (3 <> 3) AS `2 <=> (3 != 3)`,2 <=> 3 <> 3 AS `(2 <=> 3) != 3`
+select 2 <=> 3 != 3, 2 <=> (3 != 3), (2 <=> 3) != 3 union select * from v1;
+2 <=> 3 != 3 2 <=> (3 != 3) (2 <=> 3) != 3
+1 0 1
+create or replace view v1 as select 1 <=> 3 LIKE 3, 1 <=> (3 LIKE 3), (1 <=> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 like 3 AS `1 <=> 3 LIKE 3`,1 <=> 3 like 3 AS `1 <=> (3 LIKE 3)`,(1 <=> 3) like 3 AS `(1 <=> 3) LIKE 3`
+select 1 <=> 3 LIKE 3, 1 <=> (3 LIKE 3), (1 <=> 3) LIKE 3 union select * from v1;
+1 <=> 3 LIKE 3 1 <=> (3 LIKE 3) (1 <=> 3) LIKE 3
+1 1 0
+create or replace view v1 as select 1 <=> 3 REGEXP 3, 1 <=> (3 REGEXP 3), (1 <=> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 regexp 3 AS `1 <=> 3 REGEXP 3`,1 <=> 3 regexp 3 AS `1 <=> (3 REGEXP 3)`,(1 <=> 3) regexp 3 AS `(1 <=> 3) REGEXP 3`
+select 1 <=> 3 REGEXP 3, 1 <=> (3 REGEXP 3), (1 <=> 3) REGEXP 3 union select * from v1;
+1 <=> 3 REGEXP 3 1 <=> (3 REGEXP 3) (1 <=> 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 <=> 3 | 3, 2 <=> (3 | 3), (2 <=> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 | 3 AS `2 <=> 3 | 3`,2 <=> 3 | 3 AS `2 <=> (3 | 3)`,(2 <=> 3) | 3 AS `(2 <=> 3) | 3`
+select 2 <=> 3 | 3, 2 <=> (3 | 3), (2 <=> 3) | 3 union select * from v1;
+2 <=> 3 | 3 2 <=> (3 | 3) (2 <=> 3) | 3
+0 0 3
+create or replace view v1 as select 2 <=> 3 & 2, 2 <=> (3 & 2), (2 <=> 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 & 2 AS `2 <=> 3 & 2`,2 <=> 3 & 2 AS `2 <=> (3 & 2)`,(2 <=> 3) & 2 AS `(2 <=> 3) & 2`
+select 2 <=> 3 & 2, 2 <=> (3 & 2), (2 <=> 3) & 2 union select * from v1;
+2 <=> 3 & 2 2 <=> (3 & 2) (2 <=> 3) & 2
+1 1 0
+create or replace view v1 as select 3 <=> 3 << 3, 3 <=> (3 << 3), (3 <=> 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 3 << 3 AS `3 <=> 3 << 3`,3 <=> 3 << 3 AS `3 <=> (3 << 3)`,(3 <=> 3) << 3 AS `(3 <=> 3) << 3`
+select 3 <=> 3 << 3, 3 <=> (3 << 3), (3 <=> 3) << 3 union select * from v1;
+3 <=> 3 << 3 3 <=> (3 << 3) (3 <=> 3) << 3
+0 0 8
+create or replace view v1 as select 1 <=> 3 >> 1, 1 <=> (3 >> 1), (1 <=> 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 >> 1 AS `1 <=> 3 >> 1`,1 <=> 3 >> 1 AS `1 <=> (3 >> 1)`,(1 <=> 3) >> 1 AS `(1 <=> 3) >> 1`
+select 1 <=> 3 >> 1, 1 <=> (3 >> 1), (1 <=> 3) >> 1 union select * from v1;
+1 <=> 3 >> 1 1 <=> (3 >> 1) (1 <=> 3) >> 1
+1 1 0
+create or replace view v1 as select 2 <=> '2000-01-01' +INTERVAL 1 DAY, 2 <=> ('2000-01-01' +INTERVAL 1 DAY), (2 <=> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> '2000-01-01' + interval 1 day AS `2 <=> '2000-01-01' +INTERVAL 1 DAY`,2 <=> '2000-01-01' + interval 1 day AS `2 <=> ('2000-01-01' +INTERVAL 1 DAY)`,(2 <=> '2000-01-01') + interval 1 day AS `(2 <=> '2000-01-01') +INTERVAL 1 DAY`
+select 2 <=> '2000-01-01' +INTERVAL 1 DAY, 2 <=> ('2000-01-01' +INTERVAL 1 DAY), (2 <=> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 <=> '2000-01-01' +INTERVAL 1 DAY 2 <=> ('2000-01-01' +INTERVAL 1 DAY) (2 <=> '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 <=> 3 + 3, 2 <=> (3 + 3), (2 <=> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 + 3 AS `2 <=> 3 + 3`,2 <=> 3 + 3 AS `2 <=> (3 + 3)`,(2 <=> 3) + 3 AS `(2 <=> 3) + 3`
+select 2 <=> 3 + 3, 2 <=> (3 + 3), (2 <=> 3) + 3 union select * from v1;
+2 <=> 3 + 3 2 <=> (3 + 3) (2 <=> 3) + 3
+0 0 3
+create or replace view v1 as select 2 <=> 3 - 3, 2 <=> (3 - 3), (2 <=> 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 - 3 AS `2 <=> 3 - 3`,2 <=> 3 - 3 AS `2 <=> (3 - 3)`,(2 <=> 3) - 3 AS `(2 <=> 3) - 3`
+select 2 <=> 3 - 3, 2 <=> (3 - 3), (2 <=> 3) - 3 union select * from v1;
+2 <=> 3 - 3 2 <=> (3 - 3) (2 <=> 3) - 3
+0 0 -3
+create or replace view v1 as select 3 <=> 3 * 3, 3 <=> (3 * 3), (3 <=> 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 3 * 3 AS `3 <=> 3 * 3`,3 <=> 3 * 3 AS `3 <=> (3 * 3)`,(3 <=> 3) * 3 AS `(3 <=> 3) * 3`
+select 3 <=> 3 * 3, 3 <=> (3 * 3), (3 <=> 3) * 3 union select * from v1;
+3 <=> 3 * 3 3 <=> (3 * 3) (3 <=> 3) * 3
+0 0 3
+create or replace view v1 as select 3 <=> 9 / 3, 3 <=> (9 / 3), (3 <=> 9) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 9 / 3 AS `3 <=> 9 / 3`,3 <=> 9 / 3 AS `3 <=> (9 / 3)`,(3 <=> 9) / 3 AS `(3 <=> 9) / 3`
+select 3 <=> 9 / 3, 3 <=> (9 / 3), (3 <=> 9) / 3 union select * from v1;
+3 <=> 9 / 3 3 <=> (9 / 3) (3 <=> 9) / 3
+1 1 0.0000
+create or replace view v1 as select 3 <=> 9 DIV 3, 3 <=> (9 DIV 3), (3 <=> 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 9 DIV 3 AS `3 <=> 9 DIV 3`,3 <=> 9 DIV 3 AS `3 <=> (9 DIV 3)`,(3 <=> 9) DIV 3 AS `(3 <=> 9) DIV 3`
+select 3 <=> 9 DIV 3, 3 <=> (9 DIV 3), (3 <=> 9) DIV 3 union select * from v1;
+3 <=> 9 DIV 3 3 <=> (9 DIV 3) (3 <=> 9) DIV 3
+1 1 0
+create or replace view v1 as select 3 <=> 3 MOD 3, 3 <=> (3 MOD 3), (3 <=> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 3 % 3 AS `3 <=> 3 MOD 3`,3 <=> 3 % 3 AS `3 <=> (3 MOD 3)`,(3 <=> 3) % 3 AS `(3 <=> 3) MOD 3`
+select 3 <=> 3 MOD 3, 3 <=> (3 MOD 3), (3 <=> 3) MOD 3 union select * from v1;
+3 <=> 3 MOD 3 3 <=> (3 MOD 3) (3 <=> 3) MOD 3
+0 0 1
+create or replace view v1 as select 3 <=> 3 % 3, 3 <=> (3 % 3), (3 <=> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <=> 3 % 3 AS `3 <=> 3 % 3`,3 <=> 3 % 3 AS `3 <=> (3 % 3)`,(3 <=> 3) % 3 AS `(3 <=> 3) % 3`
+select 3 <=> 3 % 3, 3 <=> (3 % 3), (3 <=> 3) % 3 union select * from v1;
+3 <=> 3 % 3 3 <=> (3 % 3) (3 <=> 3) % 3
+0 0 1
+create or replace view v1 as select 2 <=> 3 ^ 3, 2 <=> (3 ^ 3), (2 <=> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 ^ 3 AS `2 <=> 3 ^ 3`,2 <=> 3 ^ 3 AS `2 <=> (3 ^ 3)`,(2 <=> 3) ^ 3 AS `(2 <=> 3) ^ 3`
+select 2 <=> 3 ^ 3, 2 <=> (3 ^ 3), (2 <=> 3) ^ 3 union select * from v1;
+2 <=> 3 ^ 3 2 <=> (3 ^ 3) (2 <=> 3) ^ 3
+0 0 3
+create or replace view v1 as select 1 <=> 3 BETWEEN 1 AND 3, 1 <=> (3 BETWEEN 1 AND 3), (1 <=> 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <=> 3 between 1 and 3 AS `1 <=> 3 BETWEEN 1 AND 3`,1 <=> 3 between 1 and 3 AS `1 <=> (3 BETWEEN 1 AND 3)`,(1 <=> 3) between 1 and 3 AS `(1 <=> 3) BETWEEN 1 AND 3`
+select 1 <=> 3 BETWEEN 1 AND 3, 1 <=> (3 BETWEEN 1 AND 3), (1 <=> 3) BETWEEN 1 AND 3 union select * from v1;
+1 <=> 3 BETWEEN 1 AND 3 1 <=> (3 BETWEEN 1 AND 3) (1 <=> 3) BETWEEN 1 AND 3
+1 1 0
+create or replace view v1 as select 4 >= 3 IS FALSE, 4 >= (3 IS FALSE), (4 >= 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 >= 3 is false AS `4 >= 3 IS FALSE`,4 >= (3 is false) AS `4 >= (3 IS FALSE)`,4 >= 3 is false AS `(4 >= 3) IS FALSE`
+select 4 >= 3 IS FALSE, 4 >= (3 IS FALSE), (4 >= 3) IS FALSE union select * from v1;
+4 >= 3 IS FALSE 4 >= (3 IS FALSE) (4 >= 3) IS FALSE
+0 1 0
+create or replace view v1 as select charset(2 >= 3 COLLATE latin1_bin), charset(2 >= (3 COLLATE latin1_bin)), charset((2 >= 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 >= 3 collate latin1_bin) AS `charset(2 >= 3 COLLATE latin1_bin)`,charset(2 >= 3 collate latin1_bin) AS `charset(2 >= (3 COLLATE latin1_bin))`,charset((2 >= 3) collate latin1_bin) AS `charset((2 >= 3) COLLATE latin1_bin)`
+select charset(2 >= 3 COLLATE latin1_bin), charset(2 >= (3 COLLATE latin1_bin)), charset((2 >= 3) COLLATE latin1_bin) union select * from v1;
+charset(2 >= 3 COLLATE latin1_bin) charset(2 >= (3 COLLATE latin1_bin)) charset((2 >= 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 >= 3 IN (1,1), 2 >= (3 IN (1,1)), (2 >= 3) IN (1,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 in (1,1) AS `2 >= 3 IN (1,1)`,2 >= 3 in (1,1) AS `2 >= (3 IN (1,1))`,(2 >= 3) in (1,1) AS `(2 >= 3) IN (1,1)`
+select 2 >= 3 IN (1,1), 2 >= (3 IN (1,1)), (2 >= 3) IN (1,1) union select * from v1;
+2 >= 3 IN (1,1) 2 >= (3 IN (1,1)) (2 >= 3) IN (1,1)
+1 1 0
+create or replace view v1 as select 2 >= 3 OR 0, 2 >= (3 OR 0), (2 >= 3) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 or 0 AS `2 >= 3 OR 0`,2 >= (3 or 0) AS `2 >= (3 OR 0)`,2 >= 3 or 0 AS `(2 >= 3) OR 0`
+select 2 >= 3 OR 0, 2 >= (3 OR 0), (2 >= 3) OR 0 union select * from v1;
+2 >= 3 OR 0 2 >= (3 OR 0) (2 >= 3) OR 0
+0 1 0
+create or replace view v1 as select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 or 0 AS `2 >= 3 || 0`,2 >= (3 or 0) AS `2 >= (3 || 0)`,2 >= 3 or 0 AS `(2 >= 3) || 0`
+select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0 union select * from v1;
+2 >= 3 || 0 2 >= (3 || 0) (2 >= 3) || 0
+0 1 0
+create or replace view v1 as select 2 >= 3 XOR 0, 2 >= (3 XOR 0), (2 >= 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 xor 0 AS `2 >= 3 XOR 0`,2 >= (3 xor 0) AS `2 >= (3 XOR 0)`,2 >= 3 xor 0 AS `(2 >= 3) XOR 0`
+select 2 >= 3 XOR 0, 2 >= (3 XOR 0), (2 >= 3) XOR 0 union select * from v1;
+2 >= 3 XOR 0 2 >= (3 XOR 0) (2 >= 3) XOR 0
+0 1 0
+create or replace view v1 as select 2 >= 3 AND 3, 2 >= (3 AND 3), (2 >= 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 and 3 AS `2 >= 3 AND 3`,2 >= (3 and 3) AS `2 >= (3 AND 3)`,2 >= 3 and 3 AS `(2 >= 3) AND 3`
+select 2 >= 3 AND 3, 2 >= (3 AND 3), (2 >= 3) AND 3 union select * from v1;
+2 >= 3 AND 3 2 >= (3 AND 3) (2 >= 3) AND 3
+0 1 0
+create or replace view v1 as select 2 >= 3 && 3, 2 >= (3 && 3), (2 >= 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 and 3 AS `2 >= 3 && 3`,2 >= (3 and 3) AS `2 >= (3 && 3)`,2 >= 3 and 3 AS `(2 >= 3) && 3`
+select 2 >= 3 && 3, 2 >= (3 && 3), (2 >= 3) && 3 union select * from v1;
+2 >= 3 && 3 2 >= (3 && 3) (2 >= 3) && 3
+0 1 0
+create or replace view v1 as select 2 >= 3 = 3, 2 >= (3 = 3), (2 >= 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 = 3 AS `2 >= 3 = 3`,2 >= (3 = 3) AS `2 >= (3 = 3)`,2 >= 3 = 3 AS `(2 >= 3) = 3`
+select 2 >= 3 = 3, 2 >= (3 = 3), (2 >= 3) = 3 union select * from v1;
+2 >= 3 = 3 2 >= (3 = 3) (2 >= 3) = 3
+0 1 0
+create or replace view v1 as select 2 >= 3 <=> 3, 2 >= (3 <=> 3), (2 >= 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 <=> 3 AS `2 >= 3 <=> 3`,2 >= (3 <=> 3) AS `2 >= (3 <=> 3)`,2 >= 3 <=> 3 AS `(2 >= 3) <=> 3`
+select 2 >= 3 <=> 3, 2 >= (3 <=> 3), (2 >= 3) <=> 3 union select * from v1;
+2 >= 3 <=> 3 2 >= (3 <=> 3) (2 >= 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 >= 3 >= 3, 2 >= (3 >= 3), (2 >= 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 >= 3 AS `2 >= 3 >= 3`,2 >= (3 >= 3) AS `2 >= (3 >= 3)`,2 >= 3 >= 3 AS `(2 >= 3) >= 3`
+select 2 >= 3 >= 3, 2 >= (3 >= 3), (2 >= 3) >= 3 union select * from v1;
+2 >= 3 >= 3 2 >= (3 >= 3) (2 >= 3) >= 3
+0 1 0
+create or replace view v1 as select 0 >= 3 <= 3, 0 >= (3 <= 3), (0 >= 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 >= 3 <= 3 AS `0 >= 3 <= 3`,0 >= (3 <= 3) AS `0 >= (3 <= 3)`,0 >= 3 <= 3 AS `(0 >= 3) <= 3`
+select 0 >= 3 <= 3, 0 >= (3 <= 3), (0 >= 3) <= 3 union select * from v1;
+0 >= 3 <= 3 0 >= (3 <= 3) (0 >= 3) <= 3
+1 0 1
+create or replace view v1 as select 0 >= 2 < 3, 0 >= (2 < 3), (0 >= 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 >= 2 < 3 AS `0 >= 2 < 3`,0 >= (2 < 3) AS `0 >= (2 < 3)`,0 >= 2 < 3 AS `(0 >= 2) < 3`
+select 0 >= 2 < 3, 0 >= (2 < 3), (0 >= 2) < 3 union select * from v1;
+0 >= 2 < 3 0 >= (2 < 3) (0 >= 2) < 3
+1 0 1
+create or replace view v1 as select 2 >= 3 <> 0, 2 >= (3 <> 0), (2 >= 3) <> 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 <> 0 AS `2 >= 3 <> 0`,2 >= (3 <> 0) AS `2 >= (3 <> 0)`,2 >= 3 <> 0 AS `(2 >= 3) <> 0`
+select 2 >= 3 <> 0, 2 >= (3 <> 0), (2 >= 3) <> 0 union select * from v1;
+2 >= 3 <> 0 2 >= (3 <> 0) (2 >= 3) <> 0
+0 1 0
+create or replace view v1 as select 2 >= 3 > 3, 2 >= (3 > 3), (2 >= 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 > 3 AS `2 >= 3 > 3`,2 >= (3 > 3) AS `2 >= (3 > 3)`,2 >= 3 > 3 AS `(2 >= 3) > 3`
+select 2 >= 3 > 3, 2 >= (3 > 3), (2 >= 3) > 3 union select * from v1;
+2 >= 3 > 3 2 >= (3 > 3) (2 >= 3) > 3
+0 1 0
+create or replace view v1 as select 2 >= 3 != 0, 2 >= (3 != 0), (2 >= 3) != 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 <> 0 AS `2 >= 3 != 0`,2 >= (3 <> 0) AS `2 >= (3 != 0)`,2 >= 3 <> 0 AS `(2 >= 3) != 0`
+select 2 >= 3 != 0, 2 >= (3 != 0), (2 >= 3) != 0 union select * from v1;
+2 >= 3 != 0 2 >= (3 != 0) (2 >= 3) != 0
+0 1 0
+create or replace view v1 as select 2 >= 3 LIKE 3, 2 >= (3 LIKE 3), (2 >= 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 like 3 AS `2 >= 3 LIKE 3`,2 >= 3 like 3 AS `2 >= (3 LIKE 3)`,(2 >= 3) like 3 AS `(2 >= 3) LIKE 3`
+select 2 >= 3 LIKE 3, 2 >= (3 LIKE 3), (2 >= 3) LIKE 3 union select * from v1;
+2 >= 3 LIKE 3 2 >= (3 LIKE 3) (2 >= 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 >= 3 REGEXP 3, 2 >= (3 REGEXP 3), (2 >= 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 regexp 3 AS `2 >= 3 REGEXP 3`,2 >= 3 regexp 3 AS `2 >= (3 REGEXP 3)`,(2 >= 3) regexp 3 AS `(2 >= 3) REGEXP 3`
+select 2 >= 3 REGEXP 3, 2 >= (3 REGEXP 3), (2 >= 3) REGEXP 3 union select * from v1;
+2 >= 3 REGEXP 3 2 >= (3 REGEXP 3) (2 >= 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 >= 3 | 3, 2 >= (3 | 3), (2 >= 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 | 3 AS `2 >= 3 | 3`,2 >= 3 | 3 AS `2 >= (3 | 3)`,(2 >= 3) | 3 AS `(2 >= 3) | 3`
+select 2 >= 3 | 3, 2 >= (3 | 3), (2 >= 3) | 3 union select * from v1;
+2 >= 3 | 3 2 >= (3 | 3) (2 >= 3) | 3
+0 0 3
+create or replace view v1 as select 2 >= 3 & 1, 2 >= (3 & 1), (2 >= 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 & 1 AS `2 >= 3 & 1`,2 >= 3 & 1 AS `2 >= (3 & 1)`,(2 >= 3) & 1 AS `(2 >= 3) & 1`
+select 2 >= 3 & 1, 2 >= (3 & 1), (2 >= 3) & 1 union select * from v1;
+2 >= 3 & 1 2 >= (3 & 1) (2 >= 3) & 1
+1 1 0
+create or replace view v1 as select 3 >= 3 << 3, 3 >= (3 << 3), (3 >= 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 >= 3 << 3 AS `3 >= 3 << 3`,3 >= 3 << 3 AS `3 >= (3 << 3)`,(3 >= 3) << 3 AS `(3 >= 3) << 3`
+select 3 >= 3 << 3, 3 >= (3 << 3), (3 >= 3) << 3 union select * from v1;
+3 >= 3 << 3 3 >= (3 << 3) (3 >= 3) << 3
+0 0 8
+create or replace view v1 as select 2 >= 3 >> 3, 2 >= (3 >> 3), (2 >= 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 >> 3 AS `2 >= 3 >> 3`,2 >= 3 >> 3 AS `2 >= (3 >> 3)`,(2 >= 3) >> 3 AS `(2 >= 3) >> 3`
+select 2 >= 3 >> 3, 2 >= (3 >> 3), (2 >= 3) >> 3 union select * from v1;
+2 >= 3 >> 3 2 >= (3 >> 3) (2 >= 3) >> 3
+1 1 0
+create or replace view v1 as select 2 >= '2000-01-01' +INTERVAL 1 DAY, 2 >= ('2000-01-01' +INTERVAL 1 DAY), (2 >= '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= '2000-01-01' + interval 1 day AS `2 >= '2000-01-01' +INTERVAL 1 DAY`,2 >= '2000-01-01' + interval 1 day AS `2 >= ('2000-01-01' +INTERVAL 1 DAY)`,(2 >= '2000-01-01') + interval 1 day AS `(2 >= '2000-01-01') +INTERVAL 1 DAY`
+select 2 >= '2000-01-01' +INTERVAL 1 DAY, 2 >= ('2000-01-01' +INTERVAL 1 DAY), (2 >= '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 >= '2000-01-01' +INTERVAL 1 DAY 2 >= ('2000-01-01' +INTERVAL 1 DAY) (2 >= '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 >= 3 + 3, 2 >= (3 + 3), (2 >= 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 + 3 AS `2 >= 3 + 3`,2 >= 3 + 3 AS `2 >= (3 + 3)`,(2 >= 3) + 3 AS `(2 >= 3) + 3`
+select 2 >= 3 + 3, 2 >= (3 + 3), (2 >= 3) + 3 union select * from v1;
+2 >= 3 + 3 2 >= (3 + 3) (2 >= 3) + 3
+0 0 3
+create or replace view v1 as select 2 >= 3 - 3, 2 >= (3 - 3), (2 >= 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 - 3 AS `2 >= 3 - 3`,2 >= 3 - 3 AS `2 >= (3 - 3)`,(2 >= 3) - 3 AS `(2 >= 3) - 3`
+select 2 >= 3 - 3, 2 >= (3 - 3), (2 >= 3) - 3 union select * from v1;
+2 >= 3 - 3 2 >= (3 - 3) (2 >= 3) - 3
+1 1 -3
+create or replace view v1 as select 3 >= 3 * 3, 3 >= (3 * 3), (3 >= 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 >= 3 * 3 AS `3 >= 3 * 3`,3 >= 3 * 3 AS `3 >= (3 * 3)`,(3 >= 3) * 3 AS `(3 >= 3) * 3`
+select 3 >= 3 * 3, 3 >= (3 * 3), (3 >= 3) * 3 union select * from v1;
+3 >= 3 * 3 3 >= (3 * 3) (3 >= 3) * 3
+0 0 3
+create or replace view v1 as select 2 >= 3 / 3, 2 >= (3 / 3), (2 >= 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 / 3 AS `2 >= 3 / 3`,2 >= 3 / 3 AS `2 >= (3 / 3)`,(2 >= 3) / 3 AS `(2 >= 3) / 3`
+select 2 >= 3 / 3, 2 >= (3 / 3), (2 >= 3) / 3 union select * from v1;
+2 >= 3 / 3 2 >= (3 / 3) (2 >= 3) / 3
+1 1 0.0000
+create or replace view v1 as select 2 >= 3 DIV 3, 2 >= (3 DIV 3), (2 >= 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 DIV 3 AS `2 >= 3 DIV 3`,2 >= 3 DIV 3 AS `2 >= (3 DIV 3)`,(2 >= 3) DIV 3 AS `(2 >= 3) DIV 3`
+select 2 >= 3 DIV 3, 2 >= (3 DIV 3), (2 >= 3) DIV 3 union select * from v1;
+2 >= 3 DIV 3 2 >= (3 DIV 3) (2 >= 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 >= 3 MOD 3, 2 >= (3 MOD 3), (2 >= 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 % 3 AS `2 >= 3 MOD 3`,2 >= 3 % 3 AS `2 >= (3 MOD 3)`,(2 >= 3) % 3 AS `(2 >= 3) MOD 3`
+select 2 >= 3 MOD 3, 2 >= (3 MOD 3), (2 >= 3) MOD 3 union select * from v1;
+2 >= 3 MOD 3 2 >= (3 MOD 3) (2 >= 3) MOD 3
+1 1 0
+create or replace view v1 as select 2 >= 3 % 3, 2 >= (3 % 3), (2 >= 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 % 3 AS `2 >= 3 % 3`,2 >= 3 % 3 AS `2 >= (3 % 3)`,(2 >= 3) % 3 AS `(2 >= 3) % 3`
+select 2 >= 3 % 3, 2 >= (3 % 3), (2 >= 3) % 3 union select * from v1;
+2 >= 3 % 3 2 >= (3 % 3) (2 >= 3) % 3
+1 1 0
+create or replace view v1 as select 2 >= 3 ^ 3, 2 >= (3 ^ 3), (2 >= 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 ^ 3 AS `2 >= 3 ^ 3`,2 >= 3 ^ 3 AS `2 >= (3 ^ 3)`,(2 >= 3) ^ 3 AS `(2 >= 3) ^ 3`
+select 2 >= 3 ^ 3, 2 >= (3 ^ 3), (2 >= 3) ^ 3 union select * from v1;
+2 >= 3 ^ 3 2 >= (3 ^ 3) (2 >= 3) ^ 3
+1 1 3
+create or replace view v1 as select 2 >= 3 BETWEEN 1 AND 3, 2 >= (3 BETWEEN 1 AND 3), (2 >= 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 between 1 and 3 AS `2 >= 3 BETWEEN 1 AND 3`,2 >= 3 between 1 and 3 AS `2 >= (3 BETWEEN 1 AND 3)`,(2 >= 3) between 1 and 3 AS `(2 >= 3) BETWEEN 1 AND 3`
+select 2 >= 3 BETWEEN 1 AND 3, 2 >= (3 BETWEEN 1 AND 3), (2 >= 3) BETWEEN 1 AND 3 union select * from v1;
+2 >= 3 BETWEEN 1 AND 3 2 >= (3 BETWEEN 1 AND 3) (2 >= 3) BETWEEN 1 AND 3
+1 1 0
+create or replace view v1 as select 2 <= 1 IS FALSE, 2 <= (1 IS FALSE), (2 <= 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 1 is false AS `2 <= 1 IS FALSE`,2 <= (1 is false) AS `2 <= (1 IS FALSE)`,2 <= 1 is false AS `(2 <= 1) IS FALSE`
+select 2 <= 1 IS FALSE, 2 <= (1 IS FALSE), (2 <= 1) IS FALSE union select * from v1;
+2 <= 1 IS FALSE 2 <= (1 IS FALSE) (2 <= 1) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 <= 3 COLLATE latin1_bin), charset(2 <= (3 COLLATE latin1_bin)), charset((2 <= 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 <= 3 collate latin1_bin) AS `charset(2 <= 3 COLLATE latin1_bin)`,charset(2 <= 3 collate latin1_bin) AS `charset(2 <= (3 COLLATE latin1_bin))`,charset((2 <= 3) collate latin1_bin) AS `charset((2 <= 3) COLLATE latin1_bin)`
+select charset(2 <= 3 COLLATE latin1_bin), charset(2 <= (3 COLLATE latin1_bin)), charset((2 <= 3) COLLATE latin1_bin) union select * from v1;
+charset(2 <= 3 COLLATE latin1_bin) charset(2 <= (3 COLLATE latin1_bin)) charset((2 <= 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 <= 3 IN (0,1), 2 <= (3 IN (0,1)), (2 <= 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 in (0,1) AS `2 <= 3 IN (0,1)`,2 <= 3 in (0,1) AS `2 <= (3 IN (0,1))`,(2 <= 3) in (0,1) AS `(2 <= 3) IN (0,1)`
+select 2 <= 3 IN (0,1), 2 <= (3 IN (0,1)), (2 <= 3) IN (0,1) union select * from v1;
+2 <= 3 IN (0,1) 2 <= (3 IN (0,1)) (2 <= 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 2 <= 3 OR 3, 2 <= (3 OR 3), (2 <= 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 or 3 AS `2 <= 3 OR 3`,2 <= (3 or 3) AS `2 <= (3 OR 3)`,2 <= 3 or 3 AS `(2 <= 3) OR 3`
+select 2 <= 3 OR 3, 2 <= (3 OR 3), (2 <= 3) OR 3 union select * from v1;
+2 <= 3 OR 3 2 <= (3 OR 3) (2 <= 3) OR 3
+1 0 1
+create or replace view v1 as select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 or 3 AS `2 <= 3 || 3`,2 <= (3 or 3) AS `2 <= (3 || 3)`,2 <= 3 or 3 AS `(2 <= 3) || 3`
+select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3 union select * from v1;
+2 <= 3 || 3 2 <= (3 || 3) (2 <= 3) || 3
+1 0 1
+create or replace view v1 as select 2 <= 1 XOR 1, 2 <= (1 XOR 1), (2 <= 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 1 xor 1 AS `2 <= 1 XOR 1`,2 <= (1 xor 1) AS `2 <= (1 XOR 1)`,2 <= 1 xor 1 AS `(2 <= 1) XOR 1`
+select 2 <= 1 XOR 1, 2 <= (1 XOR 1), (2 <= 1) XOR 1 union select * from v1;
+2 <= 1 XOR 1 2 <= (1 XOR 1) (2 <= 1) XOR 1
+1 0 1
+create or replace view v1 as select 2 <= 3 AND 3, 2 <= (3 AND 3), (2 <= 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 and 3 AS `2 <= 3 AND 3`,2 <= (3 and 3) AS `2 <= (3 AND 3)`,2 <= 3 and 3 AS `(2 <= 3) AND 3`
+select 2 <= 3 AND 3, 2 <= (3 AND 3), (2 <= 3) AND 3 union select * from v1;
+2 <= 3 AND 3 2 <= (3 AND 3) (2 <= 3) AND 3
+1 0 1
+create or replace view v1 as select 2 <= 3 && 3, 2 <= (3 && 3), (2 <= 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 and 3 AS `2 <= 3 && 3`,2 <= (3 and 3) AS `2 <= (3 && 3)`,2 <= 3 and 3 AS `(2 <= 3) && 3`
+select 2 <= 3 && 3, 2 <= (3 && 3), (2 <= 3) && 3 union select * from v1;
+2 <= 3 && 3 2 <= (3 && 3) (2 <= 3) && 3
+1 0 1
+create or replace view v1 as select 2 <= 0 = 0, 2 <= (0 = 0), (2 <= 0) = 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 0 = 0 AS `2 <= 0 = 0`,2 <= (0 = 0) AS `2 <= (0 = 0)`,2 <= 0 = 0 AS `(2 <= 0) = 0`
+select 2 <= 0 = 0, 2 <= (0 = 0), (2 <= 0) = 0 union select * from v1;
+2 <= 0 = 0 2 <= (0 = 0) (2 <= 0) = 0
+1 0 1
+create or replace view v1 as select 2 <= 0 <=> 0, 2 <= (0 <=> 0), (2 <= 0) <=> 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 0 <=> 0 AS `2 <= 0 <=> 0`,2 <= (0 <=> 0) AS `2 <= (0 <=> 0)`,2 <= 0 <=> 0 AS `(2 <= 0) <=> 0`
+select 2 <= 0 <=> 0, 2 <= (0 <=> 0), (2 <= 0) <=> 0 union select * from v1;
+2 <= 0 <=> 0 2 <= (0 <=> 0) (2 <= 0) <=> 0
+1 0 1
+create or replace view v1 as select 2 <= 0 >= 0, 2 <= (0 >= 0), (2 <= 0) >= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 0 >= 0 AS `2 <= 0 >= 0`,2 <= (0 >= 0) AS `2 <= (0 >= 0)`,2 <= 0 >= 0 AS `(2 <= 0) >= 0`
+select 2 <= 0 >= 0, 2 <= (0 >= 0), (2 <= 0) >= 0 union select * from v1;
+2 <= 0 >= 0 2 <= (0 >= 0) (2 <= 0) >= 0
+1 0 1
+create or replace view v1 as select 2 <= 3 <= 3, 2 <= (3 <= 3), (2 <= 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 <= 3 AS `2 <= 3 <= 3`,2 <= (3 <= 3) AS `2 <= (3 <= 3)`,2 <= 3 <= 3 AS `(2 <= 3) <= 3`
+select 2 <= 3 <= 3, 2 <= (3 <= 3), (2 <= 3) <= 3 union select * from v1;
+2 <= 3 <= 3 2 <= (3 <= 3) (2 <= 3) <= 3
+1 0 1
+create or replace view v1 as select 2 <= 3 < 3, 2 <= (3 < 3), (2 <= 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 < 3 AS `2 <= 3 < 3`,2 <= (3 < 3) AS `2 <= (3 < 3)`,2 <= 3 < 3 AS `(2 <= 3) < 3`
+select 2 <= 3 < 3, 2 <= (3 < 3), (2 <= 3) < 3 union select * from v1;
+2 <= 3 < 3 2 <= (3 < 3) (2 <= 3) < 3
+1 0 1
+create or replace view v1 as select 2 <= 3 <> 3, 2 <= (3 <> 3), (2 <= 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 <> 3 AS `2 <= 3 <> 3`,2 <= (3 <> 3) AS `2 <= (3 <> 3)`,2 <= 3 <> 3 AS `(2 <= 3) <> 3`
+select 2 <= 3 <> 3, 2 <= (3 <> 3), (2 <= 3) <> 3 union select * from v1;
+2 <= 3 <> 3 2 <= (3 <> 3) (2 <= 3) <> 3
+1 0 1
+create or replace view v1 as select 2 <= 3 > 0, 2 <= (3 > 0), (2 <= 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 > 0 AS `2 <= 3 > 0`,2 <= (3 > 0) AS `2 <= (3 > 0)`,2 <= 3 > 0 AS `(2 <= 3) > 0`
+select 2 <= 3 > 0, 2 <= (3 > 0), (2 <= 3) > 0 union select * from v1;
+2 <= 3 > 0 2 <= (3 > 0) (2 <= 3) > 0
+1 0 1
+create or replace view v1 as select 2 <= 3 != 3, 2 <= (3 != 3), (2 <= 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 <> 3 AS `2 <= 3 != 3`,2 <= (3 <> 3) AS `2 <= (3 != 3)`,2 <= 3 <> 3 AS `(2 <= 3) != 3`
+select 2 <= 3 != 3, 2 <= (3 != 3), (2 <= 3) != 3 union select * from v1;
+2 <= 3 != 3 2 <= (3 != 3) (2 <= 3) != 3
+1 0 1
+create or replace view v1 as select 2 <= 0 LIKE 0, 2 <= (0 LIKE 0), (2 <= 0) LIKE 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 0 like 0 AS `2 <= 0 LIKE 0`,2 <= 0 like 0 AS `2 <= (0 LIKE 0)`,(2 <= 0) like 0 AS `(2 <= 0) LIKE 0`
+select 2 <= 0 LIKE 0, 2 <= (0 LIKE 0), (2 <= 0) LIKE 0 union select * from v1;
+2 <= 0 LIKE 0 2 <= (0 LIKE 0) (2 <= 0) LIKE 0
+0 0 1
+create or replace view v1 as select 2 <= 0 REGEXP 0, 2 <= (0 REGEXP 0), (2 <= 0) REGEXP 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 0 regexp 0 AS `2 <= 0 REGEXP 0`,2 <= 0 regexp 0 AS `2 <= (0 REGEXP 0)`,(2 <= 0) regexp 0 AS `(2 <= 0) REGEXP 0`
+select 2 <= 0 REGEXP 0, 2 <= (0 REGEXP 0), (2 <= 0) REGEXP 0 union select * from v1;
+2 <= 0 REGEXP 0 2 <= (0 REGEXP 0) (2 <= 0) REGEXP 0
+0 0 1
+create or replace view v1 as select 2 <= 3 | 3, 2 <= (3 | 3), (2 <= 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 | 3 AS `2 <= 3 | 3`,2 <= 3 | 3 AS `2 <= (3 | 3)`,(2 <= 3) | 3 AS `(2 <= 3) | 3`
+select 2 <= 3 | 3, 2 <= (3 | 3), (2 <= 3) | 3 union select * from v1;
+2 <= 3 | 3 2 <= (3 | 3) (2 <= 3) | 3
+1 1 3
+create or replace view v1 as select 2 <= 3 & 2, 2 <= (3 & 2), (2 <= 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 & 2 AS `2 <= 3 & 2`,2 <= 3 & 2 AS `2 <= (3 & 2)`,(2 <= 3) & 2 AS `(2 <= 3) & 2`
+select 2 <= 3 & 2, 2 <= (3 & 2), (2 <= 3) & 2 union select * from v1;
+2 <= 3 & 2 2 <= (3 & 2) (2 <= 3) & 2
+1 1 0
+create or replace view v1 as select 2 <= 3 << 3, 2 <= (3 << 3), (2 <= 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 << 3 AS `2 <= 3 << 3`,2 <= 3 << 3 AS `2 <= (3 << 3)`,(2 <= 3) << 3 AS `(2 <= 3) << 3`
+select 2 <= 3 << 3, 2 <= (3 << 3), (2 <= 3) << 3 union select * from v1;
+2 <= 3 << 3 2 <= (3 << 3) (2 <= 3) << 3
+1 1 8
+create or replace view v1 as select 0 <= 3 >> 1, 0 <= (3 >> 1), (0 <= 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <= 3 >> 1 AS `0 <= 3 >> 1`,0 <= 3 >> 1 AS `0 <= (3 >> 1)`,(0 <= 3) >> 1 AS `(0 <= 3) >> 1`
+select 0 <= 3 >> 1, 0 <= (3 >> 1), (0 <= 3) >> 1 union select * from v1;
+0 <= 3 >> 1 0 <= (3 >> 1) (0 <= 3) >> 1
+1 1 0
+create or replace view v1 as select 2 <= '2000-01-01' +INTERVAL 1 DAY, 2 <= ('2000-01-01' +INTERVAL 1 DAY), (2 <= '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= '2000-01-01' + interval 1 day AS `2 <= '2000-01-01' +INTERVAL 1 DAY`,2 <= '2000-01-01' + interval 1 day AS `2 <= ('2000-01-01' +INTERVAL 1 DAY)`,(2 <= '2000-01-01') + interval 1 day AS `(2 <= '2000-01-01') +INTERVAL 1 DAY`
+select 2 <= '2000-01-01' +INTERVAL 1 DAY, 2 <= ('2000-01-01' +INTERVAL 1 DAY), (2 <= '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 <= '2000-01-01' +INTERVAL 1 DAY 2 <= ('2000-01-01' +INTERVAL 1 DAY) (2 <= '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 <= 3 + 3, 2 <= (3 + 3), (2 <= 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 + 3 AS `2 <= 3 + 3`,2 <= 3 + 3 AS `2 <= (3 + 3)`,(2 <= 3) + 3 AS `(2 <= 3) + 3`
+select 2 <= 3 + 3, 2 <= (3 + 3), (2 <= 3) + 3 union select * from v1;
+2 <= 3 + 3 2 <= (3 + 3) (2 <= 3) + 3
+1 1 4
+create or replace view v1 as select 2 <= 3 - 3, 2 <= (3 - 3), (2 <= 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 - 3 AS `2 <= 3 - 3`,2 <= 3 - 3 AS `2 <= (3 - 3)`,(2 <= 3) - 3 AS `(2 <= 3) - 3`
+select 2 <= 3 - 3, 2 <= (3 - 3), (2 <= 3) - 3 union select * from v1;
+2 <= 3 - 3 2 <= (3 - 3) (2 <= 3) - 3
+0 0 -2
+create or replace view v1 as select 2 <= 3 * 3, 2 <= (3 * 3), (2 <= 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 * 3 AS `2 <= 3 * 3`,2 <= 3 * 3 AS `2 <= (3 * 3)`,(2 <= 3) * 3 AS `(2 <= 3) * 3`
+select 2 <= 3 * 3, 2 <= (3 * 3), (2 <= 3) * 3 union select * from v1;
+2 <= 3 * 3 2 <= (3 * 3) (2 <= 3) * 3
+1 1 3
+create or replace view v1 as select 2 <= 3 / 3, 2 <= (3 / 3), (2 <= 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 / 3 AS `2 <= 3 / 3`,2 <= 3 / 3 AS `2 <= (3 / 3)`,(2 <= 3) / 3 AS `(2 <= 3) / 3`
+select 2 <= 3 / 3, 2 <= (3 / 3), (2 <= 3) / 3 union select * from v1;
+2 <= 3 / 3 2 <= (3 / 3) (2 <= 3) / 3
+0 0 0.3333
+create or replace view v1 as select 2 <= 9 DIV 3, 2 <= (9 DIV 3), (2 <= 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 9 DIV 3 AS `2 <= 9 DIV 3`,2 <= 9 DIV 3 AS `2 <= (9 DIV 3)`,(2 <= 9) DIV 3 AS `(2 <= 9) DIV 3`
+select 2 <= 9 DIV 3, 2 <= (9 DIV 3), (2 <= 9) DIV 3 union select * from v1;
+2 <= 9 DIV 3 2 <= (9 DIV 3) (2 <= 9) DIV 3
+1 1 0
+create or replace view v1 as select 2 <= 3 MOD 3, 2 <= (3 MOD 3), (2 <= 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 % 3 AS `2 <= 3 MOD 3`,2 <= 3 % 3 AS `2 <= (3 MOD 3)`,(2 <= 3) % 3 AS `(2 <= 3) MOD 3`
+select 2 <= 3 MOD 3, 2 <= (3 MOD 3), (2 <= 3) MOD 3 union select * from v1;
+2 <= 3 MOD 3 2 <= (3 MOD 3) (2 <= 3) MOD 3
+0 0 1
+create or replace view v1 as select 2 <= 3 % 3, 2 <= (3 % 3), (2 <= 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 % 3 AS `2 <= 3 % 3`,2 <= 3 % 3 AS `2 <= (3 % 3)`,(2 <= 3) % 3 AS `(2 <= 3) % 3`
+select 2 <= 3 % 3, 2 <= (3 % 3), (2 <= 3) % 3 union select * from v1;
+2 <= 3 % 3 2 <= (3 % 3) (2 <= 3) % 3
+0 0 1
+create or replace view v1 as select 2 <= 3 ^ 3, 2 <= (3 ^ 3), (2 <= 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 ^ 3 AS `2 <= 3 ^ 3`,2 <= 3 ^ 3 AS `2 <= (3 ^ 3)`,(2 <= 3) ^ 3 AS `(2 <= 3) ^ 3`
+select 2 <= 3 ^ 3, 2 <= (3 ^ 3), (2 <= 3) ^ 3 union select * from v1;
+2 <= 3 ^ 3 2 <= (3 ^ 3) (2 <= 3) ^ 3
+0 0 2
+create or replace view v1 as select 2 <= 3 BETWEEN 1 AND 3, 2 <= (3 BETWEEN 1 AND 3), (2 <= 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 between 1 and 3 AS `2 <= 3 BETWEEN 1 AND 3`,2 <= 3 between 1 and 3 AS `2 <= (3 BETWEEN 1 AND 3)`,(2 <= 3) between 1 and 3 AS `(2 <= 3) BETWEEN 1 AND 3`
+select 2 <= 3 BETWEEN 1 AND 3, 2 <= (3 BETWEEN 1 AND 3), (2 <= 3) BETWEEN 1 AND 3 union select * from v1;
+2 <= 3 BETWEEN 1 AND 3 2 <= (3 BETWEEN 1 AND 3) (2 <= 3) BETWEEN 1 AND 3
+0 0 1
+create or replace view v1 as select 2 < 1 IS FALSE, 2 < (1 IS FALSE), (2 < 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 1 is false AS `2 < 1 IS FALSE`,2 < (1 is false) AS `2 < (1 IS FALSE)`,2 < 1 is false AS `(2 < 1) IS FALSE`
+select 2 < 1 IS FALSE, 2 < (1 IS FALSE), (2 < 1) IS FALSE union select * from v1;
+2 < 1 IS FALSE 2 < (1 IS FALSE) (2 < 1) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 < 3 COLLATE latin1_bin), charset(2 < (3 COLLATE latin1_bin)), charset((2 < 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 < 3 collate latin1_bin) AS `charset(2 < 3 COLLATE latin1_bin)`,charset(2 < 3 collate latin1_bin) AS `charset(2 < (3 COLLATE latin1_bin))`,charset((2 < 3) collate latin1_bin) AS `charset((2 < 3) COLLATE latin1_bin)`
+select charset(2 < 3 COLLATE latin1_bin), charset(2 < (3 COLLATE latin1_bin)), charset((2 < 3) COLLATE latin1_bin) union select * from v1;
+charset(2 < 3 COLLATE latin1_bin) charset(2 < (3 COLLATE latin1_bin)) charset((2 < 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 < 3 IN (0,1), 2 < (3 IN (0,1)), (2 < 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 in (0,1) AS `2 < 3 IN (0,1)`,2 < 3 in (0,1) AS `2 < (3 IN (0,1))`,(2 < 3) in (0,1) AS `(2 < 3) IN (0,1)`
+select 2 < 3 IN (0,1), 2 < (3 IN (0,1)), (2 < 3) IN (0,1) union select * from v1;
+2 < 3 IN (0,1) 2 < (3 IN (0,1)) (2 < 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 2 < 3 OR 3, 2 < (3 OR 3), (2 < 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 or 3 AS `2 < 3 OR 3`,2 < (3 or 3) AS `2 < (3 OR 3)`,2 < 3 or 3 AS `(2 < 3) OR 3`
+select 2 < 3 OR 3, 2 < (3 OR 3), (2 < 3) OR 3 union select * from v1;
+2 < 3 OR 3 2 < (3 OR 3) (2 < 3) OR 3
+1 0 1
+create or replace view v1 as select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 or 3 AS `2 < 3 || 3`,2 < (3 or 3) AS `2 < (3 || 3)`,2 < 3 or 3 AS `(2 < 3) || 3`
+select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3 union select * from v1;
+2 < 3 || 3 2 < (3 || 3) (2 < 3) || 3
+1 0 1
+create or replace view v1 as select 2 < 3 XOR 0, 2 < (3 XOR 0), (2 < 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 xor 0 AS `2 < 3 XOR 0`,2 < (3 xor 0) AS `2 < (3 XOR 0)`,2 < 3 xor 0 AS `(2 < 3) XOR 0`
+select 2 < 3 XOR 0, 2 < (3 XOR 0), (2 < 3) XOR 0 union select * from v1;
+2 < 3 XOR 0 2 < (3 XOR 0) (2 < 3) XOR 0
+1 0 1
+create or replace view v1 as select 2 < 3 AND 3, 2 < (3 AND 3), (2 < 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 and 3 AS `2 < 3 AND 3`,2 < (3 and 3) AS `2 < (3 AND 3)`,2 < 3 and 3 AS `(2 < 3) AND 3`
+select 2 < 3 AND 3, 2 < (3 AND 3), (2 < 3) AND 3 union select * from v1;
+2 < 3 AND 3 2 < (3 AND 3) (2 < 3) AND 3
+1 0 1
+create or replace view v1 as select 2 < 3 && 3, 2 < (3 && 3), (2 < 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 and 3 AS `2 < 3 && 3`,2 < (3 and 3) AS `2 < (3 && 3)`,2 < 3 and 3 AS `(2 < 3) && 3`
+select 2 < 3 && 3, 2 < (3 && 3), (2 < 3) && 3 union select * from v1;
+2 < 3 && 3 2 < (3 && 3) (2 < 3) && 3
+1 0 1
+create or replace view v1 as select 2 < 3 = 1, 2 < (3 = 1), (2 < 3) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 = 1 AS `2 < 3 = 1`,2 < (3 = 1) AS `2 < (3 = 1)`,2 < 3 = 1 AS `(2 < 3) = 1`
+select 2 < 3 = 1, 2 < (3 = 1), (2 < 3) = 1 union select * from v1;
+2 < 3 = 1 2 < (3 = 1) (2 < 3) = 1
+1 0 1
+create or replace view v1 as select 2 < 3 <=> 1, 2 < (3 <=> 1), (2 < 3) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 <=> 1 AS `2 < 3 <=> 1`,2 < (3 <=> 1) AS `2 < (3 <=> 1)`,2 < 3 <=> 1 AS `(2 < 3) <=> 1`
+select 2 < 3 <=> 1, 2 < (3 <=> 1), (2 < 3) <=> 1 union select * from v1;
+2 < 3 <=> 1 2 < (3 <=> 1) (2 < 3) <=> 1
+1 0 1
+create or replace view v1 as select 2 < 3 >= 1, 2 < (3 >= 1), (2 < 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 >= 1 AS `2 < 3 >= 1`,2 < (3 >= 1) AS `2 < (3 >= 1)`,2 < 3 >= 1 AS `(2 < 3) >= 1`
+select 2 < 3 >= 1, 2 < (3 >= 1), (2 < 3) >= 1 union select * from v1;
+2 < 3 >= 1 2 < (3 >= 1) (2 < 3) >= 1
+1 0 1
+create or replace view v1 as select 2 < 3 <= 3, 2 < (3 <= 3), (2 < 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 <= 3 AS `2 < 3 <= 3`,2 < (3 <= 3) AS `2 < (3 <= 3)`,2 < 3 <= 3 AS `(2 < 3) <= 3`
+select 2 < 3 <= 3, 2 < (3 <= 3), (2 < 3) <= 3 union select * from v1;
+2 < 3 <= 3 2 < (3 <= 3) (2 < 3) <= 3
+1 0 1
+create or replace view v1 as select 2 < 3 < 3, 2 < (3 < 3), (2 < 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 < 3 AS `2 < 3 < 3`,2 < (3 < 3) AS `2 < (3 < 3)`,2 < 3 < 3 AS `(2 < 3) < 3`
+select 2 < 3 < 3, 2 < (3 < 3), (2 < 3) < 3 union select * from v1;
+2 < 3 < 3 2 < (3 < 3) (2 < 3) < 3
+1 0 1
+create or replace view v1 as select 2 < 3 <> 3, 2 < (3 <> 3), (2 < 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 <> 3 AS `2 < 3 <> 3`,2 < (3 <> 3) AS `2 < (3 <> 3)`,2 < 3 <> 3 AS `(2 < 3) <> 3`
+select 2 < 3 <> 3, 2 < (3 <> 3), (2 < 3) <> 3 union select * from v1;
+2 < 3 <> 3 2 < (3 <> 3) (2 < 3) <> 3
+1 0 1
+create or replace view v1 as select 2 < 3 > 0, 2 < (3 > 0), (2 < 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 > 0 AS `2 < 3 > 0`,2 < (3 > 0) AS `2 < (3 > 0)`,2 < 3 > 0 AS `(2 < 3) > 0`
+select 2 < 3 > 0, 2 < (3 > 0), (2 < 3) > 0 union select * from v1;
+2 < 3 > 0 2 < (3 > 0) (2 < 3) > 0
+1 0 1
+create or replace view v1 as select 2 < 3 != 3, 2 < (3 != 3), (2 < 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 <> 3 AS `2 < 3 != 3`,2 < (3 <> 3) AS `2 < (3 != 3)`,2 < 3 <> 3 AS `(2 < 3) != 3`
+select 2 < 3 != 3, 2 < (3 != 3), (2 < 3) != 3 union select * from v1;
+2 < 3 != 3 2 < (3 != 3) (2 < 3) != 3
+1 0 1
+create or replace view v1 as select 2 < 3 LIKE 1, 2 < (3 LIKE 1), (2 < 3) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 like 1 AS `2 < 3 LIKE 1`,2 < 3 like 1 AS `2 < (3 LIKE 1)`,(2 < 3) like 1 AS `(2 < 3) LIKE 1`
+select 2 < 3 LIKE 1, 2 < (3 LIKE 1), (2 < 3) LIKE 1 union select * from v1;
+2 < 3 LIKE 1 2 < (3 LIKE 1) (2 < 3) LIKE 1
+0 0 1
+create or replace view v1 as select 2 < 3 REGEXP 1, 2 < (3 REGEXP 1), (2 < 3) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 regexp 1 AS `2 < 3 REGEXP 1`,2 < 3 regexp 1 AS `2 < (3 REGEXP 1)`,(2 < 3) regexp 1 AS `(2 < 3) REGEXP 1`
+select 2 < 3 REGEXP 1, 2 < (3 REGEXP 1), (2 < 3) REGEXP 1 union select * from v1;
+2 < 3 REGEXP 1 2 < (3 REGEXP 1) (2 < 3) REGEXP 1
+0 0 1
+create or replace view v1 as select 2 < 3 | 3, 2 < (3 | 3), (2 < 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 | 3 AS `2 < 3 | 3`,2 < 3 | 3 AS `2 < (3 | 3)`,(2 < 3) | 3 AS `(2 < 3) | 3`
+select 2 < 3 | 3, 2 < (3 | 3), (2 < 3) | 3 union select * from v1;
+2 < 3 | 3 2 < (3 | 3) (2 < 3) | 3
+1 1 3
+create or replace view v1 as select 2 < 4 & 4, 2 < (4 & 4), (2 < 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 4 & 4 AS `2 < 4 & 4`,2 < 4 & 4 AS `2 < (4 & 4)`,(2 < 4) & 4 AS `(2 < 4) & 4`
+select 2 < 4 & 4, 2 < (4 & 4), (2 < 4) & 4 union select * from v1;
+2 < 4 & 4 2 < (4 & 4) (2 < 4) & 4
+1 1 0
+create or replace view v1 as select 2 < 3 << 3, 2 < (3 << 3), (2 < 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 << 3 AS `2 < 3 << 3`,2 < 3 << 3 AS `2 < (3 << 3)`,(2 < 3) << 3 AS `(2 < 3) << 3`
+select 2 < 3 << 3, 2 < (3 << 3), (2 < 3) << 3 union select * from v1;
+2 < 3 << 3 2 < (3 << 3) (2 < 3) << 3
+1 1 8
+create or replace view v1 as select 0 < 3 >> 1, 0 < (3 >> 1), (0 < 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 < 3 >> 1 AS `0 < 3 >> 1`,0 < 3 >> 1 AS `0 < (3 >> 1)`,(0 < 3) >> 1 AS `(0 < 3) >> 1`
+select 0 < 3 >> 1, 0 < (3 >> 1), (0 < 3) >> 1 union select * from v1;
+0 < 3 >> 1 0 < (3 >> 1) (0 < 3) >> 1
+1 1 0
+create or replace view v1 as select 2 < '2000-01-01' +INTERVAL 1 DAY, 2 < ('2000-01-01' +INTERVAL 1 DAY), (2 < '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < '2000-01-01' + interval 1 day AS `2 < '2000-01-01' +INTERVAL 1 DAY`,2 < '2000-01-01' + interval 1 day AS `2 < ('2000-01-01' +INTERVAL 1 DAY)`,(2 < '2000-01-01') + interval 1 day AS `(2 < '2000-01-01') +INTERVAL 1 DAY`
+select 2 < '2000-01-01' +INTERVAL 1 DAY, 2 < ('2000-01-01' +INTERVAL 1 DAY), (2 < '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 < '2000-01-01' +INTERVAL 1 DAY 2 < ('2000-01-01' +INTERVAL 1 DAY) (2 < '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 < 3 + 3, 2 < (3 + 3), (2 < 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 + 3 AS `2 < 3 + 3`,2 < 3 + 3 AS `2 < (3 + 3)`,(2 < 3) + 3 AS `(2 < 3) + 3`
+select 2 < 3 + 3, 2 < (3 + 3), (2 < 3) + 3 union select * from v1;
+2 < 3 + 3 2 < (3 + 3) (2 < 3) + 3
+1 1 4
+create or replace view v1 as select 2 < 3 - 3, 2 < (3 - 3), (2 < 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 - 3 AS `2 < 3 - 3`,2 < 3 - 3 AS `2 < (3 - 3)`,(2 < 3) - 3 AS `(2 < 3) - 3`
+select 2 < 3 - 3, 2 < (3 - 3), (2 < 3) - 3 union select * from v1;
+2 < 3 - 3 2 < (3 - 3) (2 < 3) - 3
+0 0 -2
+create or replace view v1 as select 2 < 3 * 3, 2 < (3 * 3), (2 < 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 * 3 AS `2 < 3 * 3`,2 < 3 * 3 AS `2 < (3 * 3)`,(2 < 3) * 3 AS `(2 < 3) * 3`
+select 2 < 3 * 3, 2 < (3 * 3), (2 < 3) * 3 union select * from v1;
+2 < 3 * 3 2 < (3 * 3) (2 < 3) * 3
+1 1 3
+create or replace view v1 as select 2 < 3 / 3, 2 < (3 / 3), (2 < 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 / 3 AS `2 < 3 / 3`,2 < 3 / 3 AS `2 < (3 / 3)`,(2 < 3) / 3 AS `(2 < 3) / 3`
+select 2 < 3 / 3, 2 < (3 / 3), (2 < 3) / 3 union select * from v1;
+2 < 3 / 3 2 < (3 / 3) (2 < 3) / 3
+0 0 0.3333
+create or replace view v1 as select 2 < 9 DIV 3, 2 < (9 DIV 3), (2 < 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 9 DIV 3 AS `2 < 9 DIV 3`,2 < 9 DIV 3 AS `2 < (9 DIV 3)`,(2 < 9) DIV 3 AS `(2 < 9) DIV 3`
+select 2 < 9 DIV 3, 2 < (9 DIV 3), (2 < 9) DIV 3 union select * from v1;
+2 < 9 DIV 3 2 < (9 DIV 3) (2 < 9) DIV 3
+1 1 0
+create or replace view v1 as select 2 < 3 MOD 3, 2 < (3 MOD 3), (2 < 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 % 3 AS `2 < 3 MOD 3`,2 < 3 % 3 AS `2 < (3 MOD 3)`,(2 < 3) % 3 AS `(2 < 3) MOD 3`
+select 2 < 3 MOD 3, 2 < (3 MOD 3), (2 < 3) MOD 3 union select * from v1;
+2 < 3 MOD 3 2 < (3 MOD 3) (2 < 3) MOD 3
+0 0 1
+create or replace view v1 as select 2 < 3 % 3, 2 < (3 % 3), (2 < 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 % 3 AS `2 < 3 % 3`,2 < 3 % 3 AS `2 < (3 % 3)`,(2 < 3) % 3 AS `(2 < 3) % 3`
+select 2 < 3 % 3, 2 < (3 % 3), (2 < 3) % 3 union select * from v1;
+2 < 3 % 3 2 < (3 % 3) (2 < 3) % 3
+0 0 1
+create or replace view v1 as select 2 < 3 ^ 3, 2 < (3 ^ 3), (2 < 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 ^ 3 AS `2 < 3 ^ 3`,2 < 3 ^ 3 AS `2 < (3 ^ 3)`,(2 < 3) ^ 3 AS `(2 < 3) ^ 3`
+select 2 < 3 ^ 3, 2 < (3 ^ 3), (2 < 3) ^ 3 union select * from v1;
+2 < 3 ^ 3 2 < (3 ^ 3) (2 < 3) ^ 3
+0 0 2
+create or replace view v1 as select 2 < 3 BETWEEN 1 AND 3, 2 < (3 BETWEEN 1 AND 3), (2 < 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 between 1 and 3 AS `2 < 3 BETWEEN 1 AND 3`,2 < 3 between 1 and 3 AS `2 < (3 BETWEEN 1 AND 3)`,(2 < 3) between 1 and 3 AS `(2 < 3) BETWEEN 1 AND 3`
+select 2 < 3 BETWEEN 1 AND 3, 2 < (3 BETWEEN 1 AND 3), (2 < 3) BETWEEN 1 AND 3 union select * from v1;
+2 < 3 BETWEEN 1 AND 3 2 < (3 BETWEEN 1 AND 3) (2 < 3) BETWEEN 1 AND 3
+0 0 1
+create or replace view v1 as select 2 <> 3 IS FALSE, 2 <> (3 IS FALSE), (2 <> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 is false AS `2 <> 3 IS FALSE`,2 <> (3 is false) AS `2 <> (3 IS FALSE)`,2 <> 3 is false AS `(2 <> 3) IS FALSE`
+select 2 <> 3 IS FALSE, 2 <> (3 IS FALSE), (2 <> 3) IS FALSE union select * from v1;
+2 <> 3 IS FALSE 2 <> (3 IS FALSE) (2 <> 3) IS FALSE
+0 1 0
+create or replace view v1 as select charset(2 <> 3 COLLATE latin1_bin), charset(2 <> (3 COLLATE latin1_bin)), charset((2 <> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 <> 3 collate latin1_bin) AS `charset(2 <> 3 COLLATE latin1_bin)`,charset(2 <> 3 collate latin1_bin) AS `charset(2 <> (3 COLLATE latin1_bin))`,charset((2 <> 3) collate latin1_bin) AS `charset((2 <> 3) COLLATE latin1_bin)`
+select charset(2 <> 3 COLLATE latin1_bin), charset(2 <> (3 COLLATE latin1_bin)), charset((2 <> 3) COLLATE latin1_bin) union select * from v1;
+charset(2 <> 3 COLLATE latin1_bin) charset(2 <> (3 COLLATE latin1_bin)) charset((2 <> 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 <> 3 IN (0,0), 2 <> (3 IN (0,0)), (2 <> 3) IN (0,0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 in (0,0) AS `2 <> 3 IN (0,0)`,2 <> 3 in (0,0) AS `2 <> (3 IN (0,0))`,(2 <> 3) in (0,0) AS `(2 <> 3) IN (0,0)`
+select 2 <> 3 IN (0,0), 2 <> (3 IN (0,0)), (2 <> 3) IN (0,0) union select * from v1;
+2 <> 3 IN (0,0) 2 <> (3 IN (0,0)) (2 <> 3) IN (0,0)
+1 1 0
+create or replace view v1 as select 1 <> 3 OR 3, 1 <> (3 OR 3), (1 <> 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 or 3 AS `1 <> 3 OR 3`,1 <> (3 or 3) AS `1 <> (3 OR 3)`,1 <> 3 or 3 AS `(1 <> 3) OR 3`
+select 1 <> 3 OR 3, 1 <> (3 OR 3), (1 <> 3) OR 3 union select * from v1;
+1 <> 3 OR 3 1 <> (3 OR 3) (1 <> 3) OR 3
+1 0 1
+create or replace view v1 as select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 or 3 AS `1 <> 3 || 3`,1 <> (3 or 3) AS `1 <> (3 || 3)`,1 <> 3 or 3 AS `(1 <> 3) || 3`
+select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3 union select * from v1;
+1 <> 3 || 3 1 <> (3 || 3) (1 <> 3) || 3
+1 0 1
+create or replace view v1 as select 2 <> 3 XOR 3, 2 <> (3 XOR 3), (2 <> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 xor 3 AS `2 <> 3 XOR 3`,2 <> (3 xor 3) AS `2 <> (3 XOR 3)`,2 <> 3 xor 3 AS `(2 <> 3) XOR 3`
+select 2 <> 3 XOR 3, 2 <> (3 XOR 3), (2 <> 3) XOR 3 union select * from v1;
+2 <> 3 XOR 3 2 <> (3 XOR 3) (2 <> 3) XOR 3
+0 1 0
+create or replace view v1 as select 3 <> 3 AND 3, 3 <> (3 AND 3), (3 <> 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 and 3 AS `3 <> 3 AND 3`,3 <> (3 and 3) AS `3 <> (3 AND 3)`,3 <> 3 and 3 AS `(3 <> 3) AND 3`
+select 3 <> 3 AND 3, 3 <> (3 AND 3), (3 <> 3) AND 3 union select * from v1;
+3 <> 3 AND 3 3 <> (3 AND 3) (3 <> 3) AND 3
+0 1 0
+create or replace view v1 as select 3 <> 3 && 3, 3 <> (3 && 3), (3 <> 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 and 3 AS `3 <> 3 && 3`,3 <> (3 and 3) AS `3 <> (3 && 3)`,3 <> 3 and 3 AS `(3 <> 3) && 3`
+select 3 <> 3 && 3, 3 <> (3 && 3), (3 <> 3) && 3 union select * from v1;
+3 <> 3 && 3 3 <> (3 && 3) (3 <> 3) && 3
+0 1 0
+create or replace view v1 as select 2 <> 3 = 3, 2 <> (3 = 3), (2 <> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 = 3 AS `2 <> 3 = 3`,2 <> (3 = 3) AS `2 <> (3 = 3)`,2 <> 3 = 3 AS `(2 <> 3) = 3`
+select 2 <> 3 = 3, 2 <> (3 = 3), (2 <> 3) = 3 union select * from v1;
+2 <> 3 = 3 2 <> (3 = 3) (2 <> 3) = 3
+0 1 0
+create or replace view v1 as select 2 <> 3 <=> 3, 2 <> (3 <=> 3), (2 <> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 <=> 3 AS `2 <> 3 <=> 3`,2 <> (3 <=> 3) AS `2 <> (3 <=> 3)`,2 <> 3 <=> 3 AS `(2 <> 3) <=> 3`
+select 2 <> 3 <=> 3, 2 <> (3 <=> 3), (2 <> 3) <=> 3 union select * from v1;
+2 <> 3 <=> 3 2 <> (3 <=> 3) (2 <> 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 <> 3 >= 3, 2 <> (3 >= 3), (2 <> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 >= 3 AS `2 <> 3 >= 3`,2 <> (3 >= 3) AS `2 <> (3 >= 3)`,2 <> 3 >= 3 AS `(2 <> 3) >= 3`
+select 2 <> 3 >= 3, 2 <> (3 >= 3), (2 <> 3) >= 3 union select * from v1;
+2 <> 3 >= 3 2 <> (3 >= 3) (2 <> 3) >= 3
+0 1 0
+create or replace view v1 as select 1 <> 3 <= 3, 1 <> (3 <= 3), (1 <> 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 <= 3 AS `1 <> 3 <= 3`,1 <> (3 <= 3) AS `1 <> (3 <= 3)`,1 <> 3 <= 3 AS `(1 <> 3) <= 3`
+select 1 <> 3 <= 3, 1 <> (3 <= 3), (1 <> 3) <= 3 union select * from v1;
+1 <> 3 <= 3 1 <> (3 <= 3) (1 <> 3) <= 3
+1 0 1
+create or replace view v1 as select 0 <> 3 < 3, 0 <> (3 < 3), (0 <> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 < 3 AS `0 <> 3 < 3`,0 <> (3 < 3) AS `0 <> (3 < 3)`,0 <> 3 < 3 AS `(0 <> 3) < 3`
+select 0 <> 3 < 3, 0 <> (3 < 3), (0 <> 3) < 3 union select * from v1;
+0 <> 3 < 3 0 <> (3 < 3) (0 <> 3) < 3
+1 0 1
+create or replace view v1 as select 0 <> 3 <> 3, 0 <> (3 <> 3), (0 <> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 <> 3 AS `0 <> 3 <> 3`,0 <> (3 <> 3) AS `0 <> (3 <> 3)`,0 <> 3 <> 3 AS `(0 <> 3) <> 3`
+select 0 <> 3 <> 3, 0 <> (3 <> 3), (0 <> 3) <> 3 union select * from v1;
+0 <> 3 <> 3 0 <> (3 <> 3) (0 <> 3) <> 3
+1 0 1
+create or replace view v1 as select 2 <> 3 > 3, 2 <> (3 > 3), (2 <> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 > 3 AS `2 <> 3 > 3`,2 <> (3 > 3) AS `2 <> (3 > 3)`,2 <> 3 > 3 AS `(2 <> 3) > 3`
+select 2 <> 3 > 3, 2 <> (3 > 3), (2 <> 3) > 3 union select * from v1;
+2 <> 3 > 3 2 <> (3 > 3) (2 <> 3) > 3
+0 1 0
+create or replace view v1 as select 0 <> 3 != 3, 0 <> (3 != 3), (0 <> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 <> 3 AS `0 <> 3 != 3`,0 <> (3 <> 3) AS `0 <> (3 != 3)`,0 <> 3 <> 3 AS `(0 <> 3) != 3`
+select 0 <> 3 != 3, 0 <> (3 != 3), (0 <> 3) != 3 union select * from v1;
+0 <> 3 != 3 0 <> (3 != 3) (0 <> 3) != 3
+1 0 1
+create or replace view v1 as select 2 <> 3 LIKE 3, 2 <> (3 LIKE 3), (2 <> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 like 3 AS `2 <> 3 LIKE 3`,2 <> 3 like 3 AS `2 <> (3 LIKE 3)`,(2 <> 3) like 3 AS `(2 <> 3) LIKE 3`
+select 2 <> 3 LIKE 3, 2 <> (3 LIKE 3), (2 <> 3) LIKE 3 union select * from v1;
+2 <> 3 LIKE 3 2 <> (3 LIKE 3) (2 <> 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 <> 3 REGEXP 3, 2 <> (3 REGEXP 3), (2 <> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 regexp 3 AS `2 <> 3 REGEXP 3`,2 <> 3 regexp 3 AS `2 <> (3 REGEXP 3)`,(2 <> 3) regexp 3 AS `(2 <> 3) REGEXP 3`
+select 2 <> 3 REGEXP 3, 2 <> (3 REGEXP 3), (2 <> 3) REGEXP 3 union select * from v1;
+2 <> 3 REGEXP 3 2 <> (3 REGEXP 3) (2 <> 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 <> 3 | 3, 2 <> (3 | 3), (2 <> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 | 3 AS `2 <> 3 | 3`,2 <> 3 | 3 AS `2 <> (3 | 3)`,(2 <> 3) | 3 AS `(2 <> 3) | 3`
+select 2 <> 3 | 3, 2 <> (3 | 3), (2 <> 3) | 3 union select * from v1;
+2 <> 3 | 3 2 <> (3 | 3) (2 <> 3) | 3
+1 1 3
+create or replace view v1 as select 2 <> 4 & 4, 2 <> (4 & 4), (2 <> 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 4 & 4 AS `2 <> 4 & 4`,2 <> 4 & 4 AS `2 <> (4 & 4)`,(2 <> 4) & 4 AS `(2 <> 4) & 4`
+select 2 <> 4 & 4, 2 <> (4 & 4), (2 <> 4) & 4 union select * from v1;
+2 <> 4 & 4 2 <> (4 & 4) (2 <> 4) & 4
+1 1 0
+create or replace view v1 as select 2 <> 3 << 3, 2 <> (3 << 3), (2 <> 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 << 3 AS `2 <> 3 << 3`,2 <> 3 << 3 AS `2 <> (3 << 3)`,(2 <> 3) << 3 AS `(2 <> 3) << 3`
+select 2 <> 3 << 3, 2 <> (3 << 3), (2 <> 3) << 3 union select * from v1;
+2 <> 3 << 3 2 <> (3 << 3) (2 <> 3) << 3
+1 1 8
+create or replace view v1 as select 2 <> 3 >> 3, 2 <> (3 >> 3), (2 <> 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 >> 3 AS `2 <> 3 >> 3`,2 <> 3 >> 3 AS `2 <> (3 >> 3)`,(2 <> 3) >> 3 AS `(2 <> 3) >> 3`
+select 2 <> 3 >> 3, 2 <> (3 >> 3), (2 <> 3) >> 3 union select * from v1;
+2 <> 3 >> 3 2 <> (3 >> 3) (2 <> 3) >> 3
+1 1 0
+create or replace view v1 as select 2 <> '2000-01-01' +INTERVAL 1 DAY, 2 <> ('2000-01-01' +INTERVAL 1 DAY), (2 <> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> '2000-01-01' + interval 1 day AS `2 <> '2000-01-01' +INTERVAL 1 DAY`,2 <> '2000-01-01' + interval 1 day AS `2 <> ('2000-01-01' +INTERVAL 1 DAY)`,(2 <> '2000-01-01') + interval 1 day AS `(2 <> '2000-01-01') +INTERVAL 1 DAY`
+select 2 <> '2000-01-01' +INTERVAL 1 DAY, 2 <> ('2000-01-01' +INTERVAL 1 DAY), (2 <> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 <> '2000-01-01' +INTERVAL 1 DAY 2 <> ('2000-01-01' +INTERVAL 1 DAY) (2 <> '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 <> 3 + 3, 2 <> (3 + 3), (2 <> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 + 3 AS `2 <> 3 + 3`,2 <> 3 + 3 AS `2 <> (3 + 3)`,(2 <> 3) + 3 AS `(2 <> 3) + 3`
+select 2 <> 3 + 3, 2 <> (3 + 3), (2 <> 3) + 3 union select * from v1;
+2 <> 3 + 3 2 <> (3 + 3) (2 <> 3) + 3
+1 1 4
+create or replace view v1 as select 2 <> 3 - 3, 2 <> (3 - 3), (2 <> 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 - 3 AS `2 <> 3 - 3`,2 <> 3 - 3 AS `2 <> (3 - 3)`,(2 <> 3) - 3 AS `(2 <> 3) - 3`
+select 2 <> 3 - 3, 2 <> (3 - 3), (2 <> 3) - 3 union select * from v1;
+2 <> 3 - 3 2 <> (3 - 3) (2 <> 3) - 3
+1 1 -2
+create or replace view v1 as select 2 <> 3 * 3, 2 <> (3 * 3), (2 <> 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 * 3 AS `2 <> 3 * 3`,2 <> 3 * 3 AS `2 <> (3 * 3)`,(2 <> 3) * 3 AS `(2 <> 3) * 3`
+select 2 <> 3 * 3, 2 <> (3 * 3), (2 <> 3) * 3 union select * from v1;
+2 <> 3 * 3 2 <> (3 * 3) (2 <> 3) * 3
+1 1 3
+create or replace view v1 as select 2 <> 3 / 3, 2 <> (3 / 3), (2 <> 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 / 3 AS `2 <> 3 / 3`,2 <> 3 / 3 AS `2 <> (3 / 3)`,(2 <> 3) / 3 AS `(2 <> 3) / 3`
+select 2 <> 3 / 3, 2 <> (3 / 3), (2 <> 3) / 3 union select * from v1;
+2 <> 3 / 3 2 <> (3 / 3) (2 <> 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 <> 3 DIV 3, 2 <> (3 DIV 3), (2 <> 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 DIV 3 AS `2 <> 3 DIV 3`,2 <> 3 DIV 3 AS `2 <> (3 DIV 3)`,(2 <> 3) DIV 3 AS `(2 <> 3) DIV 3`
+select 2 <> 3 DIV 3, 2 <> (3 DIV 3), (2 <> 3) DIV 3 union select * from v1;
+2 <> 3 DIV 3 2 <> (3 DIV 3) (2 <> 3) DIV 3
+1 1 0
+create or replace view v1 as select 3 <> 3 MOD 3, 3 <> (3 MOD 3), (3 <> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 % 3 AS `3 <> 3 MOD 3`,3 <> 3 % 3 AS `3 <> (3 MOD 3)`,(3 <> 3) % 3 AS `(3 <> 3) MOD 3`
+select 3 <> 3 MOD 3, 3 <> (3 MOD 3), (3 <> 3) MOD 3 union select * from v1;
+3 <> 3 MOD 3 3 <> (3 MOD 3) (3 <> 3) MOD 3
+1 1 0
+create or replace view v1 as select 3 <> 3 % 3, 3 <> (3 % 3), (3 <> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 % 3 AS `3 <> 3 % 3`,3 <> 3 % 3 AS `3 <> (3 % 3)`,(3 <> 3) % 3 AS `(3 <> 3) % 3`
+select 3 <> 3 % 3, 3 <> (3 % 3), (3 <> 3) % 3 union select * from v1;
+3 <> 3 % 3 3 <> (3 % 3) (3 <> 3) % 3
+1 1 0
+create or replace view v1 as select 2 <> 3 ^ 3, 2 <> (3 ^ 3), (2 <> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 ^ 3 AS `2 <> 3 ^ 3`,2 <> 3 ^ 3 AS `2 <> (3 ^ 3)`,(2 <> 3) ^ 3 AS `(2 <> 3) ^ 3`
+select 2 <> 3 ^ 3, 2 <> (3 ^ 3), (2 <> 3) ^ 3 union select * from v1;
+2 <> 3 ^ 3 2 <> (3 ^ 3) (2 <> 3) ^ 3
+1 1 2
+create or replace view v1 as select 2 <> 3 BETWEEN 2 AND 3, 2 <> (3 BETWEEN 2 AND 3), (2 <> 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 between 2 and 3 AS `2 <> 3 BETWEEN 2 AND 3`,2 <> 3 between 2 and 3 AS `2 <> (3 BETWEEN 2 AND 3)`,(2 <> 3) between 2 and 3 AS `(2 <> 3) BETWEEN 2 AND 3`
+select 2 <> 3 BETWEEN 2 AND 3, 2 <> (3 BETWEEN 2 AND 3), (2 <> 3) BETWEEN 2 AND 3 union select * from v1;
+2 <> 3 BETWEEN 2 AND 3 2 <> (3 BETWEEN 2 AND 3) (2 <> 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select 2 > 0 IS FALSE, 2 > (0 IS FALSE), (2 > 0) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 0 is false AS `2 > 0 IS FALSE`,2 > (0 is false) AS `2 > (0 IS FALSE)`,2 > 0 is false AS `(2 > 0) IS FALSE`
+select 2 > 0 IS FALSE, 2 > (0 IS FALSE), (2 > 0) IS FALSE union select * from v1;
+2 > 0 IS FALSE 2 > (0 IS FALSE) (2 > 0) IS FALSE
+0 1 0
+create or replace view v1 as select charset(2 > 3 COLLATE latin1_bin), charset(2 > (3 COLLATE latin1_bin)), charset((2 > 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 > 3 collate latin1_bin) AS `charset(2 > 3 COLLATE latin1_bin)`,charset(2 > 3 collate latin1_bin) AS `charset(2 > (3 COLLATE latin1_bin))`,charset((2 > 3) collate latin1_bin) AS `charset((2 > 3) COLLATE latin1_bin)`
+select charset(2 > 3 COLLATE latin1_bin), charset(2 > (3 COLLATE latin1_bin)), charset((2 > 3) COLLATE latin1_bin) union select * from v1;
+charset(2 > 3 COLLATE latin1_bin) charset(2 > (3 COLLATE latin1_bin)) charset((2 > 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 > 3 IN (1,1), 2 > (3 IN (1,1)), (2 > 3) IN (1,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 in (1,1) AS `2 > 3 IN (1,1)`,2 > 3 in (1,1) AS `2 > (3 IN (1,1))`,(2 > 3) in (1,1) AS `(2 > 3) IN (1,1)`
+select 2 > 3 IN (1,1), 2 > (3 IN (1,1)), (2 > 3) IN (1,1) union select * from v1;
+2 > 3 IN (1,1) 2 > (3 IN (1,1)) (2 > 3) IN (1,1)
+1 1 0
+create or replace view v1 as select 0 > 3 OR 3, 0 > (3 OR 3), (0 > 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 > 3 or 3 AS `0 > 3 OR 3`,0 > (3 or 3) AS `0 > (3 OR 3)`,0 > 3 or 3 AS `(0 > 3) OR 3`
+select 0 > 3 OR 3, 0 > (3 OR 3), (0 > 3) OR 3 union select * from v1;
+0 > 3 OR 3 0 > (3 OR 3) (0 > 3) OR 3
+1 0 1
+create or replace view v1 as select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 > 3 or 3 AS `0 > 3 || 3`,0 > (3 or 3) AS `0 > (3 || 3)`,0 > 3 or 3 AS `(0 > 3) || 3`
+select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3 union select * from v1;
+0 > 3 || 3 0 > (3 || 3) (0 > 3) || 3
+1 0 1
+create or replace view v1 as select 4 > 3 XOR 3, 4 > (3 XOR 3), (4 > 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 > 3 xor 3 AS `4 > 3 XOR 3`,4 > (3 xor 3) AS `4 > (3 XOR 3)`,4 > 3 xor 3 AS `(4 > 3) XOR 3`
+select 4 > 3 XOR 3, 4 > (3 XOR 3), (4 > 3) XOR 3 union select * from v1;
+4 > 3 XOR 3 4 > (3 XOR 3) (4 > 3) XOR 3
+0 1 0
+create or replace view v1 as select 2 > 3 AND 3, 2 > (3 AND 3), (2 > 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 and 3 AS `2 > 3 AND 3`,2 > (3 and 3) AS `2 > (3 AND 3)`,2 > 3 and 3 AS `(2 > 3) AND 3`
+select 2 > 3 AND 3, 2 > (3 AND 3), (2 > 3) AND 3 union select * from v1;
+2 > 3 AND 3 2 > (3 AND 3) (2 > 3) AND 3
+0 1 0
+create or replace view v1 as select 2 > 3 && 3, 2 > (3 && 3), (2 > 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 and 3 AS `2 > 3 && 3`,2 > (3 and 3) AS `2 > (3 && 3)`,2 > 3 and 3 AS `(2 > 3) && 3`
+select 2 > 3 && 3, 2 > (3 && 3), (2 > 3) && 3 union select * from v1;
+2 > 3 && 3 2 > (3 && 3) (2 > 3) && 3
+0 1 0
+create or replace view v1 as select 2 > 3 = 3, 2 > (3 = 3), (2 > 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 = 3 AS `2 > 3 = 3`,2 > (3 = 3) AS `2 > (3 = 3)`,2 > 3 = 3 AS `(2 > 3) = 3`
+select 2 > 3 = 3, 2 > (3 = 3), (2 > 3) = 3 union select * from v1;
+2 > 3 = 3 2 > (3 = 3) (2 > 3) = 3
+0 1 0
+create or replace view v1 as select 2 > 3 <=> 3, 2 > (3 <=> 3), (2 > 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 <=> 3 AS `2 > 3 <=> 3`,2 > (3 <=> 3) AS `2 > (3 <=> 3)`,2 > 3 <=> 3 AS `(2 > 3) <=> 3`
+select 2 > 3 <=> 3, 2 > (3 <=> 3), (2 > 3) <=> 3 union select * from v1;
+2 > 3 <=> 3 2 > (3 <=> 3) (2 > 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 > 3 >= 3, 2 > (3 >= 3), (2 > 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 >= 3 AS `2 > 3 >= 3`,2 > (3 >= 3) AS `2 > (3 >= 3)`,2 > 3 >= 3 AS `(2 > 3) >= 3`
+select 2 > 3 >= 3, 2 > (3 >= 3), (2 > 3) >= 3 union select * from v1;
+2 > 3 >= 3 2 > (3 >= 3) (2 > 3) >= 3
+0 1 0
+create or replace view v1 as select 2 > 0 <= 0, 2 > (0 <= 0), (2 > 0) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 0 <= 0 AS `2 > 0 <= 0`,2 > (0 <= 0) AS `2 > (0 <= 0)`,2 > 0 <= 0 AS `(2 > 0) <= 0`
+select 2 > 0 <= 0, 2 > (0 <= 0), (2 > 0) <= 0 union select * from v1;
+2 > 0 <= 0 2 > (0 <= 0) (2 > 0) <= 0
+0 1 0
+create or replace view v1 as select 2 > 0 < 0, 2 > (0 < 0), (2 > 0) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 0 < 0 AS `2 > 0 < 0`,2 > (0 < 0) AS `2 > (0 < 0)`,2 > 0 < 0 AS `(2 > 0) < 0`
+select 2 > 0 < 0, 2 > (0 < 0), (2 > 0) < 0 union select * from v1;
+2 > 0 < 0 2 > (0 < 0) (2 > 0) < 0
+0 1 0
+create or replace view v1 as select 2 > 1 <> 1, 2 > (1 <> 1), (2 > 1) <> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 1 <> 1 AS `2 > 1 <> 1`,2 > (1 <> 1) AS `2 > (1 <> 1)`,2 > 1 <> 1 AS `(2 > 1) <> 1`
+select 2 > 1 <> 1, 2 > (1 <> 1), (2 > 1) <> 1 union select * from v1;
+2 > 1 <> 1 2 > (1 <> 1) (2 > 1) <> 1
+0 1 0
+create or replace view v1 as select 2 > 3 > 3, 2 > (3 > 3), (2 > 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 > 3 AS `2 > 3 > 3`,2 > (3 > 3) AS `2 > (3 > 3)`,2 > 3 > 3 AS `(2 > 3) > 3`
+select 2 > 3 > 3, 2 > (3 > 3), (2 > 3) > 3 union select * from v1;
+2 > 3 > 3 2 > (3 > 3) (2 > 3) > 3
+0 1 0
+create or replace view v1 as select 2 > 1 != 1, 2 > (1 != 1), (2 > 1) != 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 1 <> 1 AS `2 > 1 != 1`,2 > (1 <> 1) AS `2 > (1 != 1)`,2 > 1 <> 1 AS `(2 > 1) != 1`
+select 2 > 1 != 1, 2 > (1 != 1), (2 > 1) != 1 union select * from v1;
+2 > 1 != 1 2 > (1 != 1) (2 > 1) != 1
+0 1 0
+create or replace view v1 as select 2 > 3 LIKE 3, 2 > (3 LIKE 3), (2 > 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 like 3 AS `2 > 3 LIKE 3`,2 > 3 like 3 AS `2 > (3 LIKE 3)`,(2 > 3) like 3 AS `(2 > 3) LIKE 3`
+select 2 > 3 LIKE 3, 2 > (3 LIKE 3), (2 > 3) LIKE 3 union select * from v1;
+2 > 3 LIKE 3 2 > (3 LIKE 3) (2 > 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 > 3 REGEXP 3, 2 > (3 REGEXP 3), (2 > 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 regexp 3 AS `2 > 3 REGEXP 3`,2 > 3 regexp 3 AS `2 > (3 REGEXP 3)`,(2 > 3) regexp 3 AS `(2 > 3) REGEXP 3`
+select 2 > 3 REGEXP 3, 2 > (3 REGEXP 3), (2 > 3) REGEXP 3 union select * from v1;
+2 > 3 REGEXP 3 2 > (3 REGEXP 3) (2 > 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 > 3 | 3, 2 > (3 | 3), (2 > 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 | 3 AS `2 > 3 | 3`,2 > 3 | 3 AS `2 > (3 | 3)`,(2 > 3) | 3 AS `(2 > 3) | 3`
+select 2 > 3 | 3, 2 > (3 | 3), (2 > 3) | 3 union select * from v1;
+2 > 3 | 3 2 > (3 | 3) (2 > 3) | 3
+0 0 3
+create or replace view v1 as select 4 > 2 & 2, 4 > (2 & 2), (4 > 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 > 2 & 2 AS `4 > 2 & 2`,4 > 2 & 2 AS `4 > (2 & 2)`,(4 > 2) & 2 AS `(4 > 2) & 2`
+select 4 > 2 & 2, 4 > (2 & 2), (4 > 2) & 2 union select * from v1;
+4 > 2 & 2 4 > (2 & 2) (4 > 2) & 2
+1 1 0
+create or replace view v1 as select 4 > 3 << 3, 4 > (3 << 3), (4 > 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 > 3 << 3 AS `4 > 3 << 3`,4 > 3 << 3 AS `4 > (3 << 3)`,(4 > 3) << 3 AS `(4 > 3) << 3`
+select 4 > 3 << 3, 4 > (3 << 3), (4 > 3) << 3 union select * from v1;
+4 > 3 << 3 4 > (3 << 3) (4 > 3) << 3
+0 0 8
+create or replace view v1 as select 2 > 3 >> 3, 2 > (3 >> 3), (2 > 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 >> 3 AS `2 > 3 >> 3`,2 > 3 >> 3 AS `2 > (3 >> 3)`,(2 > 3) >> 3 AS `(2 > 3) >> 3`
+select 2 > 3 >> 3, 2 > (3 >> 3), (2 > 3) >> 3 union select * from v1;
+2 > 3 >> 3 2 > (3 >> 3) (2 > 3) >> 3
+1 1 0
+create or replace view v1 as select 2 > '2000-01-01' +INTERVAL 1 DAY, 2 > ('2000-01-01' +INTERVAL 1 DAY), (2 > '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > '2000-01-01' + interval 1 day AS `2 > '2000-01-01' +INTERVAL 1 DAY`,2 > '2000-01-01' + interval 1 day AS `2 > ('2000-01-01' +INTERVAL 1 DAY)`,(2 > '2000-01-01') + interval 1 day AS `(2 > '2000-01-01') +INTERVAL 1 DAY`
+select 2 > '2000-01-01' +INTERVAL 1 DAY, 2 > ('2000-01-01' +INTERVAL 1 DAY), (2 > '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 > '2000-01-01' +INTERVAL 1 DAY 2 > ('2000-01-01' +INTERVAL 1 DAY) (2 > '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 > 3 + 3, 2 > (3 + 3), (2 > 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 + 3 AS `2 > 3 + 3`,2 > 3 + 3 AS `2 > (3 + 3)`,(2 > 3) + 3 AS `(2 > 3) + 3`
+select 2 > 3 + 3, 2 > (3 + 3), (2 > 3) + 3 union select * from v1;
+2 > 3 + 3 2 > (3 + 3) (2 > 3) + 3
+0 0 3
+create or replace view v1 as select 2 > 3 - 3, 2 > (3 - 3), (2 > 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 - 3 AS `2 > 3 - 3`,2 > 3 - 3 AS `2 > (3 - 3)`,(2 > 3) - 3 AS `(2 > 3) - 3`
+select 2 > 3 - 3, 2 > (3 - 3), (2 > 3) - 3 union select * from v1;
+2 > 3 - 3 2 > (3 - 3) (2 > 3) - 3
+1 1 -3
+create or replace view v1 as select 4 > 3 * 3, 4 > (3 * 3), (4 > 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 > 3 * 3 AS `4 > 3 * 3`,4 > 3 * 3 AS `4 > (3 * 3)`,(4 > 3) * 3 AS `(4 > 3) * 3`
+select 4 > 3 * 3, 4 > (3 * 3), (4 > 3) * 3 union select * from v1;
+4 > 3 * 3 4 > (3 * 3) (4 > 3) * 3
+0 0 3
+create or replace view v1 as select 2 > 3 / 3, 2 > (3 / 3), (2 > 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 / 3 AS `2 > 3 / 3`,2 > 3 / 3 AS `2 > (3 / 3)`,(2 > 3) / 3 AS `(2 > 3) / 3`
+select 2 > 3 / 3, 2 > (3 / 3), (2 > 3) / 3 union select * from v1;
+2 > 3 / 3 2 > (3 / 3) (2 > 3) / 3
+1 1 0.0000
+create or replace view v1 as select 2 > 3 DIV 3, 2 > (3 DIV 3), (2 > 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 DIV 3 AS `2 > 3 DIV 3`,2 > 3 DIV 3 AS `2 > (3 DIV 3)`,(2 > 3) DIV 3 AS `(2 > 3) DIV 3`
+select 2 > 3 DIV 3, 2 > (3 DIV 3), (2 > 3) DIV 3 union select * from v1;
+2 > 3 DIV 3 2 > (3 DIV 3) (2 > 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 > 3 MOD 3, 2 > (3 MOD 3), (2 > 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 % 3 AS `2 > 3 MOD 3`,2 > 3 % 3 AS `2 > (3 MOD 3)`,(2 > 3) % 3 AS `(2 > 3) MOD 3`
+select 2 > 3 MOD 3, 2 > (3 MOD 3), (2 > 3) MOD 3 union select * from v1;
+2 > 3 MOD 3 2 > (3 MOD 3) (2 > 3) MOD 3
+1 1 0
+create or replace view v1 as select 2 > 3 % 3, 2 > (3 % 3), (2 > 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 % 3 AS `2 > 3 % 3`,2 > 3 % 3 AS `2 > (3 % 3)`,(2 > 3) % 3 AS `(2 > 3) % 3`
+select 2 > 3 % 3, 2 > (3 % 3), (2 > 3) % 3 union select * from v1;
+2 > 3 % 3 2 > (3 % 3) (2 > 3) % 3
+1 1 0
+create or replace view v1 as select 2 > 3 ^ 3, 2 > (3 ^ 3), (2 > 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 ^ 3 AS `2 > 3 ^ 3`,2 > 3 ^ 3 AS `2 > (3 ^ 3)`,(2 > 3) ^ 3 AS `(2 > 3) ^ 3`
+select 2 > 3 ^ 3, 2 > (3 ^ 3), (2 > 3) ^ 3 union select * from v1;
+2 > 3 ^ 3 2 > (3 ^ 3) (2 > 3) ^ 3
+1 1 3
+create or replace view v1 as select 2 > 3 BETWEEN 1 AND 3, 2 > (3 BETWEEN 1 AND 3), (2 > 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 between 1 and 3 AS `2 > 3 BETWEEN 1 AND 3`,2 > 3 between 1 and 3 AS `2 > (3 BETWEEN 1 AND 3)`,(2 > 3) between 1 and 3 AS `(2 > 3) BETWEEN 1 AND 3`
+select 2 > 3 BETWEEN 1 AND 3, 2 > (3 BETWEEN 1 AND 3), (2 > 3) BETWEEN 1 AND 3 union select * from v1;
+2 > 3 BETWEEN 1 AND 3 2 > (3 BETWEEN 1 AND 3) (2 > 3) BETWEEN 1 AND 3
+1 1 0
+create or replace view v1 as select 2 != 3 IS FALSE, 2 != (3 IS FALSE), (2 != 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 is false AS `2 != 3 IS FALSE`,2 <> (3 is false) AS `2 != (3 IS FALSE)`,2 <> 3 is false AS `(2 != 3) IS FALSE`
+select 2 != 3 IS FALSE, 2 != (3 IS FALSE), (2 != 3) IS FALSE union select * from v1;
+2 != 3 IS FALSE 2 != (3 IS FALSE) (2 != 3) IS FALSE
+0 1 0
+create or replace view v1 as select charset(2 != 3 COLLATE latin1_bin), charset(2 != (3 COLLATE latin1_bin)), charset((2 != 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 <> 3 collate latin1_bin) AS `charset(2 != 3 COLLATE latin1_bin)`,charset(2 <> 3 collate latin1_bin) AS `charset(2 != (3 COLLATE latin1_bin))`,charset((2 <> 3) collate latin1_bin) AS `charset((2 != 3) COLLATE latin1_bin)`
+select charset(2 != 3 COLLATE latin1_bin), charset(2 != (3 COLLATE latin1_bin)), charset((2 != 3) COLLATE latin1_bin) union select * from v1;
+charset(2 != 3 COLLATE latin1_bin) charset(2 != (3 COLLATE latin1_bin)) charset((2 != 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 != 3 IN (0,0), 2 != (3 IN (0,0)), (2 != 3) IN (0,0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 in (0,0) AS `2 != 3 IN (0,0)`,2 <> 3 in (0,0) AS `2 != (3 IN (0,0))`,(2 <> 3) in (0,0) AS `(2 != 3) IN (0,0)`
+select 2 != 3 IN (0,0), 2 != (3 IN (0,0)), (2 != 3) IN (0,0) union select * from v1;
+2 != 3 IN (0,0) 2 != (3 IN (0,0)) (2 != 3) IN (0,0)
+1 1 0
+create or replace view v1 as select 1 != 3 OR 3, 1 != (3 OR 3), (1 != 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 or 3 AS `1 != 3 OR 3`,1 <> (3 or 3) AS `1 != (3 OR 3)`,1 <> 3 or 3 AS `(1 != 3) OR 3`
+select 1 != 3 OR 3, 1 != (3 OR 3), (1 != 3) OR 3 union select * from v1;
+1 != 3 OR 3 1 != (3 OR 3) (1 != 3) OR 3
+1 0 1
+create or replace view v1 as select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 or 3 AS `1 != 3 || 3`,1 <> (3 or 3) AS `1 != (3 || 3)`,1 <> 3 or 3 AS `(1 != 3) || 3`
+select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3 union select * from v1;
+1 != 3 || 3 1 != (3 || 3) (1 != 3) || 3
+1 0 1
+create or replace view v1 as select 2 != 3 XOR 3, 2 != (3 XOR 3), (2 != 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 xor 3 AS `2 != 3 XOR 3`,2 <> (3 xor 3) AS `2 != (3 XOR 3)`,2 <> 3 xor 3 AS `(2 != 3) XOR 3`
+select 2 != 3 XOR 3, 2 != (3 XOR 3), (2 != 3) XOR 3 union select * from v1;
+2 != 3 XOR 3 2 != (3 XOR 3) (2 != 3) XOR 3
+0 1 0
+create or replace view v1 as select 3 != 3 AND 3, 3 != (3 AND 3), (3 != 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 and 3 AS `3 != 3 AND 3`,3 <> (3 and 3) AS `3 != (3 AND 3)`,3 <> 3 and 3 AS `(3 != 3) AND 3`
+select 3 != 3 AND 3, 3 != (3 AND 3), (3 != 3) AND 3 union select * from v1;
+3 != 3 AND 3 3 != (3 AND 3) (3 != 3) AND 3
+0 1 0
+create or replace view v1 as select 3 != 3 && 3, 3 != (3 && 3), (3 != 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 and 3 AS `3 != 3 && 3`,3 <> (3 and 3) AS `3 != (3 && 3)`,3 <> 3 and 3 AS `(3 != 3) && 3`
+select 3 != 3 && 3, 3 != (3 && 3), (3 != 3) && 3 union select * from v1;
+3 != 3 && 3 3 != (3 && 3) (3 != 3) && 3
+0 1 0
+create or replace view v1 as select 2 != 3 = 3, 2 != (3 = 3), (2 != 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 = 3 AS `2 != 3 = 3`,2 <> (3 = 3) AS `2 != (3 = 3)`,2 <> 3 = 3 AS `(2 != 3) = 3`
+select 2 != 3 = 3, 2 != (3 = 3), (2 != 3) = 3 union select * from v1;
+2 != 3 = 3 2 != (3 = 3) (2 != 3) = 3
+0 1 0
+create or replace view v1 as select 2 != 3 <=> 3, 2 != (3 <=> 3), (2 != 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 <=> 3 AS `2 != 3 <=> 3`,2 <> (3 <=> 3) AS `2 != (3 <=> 3)`,2 <> 3 <=> 3 AS `(2 != 3) <=> 3`
+select 2 != 3 <=> 3, 2 != (3 <=> 3), (2 != 3) <=> 3 union select * from v1;
+2 != 3 <=> 3 2 != (3 <=> 3) (2 != 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 != 3 >= 3, 2 != (3 >= 3), (2 != 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 >= 3 AS `2 != 3 >= 3`,2 <> (3 >= 3) AS `2 != (3 >= 3)`,2 <> 3 >= 3 AS `(2 != 3) >= 3`
+select 2 != 3 >= 3, 2 != (3 >= 3), (2 != 3) >= 3 union select * from v1;
+2 != 3 >= 3 2 != (3 >= 3) (2 != 3) >= 3
+0 1 0
+create or replace view v1 as select 1 != 3 <= 3, 1 != (3 <= 3), (1 != 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 3 <= 3 AS `1 != 3 <= 3`,1 <> (3 <= 3) AS `1 != (3 <= 3)`,1 <> 3 <= 3 AS `(1 != 3) <= 3`
+select 1 != 3 <= 3, 1 != (3 <= 3), (1 != 3) <= 3 union select * from v1;
+1 != 3 <= 3 1 != (3 <= 3) (1 != 3) <= 3
+1 0 1
+create or replace view v1 as select 0 != 3 < 3, 0 != (3 < 3), (0 != 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 < 3 AS `0 != 3 < 3`,0 <> (3 < 3) AS `0 != (3 < 3)`,0 <> 3 < 3 AS `(0 != 3) < 3`
+select 0 != 3 < 3, 0 != (3 < 3), (0 != 3) < 3 union select * from v1;
+0 != 3 < 3 0 != (3 < 3) (0 != 3) < 3
+1 0 1
+create or replace view v1 as select 0 != 3 <> 3, 0 != (3 <> 3), (0 != 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 <> 3 AS `0 != 3 <> 3`,0 <> (3 <> 3) AS `0 != (3 <> 3)`,0 <> 3 <> 3 AS `(0 != 3) <> 3`
+select 0 != 3 <> 3, 0 != (3 <> 3), (0 != 3) <> 3 union select * from v1;
+0 != 3 <> 3 0 != (3 <> 3) (0 != 3) <> 3
+1 0 1
+create or replace view v1 as select 2 != 3 > 3, 2 != (3 > 3), (2 != 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 > 3 AS `2 != 3 > 3`,2 <> (3 > 3) AS `2 != (3 > 3)`,2 <> 3 > 3 AS `(2 != 3) > 3`
+select 2 != 3 > 3, 2 != (3 > 3), (2 != 3) > 3 union select * from v1;
+2 != 3 > 3 2 != (3 > 3) (2 != 3) > 3
+0 1 0
+create or replace view v1 as select 0 != 3 != 3, 0 != (3 != 3), (0 != 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 <> 3 <> 3 AS `0 != 3 != 3`,0 <> (3 <> 3) AS `0 != (3 != 3)`,0 <> 3 <> 3 AS `(0 != 3) != 3`
+select 0 != 3 != 3, 0 != (3 != 3), (0 != 3) != 3 union select * from v1;
+0 != 3 != 3 0 != (3 != 3) (0 != 3) != 3
+1 0 1
+create or replace view v1 as select 2 != 3 LIKE 3, 2 != (3 LIKE 3), (2 != 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 like 3 AS `2 != 3 LIKE 3`,2 <> 3 like 3 AS `2 != (3 LIKE 3)`,(2 <> 3) like 3 AS `(2 != 3) LIKE 3`
+select 2 != 3 LIKE 3, 2 != (3 LIKE 3), (2 != 3) LIKE 3 union select * from v1;
+2 != 3 LIKE 3 2 != (3 LIKE 3) (2 != 3) LIKE 3
+1 1 0
+create or replace view v1 as select 2 != 3 REGEXP 3, 2 != (3 REGEXP 3), (2 != 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 regexp 3 AS `2 != 3 REGEXP 3`,2 <> 3 regexp 3 AS `2 != (3 REGEXP 3)`,(2 <> 3) regexp 3 AS `(2 != 3) REGEXP 3`
+select 2 != 3 REGEXP 3, 2 != (3 REGEXP 3), (2 != 3) REGEXP 3 union select * from v1;
+2 != 3 REGEXP 3 2 != (3 REGEXP 3) (2 != 3) REGEXP 3
+1 1 0
+create or replace view v1 as select 2 != 3 | 3, 2 != (3 | 3), (2 != 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 | 3 AS `2 != 3 | 3`,2 <> 3 | 3 AS `2 != (3 | 3)`,(2 <> 3) | 3 AS `(2 != 3) | 3`
+select 2 != 3 | 3, 2 != (3 | 3), (2 != 3) | 3 union select * from v1;
+2 != 3 | 3 2 != (3 | 3) (2 != 3) | 3
+1 1 3
+create or replace view v1 as select 2 != 4 & 4, 2 != (4 & 4), (2 != 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 4 & 4 AS `2 != 4 & 4`,2 <> 4 & 4 AS `2 != (4 & 4)`,(2 <> 4) & 4 AS `(2 != 4) & 4`
+select 2 != 4 & 4, 2 != (4 & 4), (2 != 4) & 4 union select * from v1;
+2 != 4 & 4 2 != (4 & 4) (2 != 4) & 4
+1 1 0
+create or replace view v1 as select 2 != 3 << 3, 2 != (3 << 3), (2 != 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 << 3 AS `2 != 3 << 3`,2 <> 3 << 3 AS `2 != (3 << 3)`,(2 <> 3) << 3 AS `(2 != 3) << 3`
+select 2 != 3 << 3, 2 != (3 << 3), (2 != 3) << 3 union select * from v1;
+2 != 3 << 3 2 != (3 << 3) (2 != 3) << 3
+1 1 8
+create or replace view v1 as select 2 != 3 >> 3, 2 != (3 >> 3), (2 != 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 >> 3 AS `2 != 3 >> 3`,2 <> 3 >> 3 AS `2 != (3 >> 3)`,(2 <> 3) >> 3 AS `(2 != 3) >> 3`
+select 2 != 3 >> 3, 2 != (3 >> 3), (2 != 3) >> 3 union select * from v1;
+2 != 3 >> 3 2 != (3 >> 3) (2 != 3) >> 3
+1 1 0
+create or replace view v1 as select 2 != '2000-01-01' +INTERVAL 1 DAY, 2 != ('2000-01-01' +INTERVAL 1 DAY), (2 != '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> '2000-01-01' + interval 1 day AS `2 != '2000-01-01' +INTERVAL 1 DAY`,2 <> '2000-01-01' + interval 1 day AS `2 != ('2000-01-01' +INTERVAL 1 DAY)`,(2 <> '2000-01-01') + interval 1 day AS `(2 != '2000-01-01') +INTERVAL 1 DAY`
+select 2 != '2000-01-01' +INTERVAL 1 DAY, 2 != ('2000-01-01' +INTERVAL 1 DAY), (2 != '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 != '2000-01-01' +INTERVAL 1 DAY 2 != ('2000-01-01' +INTERVAL 1 DAY) (2 != '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 != 3 + 3, 2 != (3 + 3), (2 != 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 + 3 AS `2 != 3 + 3`,2 <> 3 + 3 AS `2 != (3 + 3)`,(2 <> 3) + 3 AS `(2 != 3) + 3`
+select 2 != 3 + 3, 2 != (3 + 3), (2 != 3) + 3 union select * from v1;
+2 != 3 + 3 2 != (3 + 3) (2 != 3) + 3
+1 1 4
+create or replace view v1 as select 2 != 3 - 3, 2 != (3 - 3), (2 != 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 - 3 AS `2 != 3 - 3`,2 <> 3 - 3 AS `2 != (3 - 3)`,(2 <> 3) - 3 AS `(2 != 3) - 3`
+select 2 != 3 - 3, 2 != (3 - 3), (2 != 3) - 3 union select * from v1;
+2 != 3 - 3 2 != (3 - 3) (2 != 3) - 3
+1 1 -2
+create or replace view v1 as select 2 != 3 * 3, 2 != (3 * 3), (2 != 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 * 3 AS `2 != 3 * 3`,2 <> 3 * 3 AS `2 != (3 * 3)`,(2 <> 3) * 3 AS `(2 != 3) * 3`
+select 2 != 3 * 3, 2 != (3 * 3), (2 != 3) * 3 union select * from v1;
+2 != 3 * 3 2 != (3 * 3) (2 != 3) * 3
+1 1 3
+create or replace view v1 as select 2 != 3 / 3, 2 != (3 / 3), (2 != 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 / 3 AS `2 != 3 / 3`,2 <> 3 / 3 AS `2 != (3 / 3)`,(2 <> 3) / 3 AS `(2 != 3) / 3`
+select 2 != 3 / 3, 2 != (3 / 3), (2 != 3) / 3 union select * from v1;
+2 != 3 / 3 2 != (3 / 3) (2 != 3) / 3
+1 1 0.3333
+create or replace view v1 as select 2 != 3 DIV 3, 2 != (3 DIV 3), (2 != 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 DIV 3 AS `2 != 3 DIV 3`,2 <> 3 DIV 3 AS `2 != (3 DIV 3)`,(2 <> 3) DIV 3 AS `(2 != 3) DIV 3`
+select 2 != 3 DIV 3, 2 != (3 DIV 3), (2 != 3) DIV 3 union select * from v1;
+2 != 3 DIV 3 2 != (3 DIV 3) (2 != 3) DIV 3
+1 1 0
+create or replace view v1 as select 3 != 3 MOD 3, 3 != (3 MOD 3), (3 != 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 % 3 AS `3 != 3 MOD 3`,3 <> 3 % 3 AS `3 != (3 MOD 3)`,(3 <> 3) % 3 AS `(3 != 3) MOD 3`
+select 3 != 3 MOD 3, 3 != (3 MOD 3), (3 != 3) MOD 3 union select * from v1;
+3 != 3 MOD 3 3 != (3 MOD 3) (3 != 3) MOD 3
+1 1 0
+create or replace view v1 as select 3 != 3 % 3, 3 != (3 % 3), (3 != 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 <> 3 % 3 AS `3 != 3 % 3`,3 <> 3 % 3 AS `3 != (3 % 3)`,(3 <> 3) % 3 AS `(3 != 3) % 3`
+select 3 != 3 % 3, 3 != (3 % 3), (3 != 3) % 3 union select * from v1;
+3 != 3 % 3 3 != (3 % 3) (3 != 3) % 3
+1 1 0
+create or replace view v1 as select 2 != 3 ^ 3, 2 != (3 ^ 3), (2 != 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 ^ 3 AS `2 != 3 ^ 3`,2 <> 3 ^ 3 AS `2 != (3 ^ 3)`,(2 <> 3) ^ 3 AS `(2 != 3) ^ 3`
+select 2 != 3 ^ 3, 2 != (3 ^ 3), (2 != 3) ^ 3 union select * from v1;
+2 != 3 ^ 3 2 != (3 ^ 3) (2 != 3) ^ 3
+1 1 2
+create or replace view v1 as select 2 != 3 BETWEEN 2 AND 3, 2 != (3 BETWEEN 2 AND 3), (2 != 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 between 2 and 3 AS `2 != 3 BETWEEN 2 AND 3`,2 <> 3 between 2 and 3 AS `2 != (3 BETWEEN 2 AND 3)`,(2 <> 3) between 2 and 3 AS `(2 != 3) BETWEEN 2 AND 3`
+select 2 != 3 BETWEEN 2 AND 3, 2 != (3 BETWEEN 2 AND 3), (2 != 3) BETWEEN 2 AND 3 union select * from v1;
+2 != 3 BETWEEN 2 AND 3 2 != (3 BETWEEN 2 AND 3) (2 != 3) BETWEEN 2 AND 3
+1 1 0
+create or replace view v1 as select 2 LIKE 3 IS FALSE, 2 LIKE (3 IS FALSE), (2 LIKE 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 is false AS `2 LIKE 3 IS FALSE`,2 like (3 is false) AS `2 LIKE (3 IS FALSE)`,2 like 3 is false AS `(2 LIKE 3) IS FALSE`
+select 2 LIKE 3 IS FALSE, 2 LIKE (3 IS FALSE), (2 LIKE 3) IS FALSE union select * from v1;
+2 LIKE 3 IS FALSE 2 LIKE (3 IS FALSE) (2 LIKE 3) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 LIKE 3 COLLATE latin1_bin), charset(2 LIKE (3 COLLATE latin1_bin)), charset((2 LIKE 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 like 3 collate latin1_bin) AS `charset(2 LIKE 3 COLLATE latin1_bin)`,charset(2 like 3 collate latin1_bin) AS `charset(2 LIKE (3 COLLATE latin1_bin))`,charset((2 like 3) collate latin1_bin) AS `charset((2 LIKE 3) COLLATE latin1_bin)`
+select charset(2 LIKE 3 COLLATE latin1_bin), charset(2 LIKE (3 COLLATE latin1_bin)), charset((2 LIKE 3) COLLATE latin1_bin) union select * from v1;
+charset(2 LIKE 3 COLLATE latin1_bin) charset(2 LIKE (3 COLLATE latin1_bin)) charset((2 LIKE 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 LIKE 3 IN (0,1), 2 LIKE (3 IN (0,1)), (2 LIKE 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 in (0,1) AS `2 LIKE 3 IN (0,1)`,2 like (3 in (0,1)) AS `2 LIKE (3 IN (0,1))`,2 like 3 in (0,1) AS `(2 LIKE 3) IN (0,1)`
+select 2 LIKE 3 IN (0,1), 2 LIKE (3 IN (0,1)), (2 LIKE 3) IN (0,1) union select * from v1;
+2 LIKE 3 IN (0,1) 2 LIKE (3 IN (0,1)) (2 LIKE 3) IN (0,1)
+1 0 1
+create or replace view v1 as select 2 LIKE 3 OR 3, 2 LIKE (3 OR 3), (2 LIKE 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 or 3 AS `2 LIKE 3 OR 3`,2 like (3 or 3) AS `2 LIKE (3 OR 3)`,2 like 3 or 3 AS `(2 LIKE 3) OR 3`
+select 2 LIKE 3 OR 3, 2 LIKE (3 OR 3), (2 LIKE 3) OR 3 union select * from v1;
+2 LIKE 3 OR 3 2 LIKE (3 OR 3) (2 LIKE 3) OR 3
+1 0 1
+create or replace view v1 as select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 or 3 AS `2 LIKE 3 || 3`,2 like (3 or 3) AS `2 LIKE (3 || 3)`,2 like 3 or 3 AS `(2 LIKE 3) || 3`
+select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3 union select * from v1;
+2 LIKE 3 || 3 2 LIKE (3 || 3) (2 LIKE 3) || 3
+1 0 1
+create or replace view v1 as select 2 LIKE 3 XOR 3, 2 LIKE (3 XOR 3), (2 LIKE 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 xor 3 AS `2 LIKE 3 XOR 3`,2 like (3 xor 3) AS `2 LIKE (3 XOR 3)`,2 like 3 xor 3 AS `(2 LIKE 3) XOR 3`
+select 2 LIKE 3 XOR 3, 2 LIKE (3 XOR 3), (2 LIKE 3) XOR 3 union select * from v1;
+2 LIKE 3 XOR 3 2 LIKE (3 XOR 3) (2 LIKE 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 LIKE 2 AND 2, 2 LIKE (2 AND 2), (2 LIKE 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 and 2 AS `2 LIKE 2 AND 2`,2 like (2 and 2) AS `2 LIKE (2 AND 2)`,2 like 2 and 2 AS `(2 LIKE 2) AND 2`
+select 2 LIKE 2 AND 2, 2 LIKE (2 AND 2), (2 LIKE 2) AND 2 union select * from v1;
+2 LIKE 2 AND 2 2 LIKE (2 AND 2) (2 LIKE 2) AND 2
+1 0 1
+create or replace view v1 as select 2 LIKE 2 && 2, 2 LIKE (2 && 2), (2 LIKE 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 and 2 AS `2 LIKE 2 && 2`,2 like (2 and 2) AS `2 LIKE (2 && 2)`,2 like 2 and 2 AS `(2 LIKE 2) && 2`
+select 2 LIKE 2 && 2, 2 LIKE (2 && 2), (2 LIKE 2) && 2 union select * from v1;
+2 LIKE 2 && 2 2 LIKE (2 && 2) (2 LIKE 2) && 2
+1 0 1
+create or replace view v1 as select 2 LIKE 2 = 1, 2 LIKE (2 = 1), (2 LIKE 2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 = 1 AS `2 LIKE 2 = 1`,2 like (2 = 1) AS `2 LIKE (2 = 1)`,2 like 2 = 1 AS `(2 LIKE 2) = 1`
+select 2 LIKE 2 = 1, 2 LIKE (2 = 1), (2 LIKE 2) = 1 union select * from v1;
+2 LIKE 2 = 1 2 LIKE (2 = 1) (2 LIKE 2) = 1
+1 0 1
+create or replace view v1 as select 2 LIKE 2 <=> 1, 2 LIKE (2 <=> 1), (2 LIKE 2) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 <=> 1 AS `2 LIKE 2 <=> 1`,2 like (2 <=> 1) AS `2 LIKE (2 <=> 1)`,2 like 2 <=> 1 AS `(2 LIKE 2) <=> 1`
+select 2 LIKE 2 <=> 1, 2 LIKE (2 <=> 1), (2 LIKE 2) <=> 1 union select * from v1;
+2 LIKE 2 <=> 1 2 LIKE (2 <=> 1) (2 LIKE 2) <=> 1
+1 0 1
+create or replace view v1 as select 2 LIKE 2 >= 1, 2 LIKE (2 >= 1), (2 LIKE 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 >= 1 AS `2 LIKE 2 >= 1`,2 like (2 >= 1) AS `2 LIKE (2 >= 1)`,2 like 2 >= 1 AS `(2 LIKE 2) >= 1`
+select 2 LIKE 2 >= 1, 2 LIKE (2 >= 1), (2 LIKE 2) >= 1 union select * from v1;
+2 LIKE 2 >= 1 2 LIKE (2 >= 1) (2 LIKE 2) >= 1
+1 0 1
+create or replace view v1 as select 2 LIKE 3 <= 3, 2 LIKE (3 <= 3), (2 LIKE 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 <= 3 AS `2 LIKE 3 <= 3`,2 like (3 <= 3) AS `2 LIKE (3 <= 3)`,2 like 3 <= 3 AS `(2 LIKE 3) <= 3`
+select 2 LIKE 3 <= 3, 2 LIKE (3 <= 3), (2 LIKE 3) <= 3 union select * from v1;
+2 LIKE 3 <= 3 2 LIKE (3 <= 3) (2 LIKE 3) <= 3
+1 0 1
+create or replace view v1 as select 2 LIKE 3 < 3, 2 LIKE (3 < 3), (2 LIKE 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 < 3 AS `2 LIKE 3 < 3`,2 like (3 < 3) AS `2 LIKE (3 < 3)`,2 like 3 < 3 AS `(2 LIKE 3) < 3`
+select 2 LIKE 3 < 3, 2 LIKE (3 < 3), (2 LIKE 3) < 3 union select * from v1;
+2 LIKE 3 < 3 2 LIKE (3 < 3) (2 LIKE 3) < 3
+1 0 1
+create or replace view v1 as select 2 LIKE 3 <> 3, 2 LIKE (3 <> 3), (2 LIKE 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 <> 3 AS `2 LIKE 3 <> 3`,2 like (3 <> 3) AS `2 LIKE (3 <> 3)`,2 like 3 <> 3 AS `(2 LIKE 3) <> 3`
+select 2 LIKE 3 <> 3, 2 LIKE (3 <> 3), (2 LIKE 3) <> 3 union select * from v1;
+2 LIKE 3 <> 3 2 LIKE (3 <> 3) (2 LIKE 3) <> 3
+1 0 1
+create or replace view v1 as select 2 LIKE 2 > 0, 2 LIKE (2 > 0), (2 LIKE 2) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 > 0 AS `2 LIKE 2 > 0`,2 like (2 > 0) AS `2 LIKE (2 > 0)`,2 like 2 > 0 AS `(2 LIKE 2) > 0`
+select 2 LIKE 2 > 0, 2 LIKE (2 > 0), (2 LIKE 2) > 0 union select * from v1;
+2 LIKE 2 > 0 2 LIKE (2 > 0) (2 LIKE 2) > 0
+1 0 1
+create or replace view v1 as select 2 LIKE 3 != 3, 2 LIKE (3 != 3), (2 LIKE 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 <> 3 AS `2 LIKE 3 != 3`,2 like (3 <> 3) AS `2 LIKE (3 != 3)`,2 like 3 <> 3 AS `(2 LIKE 3) != 3`
+select 2 LIKE 3 != 3, 2 LIKE (3 != 3), (2 LIKE 3) != 3 union select * from v1;
+2 LIKE 3 != 3 2 LIKE (3 != 3) (2 LIKE 3) != 3
+1 0 1
+create or replace view v1 as select 2 LIKE 2 LIKE 1, 2 LIKE (2 LIKE 1), (2 LIKE 2) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 like 1 AS `2 LIKE 2 LIKE 1`,2 like (2 like 1) AS `2 LIKE (2 LIKE 1)`,2 like 2 like 1 AS `(2 LIKE 2) LIKE 1`
+select 2 LIKE 2 LIKE 1, 2 LIKE (2 LIKE 1), (2 LIKE 2) LIKE 1 union select * from v1;
+2 LIKE 2 LIKE 1 2 LIKE (2 LIKE 1) (2 LIKE 2) LIKE 1
+1 0 1
+create or replace view v1 as select 2 LIKE 2 REGEXP 1, 2 LIKE (2 REGEXP 1), (2 LIKE 2) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 regexp 1 AS `2 LIKE 2 REGEXP 1`,2 like (2 regexp 1) AS `2 LIKE (2 REGEXP 1)`,2 like 2 regexp 1 AS `(2 LIKE 2) REGEXP 1`
+select 2 LIKE 2 REGEXP 1, 2 LIKE (2 REGEXP 1), (2 LIKE 2) REGEXP 1 union select * from v1;
+2 LIKE 2 REGEXP 1 2 LIKE (2 REGEXP 1) (2 LIKE 2) REGEXP 1
+1 0 1
+create or replace view v1 as select 2 LIKE 3 | 3, 2 LIKE (3 | 3), (2 LIKE 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 | 3 AS `2 LIKE 3 | 3`,2 like 3 | 3 AS `2 LIKE (3 | 3)`,(2 like 3) | 3 AS `(2 LIKE 3) | 3`
+select 2 LIKE 3 | 3, 2 LIKE (3 | 3), (2 LIKE 3) | 3 union select * from v1;
+2 LIKE 3 | 3 2 LIKE (3 | 3) (2 LIKE 3) | 3
+0 0 3
+create or replace view v1 as select 2 LIKE 2 & 2, 2 LIKE (2 & 2), (2 LIKE 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 & 2 AS `2 LIKE 2 & 2`,2 like 2 & 2 AS `2 LIKE (2 & 2)`,(2 like 2) & 2 AS `(2 LIKE 2) & 2`
+select 2 LIKE 2 & 2, 2 LIKE (2 & 2), (2 LIKE 2) & 2 union select * from v1;
+2 LIKE 2 & 2 2 LIKE (2 & 2) (2 LIKE 2) & 2
+1 1 0
+create or replace view v1 as select 2 LIKE 2 << 2, 2 LIKE (2 << 2), (2 LIKE 2) << 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 << 2 AS `2 LIKE 2 << 2`,2 like 2 << 2 AS `2 LIKE (2 << 2)`,(2 like 2) << 2 AS `(2 LIKE 2) << 2`
+select 2 LIKE 2 << 2, 2 LIKE (2 << 2), (2 LIKE 2) << 2 union select * from v1;
+2 LIKE 2 << 2 2 LIKE (2 << 2) (2 LIKE 2) << 2
+0 0 4
+create or replace view v1 as select 2 LIKE 4 >> 1, 2 LIKE (4 >> 1), (2 LIKE 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 4 >> 1 AS `2 LIKE 4 >> 1`,2 like 4 >> 1 AS `2 LIKE (4 >> 1)`,(2 like 4) >> 1 AS `(2 LIKE 4) >> 1`
+select 2 LIKE 4 >> 1, 2 LIKE (4 >> 1), (2 LIKE 4) >> 1 union select * from v1;
+2 LIKE 4 >> 1 2 LIKE (4 >> 1) (2 LIKE 4) >> 1
+1 1 0
+create or replace view v1 as select 2 LIKE '2000-01-01' +INTERVAL 1 DAY, 2 LIKE ('2000-01-01' +INTERVAL 1 DAY), (2 LIKE '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like '2000-01-01' + interval 1 day AS `2 LIKE '2000-01-01' +INTERVAL 1 DAY`,2 like '2000-01-01' + interval 1 day AS `2 LIKE ('2000-01-01' +INTERVAL 1 DAY)`,(2 like '2000-01-01') + interval 1 day AS `(2 LIKE '2000-01-01') +INTERVAL 1 DAY`
+select 2 LIKE '2000-01-01' +INTERVAL 1 DAY, 2 LIKE ('2000-01-01' +INTERVAL 1 DAY), (2 LIKE '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 LIKE '2000-01-01' +INTERVAL 1 DAY 2 LIKE ('2000-01-01' +INTERVAL 1 DAY) (2 LIKE '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 LIKE 3 + 3, 2 LIKE (3 + 3), (2 LIKE 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 + 3 AS `2 LIKE 3 + 3`,2 like 3 + 3 AS `2 LIKE (3 + 3)`,(2 like 3) + 3 AS `(2 LIKE 3) + 3`
+select 2 LIKE 3 + 3, 2 LIKE (3 + 3), (2 LIKE 3) + 3 union select * from v1;
+2 LIKE 3 + 3 2 LIKE (3 + 3) (2 LIKE 3) + 3
+0 0 3
+create or replace view v1 as select 2 LIKE 3 - 3, 2 LIKE (3 - 3), (2 LIKE 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 - 3 AS `2 LIKE 3 - 3`,2 like 3 - 3 AS `2 LIKE (3 - 3)`,(2 like 3) - 3 AS `(2 LIKE 3) - 3`
+select 2 LIKE 3 - 3, 2 LIKE (3 - 3), (2 LIKE 3) - 3 union select * from v1;
+2 LIKE 3 - 3 2 LIKE (3 - 3) (2 LIKE 3) - 3
+0 0 -3
+create or replace view v1 as select 2 LIKE 2 * 2, 2 LIKE (2 * 2), (2 LIKE 2) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 * 2 AS `2 LIKE 2 * 2`,2 like 2 * 2 AS `2 LIKE (2 * 2)`,(2 like 2) * 2 AS `(2 LIKE 2) * 2`
+select 2 LIKE 2 * 2, 2 LIKE (2 * 2), (2 LIKE 2) * 2 union select * from v1;
+2 LIKE 2 * 2 2 LIKE (2 * 2) (2 LIKE 2) * 2
+0 0 2
+create or replace view v1 as select 2 LIKE 2 / 2, 2 LIKE (2 / 2), (2 LIKE 2) / 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 / 2 AS `2 LIKE 2 / 2`,2 like 2 / 2 AS `2 LIKE (2 / 2)`,(2 like 2) / 2 AS `(2 LIKE 2) / 2`
+select 2 LIKE 2 / 2, 2 LIKE (2 / 2), (2 LIKE 2) / 2 union select * from v1;
+2 LIKE 2 / 2 2 LIKE (2 / 2) (2 LIKE 2) / 2
+0 0 0.5000
+create or replace view v1 as select 2 LIKE 4 DIV 2, 2 LIKE (4 DIV 2), (2 LIKE 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 4 DIV 2 AS `2 LIKE 4 DIV 2`,2 like 4 DIV 2 AS `2 LIKE (4 DIV 2)`,(2 like 4) DIV 2 AS `(2 LIKE 4) DIV 2`
+select 2 LIKE 4 DIV 2, 2 LIKE (4 DIV 2), (2 LIKE 4) DIV 2 union select * from v1;
+2 LIKE 4 DIV 2 2 LIKE (4 DIV 2) (2 LIKE 4) DIV 2
+1 1 0
+create or replace view v1 as select 2 LIKE 2 MOD 2, 2 LIKE (2 MOD 2), (2 LIKE 2) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 % 2 AS `2 LIKE 2 MOD 2`,2 like 2 % 2 AS `2 LIKE (2 MOD 2)`,(2 like 2) % 2 AS `(2 LIKE 2) MOD 2`
+select 2 LIKE 2 MOD 2, 2 LIKE (2 MOD 2), (2 LIKE 2) MOD 2 union select * from v1;
+2 LIKE 2 MOD 2 2 LIKE (2 MOD 2) (2 LIKE 2) MOD 2
+0 0 1
+create or replace view v1 as select 2 LIKE 2 % 2, 2 LIKE (2 % 2), (2 LIKE 2) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 % 2 AS `2 LIKE 2 % 2`,2 like 2 % 2 AS `2 LIKE (2 % 2)`,(2 like 2) % 2 AS `(2 LIKE 2) % 2`
+select 2 LIKE 2 % 2, 2 LIKE (2 % 2), (2 LIKE 2) % 2 union select * from v1;
+2 LIKE 2 % 2 2 LIKE (2 % 2) (2 LIKE 2) % 2
+0 0 1
+create or replace view v1 as select 2 LIKE 3 ^ 3, 2 LIKE (3 ^ 3), (2 LIKE 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 ^ 3 AS `2 LIKE 3 ^ 3`,2 like 3 ^ 3 AS `2 LIKE (3 ^ 3)`,(2 like 3) ^ 3 AS `(2 LIKE 3) ^ 3`
+select 2 LIKE 3 ^ 3, 2 LIKE (3 ^ 3), (2 LIKE 3) ^ 3 union select * from v1;
+2 LIKE 3 ^ 3 2 LIKE (3 ^ 3) (2 LIKE 3) ^ 3
+0 0 3
+create or replace view v1 as select 2 LIKE 2 BETWEEN 1 AND 3, 2 LIKE (2 BETWEEN 1 AND 3), (2 LIKE 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 between 1 and 3 AS `2 LIKE 2 BETWEEN 1 AND 3`,2 like (2 between 1 and 3) AS `2 LIKE (2 BETWEEN 1 AND 3)`,2 like 2 between 1 and 3 AS `(2 LIKE 2) BETWEEN 1 AND 3`
+select 2 LIKE 2 BETWEEN 1 AND 3, 2 LIKE (2 BETWEEN 1 AND 3), (2 LIKE 2) BETWEEN 1 AND 3 union select * from v1;
+2 LIKE 2 BETWEEN 1 AND 3 2 LIKE (2 BETWEEN 1 AND 3) (2 LIKE 2) BETWEEN 1 AND 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 IS FALSE, 2 REGEXP (3 IS FALSE), (2 REGEXP 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 is false AS `2 REGEXP 3 IS FALSE`,2 regexp (3 is false) AS `2 REGEXP (3 IS FALSE)`,2 regexp 3 is false AS `(2 REGEXP 3) IS FALSE`
+select 2 REGEXP 3 IS FALSE, 2 REGEXP (3 IS FALSE), (2 REGEXP 3) IS FALSE union select * from v1;
+2 REGEXP 3 IS FALSE 2 REGEXP (3 IS FALSE) (2 REGEXP 3) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 REGEXP 3 COLLATE latin1_bin), charset(2 REGEXP (3 COLLATE latin1_bin)), charset((2 REGEXP 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 regexp 3 collate latin1_bin) AS `charset(2 REGEXP 3 COLLATE latin1_bin)`,charset(2 regexp 3 collate latin1_bin) AS `charset(2 REGEXP (3 COLLATE latin1_bin))`,charset((2 regexp 3) collate latin1_bin) AS `charset((2 REGEXP 3) COLLATE latin1_bin)`
+select charset(2 REGEXP 3 COLLATE latin1_bin), charset(2 REGEXP (3 COLLATE latin1_bin)), charset((2 REGEXP 3) COLLATE latin1_bin) union select * from v1;
+charset(2 REGEXP 3 COLLATE latin1_bin) charset(2 REGEXP (3 COLLATE latin1_bin)) charset((2 REGEXP 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 REGEXP 3 IN (0,1), 2 REGEXP (3 IN (0,1)), (2 REGEXP 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 in (0,1) AS `2 REGEXP 3 IN (0,1)`,2 regexp (3 in (0,1)) AS `2 REGEXP (3 IN (0,1))`,2 regexp 3 in (0,1) AS `(2 REGEXP 3) IN (0,1)`
+select 2 REGEXP 3 IN (0,1), 2 REGEXP (3 IN (0,1)), (2 REGEXP 3) IN (0,1) union select * from v1;
+2 REGEXP 3 IN (0,1) 2 REGEXP (3 IN (0,1)) (2 REGEXP 3) IN (0,1)
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 OR 3, 2 REGEXP (3 OR 3), (2 REGEXP 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 or 3 AS `2 REGEXP 3 OR 3`,2 regexp (3 or 3) AS `2 REGEXP (3 OR 3)`,2 regexp 3 or 3 AS `(2 REGEXP 3) OR 3`
+select 2 REGEXP 3 OR 3, 2 REGEXP (3 OR 3), (2 REGEXP 3) OR 3 union select * from v1;
+2 REGEXP 3 OR 3 2 REGEXP (3 OR 3) (2 REGEXP 3) OR 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 or 3 AS `2 REGEXP 3 || 3`,2 regexp (3 or 3) AS `2 REGEXP (3 || 3)`,2 regexp 3 or 3 AS `(2 REGEXP 3) || 3`
+select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3 union select * from v1;
+2 REGEXP 3 || 3 2 REGEXP (3 || 3) (2 REGEXP 3) || 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 XOR 3, 2 REGEXP (3 XOR 3), (2 REGEXP 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 xor 3 AS `2 REGEXP 3 XOR 3`,2 regexp (3 xor 3) AS `2 REGEXP (3 XOR 3)`,2 regexp 3 xor 3 AS `(2 REGEXP 3) XOR 3`
+select 2 REGEXP 3 XOR 3, 2 REGEXP (3 XOR 3), (2 REGEXP 3) XOR 3 union select * from v1;
+2 REGEXP 3 XOR 3 2 REGEXP (3 XOR 3) (2 REGEXP 3) XOR 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 AND 2, 2 REGEXP (2 AND 2), (2 REGEXP 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 and 2 AS `2 REGEXP 2 AND 2`,2 regexp (2 and 2) AS `2 REGEXP (2 AND 2)`,2 regexp 2 and 2 AS `(2 REGEXP 2) AND 2`
+select 2 REGEXP 2 AND 2, 2 REGEXP (2 AND 2), (2 REGEXP 2) AND 2 union select * from v1;
+2 REGEXP 2 AND 2 2 REGEXP (2 AND 2) (2 REGEXP 2) AND 2
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 && 2, 2 REGEXP (2 && 2), (2 REGEXP 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 and 2 AS `2 REGEXP 2 && 2`,2 regexp (2 and 2) AS `2 REGEXP (2 && 2)`,2 regexp 2 and 2 AS `(2 REGEXP 2) && 2`
+select 2 REGEXP 2 && 2, 2 REGEXP (2 && 2), (2 REGEXP 2) && 2 union select * from v1;
+2 REGEXP 2 && 2 2 REGEXP (2 && 2) (2 REGEXP 2) && 2
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 = 1, 2 REGEXP (2 = 1), (2 REGEXP 2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 = 1 AS `2 REGEXP 2 = 1`,2 regexp (2 = 1) AS `2 REGEXP (2 = 1)`,2 regexp 2 = 1 AS `(2 REGEXP 2) = 1`
+select 2 REGEXP 2 = 1, 2 REGEXP (2 = 1), (2 REGEXP 2) = 1 union select * from v1;
+2 REGEXP 2 = 1 2 REGEXP (2 = 1) (2 REGEXP 2) = 1
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 <=> 1, 2 REGEXP (2 <=> 1), (2 REGEXP 2) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 <=> 1 AS `2 REGEXP 2 <=> 1`,2 regexp (2 <=> 1) AS `2 REGEXP (2 <=> 1)`,2 regexp 2 <=> 1 AS `(2 REGEXP 2) <=> 1`
+select 2 REGEXP 2 <=> 1, 2 REGEXP (2 <=> 1), (2 REGEXP 2) <=> 1 union select * from v1;
+2 REGEXP 2 <=> 1 2 REGEXP (2 <=> 1) (2 REGEXP 2) <=> 1
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 >= 1, 2 REGEXP (2 >= 1), (2 REGEXP 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 >= 1 AS `2 REGEXP 2 >= 1`,2 regexp (2 >= 1) AS `2 REGEXP (2 >= 1)`,2 regexp 2 >= 1 AS `(2 REGEXP 2) >= 1`
+select 2 REGEXP 2 >= 1, 2 REGEXP (2 >= 1), (2 REGEXP 2) >= 1 union select * from v1;
+2 REGEXP 2 >= 1 2 REGEXP (2 >= 1) (2 REGEXP 2) >= 1
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 <= 3, 2 REGEXP (3 <= 3), (2 REGEXP 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 <= 3 AS `2 REGEXP 3 <= 3`,2 regexp (3 <= 3) AS `2 REGEXP (3 <= 3)`,2 regexp 3 <= 3 AS `(2 REGEXP 3) <= 3`
+select 2 REGEXP 3 <= 3, 2 REGEXP (3 <= 3), (2 REGEXP 3) <= 3 union select * from v1;
+2 REGEXP 3 <= 3 2 REGEXP (3 <= 3) (2 REGEXP 3) <= 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 < 3, 2 REGEXP (3 < 3), (2 REGEXP 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 < 3 AS `2 REGEXP 3 < 3`,2 regexp (3 < 3) AS `2 REGEXP (3 < 3)`,2 regexp 3 < 3 AS `(2 REGEXP 3) < 3`
+select 2 REGEXP 3 < 3, 2 REGEXP (3 < 3), (2 REGEXP 3) < 3 union select * from v1;
+2 REGEXP 3 < 3 2 REGEXP (3 < 3) (2 REGEXP 3) < 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 <> 3, 2 REGEXP (3 <> 3), (2 REGEXP 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 <> 3 AS `2 REGEXP 3 <> 3`,2 regexp (3 <> 3) AS `2 REGEXP (3 <> 3)`,2 regexp 3 <> 3 AS `(2 REGEXP 3) <> 3`
+select 2 REGEXP 3 <> 3, 2 REGEXP (3 <> 3), (2 REGEXP 3) <> 3 union select * from v1;
+2 REGEXP 3 <> 3 2 REGEXP (3 <> 3) (2 REGEXP 3) <> 3
+1 0 1
+create or replace view v1 as select 2 REGEXP 2 > 0, 2 REGEXP (2 > 0), (2 REGEXP 2) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 > 0 AS `2 REGEXP 2 > 0`,2 regexp (2 > 0) AS `2 REGEXP (2 > 0)`,2 regexp 2 > 0 AS `(2 REGEXP 2) > 0`
+select 2 REGEXP 2 > 0, 2 REGEXP (2 > 0), (2 REGEXP 2) > 0 union select * from v1;
+2 REGEXP 2 > 0 2 REGEXP (2 > 0) (2 REGEXP 2) > 0
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 != 3, 2 REGEXP (3 != 3), (2 REGEXP 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 <> 3 AS `2 REGEXP 3 != 3`,2 regexp (3 <> 3) AS `2 REGEXP (3 != 3)`,2 regexp 3 <> 3 AS `(2 REGEXP 3) != 3`
+select 2 REGEXP 3 != 3, 2 REGEXP (3 != 3), (2 REGEXP 3) != 3 union select * from v1;
+2 REGEXP 3 != 3 2 REGEXP (3 != 3) (2 REGEXP 3) != 3
+1 0 1
+create or replace view v1 as select 1 REGEXP 3 LIKE 3, 1 REGEXP (3 LIKE 3), (1 REGEXP 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 regexp 3 like 3 AS `1 REGEXP 3 LIKE 3`,1 regexp (3 like 3) AS `1 REGEXP (3 LIKE 3)`,1 regexp 3 like 3 AS `(1 REGEXP 3) LIKE 3`
+select 1 REGEXP 3 LIKE 3, 1 REGEXP (3 LIKE 3), (1 REGEXP 3) LIKE 3 union select * from v1;
+1 REGEXP 3 LIKE 3 1 REGEXP (3 LIKE 3) (1 REGEXP 3) LIKE 3
+0 1 0
+create or replace view v1 as select 1 REGEXP 3 REGEXP 3, 1 REGEXP (3 REGEXP 3), (1 REGEXP 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 regexp 3 regexp 3 AS `1 REGEXP 3 REGEXP 3`,1 regexp (3 regexp 3) AS `1 REGEXP (3 REGEXP 3)`,1 regexp 3 regexp 3 AS `(1 REGEXP 3) REGEXP 3`
+select 1 REGEXP 3 REGEXP 3, 1 REGEXP (3 REGEXP 3), (1 REGEXP 3) REGEXP 3 union select * from v1;
+1 REGEXP 3 REGEXP 3 1 REGEXP (3 REGEXP 3) (1 REGEXP 3) REGEXP 3
+0 1 0
+create or replace view v1 as select 2 REGEXP 3 | 3, 2 REGEXP (3 | 3), (2 REGEXP 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 | 3 AS `2 REGEXP 3 | 3`,2 regexp 3 | 3 AS `2 REGEXP (3 | 3)`,(2 regexp 3) | 3 AS `(2 REGEXP 3) | 3`
+select 2 REGEXP 3 | 3, 2 REGEXP (3 | 3), (2 REGEXP 3) | 3 union select * from v1;
+2 REGEXP 3 | 3 2 REGEXP (3 | 3) (2 REGEXP 3) | 3
+0 0 3
+create or replace view v1 as select 2 REGEXP 2 & 2, 2 REGEXP (2 & 2), (2 REGEXP 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 & 2 AS `2 REGEXP 2 & 2`,2 regexp 2 & 2 AS `2 REGEXP (2 & 2)`,(2 regexp 2) & 2 AS `(2 REGEXP 2) & 2`
+select 2 REGEXP 2 & 2, 2 REGEXP (2 & 2), (2 REGEXP 2) & 2 union select * from v1;
+2 REGEXP 2 & 2 2 REGEXP (2 & 2) (2 REGEXP 2) & 2
+1 1 0
+create or replace view v1 as select 2 REGEXP 2 << 2, 2 REGEXP (2 << 2), (2 REGEXP 2) << 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 << 2 AS `2 REGEXP 2 << 2`,2 regexp 2 << 2 AS `2 REGEXP (2 << 2)`,(2 regexp 2) << 2 AS `(2 REGEXP 2) << 2`
+select 2 REGEXP 2 << 2, 2 REGEXP (2 << 2), (2 REGEXP 2) << 2 union select * from v1;
+2 REGEXP 2 << 2 2 REGEXP (2 << 2) (2 REGEXP 2) << 2
+0 0 4
+create or replace view v1 as select 2 REGEXP 4 >> 1, 2 REGEXP (4 >> 1), (2 REGEXP 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 4 >> 1 AS `2 REGEXP 4 >> 1`,2 regexp 4 >> 1 AS `2 REGEXP (4 >> 1)`,(2 regexp 4) >> 1 AS `(2 REGEXP 4) >> 1`
+select 2 REGEXP 4 >> 1, 2 REGEXP (4 >> 1), (2 REGEXP 4) >> 1 union select * from v1;
+2 REGEXP 4 >> 1 2 REGEXP (4 >> 1) (2 REGEXP 4) >> 1
+1 1 0
+create or replace view v1 as select 2 REGEXP '2000-01-01' +INTERVAL 1 DAY, 2 REGEXP ('2000-01-01' +INTERVAL 1 DAY), (2 REGEXP '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp '2000-01-01' + interval 1 day AS `2 REGEXP '2000-01-01' +INTERVAL 1 DAY`,2 regexp '2000-01-01' + interval 1 day AS `2 REGEXP ('2000-01-01' +INTERVAL 1 DAY)`,(2 regexp '2000-01-01') + interval 1 day AS `(2 REGEXP '2000-01-01') +INTERVAL 1 DAY`
+select 2 REGEXP '2000-01-01' +INTERVAL 1 DAY, 2 REGEXP ('2000-01-01' +INTERVAL 1 DAY), (2 REGEXP '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 REGEXP '2000-01-01' +INTERVAL 1 DAY 2 REGEXP ('2000-01-01' +INTERVAL 1 DAY) (2 REGEXP '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 REGEXP 3 + 3, 2 REGEXP (3 + 3), (2 REGEXP 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 + 3 AS `2 REGEXP 3 + 3`,2 regexp 3 + 3 AS `2 REGEXP (3 + 3)`,(2 regexp 3) + 3 AS `(2 REGEXP 3) + 3`
+select 2 REGEXP 3 + 3, 2 REGEXP (3 + 3), (2 REGEXP 3) + 3 union select * from v1;
+2 REGEXP 3 + 3 2 REGEXP (3 + 3) (2 REGEXP 3) + 3
+0 0 3
+create or replace view v1 as select 2 REGEXP 3 - 3, 2 REGEXP (3 - 3), (2 REGEXP 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 - 3 AS `2 REGEXP 3 - 3`,2 regexp 3 - 3 AS `2 REGEXP (3 - 3)`,(2 regexp 3) - 3 AS `(2 REGEXP 3) - 3`
+select 2 REGEXP 3 - 3, 2 REGEXP (3 - 3), (2 REGEXP 3) - 3 union select * from v1;
+2 REGEXP 3 - 3 2 REGEXP (3 - 3) (2 REGEXP 3) - 3
+0 0 -3
+create or replace view v1 as select 2 REGEXP 2 * 2, 2 REGEXP (2 * 2), (2 REGEXP 2) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 * 2 AS `2 REGEXP 2 * 2`,2 regexp 2 * 2 AS `2 REGEXP (2 * 2)`,(2 regexp 2) * 2 AS `(2 REGEXP 2) * 2`
+select 2 REGEXP 2 * 2, 2 REGEXP (2 * 2), (2 REGEXP 2) * 2 union select * from v1;
+2 REGEXP 2 * 2 2 REGEXP (2 * 2) (2 REGEXP 2) * 2
+0 0 2
+create or replace view v1 as select 2 REGEXP 2 / 2, 2 REGEXP (2 / 2), (2 REGEXP 2) / 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 / 2 AS `2 REGEXP 2 / 2`,2 regexp 2 / 2 AS `2 REGEXP (2 / 2)`,(2 regexp 2) / 2 AS `(2 REGEXP 2) / 2`
+select 2 REGEXP 2 / 2, 2 REGEXP (2 / 2), (2 REGEXP 2) / 2 union select * from v1;
+2 REGEXP 2 / 2 2 REGEXP (2 / 2) (2 REGEXP 2) / 2
+0 0 0.5000
+create or replace view v1 as select 2 REGEXP 4 DIV 2, 2 REGEXP (4 DIV 2), (2 REGEXP 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 4 DIV 2 AS `2 REGEXP 4 DIV 2`,2 regexp 4 DIV 2 AS `2 REGEXP (4 DIV 2)`,(2 regexp 4) DIV 2 AS `(2 REGEXP 4) DIV 2`
+select 2 REGEXP 4 DIV 2, 2 REGEXP (4 DIV 2), (2 REGEXP 4) DIV 2 union select * from v1;
+2 REGEXP 4 DIV 2 2 REGEXP (4 DIV 2) (2 REGEXP 4) DIV 2
+1 1 0
+create or replace view v1 as select 2 REGEXP 2 MOD 2, 2 REGEXP (2 MOD 2), (2 REGEXP 2) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 % 2 AS `2 REGEXP 2 MOD 2`,2 regexp 2 % 2 AS `2 REGEXP (2 MOD 2)`,(2 regexp 2) % 2 AS `(2 REGEXP 2) MOD 2`
+select 2 REGEXP 2 MOD 2, 2 REGEXP (2 MOD 2), (2 REGEXP 2) MOD 2 union select * from v1;
+2 REGEXP 2 MOD 2 2 REGEXP (2 MOD 2) (2 REGEXP 2) MOD 2
+0 0 1
+create or replace view v1 as select 2 REGEXP 2 % 2, 2 REGEXP (2 % 2), (2 REGEXP 2) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 % 2 AS `2 REGEXP 2 % 2`,2 regexp 2 % 2 AS `2 REGEXP (2 % 2)`,(2 regexp 2) % 2 AS `(2 REGEXP 2) % 2`
+select 2 REGEXP 2 % 2, 2 REGEXP (2 % 2), (2 REGEXP 2) % 2 union select * from v1;
+2 REGEXP 2 % 2 2 REGEXP (2 % 2) (2 REGEXP 2) % 2
+0 0 1
+create or replace view v1 as select 2 REGEXP 3 ^ 3, 2 REGEXP (3 ^ 3), (2 REGEXP 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 ^ 3 AS `2 REGEXP 3 ^ 3`,2 regexp 3 ^ 3 AS `2 REGEXP (3 ^ 3)`,(2 regexp 3) ^ 3 AS `(2 REGEXP 3) ^ 3`
+select 2 REGEXP 3 ^ 3, 2 REGEXP (3 ^ 3), (2 REGEXP 3) ^ 3 union select * from v1;
+2 REGEXP 3 ^ 3 2 REGEXP (3 ^ 3) (2 REGEXP 3) ^ 3
+0 0 3
+create or replace view v1 as select 2 REGEXP 2 BETWEEN 1 AND 3, 2 REGEXP (2 BETWEEN 1 AND 3), (2 REGEXP 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 2 between 1 and 3 AS `2 REGEXP 2 BETWEEN 1 AND 3`,2 regexp (2 between 1 and 3) AS `2 REGEXP (2 BETWEEN 1 AND 3)`,2 regexp 2 between 1 and 3 AS `(2 REGEXP 2) BETWEEN 1 AND 3`
+select 2 REGEXP 2 BETWEEN 1 AND 3, 2 REGEXP (2 BETWEEN 1 AND 3), (2 REGEXP 2) BETWEEN 1 AND 3 union select * from v1;
+2 REGEXP 2 BETWEEN 1 AND 3 2 REGEXP (2 BETWEEN 1 AND 3) (2 REGEXP 2) BETWEEN 1 AND 3
+1 0 1
+create or replace view v1 as select 2 | 3 IS FALSE, 2 | (3 IS FALSE), (2 | 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 is false AS `2 | 3 IS FALSE`,2 | (3 is false) AS `2 | (3 IS FALSE)`,2 | 3 is false AS `(2 | 3) IS FALSE`
+select 2 | 3 IS FALSE, 2 | (3 IS FALSE), (2 | 3) IS FALSE union select * from v1;
+2 | 3 IS FALSE 2 | (3 IS FALSE) (2 | 3) IS FALSE
+0 2 0
+create or replace view v1 as select charset(2 | 3 COLLATE latin1_bin), charset(2 | (3 COLLATE latin1_bin)), charset((2 | 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 | 3 collate latin1_bin) AS `charset(2 | 3 COLLATE latin1_bin)`,charset(2 | 3 collate latin1_bin) AS `charset(2 | (3 COLLATE latin1_bin))`,charset((2 | 3) collate latin1_bin) AS `charset((2 | 3) COLLATE latin1_bin)`
+select charset(2 | 3 COLLATE latin1_bin), charset(2 | (3 COLLATE latin1_bin)), charset((2 | 3) COLLATE latin1_bin) union select * from v1;
+charset(2 | 3 COLLATE latin1_bin) charset(2 | (3 COLLATE latin1_bin)) charset((2 | 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 | 3 IN (0,1), 2 | (3 IN (0,1)), (2 | 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 in (0,1) AS `2 | 3 IN (0,1)`,2 | (3 in (0,1)) AS `2 | (3 IN (0,1))`,2 | 3 in (0,1) AS `(2 | 3) IN (0,1)`
+select 2 | 3 IN (0,1), 2 | (3 IN (0,1)), (2 | 3) IN (0,1) union select * from v1;
+2 | 3 IN (0,1) 2 | (3 IN (0,1)) (2 | 3) IN (0,1)
+0 2 0
+create or replace view v1 as select 2 | 3 OR 3, 2 | (3 OR 3), (2 | 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 or 3 AS `2 | 3 OR 3`,2 | (3 or 3) AS `2 | (3 OR 3)`,2 | 3 or 3 AS `(2 | 3) OR 3`
+select 2 | 3 OR 3, 2 | (3 OR 3), (2 | 3) OR 3 union select * from v1;
+2 | 3 OR 3 2 | (3 OR 3) (2 | 3) OR 3
+1 3 1
+create or replace view v1 as select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 or 3 AS `2 | 3 || 3`,2 | (3 or 3) AS `2 | (3 || 3)`,2 | 3 or 3 AS `(2 | 3) || 3`
+select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3 union select * from v1;
+2 | 3 || 3 2 | (3 || 3) (2 | 3) || 3
+1 3 1
+create or replace view v1 as select 2 | 3 XOR 3, 2 | (3 XOR 3), (2 | 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 xor 3 AS `2 | 3 XOR 3`,2 | (3 xor 3) AS `2 | (3 XOR 3)`,2 | 3 xor 3 AS `(2 | 3) XOR 3`
+select 2 | 3 XOR 3, 2 | (3 XOR 3), (2 | 3) XOR 3 union select * from v1;
+2 | 3 XOR 3 2 | (3 XOR 3) (2 | 3) XOR 3
+0 2 0
+create or replace view v1 as select 2 | 3 AND 3, 2 | (3 AND 3), (2 | 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 and 3 AS `2 | 3 AND 3`,2 | (3 and 3) AS `2 | (3 AND 3)`,2 | 3 and 3 AS `(2 | 3) AND 3`
+select 2 | 3 AND 3, 2 | (3 AND 3), (2 | 3) AND 3 union select * from v1;
+2 | 3 AND 3 2 | (3 AND 3) (2 | 3) AND 3
+1 3 1
+create or replace view v1 as select 2 | 3 && 3, 2 | (3 && 3), (2 | 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 and 3 AS `2 | 3 && 3`,2 | (3 and 3) AS `2 | (3 && 3)`,2 | 3 and 3 AS `(2 | 3) && 3`
+select 2 | 3 && 3, 2 | (3 && 3), (2 | 3) && 3 union select * from v1;
+2 | 3 && 3 2 | (3 && 3) (2 | 3) && 3
+1 3 1
+create or replace view v1 as select 2 | 3 = 3, 2 | (3 = 3), (2 | 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 = 3 AS `2 | 3 = 3`,2 | (3 = 3) AS `2 | (3 = 3)`,2 | 3 = 3 AS `(2 | 3) = 3`
+select 2 | 3 = 3, 2 | (3 = 3), (2 | 3) = 3 union select * from v1;
+2 | 3 = 3 2 | (3 = 3) (2 | 3) = 3
+1 3 1
+create or replace view v1 as select 2 | 3 <=> 3, 2 | (3 <=> 3), (2 | 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 <=> 3 AS `2 | 3 <=> 3`,2 | (3 <=> 3) AS `2 | (3 <=> 3)`,2 | 3 <=> 3 AS `(2 | 3) <=> 3`
+select 2 | 3 <=> 3, 2 | (3 <=> 3), (2 | 3) <=> 3 union select * from v1;
+2 | 3 <=> 3 2 | (3 <=> 3) (2 | 3) <=> 3
+1 3 1
+create or replace view v1 as select 2 | 3 >= 3, 2 | (3 >= 3), (2 | 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 >= 3 AS `2 | 3 >= 3`,2 | (3 >= 3) AS `2 | (3 >= 3)`,2 | 3 >= 3 AS `(2 | 3) >= 3`
+select 2 | 3 >= 3, 2 | (3 >= 3), (2 | 3) >= 3 union select * from v1;
+2 | 3 >= 3 2 | (3 >= 3) (2 | 3) >= 3
+1 3 1
+create or replace view v1 as select 2 | 3 <= 3, 2 | (3 <= 3), (2 | 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 <= 3 AS `2 | 3 <= 3`,2 | (3 <= 3) AS `2 | (3 <= 3)`,2 | 3 <= 3 AS `(2 | 3) <= 3`
+select 2 | 3 <= 3, 2 | (3 <= 3), (2 | 3) <= 3 union select * from v1;
+2 | 3 <= 3 2 | (3 <= 3) (2 | 3) <= 3
+1 3 1
+create or replace view v1 as select 2 | 3 < 3, 2 | (3 < 3), (2 | 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 < 3 AS `2 | 3 < 3`,2 | (3 < 3) AS `2 | (3 < 3)`,2 | 3 < 3 AS `(2 | 3) < 3`
+select 2 | 3 < 3, 2 | (3 < 3), (2 | 3) < 3 union select * from v1;
+2 | 3 < 3 2 | (3 < 3) (2 | 3) < 3
+0 2 0
+create or replace view v1 as select 2 | 3 <> 3, 2 | (3 <> 3), (2 | 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 <> 3 AS `2 | 3 <> 3`,2 | (3 <> 3) AS `2 | (3 <> 3)`,2 | 3 <> 3 AS `(2 | 3) <> 3`
+select 2 | 3 <> 3, 2 | (3 <> 3), (2 | 3) <> 3 union select * from v1;
+2 | 3 <> 3 2 | (3 <> 3) (2 | 3) <> 3
+0 2 0
+create or replace view v1 as select 2 | 3 > 3, 2 | (3 > 3), (2 | 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 > 3 AS `2 | 3 > 3`,2 | (3 > 3) AS `2 | (3 > 3)`,2 | 3 > 3 AS `(2 | 3) > 3`
+select 2 | 3 > 3, 2 | (3 > 3), (2 | 3) > 3 union select * from v1;
+2 | 3 > 3 2 | (3 > 3) (2 | 3) > 3
+0 2 0
+create or replace view v1 as select 2 | 3 != 3, 2 | (3 != 3), (2 | 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 <> 3 AS `2 | 3 != 3`,2 | (3 <> 3) AS `2 | (3 != 3)`,2 | 3 <> 3 AS `(2 | 3) != 3`
+select 2 | 3 != 3, 2 | (3 != 3), (2 | 3) != 3 union select * from v1;
+2 | 3 != 3 2 | (3 != 3) (2 | 3) != 3
+0 2 0
+create or replace view v1 as select 2 | 3 LIKE 3, 2 | (3 LIKE 3), (2 | 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 like 3 AS `2 | 3 LIKE 3`,2 | (3 like 3) AS `2 | (3 LIKE 3)`,2 | 3 like 3 AS `(2 | 3) LIKE 3`
+select 2 | 3 LIKE 3, 2 | (3 LIKE 3), (2 | 3) LIKE 3 union select * from v1;
+2 | 3 LIKE 3 2 | (3 LIKE 3) (2 | 3) LIKE 3
+1 3 1
+create or replace view v1 as select 2 | 3 REGEXP 3, 2 | (3 REGEXP 3), (2 | 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 regexp 3 AS `2 | 3 REGEXP 3`,2 | (3 regexp 3) AS `2 | (3 REGEXP 3)`,2 | 3 regexp 3 AS `(2 | 3) REGEXP 3`
+select 2 | 3 REGEXP 3, 2 | (3 REGEXP 3), (2 | 3) REGEXP 3 union select * from v1;
+2 | 3 REGEXP 3 2 | (3 REGEXP 3) (2 | 3) REGEXP 3
+1 3 1
+create or replace view v1 as select 2 | 0 & 0, 2 | (0 & 0), (2 | 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 0 & 0 AS `2 | 0 & 0`,2 | 0 & 0 AS `2 | (0 & 0)`,(2 | 0) & 0 AS `(2 | 0) & 0`
+select 2 | 0 & 0, 2 | (0 & 0), (2 | 0) & 0 union select * from v1;
+2 | 0 & 0 2 | (0 & 0) (2 | 0) & 0
+2 2 0
+create or replace view v1 as select 2 | 3 << 3, 2 | (3 << 3), (2 | 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 << 3 AS `2 | 3 << 3`,2 | 3 << 3 AS `2 | (3 << 3)`,(2 | 3) << 3 AS `(2 | 3) << 3`
+select 2 | 3 << 3, 2 | (3 << 3), (2 | 3) << 3 union select * from v1;
+2 | 3 << 3 2 | (3 << 3) (2 | 3) << 3
+26 26 24
+create or replace view v1 as select 2 | 3 >> 3, 2 | (3 >> 3), (2 | 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 >> 3 AS `2 | 3 >> 3`,2 | 3 >> 3 AS `2 | (3 >> 3)`,(2 | 3) >> 3 AS `(2 | 3) >> 3`
+select 2 | 3 >> 3, 2 | (3 >> 3), (2 | 3) >> 3 union select * from v1;
+2 | 3 >> 3 2 | (3 >> 3) (2 | 3) >> 3
+2 2 0
+create or replace view v1 as select 2 | '2000-01-01' +INTERVAL 1 DAY, 2 | ('2000-01-01' +INTERVAL 1 DAY), (2 | '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | '2000-01-01' + interval 1 day AS `2 | '2000-01-01' +INTERVAL 1 DAY`,2 | '2000-01-01' + interval 1 day AS `2 | ('2000-01-01' +INTERVAL 1 DAY)`,(2 | '2000-01-01') + interval 1 day AS `(2 | '2000-01-01') +INTERVAL 1 DAY`
+select 2 | '2000-01-01' +INTERVAL 1 DAY, 2 | ('2000-01-01' +INTERVAL 1 DAY), (2 | '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 | '2000-01-01' +INTERVAL 1 DAY 2 | ('2000-01-01' +INTERVAL 1 DAY) (2 | '2000-01-01') +INTERVAL 1 DAY
+20000102 20000102 NULL
+create or replace view v1 as select 2 | 1 + 1, 2 | (1 + 1), (2 | 1) + 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 1 + 1 AS `2 | 1 + 1`,2 | 1 + 1 AS `2 | (1 + 1)`,(2 | 1) + 1 AS `(2 | 1) + 1`
+select 2 | 1 + 1, 2 | (1 + 1), (2 | 1) + 1 union select * from v1;
+2 | 1 + 1 2 | (1 + 1) (2 | 1) + 1
+2 2 4
+create or replace view v1 as select 2 | 3 - 3, 2 | (3 - 3), (2 | 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 - 3 AS `2 | 3 - 3`,2 | 3 - 3 AS `2 | (3 - 3)`,(2 | 3) - 3 AS `(2 | 3) - 3`
+select 2 | 3 - 3, 2 | (3 - 3), (2 | 3) - 3 union select * from v1;
+2 | 3 - 3 2 | (3 - 3) (2 | 3) - 3
+2 2 0
+create or replace view v1 as select 2 | 3 * 3, 2 | (3 * 3), (2 | 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 * 3 AS `2 | 3 * 3`,2 | 3 * 3 AS `2 | (3 * 3)`,(2 | 3) * 3 AS `(2 | 3) * 3`
+select 2 | 3 * 3, 2 | (3 * 3), (2 | 3) * 3 union select * from v1;
+2 | 3 * 3 2 | (3 * 3) (2 | 3) * 3
+11 11 9
+create or replace view v1 as select 2 | 3 / 3, 2 | (3 / 3), (2 | 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 / 3 AS `2 | 3 / 3`,2 | 3 / 3 AS `2 | (3 / 3)`,(2 | 3) / 3 AS `(2 | 3) / 3`
+select 2 | 3 / 3, 2 | (3 / 3), (2 | 3) / 3 union select * from v1;
+2 | 3 / 3 2 | (3 / 3) (2 | 3) / 3
+3 3 1.0000
+create or replace view v1 as select 2 | 3 DIV 3, 2 | (3 DIV 3), (2 | 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 DIV 3 AS `2 | 3 DIV 3`,2 | 3 DIV 3 AS `2 | (3 DIV 3)`,(2 | 3) DIV 3 AS `(2 | 3) DIV 3`
+select 2 | 3 DIV 3, 2 | (3 DIV 3), (2 | 3) DIV 3 union select * from v1;
+2 | 3 DIV 3 2 | (3 DIV 3) (2 | 3) DIV 3
+3 3 1
+create or replace view v1 as select 2 | 3 MOD 3, 2 | (3 MOD 3), (2 | 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 % 3 AS `2 | 3 MOD 3`,2 | 3 % 3 AS `2 | (3 MOD 3)`,(2 | 3) % 3 AS `(2 | 3) MOD 3`
+select 2 | 3 MOD 3, 2 | (3 MOD 3), (2 | 3) MOD 3 union select * from v1;
+2 | 3 MOD 3 2 | (3 MOD 3) (2 | 3) MOD 3
+2 2 0
+create or replace view v1 as select 2 | 3 % 3, 2 | (3 % 3), (2 | 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 % 3 AS `2 | 3 % 3`,2 | 3 % 3 AS `2 | (3 % 3)`,(2 | 3) % 3 AS `(2 | 3) % 3`
+select 2 | 3 % 3, 2 | (3 % 3), (2 | 3) % 3 union select * from v1;
+2 | 3 % 3 2 | (3 % 3) (2 | 3) % 3
+2 2 0
+create or replace view v1 as select 2 | 3 ^ 3, 2 | (3 ^ 3), (2 | 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 ^ 3 AS `2 | 3 ^ 3`,2 | 3 ^ 3 AS `2 | (3 ^ 3)`,(2 | 3) ^ 3 AS `(2 | 3) ^ 3`
+select 2 | 3 ^ 3, 2 | (3 ^ 3), (2 | 3) ^ 3 union select * from v1;
+2 | 3 ^ 3 2 | (3 ^ 3) (2 | 3) ^ 3
+2 2 0
+create or replace view v1 as select 2 | 3 BETWEEN 1 AND 3, 2 | (3 BETWEEN 1 AND 3), (2 | 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 between 1 and 3 AS `2 | 3 BETWEEN 1 AND 3`,2 | (3 between 1 and 3) AS `2 | (3 BETWEEN 1 AND 3)`,2 | 3 between 1 and 3 AS `(2 | 3) BETWEEN 1 AND 3`
+select 2 | 3 BETWEEN 1 AND 3, 2 | (3 BETWEEN 1 AND 3), (2 | 3) BETWEEN 1 AND 3 union select * from v1;
+2 | 3 BETWEEN 1 AND 3 2 | (3 BETWEEN 1 AND 3) (2 | 3) BETWEEN 1 AND 3
+1 3 1
+create or replace view v1 as select 2 & 1 IS FALSE, 2 & (1 IS FALSE), (2 & 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 1 is false AS `2 & 1 IS FALSE`,2 & (1 is false) AS `2 & (1 IS FALSE)`,2 & 1 is false AS `(2 & 1) IS FALSE`
+select 2 & 1 IS FALSE, 2 & (1 IS FALSE), (2 & 1) IS FALSE union select * from v1;
+2 & 1 IS FALSE 2 & (1 IS FALSE) (2 & 1) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 & 3 COLLATE latin1_bin), charset(2 & (3 COLLATE latin1_bin)), charset((2 & 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 & 3 collate latin1_bin) AS `charset(2 & 3 COLLATE latin1_bin)`,charset(2 & 3 collate latin1_bin) AS `charset(2 & (3 COLLATE latin1_bin))`,charset((2 & 3) collate latin1_bin) AS `charset((2 & 3) COLLATE latin1_bin)`
+select charset(2 & 3 COLLATE latin1_bin), charset(2 & (3 COLLATE latin1_bin)), charset((2 & 3) COLLATE latin1_bin) union select * from v1;
+charset(2 & 3 COLLATE latin1_bin) charset(2 & (3 COLLATE latin1_bin)) charset((2 & 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 & 4 IN (0,1), 2 & (4 IN (0,1)), (2 & 4) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 4 in (0,1) AS `2 & 4 IN (0,1)`,2 & (4 in (0,1)) AS `2 & (4 IN (0,1))`,2 & 4 in (0,1) AS `(2 & 4) IN (0,1)`
+select 2 & 4 IN (0,1), 2 & (4 IN (0,1)), (2 & 4) IN (0,1) union select * from v1;
+2 & 4 IN (0,1) 2 & (4 IN (0,1)) (2 & 4) IN (0,1)
+1 0 1
+create or replace view v1 as select 2 & 3 OR 3, 2 & (3 OR 3), (2 & 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 or 3 AS `2 & 3 OR 3`,2 & (3 or 3) AS `2 & (3 OR 3)`,2 & 3 or 3 AS `(2 & 3) OR 3`
+select 2 & 3 OR 3, 2 & (3 OR 3), (2 & 3) OR 3 union select * from v1;
+2 & 3 OR 3 2 & (3 OR 3) (2 & 3) OR 3
+1 0 1
+create or replace view v1 as select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 or 3 AS `2 & 3 || 3`,2 & (3 or 3) AS `2 & (3 || 3)`,2 & 3 or 3 AS `(2 & 3) || 3`
+select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3 union select * from v1;
+2 & 3 || 3 2 & (3 || 3) (2 & 3) || 3
+1 0 1
+create or replace view v1 as select 2 & 1 XOR 1, 2 & (1 XOR 1), (2 & 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 1 xor 1 AS `2 & 1 XOR 1`,2 & (1 xor 1) AS `2 & (1 XOR 1)`,2 & 1 xor 1 AS `(2 & 1) XOR 1`
+select 2 & 1 XOR 1, 2 & (1 XOR 1), (2 & 1) XOR 1 union select * from v1;
+2 & 1 XOR 1 2 & (1 XOR 1) (2 & 1) XOR 1
+1 0 1
+create or replace view v1 as select 2 & 3 AND 3, 2 & (3 AND 3), (2 & 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 and 3 AS `2 & 3 AND 3`,2 & (3 and 3) AS `2 & (3 AND 3)`,2 & 3 and 3 AS `(2 & 3) AND 3`
+select 2 & 3 AND 3, 2 & (3 AND 3), (2 & 3) AND 3 union select * from v1;
+2 & 3 AND 3 2 & (3 AND 3) (2 & 3) AND 3
+1 0 1
+create or replace view v1 as select 2 & 3 && 3, 2 & (3 && 3), (2 & 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 and 3 AS `2 & 3 && 3`,2 & (3 and 3) AS `2 & (3 && 3)`,2 & 3 and 3 AS `(2 & 3) && 3`
+select 2 & 3 && 3, 2 & (3 && 3), (2 & 3) && 3 union select * from v1;
+2 & 3 && 3 2 & (3 && 3) (2 & 3) && 3
+1 0 1
+create or replace view v1 as select 2 & 3 = 2, 2 & (3 = 2), (2 & 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 = 2 AS `2 & 3 = 2`,2 & (3 = 2) AS `2 & (3 = 2)`,2 & 3 = 2 AS `(2 & 3) = 2`
+select 2 & 3 = 2, 2 & (3 = 2), (2 & 3) = 2 union select * from v1;
+2 & 3 = 2 2 & (3 = 2) (2 & 3) = 2
+1 0 1
+create or replace view v1 as select 2 & 3 <=> 2, 2 & (3 <=> 2), (2 & 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 <=> 2 AS `2 & 3 <=> 2`,2 & (3 <=> 2) AS `2 & (3 <=> 2)`,2 & 3 <=> 2 AS `(2 & 3) <=> 2`
+select 2 & 3 <=> 2, 2 & (3 <=> 2), (2 & 3) <=> 2 union select * from v1;
+2 & 3 <=> 2 2 & (3 <=> 2) (2 & 3) <=> 2
+1 0 1
+create or replace view v1 as select 2 & 3 >= 2, 2 & (3 >= 2), (2 & 3) >= 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 >= 2 AS `2 & 3 >= 2`,2 & (3 >= 2) AS `2 & (3 >= 2)`,2 & 3 >= 2 AS `(2 & 3) >= 2`
+select 2 & 3 >= 2, 2 & (3 >= 2), (2 & 3) >= 2 union select * from v1;
+2 & 3 >= 2 2 & (3 >= 2) (2 & 3) >= 2
+1 0 1
+create or replace view v1 as select 2 & 3 <= 3, 2 & (3 <= 3), (2 & 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 <= 3 AS `2 & 3 <= 3`,2 & (3 <= 3) AS `2 & (3 <= 3)`,2 & 3 <= 3 AS `(2 & 3) <= 3`
+select 2 & 3 <= 3, 2 & (3 <= 3), (2 & 3) <= 3 union select * from v1;
+2 & 3 <= 3 2 & (3 <= 3) (2 & 3) <= 3
+1 0 1
+create or replace view v1 as select 2 & 3 < 3, 2 & (3 < 3), (2 & 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 < 3 AS `2 & 3 < 3`,2 & (3 < 3) AS `2 & (3 < 3)`,2 & 3 < 3 AS `(2 & 3) < 3`
+select 2 & 3 < 3, 2 & (3 < 3), (2 & 3) < 3 union select * from v1;
+2 & 3 < 3 2 & (3 < 3) (2 & 3) < 3
+1 0 1
+create or replace view v1 as select 2 & 3 <> 3, 2 & (3 <> 3), (2 & 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 <> 3 AS `2 & 3 <> 3`,2 & (3 <> 3) AS `2 & (3 <> 3)`,2 & 3 <> 3 AS `(2 & 3) <> 3`
+select 2 & 3 <> 3, 2 & (3 <> 3), (2 & 3) <> 3 union select * from v1;
+2 & 3 <> 3 2 & (3 <> 3) (2 & 3) <> 3
+1 0 1
+create or replace view v1 as select 2 & 3 > 1, 2 & (3 > 1), (2 & 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 > 1 AS `2 & 3 > 1`,2 & (3 > 1) AS `2 & (3 > 1)`,2 & 3 > 1 AS `(2 & 3) > 1`
+select 2 & 3 > 1, 2 & (3 > 1), (2 & 3) > 1 union select * from v1;
+2 & 3 > 1 2 & (3 > 1) (2 & 3) > 1
+1 0 1
+create or replace view v1 as select 2 & 3 != 3, 2 & (3 != 3), (2 & 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 <> 3 AS `2 & 3 != 3`,2 & (3 <> 3) AS `2 & (3 != 3)`,2 & 3 <> 3 AS `(2 & 3) != 3`
+select 2 & 3 != 3, 2 & (3 != 3), (2 & 3) != 3 union select * from v1;
+2 & 3 != 3 2 & (3 != 3) (2 & 3) != 3
+1 0 1
+create or replace view v1 as select 2 & 3 LIKE 2, 2 & (3 LIKE 2), (2 & 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 like 2 AS `2 & 3 LIKE 2`,2 & (3 like 2) AS `2 & (3 LIKE 2)`,2 & 3 like 2 AS `(2 & 3) LIKE 2`
+select 2 & 3 LIKE 2, 2 & (3 LIKE 2), (2 & 3) LIKE 2 union select * from v1;
+2 & 3 LIKE 2 2 & (3 LIKE 2) (2 & 3) LIKE 2
+1 0 1
+create or replace view v1 as select 2 & 3 REGEXP 2, 2 & (3 REGEXP 2), (2 & 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 regexp 2 AS `2 & 3 REGEXP 2`,2 & (3 regexp 2) AS `2 & (3 REGEXP 2)`,2 & 3 regexp 2 AS `(2 & 3) REGEXP 2`
+select 2 & 3 REGEXP 2, 2 & (3 REGEXP 2), (2 & 3) REGEXP 2 union select * from v1;
+2 & 3 REGEXP 2 2 & (3 REGEXP 2) (2 & 3) REGEXP 2
+1 0 1
+create or replace view v1 as select 2 & 3 | 3, 2 & (3 | 3), (2 & 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 | 3 AS `2 & 3 | 3`,2 & (3 | 3) AS `2 & (3 | 3)`,2 & 3 | 3 AS `(2 & 3) | 3`
+select 2 & 3 | 3, 2 & (3 | 3), (2 & 3) | 3 union select * from v1;
+2 & 3 | 3 2 & (3 | 3) (2 & 3) | 3
+3 2 3
+create or replace view v1 as select 2 & 3 << 3, 2 & (3 << 3), (2 & 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 << 3 AS `2 & 3 << 3`,2 & 3 << 3 AS `2 & (3 << 3)`,(2 & 3) << 3 AS `(2 & 3) << 3`
+select 2 & 3 << 3, 2 & (3 << 3), (2 & 3) << 3 union select * from v1;
+2 & 3 << 3 2 & (3 << 3) (2 & 3) << 3
+0 0 16
+create or replace view v1 as select 2 & 3 >> 1, 2 & (3 >> 1), (2 & 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 >> 1 AS `2 & 3 >> 1`,2 & 3 >> 1 AS `2 & (3 >> 1)`,(2 & 3) >> 1 AS `(2 & 3) >> 1`
+select 2 & 3 >> 1, 2 & (3 >> 1), (2 & 3) >> 1 union select * from v1;
+2 & 3 >> 1 2 & (3 >> 1) (2 & 3) >> 1
+0 0 1
+create or replace view v1 as select 2 & '2000-01-01' +INTERVAL 1 DAY, 2 & ('2000-01-01' +INTERVAL 1 DAY), (2 & '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & '2000-01-01' + interval 1 day AS `2 & '2000-01-01' +INTERVAL 1 DAY`,2 & '2000-01-01' + interval 1 day AS `2 & ('2000-01-01' +INTERVAL 1 DAY)`,(2 & '2000-01-01') + interval 1 day AS `(2 & '2000-01-01') +INTERVAL 1 DAY`
+select 2 & '2000-01-01' +INTERVAL 1 DAY, 2 & ('2000-01-01' +INTERVAL 1 DAY), (2 & '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 & '2000-01-01' +INTERVAL 1 DAY 2 & ('2000-01-01' +INTERVAL 1 DAY) (2 & '2000-01-01') +INTERVAL 1 DAY
+2 2 NULL
+create or replace view v1 as select 2 & 3 + 3, 2 & (3 + 3), (2 & 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 + 3 AS `2 & 3 + 3`,2 & 3 + 3 AS `2 & (3 + 3)`,(2 & 3) + 3 AS `(2 & 3) + 3`
+select 2 & 3 + 3, 2 & (3 + 3), (2 & 3) + 3 union select * from v1;
+2 & 3 + 3 2 & (3 + 3) (2 & 3) + 3
+2 2 5
+create or replace view v1 as select 6 & 4 - 3, 6 & (4 - 3), (6 & 4) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 6 & 4 - 3 AS `6 & 4 - 3`,6 & 4 - 3 AS `6 & (4 - 3)`,(6 & 4) - 3 AS `(6 & 4) - 3`
+select 6 & 4 - 3, 6 & (4 - 3), (6 & 4) - 3 union select * from v1;
+6 & 4 - 3 6 & (4 - 3) (6 & 4) - 3
+0 0 1
+create or replace view v1 as select 2 & 3 * 3, 2 & (3 * 3), (2 & 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 * 3 AS `2 & 3 * 3`,2 & 3 * 3 AS `2 & (3 * 3)`,(2 & 3) * 3 AS `(2 & 3) * 3`
+select 2 & 3 * 3, 2 & (3 * 3), (2 & 3) * 3 union select * from v1;
+2 & 3 * 3 2 & (3 * 3) (2 & 3) * 3
+0 0 6
+create or replace view v1 as select 2 & 3 / 3, 2 & (3 / 3), (2 & 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 / 3 AS `2 & 3 / 3`,2 & 3 / 3 AS `2 & (3 / 3)`,(2 & 3) / 3 AS `(2 & 3) / 3`
+select 2 & 3 / 3, 2 & (3 / 3), (2 & 3) / 3 union select * from v1;
+2 & 3 / 3 2 & (3 / 3) (2 & 3) / 3
+0 0 0.6667
+create or replace view v1 as select 2 & 3 DIV 2, 2 & (3 DIV 2), (2 & 3) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 DIV 2 AS `2 & 3 DIV 2`,2 & 3 DIV 2 AS `2 & (3 DIV 2)`,(2 & 3) DIV 2 AS `(2 & 3) DIV 2`
+select 2 & 3 DIV 2, 2 & (3 DIV 2), (2 & 3) DIV 2 union select * from v1;
+2 & 3 DIV 2 2 & (3 DIV 2) (2 & 3) DIV 2
+0 0 1
+create or replace view v1 as select 2 & 3 MOD 3, 2 & (3 MOD 3), (2 & 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 % 3 AS `2 & 3 MOD 3`,2 & 3 % 3 AS `2 & (3 MOD 3)`,(2 & 3) % 3 AS `(2 & 3) MOD 3`
+select 2 & 3 MOD 3, 2 & (3 MOD 3), (2 & 3) MOD 3 union select * from v1;
+2 & 3 MOD 3 2 & (3 MOD 3) (2 & 3) MOD 3
+0 0 2
+create or replace view v1 as select 2 & 3 % 3, 2 & (3 % 3), (2 & 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 % 3 AS `2 & 3 % 3`,2 & 3 % 3 AS `2 & (3 % 3)`,(2 & 3) % 3 AS `(2 & 3) % 3`
+select 2 & 3 % 3, 2 & (3 % 3), (2 & 3) % 3 union select * from v1;
+2 & 3 % 3 2 & (3 % 3) (2 & 3) % 3
+0 0 2
+create or replace view v1 as select 2 & 3 ^ 3, 2 & (3 ^ 3), (2 & 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 ^ 3 AS `2 & 3 ^ 3`,2 & 3 ^ 3 AS `2 & (3 ^ 3)`,(2 & 3) ^ 3 AS `(2 & 3) ^ 3`
+select 2 & 3 ^ 3, 2 & (3 ^ 3), (2 & 3) ^ 3 union select * from v1;
+2 & 3 ^ 3 2 & (3 ^ 3) (2 & 3) ^ 3
+0 0 1
+create or replace view v1 as select 2 & 3 BETWEEN 1 AND 3, 2 & (3 BETWEEN 1 AND 3), (2 & 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 3 between 1 and 3 AS `2 & 3 BETWEEN 1 AND 3`,2 & (3 between 1 and 3) AS `2 & (3 BETWEEN 1 AND 3)`,2 & 3 between 1 and 3 AS `(2 & 3) BETWEEN 1 AND 3`
+select 2 & 3 BETWEEN 1 AND 3, 2 & (3 BETWEEN 1 AND 3), (2 & 3) BETWEEN 1 AND 3 union select * from v1;
+2 & 3 BETWEEN 1 AND 3 2 & (3 BETWEEN 1 AND 3) (2 & 3) BETWEEN 1 AND 3
+1 0 1
+create or replace view v1 as select 2 << 3 IS FALSE, 2 << (3 IS FALSE), (2 << 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 is false AS `2 << 3 IS FALSE`,2 << (3 is false) AS `2 << (3 IS FALSE)`,2 << 3 is false AS `(2 << 3) IS FALSE`
+select 2 << 3 IS FALSE, 2 << (3 IS FALSE), (2 << 3) IS FALSE union select * from v1;
+2 << 3 IS FALSE 2 << (3 IS FALSE) (2 << 3) IS FALSE
+0 2 0
+create or replace view v1 as select charset(2 << 3 COLLATE latin1_bin), charset(2 << (3 COLLATE latin1_bin)), charset((2 << 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 << 3 collate latin1_bin) AS `charset(2 << 3 COLLATE latin1_bin)`,charset(2 << 3 collate latin1_bin) AS `charset(2 << (3 COLLATE latin1_bin))`,charset((2 << 3) collate latin1_bin) AS `charset((2 << 3) COLLATE latin1_bin)`
+select charset(2 << 3 COLLATE latin1_bin), charset(2 << (3 COLLATE latin1_bin)), charset((2 << 3) COLLATE latin1_bin) union select * from v1;
+charset(2 << 3 COLLATE latin1_bin) charset(2 << (3 COLLATE latin1_bin)) charset((2 << 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 << 3 IN (0,1), 2 << (3 IN (0,1)), (2 << 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 in (0,1) AS `2 << 3 IN (0,1)`,2 << (3 in (0,1)) AS `2 << (3 IN (0,1))`,2 << 3 in (0,1) AS `(2 << 3) IN (0,1)`
+select 2 << 3 IN (0,1), 2 << (3 IN (0,1)), (2 << 3) IN (0,1) union select * from v1;
+2 << 3 IN (0,1) 2 << (3 IN (0,1)) (2 << 3) IN (0,1)
+0 2 0
+create or replace view v1 as select 2 << 3 OR 3, 2 << (3 OR 3), (2 << 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 or 3 AS `2 << 3 OR 3`,2 << (3 or 3) AS `2 << (3 OR 3)`,2 << 3 or 3 AS `(2 << 3) OR 3`
+select 2 << 3 OR 3, 2 << (3 OR 3), (2 << 3) OR 3 union select * from v1;
+2 << 3 OR 3 2 << (3 OR 3) (2 << 3) OR 3
+1 4 1
+create or replace view v1 as select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 or 3 AS `2 << 3 || 3`,2 << (3 or 3) AS `2 << (3 || 3)`,2 << 3 or 3 AS `(2 << 3) || 3`
+select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3 union select * from v1;
+2 << 3 || 3 2 << (3 || 3) (2 << 3) || 3
+1 4 1
+create or replace view v1 as select 2 << 3 XOR 3, 2 << (3 XOR 3), (2 << 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 xor 3 AS `2 << 3 XOR 3`,2 << (3 xor 3) AS `2 << (3 XOR 3)`,2 << 3 xor 3 AS `(2 << 3) XOR 3`
+select 2 << 3 XOR 3, 2 << (3 XOR 3), (2 << 3) XOR 3 union select * from v1;
+2 << 3 XOR 3 2 << (3 XOR 3) (2 << 3) XOR 3
+0 2 0
+create or replace view v1 as select 2 << 3 AND 3, 2 << (3 AND 3), (2 << 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 and 3 AS `2 << 3 AND 3`,2 << (3 and 3) AS `2 << (3 AND 3)`,2 << 3 and 3 AS `(2 << 3) AND 3`
+select 2 << 3 AND 3, 2 << (3 AND 3), (2 << 3) AND 3 union select * from v1;
+2 << 3 AND 3 2 << (3 AND 3) (2 << 3) AND 3
+1 4 1
+create or replace view v1 as select 2 << 3 && 3, 2 << (3 && 3), (2 << 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 and 3 AS `2 << 3 && 3`,2 << (3 and 3) AS `2 << (3 && 3)`,2 << 3 and 3 AS `(2 << 3) && 3`
+select 2 << 3 && 3, 2 << (3 && 3), (2 << 3) && 3 union select * from v1;
+2 << 3 && 3 2 << (3 && 3) (2 << 3) && 3
+1 4 1
+create or replace view v1 as select 2 << 3 = 3, 2 << (3 = 3), (2 << 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 = 3 AS `2 << 3 = 3`,2 << (3 = 3) AS `2 << (3 = 3)`,2 << 3 = 3 AS `(2 << 3) = 3`
+select 2 << 3 = 3, 2 << (3 = 3), (2 << 3) = 3 union select * from v1;
+2 << 3 = 3 2 << (3 = 3) (2 << 3) = 3
+0 4 0
+create or replace view v1 as select 2 << 3 <=> 3, 2 << (3 <=> 3), (2 << 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 <=> 3 AS `2 << 3 <=> 3`,2 << (3 <=> 3) AS `2 << (3 <=> 3)`,2 << 3 <=> 3 AS `(2 << 3) <=> 3`
+select 2 << 3 <=> 3, 2 << (3 <=> 3), (2 << 3) <=> 3 union select * from v1;
+2 << 3 <=> 3 2 << (3 <=> 3) (2 << 3) <=> 3
+0 4 0
+create or replace view v1 as select 2 << 3 >= 3, 2 << (3 >= 3), (2 << 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 >= 3 AS `2 << 3 >= 3`,2 << (3 >= 3) AS `2 << (3 >= 3)`,2 << 3 >= 3 AS `(2 << 3) >= 3`
+select 2 << 3 >= 3, 2 << (3 >= 3), (2 << 3) >= 3 union select * from v1;
+2 << 3 >= 3 2 << (3 >= 3) (2 << 3) >= 3
+1 4 1
+create or replace view v1 as select 2 << 3 <= 3, 2 << (3 <= 3), (2 << 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 <= 3 AS `2 << 3 <= 3`,2 << (3 <= 3) AS `2 << (3 <= 3)`,2 << 3 <= 3 AS `(2 << 3) <= 3`
+select 2 << 3 <= 3, 2 << (3 <= 3), (2 << 3) <= 3 union select * from v1;
+2 << 3 <= 3 2 << (3 <= 3) (2 << 3) <= 3
+0 4 0
+create or replace view v1 as select 2 << 3 < 3, 2 << (3 < 3), (2 << 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 < 3 AS `2 << 3 < 3`,2 << (3 < 3) AS `2 << (3 < 3)`,2 << 3 < 3 AS `(2 << 3) < 3`
+select 2 << 3 < 3, 2 << (3 < 3), (2 << 3) < 3 union select * from v1;
+2 << 3 < 3 2 << (3 < 3) (2 << 3) < 3
+0 2 0
+create or replace view v1 as select 2 << 3 <> 3, 2 << (3 <> 3), (2 << 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 <> 3 AS `2 << 3 <> 3`,2 << (3 <> 3) AS `2 << (3 <> 3)`,2 << 3 <> 3 AS `(2 << 3) <> 3`
+select 2 << 3 <> 3, 2 << (3 <> 3), (2 << 3) <> 3 union select * from v1;
+2 << 3 <> 3 2 << (3 <> 3) (2 << 3) <> 3
+1 2 1
+create or replace view v1 as select 2 << 3 > 3, 2 << (3 > 3), (2 << 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 > 3 AS `2 << 3 > 3`,2 << (3 > 3) AS `2 << (3 > 3)`,2 << 3 > 3 AS `(2 << 3) > 3`
+select 2 << 3 > 3, 2 << (3 > 3), (2 << 3) > 3 union select * from v1;
+2 << 3 > 3 2 << (3 > 3) (2 << 3) > 3
+1 2 1
+create or replace view v1 as select 2 << 3 != 3, 2 << (3 != 3), (2 << 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 <> 3 AS `2 << 3 != 3`,2 << (3 <> 3) AS `2 << (3 != 3)`,2 << 3 <> 3 AS `(2 << 3) != 3`
+select 2 << 3 != 3, 2 << (3 != 3), (2 << 3) != 3 union select * from v1;
+2 << 3 != 3 2 << (3 != 3) (2 << 3) != 3
+1 2 1
+create or replace view v1 as select 2 << 3 LIKE 3, 2 << (3 LIKE 3), (2 << 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 like 3 AS `2 << 3 LIKE 3`,2 << (3 like 3) AS `2 << (3 LIKE 3)`,2 << 3 like 3 AS `(2 << 3) LIKE 3`
+select 2 << 3 LIKE 3, 2 << (3 LIKE 3), (2 << 3) LIKE 3 union select * from v1;
+2 << 3 LIKE 3 2 << (3 LIKE 3) (2 << 3) LIKE 3
+0 4 0
+create or replace view v1 as select 2 << 3 REGEXP 3, 2 << (3 REGEXP 3), (2 << 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 regexp 3 AS `2 << 3 REGEXP 3`,2 << (3 regexp 3) AS `2 << (3 REGEXP 3)`,2 << 3 regexp 3 AS `(2 << 3) REGEXP 3`
+select 2 << 3 REGEXP 3, 2 << (3 REGEXP 3), (2 << 3) REGEXP 3 union select * from v1;
+2 << 3 REGEXP 3 2 << (3 REGEXP 3) (2 << 3) REGEXP 3
+0 4 0
+create or replace view v1 as select 2 << 3 | 3, 2 << (3 | 3), (2 << 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 | 3 AS `2 << 3 | 3`,2 << (3 | 3) AS `2 << (3 | 3)`,2 << 3 | 3 AS `(2 << 3) | 3`
+select 2 << 3 | 3, 2 << (3 | 3), (2 << 3) | 3 union select * from v1;
+2 << 3 | 3 2 << (3 | 3) (2 << 3) | 3
+19 16 19
+create or replace view v1 as select 2 << 3 & 3, 2 << (3 & 3), (2 << 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 & 3 AS `2 << 3 & 3`,2 << (3 & 3) AS `2 << (3 & 3)`,2 << 3 & 3 AS `(2 << 3) & 3`
+select 2 << 3 & 3, 2 << (3 & 3), (2 << 3) & 3 union select * from v1;
+2 << 3 & 3 2 << (3 & 3) (2 << 3) & 3
+0 16 0
+create or replace view v1 as select 2 << 3 << 3, 2 << (3 << 3), (2 << 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 << 3 AS `2 << 3 << 3`,2 << (3 << 3) AS `2 << (3 << 3)`,2 << 3 << 3 AS `(2 << 3) << 3`
+select 2 << 3 << 3, 2 << (3 << 3), (2 << 3) << 3 union select * from v1;
+2 << 3 << 3 2 << (3 << 3) (2 << 3) << 3
+128 33554432 128
+create or replace view v1 as select 2 << 2 >> 3, 2 << (2 >> 3), (2 << 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 2 >> 3 AS `2 << 2 >> 3`,2 << (2 >> 3) AS `2 << (2 >> 3)`,2 << 2 >> 3 AS `(2 << 2) >> 3`
+select 2 << 2 >> 3, 2 << (2 >> 3), (2 << 2) >> 3 union select * from v1;
+2 << 2 >> 3 2 << (2 >> 3) (2 << 2) >> 3
+1 2 1
+create or replace view v1 as select 2 << '2000-01-01' +INTERVAL 1 DAY, 2 << ('2000-01-01' +INTERVAL 1 DAY), (2 << '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << '2000-01-01' + interval 1 day AS `2 << '2000-01-01' +INTERVAL 1 DAY`,2 << '2000-01-01' + interval 1 day AS `2 << ('2000-01-01' +INTERVAL 1 DAY)`,(2 << '2000-01-01') + interval 1 day AS `(2 << '2000-01-01') +INTERVAL 1 DAY`
+select 2 << '2000-01-01' +INTERVAL 1 DAY, 2 << ('2000-01-01' +INTERVAL 1 DAY), (2 << '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 << '2000-01-01' +INTERVAL 1 DAY 2 << ('2000-01-01' +INTERVAL 1 DAY) (2 << '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 << 3 + 3, 2 << (3 + 3), (2 << 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 + 3 AS `2 << 3 + 3`,2 << 3 + 3 AS `2 << (3 + 3)`,(2 << 3) + 3 AS `(2 << 3) + 3`
+select 2 << 3 + 3, 2 << (3 + 3), (2 << 3) + 3 union select * from v1;
+2 << 3 + 3 2 << (3 + 3) (2 << 3) + 3
+128 128 19
+create or replace view v1 as select 2 << 3 - 3, 2 << (3 - 3), (2 << 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 - 3 AS `2 << 3 - 3`,2 << 3 - 3 AS `2 << (3 - 3)`,(2 << 3) - 3 AS `(2 << 3) - 3`
+select 2 << 3 - 3, 2 << (3 - 3), (2 << 3) - 3 union select * from v1;
+2 << 3 - 3 2 << (3 - 3) (2 << 3) - 3
+2 2 13
+create or replace view v1 as select 2 << 3 * 3, 2 << (3 * 3), (2 << 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 * 3 AS `2 << 3 * 3`,2 << 3 * 3 AS `2 << (3 * 3)`,(2 << 3) * 3 AS `(2 << 3) * 3`
+select 2 << 3 * 3, 2 << (3 * 3), (2 << 3) * 3 union select * from v1;
+2 << 3 * 3 2 << (3 * 3) (2 << 3) * 3
+1024 1024 48
+create or replace view v1 as select 2 << 3 / 3, 2 << (3 / 3), (2 << 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 / 3 AS `2 << 3 / 3`,2 << 3 / 3 AS `2 << (3 / 3)`,(2 << 3) / 3 AS `(2 << 3) / 3`
+select 2 << 3 / 3, 2 << (3 / 3), (2 << 3) / 3 union select * from v1;
+2 << 3 / 3 2 << (3 / 3) (2 << 3) / 3
+4 4 5.3333
+create or replace view v1 as select 2 << 3 DIV 3, 2 << (3 DIV 3), (2 << 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 DIV 3 AS `2 << 3 DIV 3`,2 << 3 DIV 3 AS `2 << (3 DIV 3)`,(2 << 3) DIV 3 AS `(2 << 3) DIV 3`
+select 2 << 3 DIV 3, 2 << (3 DIV 3), (2 << 3) DIV 3 union select * from v1;
+2 << 3 DIV 3 2 << (3 DIV 3) (2 << 3) DIV 3
+4 4 5
+create or replace view v1 as select 2 << 3 MOD 3, 2 << (3 MOD 3), (2 << 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 % 3 AS `2 << 3 MOD 3`,2 << 3 % 3 AS `2 << (3 MOD 3)`,(2 << 3) % 3 AS `(2 << 3) MOD 3`
+select 2 << 3 MOD 3, 2 << (3 MOD 3), (2 << 3) MOD 3 union select * from v1;
+2 << 3 MOD 3 2 << (3 MOD 3) (2 << 3) MOD 3
+2 2 1
+create or replace view v1 as select 2 << 3 % 3, 2 << (3 % 3), (2 << 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 % 3 AS `2 << 3 % 3`,2 << 3 % 3 AS `2 << (3 % 3)`,(2 << 3) % 3 AS `(2 << 3) % 3`
+select 2 << 3 % 3, 2 << (3 % 3), (2 << 3) % 3 union select * from v1;
+2 << 3 % 3 2 << (3 % 3) (2 << 3) % 3
+2 2 1
+create or replace view v1 as select 2 << 3 ^ 3, 2 << (3 ^ 3), (2 << 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 ^ 3 AS `2 << 3 ^ 3`,2 << 3 ^ 3 AS `2 << (3 ^ 3)`,(2 << 3) ^ 3 AS `(2 << 3) ^ 3`
+select 2 << 3 ^ 3, 2 << (3 ^ 3), (2 << 3) ^ 3 union select * from v1;
+2 << 3 ^ 3 2 << (3 ^ 3) (2 << 3) ^ 3
+2 2 19
+create or replace view v1 as select 2 << 3 BETWEEN 1 AND 3, 2 << (3 BETWEEN 1 AND 3), (2 << 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 between 1 and 3 AS `2 << 3 BETWEEN 1 AND 3`,2 << (3 between 1 and 3) AS `2 << (3 BETWEEN 1 AND 3)`,2 << 3 between 1 and 3 AS `(2 << 3) BETWEEN 1 AND 3`
+select 2 << 3 BETWEEN 1 AND 3, 2 << (3 BETWEEN 1 AND 3), (2 << 3) BETWEEN 1 AND 3 union select * from v1;
+2 << 3 BETWEEN 1 AND 3 2 << (3 BETWEEN 1 AND 3) (2 << 3) BETWEEN 1 AND 3
+0 4 0
+create or replace view v1 as select 2 >> 3 IS FALSE, 2 >> (3 IS FALSE), (2 >> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 is false AS `2 >> 3 IS FALSE`,2 >> (3 is false) AS `2 >> (3 IS FALSE)`,2 >> 3 is false AS `(2 >> 3) IS FALSE`
+select 2 >> 3 IS FALSE, 2 >> (3 IS FALSE), (2 >> 3) IS FALSE union select * from v1;
+2 >> 3 IS FALSE 2 >> (3 IS FALSE) (2 >> 3) IS FALSE
+1 2 1
+create or replace view v1 as select charset(2 >> 3 COLLATE latin1_bin), charset(2 >> (3 COLLATE latin1_bin)), charset((2 >> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 >> 3 collate latin1_bin) AS `charset(2 >> 3 COLLATE latin1_bin)`,charset(2 >> 3 collate latin1_bin) AS `charset(2 >> (3 COLLATE latin1_bin))`,charset((2 >> 3) collate latin1_bin) AS `charset((2 >> 3) COLLATE latin1_bin)`
+select charset(2 >> 3 COLLATE latin1_bin), charset(2 >> (3 COLLATE latin1_bin)), charset((2 >> 3) COLLATE latin1_bin) union select * from v1;
+charset(2 >> 3 COLLATE latin1_bin) charset(2 >> (3 COLLATE latin1_bin)) charset((2 >> 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 >> 3 IN (0,1), 2 >> (3 IN (0,1)), (2 >> 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 in (0,1) AS `2 >> 3 IN (0,1)`,2 >> (3 in (0,1)) AS `2 >> (3 IN (0,1))`,2 >> 3 in (0,1) AS `(2 >> 3) IN (0,1)`
+select 2 >> 3 IN (0,1), 2 >> (3 IN (0,1)), (2 >> 3) IN (0,1) union select * from v1;
+2 >> 3 IN (0,1) 2 >> (3 IN (0,1)) (2 >> 3) IN (0,1)
+1 2 1
+create or replace view v1 as select 2 >> 3 OR 0, 2 >> (3 OR 0), (2 >> 3) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 or 0 AS `2 >> 3 OR 0`,2 >> (3 or 0) AS `2 >> (3 OR 0)`,2 >> 3 or 0 AS `(2 >> 3) OR 0`
+select 2 >> 3 OR 0, 2 >> (3 OR 0), (2 >> 3) OR 0 union select * from v1;
+2 >> 3 OR 0 2 >> (3 OR 0) (2 >> 3) OR 0
+0 1 0
+create or replace view v1 as select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 or 0 AS `2 >> 3 || 0`,2 >> (3 or 0) AS `2 >> (3 || 0)`,2 >> 3 or 0 AS `(2 >> 3) || 0`
+select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0 union select * from v1;
+2 >> 3 || 0 2 >> (3 || 0) (2 >> 3) || 0
+0 1 0
+create or replace view v1 as select 2 >> 3 XOR 3, 2 >> (3 XOR 3), (2 >> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 xor 3 AS `2 >> 3 XOR 3`,2 >> (3 xor 3) AS `2 >> (3 XOR 3)`,2 >> 3 xor 3 AS `(2 >> 3) XOR 3`
+select 2 >> 3 XOR 3, 2 >> (3 XOR 3), (2 >> 3) XOR 3 union select * from v1;
+2 >> 3 XOR 3 2 >> (3 XOR 3) (2 >> 3) XOR 3
+1 2 1
+create or replace view v1 as select 2 >> 3 AND 3, 2 >> (3 AND 3), (2 >> 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 and 3 AS `2 >> 3 AND 3`,2 >> (3 and 3) AS `2 >> (3 AND 3)`,2 >> 3 and 3 AS `(2 >> 3) AND 3`
+select 2 >> 3 AND 3, 2 >> (3 AND 3), (2 >> 3) AND 3 union select * from v1;
+2 >> 3 AND 3 2 >> (3 AND 3) (2 >> 3) AND 3
+0 1 0
+create or replace view v1 as select 2 >> 3 && 3, 2 >> (3 && 3), (2 >> 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 and 3 AS `2 >> 3 && 3`,2 >> (3 and 3) AS `2 >> (3 && 3)`,2 >> 3 and 3 AS `(2 >> 3) && 3`
+select 2 >> 3 && 3, 2 >> (3 && 3), (2 >> 3) && 3 union select * from v1;
+2 >> 3 && 3 2 >> (3 && 3) (2 >> 3) && 3
+0 1 0
+create or replace view v1 as select 2 >> 3 = 3, 2 >> (3 = 3), (2 >> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 = 3 AS `2 >> 3 = 3`,2 >> (3 = 3) AS `2 >> (3 = 3)`,2 >> 3 = 3 AS `(2 >> 3) = 3`
+select 2 >> 3 = 3, 2 >> (3 = 3), (2 >> 3) = 3 union select * from v1;
+2 >> 3 = 3 2 >> (3 = 3) (2 >> 3) = 3
+0 1 0
+create or replace view v1 as select 2 >> 3 <=> 3, 2 >> (3 <=> 3), (2 >> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 <=> 3 AS `2 >> 3 <=> 3`,2 >> (3 <=> 3) AS `2 >> (3 <=> 3)`,2 >> 3 <=> 3 AS `(2 >> 3) <=> 3`
+select 2 >> 3 <=> 3, 2 >> (3 <=> 3), (2 >> 3) <=> 3 union select * from v1;
+2 >> 3 <=> 3 2 >> (3 <=> 3) (2 >> 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 >> 3 >= 3, 2 >> (3 >= 3), (2 >> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 >= 3 AS `2 >> 3 >= 3`,2 >> (3 >= 3) AS `2 >> (3 >= 3)`,2 >> 3 >= 3 AS `(2 >> 3) >= 3`
+select 2 >> 3 >= 3, 2 >> (3 >= 3), (2 >> 3) >= 3 union select * from v1;
+2 >> 3 >= 3 2 >> (3 >= 3) (2 >> 3) >= 3
+0 1 0
+create or replace view v1 as select 2 >> 3 <= 0, 2 >> (3 <= 0), (2 >> 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 <= 0 AS `2 >> 3 <= 0`,2 >> (3 <= 0) AS `2 >> (3 <= 0)`,2 >> 3 <= 0 AS `(2 >> 3) <= 0`
+select 2 >> 3 <= 0, 2 >> (3 <= 0), (2 >> 3) <= 0 union select * from v1;
+2 >> 3 <= 0 2 >> (3 <= 0) (2 >> 3) <= 0
+1 2 1
+create or replace view v1 as select 2 >> 3 < 3, 2 >> (3 < 3), (2 >> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 < 3 AS `2 >> 3 < 3`,2 >> (3 < 3) AS `2 >> (3 < 3)`,2 >> 3 < 3 AS `(2 >> 3) < 3`
+select 2 >> 3 < 3, 2 >> (3 < 3), (2 >> 3) < 3 union select * from v1;
+2 >> 3 < 3 2 >> (3 < 3) (2 >> 3) < 3
+1 2 1
+create or replace view v1 as select 2 >> 3 <> 3, 2 >> (3 <> 3), (2 >> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 <> 3 AS `2 >> 3 <> 3`,2 >> (3 <> 3) AS `2 >> (3 <> 3)`,2 >> 3 <> 3 AS `(2 >> 3) <> 3`
+select 2 >> 3 <> 3, 2 >> (3 <> 3), (2 >> 3) <> 3 union select * from v1;
+2 >> 3 <> 3 2 >> (3 <> 3) (2 >> 3) <> 3
+1 2 1
+create or replace view v1 as select 2 >> 3 > 3, 2 >> (3 > 3), (2 >> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 > 3 AS `2 >> 3 > 3`,2 >> (3 > 3) AS `2 >> (3 > 3)`,2 >> 3 > 3 AS `(2 >> 3) > 3`
+select 2 >> 3 > 3, 2 >> (3 > 3), (2 >> 3) > 3 union select * from v1;
+2 >> 3 > 3 2 >> (3 > 3) (2 >> 3) > 3
+0 2 0
+create or replace view v1 as select 2 >> 3 != 3, 2 >> (3 != 3), (2 >> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 <> 3 AS `2 >> 3 != 3`,2 >> (3 <> 3) AS `2 >> (3 != 3)`,2 >> 3 <> 3 AS `(2 >> 3) != 3`
+select 2 >> 3 != 3, 2 >> (3 != 3), (2 >> 3) != 3 union select * from v1;
+2 >> 3 != 3 2 >> (3 != 3) (2 >> 3) != 3
+1 2 1
+create or replace view v1 as select 2 >> 3 LIKE 3, 2 >> (3 LIKE 3), (2 >> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 like 3 AS `2 >> 3 LIKE 3`,2 >> (3 like 3) AS `2 >> (3 LIKE 3)`,2 >> 3 like 3 AS `(2 >> 3) LIKE 3`
+select 2 >> 3 LIKE 3, 2 >> (3 LIKE 3), (2 >> 3) LIKE 3 union select * from v1;
+2 >> 3 LIKE 3 2 >> (3 LIKE 3) (2 >> 3) LIKE 3
+0 1 0
+create or replace view v1 as select 2 >> 3 REGEXP 3, 2 >> (3 REGEXP 3), (2 >> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 regexp 3 AS `2 >> 3 REGEXP 3`,2 >> (3 regexp 3) AS `2 >> (3 REGEXP 3)`,2 >> 3 regexp 3 AS `(2 >> 3) REGEXP 3`
+select 2 >> 3 REGEXP 3, 2 >> (3 REGEXP 3), (2 >> 3) REGEXP 3 union select * from v1;
+2 >> 3 REGEXP 3 2 >> (3 REGEXP 3) (2 >> 3) REGEXP 3
+0 1 0
+create or replace view v1 as select 2 >> 3 | 3, 2 >> (3 | 3), (2 >> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 | 3 AS `2 >> 3 | 3`,2 >> (3 | 3) AS `2 >> (3 | 3)`,2 >> 3 | 3 AS `(2 >> 3) | 3`
+select 2 >> 3 | 3, 2 >> (3 | 3), (2 >> 3) | 3 union select * from v1;
+2 >> 3 | 3 2 >> (3 | 3) (2 >> 3) | 3
+3 0 3
+create or replace view v1 as select 2 >> 3 & 1, 2 >> (3 & 1), (2 >> 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 & 1 AS `2 >> 3 & 1`,2 >> (3 & 1) AS `2 >> (3 & 1)`,2 >> 3 & 1 AS `(2 >> 3) & 1`
+select 2 >> 3 & 1, 2 >> (3 & 1), (2 >> 3) & 1 union select * from v1;
+2 >> 3 & 1 2 >> (3 & 1) (2 >> 3) & 1
+0 1 0
+create or replace view v1 as select 2 >> 1 << 3, 2 >> (1 << 3), (2 >> 1) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 1 << 3 AS `2 >> 1 << 3`,2 >> (1 << 3) AS `2 >> (1 << 3)`,2 >> 1 << 3 AS `(2 >> 1) << 3`
+select 2 >> 1 << 3, 2 >> (1 << 3), (2 >> 1) << 3 union select * from v1;
+2 >> 1 << 3 2 >> (1 << 3) (2 >> 1) << 3
+8 0 8
+create or replace view v1 as select 2 >> 3 >> 3, 2 >> (3 >> 3), (2 >> 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 >> 3 AS `2 >> 3 >> 3`,2 >> (3 >> 3) AS `2 >> (3 >> 3)`,2 >> 3 >> 3 AS `(2 >> 3) >> 3`
+select 2 >> 3 >> 3, 2 >> (3 >> 3), (2 >> 3) >> 3 union select * from v1;
+2 >> 3 >> 3 2 >> (3 >> 3) (2 >> 3) >> 3
+0 2 0
+create or replace view v1 as select 2 >> '2000-01-01' +INTERVAL 1 DAY, 2 >> ('2000-01-01' +INTERVAL 1 DAY), (2 >> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> '2000-01-01' + interval 1 day AS `2 >> '2000-01-01' +INTERVAL 1 DAY`,2 >> '2000-01-01' + interval 1 day AS `2 >> ('2000-01-01' +INTERVAL 1 DAY)`,(2 >> '2000-01-01') + interval 1 day AS `(2 >> '2000-01-01') +INTERVAL 1 DAY`
+select 2 >> '2000-01-01' +INTERVAL 1 DAY, 2 >> ('2000-01-01' +INTERVAL 1 DAY), (2 >> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 >> '2000-01-01' +INTERVAL 1 DAY 2 >> ('2000-01-01' +INTERVAL 1 DAY) (2 >> '2000-01-01') +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 >> 3 + 3, 2 >> (3 + 3), (2 >> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 + 3 AS `2 >> 3 + 3`,2 >> 3 + 3 AS `2 >> (3 + 3)`,(2 >> 3) + 3 AS `(2 >> 3) + 3`
+select 2 >> 3 + 3, 2 >> (3 + 3), (2 >> 3) + 3 union select * from v1;
+2 >> 3 + 3 2 >> (3 + 3) (2 >> 3) + 3
+0 0 3
+create or replace view v1 as select 2 >> 1 - 1, 2 >> (1 - 1), (2 >> 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 1 - 1 AS `2 >> 1 - 1`,2 >> 1 - 1 AS `2 >> (1 - 1)`,(2 >> 1) - 1 AS `(2 >> 1) - 1`
+select 2 >> 1 - 1, 2 >> (1 - 1), (2 >> 1) - 1 union select * from v1;
+2 >> 1 - 1 2 >> (1 - 1) (2 >> 1) - 1
+2 2 0
+create or replace view v1 as select 2 >> 1 * 3, 2 >> (1 * 3), (2 >> 1) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 1 * 3 AS `2 >> 1 * 3`,2 >> 1 * 3 AS `2 >> (1 * 3)`,(2 >> 1) * 3 AS `(2 >> 1) * 3`
+select 2 >> 1 * 3, 2 >> (1 * 3), (2 >> 1) * 3 union select * from v1;
+2 >> 1 * 3 2 >> (1 * 3) (2 >> 1) * 3
+0 0 3
+create or replace view v1 as select 2 >> 3 / 3, 2 >> (3 / 3), (2 >> 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 / 3 AS `2 >> 3 / 3`,2 >> 3 / 3 AS `2 >> (3 / 3)`,(2 >> 3) / 3 AS `(2 >> 3) / 3`
+select 2 >> 3 / 3, 2 >> (3 / 3), (2 >> 3) / 3 union select * from v1;
+2 >> 3 / 3 2 >> (3 / 3) (2 >> 3) / 3
+1 1 0.0000
+create or replace view v1 as select 2 >> 3 DIV 3, 2 >> (3 DIV 3), (2 >> 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 DIV 3 AS `2 >> 3 DIV 3`,2 >> 3 DIV 3 AS `2 >> (3 DIV 3)`,(2 >> 3) DIV 3 AS `(2 >> 3) DIV 3`
+select 2 >> 3 DIV 3, 2 >> (3 DIV 3), (2 >> 3) DIV 3 union select * from v1;
+2 >> 3 DIV 3 2 >> (3 DIV 3) (2 >> 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 >> 3 MOD 3, 2 >> (3 MOD 3), (2 >> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 % 3 AS `2 >> 3 MOD 3`,2 >> 3 % 3 AS `2 >> (3 MOD 3)`,(2 >> 3) % 3 AS `(2 >> 3) MOD 3`
+select 2 >> 3 MOD 3, 2 >> (3 MOD 3), (2 >> 3) MOD 3 union select * from v1;
+2 >> 3 MOD 3 2 >> (3 MOD 3) (2 >> 3) MOD 3
+2 2 0
+create or replace view v1 as select 2 >> 3 % 3, 2 >> (3 % 3), (2 >> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 % 3 AS `2 >> 3 % 3`,2 >> 3 % 3 AS `2 >> (3 % 3)`,(2 >> 3) % 3 AS `(2 >> 3) % 3`
+select 2 >> 3 % 3, 2 >> (3 % 3), (2 >> 3) % 3 union select * from v1;
+2 >> 3 % 3 2 >> (3 % 3) (2 >> 3) % 3
+2 2 0
+create or replace view v1 as select 2 >> 3 ^ 3, 2 >> (3 ^ 3), (2 >> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 ^ 3 AS `2 >> 3 ^ 3`,2 >> 3 ^ 3 AS `2 >> (3 ^ 3)`,(2 >> 3) ^ 3 AS `(2 >> 3) ^ 3`
+select 2 >> 3 ^ 3, 2 >> (3 ^ 3), (2 >> 3) ^ 3 union select * from v1;
+2 >> 3 ^ 3 2 >> (3 ^ 3) (2 >> 3) ^ 3
+2 2 3
+create or replace view v1 as select 2 >> 3 BETWEEN 1 AND 3, 2 >> (3 BETWEEN 1 AND 3), (2 >> 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 between 1 and 3 AS `2 >> 3 BETWEEN 1 AND 3`,2 >> (3 between 1 and 3) AS `2 >> (3 BETWEEN 1 AND 3)`,2 >> 3 between 1 and 3 AS `(2 >> 3) BETWEEN 1 AND 3`
+select 2 >> 3 BETWEEN 1 AND 3, 2 >> (3 BETWEEN 1 AND 3), (2 >> 3) BETWEEN 1 AND 3 union select * from v1;
+2 >> 3 BETWEEN 1 AND 3 2 >> (3 BETWEEN 1 AND 3) (2 >> 3) BETWEEN 1 AND 3
+0 1 0
+create or replace view v1 as select 2 + 3 IS FALSE, 2 + (3 IS FALSE), (2 + 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 is false AS `2 + 3 IS FALSE`,2 + (3 is false) AS `2 + (3 IS FALSE)`,2 + 3 is false AS `(2 + 3) IS FALSE`
+select 2 + 3 IS FALSE, 2 + (3 IS FALSE), (2 + 3) IS FALSE union select * from v1;
+2 + 3 IS FALSE 2 + (3 IS FALSE) (2 + 3) IS FALSE
+0 2 0
+create or replace view v1 as select charset(2 + 3 COLLATE latin1_bin), charset(2 + (3 COLLATE latin1_bin)), charset((2 + 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 + 3 collate latin1_bin) AS `charset(2 + 3 COLLATE latin1_bin)`,charset(2 + 3 collate latin1_bin) AS `charset(2 + (3 COLLATE latin1_bin))`,charset((2 + 3) collate latin1_bin) AS `charset((2 + 3) COLLATE latin1_bin)`
+select charset(2 + 3 COLLATE latin1_bin), charset(2 + (3 COLLATE latin1_bin)), charset((2 + 3) COLLATE latin1_bin) union select * from v1;
+charset(2 + 3 COLLATE latin1_bin) charset(2 + (3 COLLATE latin1_bin)) charset((2 + 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 + 3 IN (0,1), 2 + (3 IN (0,1)), (2 + 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 in (0,1) AS `2 + 3 IN (0,1)`,2 + (3 in (0,1)) AS `2 + (3 IN (0,1))`,2 + 3 in (0,1) AS `(2 + 3) IN (0,1)`
+select 2 + 3 IN (0,1), 2 + (3 IN (0,1)), (2 + 3) IN (0,1) union select * from v1;
+2 + 3 IN (0,1) 2 + (3 IN (0,1)) (2 + 3) IN (0,1)
+0 2 0
+create or replace view v1 as select 2 + 3 OR 3, 2 + (3 OR 3), (2 + 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 or 3 AS `2 + 3 OR 3`,2 + (3 or 3) AS `2 + (3 OR 3)`,2 + 3 or 3 AS `(2 + 3) OR 3`
+select 2 + 3 OR 3, 2 + (3 OR 3), (2 + 3) OR 3 union select * from v1;
+2 + 3 OR 3 2 + (3 OR 3) (2 + 3) OR 3
+1 3 1
+create or replace view v1 as select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 or 3 AS `2 + 3 || 3`,2 + (3 or 3) AS `2 + (3 || 3)`,2 + 3 or 3 AS `(2 + 3) || 3`
+select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3 union select * from v1;
+2 + 3 || 3 2 + (3 || 3) (2 + 3) || 3
+1 3 1
+create or replace view v1 as select 2 + 3 XOR 3, 2 + (3 XOR 3), (2 + 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 xor 3 AS `2 + 3 XOR 3`,2 + (3 xor 3) AS `2 + (3 XOR 3)`,2 + 3 xor 3 AS `(2 + 3) XOR 3`
+select 2 + 3 XOR 3, 2 + (3 XOR 3), (2 + 3) XOR 3 union select * from v1;
+2 + 3 XOR 3 2 + (3 XOR 3) (2 + 3) XOR 3
+0 2 0
+create or replace view v1 as select 2 + 3 AND 3, 2 + (3 AND 3), (2 + 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 and 3 AS `2 + 3 AND 3`,2 + (3 and 3) AS `2 + (3 AND 3)`,2 + 3 and 3 AS `(2 + 3) AND 3`
+select 2 + 3 AND 3, 2 + (3 AND 3), (2 + 3) AND 3 union select * from v1;
+2 + 3 AND 3 2 + (3 AND 3) (2 + 3) AND 3
+1 3 1
+create or replace view v1 as select 2 + 3 && 3, 2 + (3 && 3), (2 + 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 and 3 AS `2 + 3 && 3`,2 + (3 and 3) AS `2 + (3 && 3)`,2 + 3 and 3 AS `(2 + 3) && 3`
+select 2 + 3 && 3, 2 + (3 && 3), (2 + 3) && 3 union select * from v1;
+2 + 3 && 3 2 + (3 && 3) (2 + 3) && 3
+1 3 1
+create or replace view v1 as select 2 + 3 = 3, 2 + (3 = 3), (2 + 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 = 3 AS `2 + 3 = 3`,2 + (3 = 3) AS `2 + (3 = 3)`,2 + 3 = 3 AS `(2 + 3) = 3`
+select 2 + 3 = 3, 2 + (3 = 3), (2 + 3) = 3 union select * from v1;
+2 + 3 = 3 2 + (3 = 3) (2 + 3) = 3
+0 3 0
+create or replace view v1 as select 2 + 3 <=> 3, 2 + (3 <=> 3), (2 + 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 <=> 3 AS `2 + 3 <=> 3`,2 + (3 <=> 3) AS `2 + (3 <=> 3)`,2 + 3 <=> 3 AS `(2 + 3) <=> 3`
+select 2 + 3 <=> 3, 2 + (3 <=> 3), (2 + 3) <=> 3 union select * from v1;
+2 + 3 <=> 3 2 + (3 <=> 3) (2 + 3) <=> 3
+0 3 0
+create or replace view v1 as select 2 + 3 >= 3, 2 + (3 >= 3), (2 + 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 >= 3 AS `2 + 3 >= 3`,2 + (3 >= 3) AS `2 + (3 >= 3)`,2 + 3 >= 3 AS `(2 + 3) >= 3`
+select 2 + 3 >= 3, 2 + (3 >= 3), (2 + 3) >= 3 union select * from v1;
+2 + 3 >= 3 2 + (3 >= 3) (2 + 3) >= 3
+1 3 1
+create or replace view v1 as select 2 + 3 <= 3, 2 + (3 <= 3), (2 + 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 <= 3 AS `2 + 3 <= 3`,2 + (3 <= 3) AS `2 + (3 <= 3)`,2 + 3 <= 3 AS `(2 + 3) <= 3`
+select 2 + 3 <= 3, 2 + (3 <= 3), (2 + 3) <= 3 union select * from v1;
+2 + 3 <= 3 2 + (3 <= 3) (2 + 3) <= 3
+0 3 0
+create or replace view v1 as select 2 + 3 < 3, 2 + (3 < 3), (2 + 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 < 3 AS `2 + 3 < 3`,2 + (3 < 3) AS `2 + (3 < 3)`,2 + 3 < 3 AS `(2 + 3) < 3`
+select 2 + 3 < 3, 2 + (3 < 3), (2 + 3) < 3 union select * from v1;
+2 + 3 < 3 2 + (3 < 3) (2 + 3) < 3
+0 2 0
+create or replace view v1 as select 2 + 3 <> 3, 2 + (3 <> 3), (2 + 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 <> 3 AS `2 + 3 <> 3`,2 + (3 <> 3) AS `2 + (3 <> 3)`,2 + 3 <> 3 AS `(2 + 3) <> 3`
+select 2 + 3 <> 3, 2 + (3 <> 3), (2 + 3) <> 3 union select * from v1;
+2 + 3 <> 3 2 + (3 <> 3) (2 + 3) <> 3
+1 2 1
+create or replace view v1 as select 2 + 3 > 3, 2 + (3 > 3), (2 + 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 > 3 AS `2 + 3 > 3`,2 + (3 > 3) AS `2 + (3 > 3)`,2 + 3 > 3 AS `(2 + 3) > 3`
+select 2 + 3 > 3, 2 + (3 > 3), (2 + 3) > 3 union select * from v1;
+2 + 3 > 3 2 + (3 > 3) (2 + 3) > 3
+1 2 1
+create or replace view v1 as select 2 + 3 != 3, 2 + (3 != 3), (2 + 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 <> 3 AS `2 + 3 != 3`,2 + (3 <> 3) AS `2 + (3 != 3)`,2 + 3 <> 3 AS `(2 + 3) != 3`
+select 2 + 3 != 3, 2 + (3 != 3), (2 + 3) != 3 union select * from v1;
+2 + 3 != 3 2 + (3 != 3) (2 + 3) != 3
+1 2 1
+create or replace view v1 as select 2 + 3 LIKE 3, 2 + (3 LIKE 3), (2 + 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 like 3 AS `2 + 3 LIKE 3`,2 + (3 like 3) AS `2 + (3 LIKE 3)`,2 + 3 like 3 AS `(2 + 3) LIKE 3`
+select 2 + 3 LIKE 3, 2 + (3 LIKE 3), (2 + 3) LIKE 3 union select * from v1;
+2 + 3 LIKE 3 2 + (3 LIKE 3) (2 + 3) LIKE 3
+0 3 0
+create or replace view v1 as select 2 + 3 REGEXP 3, 2 + (3 REGEXP 3), (2 + 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 regexp 3 AS `2 + 3 REGEXP 3`,2 + (3 regexp 3) AS `2 + (3 REGEXP 3)`,2 + 3 regexp 3 AS `(2 + 3) REGEXP 3`
+select 2 + 3 REGEXP 3, 2 + (3 REGEXP 3), (2 + 3) REGEXP 3 union select * from v1;
+2 + 3 REGEXP 3 2 + (3 REGEXP 3) (2 + 3) REGEXP 3
+0 3 0
+create or replace view v1 as select 2 + 3 | 3, 2 + (3 | 3), (2 + 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 | 3 AS `2 + 3 | 3`,2 + (3 | 3) AS `2 + (3 | 3)`,2 + 3 | 3 AS `(2 + 3) | 3`
+select 2 + 3 | 3, 2 + (3 | 3), (2 + 3) | 3 union select * from v1;
+2 + 3 | 3 2 + (3 | 3) (2 + 3) | 3
+7 5 7
+create or replace view v1 as select 2 + 3 & 3, 2 + (3 & 3), (2 + 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 & 3 AS `2 + 3 & 3`,2 + (3 & 3) AS `2 + (3 & 3)`,2 + 3 & 3 AS `(2 + 3) & 3`
+select 2 + 3 & 3, 2 + (3 & 3), (2 + 3) & 3 union select * from v1;
+2 + 3 & 3 2 + (3 & 3) (2 + 3) & 3
+1 5 1
+create or replace view v1 as select 2 + 3 << 3, 2 + (3 << 3), (2 + 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 << 3 AS `2 + 3 << 3`,2 + (3 << 3) AS `2 + (3 << 3)`,2 + 3 << 3 AS `(2 + 3) << 3`
+select 2 + 3 << 3, 2 + (3 << 3), (2 + 3) << 3 union select * from v1;
+2 + 3 << 3 2 + (3 << 3) (2 + 3) << 3
+40 26 40
+create or replace view v1 as select 2 + 3 >> 3, 2 + (3 >> 3), (2 + 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 >> 3 AS `2 + 3 >> 3`,2 + (3 >> 3) AS `2 + (3 >> 3)`,2 + 3 >> 3 AS `(2 + 3) >> 3`
+select 2 + 3 >> 3, 2 + (3 >> 3), (2 + 3) >> 3 union select * from v1;
+2 + 3 >> 3 2 + (3 >> 3) (2 + 3) >> 3
+0 2 0
+create or replace view v1 as select 2 + '2000-01-01' +INTERVAL 1 DAY, 2 + ('2000-01-01' +INTERVAL 1 DAY), (2 + '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + '2000-01-01' + interval 1 day AS `2 + '2000-01-01' +INTERVAL 1 DAY`,2 + ('2000-01-01' + interval 1 day) AS `2 + ('2000-01-01' +INTERVAL 1 DAY)`,2 + '2000-01-01' + interval 1 day AS `(2 + '2000-01-01') +INTERVAL 1 DAY`
+select 2 + '2000-01-01' +INTERVAL 1 DAY, 2 + ('2000-01-01' +INTERVAL 1 DAY), (2 + '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 + '2000-01-01' +INTERVAL 1 DAY 2 + ('2000-01-01' +INTERVAL 1 DAY) (2 + '2000-01-01') +INTERVAL 1 DAY
+NULL 20000104 NULL
+create or replace view v1 as select 2 + 3 * 3, 2 + (3 * 3), (2 + 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 * 3 AS `2 + 3 * 3`,2 + 3 * 3 AS `2 + (3 * 3)`,(2 + 3) * 3 AS `(2 + 3) * 3`
+select 2 + 3 * 3, 2 + (3 * 3), (2 + 3) * 3 union select * from v1;
+2 + 3 * 3 2 + (3 * 3) (2 + 3) * 3
+11 11 15
+create or replace view v1 as select 2 + 3 / 3, 2 + (3 / 3), (2 + 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 / 3 AS `2 + 3 / 3`,2 + 3 / 3 AS `2 + (3 / 3)`,(2 + 3) / 3 AS `(2 + 3) / 3`
+select 2 + 3 / 3, 2 + (3 / 3), (2 + 3) / 3 union select * from v1;
+2 + 3 / 3 2 + (3 / 3) (2 + 3) / 3
+3.0000 3.0000 1.6667
+create or replace view v1 as select 2 + 3 DIV 3, 2 + (3 DIV 3), (2 + 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 DIV 3 AS `2 + 3 DIV 3`,2 + 3 DIV 3 AS `2 + (3 DIV 3)`,(2 + 3) DIV 3 AS `(2 + 3) DIV 3`
+select 2 + 3 DIV 3, 2 + (3 DIV 3), (2 + 3) DIV 3 union select * from v1;
+2 + 3 DIV 3 2 + (3 DIV 3) (2 + 3) DIV 3
+3 3 1
+create or replace view v1 as select 2 + 1 MOD 3, 2 + (1 MOD 3), (2 + 1) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 1 % 3 AS `2 + 1 MOD 3`,2 + 1 % 3 AS `2 + (1 MOD 3)`,(2 + 1) % 3 AS `(2 + 1) MOD 3`
+select 2 + 1 MOD 3, 2 + (1 MOD 3), (2 + 1) MOD 3 union select * from v1;
+2 + 1 MOD 3 2 + (1 MOD 3) (2 + 1) MOD 3
+3 3 0
+create or replace view v1 as select 2 + 1 % 3, 2 + (1 % 3), (2 + 1) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 1 % 3 AS `2 + 1 % 3`,2 + 1 % 3 AS `2 + (1 % 3)`,(2 + 1) % 3 AS `(2 + 1) % 3`
+select 2 + 1 % 3, 2 + (1 % 3), (2 + 1) % 3 union select * from v1;
+2 + 1 % 3 2 + (1 % 3) (2 + 1) % 3
+3 3 0
+create or replace view v1 as select 2 + 3 ^ 3, 2 + (3 ^ 3), (2 + 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 ^ 3 AS `2 + 3 ^ 3`,2 + 3 ^ 3 AS `2 + (3 ^ 3)`,(2 + 3) ^ 3 AS `(2 + 3) ^ 3`
+select 2 + 3 ^ 3, 2 + (3 ^ 3), (2 + 3) ^ 3 union select * from v1;
+2 + 3 ^ 3 2 + (3 ^ 3) (2 + 3) ^ 3
+2 2 6
+create or replace view v1 as select 2 + 3 BETWEEN 1 AND 3, 2 + (3 BETWEEN 1 AND 3), (2 + 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 between 1 and 3 AS `2 + 3 BETWEEN 1 AND 3`,2 + (3 between 1 and 3) AS `2 + (3 BETWEEN 1 AND 3)`,2 + 3 between 1 and 3 AS `(2 + 3) BETWEEN 1 AND 3`
+select 2 + 3 BETWEEN 1 AND 3, 2 + (3 BETWEEN 1 AND 3), (2 + 3) BETWEEN 1 AND 3 union select * from v1;
+2 + 3 BETWEEN 1 AND 3 2 + (3 BETWEEN 1 AND 3) (2 + 3) BETWEEN 1 AND 3
+0 3 0
+create or replace view v1 as select 2 - 3 IS FALSE, 2 - (3 IS FALSE), (2 - 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 is false AS `2 - 3 IS FALSE`,2 - (3 is false) AS `2 - (3 IS FALSE)`,2 - 3 is false AS `(2 - 3) IS FALSE`
+select 2 - 3 IS FALSE, 2 - (3 IS FALSE), (2 - 3) IS FALSE union select * from v1;
+2 - 3 IS FALSE 2 - (3 IS FALSE) (2 - 3) IS FALSE
+0 2 0
+create or replace view v1 as select charset(2 - 3 COLLATE latin1_bin), charset(2 - (3 COLLATE latin1_bin)), charset((2 - 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 - 3 collate latin1_bin) AS `charset(2 - 3 COLLATE latin1_bin)`,charset(2 - 3 collate latin1_bin) AS `charset(2 - (3 COLLATE latin1_bin))`,charset((2 - 3) collate latin1_bin) AS `charset((2 - 3) COLLATE latin1_bin)`
+select charset(2 - 3 COLLATE latin1_bin), charset(2 - (3 COLLATE latin1_bin)), charset((2 - 3) COLLATE latin1_bin) union select * from v1;
+charset(2 - 3 COLLATE latin1_bin) charset(2 - (3 COLLATE latin1_bin)) charset((2 - 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 - 3 IN (0,1), 2 - (3 IN (0,1)), (2 - 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 in (0,1) AS `2 - 3 IN (0,1)`,2 - (3 in (0,1)) AS `2 - (3 IN (0,1))`,2 - 3 in (0,1) AS `(2 - 3) IN (0,1)`
+select 2 - 3 IN (0,1), 2 - (3 IN (0,1)), (2 - 3) IN (0,1) union select * from v1;
+2 - 3 IN (0,1) 2 - (3 IN (0,1)) (2 - 3) IN (0,1)
+0 2 0
+create or replace view v1 as select 2 - 2 OR 0, 2 - (2 OR 0), (2 - 2) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 2 or 0 AS `2 - 2 OR 0`,2 - (2 or 0) AS `2 - (2 OR 0)`,2 - 2 or 0 AS `(2 - 2) OR 0`
+select 2 - 2 OR 0, 2 - (2 OR 0), (2 - 2) OR 0 union select * from v1;
+2 - 2 OR 0 2 - (2 OR 0) (2 - 2) OR 0
+0 1 0
+create or replace view v1 as select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 2 or 0 AS `2 - 2 || 0`,2 - (2 or 0) AS `2 - (2 || 0)`,2 - 2 or 0 AS `(2 - 2) || 0`
+select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0 union select * from v1;
+2 - 2 || 0 2 - (2 || 0) (2 - 2) || 0
+0 1 0
+create or replace view v1 as select 2 - 3 XOR 3, 2 - (3 XOR 3), (2 - 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 xor 3 AS `2 - 3 XOR 3`,2 - (3 xor 3) AS `2 - (3 XOR 3)`,2 - 3 xor 3 AS `(2 - 3) XOR 3`
+select 2 - 3 XOR 3, 2 - (3 XOR 3), (2 - 3) XOR 3 union select * from v1;
+2 - 3 XOR 3 2 - (3 XOR 3) (2 - 3) XOR 3
+0 2 0
+create or replace view v1 as select 2 - 2 AND 2, 2 - (2 AND 2), (2 - 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 2 and 2 AS `2 - 2 AND 2`,2 - (2 and 2) AS `2 - (2 AND 2)`,2 - 2 and 2 AS `(2 - 2) AND 2`
+select 2 - 2 AND 2, 2 - (2 AND 2), (2 - 2) AND 2 union select * from v1;
+2 - 2 AND 2 2 - (2 AND 2) (2 - 2) AND 2
+0 1 0
+create or replace view v1 as select 2 - 2 && 2, 2 - (2 && 2), (2 - 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 2 and 2 AS `2 - 2 && 2`,2 - (2 and 2) AS `2 - (2 && 2)`,2 - 2 and 2 AS `(2 - 2) && 2`
+select 2 - 2 && 2, 2 - (2 && 2), (2 - 2) && 2 union select * from v1;
+2 - 2 && 2 2 - (2 && 2) (2 - 2) && 2
+0 1 0
+create or replace view v1 as select 2 - 3 = 3, 2 - (3 = 3), (2 - 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 = 3 AS `2 - 3 = 3`,2 - (3 = 3) AS `2 - (3 = 3)`,2 - 3 = 3 AS `(2 - 3) = 3`
+select 2 - 3 = 3, 2 - (3 = 3), (2 - 3) = 3 union select * from v1;
+2 - 3 = 3 2 - (3 = 3) (2 - 3) = 3
+0 1 0
+create or replace view v1 as select 2 - 3 <=> 3, 2 - (3 <=> 3), (2 - 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 <=> 3 AS `2 - 3 <=> 3`,2 - (3 <=> 3) AS `2 - (3 <=> 3)`,2 - 3 <=> 3 AS `(2 - 3) <=> 3`
+select 2 - 3 <=> 3, 2 - (3 <=> 3), (2 - 3) <=> 3 union select * from v1;
+2 - 3 <=> 3 2 - (3 <=> 3) (2 - 3) <=> 3
+0 1 0
+create or replace view v1 as select 2 - 3 >= 3, 2 - (3 >= 3), (2 - 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 >= 3 AS `2 - 3 >= 3`,2 - (3 >= 3) AS `2 - (3 >= 3)`,2 - 3 >= 3 AS `(2 - 3) >= 3`
+select 2 - 3 >= 3, 2 - (3 >= 3), (2 - 3) >= 3 union select * from v1;
+2 - 3 >= 3 2 - (3 >= 3) (2 - 3) >= 3
+0 1 0
+create or replace view v1 as select 2 - 3 <= 2, 2 - (3 <= 2), (2 - 3) <= 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 <= 2 AS `2 - 3 <= 2`,2 - (3 <= 2) AS `2 - (3 <= 2)`,2 - 3 <= 2 AS `(2 - 3) <= 2`
+select 2 - 3 <= 2, 2 - (3 <= 2), (2 - 3) <= 2 union select * from v1;
+2 - 3 <= 2 2 - (3 <= 2) (2 - 3) <= 2
+1 2 1
+create or replace view v1 as select 2 - 3 < 3, 2 - (3 < 3), (2 - 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 < 3 AS `2 - 3 < 3`,2 - (3 < 3) AS `2 - (3 < 3)`,2 - 3 < 3 AS `(2 - 3) < 3`
+select 2 - 3 < 3, 2 - (3 < 3), (2 - 3) < 3 union select * from v1;
+2 - 3 < 3 2 - (3 < 3) (2 - 3) < 3
+1 2 1
+create or replace view v1 as select 2 - 3 <> 3, 2 - (3 <> 3), (2 - 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 <> 3 AS `2 - 3 <> 3`,2 - (3 <> 3) AS `2 - (3 <> 3)`,2 - 3 <> 3 AS `(2 - 3) <> 3`
+select 2 - 3 <> 3, 2 - (3 <> 3), (2 - 3) <> 3 union select * from v1;
+2 - 3 <> 3 2 - (3 <> 3) (2 - 3) <> 3
+1 2 1
+create or replace view v1 as select 2 - 3 > 3, 2 - (3 > 3), (2 - 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 > 3 AS `2 - 3 > 3`,2 - (3 > 3) AS `2 - (3 > 3)`,2 - 3 > 3 AS `(2 - 3) > 3`
+select 2 - 3 > 3, 2 - (3 > 3), (2 - 3) > 3 union select * from v1;
+2 - 3 > 3 2 - (3 > 3) (2 - 3) > 3
+0 2 0
+create or replace view v1 as select 2 - 3 != 3, 2 - (3 != 3), (2 - 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 <> 3 AS `2 - 3 != 3`,2 - (3 <> 3) AS `2 - (3 != 3)`,2 - 3 <> 3 AS `(2 - 3) != 3`
+select 2 - 3 != 3, 2 - (3 != 3), (2 - 3) != 3 union select * from v1;
+2 - 3 != 3 2 - (3 != 3) (2 - 3) != 3
+1 2 1
+create or replace view v1 as select 2 - 3 LIKE 3, 2 - (3 LIKE 3), (2 - 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 like 3 AS `2 - 3 LIKE 3`,2 - (3 like 3) AS `2 - (3 LIKE 3)`,2 - 3 like 3 AS `(2 - 3) LIKE 3`
+select 2 - 3 LIKE 3, 2 - (3 LIKE 3), (2 - 3) LIKE 3 union select * from v1;
+2 - 3 LIKE 3 2 - (3 LIKE 3) (2 - 3) LIKE 3
+0 1 0
+create or replace view v1 as select 2 - 3 REGEXP 3, 2 - (3 REGEXP 3), (2 - 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 regexp 3 AS `2 - 3 REGEXP 3`,2 - (3 regexp 3) AS `2 - (3 REGEXP 3)`,2 - 3 regexp 3 AS `(2 - 3) REGEXP 3`
+select 2 - 3 REGEXP 3, 2 - (3 REGEXP 3), (2 - 3) REGEXP 3 union select * from v1;
+2 - 3 REGEXP 3 2 - (3 REGEXP 3) (2 - 3) REGEXP 3
+0 1 0
+create or replace view v1 as select 2 - 0 | 1, 2 - (0 | 1), (2 - 0) | 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 0 | 1 AS `2 - 0 | 1`,2 - (0 | 1) AS `2 - (0 | 1)`,2 - 0 | 1 AS `(2 - 0) | 1`
+select 2 - 0 | 1, 2 - (0 | 1), (2 - 0) | 1 union select * from v1;
+2 - 0 | 1 2 - (0 | 1) (2 - 0) | 1
+3 1 3
+create or replace view v1 as select 2 - 1 & 2, 2 - (1 & 2), (2 - 1) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 1 & 2 AS `2 - 1 & 2`,2 - (1 & 2) AS `2 - (1 & 2)`,2 - 1 & 2 AS `(2 - 1) & 2`
+select 2 - 1 & 2, 2 - (1 & 2), (2 - 1) & 2 union select * from v1;
+2 - 1 & 2 2 - (1 & 2) (2 - 1) & 2
+0 2 0
+create or replace view v1 as select 2 - 1 << 1, 2 - (1 << 1), (2 - 1) << 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 1 << 1 AS `2 - 1 << 1`,2 - (1 << 1) AS `2 - (1 << 1)`,2 - 1 << 1 AS `(2 - 1) << 1`
+select 2 - 1 << 1, 2 - (1 << 1), (2 - 1) << 1 union select * from v1;
+2 - 1 << 1 2 - (1 << 1) (2 - 1) << 1
+2 0 2
+create or replace view v1 as select 2 - 3 >> 3, 2 - (3 >> 3), (2 - 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 >> 3 AS `2 - 3 >> 3`,2 - (3 >> 3) AS `2 - (3 >> 3)`,2 - 3 >> 3 AS `(2 - 3) >> 3`
+select 2 - 3 >> 3, 2 - (3 >> 3), (2 - 3) >> 3 union select * from v1;
+2 - 3 >> 3 2 - (3 >> 3) (2 - 3) >> 3
+2305843009213693951 2 2305843009213693951
+create or replace view v1 as select 2 - '2000-01-01' +INTERVAL 1 DAY, 2 - ('2000-01-01' +INTERVAL 1 DAY), (2 - '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - '2000-01-01' + interval 1 day AS `2 - '2000-01-01' +INTERVAL 1 DAY`,2 - ('2000-01-01' + interval 1 day) AS `2 - ('2000-01-01' +INTERVAL 1 DAY)`,2 - '2000-01-01' + interval 1 day AS `(2 - '2000-01-01') +INTERVAL 1 DAY`
+select 2 - '2000-01-01' +INTERVAL 1 DAY, 2 - ('2000-01-01' +INTERVAL 1 DAY), (2 - '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 - '2000-01-01' +INTERVAL 1 DAY 2 - ('2000-01-01' +INTERVAL 1 DAY) (2 - '2000-01-01') +INTERVAL 1 DAY
+NULL -20000100 NULL
+create or replace view v1 as select 2 - 3 + 3, 2 - (3 + 3), (2 - 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 + 3 AS `2 - 3 + 3`,2 - (3 + 3) AS `2 - (3 + 3)`,2 - 3 + 3 AS `(2 - 3) + 3`
+select 2 - 3 + 3, 2 - (3 + 3), (2 - 3) + 3 union select * from v1;
+2 - 3 + 3 2 - (3 + 3) (2 - 3) + 3
+2 -4 2
+create or replace view v1 as select 2 - 3 - 3, 2 - (3 - 3), (2 - 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 - 3 AS `2 - 3 - 3`,2 - (3 - 3) AS `2 - (3 - 3)`,2 - 3 - 3 AS `(2 - 3) - 3`
+select 2 - 3 - 3, 2 - (3 - 3), (2 - 3) - 3 union select * from v1;
+2 - 3 - 3 2 - (3 - 3) (2 - 3) - 3
+-4 2 -4
+create or replace view v1 as select 2 - 3 * 3, 2 - (3 * 3), (2 - 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 * 3 AS `2 - 3 * 3`,2 - 3 * 3 AS `2 - (3 * 3)`,(2 - 3) * 3 AS `(2 - 3) * 3`
+select 2 - 3 * 3, 2 - (3 * 3), (2 - 3) * 3 union select * from v1;
+2 - 3 * 3 2 - (3 * 3) (2 - 3) * 3
+-7 -7 -3
+create or replace view v1 as select 2 - 3 / 3, 2 - (3 / 3), (2 - 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 / 3 AS `2 - 3 / 3`,2 - 3 / 3 AS `2 - (3 / 3)`,(2 - 3) / 3 AS `(2 - 3) / 3`
+select 2 - 3 / 3, 2 - (3 / 3), (2 - 3) / 3 union select * from v1;
+2 - 3 / 3 2 - (3 / 3) (2 - 3) / 3
+1.0000 1.0000 -0.3333
+create or replace view v1 as select 2 - 3 DIV 3, 2 - (3 DIV 3), (2 - 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 DIV 3 AS `2 - 3 DIV 3`,2 - 3 DIV 3 AS `2 - (3 DIV 3)`,(2 - 3) DIV 3 AS `(2 - 3) DIV 3`
+select 2 - 3 DIV 3, 2 - (3 DIV 3), (2 - 3) DIV 3 union select * from v1;
+2 - 3 DIV 3 2 - (3 DIV 3) (2 - 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 - 3 MOD 3, 2 - (3 MOD 3), (2 - 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 % 3 AS `2 - 3 MOD 3`,2 - 3 % 3 AS `2 - (3 MOD 3)`,(2 - 3) % 3 AS `(2 - 3) MOD 3`
+select 2 - 3 MOD 3, 2 - (3 MOD 3), (2 - 3) MOD 3 union select * from v1;
+2 - 3 MOD 3 2 - (3 MOD 3) (2 - 3) MOD 3
+2 2 -1
+create or replace view v1 as select 2 - 3 % 3, 2 - (3 % 3), (2 - 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 % 3 AS `2 - 3 % 3`,2 - 3 % 3 AS `2 - (3 % 3)`,(2 - 3) % 3 AS `(2 - 3) % 3`
+select 2 - 3 % 3, 2 - (3 % 3), (2 - 3) % 3 union select * from v1;
+2 - 3 % 3 2 - (3 % 3) (2 - 3) % 3
+2 2 -1
+create or replace view v1 as select 2 - 3 ^ 3, 2 - (3 ^ 3), (2 - 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 ^ 3 AS `2 - 3 ^ 3`,2 - 3 ^ 3 AS `2 - (3 ^ 3)`,(2 - 3) ^ 3 AS `(2 - 3) ^ 3`
+select 2 - 3 ^ 3, 2 - (3 ^ 3), (2 - 3) ^ 3 union select * from v1;
+2 - 3 ^ 3 2 - (3 ^ 3) (2 - 3) ^ 3
+2 2 18446744073709551612
+create or replace view v1 as select 2 - 3 BETWEEN 1 AND 3, 2 - (3 BETWEEN 1 AND 3), (2 - 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 between 1 and 3 AS `2 - 3 BETWEEN 1 AND 3`,2 - (3 between 1 and 3) AS `2 - (3 BETWEEN 1 AND 3)`,2 - 3 between 1 and 3 AS `(2 - 3) BETWEEN 1 AND 3`
+select 2 - 3 BETWEEN 1 AND 3, 2 - (3 BETWEEN 1 AND 3), (2 - 3) BETWEEN 1 AND 3 union select * from v1;
+2 - 3 BETWEEN 1 AND 3 2 - (3 BETWEEN 1 AND 3) (2 - 3) BETWEEN 1 AND 3
+0 1 0
+create or replace view v1 as select 2 * 0 IS FALSE, 2 * (0 IS FALSE), (2 * 0) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 0 is false AS `2 * 0 IS FALSE`,2 * (0 is false) AS `2 * (0 IS FALSE)`,2 * 0 is false AS `(2 * 0) IS FALSE`
+select 2 * 0 IS FALSE, 2 * (0 IS FALSE), (2 * 0) IS FALSE union select * from v1;
+2 * 0 IS FALSE 2 * (0 IS FALSE) (2 * 0) IS FALSE
+1 2 1
+create or replace view v1 as select charset(2 * 3 COLLATE latin1_bin), charset(2 * (3 COLLATE latin1_bin)), charset((2 * 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 * 3 collate latin1_bin) AS `charset(2 * 3 COLLATE latin1_bin)`,charset(2 * 3 collate latin1_bin) AS `charset(2 * (3 COLLATE latin1_bin))`,charset((2 * 3) collate latin1_bin) AS `charset((2 * 3) COLLATE latin1_bin)`
+select charset(2 * 3 COLLATE latin1_bin), charset(2 * (3 COLLATE latin1_bin)), charset((2 * 3) COLLATE latin1_bin) union select * from v1;
+charset(2 * 3 COLLATE latin1_bin) charset(2 * (3 COLLATE latin1_bin)) charset((2 * 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 * 0 IN (0,1), 2 * (0 IN (0,1)), (2 * 0) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 0 in (0,1) AS `2 * 0 IN (0,1)`,2 * (0 in (0,1)) AS `2 * (0 IN (0,1))`,2 * 0 in (0,1) AS `(2 * 0) IN (0,1)`
+select 2 * 0 IN (0,1), 2 * (0 IN (0,1)), (2 * 0) IN (0,1) union select * from v1;
+2 * 0 IN (0,1) 2 * (0 IN (0,1)) (2 * 0) IN (0,1)
+1 2 1
+create or replace view v1 as select 2 * 3 OR 3, 2 * (3 OR 3), (2 * 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 or 3 AS `2 * 3 OR 3`,2 * (3 or 3) AS `2 * (3 OR 3)`,2 * 3 or 3 AS `(2 * 3) OR 3`
+select 2 * 3 OR 3, 2 * (3 OR 3), (2 * 3) OR 3 union select * from v1;
+2 * 3 OR 3 2 * (3 OR 3) (2 * 3) OR 3
+1 2 1
+create or replace view v1 as select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 or 3 AS `2 * 3 || 3`,2 * (3 or 3) AS `2 * (3 || 3)`,2 * 3 or 3 AS `(2 * 3) || 3`
+select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3 union select * from v1;
+2 * 3 || 3 2 * (3 || 3) (2 * 3) || 3
+1 2 1
+create or replace view v1 as select 2 * 3 XOR 0, 2 * (3 XOR 0), (2 * 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 xor 0 AS `2 * 3 XOR 0`,2 * (3 xor 0) AS `2 * (3 XOR 0)`,2 * 3 xor 0 AS `(2 * 3) XOR 0`
+select 2 * 3 XOR 0, 2 * (3 XOR 0), (2 * 3) XOR 0 union select * from v1;
+2 * 3 XOR 0 2 * (3 XOR 0) (2 * 3) XOR 0
+1 2 1
+create or replace view v1 as select 2 * 3 AND 3, 2 * (3 AND 3), (2 * 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 and 3 AS `2 * 3 AND 3`,2 * (3 and 3) AS `2 * (3 AND 3)`,2 * 3 and 3 AS `(2 * 3) AND 3`
+select 2 * 3 AND 3, 2 * (3 AND 3), (2 * 3) AND 3 union select * from v1;
+2 * 3 AND 3 2 * (3 AND 3) (2 * 3) AND 3
+1 2 1
+create or replace view v1 as select 2 * 3 && 3, 2 * (3 && 3), (2 * 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 and 3 AS `2 * 3 && 3`,2 * (3 and 3) AS `2 * (3 && 3)`,2 * 3 and 3 AS `(2 * 3) && 3`
+select 2 * 3 && 3, 2 * (3 && 3), (2 * 3) && 3 union select * from v1;
+2 * 3 && 3 2 * (3 && 3) (2 * 3) && 3
+1 2 1
+create or replace view v1 as select 2 * 3 = 3, 2 * (3 = 3), (2 * 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 = 3 AS `2 * 3 = 3`,2 * (3 = 3) AS `2 * (3 = 3)`,2 * 3 = 3 AS `(2 * 3) = 3`
+select 2 * 3 = 3, 2 * (3 = 3), (2 * 3) = 3 union select * from v1;
+2 * 3 = 3 2 * (3 = 3) (2 * 3) = 3
+0 2 0
+create or replace view v1 as select 2 * 3 <=> 3, 2 * (3 <=> 3), (2 * 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 <=> 3 AS `2 * 3 <=> 3`,2 * (3 <=> 3) AS `2 * (3 <=> 3)`,2 * 3 <=> 3 AS `(2 * 3) <=> 3`
+select 2 * 3 <=> 3, 2 * (3 <=> 3), (2 * 3) <=> 3 union select * from v1;
+2 * 3 <=> 3 2 * (3 <=> 3) (2 * 3) <=> 3
+0 2 0
+create or replace view v1 as select 2 * 3 >= 3, 2 * (3 >= 3), (2 * 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 >= 3 AS `2 * 3 >= 3`,2 * (3 >= 3) AS `2 * (3 >= 3)`,2 * 3 >= 3 AS `(2 * 3) >= 3`
+select 2 * 3 >= 3, 2 * (3 >= 3), (2 * 3) >= 3 union select * from v1;
+2 * 3 >= 3 2 * (3 >= 3) (2 * 3) >= 3
+1 2 1
+create or replace view v1 as select 2 * 3 <= 3, 2 * (3 <= 3), (2 * 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 <= 3 AS `2 * 3 <= 3`,2 * (3 <= 3) AS `2 * (3 <= 3)`,2 * 3 <= 3 AS `(2 * 3) <= 3`
+select 2 * 3 <= 3, 2 * (3 <= 3), (2 * 3) <= 3 union select * from v1;
+2 * 3 <= 3 2 * (3 <= 3) (2 * 3) <= 3
+0 2 0
+create or replace view v1 as select 2 * 0 < 3, 2 * (0 < 3), (2 * 0) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 0 < 3 AS `2 * 0 < 3`,2 * (0 < 3) AS `2 * (0 < 3)`,2 * 0 < 3 AS `(2 * 0) < 3`
+select 2 * 0 < 3, 2 * (0 < 3), (2 * 0) < 3 union select * from v1;
+2 * 0 < 3 2 * (0 < 3) (2 * 0) < 3
+1 2 1
+create or replace view v1 as select 2 * 3 <> 3, 2 * (3 <> 3), (2 * 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 <> 3 AS `2 * 3 <> 3`,2 * (3 <> 3) AS `2 * (3 <> 3)`,2 * 3 <> 3 AS `(2 * 3) <> 3`
+select 2 * 3 <> 3, 2 * (3 <> 3), (2 * 3) <> 3 union select * from v1;
+2 * 3 <> 3 2 * (3 <> 3) (2 * 3) <> 3
+1 0 1
+create or replace view v1 as select 2 * 3 > 3, 2 * (3 > 3), (2 * 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 > 3 AS `2 * 3 > 3`,2 * (3 > 3) AS `2 * (3 > 3)`,2 * 3 > 3 AS `(2 * 3) > 3`
+select 2 * 3 > 3, 2 * (3 > 3), (2 * 3) > 3 union select * from v1;
+2 * 3 > 3 2 * (3 > 3) (2 * 3) > 3
+1 0 1
+create or replace view v1 as select 2 * 3 != 3, 2 * (3 != 3), (2 * 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 <> 3 AS `2 * 3 != 3`,2 * (3 <> 3) AS `2 * (3 != 3)`,2 * 3 <> 3 AS `(2 * 3) != 3`
+select 2 * 3 != 3, 2 * (3 != 3), (2 * 3) != 3 union select * from v1;
+2 * 3 != 3 2 * (3 != 3) (2 * 3) != 3
+1 0 1
+create or replace view v1 as select 2 * 3 LIKE 3, 2 * (3 LIKE 3), (2 * 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 like 3 AS `2 * 3 LIKE 3`,2 * (3 like 3) AS `2 * (3 LIKE 3)`,2 * 3 like 3 AS `(2 * 3) LIKE 3`
+select 2 * 3 LIKE 3, 2 * (3 LIKE 3), (2 * 3) LIKE 3 union select * from v1;
+2 * 3 LIKE 3 2 * (3 LIKE 3) (2 * 3) LIKE 3
+0 2 0
+create or replace view v1 as select 2 * 3 REGEXP 3, 2 * (3 REGEXP 3), (2 * 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 regexp 3 AS `2 * 3 REGEXP 3`,2 * (3 regexp 3) AS `2 * (3 REGEXP 3)`,2 * 3 regexp 3 AS `(2 * 3) REGEXP 3`
+select 2 * 3 REGEXP 3, 2 * (3 REGEXP 3), (2 * 3) REGEXP 3 union select * from v1;
+2 * 3 REGEXP 3 2 * (3 REGEXP 3) (2 * 3) REGEXP 3
+0 2 0
+create or replace view v1 as select 2 * 3 | 3, 2 * (3 | 3), (2 * 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 | 3 AS `2 * 3 | 3`,2 * (3 | 3) AS `2 * (3 | 3)`,2 * 3 | 3 AS `(2 * 3) | 3`
+select 2 * 3 | 3, 2 * (3 | 3), (2 * 3) | 3 union select * from v1;
+2 * 3 | 3 2 * (3 | 3) (2 * 3) | 3
+7 6 7
+create or replace view v1 as select 2 * 3 & 3, 2 * (3 & 3), (2 * 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 & 3 AS `2 * 3 & 3`,2 * (3 & 3) AS `2 * (3 & 3)`,2 * 3 & 3 AS `(2 * 3) & 3`
+select 2 * 3 & 3, 2 * (3 & 3), (2 * 3) & 3 union select * from v1;
+2 * 3 & 3 2 * (3 & 3) (2 * 3) & 3
+2 6 2
+create or replace view v1 as select 2 * 3 >> 2, 2 * (3 >> 2), (2 * 3) >> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 >> 2 AS `2 * 3 >> 2`,2 * (3 >> 2) AS `2 * (3 >> 2)`,2 * 3 >> 2 AS `(2 * 3) >> 2`
+select 2 * 3 >> 2, 2 * (3 >> 2), (2 * 3) >> 2 union select * from v1;
+2 * 3 >> 2 2 * (3 >> 2) (2 * 3) >> 2
+1 0 1
+create or replace view v1 as select 2 * '2000-01-01' +INTERVAL 1 DAY, 2 * ('2000-01-01' +INTERVAL 1 DAY), (2 * '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * '2000-01-01' + interval 1 day AS `2 * '2000-01-01' +INTERVAL 1 DAY`,2 * ('2000-01-01' + interval 1 day) AS `2 * ('2000-01-01' +INTERVAL 1 DAY)`,2 * '2000-01-01' + interval 1 day AS `(2 * '2000-01-01') +INTERVAL 1 DAY`
+select 2 * '2000-01-01' +INTERVAL 1 DAY, 2 * ('2000-01-01' +INTERVAL 1 DAY), (2 * '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 * '2000-01-01' +INTERVAL 1 DAY 2 * ('2000-01-01' +INTERVAL 1 DAY) (2 * '2000-01-01') +INTERVAL 1 DAY
+NULL 40000204 NULL
+create or replace view v1 as select 2 * 3 + 3, 2 * (3 + 3), (2 * 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 + 3 AS `2 * 3 + 3`,2 * (3 + 3) AS `2 * (3 + 3)`,2 * 3 + 3 AS `(2 * 3) + 3`
+select 2 * 3 + 3, 2 * (3 + 3), (2 * 3) + 3 union select * from v1;
+2 * 3 + 3 2 * (3 + 3) (2 * 3) + 3
+9 12 9
+create or replace view v1 as select 2 * 3 - 3, 2 * (3 - 3), (2 * 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 - 3 AS `2 * 3 - 3`,2 * (3 - 3) AS `2 * (3 - 3)`,2 * 3 - 3 AS `(2 * 3) - 3`
+select 2 * 3 - 3, 2 * (3 - 3), (2 * 3) - 3 union select * from v1;
+2 * 3 - 3 2 * (3 - 3) (2 * 3) - 3
+3 0 3
+create or replace view v1 as select 2 * 3 DIV 2, 2 * (3 DIV 2), (2 * 3) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 DIV 2 AS `2 * 3 DIV 2`,2 * (3 DIV 2) AS `2 * (3 DIV 2)`,2 * 3 DIV 2 AS `(2 * 3) DIV 2`
+select 2 * 3 DIV 2, 2 * (3 DIV 2), (2 * 3) DIV 2 union select * from v1;
+2 * 3 DIV 2 2 * (3 DIV 2) (2 * 3) DIV 2
+3 2 3
+create or replace view v1 as select 2 * 3 MOD 2, 2 * (3 MOD 2), (2 * 3) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 % 2 AS `2 * 3 MOD 2`,2 * (3 % 2) AS `2 * (3 MOD 2)`,2 * 3 % 2 AS `(2 * 3) MOD 2`
+select 2 * 3 MOD 2, 2 * (3 MOD 2), (2 * 3) MOD 2 union select * from v1;
+2 * 3 MOD 2 2 * (3 MOD 2) (2 * 3) MOD 2
+0 2 0
+create or replace view v1 as select 2 * 3 % 2, 2 * (3 % 2), (2 * 3) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 % 2 AS `2 * 3 % 2`,2 * (3 % 2) AS `2 * (3 % 2)`,2 * 3 % 2 AS `(2 * 3) % 2`
+select 2 * 3 % 2, 2 * (3 % 2), (2 * 3) % 2 union select * from v1;
+2 * 3 % 2 2 * (3 % 2) (2 * 3) % 2
+0 2 0
+create or replace view v1 as select 2 * 3 ^ 3, 2 * (3 ^ 3), (2 * 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 ^ 3 AS `2 * 3 ^ 3`,2 * 3 ^ 3 AS `2 * (3 ^ 3)`,(2 * 3) ^ 3 AS `(2 * 3) ^ 3`
+select 2 * 3 ^ 3, 2 * (3 ^ 3), (2 * 3) ^ 3 union select * from v1;
+2 * 3 ^ 3 2 * (3 ^ 3) (2 * 3) ^ 3
+0 0 5
+create or replace view v1 as select 2 * 3 BETWEEN 1 AND 3, 2 * (3 BETWEEN 1 AND 3), (2 * 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 3 between 1 and 3 AS `2 * 3 BETWEEN 1 AND 3`,2 * (3 between 1 and 3) AS `2 * (3 BETWEEN 1 AND 3)`,2 * 3 between 1 and 3 AS `(2 * 3) BETWEEN 1 AND 3`
+select 2 * 3 BETWEEN 1 AND 3, 2 * (3 BETWEEN 1 AND 3), (2 * 3) BETWEEN 1 AND 3 union select * from v1;
+2 * 3 BETWEEN 1 AND 3 2 * (3 BETWEEN 1 AND 3) (2 * 3) BETWEEN 1 AND 3
+0 2 0
+create or replace view v1 as select 2 / 3 IS FALSE, 2 / (3 IS FALSE), (2 / 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 is false AS `2 / 3 IS FALSE`,2 / (3 is false) AS `2 / (3 IS FALSE)`,2 / 3 is false AS `(2 / 3) IS FALSE`
+select 2 / 3 IS FALSE, 2 / (3 IS FALSE), (2 / 3) IS FALSE union select * from v1;
+2 / 3 IS FALSE 2 / (3 IS FALSE) (2 / 3) IS FALSE
+0 NULL 0
+create or replace view v1 as select charset(2 / 3 COLLATE latin1_bin), charset(2 / (3 COLLATE latin1_bin)), charset((2 / 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 / 3 collate latin1_bin) AS `charset(2 / 3 COLLATE latin1_bin)`,charset(2 / 3 collate latin1_bin) AS `charset(2 / (3 COLLATE latin1_bin))`,charset((2 / 3) collate latin1_bin) AS `charset((2 / 3) COLLATE latin1_bin)`
+select charset(2 / 3 COLLATE latin1_bin), charset(2 / (3 COLLATE latin1_bin)), charset((2 / 3) COLLATE latin1_bin) union select * from v1;
+charset(2 / 3 COLLATE latin1_bin) charset(2 / (3 COLLATE latin1_bin)) charset((2 / 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 / 3 IN (0,1), 2 / (3 IN (0,1)), (2 / 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 in (0,1) AS `2 / 3 IN (0,1)`,2 / (3 in (0,1)) AS `2 / (3 IN (0,1))`,2 / 3 in (0,1) AS `(2 / 3) IN (0,1)`
+select 2 / 3 IN (0,1), 2 / (3 IN (0,1)), (2 / 3) IN (0,1) union select * from v1;
+2 / 3 IN (0,1) 2 / (3 IN (0,1)) (2 / 3) IN (0,1)
+0 NULL 0
+create or replace view v1 as select 2 / 3 OR 3, 2 / (3 OR 3), (2 / 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 or 3 AS `2 / 3 OR 3`,2 / (3 or 3) AS `2 / (3 OR 3)`,2 / 3 or 3 AS `(2 / 3) OR 3`
+select 2 / 3 OR 3, 2 / (3 OR 3), (2 / 3) OR 3 union select * from v1;
+2 / 3 OR 3 2 / (3 OR 3) (2 / 3) OR 3
+1 2.0000 1
+create or replace view v1 as select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 or 3 AS `2 / 3 || 3`,2 / (3 or 3) AS `2 / (3 || 3)`,2 / 3 or 3 AS `(2 / 3) || 3`
+select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3 union select * from v1;
+2 / 3 || 3 2 / (3 || 3) (2 / 3) || 3
+1 2.0000 1
+create or replace view v1 as select 2 / 3 XOR 3, 2 / (3 XOR 3), (2 / 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 xor 3 AS `2 / 3 XOR 3`,2 / (3 xor 3) AS `2 / (3 XOR 3)`,2 / 3 xor 3 AS `(2 / 3) XOR 3`
+select 2 / 3 XOR 3, 2 / (3 XOR 3), (2 / 3) XOR 3 union select * from v1;
+2 / 3 XOR 3 2 / (3 XOR 3) (2 / 3) XOR 3
+0 NULL 0
+create or replace view v1 as select 2 / 3 AND 3, 2 / (3 AND 3), (2 / 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 and 3 AS `2 / 3 AND 3`,2 / (3 and 3) AS `2 / (3 AND 3)`,2 / 3 and 3 AS `(2 / 3) AND 3`
+select 2 / 3 AND 3, 2 / (3 AND 3), (2 / 3) AND 3 union select * from v1;
+2 / 3 AND 3 2 / (3 AND 3) (2 / 3) AND 3
+1 2.0000 1
+create or replace view v1 as select 2 / 3 && 3, 2 / (3 && 3), (2 / 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 and 3 AS `2 / 3 && 3`,2 / (3 and 3) AS `2 / (3 && 3)`,2 / 3 and 3 AS `(2 / 3) && 3`
+select 2 / 3 && 3, 2 / (3 && 3), (2 / 3) && 3 union select * from v1;
+2 / 3 && 3 2 / (3 && 3) (2 / 3) && 3
+1 2.0000 1
+create or replace view v1 as select 2 / 3 = 3, 2 / (3 = 3), (2 / 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 = 3 AS `2 / 3 = 3`,2 / (3 = 3) AS `2 / (3 = 3)`,2 / 3 = 3 AS `(2 / 3) = 3`
+select 2 / 3 = 3, 2 / (3 = 3), (2 / 3) = 3 union select * from v1;
+2 / 3 = 3 2 / (3 = 3) (2 / 3) = 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 <=> 3, 2 / (3 <=> 3), (2 / 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 <=> 3 AS `2 / 3 <=> 3`,2 / (3 <=> 3) AS `2 / (3 <=> 3)`,2 / 3 <=> 3 AS `(2 / 3) <=> 3`
+select 2 / 3 <=> 3, 2 / (3 <=> 3), (2 / 3) <=> 3 union select * from v1;
+2 / 3 <=> 3 2 / (3 <=> 3) (2 / 3) <=> 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 >= 3, 2 / (3 >= 3), (2 / 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 >= 3 AS `2 / 3 >= 3`,2 / (3 >= 3) AS `2 / (3 >= 3)`,2 / 3 >= 3 AS `(2 / 3) >= 3`
+select 2 / 3 >= 3, 2 / (3 >= 3), (2 / 3) >= 3 union select * from v1;
+2 / 3 >= 3 2 / (3 >= 3) (2 / 3) >= 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 <= 3, 2 / (3 <= 3), (2 / 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 <= 3 AS `2 / 3 <= 3`,2 / (3 <= 3) AS `2 / (3 <= 3)`,2 / 3 <= 3 AS `(2 / 3) <= 3`
+select 2 / 3 <= 3, 2 / (3 <= 3), (2 / 3) <= 3 union select * from v1;
+2 / 3 <= 3 2 / (3 <= 3) (2 / 3) <= 3
+1 2.0000 1
+create or replace view v1 as select 2 / 3 < 3, 2 / (3 < 3), (2 / 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 < 3 AS `2 / 3 < 3`,2 / (3 < 3) AS `2 / (3 < 3)`,2 / 3 < 3 AS `(2 / 3) < 3`
+select 2 / 3 < 3, 2 / (3 < 3), (2 / 3) < 3 union select * from v1;
+2 / 3 < 3 2 / (3 < 3) (2 / 3) < 3
+1 NULL 1
+create or replace view v1 as select 2 / 3 <> 3, 2 / (3 <> 3), (2 / 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 <> 3 AS `2 / 3 <> 3`,2 / (3 <> 3) AS `2 / (3 <> 3)`,2 / 3 <> 3 AS `(2 / 3) <> 3`
+select 2 / 3 <> 3, 2 / (3 <> 3), (2 / 3) <> 3 union select * from v1;
+2 / 3 <> 3 2 / (3 <> 3) (2 / 3) <> 3
+1 NULL 1
+create or replace view v1 as select 2 / 3 > 3, 2 / (3 > 3), (2 / 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 > 3 AS `2 / 3 > 3`,2 / (3 > 3) AS `2 / (3 > 3)`,2 / 3 > 3 AS `(2 / 3) > 3`
+select 2 / 3 > 3, 2 / (3 > 3), (2 / 3) > 3 union select * from v1;
+2 / 3 > 3 2 / (3 > 3) (2 / 3) > 3
+0 NULL 0
+create or replace view v1 as select 2 / 3 != 3, 2 / (3 != 3), (2 / 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 <> 3 AS `2 / 3 != 3`,2 / (3 <> 3) AS `2 / (3 != 3)`,2 / 3 <> 3 AS `(2 / 3) != 3`
+select 2 / 3 != 3, 2 / (3 != 3), (2 / 3) != 3 union select * from v1;
+2 / 3 != 3 2 / (3 != 3) (2 / 3) != 3
+1 NULL 1
+create or replace view v1 as select 2 / 3 LIKE 3, 2 / (3 LIKE 3), (2 / 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 like 3 AS `2 / 3 LIKE 3`,2 / (3 like 3) AS `2 / (3 LIKE 3)`,2 / 3 like 3 AS `(2 / 3) LIKE 3`
+select 2 / 3 LIKE 3, 2 / (3 LIKE 3), (2 / 3) LIKE 3 union select * from v1;
+2 / 3 LIKE 3 2 / (3 LIKE 3) (2 / 3) LIKE 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 REGEXP 3, 2 / (3 REGEXP 3), (2 / 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 regexp 3 AS `2 / 3 REGEXP 3`,2 / (3 regexp 3) AS `2 / (3 REGEXP 3)`,2 / 3 regexp 3 AS `(2 / 3) REGEXP 3`
+select 2 / 3 REGEXP 3, 2 / (3 REGEXP 3), (2 / 3) REGEXP 3 union select * from v1;
+2 / 3 REGEXP 3 2 / (3 REGEXP 3) (2 / 3) REGEXP 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 | 3, 2 / (3 | 3), (2 / 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 | 3 AS `2 / 3 | 3`,2 / (3 | 3) AS `2 / (3 | 3)`,2 / 3 | 3 AS `(2 / 3) | 3`
+select 2 / 3 | 3, 2 / (3 | 3), (2 / 3) | 3 union select * from v1;
+2 / 3 | 3 2 / (3 | 3) (2 / 3) | 3
+3 0.6667 3
+create or replace view v1 as select 2 / 3 & 3, 2 / (3 & 3), (2 / 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 & 3 AS `2 / 3 & 3`,2 / (3 & 3) AS `2 / (3 & 3)`,2 / 3 & 3 AS `(2 / 3) & 3`
+select 2 / 3 & 3, 2 / (3 & 3), (2 / 3) & 3 union select * from v1;
+2 / 3 & 3 2 / (3 & 3) (2 / 3) & 3
+1 0.6667 1
+create or replace view v1 as select 2 / 3 << 3, 2 / (3 << 3), (2 / 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 << 3 AS `2 / 3 << 3`,2 / (3 << 3) AS `2 / (3 << 3)`,2 / 3 << 3 AS `(2 / 3) << 3`
+select 2 / 3 << 3, 2 / (3 << 3), (2 / 3) << 3 union select * from v1;
+2 / 3 << 3 2 / (3 << 3) (2 / 3) << 3
+8 0.0833 8
+create or replace view v1 as select 2 / 3 >> 3, 2 / (3 >> 3), (2 / 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 >> 3 AS `2 / 3 >> 3`,2 / (3 >> 3) AS `2 / (3 >> 3)`,2 / 3 >> 3 AS `(2 / 3) >> 3`
+select 2 / 3 >> 3, 2 / (3 >> 3), (2 / 3) >> 3 union select * from v1;
+2 / 3 >> 3 2 / (3 >> 3) (2 / 3) >> 3
+0 NULL 0
+create or replace view v1 as select 2 / '2000-01-01' +INTERVAL 1 DAY, 2 / ('2000-01-01' +INTERVAL 1 DAY), (2 / '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / '2000-01-01' + interval 1 day AS `2 / '2000-01-01' +INTERVAL 1 DAY`,2 / ('2000-01-01' + interval 1 day) AS `2 / ('2000-01-01' +INTERVAL 1 DAY)`,2 / '2000-01-01' + interval 1 day AS `(2 / '2000-01-01') +INTERVAL 1 DAY`
+select 2 / '2000-01-01' +INTERVAL 1 DAY, 2 / ('2000-01-01' +INTERVAL 1 DAY), (2 / '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 / '2000-01-01' +INTERVAL 1 DAY 2 / ('2000-01-01' +INTERVAL 1 DAY) (2 / '2000-01-01') +INTERVAL 1 DAY
+NULL 0.0000 NULL
+NULL 0.0000 NULL
+create or replace view v1 as select 2 / 3 + 3, 2 / (3 + 3), (2 / 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 + 3 AS `2 / 3 + 3`,2 / (3 + 3) AS `2 / (3 + 3)`,2 / 3 + 3 AS `(2 / 3) + 3`
+select 2 / 3 + 3, 2 / (3 + 3), (2 / 3) + 3 union select * from v1;
+2 / 3 + 3 2 / (3 + 3) (2 / 3) + 3
+3.6667 0.3333 3.6667
+create or replace view v1 as select 2 / 3 - 3, 2 / (3 - 3), (2 / 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 - 3 AS `2 / 3 - 3`,2 / (3 - 3) AS `2 / (3 - 3)`,2 / 3 - 3 AS `(2 / 3) - 3`
+select 2 / 3 - 3, 2 / (3 - 3), (2 / 3) - 3 union select * from v1;
+2 / 3 - 3 2 / (3 - 3) (2 / 3) - 3
+-2.3333 NULL -2.3333
+create or replace view v1 as select 2 / 3 * 3, 2 / (3 * 3), (2 / 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 * 3 AS `2 / 3 * 3`,2 / (3 * 3) AS `2 / (3 * 3)`,2 / 3 * 3 AS `(2 / 3) * 3`
+select 2 / 3 * 3, 2 / (3 * 3), (2 / 3) * 3 union select * from v1;
+2 / 3 * 3 2 / (3 * 3) (2 / 3) * 3
+2.0000 0.2222 2.0000
+create or replace view v1 as select 2 / 3 / 3, 2 / (3 / 3), (2 / 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 / 3 AS `2 / 3 / 3`,2 / (3 / 3) AS `2 / (3 / 3)`,2 / 3 / 3 AS `(2 / 3) / 3`
+select 2 / 3 / 3, 2 / (3 / 3), (2 / 3) / 3 union select * from v1;
+2 / 3 / 3 2 / (3 / 3) (2 / 3) / 3
+0.22222222 2.0000 0.22222222
+create or replace view v1 as select 2 / 3 DIV 3, 2 / (3 DIV 3), (2 / 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 DIV 3 AS `2 / 3 DIV 3`,2 / (3 DIV 3) AS `2 / (3 DIV 3)`,2 / 3 DIV 3 AS `(2 / 3) DIV 3`
+select 2 / 3 DIV 3, 2 / (3 DIV 3), (2 / 3) DIV 3 union select * from v1;
+2 / 3 DIV 3 2 / (3 DIV 3) (2 / 3) DIV 3
+0 2.0000 0
+create or replace view v1 as select 2 / 3 MOD 3, 2 / (3 MOD 3), (2 / 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 % 3 AS `2 / 3 MOD 3`,2 / (3 % 3) AS `2 / (3 MOD 3)`,2 / 3 % 3 AS `(2 / 3) MOD 3`
+select 2 / 3 MOD 3, 2 / (3 MOD 3), (2 / 3) MOD 3 union select * from v1;
+2 / 3 MOD 3 2 / (3 MOD 3) (2 / 3) MOD 3
+0.6667 NULL 0.6667
+create or replace view v1 as select 2 / 3 % 3, 2 / (3 % 3), (2 / 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 % 3 AS `2 / 3 % 3`,2 / (3 % 3) AS `2 / (3 % 3)`,2 / 3 % 3 AS `(2 / 3) % 3`
+select 2 / 3 % 3, 2 / (3 % 3), (2 / 3) % 3 union select * from v1;
+2 / 3 % 3 2 / (3 % 3) (2 / 3) % 3
+0.6667 NULL 0.6667
+create or replace view v1 as select 2 / 3 ^ 3, 2 / (3 ^ 3), (2 / 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 ^ 3 AS `2 / 3 ^ 3`,2 / 3 ^ 3 AS `2 / (3 ^ 3)`,(2 / 3) ^ 3 AS `(2 / 3) ^ 3`
+select 2 / 3 ^ 3, 2 / (3 ^ 3), (2 / 3) ^ 3 union select * from v1;
+2 / 3 ^ 3 2 / (3 ^ 3) (2 / 3) ^ 3
+NULL NULL 2
+create or replace view v1 as select 2 / 3 BETWEEN 1 AND 3, 2 / (3 BETWEEN 1 AND 3), (2 / 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 between 1 and 3 AS `2 / 3 BETWEEN 1 AND 3`,2 / (3 between 1 and 3) AS `2 / (3 BETWEEN 1 AND 3)`,2 / 3 between 1 and 3 AS `(2 / 3) BETWEEN 1 AND 3`
+select 2 / 3 BETWEEN 1 AND 3, 2 / (3 BETWEEN 1 AND 3), (2 / 3) BETWEEN 1 AND 3 union select * from v1;
+2 / 3 BETWEEN 1 AND 3 2 / (3 BETWEEN 1 AND 3) (2 / 3) BETWEEN 1 AND 3
+0 2.0000 0
+create or replace view v1 as select 2 DIV 3 IS FALSE, 2 DIV (3 IS FALSE), (2 DIV 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 is false AS `2 DIV 3 IS FALSE`,2 DIV (3 is false) AS `2 DIV (3 IS FALSE)`,2 DIV 3 is false AS `(2 DIV 3) IS FALSE`
+select 2 DIV 3 IS FALSE, 2 DIV (3 IS FALSE), (2 DIV 3) IS FALSE union select * from v1;
+2 DIV 3 IS FALSE 2 DIV (3 IS FALSE) (2 DIV 3) IS FALSE
+1 NULL 1
+create or replace view v1 as select charset(2 DIV 3 COLLATE latin1_bin), charset(2 DIV (3 COLLATE latin1_bin)), charset((2 DIV 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 DIV 3 collate latin1_bin) AS `charset(2 DIV 3 COLLATE latin1_bin)`,charset(2 DIV 3 collate latin1_bin) AS `charset(2 DIV (3 COLLATE latin1_bin))`,charset((2 DIV 3) collate latin1_bin) AS `charset((2 DIV 3) COLLATE latin1_bin)`
+select charset(2 DIV 3 COLLATE latin1_bin), charset(2 DIV (3 COLLATE latin1_bin)), charset((2 DIV 3) COLLATE latin1_bin) union select * from v1;
+charset(2 DIV 3 COLLATE latin1_bin) charset(2 DIV (3 COLLATE latin1_bin)) charset((2 DIV 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 DIV 3 IN (0,1), 2 DIV (3 IN (0,1)), (2 DIV 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 in (0,1) AS `2 DIV 3 IN (0,1)`,2 DIV (3 in (0,1)) AS `2 DIV (3 IN (0,1))`,2 DIV 3 in (0,1) AS `(2 DIV 3) IN (0,1)`
+select 2 DIV 3 IN (0,1), 2 DIV (3 IN (0,1)), (2 DIV 3) IN (0,1) union select * from v1;
+2 DIV 3 IN (0,1) 2 DIV (3 IN (0,1)) (2 DIV 3) IN (0,1)
+1 NULL 1
+create or replace view v1 as select 2 DIV 3 OR 3, 2 DIV (3 OR 3), (2 DIV 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 or 3 AS `2 DIV 3 OR 3`,2 DIV (3 or 3) AS `2 DIV (3 OR 3)`,2 DIV 3 or 3 AS `(2 DIV 3) OR 3`
+select 2 DIV 3 OR 3, 2 DIV (3 OR 3), (2 DIV 3) OR 3 union select * from v1;
+2 DIV 3 OR 3 2 DIV (3 OR 3) (2 DIV 3) OR 3
+1 2 1
+create or replace view v1 as select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 or 3 AS `2 DIV 3 || 3`,2 DIV (3 or 3) AS `2 DIV (3 || 3)`,2 DIV 3 or 3 AS `(2 DIV 3) || 3`
+select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3 union select * from v1;
+2 DIV 3 || 3 2 DIV (3 || 3) (2 DIV 3) || 3
+1 2 1
+create or replace view v1 as select 2 DIV 3 XOR 3, 2 DIV (3 XOR 3), (2 DIV 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 xor 3 AS `2 DIV 3 XOR 3`,2 DIV (3 xor 3) AS `2 DIV (3 XOR 3)`,2 DIV 3 xor 3 AS `(2 DIV 3) XOR 3`
+select 2 DIV 3 XOR 3, 2 DIV (3 XOR 3), (2 DIV 3) XOR 3 union select * from v1;
+2 DIV 3 XOR 3 2 DIV (3 XOR 3) (2 DIV 3) XOR 3
+1 NULL 1
+create or replace view v1 as select 2 DIV 3 AND 3, 2 DIV (3 AND 3), (2 DIV 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 and 3 AS `2 DIV 3 AND 3`,2 DIV (3 and 3) AS `2 DIV (3 AND 3)`,2 DIV 3 and 3 AS `(2 DIV 3) AND 3`
+select 2 DIV 3 AND 3, 2 DIV (3 AND 3), (2 DIV 3) AND 3 union select * from v1;
+2 DIV 3 AND 3 2 DIV (3 AND 3) (2 DIV 3) AND 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 && 3, 2 DIV (3 && 3), (2 DIV 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 and 3 AS `2 DIV 3 && 3`,2 DIV (3 and 3) AS `2 DIV (3 && 3)`,2 DIV 3 and 3 AS `(2 DIV 3) && 3`
+select 2 DIV 3 && 3, 2 DIV (3 && 3), (2 DIV 3) && 3 union select * from v1;
+2 DIV 3 && 3 2 DIV (3 && 3) (2 DIV 3) && 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 = 3, 2 DIV (3 = 3), (2 DIV 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 = 3 AS `2 DIV 3 = 3`,2 DIV (3 = 3) AS `2 DIV (3 = 3)`,2 DIV 3 = 3 AS `(2 DIV 3) = 3`
+select 2 DIV 3 = 3, 2 DIV (3 = 3), (2 DIV 3) = 3 union select * from v1;
+2 DIV 3 = 3 2 DIV (3 = 3) (2 DIV 3) = 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 <=> 3, 2 DIV (3 <=> 3), (2 DIV 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 <=> 3 AS `2 DIV 3 <=> 3`,2 DIV (3 <=> 3) AS `2 DIV (3 <=> 3)`,2 DIV 3 <=> 3 AS `(2 DIV 3) <=> 3`
+select 2 DIV 3 <=> 3, 2 DIV (3 <=> 3), (2 DIV 3) <=> 3 union select * from v1;
+2 DIV 3 <=> 3 2 DIV (3 <=> 3) (2 DIV 3) <=> 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 >= 3, 2 DIV (3 >= 3), (2 DIV 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 >= 3 AS `2 DIV 3 >= 3`,2 DIV (3 >= 3) AS `2 DIV (3 >= 3)`,2 DIV 3 >= 3 AS `(2 DIV 3) >= 3`
+select 2 DIV 3 >= 3, 2 DIV (3 >= 3), (2 DIV 3) >= 3 union select * from v1;
+2 DIV 3 >= 3 2 DIV (3 >= 3) (2 DIV 3) >= 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 <= 3, 2 DIV (3 <= 3), (2 DIV 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 <= 3 AS `2 DIV 3 <= 3`,2 DIV (3 <= 3) AS `2 DIV (3 <= 3)`,2 DIV 3 <= 3 AS `(2 DIV 3) <= 3`
+select 2 DIV 3 <= 3, 2 DIV (3 <= 3), (2 DIV 3) <= 3 union select * from v1;
+2 DIV 3 <= 3 2 DIV (3 <= 3) (2 DIV 3) <= 3
+1 2 1
+create or replace view v1 as select 2 DIV 3 < 3, 2 DIV (3 < 3), (2 DIV 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 < 3 AS `2 DIV 3 < 3`,2 DIV (3 < 3) AS `2 DIV (3 < 3)`,2 DIV 3 < 3 AS `(2 DIV 3) < 3`
+select 2 DIV 3 < 3, 2 DIV (3 < 3), (2 DIV 3) < 3 union select * from v1;
+2 DIV 3 < 3 2 DIV (3 < 3) (2 DIV 3) < 3
+1 NULL 1
+create or replace view v1 as select 2 DIV 3 <> 3, 2 DIV (3 <> 3), (2 DIV 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 <> 3 AS `2 DIV 3 <> 3`,2 DIV (3 <> 3) AS `2 DIV (3 <> 3)`,2 DIV 3 <> 3 AS `(2 DIV 3) <> 3`
+select 2 DIV 3 <> 3, 2 DIV (3 <> 3), (2 DIV 3) <> 3 union select * from v1;
+2 DIV 3 <> 3 2 DIV (3 <> 3) (2 DIV 3) <> 3
+1 NULL 1
+create or replace view v1 as select 2 DIV 3 > 3, 2 DIV (3 > 3), (2 DIV 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 > 3 AS `2 DIV 3 > 3`,2 DIV (3 > 3) AS `2 DIV (3 > 3)`,2 DIV 3 > 3 AS `(2 DIV 3) > 3`
+select 2 DIV 3 > 3, 2 DIV (3 > 3), (2 DIV 3) > 3 union select * from v1;
+2 DIV 3 > 3 2 DIV (3 > 3) (2 DIV 3) > 3
+0 NULL 0
+create or replace view v1 as select 2 DIV 3 != 3, 2 DIV (3 != 3), (2 DIV 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 <> 3 AS `2 DIV 3 != 3`,2 DIV (3 <> 3) AS `2 DIV (3 != 3)`,2 DIV 3 <> 3 AS `(2 DIV 3) != 3`
+select 2 DIV 3 != 3, 2 DIV (3 != 3), (2 DIV 3) != 3 union select * from v1;
+2 DIV 3 != 3 2 DIV (3 != 3) (2 DIV 3) != 3
+1 NULL 1
+create or replace view v1 as select 2 DIV 3 LIKE 3, 2 DIV (3 LIKE 3), (2 DIV 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 like 3 AS `2 DIV 3 LIKE 3`,2 DIV (3 like 3) AS `2 DIV (3 LIKE 3)`,2 DIV 3 like 3 AS `(2 DIV 3) LIKE 3`
+select 2 DIV 3 LIKE 3, 2 DIV (3 LIKE 3), (2 DIV 3) LIKE 3 union select * from v1;
+2 DIV 3 LIKE 3 2 DIV (3 LIKE 3) (2 DIV 3) LIKE 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 REGEXP 3, 2 DIV (3 REGEXP 3), (2 DIV 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 regexp 3 AS `2 DIV 3 REGEXP 3`,2 DIV (3 regexp 3) AS `2 DIV (3 REGEXP 3)`,2 DIV 3 regexp 3 AS `(2 DIV 3) REGEXP 3`
+select 2 DIV 3 REGEXP 3, 2 DIV (3 REGEXP 3), (2 DIV 3) REGEXP 3 union select * from v1;
+2 DIV 3 REGEXP 3 2 DIV (3 REGEXP 3) (2 DIV 3) REGEXP 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 | 3, 2 DIV (3 | 3), (2 DIV 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 | 3 AS `2 DIV 3 | 3`,2 DIV (3 | 3) AS `2 DIV (3 | 3)`,2 DIV 3 | 3 AS `(2 DIV 3) | 3`
+select 2 DIV 3 | 3, 2 DIV (3 | 3), (2 DIV 3) | 3 union select * from v1;
+2 DIV 3 | 3 2 DIV (3 | 3) (2 DIV 3) | 3
+3 0 3
+create or replace view v1 as select 2 DIV 3 & 1, 2 DIV (3 & 1), (2 DIV 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 & 1 AS `2 DIV 3 & 1`,2 DIV (3 & 1) AS `2 DIV (3 & 1)`,2 DIV 3 & 1 AS `(2 DIV 3) & 1`
+select 2 DIV 3 & 1, 2 DIV (3 & 1), (2 DIV 3) & 1 union select * from v1;
+2 DIV 3 & 1 2 DIV (3 & 1) (2 DIV 3) & 1
+0 2 0
+create or replace view v1 as select 4 DIV 3 << 3, 4 DIV (3 << 3), (4 DIV 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 DIV 3 << 3 AS `4 DIV 3 << 3`,4 DIV (3 << 3) AS `4 DIV (3 << 3)`,4 DIV 3 << 3 AS `(4 DIV 3) << 3`
+select 4 DIV 3 << 3, 4 DIV (3 << 3), (4 DIV 3) << 3 union select * from v1;
+4 DIV 3 << 3 4 DIV (3 << 3) (4 DIV 3) << 3
+8 0 8
+create or replace view v1 as select 2 DIV 3 >> 3, 2 DIV (3 >> 3), (2 DIV 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 >> 3 AS `2 DIV 3 >> 3`,2 DIV (3 >> 3) AS `2 DIV (3 >> 3)`,2 DIV 3 >> 3 AS `(2 DIV 3) >> 3`
+select 2 DIV 3 >> 3, 2 DIV (3 >> 3), (2 DIV 3) >> 3 union select * from v1;
+2 DIV 3 >> 3 2 DIV (3 >> 3) (2 DIV 3) >> 3
+0 NULL 0
+create or replace view v1 as select 2 DIV '2000-01-01' +INTERVAL 1 DAY, 2 DIV ('2000-01-01' +INTERVAL 1 DAY), (2 DIV '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV '2000-01-01' + interval 1 day AS `2 DIV '2000-01-01' +INTERVAL 1 DAY`,2 DIV ('2000-01-01' + interval 1 day) AS `2 DIV ('2000-01-01' +INTERVAL 1 DAY)`,2 DIV '2000-01-01' + interval 1 day AS `(2 DIV '2000-01-01') +INTERVAL 1 DAY`
+select 2 DIV '2000-01-01' +INTERVAL 1 DAY, 2 DIV ('2000-01-01' +INTERVAL 1 DAY), (2 DIV '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 DIV '2000-01-01' +INTERVAL 1 DAY 2 DIV ('2000-01-01' +INTERVAL 1 DAY) (2 DIV '2000-01-01') +INTERVAL 1 DAY
+NULL 0 NULL
+create or replace view v1 as select 2 DIV 3 + 3, 2 DIV (3 + 3), (2 DIV 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 + 3 AS `2 DIV 3 + 3`,2 DIV (3 + 3) AS `2 DIV (3 + 3)`,2 DIV 3 + 3 AS `(2 DIV 3) + 3`
+select 2 DIV 3 + 3, 2 DIV (3 + 3), (2 DIV 3) + 3 union select * from v1;
+2 DIV 3 + 3 2 DIV (3 + 3) (2 DIV 3) + 3
+3 0 3
+create or replace view v1 as select 2 DIV 3 - 3, 2 DIV (3 - 3), (2 DIV 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 - 3 AS `2 DIV 3 - 3`,2 DIV (3 - 3) AS `2 DIV (3 - 3)`,2 DIV 3 - 3 AS `(2 DIV 3) - 3`
+select 2 DIV 3 - 3, 2 DIV (3 - 3), (2 DIV 3) - 3 union select * from v1;
+2 DIV 3 - 3 2 DIV (3 - 3) (2 DIV 3) - 3
+-3 NULL -3
+create or replace view v1 as select 4 DIV 3 * 3, 4 DIV (3 * 3), (4 DIV 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 4 DIV 3 * 3 AS `4 DIV 3 * 3`,4 DIV (3 * 3) AS `4 DIV (3 * 3)`,4 DIV 3 * 3 AS `(4 DIV 3) * 3`
+select 4 DIV 3 * 3, 4 DIV (3 * 3), (4 DIV 3) * 3 union select * from v1;
+4 DIV 3 * 3 4 DIV (3 * 3) (4 DIV 3) * 3
+3 0 3
+create or replace view v1 as select 2 DIV 3 / 3, 2 DIV (3 / 3), (2 DIV 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 / 3 AS `2 DIV 3 / 3`,2 DIV (3 / 3) AS `2 DIV (3 / 3)`,2 DIV 3 / 3 AS `(2 DIV 3) / 3`
+select 2 DIV 3 / 3, 2 DIV (3 / 3), (2 DIV 3) / 3 union select * from v1;
+2 DIV 3 / 3 2 DIV (3 / 3) (2 DIV 3) / 3
+0.0000 2 0.0000
+create or replace view v1 as select 2 DIV 3 DIV 3, 2 DIV (3 DIV 3), (2 DIV 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 DIV 3 AS `2 DIV 3 DIV 3`,2 DIV (3 DIV 3) AS `2 DIV (3 DIV 3)`,2 DIV 3 DIV 3 AS `(2 DIV 3) DIV 3`
+select 2 DIV 3 DIV 3, 2 DIV (3 DIV 3), (2 DIV 3) DIV 3 union select * from v1;
+2 DIV 3 DIV 3 2 DIV (3 DIV 3) (2 DIV 3) DIV 3
+0 2 0
+create or replace view v1 as select 2 DIV 3 MOD 3, 2 DIV (3 MOD 3), (2 DIV 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 % 3 AS `2 DIV 3 MOD 3`,2 DIV (3 % 3) AS `2 DIV (3 MOD 3)`,2 DIV 3 % 3 AS `(2 DIV 3) MOD 3`
+select 2 DIV 3 MOD 3, 2 DIV (3 MOD 3), (2 DIV 3) MOD 3 union select * from v1;
+2 DIV 3 MOD 3 2 DIV (3 MOD 3) (2 DIV 3) MOD 3
+0 NULL 0
+create or replace view v1 as select 2 DIV 3 % 3, 2 DIV (3 % 3), (2 DIV 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 % 3 AS `2 DIV 3 % 3`,2 DIV (3 % 3) AS `2 DIV (3 % 3)`,2 DIV 3 % 3 AS `(2 DIV 3) % 3`
+select 2 DIV 3 % 3, 2 DIV (3 % 3), (2 DIV 3) % 3 union select * from v1;
+2 DIV 3 % 3 2 DIV (3 % 3) (2 DIV 3) % 3
+0 NULL 0
+create or replace view v1 as select 2 DIV 3 ^ 3, 2 DIV (3 ^ 3), (2 DIV 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 ^ 3 AS `2 DIV 3 ^ 3`,2 DIV 3 ^ 3 AS `2 DIV (3 ^ 3)`,(2 DIV 3) ^ 3 AS `(2 DIV 3) ^ 3`
+select 2 DIV 3 ^ 3, 2 DIV (3 ^ 3), (2 DIV 3) ^ 3 union select * from v1;
+2 DIV 3 ^ 3 2 DIV (3 ^ 3) (2 DIV 3) ^ 3
+NULL NULL 3
+create or replace view v1 as select 2 DIV 3 BETWEEN 1 AND 3, 2 DIV (3 BETWEEN 1 AND 3), (2 DIV 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 between 1 and 3 AS `2 DIV 3 BETWEEN 1 AND 3`,2 DIV (3 between 1 and 3) AS `2 DIV (3 BETWEEN 1 AND 3)`,2 DIV 3 between 1 and 3 AS `(2 DIV 3) BETWEEN 1 AND 3`
+select 2 DIV 3 BETWEEN 1 AND 3, 2 DIV (3 BETWEEN 1 AND 3), (2 DIV 3) BETWEEN 1 AND 3 union select * from v1;
+2 DIV 3 BETWEEN 1 AND 3 2 DIV (3 BETWEEN 1 AND 3) (2 DIV 3) BETWEEN 1 AND 3
+0 2 0
+create or replace view v1 as select 2 MOD 3 IS FALSE, 2 MOD (3 IS FALSE), (2 MOD 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 is false AS `2 MOD 3 IS FALSE`,2 % (3 is false) AS `2 MOD (3 IS FALSE)`,2 % 3 is false AS `(2 MOD 3) IS FALSE`
+select 2 MOD 3 IS FALSE, 2 MOD (3 IS FALSE), (2 MOD 3) IS FALSE union select * from v1;
+2 MOD 3 IS FALSE 2 MOD (3 IS FALSE) (2 MOD 3) IS FALSE
+0 NULL 0
+create or replace view v1 as select charset(2 MOD 3 COLLATE latin1_bin), charset(2 MOD (3 COLLATE latin1_bin)), charset((2 MOD 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 % 3 collate latin1_bin) AS `charset(2 MOD 3 COLLATE latin1_bin)`,charset(2 % 3 collate latin1_bin) AS `charset(2 MOD (3 COLLATE latin1_bin))`,charset((2 % 3) collate latin1_bin) AS `charset((2 MOD 3) COLLATE latin1_bin)`
+select charset(2 MOD 3 COLLATE latin1_bin), charset(2 MOD (3 COLLATE latin1_bin)), charset((2 MOD 3) COLLATE latin1_bin) union select * from v1;
+charset(2 MOD 3 COLLATE latin1_bin) charset(2 MOD (3 COLLATE latin1_bin)) charset((2 MOD 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 MOD 3 IN (0,1), 2 MOD (3 IN (0,1)), (2 MOD 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 in (0,1) AS `2 MOD 3 IN (0,1)`,2 % (3 in (0,1)) AS `2 MOD (3 IN (0,1))`,2 % 3 in (0,1) AS `(2 MOD 3) IN (0,1)`
+select 2 MOD 3 IN (0,1), 2 MOD (3 IN (0,1)), (2 MOD 3) IN (0,1) union select * from v1;
+2 MOD 3 IN (0,1) 2 MOD (3 IN (0,1)) (2 MOD 3) IN (0,1)
+0 NULL 0
+create or replace view v1 as select 2 MOD 3 OR 3, 2 MOD (3 OR 3), (2 MOD 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 or 3 AS `2 MOD 3 OR 3`,2 % (3 or 3) AS `2 MOD (3 OR 3)`,2 % 3 or 3 AS `(2 MOD 3) OR 3`
+select 2 MOD 3 OR 3, 2 MOD (3 OR 3), (2 MOD 3) OR 3 union select * from v1;
+2 MOD 3 OR 3 2 MOD (3 OR 3) (2 MOD 3) OR 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 or 3 AS `2 MOD 3 || 3`,2 % (3 or 3) AS `2 MOD (3 || 3)`,2 % 3 or 3 AS `(2 MOD 3) || 3`
+select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3 union select * from v1;
+2 MOD 3 || 3 2 MOD (3 || 3) (2 MOD 3) || 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 XOR 3, 2 MOD (3 XOR 3), (2 MOD 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 xor 3 AS `2 MOD 3 XOR 3`,2 % (3 xor 3) AS `2 MOD (3 XOR 3)`,2 % 3 xor 3 AS `(2 MOD 3) XOR 3`
+select 2 MOD 3 XOR 3, 2 MOD (3 XOR 3), (2 MOD 3) XOR 3 union select * from v1;
+2 MOD 3 XOR 3 2 MOD (3 XOR 3) (2 MOD 3) XOR 3
+0 NULL 0
+create or replace view v1 as select 2 MOD 3 AND 3, 2 MOD (3 AND 3), (2 MOD 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 and 3 AS `2 MOD 3 AND 3`,2 % (3 and 3) AS `2 MOD (3 AND 3)`,2 % 3 and 3 AS `(2 MOD 3) AND 3`
+select 2 MOD 3 AND 3, 2 MOD (3 AND 3), (2 MOD 3) AND 3 union select * from v1;
+2 MOD 3 AND 3 2 MOD (3 AND 3) (2 MOD 3) AND 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 && 3, 2 MOD (3 && 3), (2 MOD 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 and 3 AS `2 MOD 3 && 3`,2 % (3 and 3) AS `2 MOD (3 && 3)`,2 % 3 and 3 AS `(2 MOD 3) && 3`
+select 2 MOD 3 && 3, 2 MOD (3 && 3), (2 MOD 3) && 3 union select * from v1;
+2 MOD 3 && 3 2 MOD (3 && 3) (2 MOD 3) && 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 = 2, 2 MOD (3 = 2), (2 MOD 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 = 2 AS `2 MOD 3 = 2`,2 % (3 = 2) AS `2 MOD (3 = 2)`,2 % 3 = 2 AS `(2 MOD 3) = 2`
+select 2 MOD 3 = 2, 2 MOD (3 = 2), (2 MOD 3) = 2 union select * from v1;
+2 MOD 3 = 2 2 MOD (3 = 2) (2 MOD 3) = 2
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 <=> 2, 2 MOD (3 <=> 2), (2 MOD 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <=> 2 AS `2 MOD 3 <=> 2`,2 % (3 <=> 2) AS `2 MOD (3 <=> 2)`,2 % 3 <=> 2 AS `(2 MOD 3) <=> 2`
+select 2 MOD 3 <=> 2, 2 MOD (3 <=> 2), (2 MOD 3) <=> 2 union select * from v1;
+2 MOD 3 <=> 2 2 MOD (3 <=> 2) (2 MOD 3) <=> 2
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 >= 1, 2 MOD (3 >= 1), (2 MOD 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 >= 1 AS `2 MOD 3 >= 1`,2 % (3 >= 1) AS `2 MOD (3 >= 1)`,2 % 3 >= 1 AS `(2 MOD 3) >= 1`
+select 2 MOD 3 >= 1, 2 MOD (3 >= 1), (2 MOD 3) >= 1 union select * from v1;
+2 MOD 3 >= 1 2 MOD (3 >= 1) (2 MOD 3) >= 1
+1 0 1
+create or replace view v1 as select 2 MOD 3 <= 3, 2 MOD (3 <= 3), (2 MOD 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <= 3 AS `2 MOD 3 <= 3`,2 % (3 <= 3) AS `2 MOD (3 <= 3)`,2 % 3 <= 3 AS `(2 MOD 3) <= 3`
+select 2 MOD 3 <= 3, 2 MOD (3 <= 3), (2 MOD 3) <= 3 union select * from v1;
+2 MOD 3 <= 3 2 MOD (3 <= 3) (2 MOD 3) <= 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 < 3, 2 MOD (3 < 3), (2 MOD 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 < 3 AS `2 MOD 3 < 3`,2 % (3 < 3) AS `2 MOD (3 < 3)`,2 % 3 < 3 AS `(2 MOD 3) < 3`
+select 2 MOD 3 < 3, 2 MOD (3 < 3), (2 MOD 3) < 3 union select * from v1;
+2 MOD 3 < 3 2 MOD (3 < 3) (2 MOD 3) < 3
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 <> 3, 2 MOD (3 <> 3), (2 MOD 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <> 3 AS `2 MOD 3 <> 3`,2 % (3 <> 3) AS `2 MOD (3 <> 3)`,2 % 3 <> 3 AS `(2 MOD 3) <> 3`
+select 2 MOD 3 <> 3, 2 MOD (3 <> 3), (2 MOD 3) <> 3 union select * from v1;
+2 MOD 3 <> 3 2 MOD (3 <> 3) (2 MOD 3) <> 3
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 > 3, 2 MOD (3 > 3), (2 MOD 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 > 3 AS `2 MOD 3 > 3`,2 % (3 > 3) AS `2 MOD (3 > 3)`,2 % 3 > 3 AS `(2 MOD 3) > 3`
+select 2 MOD 3 > 3, 2 MOD (3 > 3), (2 MOD 3) > 3 union select * from v1;
+2 MOD 3 > 3 2 MOD (3 > 3) (2 MOD 3) > 3
+0 NULL 0
+create or replace view v1 as select 2 MOD 3 != 3, 2 MOD (3 != 3), (2 MOD 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <> 3 AS `2 MOD 3 != 3`,2 % (3 <> 3) AS `2 MOD (3 != 3)`,2 % 3 <> 3 AS `(2 MOD 3) != 3`
+select 2 MOD 3 != 3, 2 MOD (3 != 3), (2 MOD 3) != 3 union select * from v1;
+2 MOD 3 != 3 2 MOD (3 != 3) (2 MOD 3) != 3
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 LIKE 2, 2 MOD (3 LIKE 2), (2 MOD 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 like 2 AS `2 MOD 3 LIKE 2`,2 % (3 like 2) AS `2 MOD (3 LIKE 2)`,2 % 3 like 2 AS `(2 MOD 3) LIKE 2`
+select 2 MOD 3 LIKE 2, 2 MOD (3 LIKE 2), (2 MOD 3) LIKE 2 union select * from v1;
+2 MOD 3 LIKE 2 2 MOD (3 LIKE 2) (2 MOD 3) LIKE 2
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 REGEXP 2, 2 MOD (3 REGEXP 2), (2 MOD 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 regexp 2 AS `2 MOD 3 REGEXP 2`,2 % (3 regexp 2) AS `2 MOD (3 REGEXP 2)`,2 % 3 regexp 2 AS `(2 MOD 3) REGEXP 2`
+select 2 MOD 3 REGEXP 2, 2 MOD (3 REGEXP 2), (2 MOD 3) REGEXP 2 union select * from v1;
+2 MOD 3 REGEXP 2 2 MOD (3 REGEXP 2) (2 MOD 3) REGEXP 2
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 | 3, 2 MOD (3 | 3), (2 MOD 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 | 3 AS `2 MOD 3 | 3`,2 % (3 | 3) AS `2 MOD (3 | 3)`,2 % 3 | 3 AS `(2 MOD 3) | 3`
+select 2 MOD 3 | 3, 2 MOD (3 | 3), (2 MOD 3) | 3 union select * from v1;
+2 MOD 3 | 3 2 MOD (3 | 3) (2 MOD 3) | 3
+3 2 3
+create or replace view v1 as select 2 MOD 4 & 4, 2 MOD (4 & 4), (2 MOD 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 4 & 4 AS `2 MOD 4 & 4`,2 % (4 & 4) AS `2 MOD (4 & 4)`,2 % 4 & 4 AS `(2 MOD 4) & 4`
+select 2 MOD 4 & 4, 2 MOD (4 & 4), (2 MOD 4) & 4 union select * from v1;
+2 MOD 4 & 4 2 MOD (4 & 4) (2 MOD 4) & 4
+0 2 0
+create or replace view v1 as select 2 MOD 3 << 3, 2 MOD (3 << 3), (2 MOD 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 << 3 AS `2 MOD 3 << 3`,2 % (3 << 3) AS `2 MOD (3 << 3)`,2 % 3 << 3 AS `(2 MOD 3) << 3`
+select 2 MOD 3 << 3, 2 MOD (3 << 3), (2 MOD 3) << 3 union select * from v1;
+2 MOD 3 << 3 2 MOD (3 << 3) (2 MOD 3) << 3
+16 2 16
+create or replace view v1 as select 2 MOD 3 >> 3, 2 MOD (3 >> 3), (2 MOD 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 >> 3 AS `2 MOD 3 >> 3`,2 % (3 >> 3) AS `2 MOD (3 >> 3)`,2 % 3 >> 3 AS `(2 MOD 3) >> 3`
+select 2 MOD 3 >> 3, 2 MOD (3 >> 3), (2 MOD 3) >> 3 union select * from v1;
+2 MOD 3 >> 3 2 MOD (3 >> 3) (2 MOD 3) >> 3
+0 NULL 0
+create or replace view v1 as select 2 MOD '2000-01-01' +INTERVAL 1 DAY, 2 MOD ('2000-01-01' +INTERVAL 1 DAY), (2 MOD '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % '2000-01-01' + interval 1 day AS `2 MOD '2000-01-01' +INTERVAL 1 DAY`,2 % ('2000-01-01' + interval 1 day) AS `2 MOD ('2000-01-01' +INTERVAL 1 DAY)`,2 % '2000-01-01' + interval 1 day AS `(2 MOD '2000-01-01') +INTERVAL 1 DAY`
+select 2 MOD '2000-01-01' +INTERVAL 1 DAY, 2 MOD ('2000-01-01' +INTERVAL 1 DAY), (2 MOD '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 MOD '2000-01-01' +INTERVAL 1 DAY 2 MOD ('2000-01-01' +INTERVAL 1 DAY) (2 MOD '2000-01-01') +INTERVAL 1 DAY
+NULL 2 NULL
+create or replace view v1 as select 2 MOD 3 + 3, 2 MOD (3 + 3), (2 MOD 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 + 3 AS `2 MOD 3 + 3`,2 % (3 + 3) AS `2 MOD (3 + 3)`,2 % 3 + 3 AS `(2 MOD 3) + 3`
+select 2 MOD 3 + 3, 2 MOD (3 + 3), (2 MOD 3) + 3 union select * from v1;
+2 MOD 3 + 3 2 MOD (3 + 3) (2 MOD 3) + 3
+5 2 5
+create or replace view v1 as select 2 MOD 3 - 3, 2 MOD (3 - 3), (2 MOD 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 - 3 AS `2 MOD 3 - 3`,2 % (3 - 3) AS `2 MOD (3 - 3)`,2 % 3 - 3 AS `(2 MOD 3) - 3`
+select 2 MOD 3 - 3, 2 MOD (3 - 3), (2 MOD 3) - 3 union select * from v1;
+2 MOD 3 - 3 2 MOD (3 - 3) (2 MOD 3) - 3
+-1 NULL -1
+create or replace view v1 as select 2 MOD 3 * 3, 2 MOD (3 * 3), (2 MOD 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 * 3 AS `2 MOD 3 * 3`,2 % (3 * 3) AS `2 MOD (3 * 3)`,2 % 3 * 3 AS `(2 MOD 3) * 3`
+select 2 MOD 3 * 3, 2 MOD (3 * 3), (2 MOD 3) * 3 union select * from v1;
+2 MOD 3 * 3 2 MOD (3 * 3) (2 MOD 3) * 3
+6 2 6
+create or replace view v1 as select 2 MOD 3 / 3, 2 MOD (3 / 3), (2 MOD 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 / 3 AS `2 MOD 3 / 3`,2 % (3 / 3) AS `2 MOD (3 / 3)`,2 % 3 / 3 AS `(2 MOD 3) / 3`
+select 2 MOD 3 / 3, 2 MOD (3 / 3), (2 MOD 3) / 3 union select * from v1;
+2 MOD 3 / 3 2 MOD (3 / 3) (2 MOD 3) / 3
+0.6667 0.0000 0.6667
+create or replace view v1 as select 3 MOD 4 DIV 3, 3 MOD (4 DIV 3), (3 MOD 4) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 % 4 DIV 3 AS `3 MOD 4 DIV 3`,3 % (4 DIV 3) AS `3 MOD (4 DIV 3)`,3 % 4 DIV 3 AS `(3 MOD 4) DIV 3`
+select 3 MOD 4 DIV 3, 3 MOD (4 DIV 3), (3 MOD 4) DIV 3 union select * from v1;
+3 MOD 4 DIV 3 3 MOD (4 DIV 3) (3 MOD 4) DIV 3
+1 0 1
+create or replace view v1 as select 2 MOD 3 MOD 3, 2 MOD (3 MOD 3), (2 MOD 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 % 3 AS `2 MOD 3 MOD 3`,2 % (3 % 3) AS `2 MOD (3 MOD 3)`,2 % 3 % 3 AS `(2 MOD 3) MOD 3`
+select 2 MOD 3 MOD 3, 2 MOD (3 MOD 3), (2 MOD 3) MOD 3 union select * from v1;
+2 MOD 3 MOD 3 2 MOD (3 MOD 3) (2 MOD 3) MOD 3
+2 NULL 2
+create or replace view v1 as select 2 MOD 3 % 3, 2 MOD (3 % 3), (2 MOD 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 % 3 AS `2 MOD 3 % 3`,2 % (3 % 3) AS `2 MOD (3 % 3)`,2 % 3 % 3 AS `(2 MOD 3) % 3`
+select 2 MOD 3 % 3, 2 MOD (3 % 3), (2 MOD 3) % 3 union select * from v1;
+2 MOD 3 % 3 2 MOD (3 % 3) (2 MOD 3) % 3
+2 NULL 2
+create or replace view v1 as select 2 MOD 3 ^ 3, 2 MOD (3 ^ 3), (2 MOD 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 ^ 3 AS `2 MOD 3 ^ 3`,2 % 3 ^ 3 AS `2 MOD (3 ^ 3)`,(2 % 3) ^ 3 AS `(2 MOD 3) ^ 3`
+select 2 MOD 3 ^ 3, 2 MOD (3 ^ 3), (2 MOD 3) ^ 3 union select * from v1;
+2 MOD 3 ^ 3 2 MOD (3 ^ 3) (2 MOD 3) ^ 3
+NULL NULL 1
+create or replace view v1 as select 2 MOD 3 BETWEEN 1 AND 3, 2 MOD (3 BETWEEN 1 AND 3), (2 MOD 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 between 1 and 3 AS `2 MOD 3 BETWEEN 1 AND 3`,2 % (3 between 1 and 3) AS `2 MOD (3 BETWEEN 1 AND 3)`,2 % 3 between 1 and 3 AS `(2 MOD 3) BETWEEN 1 AND 3`
+select 2 MOD 3 BETWEEN 1 AND 3, 2 MOD (3 BETWEEN 1 AND 3), (2 MOD 3) BETWEEN 1 AND 3 union select * from v1;
+2 MOD 3 BETWEEN 1 AND 3 2 MOD (3 BETWEEN 1 AND 3) (2 MOD 3) BETWEEN 1 AND 3
+1 0 1
+create or replace view v1 as select 2 % 3 IS FALSE, 2 % (3 IS FALSE), (2 % 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 is false AS `2 % 3 IS FALSE`,2 % (3 is false) AS `2 % (3 IS FALSE)`,2 % 3 is false AS `(2 % 3) IS FALSE`
+select 2 % 3 IS FALSE, 2 % (3 IS FALSE), (2 % 3) IS FALSE union select * from v1;
+2 % 3 IS FALSE 2 % (3 IS FALSE) (2 % 3) IS FALSE
+0 NULL 0
+create or replace view v1 as select charset(2 % 3 COLLATE latin1_bin), charset(2 % (3 COLLATE latin1_bin)), charset((2 % 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 % 3 collate latin1_bin) AS `charset(2 % 3 COLLATE latin1_bin)`,charset(2 % 3 collate latin1_bin) AS `charset(2 % (3 COLLATE latin1_bin))`,charset((2 % 3) collate latin1_bin) AS `charset((2 % 3) COLLATE latin1_bin)`
+select charset(2 % 3 COLLATE latin1_bin), charset(2 % (3 COLLATE latin1_bin)), charset((2 % 3) COLLATE latin1_bin) union select * from v1;
+charset(2 % 3 COLLATE latin1_bin) charset(2 % (3 COLLATE latin1_bin)) charset((2 % 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 % 3 IN (0,1), 2 % (3 IN (0,1)), (2 % 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 in (0,1) AS `2 % 3 IN (0,1)`,2 % (3 in (0,1)) AS `2 % (3 IN (0,1))`,2 % 3 in (0,1) AS `(2 % 3) IN (0,1)`
+select 2 % 3 IN (0,1), 2 % (3 IN (0,1)), (2 % 3) IN (0,1) union select * from v1;
+2 % 3 IN (0,1) 2 % (3 IN (0,1)) (2 % 3) IN (0,1)
+0 NULL 0
+create or replace view v1 as select 2 % 3 OR 3, 2 % (3 OR 3), (2 % 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 or 3 AS `2 % 3 OR 3`,2 % (3 or 3) AS `2 % (3 OR 3)`,2 % 3 or 3 AS `(2 % 3) OR 3`
+select 2 % 3 OR 3, 2 % (3 OR 3), (2 % 3) OR 3 union select * from v1;
+2 % 3 OR 3 2 % (3 OR 3) (2 % 3) OR 3
+1 0 1
+create or replace view v1 as select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 or 3 AS `2 % 3 || 3`,2 % (3 or 3) AS `2 % (3 || 3)`,2 % 3 or 3 AS `(2 % 3) || 3`
+select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3 union select * from v1;
+2 % 3 || 3 2 % (3 || 3) (2 % 3) || 3
+1 0 1
+create or replace view v1 as select 2 % 3 XOR 3, 2 % (3 XOR 3), (2 % 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 xor 3 AS `2 % 3 XOR 3`,2 % (3 xor 3) AS `2 % (3 XOR 3)`,2 % 3 xor 3 AS `(2 % 3) XOR 3`
+select 2 % 3 XOR 3, 2 % (3 XOR 3), (2 % 3) XOR 3 union select * from v1;
+2 % 3 XOR 3 2 % (3 XOR 3) (2 % 3) XOR 3
+0 NULL 0
+create or replace view v1 as select 2 % 3 AND 3, 2 % (3 AND 3), (2 % 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 and 3 AS `2 % 3 AND 3`,2 % (3 and 3) AS `2 % (3 AND 3)`,2 % 3 and 3 AS `(2 % 3) AND 3`
+select 2 % 3 AND 3, 2 % (3 AND 3), (2 % 3) AND 3 union select * from v1;
+2 % 3 AND 3 2 % (3 AND 3) (2 % 3) AND 3
+1 0 1
+create or replace view v1 as select 2 % 3 && 3, 2 % (3 && 3), (2 % 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 and 3 AS `2 % 3 && 3`,2 % (3 and 3) AS `2 % (3 && 3)`,2 % 3 and 3 AS `(2 % 3) && 3`
+select 2 % 3 && 3, 2 % (3 && 3), (2 % 3) && 3 union select * from v1;
+2 % 3 && 3 2 % (3 && 3) (2 % 3) && 3
+1 0 1
+create or replace view v1 as select 2 % 3 = 2, 2 % (3 = 2), (2 % 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 = 2 AS `2 % 3 = 2`,2 % (3 = 2) AS `2 % (3 = 2)`,2 % 3 = 2 AS `(2 % 3) = 2`
+select 2 % 3 = 2, 2 % (3 = 2), (2 % 3) = 2 union select * from v1;
+2 % 3 = 2 2 % (3 = 2) (2 % 3) = 2
+1 NULL 1
+create or replace view v1 as select 2 % 3 <=> 2, 2 % (3 <=> 2), (2 % 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <=> 2 AS `2 % 3 <=> 2`,2 % (3 <=> 2) AS `2 % (3 <=> 2)`,2 % 3 <=> 2 AS `(2 % 3) <=> 2`
+select 2 % 3 <=> 2, 2 % (3 <=> 2), (2 % 3) <=> 2 union select * from v1;
+2 % 3 <=> 2 2 % (3 <=> 2) (2 % 3) <=> 2
+1 NULL 1
+create or replace view v1 as select 2 % 3 >= 1, 2 % (3 >= 1), (2 % 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 >= 1 AS `2 % 3 >= 1`,2 % (3 >= 1) AS `2 % (3 >= 1)`,2 % 3 >= 1 AS `(2 % 3) >= 1`
+select 2 % 3 >= 1, 2 % (3 >= 1), (2 % 3) >= 1 union select * from v1;
+2 % 3 >= 1 2 % (3 >= 1) (2 % 3) >= 1
+1 0 1
+create or replace view v1 as select 2 % 3 <= 3, 2 % (3 <= 3), (2 % 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <= 3 AS `2 % 3 <= 3`,2 % (3 <= 3) AS `2 % (3 <= 3)`,2 % 3 <= 3 AS `(2 % 3) <= 3`
+select 2 % 3 <= 3, 2 % (3 <= 3), (2 % 3) <= 3 union select * from v1;
+2 % 3 <= 3 2 % (3 <= 3) (2 % 3) <= 3
+1 0 1
+create or replace view v1 as select 2 % 3 < 3, 2 % (3 < 3), (2 % 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 < 3 AS `2 % 3 < 3`,2 % (3 < 3) AS `2 % (3 < 3)`,2 % 3 < 3 AS `(2 % 3) < 3`
+select 2 % 3 < 3, 2 % (3 < 3), (2 % 3) < 3 union select * from v1;
+2 % 3 < 3 2 % (3 < 3) (2 % 3) < 3
+1 NULL 1
+create or replace view v1 as select 2 % 3 <> 3, 2 % (3 <> 3), (2 % 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <> 3 AS `2 % 3 <> 3`,2 % (3 <> 3) AS `2 % (3 <> 3)`,2 % 3 <> 3 AS `(2 % 3) <> 3`
+select 2 % 3 <> 3, 2 % (3 <> 3), (2 % 3) <> 3 union select * from v1;
+2 % 3 <> 3 2 % (3 <> 3) (2 % 3) <> 3
+1 NULL 1
+create or replace view v1 as select 2 % 3 > 3, 2 % (3 > 3), (2 % 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 > 3 AS `2 % 3 > 3`,2 % (3 > 3) AS `2 % (3 > 3)`,2 % 3 > 3 AS `(2 % 3) > 3`
+select 2 % 3 > 3, 2 % (3 > 3), (2 % 3) > 3 union select * from v1;
+2 % 3 > 3 2 % (3 > 3) (2 % 3) > 3
+0 NULL 0
+create or replace view v1 as select 2 % 3 != 3, 2 % (3 != 3), (2 % 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 <> 3 AS `2 % 3 != 3`,2 % (3 <> 3) AS `2 % (3 != 3)`,2 % 3 <> 3 AS `(2 % 3) != 3`
+select 2 % 3 != 3, 2 % (3 != 3), (2 % 3) != 3 union select * from v1;
+2 % 3 != 3 2 % (3 != 3) (2 % 3) != 3
+1 NULL 1
+create or replace view v1 as select 2 % 3 LIKE 2, 2 % (3 LIKE 2), (2 % 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 like 2 AS `2 % 3 LIKE 2`,2 % (3 like 2) AS `2 % (3 LIKE 2)`,2 % 3 like 2 AS `(2 % 3) LIKE 2`
+select 2 % 3 LIKE 2, 2 % (3 LIKE 2), (2 % 3) LIKE 2 union select * from v1;
+2 % 3 LIKE 2 2 % (3 LIKE 2) (2 % 3) LIKE 2
+1 NULL 1
+create or replace view v1 as select 2 % 3 REGEXP 2, 2 % (3 REGEXP 2), (2 % 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 regexp 2 AS `2 % 3 REGEXP 2`,2 % (3 regexp 2) AS `2 % (3 REGEXP 2)`,2 % 3 regexp 2 AS `(2 % 3) REGEXP 2`
+select 2 % 3 REGEXP 2, 2 % (3 REGEXP 2), (2 % 3) REGEXP 2 union select * from v1;
+2 % 3 REGEXP 2 2 % (3 REGEXP 2) (2 % 3) REGEXP 2
+1 NULL 1
+create or replace view v1 as select 2 % 3 | 3, 2 % (3 | 3), (2 % 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 | 3 AS `2 % 3 | 3`,2 % (3 | 3) AS `2 % (3 | 3)`,2 % 3 | 3 AS `(2 % 3) | 3`
+select 2 % 3 | 3, 2 % (3 | 3), (2 % 3) | 3 union select * from v1;
+2 % 3 | 3 2 % (3 | 3) (2 % 3) | 3
+3 2 3
+create or replace view v1 as select 2 % 4 & 4, 2 % (4 & 4), (2 % 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 4 & 4 AS `2 % 4 & 4`,2 % (4 & 4) AS `2 % (4 & 4)`,2 % 4 & 4 AS `(2 % 4) & 4`
+select 2 % 4 & 4, 2 % (4 & 4), (2 % 4) & 4 union select * from v1;
+2 % 4 & 4 2 % (4 & 4) (2 % 4) & 4
+0 2 0
+create or replace view v1 as select 2 % 3 << 3, 2 % (3 << 3), (2 % 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 << 3 AS `2 % 3 << 3`,2 % (3 << 3) AS `2 % (3 << 3)`,2 % 3 << 3 AS `(2 % 3) << 3`
+select 2 % 3 << 3, 2 % (3 << 3), (2 % 3) << 3 union select * from v1;
+2 % 3 << 3 2 % (3 << 3) (2 % 3) << 3
+16 2 16
+create or replace view v1 as select 2 % 3 >> 3, 2 % (3 >> 3), (2 % 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 >> 3 AS `2 % 3 >> 3`,2 % (3 >> 3) AS `2 % (3 >> 3)`,2 % 3 >> 3 AS `(2 % 3) >> 3`
+select 2 % 3 >> 3, 2 % (3 >> 3), (2 % 3) >> 3 union select * from v1;
+2 % 3 >> 3 2 % (3 >> 3) (2 % 3) >> 3
+0 NULL 0
+create or replace view v1 as select 2 % '2000-01-01' +INTERVAL 1 DAY, 2 % ('2000-01-01' +INTERVAL 1 DAY), (2 % '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % '2000-01-01' + interval 1 day AS `2 % '2000-01-01' +INTERVAL 1 DAY`,2 % ('2000-01-01' + interval 1 day) AS `2 % ('2000-01-01' +INTERVAL 1 DAY)`,2 % '2000-01-01' + interval 1 day AS `(2 % '2000-01-01') +INTERVAL 1 DAY`
+select 2 % '2000-01-01' +INTERVAL 1 DAY, 2 % ('2000-01-01' +INTERVAL 1 DAY), (2 % '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 % '2000-01-01' +INTERVAL 1 DAY 2 % ('2000-01-01' +INTERVAL 1 DAY) (2 % '2000-01-01') +INTERVAL 1 DAY
+NULL 2 NULL
+create or replace view v1 as select 2 % 3 + 3, 2 % (3 + 3), (2 % 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 + 3 AS `2 % 3 + 3`,2 % (3 + 3) AS `2 % (3 + 3)`,2 % 3 + 3 AS `(2 % 3) + 3`
+select 2 % 3 + 3, 2 % (3 + 3), (2 % 3) + 3 union select * from v1;
+2 % 3 + 3 2 % (3 + 3) (2 % 3) + 3
+5 2 5
+create or replace view v1 as select 2 % 3 - 3, 2 % (3 - 3), (2 % 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 - 3 AS `2 % 3 - 3`,2 % (3 - 3) AS `2 % (3 - 3)`,2 % 3 - 3 AS `(2 % 3) - 3`
+select 2 % 3 - 3, 2 % (3 - 3), (2 % 3) - 3 union select * from v1;
+2 % 3 - 3 2 % (3 - 3) (2 % 3) - 3
+-1 NULL -1
+create or replace view v1 as select 2 % 3 * 3, 2 % (3 * 3), (2 % 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 * 3 AS `2 % 3 * 3`,2 % (3 * 3) AS `2 % (3 * 3)`,2 % 3 * 3 AS `(2 % 3) * 3`
+select 2 % 3 * 3, 2 % (3 * 3), (2 % 3) * 3 union select * from v1;
+2 % 3 * 3 2 % (3 * 3) (2 % 3) * 3
+6 2 6
+create or replace view v1 as select 2 % 3 / 3, 2 % (3 / 3), (2 % 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 / 3 AS `2 % 3 / 3`,2 % (3 / 3) AS `2 % (3 / 3)`,2 % 3 / 3 AS `(2 % 3) / 3`
+select 2 % 3 / 3, 2 % (3 / 3), (2 % 3) / 3 union select * from v1;
+2 % 3 / 3 2 % (3 / 3) (2 % 3) / 3
+0.6667 0.0000 0.6667
+create or replace view v1 as select 3 % 4 DIV 3, 3 % (4 DIV 3), (3 % 4) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 % 4 DIV 3 AS `3 % 4 DIV 3`,3 % (4 DIV 3) AS `3 % (4 DIV 3)`,3 % 4 DIV 3 AS `(3 % 4) DIV 3`
+select 3 % 4 DIV 3, 3 % (4 DIV 3), (3 % 4) DIV 3 union select * from v1;
+3 % 4 DIV 3 3 % (4 DIV 3) (3 % 4) DIV 3
+1 0 1
+create or replace view v1 as select 2 % 3 MOD 3, 2 % (3 MOD 3), (2 % 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 % 3 AS `2 % 3 MOD 3`,2 % (3 % 3) AS `2 % (3 MOD 3)`,2 % 3 % 3 AS `(2 % 3) MOD 3`
+select 2 % 3 MOD 3, 2 % (3 MOD 3), (2 % 3) MOD 3 union select * from v1;
+2 % 3 MOD 3 2 % (3 MOD 3) (2 % 3) MOD 3
+2 NULL 2
+create or replace view v1 as select 2 % 3 % 3, 2 % (3 % 3), (2 % 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 % 3 AS `2 % 3 % 3`,2 % (3 % 3) AS `2 % (3 % 3)`,2 % 3 % 3 AS `(2 % 3) % 3`
+select 2 % 3 % 3, 2 % (3 % 3), (2 % 3) % 3 union select * from v1;
+2 % 3 % 3 2 % (3 % 3) (2 % 3) % 3
+2 NULL 2
+create or replace view v1 as select 2 % 3 ^ 3, 2 % (3 ^ 3), (2 % 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 ^ 3 AS `2 % 3 ^ 3`,2 % 3 ^ 3 AS `2 % (3 ^ 3)`,(2 % 3) ^ 3 AS `(2 % 3) ^ 3`
+select 2 % 3 ^ 3, 2 % (3 ^ 3), (2 % 3) ^ 3 union select * from v1;
+2 % 3 ^ 3 2 % (3 ^ 3) (2 % 3) ^ 3
+NULL NULL 1
+create or replace view v1 as select 2 % 3 BETWEEN 1 AND 3, 2 % (3 BETWEEN 1 AND 3), (2 % 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 between 1 and 3 AS `2 % 3 BETWEEN 1 AND 3`,2 % (3 between 1 and 3) AS `2 % (3 BETWEEN 1 AND 3)`,2 % 3 between 1 and 3 AS `(2 % 3) BETWEEN 1 AND 3`
+select 2 % 3 BETWEEN 1 AND 3, 2 % (3 BETWEEN 1 AND 3), (2 % 3) BETWEEN 1 AND 3 union select * from v1;
+2 % 3 BETWEEN 1 AND 3 2 % (3 BETWEEN 1 AND 3) (2 % 3) BETWEEN 1 AND 3
+1 0 1
+create or replace view v1 as select 2 ^ 3 IS FALSE, 2 ^ (3 IS FALSE), (2 ^ 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 is false AS `2 ^ 3 IS FALSE`,2 ^ (3 is false) AS `2 ^ (3 IS FALSE)`,2 ^ 3 is false AS `(2 ^ 3) IS FALSE`
+select 2 ^ 3 IS FALSE, 2 ^ (3 IS FALSE), (2 ^ 3) IS FALSE union select * from v1;
+2 ^ 3 IS FALSE 2 ^ (3 IS FALSE) (2 ^ 3) IS FALSE
+0 2 0
+create or replace view v1 as select charset(2 ^ 3 COLLATE latin1_bin), charset(2 ^ (3 COLLATE latin1_bin)), charset((2 ^ 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 ^ 3 collate latin1_bin) AS `charset(2 ^ 3 COLLATE latin1_bin)`,charset(2 ^ 3 collate latin1_bin) AS `charset(2 ^ (3 COLLATE latin1_bin))`,charset((2 ^ 3) collate latin1_bin) AS `charset((2 ^ 3) COLLATE latin1_bin)`
+select charset(2 ^ 3 COLLATE latin1_bin), charset(2 ^ (3 COLLATE latin1_bin)), charset((2 ^ 3) COLLATE latin1_bin) union select * from v1;
+charset(2 ^ 3 COLLATE latin1_bin) charset(2 ^ (3 COLLATE latin1_bin)) charset((2 ^ 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 ^ 3 IN (0,1), 2 ^ (3 IN (0,1)), (2 ^ 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 in (0,1) AS `2 ^ 3 IN (0,1)`,2 ^ (3 in (0,1)) AS `2 ^ (3 IN (0,1))`,2 ^ 3 in (0,1) AS `(2 ^ 3) IN (0,1)`
+select 2 ^ 3 IN (0,1), 2 ^ (3 IN (0,1)), (2 ^ 3) IN (0,1) union select * from v1;
+2 ^ 3 IN (0,1) 2 ^ (3 IN (0,1)) (2 ^ 3) IN (0,1)
+1 2 1
+create or replace view v1 as select 2 ^ 3 OR 3, 2 ^ (3 OR 3), (2 ^ 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 or 3 AS `2 ^ 3 OR 3`,2 ^ (3 or 3) AS `2 ^ (3 OR 3)`,2 ^ 3 or 3 AS `(2 ^ 3) OR 3`
+select 2 ^ 3 OR 3, 2 ^ (3 OR 3), (2 ^ 3) OR 3 union select * from v1;
+2 ^ 3 OR 3 2 ^ (3 OR 3) (2 ^ 3) OR 3
+1 3 1
+create or replace view v1 as select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 or 3 AS `2 ^ 3 || 3`,2 ^ (3 or 3) AS `2 ^ (3 || 3)`,2 ^ 3 or 3 AS `(2 ^ 3) || 3`
+select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3 union select * from v1;
+2 ^ 3 || 3 2 ^ (3 || 3) (2 ^ 3) || 3
+1 3 1
+create or replace view v1 as select 2 ^ 3 XOR 3, 2 ^ (3 XOR 3), (2 ^ 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 xor 3 AS `2 ^ 3 XOR 3`,2 ^ (3 xor 3) AS `2 ^ (3 XOR 3)`,2 ^ 3 xor 3 AS `(2 ^ 3) XOR 3`
+select 2 ^ 3 XOR 3, 2 ^ (3 XOR 3), (2 ^ 3) XOR 3 union select * from v1;
+2 ^ 3 XOR 3 2 ^ (3 XOR 3) (2 ^ 3) XOR 3
+0 2 0
+create or replace view v1 as select 2 ^ 3 AND 3, 2 ^ (3 AND 3), (2 ^ 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 and 3 AS `2 ^ 3 AND 3`,2 ^ (3 and 3) AS `2 ^ (3 AND 3)`,2 ^ 3 and 3 AS `(2 ^ 3) AND 3`
+select 2 ^ 3 AND 3, 2 ^ (3 AND 3), (2 ^ 3) AND 3 union select * from v1;
+2 ^ 3 AND 3 2 ^ (3 AND 3) (2 ^ 3) AND 3
+1 3 1
+create or replace view v1 as select 2 ^ 3 && 3, 2 ^ (3 && 3), (2 ^ 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 and 3 AS `2 ^ 3 && 3`,2 ^ (3 and 3) AS `2 ^ (3 && 3)`,2 ^ 3 and 3 AS `(2 ^ 3) && 3`
+select 2 ^ 3 && 3, 2 ^ (3 && 3), (2 ^ 3) && 3 union select * from v1;
+2 ^ 3 && 3 2 ^ (3 && 3) (2 ^ 3) && 3
+1 3 1
+create or replace view v1 as select 2 ^ 3 = 3, 2 ^ (3 = 3), (2 ^ 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 = 3 AS `2 ^ 3 = 3`,2 ^ (3 = 3) AS `2 ^ (3 = 3)`,2 ^ 3 = 3 AS `(2 ^ 3) = 3`
+select 2 ^ 3 = 3, 2 ^ (3 = 3), (2 ^ 3) = 3 union select * from v1;
+2 ^ 3 = 3 2 ^ (3 = 3) (2 ^ 3) = 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 <=> 3, 2 ^ (3 <=> 3), (2 ^ 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 <=> 3 AS `2 ^ 3 <=> 3`,2 ^ (3 <=> 3) AS `2 ^ (3 <=> 3)`,2 ^ 3 <=> 3 AS `(2 ^ 3) <=> 3`
+select 2 ^ 3 <=> 3, 2 ^ (3 <=> 3), (2 ^ 3) <=> 3 union select * from v1;
+2 ^ 3 <=> 3 2 ^ (3 <=> 3) (2 ^ 3) <=> 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 >= 3, 2 ^ (3 >= 3), (2 ^ 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 >= 3 AS `2 ^ 3 >= 3`,2 ^ (3 >= 3) AS `2 ^ (3 >= 3)`,2 ^ 3 >= 3 AS `(2 ^ 3) >= 3`
+select 2 ^ 3 >= 3, 2 ^ (3 >= 3), (2 ^ 3) >= 3 union select * from v1;
+2 ^ 3 >= 3 2 ^ (3 >= 3) (2 ^ 3) >= 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 <= 3, 2 ^ (3 <= 3), (2 ^ 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 <= 3 AS `2 ^ 3 <= 3`,2 ^ (3 <= 3) AS `2 ^ (3 <= 3)`,2 ^ 3 <= 3 AS `(2 ^ 3) <= 3`
+select 2 ^ 3 <= 3, 2 ^ (3 <= 3), (2 ^ 3) <= 3 union select * from v1;
+2 ^ 3 <= 3 2 ^ (3 <= 3) (2 ^ 3) <= 3
+1 3 1
+create or replace view v1 as select 2 ^ 3 < 3, 2 ^ (3 < 3), (2 ^ 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 < 3 AS `2 ^ 3 < 3`,2 ^ (3 < 3) AS `2 ^ (3 < 3)`,2 ^ 3 < 3 AS `(2 ^ 3) < 3`
+select 2 ^ 3 < 3, 2 ^ (3 < 3), (2 ^ 3) < 3 union select * from v1;
+2 ^ 3 < 3 2 ^ (3 < 3) (2 ^ 3) < 3
+1 2 1
+create or replace view v1 as select 2 ^ 3 <> 3, 2 ^ (3 <> 3), (2 ^ 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 <> 3 AS `2 ^ 3 <> 3`,2 ^ (3 <> 3) AS `2 ^ (3 <> 3)`,2 ^ 3 <> 3 AS `(2 ^ 3) <> 3`
+select 2 ^ 3 <> 3, 2 ^ (3 <> 3), (2 ^ 3) <> 3 union select * from v1;
+2 ^ 3 <> 3 2 ^ (3 <> 3) (2 ^ 3) <> 3
+1 2 1
+create or replace view v1 as select 2 ^ 3 > 3, 2 ^ (3 > 3), (2 ^ 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 > 3 AS `2 ^ 3 > 3`,2 ^ (3 > 3) AS `2 ^ (3 > 3)`,2 ^ 3 > 3 AS `(2 ^ 3) > 3`
+select 2 ^ 3 > 3, 2 ^ (3 > 3), (2 ^ 3) > 3 union select * from v1;
+2 ^ 3 > 3 2 ^ (3 > 3) (2 ^ 3) > 3
+0 2 0
+create or replace view v1 as select 2 ^ 3 != 3, 2 ^ (3 != 3), (2 ^ 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 <> 3 AS `2 ^ 3 != 3`,2 ^ (3 <> 3) AS `2 ^ (3 != 3)`,2 ^ 3 <> 3 AS `(2 ^ 3) != 3`
+select 2 ^ 3 != 3, 2 ^ (3 != 3), (2 ^ 3) != 3 union select * from v1;
+2 ^ 3 != 3 2 ^ (3 != 3) (2 ^ 3) != 3
+1 2 1
+create or replace view v1 as select 2 ^ 3 LIKE 3, 2 ^ (3 LIKE 3), (2 ^ 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 like 3 AS `2 ^ 3 LIKE 3`,2 ^ (3 like 3) AS `2 ^ (3 LIKE 3)`,2 ^ 3 like 3 AS `(2 ^ 3) LIKE 3`
+select 2 ^ 3 LIKE 3, 2 ^ (3 LIKE 3), (2 ^ 3) LIKE 3 union select * from v1;
+2 ^ 3 LIKE 3 2 ^ (3 LIKE 3) (2 ^ 3) LIKE 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 REGEXP 3, 2 ^ (3 REGEXP 3), (2 ^ 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 regexp 3 AS `2 ^ 3 REGEXP 3`,2 ^ (3 regexp 3) AS `2 ^ (3 REGEXP 3)`,2 ^ 3 regexp 3 AS `(2 ^ 3) REGEXP 3`
+select 2 ^ 3 REGEXP 3, 2 ^ (3 REGEXP 3), (2 ^ 3) REGEXP 3 union select * from v1;
+2 ^ 3 REGEXP 3 2 ^ (3 REGEXP 3) (2 ^ 3) REGEXP 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 | 3, 2 ^ (3 | 3), (2 ^ 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 | 3 AS `2 ^ 3 | 3`,2 ^ (3 | 3) AS `2 ^ (3 | 3)`,2 ^ 3 | 3 AS `(2 ^ 3) | 3`
+select 2 ^ 3 | 3, 2 ^ (3 | 3), (2 ^ 3) | 3 union select * from v1;
+2 ^ 3 | 3 2 ^ (3 | 3) (2 ^ 3) | 3
+3 1 3
+create or replace view v1 as select 2 ^ 0 & 0, 2 ^ (0 & 0), (2 ^ 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 0 & 0 AS `2 ^ 0 & 0`,2 ^ (0 & 0) AS `2 ^ (0 & 0)`,2 ^ 0 & 0 AS `(2 ^ 0) & 0`
+select 2 ^ 0 & 0, 2 ^ (0 & 0), (2 ^ 0) & 0 union select * from v1;
+2 ^ 0 & 0 2 ^ (0 & 0) (2 ^ 0) & 0
+0 2 0
+create or replace view v1 as select 2 ^ 3 << 3, 2 ^ (3 << 3), (2 ^ 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 << 3 AS `2 ^ 3 << 3`,2 ^ (3 << 3) AS `2 ^ (3 << 3)`,2 ^ 3 << 3 AS `(2 ^ 3) << 3`
+select 2 ^ 3 << 3, 2 ^ (3 << 3), (2 ^ 3) << 3 union select * from v1;
+2 ^ 3 << 3 2 ^ (3 << 3) (2 ^ 3) << 3
+8 26 8
+create or replace view v1 as select 2 ^ 3 >> 3, 2 ^ (3 >> 3), (2 ^ 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 >> 3 AS `2 ^ 3 >> 3`,2 ^ (3 >> 3) AS `2 ^ (3 >> 3)`,2 ^ 3 >> 3 AS `(2 ^ 3) >> 3`
+select 2 ^ 3 >> 3, 2 ^ (3 >> 3), (2 ^ 3) >> 3 union select * from v1;
+2 ^ 3 >> 3 2 ^ (3 >> 3) (2 ^ 3) >> 3
+0 2 0
+create or replace view v1 as select 2 ^ '2000-01-01' +INTERVAL 1 DAY, 2 ^ ('2000-01-01' +INTERVAL 1 DAY), (2 ^ '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ '2000-01-01' + interval 1 day AS `2 ^ '2000-01-01' +INTERVAL 1 DAY`,2 ^ ('2000-01-01' + interval 1 day) AS `2 ^ ('2000-01-01' +INTERVAL 1 DAY)`,2 ^ '2000-01-01' + interval 1 day AS `(2 ^ '2000-01-01') +INTERVAL 1 DAY`
+select 2 ^ '2000-01-01' +INTERVAL 1 DAY, 2 ^ ('2000-01-01' +INTERVAL 1 DAY), (2 ^ '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 ^ '2000-01-01' +INTERVAL 1 DAY 2 ^ ('2000-01-01' +INTERVAL 1 DAY) (2 ^ '2000-01-01') +INTERVAL 1 DAY
+NULL 20000100 NULL
+create or replace view v1 as select 2 ^ 3 + 1, 2 ^ (3 + 1), (2 ^ 3) + 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 + 1 AS `2 ^ 3 + 1`,2 ^ (3 + 1) AS `2 ^ (3 + 1)`,2 ^ 3 + 1 AS `(2 ^ 3) + 1`
+select 2 ^ 3 + 1, 2 ^ (3 + 1), (2 ^ 3) + 1 union select * from v1;
+2 ^ 3 + 1 2 ^ (3 + 1) (2 ^ 3) + 1
+2 6 2
+create or replace view v1 as select 5 ^ 1 - 1, 5 ^ (1 - 1), (5 ^ 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 5 ^ 1 - 1 AS `5 ^ 1 - 1`,5 ^ (1 - 1) AS `5 ^ (1 - 1)`,5 ^ 1 - 1 AS `(5 ^ 1) - 1`
+select 5 ^ 1 - 1, 5 ^ (1 - 1), (5 ^ 1) - 1 union select * from v1;
+5 ^ 1 - 1 5 ^ (1 - 1) (5 ^ 1) - 1
+3 5 3
+create or replace view v1 as select 2 ^ 3 * 3, 2 ^ (3 * 3), (2 ^ 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 * 3 AS `2 ^ 3 * 3`,2 ^ (3 * 3) AS `2 ^ (3 * 3)`,2 ^ 3 * 3 AS `(2 ^ 3) * 3`
+select 2 ^ 3 * 3, 2 ^ (3 * 3), (2 ^ 3) * 3 union select * from v1;
+2 ^ 3 * 3 2 ^ (3 * 3) (2 ^ 3) * 3
+3 11 3
+create or replace view v1 as select 2 ^ 3 / 3, 2 ^ (3 / 3), (2 ^ 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 / 3 AS `2 ^ 3 / 3`,2 ^ (3 / 3) AS `2 ^ (3 / 3)`,2 ^ 3 / 3 AS `(2 ^ 3) / 3`
+select 2 ^ 3 / 3, 2 ^ (3 / 3), (2 ^ 3) / 3 union select * from v1;
+2 ^ 3 / 3 2 ^ (3 / 3) (2 ^ 3) / 3
+0.3333 3 0.3333
+create or replace view v1 as select 2 ^ 3 DIV 3, 2 ^ (3 DIV 3), (2 ^ 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 DIV 3 AS `2 ^ 3 DIV 3`,2 ^ (3 DIV 3) AS `2 ^ (3 DIV 3)`,2 ^ 3 DIV 3 AS `(2 ^ 3) DIV 3`
+select 2 ^ 3 DIV 3, 2 ^ (3 DIV 3), (2 ^ 3) DIV 3 union select * from v1;
+2 ^ 3 DIV 3 2 ^ (3 DIV 3) (2 ^ 3) DIV 3
+0 3 0
+create or replace view v1 as select 2 ^ 3 MOD 3, 2 ^ (3 MOD 3), (2 ^ 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 % 3 AS `2 ^ 3 MOD 3`,2 ^ (3 % 3) AS `2 ^ (3 MOD 3)`,2 ^ 3 % 3 AS `(2 ^ 3) MOD 3`
+select 2 ^ 3 MOD 3, 2 ^ (3 MOD 3), (2 ^ 3) MOD 3 union select * from v1;
+2 ^ 3 MOD 3 2 ^ (3 MOD 3) (2 ^ 3) MOD 3
+1 2 1
+create or replace view v1 as select 2 ^ 3 % 3, 2 ^ (3 % 3), (2 ^ 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 % 3 AS `2 ^ 3 % 3`,2 ^ (3 % 3) AS `2 ^ (3 % 3)`,2 ^ 3 % 3 AS `(2 ^ 3) % 3`
+select 2 ^ 3 % 3, 2 ^ (3 % 3), (2 ^ 3) % 3 union select * from v1;
+2 ^ 3 % 3 2 ^ (3 % 3) (2 ^ 3) % 3
+1 2 1
+create or replace view v1 as select 2 ^ 3 BETWEEN 1 AND 3, 2 ^ (3 BETWEEN 1 AND 3), (2 ^ 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 between 1 and 3 AS `2 ^ 3 BETWEEN 1 AND 3`,2 ^ (3 between 1 and 3) AS `2 ^ (3 BETWEEN 1 AND 3)`,2 ^ 3 between 1 and 3 AS `(2 ^ 3) BETWEEN 1 AND 3`
+select 2 ^ 3 BETWEEN 1 AND 3, 2 ^ (3 BETWEEN 1 AND 3), (2 ^ 3) BETWEEN 1 AND 3 union select * from v1;
+2 ^ 3 BETWEEN 1 AND 3 2 ^ (3 BETWEEN 1 AND 3) (2 ^ 3) BETWEEN 1 AND 3
+1 3 1
+create or replace view v1 as select 2 BETWEEN 1 AND 1 IS FALSE, 2 BETWEEN 1 AND (1 IS FALSE), (2 BETWEEN 1 AND 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 1 is false AS `2 BETWEEN 1 AND 1 IS FALSE`,2 between 1 and (1 is false) AS `2 BETWEEN 1 AND (1 IS FALSE)`,2 between 1 and 1 is false AS `(2 BETWEEN 1 AND 1) IS FALSE`
+select 2 BETWEEN 1 AND 1 IS FALSE, 2 BETWEEN 1 AND (1 IS FALSE), (2 BETWEEN 1 AND 1) IS FALSE union select * from v1;
+2 BETWEEN 1 AND 1 IS FALSE 2 BETWEEN 1 AND (1 IS FALSE) (2 BETWEEN 1 AND 1) IS FALSE
+1 0 1
+create or replace view v1 as select charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin), charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin)), charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 between 1 and 3 collate latin1_bin) AS `charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin)`,charset(2 between 1 and 3 collate latin1_bin) AS `charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin))`,charset((2 between 1 and 3) collate latin1_bin) AS `charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin)`
+select charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin), charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin)), charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin) union select * from v1;
+charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin) charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin)) charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 IN (0,1), 2 BETWEEN 1 AND (3 IN (0,1)), (2 BETWEEN 1 AND 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 in (0,1) AS `2 BETWEEN 1 AND 3 IN (0,1)`,2 between 1 and 3 in (0,1) AS `2 BETWEEN 1 AND (3 IN (0,1))`,(2 between 1 and 3) in (0,1) AS `(2 BETWEEN 1 AND 3) IN (0,1)`
+select 2 BETWEEN 1 AND 3 IN (0,1), 2 BETWEEN 1 AND (3 IN (0,1)), (2 BETWEEN 1 AND 3) IN (0,1) union select * from v1;
+2 BETWEEN 1 AND 3 IN (0,1) 2 BETWEEN 1 AND (3 IN (0,1)) (2 BETWEEN 1 AND 3) IN (0,1)
+0 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 OR 3, 2 BETWEEN 1 AND (3 OR 3), (2 BETWEEN 1 AND 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 or 3 AS `2 BETWEEN 1 AND 3 OR 3`,2 between 1 and (3 or 3) AS `2 BETWEEN 1 AND (3 OR 3)`,2 between 1 and 3 or 3 AS `(2 BETWEEN 1 AND 3) OR 3`
+select 2 BETWEEN 1 AND 3 OR 3, 2 BETWEEN 1 AND (3 OR 3), (2 BETWEEN 1 AND 3) OR 3 union select * from v1;
+2 BETWEEN 1 AND 3 OR 3 2 BETWEEN 1 AND (3 OR 3) (2 BETWEEN 1 AND 3) OR 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 or 3 AS `2 BETWEEN 1 AND 3 || 3`,2 between 1 and (3 or 3) AS `2 BETWEEN 1 AND (3 || 3)`,2 between 1 and 3 or 3 AS `(2 BETWEEN 1 AND 3) || 3`
+select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3 union select * from v1;
+2 BETWEEN 1 AND 3 || 3 2 BETWEEN 1 AND (3 || 3) (2 BETWEEN 1 AND 3) || 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 1 XOR 1, 2 BETWEEN 1 AND (1 XOR 1), (2 BETWEEN 1 AND 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 1 xor 1 AS `2 BETWEEN 1 AND 1 XOR 1`,2 between 1 and (1 xor 1) AS `2 BETWEEN 1 AND (1 XOR 1)`,2 between 1 and 1 xor 1 AS `(2 BETWEEN 1 AND 1) XOR 1`
+select 2 BETWEEN 1 AND 1 XOR 1, 2 BETWEEN 1 AND (1 XOR 1), (2 BETWEEN 1 AND 1) XOR 1 union select * from v1;
+2 BETWEEN 1 AND 1 XOR 1 2 BETWEEN 1 AND (1 XOR 1) (2 BETWEEN 1 AND 1) XOR 1
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 AND 3, 2 BETWEEN 1 AND (3 AND 3), (2 BETWEEN 1 AND 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 and 3 AS `2 BETWEEN 1 AND 3 AND 3`,2 between 1 and (3 and 3) AS `2 BETWEEN 1 AND (3 AND 3)`,2 between 1 and 3 and 3 AS `(2 BETWEEN 1 AND 3) AND 3`
+select 2 BETWEEN 1 AND 3 AND 3, 2 BETWEEN 1 AND (3 AND 3), (2 BETWEEN 1 AND 3) AND 3 union select * from v1;
+2 BETWEEN 1 AND 3 AND 3 2 BETWEEN 1 AND (3 AND 3) (2 BETWEEN 1 AND 3) AND 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 && 3, 2 BETWEEN 1 AND (3 && 3), (2 BETWEEN 1 AND 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 and 3 AS `2 BETWEEN 1 AND 3 && 3`,2 between 1 and (3 and 3) AS `2 BETWEEN 1 AND (3 && 3)`,2 between 1 and 3 and 3 AS `(2 BETWEEN 1 AND 3) && 3`
+select 2 BETWEEN 1 AND 3 && 3, 2 BETWEEN 1 AND (3 && 3), (2 BETWEEN 1 AND 3) && 3 union select * from v1;
+2 BETWEEN 1 AND 3 && 3 2 BETWEEN 1 AND (3 && 3) (2 BETWEEN 1 AND 3) && 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 = 1, 2 BETWEEN 1 AND (3 = 1), (2 BETWEEN 1 AND 3) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 = 1 AS `2 BETWEEN 1 AND 3 = 1`,2 between 1 and (3 = 1) AS `2 BETWEEN 1 AND (3 = 1)`,2 between 1 and 3 = 1 AS `(2 BETWEEN 1 AND 3) = 1`
+select 2 BETWEEN 1 AND 3 = 1, 2 BETWEEN 1 AND (3 = 1), (2 BETWEEN 1 AND 3) = 1 union select * from v1;
+2 BETWEEN 1 AND 3 = 1 2 BETWEEN 1 AND (3 = 1) (2 BETWEEN 1 AND 3) = 1
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <=> 1, 2 BETWEEN 1 AND (3 <=> 1), (2 BETWEEN 1 AND 3) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 <=> 1 AS `2 BETWEEN 1 AND 3 <=> 1`,2 between 1 and (3 <=> 1) AS `2 BETWEEN 1 AND (3 <=> 1)`,2 between 1 and 3 <=> 1 AS `(2 BETWEEN 1 AND 3) <=> 1`
+select 2 BETWEEN 1 AND 3 <=> 1, 2 BETWEEN 1 AND (3 <=> 1), (2 BETWEEN 1 AND 3) <=> 1 union select * from v1;
+2 BETWEEN 1 AND 3 <=> 1 2 BETWEEN 1 AND (3 <=> 1) (2 BETWEEN 1 AND 3) <=> 1
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 >= 1, 2 BETWEEN 1 AND (3 >= 1), (2 BETWEEN 1 AND 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 >= 1 AS `2 BETWEEN 1 AND 3 >= 1`,2 between 1 and (3 >= 1) AS `2 BETWEEN 1 AND (3 >= 1)`,2 between 1 and 3 >= 1 AS `(2 BETWEEN 1 AND 3) >= 1`
+select 2 BETWEEN 1 AND 3 >= 1, 2 BETWEEN 1 AND (3 >= 1), (2 BETWEEN 1 AND 3) >= 1 union select * from v1;
+2 BETWEEN 1 AND 3 >= 1 2 BETWEEN 1 AND (3 >= 1) (2 BETWEEN 1 AND 3) >= 1
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <= 3, 2 BETWEEN 1 AND (3 <= 3), (2 BETWEEN 1 AND 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 <= 3 AS `2 BETWEEN 1 AND 3 <= 3`,2 between 1 and (3 <= 3) AS `2 BETWEEN 1 AND (3 <= 3)`,2 between 1 and 3 <= 3 AS `(2 BETWEEN 1 AND 3) <= 3`
+select 2 BETWEEN 1 AND 3 <= 3, 2 BETWEEN 1 AND (3 <= 3), (2 BETWEEN 1 AND 3) <= 3 union select * from v1;
+2 BETWEEN 1 AND 3 <= 3 2 BETWEEN 1 AND (3 <= 3) (2 BETWEEN 1 AND 3) <= 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 < 3, 2 BETWEEN 1 AND (3 < 3), (2 BETWEEN 1 AND 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 < 3 AS `2 BETWEEN 1 AND 3 < 3`,2 between 1 and (3 < 3) AS `2 BETWEEN 1 AND (3 < 3)`,2 between 1 and 3 < 3 AS `(2 BETWEEN 1 AND 3) < 3`
+select 2 BETWEEN 1 AND 3 < 3, 2 BETWEEN 1 AND (3 < 3), (2 BETWEEN 1 AND 3) < 3 union select * from v1;
+2 BETWEEN 1 AND 3 < 3 2 BETWEEN 1 AND (3 < 3) (2 BETWEEN 1 AND 3) < 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <> 3, 2 BETWEEN 1 AND (3 <> 3), (2 BETWEEN 1 AND 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 <> 3 AS `2 BETWEEN 1 AND 3 <> 3`,2 between 1 and (3 <> 3) AS `2 BETWEEN 1 AND (3 <> 3)`,2 between 1 and 3 <> 3 AS `(2 BETWEEN 1 AND 3) <> 3`
+select 2 BETWEEN 1 AND 3 <> 3, 2 BETWEEN 1 AND (3 <> 3), (2 BETWEEN 1 AND 3) <> 3 union select * from v1;
+2 BETWEEN 1 AND 3 <> 3 2 BETWEEN 1 AND (3 <> 3) (2 BETWEEN 1 AND 3) <> 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 > 0, 2 BETWEEN 1 AND (3 > 0), (2 BETWEEN 1 AND 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 > 0 AS `2 BETWEEN 1 AND 3 > 0`,2 between 1 and (3 > 0) AS `2 BETWEEN 1 AND (3 > 0)`,2 between 1 and 3 > 0 AS `(2 BETWEEN 1 AND 3) > 0`
+select 2 BETWEEN 1 AND 3 > 0, 2 BETWEEN 1 AND (3 > 0), (2 BETWEEN 1 AND 3) > 0 union select * from v1;
+2 BETWEEN 1 AND 3 > 0 2 BETWEEN 1 AND (3 > 0) (2 BETWEEN 1 AND 3) > 0
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 != 3, 2 BETWEEN 1 AND (3 != 3), (2 BETWEEN 1 AND 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 <> 3 AS `2 BETWEEN 1 AND 3 != 3`,2 between 1 and (3 <> 3) AS `2 BETWEEN 1 AND (3 != 3)`,2 between 1 and 3 <> 3 AS `(2 BETWEEN 1 AND 3) != 3`
+select 2 BETWEEN 1 AND 3 != 3, 2 BETWEEN 1 AND (3 != 3), (2 BETWEEN 1 AND 3) != 3 union select * from v1;
+2 BETWEEN 1 AND 3 != 3 2 BETWEEN 1 AND (3 != 3) (2 BETWEEN 1 AND 3) != 3
+1 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 LIKE 1, 2 BETWEEN 1 AND (3 LIKE 1), (2 BETWEEN 1 AND 3) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 like 1 AS `2 BETWEEN 1 AND 3 LIKE 1`,2 between 1 and 3 like 1 AS `2 BETWEEN 1 AND (3 LIKE 1)`,(2 between 1 and 3) like 1 AS `(2 BETWEEN 1 AND 3) LIKE 1`
+select 2 BETWEEN 1 AND 3 LIKE 1, 2 BETWEEN 1 AND (3 LIKE 1), (2 BETWEEN 1 AND 3) LIKE 1 union select * from v1;
+2 BETWEEN 1 AND 3 LIKE 1 2 BETWEEN 1 AND (3 LIKE 1) (2 BETWEEN 1 AND 3) LIKE 1
+0 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 REGEXP 1, 2 BETWEEN 1 AND (3 REGEXP 1), (2 BETWEEN 1 AND 3) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 regexp 1 AS `2 BETWEEN 1 AND 3 REGEXP 1`,2 between 1 and 3 regexp 1 AS `2 BETWEEN 1 AND (3 REGEXP 1)`,(2 between 1 and 3) regexp 1 AS `(2 BETWEEN 1 AND 3) REGEXP 1`
+select 2 BETWEEN 1 AND 3 REGEXP 1, 2 BETWEEN 1 AND (3 REGEXP 1), (2 BETWEEN 1 AND 3) REGEXP 1 union select * from v1;
+2 BETWEEN 1 AND 3 REGEXP 1 2 BETWEEN 1 AND (3 REGEXP 1) (2 BETWEEN 1 AND 3) REGEXP 1
+0 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 | 3, 2 BETWEEN 1 AND (3 | 3), (2 BETWEEN 1 AND 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 | 3 AS `2 BETWEEN 1 AND 3 | 3`,2 between 1 and 3 | 3 AS `2 BETWEEN 1 AND (3 | 3)`,(2 between 1 and 3) | 3 AS `(2 BETWEEN 1 AND 3) | 3`
+select 2 BETWEEN 1 AND 3 | 3, 2 BETWEEN 1 AND (3 | 3), (2 BETWEEN 1 AND 3) | 3 union select * from v1;
+2 BETWEEN 1 AND 3 | 3 2 BETWEEN 1 AND (3 | 3) (2 BETWEEN 1 AND 3) | 3
+1 1 3
+create or replace view v1 as select 2 BETWEEN 1 AND 2 & 2, 2 BETWEEN 1 AND (2 & 2), (2 BETWEEN 1 AND 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 2 & 2 AS `2 BETWEEN 1 AND 2 & 2`,2 between 1 and 2 & 2 AS `2 BETWEEN 1 AND (2 & 2)`,(2 between 1 and 2) & 2 AS `(2 BETWEEN 1 AND 2) & 2`
+select 2 BETWEEN 1 AND 2 & 2, 2 BETWEEN 1 AND (2 & 2), (2 BETWEEN 1 AND 2) & 2 union select * from v1;
+2 BETWEEN 1 AND 2 & 2 2 BETWEEN 1 AND (2 & 2) (2 BETWEEN 1 AND 2) & 2
+1 1 0
+create or replace view v1 as select 2 BETWEEN 1 AND 3 << 3, 2 BETWEEN 1 AND (3 << 3), (2 BETWEEN 1 AND 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 << 3 AS `2 BETWEEN 1 AND 3 << 3`,2 between 1 and 3 << 3 AS `2 BETWEEN 1 AND (3 << 3)`,(2 between 1 and 3) << 3 AS `(2 BETWEEN 1 AND 3) << 3`
+select 2 BETWEEN 1 AND 3 << 3, 2 BETWEEN 1 AND (3 << 3), (2 BETWEEN 1 AND 3) << 3 union select * from v1;
+2 BETWEEN 1 AND 3 << 3 2 BETWEEN 1 AND (3 << 3) (2 BETWEEN 1 AND 3) << 3
+1 1 8
+create or replace view v1 as select 2 BETWEEN 1 AND 4 >> 1, 2 BETWEEN 1 AND (4 >> 1), (2 BETWEEN 1 AND 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 4 >> 1 AS `2 BETWEEN 1 AND 4 >> 1`,2 between 1 and 4 >> 1 AS `2 BETWEEN 1 AND (4 >> 1)`,(2 between 1 and 4) >> 1 AS `(2 BETWEEN 1 AND 4) >> 1`
+select 2 BETWEEN 1 AND 4 >> 1, 2 BETWEEN 1 AND (4 >> 1), (2 BETWEEN 1 AND 4) >> 1 union select * from v1;
+2 BETWEEN 1 AND 4 >> 1 2 BETWEEN 1 AND (4 >> 1) (2 BETWEEN 1 AND 4) >> 1
+1 1 0
+create or replace view v1 as select 2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY, 2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY), (2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and '2000-01-01' + interval 1 day AS `2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY`,2 between 1 and '2000-01-01' + interval 1 day AS `2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY)`,(2 between 1 and '2000-01-01') + interval 1 day AS `(2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY`
+select 2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY, 2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY), (2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY 2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY) (2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY
+1 1 NULL
+create or replace view v1 as select 2 BETWEEN 1 AND 3 + 3, 2 BETWEEN 1 AND (3 + 3), (2 BETWEEN 1 AND 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 + 3 AS `2 BETWEEN 1 AND 3 + 3`,2 between 1 and 3 + 3 AS `2 BETWEEN 1 AND (3 + 3)`,(2 between 1 and 3) + 3 AS `(2 BETWEEN 1 AND 3) + 3`
+select 2 BETWEEN 1 AND 3 + 3, 2 BETWEEN 1 AND (3 + 3), (2 BETWEEN 1 AND 3) + 3 union select * from v1;
+2 BETWEEN 1 AND 3 + 3 2 BETWEEN 1 AND (3 + 3) (2 BETWEEN 1 AND 3) + 3
+1 1 4
+create or replace view v1 as select 2 BETWEEN 1 AND 3 - 3, 2 BETWEEN 1 AND (3 - 3), (2 BETWEEN 1 AND 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 - 3 AS `2 BETWEEN 1 AND 3 - 3`,2 between 1 and 3 - 3 AS `2 BETWEEN 1 AND (3 - 3)`,(2 between 1 and 3) - 3 AS `(2 BETWEEN 1 AND 3) - 3`
+select 2 BETWEEN 1 AND 3 - 3, 2 BETWEEN 1 AND (3 - 3), (2 BETWEEN 1 AND 3) - 3 union select * from v1;
+2 BETWEEN 1 AND 3 - 3 2 BETWEEN 1 AND (3 - 3) (2 BETWEEN 1 AND 3) - 3
+0 0 -2
+create or replace view v1 as select 2 BETWEEN 1 AND 3 * 3, 2 BETWEEN 1 AND (3 * 3), (2 BETWEEN 1 AND 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 * 3 AS `2 BETWEEN 1 AND 3 * 3`,2 between 1 and 3 * 3 AS `2 BETWEEN 1 AND (3 * 3)`,(2 between 1 and 3) * 3 AS `(2 BETWEEN 1 AND 3) * 3`
+select 2 BETWEEN 1 AND 3 * 3, 2 BETWEEN 1 AND (3 * 3), (2 BETWEEN 1 AND 3) * 3 union select * from v1;
+2 BETWEEN 1 AND 3 * 3 2 BETWEEN 1 AND (3 * 3) (2 BETWEEN 1 AND 3) * 3
+1 1 3
+create or replace view v1 as select 2 BETWEEN 1 AND 3 / 3, 2 BETWEEN 1 AND (3 / 3), (2 BETWEEN 1 AND 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 / 3 AS `2 BETWEEN 1 AND 3 / 3`,2 between 1 and 3 / 3 AS `2 BETWEEN 1 AND (3 / 3)`,(2 between 1 and 3) / 3 AS `(2 BETWEEN 1 AND 3) / 3`
+select 2 BETWEEN 1 AND 3 / 3, 2 BETWEEN 1 AND (3 / 3), (2 BETWEEN 1 AND 3) / 3 union select * from v1;
+2 BETWEEN 1 AND 3 / 3 2 BETWEEN 1 AND (3 / 3) (2 BETWEEN 1 AND 3) / 3
+0 0 0.3333
+create or replace view v1 as select 2 BETWEEN 1 AND 4 DIV 2, 2 BETWEEN 1 AND (4 DIV 2), (2 BETWEEN 1 AND 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 4 DIV 2 AS `2 BETWEEN 1 AND 4 DIV 2`,2 between 1 and 4 DIV 2 AS `2 BETWEEN 1 AND (4 DIV 2)`,(2 between 1 and 4) DIV 2 AS `(2 BETWEEN 1 AND 4) DIV 2`
+select 2 BETWEEN 1 AND 4 DIV 2, 2 BETWEEN 1 AND (4 DIV 2), (2 BETWEEN 1 AND 4) DIV 2 union select * from v1;
+2 BETWEEN 1 AND 4 DIV 2 2 BETWEEN 1 AND (4 DIV 2) (2 BETWEEN 1 AND 4) DIV 2
+1 1 0
+create or replace view v1 as select 2 BETWEEN 1 AND 3 MOD 3, 2 BETWEEN 1 AND (3 MOD 3), (2 BETWEEN 1 AND 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 % 3 AS `2 BETWEEN 1 AND 3 MOD 3`,2 between 1 and 3 % 3 AS `2 BETWEEN 1 AND (3 MOD 3)`,(2 between 1 and 3) % 3 AS `(2 BETWEEN 1 AND 3) MOD 3`
+select 2 BETWEEN 1 AND 3 MOD 3, 2 BETWEEN 1 AND (3 MOD 3), (2 BETWEEN 1 AND 3) MOD 3 union select * from v1;
+2 BETWEEN 1 AND 3 MOD 3 2 BETWEEN 1 AND (3 MOD 3) (2 BETWEEN 1 AND 3) MOD 3
+0 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 % 3, 2 BETWEEN 1 AND (3 % 3), (2 BETWEEN 1 AND 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 % 3 AS `2 BETWEEN 1 AND 3 % 3`,2 between 1 and 3 % 3 AS `2 BETWEEN 1 AND (3 % 3)`,(2 between 1 and 3) % 3 AS `(2 BETWEEN 1 AND 3) % 3`
+select 2 BETWEEN 1 AND 3 % 3, 2 BETWEEN 1 AND (3 % 3), (2 BETWEEN 1 AND 3) % 3 union select * from v1;
+2 BETWEEN 1 AND 3 % 3 2 BETWEEN 1 AND (3 % 3) (2 BETWEEN 1 AND 3) % 3
+0 0 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 ^ 3, 2 BETWEEN 1 AND (3 ^ 3), (2 BETWEEN 1 AND 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 ^ 3 AS `2 BETWEEN 1 AND 3 ^ 3`,2 between 1 and 3 ^ 3 AS `2 BETWEEN 1 AND (3 ^ 3)`,(2 between 1 and 3) ^ 3 AS `(2 BETWEEN 1 AND 3) ^ 3`
+select 2 BETWEEN 1 AND 3 ^ 3, 2 BETWEEN 1 AND (3 ^ 3), (2 BETWEEN 1 AND 3) ^ 3 union select * from v1;
+2 BETWEEN 1 AND 3 ^ 3 2 BETWEEN 1 AND (3 ^ 3) (2 BETWEEN 1 AND 3) ^ 3
+0 0 2
+create or replace view v1 as select 2 BETWEEN 1 AND 3 BETWEEN 1 AND 3, 2 BETWEEN 1 AND (3 BETWEEN 1 AND 3), (2 BETWEEN 1 AND 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 between 1 and 3 AS `2 BETWEEN 1 AND 3 BETWEEN 1 AND 3`,2 between 1 and 3 between 1 and 3 AS `2 BETWEEN 1 AND (3 BETWEEN 1 AND 3)`,(2 between 1 and 3) between 1 and 3 AS `(2 BETWEEN 1 AND 3) BETWEEN 1 AND 3`
+select 2 BETWEEN 1 AND 3 BETWEEN 1 AND 3, 2 BETWEEN 1 AND (3 BETWEEN 1 AND 3), (2 BETWEEN 1 AND 3) BETWEEN 1 AND 3 union select * from v1;
+2 BETWEEN 1 AND 3 BETWEEN 1 AND 3 2 BETWEEN 1 AND (3 BETWEEN 1 AND 3) (2 BETWEEN 1 AND 3) BETWEEN 1 AND 3
+0 0 1
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 IS FALSE, 2 LIKE 2 ESCAPE (3 IS FALSE), (2 LIKE 2 ESCAPE 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 is false AS `2 LIKE 2 ESCAPE 3 IS FALSE`,2 like 2 escape (3 is false) AS `2 LIKE 2 ESCAPE (3 IS FALSE)`,2 like 2 escape 3 is false AS `(2 LIKE 2 ESCAPE 3) IS FALSE`
+select 2 LIKE 2 ESCAPE 3 IS FALSE, 2 LIKE 2 ESCAPE (3 IS FALSE), (2 LIKE 2 ESCAPE 3) IS FALSE union select * from v1;
+2 LIKE 2 ESCAPE 3 IS FALSE 2 LIKE 2 ESCAPE (3 IS FALSE) (2 LIKE 2 ESCAPE 3) IS FALSE
+0 1 0
+create or replace view v1 as select charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin), charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin)), charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 like 1 escape 3 collate latin1_bin) AS `charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin)`,charset(2 like 1 escape 3 collate latin1_bin) AS `charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin))`,charset((2 like 1 escape 3) collate latin1_bin) AS `charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin)`
+select charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin), charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin)), charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin) union select * from v1;
+charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin) charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin)) charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin)
+binary binary latin1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN(0,1), 2 LIKE 1 ESCAPE (3 IN(0,1)), (2 LIKE 1 ESCAPE 3) IN(0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 in (0,1) AS `2 LIKE 1 ESCAPE 3 IN(0,1)`,2 like 1 escape (3 in (0,1)) AS `2 LIKE 1 ESCAPE (3 IN(0,1))`,2 like 1 escape 3 in (0,1) AS `(2 LIKE 1 ESCAPE 3) IN(0,1)`
+select 2 LIKE 1 ESCAPE 3 IN(0,1), 2 LIKE 1 ESCAPE (3 IN(0,1)), (2 LIKE 1 ESCAPE 3) IN(0,1) union select * from v1;
+2 LIKE 1 ESCAPE 3 IN(0,1) 2 LIKE 1 ESCAPE (3 IN(0,1)) (2 LIKE 1 ESCAPE 3) IN(0,1)
+1 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 OR 4, 2 LIKE 1 ESCAPE (3 OR 4), (2 LIKE 1 ESCAPE 3) OR 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 or 4 AS `2 LIKE 1 ESCAPE 3 OR 4`,2 like 1 escape (3 or 4) AS `2 LIKE 1 ESCAPE (3 OR 4)`,2 like 1 escape 3 or 4 AS `(2 LIKE 1 ESCAPE 3) OR 4`
+select 2 LIKE 1 ESCAPE 3 OR 4, 2 LIKE 1 ESCAPE (3 OR 4), (2 LIKE 1 ESCAPE 3) OR 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 OR 4 2 LIKE 1 ESCAPE (3 OR 4) (2 LIKE 1 ESCAPE 3) OR 4
+1 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 || 4, 2 LIKE 1 ESCAPE (3 || 4), (2 LIKE 1 ESCAPE 3) || 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 or 4 AS `2 LIKE 1 ESCAPE 3 || 4`,2 like 1 escape (3 or 4) AS `2 LIKE 1 ESCAPE (3 || 4)`,2 like 1 escape 3 or 4 AS `(2 LIKE 1 ESCAPE 3) || 4`
+select 2 LIKE 1 ESCAPE 3 || 4, 2 LIKE 1 ESCAPE (3 || 4), (2 LIKE 1 ESCAPE 3) || 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 || 4 2 LIKE 1 ESCAPE (3 || 4) (2 LIKE 1 ESCAPE 3) || 4
+1 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 XOR 4, 2 LIKE 1 ESCAPE (3 XOR 4), (2 LIKE 1 ESCAPE 3) XOR 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 xor 4 AS `2 LIKE 1 ESCAPE 3 XOR 4`,2 like 1 escape (3 xor 4) AS `2 LIKE 1 ESCAPE (3 XOR 4)`,2 like 1 escape 3 xor 4 AS `(2 LIKE 1 ESCAPE 3) XOR 4`
+select 2 LIKE 1 ESCAPE 3 XOR 4, 2 LIKE 1 ESCAPE (3 XOR 4), (2 LIKE 1 ESCAPE 3) XOR 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 XOR 4 2 LIKE 1 ESCAPE (3 XOR 4) (2 LIKE 1 ESCAPE 3) XOR 4
+1 0 1
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 AND 0, 2 LIKE 2 ESCAPE (3 AND 0), (2 LIKE 2 ESCAPE 3) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 and 0 AS `2 LIKE 2 ESCAPE 3 AND 0`,2 like 2 escape (3 and 0) AS `2 LIKE 2 ESCAPE (3 AND 0)`,2 like 2 escape 3 and 0 AS `(2 LIKE 2 ESCAPE 3) AND 0`
+select 2 LIKE 2 ESCAPE 3 AND 0, 2 LIKE 2 ESCAPE (3 AND 0), (2 LIKE 2 ESCAPE 3) AND 0 union select * from v1;
+2 LIKE 2 ESCAPE 3 AND 0 2 LIKE 2 ESCAPE (3 AND 0) (2 LIKE 2 ESCAPE 3) AND 0
+0 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 && 0, 2 LIKE 2 ESCAPE (3 && 0), (2 LIKE 2 ESCAPE 3) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 and 0 AS `2 LIKE 2 ESCAPE 3 && 0`,2 like 2 escape (3 and 0) AS `2 LIKE 2 ESCAPE (3 && 0)`,2 like 2 escape 3 and 0 AS `(2 LIKE 2 ESCAPE 3) && 0`
+select 2 LIKE 2 ESCAPE 3 && 0, 2 LIKE 2 ESCAPE (3 && 0), (2 LIKE 2 ESCAPE 3) && 0 union select * from v1;
+2 LIKE 2 ESCAPE 3 && 0 2 LIKE 2 ESCAPE (3 && 0) (2 LIKE 2 ESCAPE 3) && 0
+0 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 = 4, 2 LIKE 2 ESCAPE (3 = 4), (2 LIKE 2 ESCAPE 3) = 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 = 4 AS `2 LIKE 2 ESCAPE 3 = 4`,2 like 2 escape (3 = 4) AS `2 LIKE 2 ESCAPE (3 = 4)`,2 like 2 escape 3 = 4 AS `(2 LIKE 2 ESCAPE 3) = 4`
+select 2 LIKE 2 ESCAPE 3 = 4, 2 LIKE 2 ESCAPE (3 = 4), (2 LIKE 2 ESCAPE 3) = 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 = 4 2 LIKE 2 ESCAPE (3 = 4) (2 LIKE 2 ESCAPE 3) = 4
+0 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 <=> 4, 2 LIKE 2 ESCAPE (3 <=> 4), (2 LIKE 2 ESCAPE 3) <=> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 <=> 4 AS `2 LIKE 2 ESCAPE 3 <=> 4`,2 like 2 escape (3 <=> 4) AS `2 LIKE 2 ESCAPE (3 <=> 4)`,2 like 2 escape 3 <=> 4 AS `(2 LIKE 2 ESCAPE 3) <=> 4`
+select 2 LIKE 2 ESCAPE 3 <=> 4, 2 LIKE 2 ESCAPE (3 <=> 4), (2 LIKE 2 ESCAPE 3) <=> 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 <=> 4 2 LIKE 2 ESCAPE (3 <=> 4) (2 LIKE 2 ESCAPE 3) <=> 4
+0 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 >= 4, 2 LIKE 2 ESCAPE (3 >= 4), (2 LIKE 2 ESCAPE 3) >= 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 >= 4 AS `2 LIKE 2 ESCAPE 3 >= 4`,2 like 2 escape (3 >= 4) AS `2 LIKE 2 ESCAPE (3 >= 4)`,2 like 2 escape 3 >= 4 AS `(2 LIKE 2 ESCAPE 3) >= 4`
+select 2 LIKE 2 ESCAPE 3 >= 4, 2 LIKE 2 ESCAPE (3 >= 4), (2 LIKE 2 ESCAPE 3) >= 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 >= 4 2 LIKE 2 ESCAPE (3 >= 4) (2 LIKE 2 ESCAPE 3) >= 4
+0 1 0
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 <= 4, 2 LIKE 1 ESCAPE (3 <= 4), (2 LIKE 1 ESCAPE 3) <= 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 <= 4 AS `2 LIKE 1 ESCAPE 3 <= 4`,2 like 1 escape (3 <= 4) AS `2 LIKE 1 ESCAPE (3 <= 4)`,2 like 1 escape 3 <= 4 AS `(2 LIKE 1 ESCAPE 3) <= 4`
+select 2 LIKE 1 ESCAPE 3 <= 4, 2 LIKE 1 ESCAPE (3 <= 4), (2 LIKE 1 ESCAPE 3) <= 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 <= 4 2 LIKE 1 ESCAPE (3 <= 4) (2 LIKE 1 ESCAPE 3) <= 4
+1 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 < 4, 2 LIKE 1 ESCAPE (3 < 4), (2 LIKE 1 ESCAPE 3) < 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 < 4 AS `2 LIKE 1 ESCAPE 3 < 4`,2 like 1 escape (3 < 4) AS `2 LIKE 1 ESCAPE (3 < 4)`,2 like 1 escape 3 < 4 AS `(2 LIKE 1 ESCAPE 3) < 4`
+select 2 LIKE 1 ESCAPE 3 < 4, 2 LIKE 1 ESCAPE (3 < 4), (2 LIKE 1 ESCAPE 3) < 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 < 4 2 LIKE 1 ESCAPE (3 < 4) (2 LIKE 1 ESCAPE 3) < 4
+1 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 <> 4, 2 LIKE 1 ESCAPE (3 <> 4), (2 LIKE 1 ESCAPE 3) <> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 <> 4 AS `2 LIKE 1 ESCAPE 3 <> 4`,2 like 1 escape (3 <> 4) AS `2 LIKE 1 ESCAPE (3 <> 4)`,2 like 1 escape 3 <> 4 AS `(2 LIKE 1 ESCAPE 3) <> 4`
+select 2 LIKE 1 ESCAPE 3 <> 4, 2 LIKE 1 ESCAPE (3 <> 4), (2 LIKE 1 ESCAPE 3) <> 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 <> 4 2 LIKE 1 ESCAPE (3 <> 4) (2 LIKE 1 ESCAPE 3) <> 4
+1 0 1
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 > 4, 2 LIKE 2 ESCAPE (3 > 4), (2 LIKE 2 ESCAPE 3) > 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 > 4 AS `2 LIKE 2 ESCAPE 3 > 4`,2 like 2 escape (3 > 4) AS `2 LIKE 2 ESCAPE (3 > 4)`,2 like 2 escape 3 > 4 AS `(2 LIKE 2 ESCAPE 3) > 4`
+select 2 LIKE 2 ESCAPE 3 > 4, 2 LIKE 2 ESCAPE (3 > 4), (2 LIKE 2 ESCAPE 3) > 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 > 4 2 LIKE 2 ESCAPE (3 > 4) (2 LIKE 2 ESCAPE 3) > 4
+0 1 0
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 != 4, 2 LIKE 1 ESCAPE (3 != 4), (2 LIKE 1 ESCAPE 3) != 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 <> 4 AS `2 LIKE 1 ESCAPE 3 != 4`,2 like 1 escape (3 <> 4) AS `2 LIKE 1 ESCAPE (3 != 4)`,2 like 1 escape 3 <> 4 AS `(2 LIKE 1 ESCAPE 3) != 4`
+select 2 LIKE 1 ESCAPE 3 != 4, 2 LIKE 1 ESCAPE (3 != 4), (2 LIKE 1 ESCAPE 3) != 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 != 4 2 LIKE 1 ESCAPE (3 != 4) (2 LIKE 1 ESCAPE 3) != 4
+1 0 1
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 LIKE 4, 2 LIKE 2 ESCAPE (3 LIKE 4), (2 LIKE 2 ESCAPE 3) LIKE 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 like 4 AS `2 LIKE 2 ESCAPE 3 LIKE 4`,2 like 2 escape (3 like 4) AS `2 LIKE 2 ESCAPE (3 LIKE 4)`,2 like 2 escape 3 like 4 AS `(2 LIKE 2 ESCAPE 3) LIKE 4`
+select 2 LIKE 2 ESCAPE 3 LIKE 4, 2 LIKE 2 ESCAPE (3 LIKE 4), (2 LIKE 2 ESCAPE 3) LIKE 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 LIKE 4 2 LIKE 2 ESCAPE (3 LIKE 4) (2 LIKE 2 ESCAPE 3) LIKE 4
+0 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 REGEXP 4, 2 LIKE 2 ESCAPE (3 REGEXP 4), (2 LIKE 2 ESCAPE 3) REGEXP 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 regexp 4 AS `2 LIKE 2 ESCAPE 3 REGEXP 4`,2 like 2 escape (3 regexp 4) AS `2 LIKE 2 ESCAPE (3 REGEXP 4)`,2 like 2 escape 3 regexp 4 AS `(2 LIKE 2 ESCAPE 3) REGEXP 4`
+select 2 LIKE 2 ESCAPE 3 REGEXP 4, 2 LIKE 2 ESCAPE (3 REGEXP 4), (2 LIKE 2 ESCAPE 3) REGEXP 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 REGEXP 4 2 LIKE 2 ESCAPE (3 REGEXP 4) (2 LIKE 2 ESCAPE 3) REGEXP 4
+0 1 0
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 | 4, 2 LIKE 1 ESCAPE (3 | 4), (2 LIKE 1 ESCAPE 3) | 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 | 4 AS `2 LIKE 1 ESCAPE 3 | 4`,2 like 1 escape 3 | 4 AS `2 LIKE 1 ESCAPE (3 | 4)`,(2 like 1 escape 3) | 4 AS `(2 LIKE 1 ESCAPE 3) | 4`
+select 2 LIKE 1 ESCAPE 3 | 4, 2 LIKE 1 ESCAPE (3 | 4), (2 LIKE 1 ESCAPE 3) | 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 | 4 2 LIKE 1 ESCAPE (3 | 4) (2 LIKE 1 ESCAPE 3) | 4
+0 0 4
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 & 4, 2 LIKE 2 ESCAPE (3 & 4), (2 LIKE 2 ESCAPE 3) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 & 4 AS `2 LIKE 2 ESCAPE 3 & 4`,2 like 2 escape 3 & 4 AS `2 LIKE 2 ESCAPE (3 & 4)`,(2 like 2 escape 3) & 4 AS `(2 LIKE 2 ESCAPE 3) & 4`
+select 2 LIKE 2 ESCAPE 3 & 4, 2 LIKE 2 ESCAPE (3 & 4), (2 LIKE 2 ESCAPE 3) & 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 & 4 2 LIKE 2 ESCAPE (3 & 4) (2 LIKE 2 ESCAPE 3) & 4
+1 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 1 << 1, 2 LIKE 2 ESCAPE (1 << 1), (2 LIKE 2 ESCAPE 1) << 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 1 << 1 AS `2 LIKE 2 ESCAPE 1 << 1`,2 like 2 escape 1 << 1 AS `2 LIKE 2 ESCAPE (1 << 1)`,(2 like 2 escape 1) << 1 AS `(2 LIKE 2 ESCAPE 1) << 1`
+select 2 LIKE 2 ESCAPE 1 << 1, 2 LIKE 2 ESCAPE (1 << 1), (2 LIKE 2 ESCAPE 1) << 1 union select * from v1;
+2 LIKE 2 ESCAPE 1 << 1 2 LIKE 2 ESCAPE (1 << 1) (2 LIKE 2 ESCAPE 1) << 1
+1 1 2
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 >> 4, 2 LIKE 2 ESCAPE (3 >> 4), (2 LIKE 2 ESCAPE 3) >> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 >> 4 AS `2 LIKE 2 ESCAPE 3 >> 4`,2 like 2 escape 3 >> 4 AS `2 LIKE 2 ESCAPE (3 >> 4)`,(2 like 2 escape 3) >> 4 AS `(2 LIKE 2 ESCAPE 3) >> 4`
+select 2 LIKE 2 ESCAPE 3 >> 4, 2 LIKE 2 ESCAPE (3 >> 4), (2 LIKE 2 ESCAPE 3) >> 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 >> 4 2 LIKE 2 ESCAPE (3 >> 4) (2 LIKE 2 ESCAPE 3) >> 4
+1 1 0
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY, 2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY), (2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 + interval 1 day AS `2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY`,2 like 1 escape 3 + interval 1 day AS `2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY)`,(2 like 1 escape 3) + interval 1 day AS `(2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY`
+select 2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY, 2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY), (2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY union select * from v1;
+2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY 2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY) (2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY
+0 0 NULL
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 + 4, 2 LIKE 1 ESCAPE (3 + 4), (2 LIKE 1 ESCAPE 3) + 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 + 4 AS `2 LIKE 1 ESCAPE 3 + 4`,2 like 1 escape 3 + 4 AS `2 LIKE 1 ESCAPE (3 + 4)`,(2 like 1 escape 3) + 4 AS `(2 LIKE 1 ESCAPE 3) + 4`
+select 2 LIKE 1 ESCAPE 3 + 4, 2 LIKE 1 ESCAPE (3 + 4), (2 LIKE 1 ESCAPE 3) + 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 + 4 2 LIKE 1 ESCAPE (3 + 4) (2 LIKE 1 ESCAPE 3) + 4
+0 0 4
+create or replace view v1 as select 2 LIKE 2 ESCAPE 1 - 1, 2 LIKE 2 ESCAPE (1 - 1), (2 LIKE 2 ESCAPE 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 1 - 1 AS `2 LIKE 2 ESCAPE 1 - 1`,2 like 2 escape 1 - 1 AS `2 LIKE 2 ESCAPE (1 - 1)`,(2 like 2 escape 1) - 1 AS `(2 LIKE 2 ESCAPE 1) - 1`
+select 2 LIKE 2 ESCAPE 1 - 1, 2 LIKE 2 ESCAPE (1 - 1), (2 LIKE 2 ESCAPE 1) - 1 union select * from v1;
+2 LIKE 2 ESCAPE 1 - 1 2 LIKE 2 ESCAPE (1 - 1) (2 LIKE 2 ESCAPE 1) - 1
+1 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 * 0, 2 LIKE 2 ESCAPE (3 * 0), (2 LIKE 2 ESCAPE 3) * 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 * 0 AS `2 LIKE 2 ESCAPE 3 * 0`,2 like 2 escape 3 * 0 AS `2 LIKE 2 ESCAPE (3 * 0)`,(2 like 2 escape 3) * 0 AS `(2 LIKE 2 ESCAPE 3) * 0`
+select 2 LIKE 2 ESCAPE 3 * 0, 2 LIKE 2 ESCAPE (3 * 0), (2 LIKE 2 ESCAPE 3) * 0 union select * from v1;
+2 LIKE 2 ESCAPE 3 * 0 2 LIKE 2 ESCAPE (3 * 0) (2 LIKE 2 ESCAPE 3) * 0
+1 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 DIV 3, 2 LIKE 2 ESCAPE (3 DIV 3), (2 LIKE 2 ESCAPE 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 DIV 3 AS `2 LIKE 2 ESCAPE 3 DIV 3`,2 like 2 escape 3 DIV 3 AS `2 LIKE 2 ESCAPE (3 DIV 3)`,(2 like 2 escape 3) DIV 3 AS `(2 LIKE 2 ESCAPE 3) DIV 3`
+select 2 LIKE 2 ESCAPE 3 DIV 3, 2 LIKE 2 ESCAPE (3 DIV 3), (2 LIKE 2 ESCAPE 3) DIV 3 union select * from v1;
+2 LIKE 2 ESCAPE 3 DIV 3 2 LIKE 2 ESCAPE (3 DIV 3) (2 LIKE 2 ESCAPE 3) DIV 3
+1 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 MOD 1, 2 LIKE 2 ESCAPE (3 MOD 1), (2 LIKE 2 ESCAPE 3) MOD 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 % 1 AS `2 LIKE 2 ESCAPE 3 MOD 1`,2 like 2 escape 3 % 1 AS `2 LIKE 2 ESCAPE (3 MOD 1)`,(2 like 2 escape 3) % 1 AS `(2 LIKE 2 ESCAPE 3) MOD 1`
+select 2 LIKE 2 ESCAPE 3 MOD 1, 2 LIKE 2 ESCAPE (3 MOD 1), (2 LIKE 2 ESCAPE 3) MOD 1 union select * from v1;
+2 LIKE 2 ESCAPE 3 MOD 1 2 LIKE 2 ESCAPE (3 MOD 1) (2 LIKE 2 ESCAPE 3) MOD 1
+1 1 0
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 % 1, 2 LIKE 2 ESCAPE (3 % 1), (2 LIKE 2 ESCAPE 3) % 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 % 1 AS `2 LIKE 2 ESCAPE 3 % 1`,2 like 2 escape 3 % 1 AS `2 LIKE 2 ESCAPE (3 % 1)`,(2 like 2 escape 3) % 1 AS `(2 LIKE 2 ESCAPE 3) % 1`
+select 2 LIKE 2 ESCAPE 3 % 1, 2 LIKE 2 ESCAPE (3 % 1), (2 LIKE 2 ESCAPE 3) % 1 union select * from v1;
+2 LIKE 2 ESCAPE 3 % 1 2 LIKE 2 ESCAPE (3 % 1) (2 LIKE 2 ESCAPE 3) % 1
+1 1 0
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 ^ 4, 2 LIKE 1 ESCAPE (3 ^ 4), (2 LIKE 1 ESCAPE 3) ^ 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 ^ 4 AS `2 LIKE 1 ESCAPE 3 ^ 4`,2 like 1 escape 3 ^ 4 AS `2 LIKE 1 ESCAPE (3 ^ 4)`,(2 like 1 escape 3) ^ 4 AS `(2 LIKE 1 ESCAPE 3) ^ 4`
+select 2 LIKE 1 ESCAPE 3 ^ 4, 2 LIKE 1 ESCAPE (3 ^ 4), (2 LIKE 1 ESCAPE 3) ^ 4 union select * from v1;
+2 LIKE 1 ESCAPE 3 ^ 4 2 LIKE 1 ESCAPE (3 ^ 4) (2 LIKE 1 ESCAPE 3) ^ 4
+0 0 4
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4, 2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4), (2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 2 escape 3 between 2 and 4 AS `2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4`,2 like 2 escape (3 between 2 and 4) AS `2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4)`,2 like 2 escape 3 between 2 and 4 AS `(2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4`
+select 2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4, 2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4), (2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4 union select * from v1;
+2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4 2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4) (2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4
+0 1 0
+create or replace view v1 as select NOT 2 IN (SELECT 0 UNION SELECT 2), NOT (2 IN (SELECT 0 UNION SELECT 2)), (NOT 2) IN (SELECT 0 UNION SELECT 2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !(2 in (select 0 union select 2)) AS `NOT 2 IN (SELECT 0 UNION SELECT 2)`,!(2 in (select 0 union select 2)) AS `NOT (2 IN (SELECT 0 UNION SELECT 2))`,!2 in (select 0 union select 2) AS `(NOT 2) IN (SELECT 0 UNION SELECT 2)`
+select NOT 2 IN (SELECT 0 UNION SELECT 2), NOT (2 IN (SELECT 0 UNION SELECT 2)), (NOT 2) IN (SELECT 0 UNION SELECT 2) union select * from v1;
+NOT 2 IN (SELECT 0 UNION SELECT 2) NOT (2 IN (SELECT 0 UNION SELECT 2)) (NOT 2) IN (SELECT 0 UNION SELECT 2)
+0 0 1
+create or replace view v1 as select - 2 IN (SELECT 2 UNION SELECT 1), - (2 IN (SELECT 2 UNION SELECT 1)), (- 2) IN (SELECT 2 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -2 in (select 2 union select 1) AS `- 2 IN (SELECT 2 UNION SELECT 1)`,-(2 in (select 2 union select 1)) AS `- (2 IN (SELECT 2 UNION SELECT 1))`,-2 in (select 2 union select 1) AS `(- 2) IN (SELECT 2 UNION SELECT 1)`
+select - 2 IN (SELECT 2 UNION SELECT 1), - (2 IN (SELECT 2 UNION SELECT 1)), (- 2) IN (SELECT 2 UNION SELECT 1) union select * from v1;
+- 2 IN (SELECT 2 UNION SELECT 1) - (2 IN (SELECT 2 UNION SELECT 1)) (- 2) IN (SELECT 2 UNION SELECT 1)
+0 -1 0
+create or replace view v1 as select ~ 2 IN (SELECT 0 UNION SELECT 1), ~ (2 IN (SELECT 0 UNION SELECT 1)), (~ 2) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select ~2 in (select 0 union select 1) AS `~ 2 IN (SELECT 0 UNION SELECT 1)`,~(2 in (select 0 union select 1)) AS `~ (2 IN (SELECT 0 UNION SELECT 1))`,~2 in (select 0 union select 1) AS `(~ 2) IN (SELECT 0 UNION SELECT 1)`
+select ~ 2 IN (SELECT 0 UNION SELECT 1), ~ (2 IN (SELECT 0 UNION SELECT 1)), (~ 2) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+~ 2 IN (SELECT 0 UNION SELECT 1) ~ (2 IN (SELECT 0 UNION SELECT 1)) (~ 2) IN (SELECT 0 UNION SELECT 1)
+0 18446744073709551615 0
+create or replace view v1 as select ! 2 IN (SELECT 0 UNION SELECT 2), ! (2 IN (SELECT 0 UNION SELECT 2)), (! 2) IN (SELECT 0 UNION SELECT 2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !2 in (select 0 union select 2) AS `! 2 IN (SELECT 0 UNION SELECT 2)`,!(2 in (select 0 union select 2)) AS `! (2 IN (SELECT 0 UNION SELECT 2))`,!2 in (select 0 union select 2) AS `(! 2) IN (SELECT 0 UNION SELECT 2)`
+select ! 2 IN (SELECT 0 UNION SELECT 2), ! (2 IN (SELECT 0 UNION SELECT 2)), (! 2) IN (SELECT 0 UNION SELECT 2) union select * from v1;
+! 2 IN (SELECT 0 UNION SELECT 2) ! (2 IN (SELECT 0 UNION SELECT 2)) (! 2) IN (SELECT 0 UNION SELECT 2)
+1 0 1
+create or replace view v1 as select BINARY 'c' IN (SELECT 'C' UNION SELECT 'X'), BINARY ('c' IN (SELECT 'C' UNION SELECT 'X')), (BINARY 'c') IN (SELECT 'C' UNION SELECT 'X');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast('c' as char charset binary) in (select 'C' union select 'X') AS `BINARY 'c' IN (SELECT 'C' UNION SELECT 'X')`,cast('c' in (select 'C' union select 'X') as char charset binary) AS `BINARY ('c' IN (SELECT 'C' UNION SELECT 'X'))`,cast('c' as char charset binary) in (select 'C' union select 'X') AS `(BINARY 'c') IN (SELECT 'C' UNION SELECT 'X')`
+select BINARY 'c' IN (SELECT 'C' UNION SELECT 'X'), BINARY ('c' IN (SELECT 'C' UNION SELECT 'X')), (BINARY 'c') IN (SELECT 'C' UNION SELECT 'X') union select * from v1;
+BINARY 'c' IN (SELECT 'C' UNION SELECT 'X') BINARY ('c' IN (SELECT 'C' UNION SELECT 'X')) (BINARY 'c') IN (SELECT 'C' UNION SELECT 'X')
+0 1 0
+create or replace view v1 as select 0 OR 3 IN (SELECT 3 UNION SELECT 10), 0 OR (3 IN (SELECT 3 UNION SELECT 10)), (0 OR 3) IN (SELECT 3 UNION SELECT 10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 in (select 3 union select 10) AS `0 OR 3 IN (SELECT 3 UNION SELECT 10)`,0 or 3 in (select 3 union select 10) AS `0 OR (3 IN (SELECT 3 UNION SELECT 10))`,(0 or 3) in (select 3 union select 10) AS `(0 OR 3) IN (SELECT 3 UNION SELECT 10)`
+select 0 OR 3 IN (SELECT 3 UNION SELECT 10), 0 OR (3 IN (SELECT 3 UNION SELECT 10)), (0 OR 3) IN (SELECT 3 UNION SELECT 10) union select * from v1;
+0 OR 3 IN (SELECT 3 UNION SELECT 10) 0 OR (3 IN (SELECT 3 UNION SELECT 10)) (0 OR 3) IN (SELECT 3 UNION SELECT 10)
+1 1 0
+create or replace view v1 as select 0 || 3 IN (SELECT 3 UNION SELECT 10), 0 || (3 IN (SELECT 3 UNION SELECT 10)), (0 || 3) IN (SELECT 3 UNION SELECT 10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 or 3 in (select 3 union select 10) AS `0 || 3 IN (SELECT 3 UNION SELECT 10)`,0 or 3 in (select 3 union select 10) AS `0 || (3 IN (SELECT 3 UNION SELECT 10))`,(0 or 3) in (select 3 union select 10) AS `(0 || 3) IN (SELECT 3 UNION SELECT 10)`
+select 0 || 3 IN (SELECT 3 UNION SELECT 10), 0 || (3 IN (SELECT 3 UNION SELECT 10)), (0 || 3) IN (SELECT 3 UNION SELECT 10) union select * from v1;
+0 || 3 IN (SELECT 3 UNION SELECT 10) 0 || (3 IN (SELECT 3 UNION SELECT 10)) (0 || 3) IN (SELECT 3 UNION SELECT 10)
+1 1 0
+create or replace view v1 as select 2 XOR 3 IN (SELECT 4 UNION SELECT 5), 2 XOR (3 IN (SELECT 4 UNION SELECT 5)), (2 XOR 3) IN (SELECT 4 UNION SELECT 5);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor 3 in (select 4 union select 5) AS `2 XOR 3 IN (SELECT 4 UNION SELECT 5)`,2 xor 3 in (select 4 union select 5) AS `2 XOR (3 IN (SELECT 4 UNION SELECT 5))`,(2 xor 3) in (select 4 union select 5) AS `(2 XOR 3) IN (SELECT 4 UNION SELECT 5)`
+select 2 XOR 3 IN (SELECT 4 UNION SELECT 5), 2 XOR (3 IN (SELECT 4 UNION SELECT 5)), (2 XOR 3) IN (SELECT 4 UNION SELECT 5) union select * from v1;
+2 XOR 3 IN (SELECT 4 UNION SELECT 5) 2 XOR (3 IN (SELECT 4 UNION SELECT 5)) (2 XOR 3) IN (SELECT 4 UNION SELECT 5)
+1 1 0
+create or replace view v1 as select 2 AND 3 IN (SELECT 0 UNION SELECT 1), 2 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 AND 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 in (select 0 union select 1) AS `2 AND 3 IN (SELECT 0 UNION SELECT 1)`,2 and 3 in (select 0 union select 1) AS `2 AND (3 IN (SELECT 0 UNION SELECT 1))`,(2 and 3) in (select 0 union select 1) AS `(2 AND 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 AND 3 IN (SELECT 0 UNION SELECT 1), 2 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 AND 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 AND 3 IN (SELECT 0 UNION SELECT 1) 2 AND (3 IN (SELECT 0 UNION SELECT 1)) (2 AND 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 && 3 IN (SELECT 0 UNION SELECT 1), 2 && (3 IN (SELECT 0 UNION SELECT 1)), (2 && 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 and 3 in (select 0 union select 1) AS `2 && 3 IN (SELECT 0 UNION SELECT 1)`,2 and 3 in (select 0 union select 1) AS `2 && (3 IN (SELECT 0 UNION SELECT 1))`,(2 and 3) in (select 0 union select 1) AS `(2 && 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 && 3 IN (SELECT 0 UNION SELECT 1), 2 && (3 IN (SELECT 0 UNION SELECT 1)), (2 && 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 && 3 IN (SELECT 0 UNION SELECT 1) 2 && (3 IN (SELECT 0 UNION SELECT 1)) (2 && 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 = 3 IN (SELECT 0 UNION SELECT 1), 2 = (3 IN (SELECT 0 UNION SELECT 1)), (2 = 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = 3 in (select 0 union select 1) AS `2 = 3 IN (SELECT 0 UNION SELECT 1)`,2 = 3 in (select 0 union select 1) AS `2 = (3 IN (SELECT 0 UNION SELECT 1))`,(2 = 3) in (select 0 union select 1) AS `(2 = 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 = 3 IN (SELECT 0 UNION SELECT 1), 2 = (3 IN (SELECT 0 UNION SELECT 1)), (2 = 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 = 3 IN (SELECT 0 UNION SELECT 1) 2 = (3 IN (SELECT 0 UNION SELECT 1)) (2 = 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 <=> 3 IN (SELECT 0 UNION SELECT 1), 2 <=> (3 IN (SELECT 0 UNION SELECT 1)), (2 <=> 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> 3 in (select 0 union select 1) AS `2 <=> 3 IN (SELECT 0 UNION SELECT 1)`,2 <=> 3 in (select 0 union select 1) AS `2 <=> (3 IN (SELECT 0 UNION SELECT 1))`,(2 <=> 3) in (select 0 union select 1) AS `(2 <=> 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 <=> 3 IN (SELECT 0 UNION SELECT 1), 2 <=> (3 IN (SELECT 0 UNION SELECT 1)), (2 <=> 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 <=> 3 IN (SELECT 0 UNION SELECT 1) 2 <=> (3 IN (SELECT 0 UNION SELECT 1)) (2 <=> 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 >= 3 IN (SELECT 1 UNION SELECT 1), 2 >= (3 IN (SELECT 1 UNION SELECT 1)), (2 >= 3) IN (SELECT 1 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= 3 in (select 1 union select 1) AS `2 >= 3 IN (SELECT 1 UNION SELECT 1)`,2 >= 3 in (select 1 union select 1) AS `2 >= (3 IN (SELECT 1 UNION SELECT 1))`,(2 >= 3) in (select 1 union select 1) AS `(2 >= 3) IN (SELECT 1 UNION SELECT 1)`
+select 2 >= 3 IN (SELECT 1 UNION SELECT 1), 2 >= (3 IN (SELECT 1 UNION SELECT 1)), (2 >= 3) IN (SELECT 1 UNION SELECT 1) union select * from v1;
+2 >= 3 IN (SELECT 1 UNION SELECT 1) 2 >= (3 IN (SELECT 1 UNION SELECT 1)) (2 >= 3) IN (SELECT 1 UNION SELECT 1)
+1 1 0
+create or replace view v1 as select 2 <= 3 IN (SELECT 0 UNION SELECT 1), 2 <= (3 IN (SELECT 0 UNION SELECT 1)), (2 <= 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= 3 in (select 0 union select 1) AS `2 <= 3 IN (SELECT 0 UNION SELECT 1)`,2 <= 3 in (select 0 union select 1) AS `2 <= (3 IN (SELECT 0 UNION SELECT 1))`,(2 <= 3) in (select 0 union select 1) AS `(2 <= 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 <= 3 IN (SELECT 0 UNION SELECT 1), 2 <= (3 IN (SELECT 0 UNION SELECT 1)), (2 <= 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 <= 3 IN (SELECT 0 UNION SELECT 1) 2 <= (3 IN (SELECT 0 UNION SELECT 1)) (2 <= 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 < 3 IN (SELECT 0 UNION SELECT 1), 2 < (3 IN (SELECT 0 UNION SELECT 1)), (2 < 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < 3 in (select 0 union select 1) AS `2 < 3 IN (SELECT 0 UNION SELECT 1)`,2 < 3 in (select 0 union select 1) AS `2 < (3 IN (SELECT 0 UNION SELECT 1))`,(2 < 3) in (select 0 union select 1) AS `(2 < 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 < 3 IN (SELECT 0 UNION SELECT 1), 2 < (3 IN (SELECT 0 UNION SELECT 1)), (2 < 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 < 3 IN (SELECT 0 UNION SELECT 1) 2 < (3 IN (SELECT 0 UNION SELECT 1)) (2 < 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 <> 3 IN (SELECT 0 UNION SELECT 0), 2 <> (3 IN (SELECT 0 UNION SELECT 0)), (2 <> 3) IN (SELECT 0 UNION SELECT 0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 in (select 0 union select 0) AS `2 <> 3 IN (SELECT 0 UNION SELECT 0)`,2 <> 3 in (select 0 union select 0) AS `2 <> (3 IN (SELECT 0 UNION SELECT 0))`,(2 <> 3) in (select 0 union select 0) AS `(2 <> 3) IN (SELECT 0 UNION SELECT 0)`
+select 2 <> 3 IN (SELECT 0 UNION SELECT 0), 2 <> (3 IN (SELECT 0 UNION SELECT 0)), (2 <> 3) IN (SELECT 0 UNION SELECT 0) union select * from v1;
+2 <> 3 IN (SELECT 0 UNION SELECT 0) 2 <> (3 IN (SELECT 0 UNION SELECT 0)) (2 <> 3) IN (SELECT 0 UNION SELECT 0)
+1 1 0
+create or replace view v1 as select 2 > 3 IN (SELECT 1 UNION SELECT 1), 2 > (3 IN (SELECT 1 UNION SELECT 1)), (2 > 3) IN (SELECT 1 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 > 3 in (select 1 union select 1) AS `2 > 3 IN (SELECT 1 UNION SELECT 1)`,2 > 3 in (select 1 union select 1) AS `2 > (3 IN (SELECT 1 UNION SELECT 1))`,(2 > 3) in (select 1 union select 1) AS `(2 > 3) IN (SELECT 1 UNION SELECT 1)`
+select 2 > 3 IN (SELECT 1 UNION SELECT 1), 2 > (3 IN (SELECT 1 UNION SELECT 1)), (2 > 3) IN (SELECT 1 UNION SELECT 1) union select * from v1;
+2 > 3 IN (SELECT 1 UNION SELECT 1) 2 > (3 IN (SELECT 1 UNION SELECT 1)) (2 > 3) IN (SELECT 1 UNION SELECT 1)
+1 1 0
+create or replace view v1 as select 2 != 3 IN (SELECT 0 UNION SELECT 0), 2 != (3 IN (SELECT 0 UNION SELECT 0)), (2 != 3) IN (SELECT 0 UNION SELECT 0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <> 3 in (select 0 union select 0) AS `2 != 3 IN (SELECT 0 UNION SELECT 0)`,2 <> 3 in (select 0 union select 0) AS `2 != (3 IN (SELECT 0 UNION SELECT 0))`,(2 <> 3) in (select 0 union select 0) AS `(2 != 3) IN (SELECT 0 UNION SELECT 0)`
+select 2 != 3 IN (SELECT 0 UNION SELECT 0), 2 != (3 IN (SELECT 0 UNION SELECT 0)), (2 != 3) IN (SELECT 0 UNION SELECT 0) union select * from v1;
+2 != 3 IN (SELECT 0 UNION SELECT 0) 2 != (3 IN (SELECT 0 UNION SELECT 0)) (2 != 3) IN (SELECT 0 UNION SELECT 0)
+1 1 0
+create or replace view v1 as select 2 LIKE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 3 in (select 0 union select 1) AS `2 LIKE 3 IN (SELECT 0 UNION SELECT 1)`,2 like (3 in (select 0 union select 1)) AS `2 LIKE (3 IN (SELECT 0 UNION SELECT 1))`,2 like 3 in (select 0 union select 1) AS `(2 LIKE 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 LIKE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 LIKE 3 IN (SELECT 0 UNION SELECT 1) 2 LIKE (3 IN (SELECT 0 UNION SELECT 1)) (2 LIKE 3) IN (SELECT 0 UNION SELECT 1)
+1 0 1
+create or replace view v1 as select 2 REGEXP 3 IN (SELECT 0 UNION SELECT 1), 2 REGEXP (3 IN (SELECT 0 UNION SELECT 1)), (2 REGEXP 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp 3 in (select 0 union select 1) AS `2 REGEXP 3 IN (SELECT 0 UNION SELECT 1)`,2 regexp (3 in (select 0 union select 1)) AS `2 REGEXP (3 IN (SELECT 0 UNION SELECT 1))`,2 regexp 3 in (select 0 union select 1) AS `(2 REGEXP 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 REGEXP 3 IN (SELECT 0 UNION SELECT 1), 2 REGEXP (3 IN (SELECT 0 UNION SELECT 1)), (2 REGEXP 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 REGEXP 3 IN (SELECT 0 UNION SELECT 1) 2 REGEXP (3 IN (SELECT 0 UNION SELECT 1)) (2 REGEXP 3) IN (SELECT 0 UNION SELECT 1)
+1 0 1
+create or replace view v1 as select 2 | 3 IN (SELECT 0 UNION SELECT 1), 2 | (3 IN (SELECT 0 UNION SELECT 1)), (2 | 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | 3 in (select 0 union select 1) AS `2 | 3 IN (SELECT 0 UNION SELECT 1)`,2 | (3 in (select 0 union select 1)) AS `2 | (3 IN (SELECT 0 UNION SELECT 1))`,2 | 3 in (select 0 union select 1) AS `(2 | 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 | 3 IN (SELECT 0 UNION SELECT 1), 2 | (3 IN (SELECT 0 UNION SELECT 1)), (2 | 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 | 3 IN (SELECT 0 UNION SELECT 1) 2 | (3 IN (SELECT 0 UNION SELECT 1)) (2 | 3) IN (SELECT 0 UNION SELECT 1)
+0 2 0
+create or replace view v1 as select 2 & 4 IN (SELECT 0 UNION SELECT 1), 2 & (4 IN (SELECT 0 UNION SELECT 1)), (2 & 4) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & 4 in (select 0 union select 1) AS `2 & 4 IN (SELECT 0 UNION SELECT 1)`,2 & (4 in (select 0 union select 1)) AS `2 & (4 IN (SELECT 0 UNION SELECT 1))`,2 & 4 in (select 0 union select 1) AS `(2 & 4) IN (SELECT 0 UNION SELECT 1)`
+select 2 & 4 IN (SELECT 0 UNION SELECT 1), 2 & (4 IN (SELECT 0 UNION SELECT 1)), (2 & 4) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 & 4 IN (SELECT 0 UNION SELECT 1) 2 & (4 IN (SELECT 0 UNION SELECT 1)) (2 & 4) IN (SELECT 0 UNION SELECT 1)
+1 0 1
+create or replace view v1 as select 2 << 3 IN (SELECT 0 UNION SELECT 1), 2 << (3 IN (SELECT 0 UNION SELECT 1)), (2 << 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << 3 in (select 0 union select 1) AS `2 << 3 IN (SELECT 0 UNION SELECT 1)`,2 << (3 in (select 0 union select 1)) AS `2 << (3 IN (SELECT 0 UNION SELECT 1))`,2 << 3 in (select 0 union select 1) AS `(2 << 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 << 3 IN (SELECT 0 UNION SELECT 1), 2 << (3 IN (SELECT 0 UNION SELECT 1)), (2 << 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 << 3 IN (SELECT 0 UNION SELECT 1) 2 << (3 IN (SELECT 0 UNION SELECT 1)) (2 << 3) IN (SELECT 0 UNION SELECT 1)
+0 2 0
+create or replace view v1 as select 2 >> 3 IN (SELECT 0 UNION SELECT 1), 2 >> (3 IN (SELECT 0 UNION SELECT 1)), (2 >> 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> 3 in (select 0 union select 1) AS `2 >> 3 IN (SELECT 0 UNION SELECT 1)`,2 >> (3 in (select 0 union select 1)) AS `2 >> (3 IN (SELECT 0 UNION SELECT 1))`,2 >> 3 in (select 0 union select 1) AS `(2 >> 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 >> 3 IN (SELECT 0 UNION SELECT 1), 2 >> (3 IN (SELECT 0 UNION SELECT 1)), (2 >> 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 >> 3 IN (SELECT 0 UNION SELECT 1) 2 >> (3 IN (SELECT 0 UNION SELECT 1)) (2 >> 3) IN (SELECT 0 UNION SELECT 1)
+1 2 1
+create or replace view v1 as select 2 + 3 IN (SELECT 0 UNION SELECT 1), 2 + (3 IN (SELECT 0 UNION SELECT 1)), (2 + 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + 3 in (select 0 union select 1) AS `2 + 3 IN (SELECT 0 UNION SELECT 1)`,2 + (3 in (select 0 union select 1)) AS `2 + (3 IN (SELECT 0 UNION SELECT 1))`,2 + 3 in (select 0 union select 1) AS `(2 + 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 + 3 IN (SELECT 0 UNION SELECT 1), 2 + (3 IN (SELECT 0 UNION SELECT 1)), (2 + 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 + 3 IN (SELECT 0 UNION SELECT 1) 2 + (3 IN (SELECT 0 UNION SELECT 1)) (2 + 3) IN (SELECT 0 UNION SELECT 1)
+0 2 0
+create or replace view v1 as select 2 - 3 IN (SELECT 0 UNION SELECT 1), 2 - (3 IN (SELECT 0 UNION SELECT 1)), (2 - 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - 3 in (select 0 union select 1) AS `2 - 3 IN (SELECT 0 UNION SELECT 1)`,2 - (3 in (select 0 union select 1)) AS `2 - (3 IN (SELECT 0 UNION SELECT 1))`,2 - 3 in (select 0 union select 1) AS `(2 - 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 - 3 IN (SELECT 0 UNION SELECT 1), 2 - (3 IN (SELECT 0 UNION SELECT 1)), (2 - 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 - 3 IN (SELECT 0 UNION SELECT 1) 2 - (3 IN (SELECT 0 UNION SELECT 1)) (2 - 3) IN (SELECT 0 UNION SELECT 1)
+0 2 0
+create or replace view v1 as select 2 * 0 IN (SELECT 0 UNION SELECT 1), 2 * (0 IN (SELECT 0 UNION SELECT 1)), (2 * 0) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * 0 in (select 0 union select 1) AS `2 * 0 IN (SELECT 0 UNION SELECT 1)`,2 * (0 in (select 0 union select 1)) AS `2 * (0 IN (SELECT 0 UNION SELECT 1))`,2 * 0 in (select 0 union select 1) AS `(2 * 0) IN (SELECT 0 UNION SELECT 1)`
+select 2 * 0 IN (SELECT 0 UNION SELECT 1), 2 * (0 IN (SELECT 0 UNION SELECT 1)), (2 * 0) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 * 0 IN (SELECT 0 UNION SELECT 1) 2 * (0 IN (SELECT 0 UNION SELECT 1)) (2 * 0) IN (SELECT 0 UNION SELECT 1)
+1 2 1
+create or replace view v1 as select 2 / 3 IN (SELECT 0 UNION SELECT 1), 2 / (3 IN (SELECT 0 UNION SELECT 1)), (2 / 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / 3 in (select 0 union select 1) AS `2 / 3 IN (SELECT 0 UNION SELECT 1)`,2 / (3 in (select 0 union select 1)) AS `2 / (3 IN (SELECT 0 UNION SELECT 1))`,2 / 3 in (select 0 union select 1) AS `(2 / 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 / 3 IN (SELECT 0 UNION SELECT 1), 2 / (3 IN (SELECT 0 UNION SELECT 1)), (2 / 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 / 3 IN (SELECT 0 UNION SELECT 1) 2 / (3 IN (SELECT 0 UNION SELECT 1)) (2 / 3) IN (SELECT 0 UNION SELECT 1)
+0 NULL 0
+create or replace view v1 as select 2 DIV 3 IN (SELECT 0 UNION SELECT 1), 2 DIV (3 IN (SELECT 0 UNION SELECT 1)), (2 DIV 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV 3 in (select 0 union select 1) AS `2 DIV 3 IN (SELECT 0 UNION SELECT 1)`,2 DIV (3 in (select 0 union select 1)) AS `2 DIV (3 IN (SELECT 0 UNION SELECT 1))`,2 DIV 3 in (select 0 union select 1) AS `(2 DIV 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 DIV 3 IN (SELECT 0 UNION SELECT 1), 2 DIV (3 IN (SELECT 0 UNION SELECT 1)), (2 DIV 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 DIV 3 IN (SELECT 0 UNION SELECT 1) 2 DIV (3 IN (SELECT 0 UNION SELECT 1)) (2 DIV 3) IN (SELECT 0 UNION SELECT 1)
+1 NULL 1
+create or replace view v1 as select 2 MOD 3 IN (SELECT 0 UNION SELECT 1), 2 MOD (3 IN (SELECT 0 UNION SELECT 1)), (2 MOD 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 in (select 0 union select 1) AS `2 MOD 3 IN (SELECT 0 UNION SELECT 1)`,2 % (3 in (select 0 union select 1)) AS `2 MOD (3 IN (SELECT 0 UNION SELECT 1))`,2 % 3 in (select 0 union select 1) AS `(2 MOD 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 MOD 3 IN (SELECT 0 UNION SELECT 1), 2 MOD (3 IN (SELECT 0 UNION SELECT 1)), (2 MOD 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 MOD 3 IN (SELECT 0 UNION SELECT 1) 2 MOD (3 IN (SELECT 0 UNION SELECT 1)) (2 MOD 3) IN (SELECT 0 UNION SELECT 1)
+0 NULL 0
+create or replace view v1 as select 2 % 3 IN (SELECT 0 UNION SELECT 1), 2 % (3 IN (SELECT 0 UNION SELECT 1)), (2 % 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % 3 in (select 0 union select 1) AS `2 % 3 IN (SELECT 0 UNION SELECT 1)`,2 % (3 in (select 0 union select 1)) AS `2 % (3 IN (SELECT 0 UNION SELECT 1))`,2 % 3 in (select 0 union select 1) AS `(2 % 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 % 3 IN (SELECT 0 UNION SELECT 1), 2 % (3 IN (SELECT 0 UNION SELECT 1)), (2 % 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 % 3 IN (SELECT 0 UNION SELECT 1) 2 % (3 IN (SELECT 0 UNION SELECT 1)) (2 % 3) IN (SELECT 0 UNION SELECT 1)
+0 NULL 0
+create or replace view v1 as select 2 ^ 3 IN (SELECT 0 UNION SELECT 1), 2 ^ (3 IN (SELECT 0 UNION SELECT 1)), (2 ^ 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ 3 in (select 0 union select 1) AS `2 ^ 3 IN (SELECT 0 UNION SELECT 1)`,2 ^ (3 in (select 0 union select 1)) AS `2 ^ (3 IN (SELECT 0 UNION SELECT 1))`,2 ^ 3 in (select 0 union select 1) AS `(2 ^ 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 ^ 3 IN (SELECT 0 UNION SELECT 1), 2 ^ (3 IN (SELECT 0 UNION SELECT 1)), (2 ^ 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 ^ 3 IN (SELECT 0 UNION SELECT 1) 2 ^ (3 IN (SELECT 0 UNION SELECT 1)) (2 ^ 3) IN (SELECT 0 UNION SELECT 1)
+1 2 1
+create or replace view v1 as select 2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1), 2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and 3 in (select 0 union select 1) AS `2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1)`,2 between 1 and 3 in (select 0 union select 1) AS `2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1))`,(2 between 1 and 3) in (select 0 union select 1) AS `(2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1), 2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1) 2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1)) (2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1)
+0 0 1
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like 1 escape 3 in (select 0 union select 1) AS `2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1)`,2 like 1 escape (3 in (select 0 union select 1)) AS `2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1))`,2 like 1 escape 3 in (select 0 union select 1) AS `(2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1)`
+select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1) 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)) (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1)
+1 0 1
+create or replace view v1 as select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND 2) AND NULL, 3 BETWEEN 1 AND (2 AND NULL), (3 BETWEEN 1 AND 2) AND NULL;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 3 between 1 and 2 and NULL AS `3 BETWEEN 1 AND 2 AND NULL`,3 between (1 and 2) and NULL AS `3 BETWEEN (1 AND 2) AND NULL`,3 between 1 and (2 and NULL) AS `3 BETWEEN 1 AND (2 AND NULL)`,3 between 1 and 2 and NULL AS `(3 BETWEEN 1 AND 2) AND NULL`
+select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND 2) AND NULL, 3 BETWEEN 1 AND (2 AND NULL), (3 BETWEEN 1 AND 2) AND NULL union select * from v1;
+3 BETWEEN 1 AND 2 AND NULL 3 BETWEEN (1 AND 2) AND NULL 3 BETWEEN 1 AND (2 AND NULL) (3 BETWEEN 1 AND 2) AND NULL
+0 NULL NULL 0
+set sql_mode=PIPES_AS_CONCAT;
+create or replace view v1 as select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 or concat(3,3) AS `2 OR 3 || 3`,2 or concat(3,3) AS `2 OR (3 || 3)`,concat(2 or 3,3) AS `(2 OR 3) || 3`
+select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3 union select * from v1;
+2 OR 3 || 3 2 OR (3 || 3) (2 OR 3) || 3
+1 1 13
+create or replace view v1 as select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) or 3 AS `2 || 3 OR 3`,concat(2,3 or 3) AS `2 || (3 OR 3)`,concat(2,3) or 3 AS `(2 || 3) OR 3`
+select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3 union select * from v1;
+2 || 3 OR 3 2 || (3 OR 3) (2 || 3) OR 3
+1 21 1
+create or replace view v1 as select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !concat(2,3) AS `NOT 2 || 3`,!concat(2,3) AS `NOT (2 || 3)`,concat(!2,3) AS `(NOT 2) || 3`
+select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3 union select * from v1;
+NOT 2 || 3 NOT (2 || 3) (NOT 2) || 3
+0 0 03
+create or replace view v1 as select - '2 ' || 3, - ('2 ' || 3), (- '2 ') || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(-'2 ',3) AS `- '2 ' || 3`,-concat('2 ',3) AS `- ('2 ' || 3)`,concat(-'2 ',3) AS `(- '2 ') || 3`
+select - '2 ' || 3, - ('2 ' || 3), (- '2 ') || 3 union select * from v1;
+- '2 ' || 3 - ('2 ' || 3) (- '2 ') || 3
+-23 -2 -23
+create or replace view v1 as select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(~2,3) AS `~ 2 || 3`,~concat(2,3) AS `~ (2 || 3)`,concat(~2,3) AS `(~ 2) || 3`
+select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3 union select * from v1;
+~ 2 || 3 ~ (2 || 3) (~ 2) || 3
+184467440737095516133 18446744073709551592 184467440737095516133
+create or replace view v1 as select ! 2 || 3, ! (2 || 3), (! 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(!2,3) AS `! 2 || 3`,!concat(2,3) AS `! (2 || 3)`,concat(!2,3) AS `(! 2) || 3`
+select ! 2 || 3, ! (2 || 3), (! 2) || 3 union select * from v1;
+! 2 || 3 ! (2 || 3) (! 2) || 3
+03 0 03
+create or replace view v1 as select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) is false AS `2 || 3 IS FALSE`,concat(2,3 is false) AS `2 || (3 IS FALSE)`,concat(2,3) is false AS `(2 || 3) IS FALSE`
+select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE union select * from v1;
+2 || 3 IS FALSE 2 || (3 IS FALSE) (2 || 3) IS FALSE
+0 20 0
+create or replace view v1 as select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,3) in (3,10) AS `0 || 3 IN (3,10)`,concat(0,3 in (3,10)) AS `0 || (3 IN (3,10))`,concat(0,3) in (3,10) AS `(0 || 3) IN (3,10)`
+select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10) union select * from v1;
+0 || 3 IN (3,10) 0 || (3 IN (3,10)) (0 || 3) IN (3,10)
+1 01 1
+create or replace view v1 as select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(1,0) xor 1 AS `1 || 0 XOR 1`,concat(1,0 xor 1) AS `1 || (0 XOR 1)`,concat(1,0) xor 1 AS `(1 || 0) XOR 1`
+select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1 union select * from v1;
+1 || 0 XOR 1 1 || (0 XOR 1) (1 || 0) XOR 1
+0 11 0
+create or replace view v1 as select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(1,1) and 0 AS `1 || 1 AND 0`,concat(1,1 and 0) AS `1 || (1 AND 0)`,concat(1,1) and 0 AS `(1 || 1) AND 0`
+select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0 union select * from v1;
+1 || 1 AND 0 1 || (1 AND 0) (1 || 1) AND 0
+0 10 0
+create or replace view v1 as select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(1,1) and 0 AS `1 || 1 && 0`,concat(1,1 and 0) AS `1 || (1 && 0)`,concat(1,1) and 0 AS `(1 || 1) && 0`
+select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0 union select * from v1;
+1 || 1 && 0 1 || (1 && 0) (1 || 1) && 0
+0 10 0
+create or replace view v1 as select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) = 3 AS `2 || 3 = 3`,concat(2,3 = 3) AS `2 || (3 = 3)`,concat(2,3) = 3 AS `(2 || 3) = 3`
+select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3 union select * from v1;
+2 || 3 = 3 2 || (3 = 3) (2 || 3) = 3
+0 21 0
+create or replace view v1 as select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) <=> 3 AS `2 || 3 <=> 3`,concat(2,3 <=> 3) AS `2 || (3 <=> 3)`,concat(2,3) <=> 3 AS `(2 || 3) <=> 3`
+select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3 union select * from v1;
+2 || 3 <=> 3 2 || (3 <=> 3) (2 || 3) <=> 3
+0 21 0
+create or replace view v1 as select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) >= 3 AS `2 || 3 >= 3`,concat(2,3 >= 3) AS `2 || (3 >= 3)`,concat(2,3) >= 3 AS `(2 || 3) >= 3`
+select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3 union select * from v1;
+2 || 3 >= 3 2 || (3 >= 3) (2 || 3) >= 3
+1 21 1
+create or replace view v1 as select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) <= 0 AS `2 || 3 <= 0`,concat(2,3 <= 0) AS `2 || (3 <= 0)`,concat(2,3) <= 0 AS `(2 || 3) <= 0`
+select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0 union select * from v1;
+2 || 3 <= 0 2 || (3 <= 0) (2 || 3) <= 0
+0 20 0
+create or replace view v1 as select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) < 0 AS `2 || 3 < 0`,concat(2,3 < 0) AS `2 || (3 < 0)`,concat(2,3) < 0 AS `(2 || 3) < 0`
+select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0 union select * from v1;
+2 || 3 < 0 2 || (3 < 0) (2 || 3) < 0
+0 20 0
+create or replace view v1 as select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,3) <> 3 AS `0 || 3 <> 3`,concat(0,3 <> 3) AS `0 || (3 <> 3)`,concat(0,3) <> 3 AS `(0 || 3) <> 3`
+select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3 union select * from v1;
+0 || 3 <> 3 0 || (3 <> 3) (0 || 3) <> 3
+0 00 0
+create or replace view v1 as select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) > 3 AS `2 || 3 > 3`,concat(2,3 > 3) AS `2 || (3 > 3)`,concat(2,3) > 3 AS `(2 || 3) > 3`
+select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3 union select * from v1;
+2 || 3 > 3 2 || (3 > 3) (2 || 3) > 3
+1 20 1
+create or replace view v1 as select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,3) <> 3 AS `0 || 3 != 3`,concat(0,3 <> 3) AS `0 || (3 != 3)`,concat(0,3) <> 3 AS `(0 || 3) != 3`
+select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3 union select * from v1;
+0 || 3 != 3 0 || (3 != 3) (0 || 3) != 3
+0 00 0
+create or replace view v1 as select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) like 3 AS `2 || 3 LIKE 3`,concat(2,3 like 3) AS `2 || (3 LIKE 3)`,concat(2,3) like 3 AS `(2 || 3) LIKE 3`
+select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3 union select * from v1;
+2 || 3 LIKE 3 2 || (3 LIKE 3) (2 || 3) LIKE 3
+0 21 0
+create or replace view v1 as select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) regexp 3 AS `2 || 3 REGEXP 3`,concat(2,3 regexp 3) AS `2 || (3 REGEXP 3)`,concat(2,3) regexp 3 AS `(2 || 3) REGEXP 3`
+select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3 union select * from v1;
+2 || 3 REGEXP 3 2 || (3 REGEXP 3) (2 || 3) REGEXP 3
+1 21 1
+create or replace view v1 as select 2 || ' 3' | 3, 2 || (' 3' | 3), (2 || ' 3') | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,' 3') | 3 AS `2 || ' 3' | 3`,concat(2,' 3' | 3) AS `2 || (' 3' | 3)`,concat(2,' 3') | 3 AS `(2 || ' 3') | 3`
+select 2 || ' 3' | 3, 2 || (' 3' | 3), (2 || ' 3') | 3 union select * from v1;
+2 || ' 3' | 3 2 || (' 3' | 3) (2 || ' 3') | 3
+3 23 3
+create or replace view v1 as select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,2) & 2 AS `0 || 2 & 2`,concat(0,2 & 2) AS `0 || (2 & 2)`,concat(0,2) & 2 AS `(0 || 2) & 2`
+select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2 union select * from v1;
+0 || 2 & 2 0 || (2 & 2) (0 || 2) & 2
+2 02 2
+create or replace view v1 as select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) << 3 AS `2 || 3 << 3`,concat(2,3 << 3) AS `2 || (3 << 3)`,concat(2,3) << 3 AS `(2 || 3) << 3`
+select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3 union select * from v1;
+2 || 3 << 3 2 || (3 << 3) (2 || 3) << 3
+184 224 184
+create or replace view v1 as select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) >> 3 AS `2 || 3 >> 3`,concat(2,3 >> 3) AS `2 || (3 >> 3)`,concat(2,3) >> 3 AS `(2 || 3) >> 3`
+select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3 union select * from v1;
+2 || 3 >> 3 2 || (3 >> 3) (2 || 3) >> 3
+2 20 2
+create or replace view v1 as select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,'2000-01-01') + interval 1 day AS `2 || '2000-01-01' +INTERVAL 1 DAY`,concat(2,'2000-01-01' + interval 1 day) AS `2 || ('2000-01-01' +INTERVAL 1 DAY)`,concat(2,'2000-01-01') + interval 1 day AS `(2 || '2000-01-01') +INTERVAL 1 DAY`
+select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+2 || '2000-01-01' +INTERVAL 1 DAY 2 || ('2000-01-01' +INTERVAL 1 DAY) (2 || '2000-01-01') +INTERVAL 1 DAY
+NULL 22000-01-02 NULL
+create or replace view v1 as select 2 || ' 3' + 3, 2 || (' 3' + 3), (2 || ' 3') + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,' 3') + 3 AS `2 || ' 3' + 3`,concat(2,' 3' + 3) AS `2 || (' 3' + 3)`,concat(2,' 3') + 3 AS `(2 || ' 3') + 3`
+select 2 || ' 3' + 3, 2 || (' 3' + 3), (2 || ' 3') + 3 union select * from v1;
+2 || ' 3' + 3 2 || (' 3' + 3) (2 || ' 3') + 3
+5 26 5
+create or replace view v1 as select 2 || ' 3' - 3, 2 || (' 3' - 3), (2 || ' 3') - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,' 3') - 3 AS `2 || ' 3' - 3`,concat(2,' 3' - 3) AS `2 || (' 3' - 3)`,concat(2,' 3') - 3 AS `(2 || ' 3') - 3`
+select 2 || ' 3' - 3, 2 || (' 3' - 3), (2 || ' 3') - 3 union select * from v1;
+2 || ' 3' - 3 2 || (' 3' - 3) (2 || ' 3') - 3
+-1 20 -1
+create or replace view v1 as select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) * 3 AS `2 || 3 * 3`,concat(2,3 * 3) AS `2 || (3 * 3)`,concat(2,3) * 3 AS `(2 || 3) * 3`
+select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3 union select * from v1;
+2 || 3 * 3 2 || (3 * 3) (2 || 3) * 3
+69 29 69
+create or replace view v1 as select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) / 3 AS `2 || 3 / 3`,concat(2,3 / 3) AS `2 || (3 / 3)`,concat(2,3) / 3 AS `(2 || 3) / 3`
+select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3 union select * from v1;
+2 || 3 / 3 2 || (3 / 3) (2 || 3) / 3
+7.666666666666667 21.0000 7.666666666666667
+create or replace view v1 as select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) DIV 3 AS `2 || 3 DIV 3`,concat(2,3 DIV 3) AS `2 || (3 DIV 3)`,concat(2,3) DIV 3 AS `(2 || 3) DIV 3`
+select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3 union select * from v1;
+2 || 3 DIV 3 2 || (3 DIV 3) (2 || 3) DIV 3
+7 21 7
+create or replace view v1 as select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,3) % 3 AS `0 || 3 MOD 3`,concat(0,3 % 3) AS `0 || (3 MOD 3)`,concat(0,3) % 3 AS `(0 || 3) MOD 3`
+select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3 union select * from v1;
+0 || 3 MOD 3 0 || (3 MOD 3) (0 || 3) MOD 3
+0 00 0
+create or replace view v1 as select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(0,3) % 3 AS `0 || 3 % 3`,concat(0,3 % 3) AS `0 || (3 % 3)`,concat(0,3) % 3 AS `(0 || 3) % 3`
+select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3 union select * from v1;
+0 || 3 % 3 0 || (3 % 3) (0 || 3) % 3
+0 00 0
+create or replace view v1 as select 2 || ' 3' ^ 3, 2 || (' 3' ^ 3), (2 || ' 3') ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,' 3') ^ 3 AS `2 || ' 3' ^ 3`,concat(2,' 3' ^ 3) AS `2 || (' 3' ^ 3)`,concat(2,' 3') ^ 3 AS `(2 || ' 3') ^ 3`
+select 2 || ' 3' ^ 3, 2 || (' 3' ^ 3), (2 || ' 3') ^ 3 union select * from v1;
+2 || ' 3' ^ 3 2 || (' 3' ^ 3) (2 || ' 3') ^ 3
+1 20 1
+create or replace view v1 as select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select concat(2,3) between 2 and 3 AS `2 || 3 BETWEEN 2 AND 3`,concat(2,3 between 2 and 3) AS `2 || (3 BETWEEN 2 AND 3)`,concat(2,3) between 2 and 3 AS `(2 || 3) BETWEEN 2 AND 3`
+select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3 union select * from v1;
+2 || 3 BETWEEN 2 AND 3 2 || (3 BETWEEN 2 AND 3) (2 || 3) BETWEEN 2 AND 3
+0 21 0
+create or replace view v1 as select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 xor concat(3,3) AS `2 XOR 3 || 3`,2 xor concat(3,3) AS `2 XOR (3 || 3)`,concat(2 xor 3,3) AS `(2 XOR 3) || 3`
+select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3 union select * from v1;
+2 XOR 3 || 3 2 XOR (3 || 3) (2 XOR 3) || 3
+0 0 03
+create or replace view v1 as select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and concat(3,3) AS `0 AND 3 || 3`,0 and concat(3,3) AS `0 AND (3 || 3)`,concat(0 and 3,3) AS `(0 AND 3) || 3`
+select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3 union select * from v1;
+0 AND 3 || 3 0 AND (3 || 3) (0 AND 3) || 3
+0 0 03
+create or replace view v1 as select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 and concat(3,3) AS `0 && 3 || 3`,0 and concat(3,3) AS `0 && (3 || 3)`,concat(0 and 3,3) AS `(0 && 3) || 3`
+select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3 union select * from v1;
+0 && 3 || 3 0 && (3 || 3) (0 && 3) || 3
+0 0 03
+create or replace view v1 as select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 = concat(3,3) AS `2 = 3 || 3`,2 = concat(3,3) AS `2 = (3 || 3)`,concat(2 = 3,3) AS `(2 = 3) || 3`
+select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3 union select * from v1;
+2 = 3 || 3 2 = (3 || 3) (2 = 3) || 3
+0 0 03
+create or replace view v1 as select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <=> concat(3,3) AS `2 <=> 3 || 3`,2 <=> concat(3,3) AS `2 <=> (3 || 3)`,concat(2 <=> 3,3) AS `(2 <=> 3) || 3`
+select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3 union select * from v1;
+2 <=> 3 || 3 2 <=> (3 || 3) (2 <=> 3) || 3
+0 0 03
+create or replace view v1 as select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >= concat(3,0) AS `2 >= 3 || 0`,2 >= concat(3,0) AS `2 >= (3 || 0)`,concat(2 >= 3,0) AS `(2 >= 3) || 0`
+select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0 union select * from v1;
+2 >= 3 || 0 2 >= (3 || 0) (2 >= 3) || 0
+0 0 00
+create or replace view v1 as select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 <= concat(3,3) AS `2 <= 3 || 3`,2 <= concat(3,3) AS `2 <= (3 || 3)`,concat(2 <= 3,3) AS `(2 <= 3) || 3`
+select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3 union select * from v1;
+2 <= 3 || 3 2 <= (3 || 3) (2 <= 3) || 3
+1 1 13
+create or replace view v1 as select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 < concat(3,3) AS `2 < 3 || 3`,2 < concat(3,3) AS `2 < (3 || 3)`,concat(2 < 3,3) AS `(2 < 3) || 3`
+select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3 union select * from v1;
+2 < 3 || 3 2 < (3 || 3) (2 < 3) || 3
+1 1 13
+create or replace view v1 as select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> concat(3,3) AS `1 <> 3 || 3`,1 <> concat(3,3) AS `1 <> (3 || 3)`,concat(1 <> 3,3) AS `(1 <> 3) || 3`
+select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3 union select * from v1;
+1 <> 3 || 3 1 <> (3 || 3) (1 <> 3) || 3
+1 1 13
+create or replace view v1 as select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 0 > concat(3,3) AS `0 > 3 || 3`,0 > concat(3,3) AS `0 > (3 || 3)`,concat(0 > 3,3) AS `(0 > 3) || 3`
+select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3 union select * from v1;
+0 > 3 || 3 0 > (3 || 3) (0 > 3) || 3
+0 0 03
+create or replace view v1 as select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> concat(3,3) AS `1 != 3 || 3`,1 <> concat(3,3) AS `1 != (3 || 3)`,concat(1 <> 3,3) AS `(1 != 3) || 3`
+select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3 union select * from v1;
+1 != 3 || 3 1 != (3 || 3) (1 != 3) || 3
+1 1 13
+create or replace view v1 as select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 like concat(3,3) AS `2 LIKE 3 || 3`,2 like concat(3,3) AS `2 LIKE (3 || 3)`,concat(2 like 3,3) AS `(2 LIKE 3) || 3`
+select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3 union select * from v1;
+2 LIKE 3 || 3 2 LIKE (3 || 3) (2 LIKE 3) || 3
+0 0 03
+create or replace view v1 as select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 regexp concat(3,3) AS `2 REGEXP 3 || 3`,2 regexp concat(3,3) AS `2 REGEXP (3 || 3)`,concat(2 regexp 3,3) AS `(2 REGEXP 3) || 3`
+select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3 union select * from v1;
+2 REGEXP 3 || 3 2 REGEXP (3 || 3) (2 REGEXP 3) || 3
+0 0 03
+create or replace view v1 as select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 | concat(3,3) AS `2 | 3 || 3`,2 | concat(3,3) AS `2 | (3 || 3)`,concat(2 | 3,3) AS `(2 | 3) || 3`
+select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3 union select * from v1;
+2 | 3 || 3 2 | (3 || 3) (2 | 3) || 3
+35 35 33
+create or replace view v1 as select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 & concat(3,3) AS `2 & 3 || 3`,2 & concat(3,3) AS `2 & (3 || 3)`,concat(2 & 3,3) AS `(2 & 3) || 3`
+select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3 union select * from v1;
+2 & 3 || 3 2 & (3 || 3) (2 & 3) || 3
+0 0 23
+create or replace view v1 as select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 << concat(3,3) AS `2 << 3 || 3`,2 << concat(3,3) AS `2 << (3 || 3)`,concat(2 << 3,3) AS `(2 << 3) || 3`
+select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3 union select * from v1;
+2 << 3 || 3 2 << (3 || 3) (2 << 3) || 3
+17179869184 17179869184 163
+create or replace view v1 as select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 >> concat(3,0) AS `2 >> 3 || 0`,2 >> concat(3,0) AS `2 >> (3 || 0)`,concat(2 >> 3,0) AS `(2 >> 3) || 0`
+select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0 union select * from v1;
+2 >> 3 || 0 2 >> (3 || 0) (2 >> 3) || 0
+0 0 00
+create or replace view v1 as select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 + concat(3,3) AS `2 + 3 || 3`,2 + concat(3,3) AS `2 + (3 || 3)`,concat(2 + 3,3) AS `(2 + 3) || 3`
+select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3 union select * from v1;
+2 + 3 || 3 2 + (3 || 3) (2 + 3) || 3
+35 35 53
+create or replace view v1 as select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 - concat(2,0) AS `2 - 2 || 0`,2 - concat(2,0) AS `2 - (2 || 0)`,concat(2 - 2,0) AS `(2 - 2) || 0`
+select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0 union select * from v1;
+2 - 2 || 0 2 - (2 || 0) (2 - 2) || 0
+-18 -18 00
+create or replace view v1 as select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 * concat(3,3) AS `2 * 3 || 3`,2 * concat(3,3) AS `2 * (3 || 3)`,concat(2 * 3,3) AS `(2 * 3) || 3`
+select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3 union select * from v1;
+2 * 3 || 3 2 * (3 || 3) (2 * 3) || 3
+66 66 63
+create or replace view v1 as select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 / concat(3,3) AS `2 / 3 || 3`,2 / concat(3,3) AS `2 / (3 || 3)`,concat(2 / 3,3) AS `(2 / 3) || 3`
+select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3 union select * from v1;
+2 / 3 || 3 2 / (3 || 3) (2 / 3) || 3
+0.06060606060606061 0.06060606060606061 0.66673
+create or replace view v1 as select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 DIV concat(3,3) AS `2 DIV 3 || 3`,2 DIV concat(3,3) AS `2 DIV (3 || 3)`,concat(2 DIV 3,3) AS `(2 DIV 3) || 3`
+select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3 union select * from v1;
+2 DIV 3 || 3 2 DIV (3 || 3) (2 DIV 3) || 3
+0 0 03
+create or replace view v1 as select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % concat(3,3) AS `2 MOD 3 || 3`,2 % concat(3,3) AS `2 MOD (3 || 3)`,concat(2 % 3,3) AS `(2 MOD 3) || 3`
+select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3 union select * from v1;
+2 MOD 3 || 3 2 MOD (3 || 3) (2 MOD 3) || 3
+2 2 23
+create or replace view v1 as select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 % concat(3,3) AS `2 % 3 || 3`,2 % concat(3,3) AS `2 % (3 || 3)`,concat(2 % 3,3) AS `(2 % 3) || 3`
+select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3 union select * from v1;
+2 % 3 || 3 2 % (3 || 3) (2 % 3) || 3
+2 2 23
+create or replace view v1 as select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 ^ concat(3,3) AS `2 ^ 3 || 3`,2 ^ concat(3,3) AS `2 ^ (3 || 3)`,concat(2 ^ 3,3) AS `(2 ^ 3) || 3`
+select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3 union select * from v1;
+2 ^ 3 || 3 2 ^ (3 || 3) (2 ^ 3) || 3
+35 35 13
+create or replace view v1 as select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 2 between 1 and concat(3,3) AS `2 BETWEEN 1 AND 3 || 3`,2 between 1 and concat(3,3) AS `2 BETWEEN 1 AND (3 || 3)`,concat(2 between 1 and 3,3) AS `(2 BETWEEN 1 AND 3) || 3`
+select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3 union select * from v1;
+2 BETWEEN 1 AND 3 || 3 2 BETWEEN 1 AND (3 || 3) (2 BETWEEN 1 AND 3) || 3
+1 1 13
+create or replace view v1 as select charset(2 LIKE 1 ESCAPE 3 || ''), charset(2 LIKE 1 ESCAPE (3 || '')), charset((2 LIKE 1 ESCAPE 3) || '');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select charset(2 like 1 escape concat(3,'')) AS `charset(2 LIKE 1 ESCAPE 3 || '')`,charset(2 like 1 escape concat(3,'')) AS `charset(2 LIKE 1 ESCAPE (3 || ''))`,charset(concat(2 like 1 escape 3,'')) AS `charset((2 LIKE 1 ESCAPE 3) || '')`
+select charset(2 LIKE 1 ESCAPE 3 || ''), charset(2 LIKE 1 ESCAPE (3 || '')), charset((2 LIKE 1 ESCAPE 3) || '') union select * from v1;
+charset(2 LIKE 1 ESCAPE 3 || '') charset(2 LIKE 1 ESCAPE (3 || '')) charset((2 LIKE 1 ESCAPE 3) || '')
+binary binary latin1
+create or replace view v1 as select ! - 1, - ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !-1 AS `! - 1`,-!1 AS `- ! 1`
+create or replace view v1 as select ! BINARY 1, BINARY ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !cast(1 as char charset binary) AS `! BINARY 1`,cast(!1 as char charset binary) AS `BINARY ! 1`
+create or replace view v1 as select ! (NOT 1), NOT ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 <> 0 AS `! (NOT 1)`,1 <> 0 AS `NOT ! 1`
+create or replace view v1 as select ! ~ 1, ~ ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !~1 AS `! ~ 1`,~!1 AS `~ ! 1`
+create or replace view v1 as select - BINARY 1, BINARY - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -cast(1 as char charset binary) AS `- BINARY 1`,cast(-1 as char charset binary) AS `BINARY - 1`
+create or replace view v1 as select - (NOT 1), NOT - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -!1 AS `- (NOT 1)`,!-1 AS `NOT - 1`
+create or replace view v1 as select - ~ 1, ~ - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select -~1 AS `- ~ 1`,~-1 AS `~ - 1`
+create or replace view v1 as select BINARY (NOT 1), NOT BINARY 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast(!1 as char charset binary) AS `BINARY (NOT 1)`,!cast(1 as char charset binary) AS `NOT BINARY 1`
+create or replace view v1 as select BINARY ~ 1, ~ BINARY 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select cast(~1 as char charset binary) AS `BINARY ~ 1`,~cast(1 as char charset binary) AS `~ BINARY 1`
+create or replace view v1 as select NOT ~ 1, ~ (NOT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select !~1 AS `NOT ~ 1`,~!1 AS `~ (NOT 1)`
+create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3 IS UNKNOWN IS NULL, 4 IS NULL IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+view_definition
+select 1 is true is false AS `1 IS TRUE IS FALSE`,/*always not null*/ 1 is null AS `2 IS FALSE IS UNKNOWN`,/*always not null*/ 1 is null AS `3 IS UNKNOWN IS NULL`,/*always not null*/ 1 is null is true AS `4 IS NULL IS TRUE`
+drop view v1;
diff --git a/mysql-test/r/precedence_bugs.result b/mysql-test/r/precedence_bugs.result
new file mode 100644
index 00000000000..4b13e820d7f
--- /dev/null
+++ b/mysql-test/r/precedence_bugs.result
@@ -0,0 +1,60 @@
+#
+# Bug#6726: NOT BETWEEN parse failure
+#
+create table t1 (a int, b int);
+insert into t1 values (1,2), (2,3), (3,4), (4,5);
+select * from t1 where a not between 1 and 2;
+a b
+3 4
+4 5
+select * from t1 where a not between 1 and 2 and b not between 3 and 4;
+a b
+4 5
+drop table t1;
+#
+# MDEV-13673 Bad result in view
+#
+explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select 3 - 2 + 1 AS `(3-2)+1`,3 / 2 * 1 AS `(3/2)*1`,3 - (2 + 1) AS `3-(2+1)`,3 / (2 * 1) AS `3/(2*1)`
+#
+# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
+#
+create table t1 (i int, j int);
+insert t1 values (1,1),(2,2);
+create view v1 as select (2, 3) not in (select i, j from t1);
+select * from v1;
+(2, 3) not in (select i, j from t1)
+1
+show create view v1;
+View v1
+Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)`
+character_set_client latin1
+collation_connection latin1_swedish_ci
+drop view v1;
+drop table t1;
+#
+# MDEV-23656 view: removal of parentheses results in wrong result
+#
+create table t1 (a int, b decimal(10,2));
+insert into t1 values (1, 10.2);
+create view v1 as select avg(b) / (2 + a) from t1;
+show create view v1;
+View v1
+Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select avg(`t1`.`b`) / (2 + `t1`.`a`) AS `avg(b) / (2 + a)` from `t1`
+character_set_client latin1
+collation_connection latin1_swedish_ci
+drop view v1;
+drop table t1;
+#
+# MDEV-17408 VIEW is incorrectly defined for a combination of = and BETWEEN
+#
+create view v1 as select 1 like (now() between '2000-01-01' and '2012-12-12' );
+show create view v1;
+View v1
+Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 like (current_timestamp() between '2000-01-01' and '2012-12-12') AS `1 like (now() between '2000-01-01' and '2012-12-12' )`
+character_set_client latin1
+collation_connection latin1_swedish_ci
+drop view v1;
diff --git a/mysql-test/r/processlist_notembedded.result b/mysql-test/r/processlist_notembedded.result
index 67eeb5ae2ff..ddde45f3031 100644
--- a/mysql-test/r/processlist_notembedded.result
+++ b/mysql-test/r/processlist_notembedded.result
@@ -3,10 +3,27 @@
#
connect con1,localhost,root,,;
connection con1;
-SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-FOUND 1 /sleep \(30\)/ in MDEV-20466.text
+FOUND 1 /sleep/ in MDEV-20466.text
+SET DEBUG_SYNC= 'now SIGNAL go';
+connection con1;
+user
disconnect con1;
+connection default;
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
+#
+# MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
+#
+connect con1,localhost,root,,;
+select sleep(100000);;
+connection default;
+SHOW EXPLAIN FOR con_id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select sleep(100000)
+KILL QUERY con_id;
+# End of 10.2 tests
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index c3e6e61ae9d..8d4b52e1b2e 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -5373,5 +5373,22 @@ drop procedure p;
drop view v1;
drop table t1;
#
+# MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
+#
+CREATE TABLE t1 (a INT);
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
+a
+EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
+a
+DROP TABLE t1;
+EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
+ERROR HY000: Default/ignore value is not supported for such parameter usage
+EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
+Database
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 96cf08dd6c7..d872735e507 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -2092,6 +2092,18 @@ drop procedure p1;
drop table t1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=@save_userstat;
+#
+# MDEV-5924: MariaDB could crash after changing the query_cache size
+#
+SET GLOBAL query_cache_size= 50*1024;
+SET GLOBAL query_cache_type= 1;
+SET query_cache_type= 1;
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM v1 WHERE pk IN (5178922,5178924,6911605,6584899,1754348,7735031,9583206,8377182,6309967,3110885,7197937,5582397,9811721,8310302,7001831,3687942,8454635,8743988,9524703,3313583,1376007,5276565,7238861,5307189,2242691,2052764,8160476,7668014,5891525,9070968,1989181,3014068,5365005,2974655,6877822,7813446,6188705,1028564,6426696,6098205,7231857,2749710,4996963,9879425,2995803,8160614,1934799,1981216,3673522,2135299,4803054,8515609,1825485,5805694,8211425,3712249,8013259,3496368,4339706,2326187,3236816,8158416,5749801,6339492,2517486,1769729,2576400,8177368,5471847,4670669,5694046,5155990,1219314,1304321,7951736,2381942,1467330,3329376,6069503,3821151,8118179,4575775,5291671,4757186,6241302,9809112,5388351,3356292,5753921,8776535,7101943,8558868,6655212,5498901,1629516,8016143,1156005,1280700,9236450,8289703,4549957,5404968,3594833,3034667,3167602,7983322,3939941,8382949,9258422,6927947,9639236,3246566,3144943,5516067,5266540,3760726,6491516,9515090,7776229,1582824,4031951,3336517,5871612,4268432,2600433,6188018,6158355,6442214,7808502,7692871,9180969,3982238,9212692,9944381,3932525,5937118,6315460,2464477,1933151,3393646,4244674,7036026,1470764,3015029,2453765,9876129,2097534,3467391,4287658,8120651,4975540,4454101,7758102,6087905,2167022,7575454,5370086,8289703,7460235,8734512,7346801,6660293,5826843,4305511,8093597,8970031,9104476,1784973,9245925,6893890,4996414,3144393,1145568,2702056,4984878,5602859,7088073,2044113,5248275,6037094,2185287,1791564,3180374,8750991,9187011,6411453,9600372,4819671,3105667,2837051,1252548,3729003,7986618,8305633,5684432,4528808,8670104,4132202,2101516,5218475,6885513,4886413,1288803,9584167,6524475,3943649,6195846,4204986,5435592,8877334,9276275,8848358,3583435,6662216,7178298,1973526,5917205,9156387,8877334,4559432,2792144,9831634,8846710,6979858,5287277,2220718,9358123,4140029,1263122,8049789,9508361,3597030,8504348,4525924,9062866,1880691,9788375,4746612,7711822,9735366,9227523,9701721,2832519,4498870,3725021,4836151,2351181,7339935,9890686,7641098,1797607,1571838,3258377,6244186,5147476,6760543,9151580,2465576,2545776,6846237,4037582,8310440,2503616,1998245,1716445,2364913,4665039,8420440,1187728,1065917,1734710,5826705,8538681,8311950,4662017,7804519,7696853,7385116,8674362,2787612,2393341,1652313,2254364,3852737,4177108,7013641,8654037,9062728,7826629,2569396,1039138,2572692,9001892,3470550,4859359,5218887,6479568,1424621,3535644,7808639,7817291,8825149,6060302,2830047,7787765,5971313,9603256,1800491,3429214,9350021,8716796,1972564,6054946,6445510,9234802,5616729,6064559,2048233,9458511,1597244,3902862,2530120,5723846,3463821,9008346,3055130,2941696,8774337,3095367,2195037,6208480,9869262,3615295,9916641,1078002,1815597,7737228,1412261,6588607,9740173,6696411,7740386,1641326,9269546,3848754,7745193,6819458,5297164,1280975,1224395,5247589,7793533,5314743,8814025,2579010,7882659,6753128,9558349,8710067,7898727,4209106,2634902,7311233,1644897,8363449,6201339,1770828,3572174,5493408,8835449,5644332,5096115,7116088,1534484,3204544,1772064,2091903,6744476,9183166,5546005,1030075,7387725,1300888,5799789,7340209,7356552,7677627,9410995,5775894,9442581,5718353,6544937,9809524,7171569,4565475,1397293,6687759,1509353,3715682,8607208,3506118,3910827,1890167,1559341,4150329,9679336,9756927,1292373,3445419,2105361,6594238,4234237,8359466,7352432,1492462,9482818,1601226,8561614,4186584,5849365,1460189,9139495,3113357,8384460,7229660,8701553,7786254,4606399,2057708,1638992,1083221,8147293,9569198,4776550,2539871,8040039,7104141,8090713,7242568,2361480,6913940,7958053,1414596,3451461,9160644,7901473,8289703,5428588,3063232,2302291,5366378,8216918,8033447,8048965,8636322,7807952,7146026,6589569,2882644,1971328,7786392,5357864,4637985,2137222,9819961,9039932,8900680,1666732,8126968,1652999,7199035,8229003,7845581,8902328,8100051,9506164,8168579,8786560,4753890,6941268,5035552,2919860,9570983,4751968,4566574,7540023,1621963,7924270,7578750,6669494,5857192,6409805,2030792,4401779,5737991,8241088,4739746,2776901,7373718,8786697,9211593,6219741,1758331,3863586,6932754,5006164,8200302,5925033,1962127,2728149,8540191,9044326,6171264,4224899,9248672,5911026,6974502,1950317,4998611,2561569,2891845,3243957,8806335,8058303,8791778,1475708,3335281,7841186,9153228,5532135,5453994,5966369,4194824,3612686,8645385,9952621,1211349,2806289,4358520,7454330,5964035,2415313,8897384,6479431,1467330,6496185,8941055,8369903,5015502,5586105,4288482,3266204,1793212,6083923,6920394,1272048,7913696,1253234,3975372,9038970,7229522,7319061,4729995,9990386,5756942,4622741,8179565,1901840,2060729,6308593,2311767,6058517,9440521,4506286,2667724,2707412,9264328,7481658,7283767,4022613,7292282,7722808,1607543,3303695,9334091,4429382,7483169,2624877,7084777,1376693,3797668,1654510,6480667,4619720,9884094,5862548,9422256,4009429,6273574,8836135,8204696,7987167,1890991,6920944,2501831,7627502,3287765,9907714,8246444,2397872,6005920,6982330,5250473,8604049,6665649,4658172,8910156,2989349,2872344,5909790,5837142,1457168,6535461,2226623,1763137,9385314,1692550,9805267,2558547,7501022,7434143,5598876,5709976,6785263,6020614,1443572,3101684,3374557,4787536,3978530,9441757,1930130,9930648,8580841,9180145,1442749,9766128,9032516,7260009,3941177,6559494,9137985,4546386,3074356,5515518,9012878,2276748,4035247,9025100,6259704,9377487,4794540,5761474,2752593,3987731,8114746,2718948,3247390,3037689,3311660,8790679,5536666,2222091,5232482,8974563,4368682,3214843,8420028,8806335,8848220,7466827,6930969,8109664,5539825,4431991,9777114,1658630,1989456,4565338,4458084,9845504,1885635,9934494,5555755,2949661,1578155,8792465,5856231,1098190,3172134,3951339,2971771,6514724,7918090,8303161,8927734,5148162,3115005,8331726,8686172,9277099,5245941,8956710,9073989,9181930,1564422,7557327,9082504,3478927,5851699,1516220,6011001,3210998,7561996,3128875,3419052,8286682,3075180,4222702,9359085,4364151,5275878,8327606,8856597,5770950,4176971,9744155,7107299,3555694,8808120,1351837,1360076,6263137,8084533,7500198,4953704,5528839,7879226,7829376,8476745,9084976,9013153,9360595,1519927,9272705,2386062,6703552,2987976,2653991,7962310,6720443,7441421,9816116,8835861,1495346,2436462,3964523,5086776,2948287,9331619,3395294,2654541,4939971,5529388,2443054,8942016,4211166,4622741,4996826,3370712,8998596,8414672,6178268,8606521,4673553,8279541,6275634,5673858,3244918,1834274,1526931,7676940,2071578,4389968,8847671,8347793,5627304,3150848,6094223,3139175,7662246,4629882,6958709,6080078,6604812,6250503,8088928,8115158,5547515,6602340,9526214,7144378,6659744,2319869,8054733,1483261,5373657,5053268,2558273,4960433,3183807,8498855,9974731,2374801,8405883,1960617,4945877,2526550,7739700,5407440,6752304,8544998,3976608,6499618,1631164,8728744,3698516,8548431,5066864,5619064,5310623,6882492,6150802,6524063,6251052,3584671,8603775,2213165,7723495,4073150,9552993,9999450,8793975,6491241,4660095,9930786,4196609,8377456,4691268,3305343,4692779,5583221,8125320,4233688,4325836,7907516,4892318,4463714,3417266,1417343,9836441,1187866,2645751,7921936,2998275,2052352,5054229,9570159,9308273,7085052,4329132,6040390,5786056,7763320,5193618,8289703,5839752,2938400,9261032,2333740,8758682,8836135,3190261,2023376,1993301,8853439,8487869,8288879,1314758,9366775,4800720,2819610,1451126,3274719,2042053,9648025,2290206,7490997,1195281,1606033,1245407,3106765,2140518,9124389,8877197,7443206,5344268,1341262,5363906,7709762,3759902,4991333,2916427,3489913,1779754,4042251,5729888,4771057,3584533,4547760,5565505,7738327,7732559,5686904,2558273,2051116,4332153,9457275,9341644,4819946,2643692,7991149,1085830,4004486,4451492,8963714,3540176,4449020,5051483,2061691,2676651,5276153,9197860,7980850,3026428,2856414,8852752,4922805,8302612,1072509,9081542,9056823,8404922,6097930,3939804,4919097,7398712,5407302,6692565,2214401,5561660,7238311,9212554,4992568,6093811,5223144,1899368,7665542,4582092,7409286,9964294,1835372,4815963,3387054,7423294,9401657,1044494,8743713,6644226,8916748,6272750,6561965,4788223,4657897,3687393,6183486,3993774,6385223,8807159,2952682,2643692,7253280,2452804,5163818,3558853,6846511,3127502,1926834,8465347,4805801,2904479,2171691,8575622,3015853,8413299,9511245,3628479,4821868,1020324,9179046,5233032,4244400,3795471,2762893,2857376,7661010,6360778,4951644,1309265,8922927,7212219,2014862,9049407,5376403,5611511,2232940,5183456,2757949,4638946,6997848,7474517,6429168,1501800,5802124,8222274,9924880,8694000,3835708,8349304,5278213,1097091,5408126,6541915,8095245,3619415,6916961,2786102,4845352,7466827,3578079,8144683,4338470,1635971,9640609,3117614,1855010,5728103,6300903,7430709,1900192,3673660,6037643,5595443,7049072,6462951,3585632,8084533,1853363,8477294,2266586,1465270,1276580,2511856,2895828,4337097,3626968,7087249,8985000,9414840,7458724,1141174,7457214,1602325,4407272,7694519,5595306,3399688,8429092,5586380,2441543,4488845,6415573,9871047,2366287,5840713,7647552,8970306,3026016,8186569,5060821,9175888,2428634,4199768,7791061,9595565,2325363,2228820,2966415,5135116,7646453,5928054,6217681,2612930,8201812,4628372,4872955,3597305,5363082,6790893,7307388,2064025,6947860,9389984,2415451,4464401,8022598,7566390,6675811,3299850,6845413,9396438,2775527,1796508,1665359,7119934,1264907,2772644,8598693,4670669,2209182,5293182,1299514,7853683,7307525,3205093,1643661,5012481,3448440,2148208,6146820,6530380,5167251,4132614,4331054,9009719,4979522,3280487,7764144,6472427,9053253,4821456,3984985,4425674,7194503,2939361,6038879,6136795,9609985,1561401,3836807,7960662,8419204,4684951,6060989,9063690,5382308,6334548,5833572,9388198,8814849,5744033,4868148,1200775,6155197,5857192,1321624,9067535,4156234,2739959,4067108,3602661,8168441,4998748,5604919,4829833,5483520,9798538,3330474,2504852,4206909,1574035,1379440,9239746,3629440,8028366,1766845,8773513,1564834,9511657,7040695,7232955,4622467,6376022,7167312,3728591,2885940,4396835,8868270,7126800,9963195,6857360,8126831,5344406,3878555,7389236,9083740,5007949,4776962,9162017,8039764,2822631,7905044,1516357,9784667,6493438,7841873,9634292,3971252,2542480,3446517,4340805,4752929,6867660,3490188,3628890,9403579,5384231,3443496,9004089,6138854,1594360,7386215,9240707,3856857,5428863,2509521,9643905,7018722,9202941,5178375,4411254,7385116,1032135,5022506,3187652,5829727,7550186,7026824,2408035,9947540,9273666,7087936,3519851,2677337,8457244,2005661,4680969,7654968,2781570,4380081,5025390,3519851,9721084,1380264,2092041,1889892,2931121,7856018,3507766,5226303,4501617,8759506,6521591,6303924,5419250,4346023,2481506,6510330,3082870,7123367,4848236,7687789,8214035,6017868,4840545,8739181,4010116,7725280,6304473,6717834,6878509,8717071,7901062,6616348,4601318,7868927,3206878,3577255,2269744,3181472,1819305,4741119,5834259,1561264,7062255,9452194,2613754,3131347,7384979,6041351,2607711,7039733,7047561,2902420,1954162,9234252,9188522,8082885,4378570,3174057,3865371,2107696,6976425,7944458,9164901,7252593,5173294,8744537,1974624,9989013,4207321,5217926,2511032,1816970,1975036,7593170,5195953,3204681,2588897,5102981,1978607,2856002,7484954,7652359,6692153,1021011,7428237,5203643,2542892,8071487,3258789,8846160,9323516,7058685,6720581,9020843,3444595,1471038,4219131,5868041,4378570,3913986,5849914,1166580,6608795,5926269,9542007,7833496,7679412,9654891,2661956,2453765,9437225,8606246,1918182,2806838,9062179,7191619,1914337,6861343,9976791,2286773,4190429,2203964,6232238,7523681,6100128,7373992,6461715,7533432,4364425,3069549,5995483,3859741,9647476,2696838,9232879,3760177,9996704,3229263,1862838,5615081,5493682,2845703,2029144,3163070,6955413,6317382,9031143,8281463,4034286,6611404,5656692,6529281,2557037,7679138,3738891,7174179,1447692,4899871,1031311,2919723,9078796,6147369,9996154,1052597,5393844,9947265,8596496,4228469,3644683,5696243,9690322,3616119,1088714,2409408,9116287,6616210,8487594,6966949,9066986,8876098,1753799,3326492,2843505,4818298,3586044,6671554,9584304,9400833,3439788,9963745,9062454,5329025,4675338,4869110,9144851,4437484,6226333,2525177,6007293,2460083,9634979,2118820,6699844,6908035,2795578,3744247,9154464,7273742,2250106,4507247,1230575,4279830,6382064,2348434,8891067,3391723,4348358,9550247,3103195,8312500,1096817,1399078,1557693,9679061,5311035,8970581,3799728,4678497,3626144,2506088,5866256,6802154,2960510,8350540,3022857,9459060,2306274,6918197,1693374,6662902,2821807,9658737,3177215,7515991,7572296,6487258,7247650,3706619,2758773,1652862,7224166,6737197,6782653,9508499,6613464,6106307,7986755,3156753,1912689,1157928,3418365,2435089,6668395,2821121,4458084,6213150,7384841,4956588,5656692,9468399,7376190,1529541,7625167,8110488,4155548,4326660,9321182,7022293,2455001,2438247,6575973,6285659,7469299,7221694,2205200,8063247,1420089,6965988,1546844,1101211,1029525,1977233,7771560,1325469,1002197,7301620,8807983,6497558,9104614,4806625,6226608,6400192,4939971,1838119,5926544,5520736,1008239,7172256,2969299,1701065,2148345,9481033,6402252,3724060,5954696,3031097,1415832,4303314,2261367,1832077,2679534,9446289,6289642,5956481,6198181,4659408,2550033,5247451,2534515,3963287,5095428,2133926,2739273,8188217,3215667,3772262,5836044,9515914,7171432,1232360,3201110,3740264,8057205,2948013,2683380,3211685,3389938,5149536,5809814,2937438,1515121,2497161,1916946,9803070,3426055,2634490,2554565,6387695,1088165,3881027,9005325,4338607,8863464,7781997,8261825,4775314,5127700,7733795,7307662,2691619,7675155,7405029,3044555,5825195,7004577,1170974,5709426,6961456,8078491,6280166,4126296,6142974,3652511,6972854,8634674,3751251,3765670,8268692,6040664,6930145,7486328,5643508,7432495,6320541,5509338,5313095,5205291,1573486,7694519,9343841,2139007,5612060,4143325,1307479,9871459,7109771,6907073,8700454,8613937,1154495,8917709,7844482,8447906,4566436,7239135,8489517,6052200,3839691,8229141,2835678,4199905,4175323,8708282,8194808,4871032,1574859,5727005,5008087,8324310,1463348,2027908,8441726,9971160,4810195,5793334,3275268,9397537,4217071,9775192,7305740,5373931,9941085,2398422,1982727,9201156,4322540,4933517,4495849,5232894,6585449,7331008,2030380,7920013,2480133,3811264,4413452,9220382,1735946,9804443,7867004,1716995,4794265,9334091,9085937,6289505,6787734,2436599,6362701,1682113,9238510,2713180,9974731,8810867,5440124,1605346,7554306,2156448,8995162,1488616,5659713,9083602,1474746,8179290,3266479,6432189,3670639,3946395,9397125,2223464,2407348,7623107,5608078,1825759,9384216,8912216,1553573,3422897,2014999,9478012,3343109,1127990,4734252,2919174,6914352,5589126,6739257,9217086,7136825,6427658,1636795,4750732,8867584,3355194,6962417,7476028,3676681,3311248,7041381,5358688,6461715,2466674,1160812,5658477,7668701,3436492,1520339,1155868,7340484,5543807,9931472,4916351,4708572,9482269,6733489,3684921,1550277,1217529,7894882,8505722,1027053,1472686,7768676,7660186,6224548,1642013,7472045,9516738,9112304,7475891,9356063,7386627,1142272,2380706,6537246,8979507,5205017,6678558,9957977,7552108,7161132,8668594,6944839,1344284,2669509,6835388,1734024,1395782,1526519,2048233,4932006,8337219,7240371,8092910,5380798,6250778,3054855,9382293,7395965,8190826,7143417,6188568,4846725,3462585,3192459,4239730,2046173,3249038,7091369,8025619,6921768,7681472,3949142,9657363,7432083,9947952,7155502,5621810,9702407,4531005,9706253,6277420,4844802,7171432,7510910,7433593,5931900,8650329,8901092,5858154,4095260,4981582,3058837,1055618,3214157,8112823,8584686,2161529,9165863,8723663,3921676,9294815,7104553,2218933,4856338,6214111,9738388,4507385,9814605,5619476,3073944,6663589,6171264,3944747,7595642,2061828,1291549,3983886,9349472,8080001,1524597,7195190,5899627,8965774,1866134,8026992,2628311,2957077,8510116,9107772,6343338,8253860,4008056,8646896,4668334,3932388,3253845,5886444,5178100,2396499,2014038,2950347,5752685,4460418,2222091,3933761,6116195,6655349,5753921,7576416,4029617,9855392,7905731,3363021,5107925,9814193,8291625,3396118,7727340,8709106,7378662,2883880,9994369,1283721,6381515,9586502,9243728,1684173,5730987,8065444,5034179,1582687,1839355,8079864,3111434,6681854,4377883,6971893,4306335,6193237,1788269,6387695,2837463,4385025,5243469,3174743,4987213,4790969,8780242,4800720,2618560,4176147,4818984,7139160,2503341,3850814,9791671,2962158,9929962,5429962,5096252,3986495,4558197,7627365,9094863,9817352,4991607,7182281,5376953,5630050,8035095,2510208,6003860,2938125,7106887,3171859,1955535,7287338,1773712,7754669,7495941,8222000,4877899,7259323,4678359,1366531,4223800,3587005,3707168,2965866,2295425,1219451,7376739,3728454,9970886,6685424,5303894,2315887,9703781,2909561,2175811,2323165,7140121,5034454,7728713,5091583,6640106,2812194,1678405,8201538,2672393,4156784,8321426,5984634,2550033,2953506,6023086,1902389,1477493,4717636,4315399,2133514,6376846,5195816,4818298,9213790,2461318,1505645,7708389,3072433,4026733,2905441,4950271,9309646,2427673,3788604,5009185,8055969,6708496,2996353,3267303,8261962,7856567,5043243,5857742,4757736,8148254,6347595,3138214,7927566,9555328,1061660,9522094,7344879,3679702,9596115,2885391,5208862,1187316,2430694,6269180,7927566,8208404,1305557,1094345,3691787,5673171,5388214,4610794,3382659,1052047,6508132,9796203,1656845,1468566,2053451,3425094,7553344,4655014,8623550,3527130,1465820,9716827,3031921,7952148,3823211,9178497,9751296,2261642,4323776,9275726,9396713,8665298,9065475,3965347,4339019,9221206,8415771,3620239,6043273,4017669,5966918,7879364,1225357,1557693,1418029,5619750,3420288,4062301,4727935,8520965,4057769,9912384,1385345,3190261,1635009,5948928,9135787,8316482,4085784,7848876,2012527,4822143,2933731,4295349,4014236,6482864,3328826,7162643,2271255,2981796,9557113,9432693,9047897,6868209,5119186,8063522,3421249,8389816,6970932,1526794,9981323,6666061,8019989,2235137,9397674,2172653,4471405,9574966,1193222,2005249,3118026,1768218,3572723,3890502,7165664,9276138,4645675,1415008,1691864,3969055,9891784,3438964,9327087,8777359,2208221,2164550,3255218,9043640,4385986,8827209,9126037,7295166,6357345,1478454,2973831,9655166,1058364,2829772,8735198,6611129,8250564,6625549,2459808,6358993,6145446,6513763,8809906,3443222,1175506,7884445,5938491,3910003,2754791,6642028,6344024,7692321,7374542,4383651,1791976,6447158,1875610,7949401,4899871,5562210,9243316,1815460,1476806,2551406,6766448,3296005,1213958,2557037,9905792,9026611,9817352,3179687,7716079,5693908,2177871,2351318,7162918,6483001,7673095,6473388,7181182,7209884,9192642,2536437,6816848,3608978,9982421,6441802,3296966,8742614,5900588,7242019,3370437,5003005,1180038,9520996,3764846,3674896,3289688,2631469,9101318,2526824,8989807,5007400,7113479,5401260,7174453,3273345,5511123,2270706,1593536,6365859,5335891,1730178,7051544,7387725,6149566,5393157,4172851,1414047,7900924,7161407,4330230,4966888,5813796,5835769,2828125,9380371,6140365,6038192,7937316,2771408,5123031,4912918,4870758,1837982,4010116,2574890,6298431,3201385,2466812,6776748,3491561,2513092,7227188,6759307,5692810,9042953,7330047,3757431,8803588,5969116,6781829,1129501,8984313,9088272,2991958,5577041,1259963,3164169,1823287,5426803,6726211,7632995,2600433,4440368,5447265,5885894,7922348,5123031,7642471,7846130,9620559,1999069,5252807,7059509,5707778,4822280,9482543,3017227,8660079,8191787,6408432,2930847,9877914,8539230,9252243,2676239,4667510,2959274,3407928,5126190,6587783,7850250,7819076,3590988,2506912,4833679,3799865,6584762,2210281,4922119,8892715,4637023,7906829,3403945,1856384,9367874,3473297,7413269,3380325,2544815,4784790,7654968,9615203,6342239,9971298,4251541,2117309,4519607,7946517,3183120,1297866,6738845,1051910,3286804,8972640,3738891,2159606,7285964,5103530,6586410,7077911,4817749,6329193,7722259,1603561,5926681,9375427,3019973,4063812,9994644,6939620,2578460,4693328,6574325,7145065,7464492,9687576,1096542,1156280,6125946,6278930,8918533,8050064,3693298,2677200,1683486,6537109,2888824,4219543,1459091,8626159,3761962,7572845,9624130,3825820,3968780,9332580,1971603,1976409,3816619,2862869,9997940,2307785,6790069,4718322,6846374,8813613,1777969,3496368,4872543,9539810,7721435,7458587,2303665,3877731,4899459,2769210,5956069,4456573,4572067,7691223,1483673,7730087,9200744,7586166,8124221,3849990,6962142,1059600,8411376,1920242,4776962,5097625,6823440,6225646,9569747,6536422,7835830,9529373,6981643,4710769,5347152,2032440,9251419,6622802,7945831,8088516,5485855,2476974,2988937,5269012,3038101,7923171,9959075,7870986,2211242,2853256,9069732,7463119,3007064,6093948,3587417,7560760,3138900,7839126,1839767,7027923,5026901,8167617,6376571,7295303,8993240,9487762,3256179,5992187,1379440,4252777,2920959,7083404,4800170,3793411,8635635,1105880,1255706,5607391,8953414,8598556,2320556,7952972,5181121,5320098,5126464,5088424,8310302,2346237,9359497,9002166,7384567,9643218,4989135,3976333,5771224,3207702,6949234,5828079,1304595,2371093,1488204,6173599,6773727,8357406,6408294,9555328,4717910,9692520,1911865,6779769,5003417,3555969,6274536,2307785,9147460,4669708,8062423,2040130,4858810,8818420,2114013,7345428,1764511,8593612,3003219,2669921,6790618,1456893,4204849,9576339,4165985,6714675,8679168,5553833,9517425,4499008,9095275,5443008,2026672,2348159,7412719,4820083,2114974,7480285,6037643,2184051,8626983,2354614,6275634,6289505,8980880,7612533,9296875,2471069,1254608,5995071,1334533,9300170,7675155,9326675,8334060,1420776,9482681,6162338,3772125,9906066,7634506,9190582,6864776,4980621,4321441,2985504,1883026,7451583,1762176,2202453,6793502,6691879,2246124,2810958,2945541,5521011,6893066,9458099,9021118,3825271,6098617,2557449,1967208,7262207,4133438,1194869,4129455,7893096,7865768,4447372,3305892,5086364,4075759,3208389,6939208,4536224,8330490,7111282,5166290,9741546,2888275,8646896,8943939,6785263,8600479,9068771,9970336,1762588,9280670,1178115,1618530,3697692,9509460,6584213,6604125,3295181,7342956,8532638,7602783,2369445,9894943,3896545,5538314,9294677,8260726,6422164,2759735,1321487,3750839,8825698,9824768,3100723,1905136,5832061,8110076,3261810,3254257,4751968,2966964,2386199,6297744,8689193,9639648,4221878,6668258,6972305,7666915,9481719,7949813,2905578,2983993,4068893,1119064,5430648,8445571,1074844,9077972,5795669,9986267,2391555,9248260,9822845,8139328,2283752,1693374,2869735,4131240,6762603,8740417,8077941,2270980,2107284,3566955,7001831,5853759,8375259,3725296,9212966,6295822,7248474,3069274,3972213,5722198,6054946,5055191,8563949,9722595,9314178,1884674,9386138,3497467,6645874,9457138,1390701,1110000,9389160,2602355,2966140,1065917,1773025,4560668,8858108,9937103,9985168,4180130,1220413,3248764,1978744,8799468,8390914,3350250,1365570,5284805,7485504,8485122,2234451,2189544,2404602,6783477,5243881,6506759,1344696,7390609,4827224,8981018,9410720,7455017,4858947,2450195,3420425,7191207,9621932,8185333,4497222,9738250,4422927,8697296,8542800,1031723,7697265,4978424,7184341,8407806,1947021,6649032,3291748,8159240,5358276,1976959,1654510,5760513,1439041,4238906,4916351,4981994,6522415,5391647,4358245,9611770,1479003,5523620,4626174,8002960,7481796,3053894,8994476,3166503,5167526,6147781,4260742,2627899,4039230,4318557,6865875,3765258,6450592,5683197,2331268,5849777,2020767,6841018,1609466,3505157,6818222,9844543,1439590,1806671,4161727,7229934,9302505,7736267,8379104,4578521,1070449,2215637,9368972,1574035,7941986,9432556,1309539,1029113,2759872,6681716,6356933,2844879,7301071,7437988,8677932,7377288,9637863,6880569,6660156,3174057,5158874,5587478,8644012,8555709,2346786,7618026,9019470,7005401,9906204,1703262,4032501,7838989,8333786,1762863,3143569,9122741,3526306,2465850,5283157,4307983,3519302,7056213,3846557,7551559,6949920,1160125,7774307,5189910,6339355,2794616,7558563,6337158,4785751,8296295,8522476,1073608,4164199,9388610,6213287,8196319,8426071,9106262,8256332,2998275,9091156,4796463,4509582,6045196,5527465,9914581,7866455,6419692,9112030,1833175,4547760,9400970,2865753,2384552,8228454,8048828,3656906,7353118,2841583,6660018,9567001,7639175,4403564,3567642,6511566,7309448,8705261,7249710,5712310,2257522,1211624,2218246,7110458,4687561,3014617,1655746,4319107,5145690,5181259,4268157,7204940,2313140,8344085,1324645,8695922,1282760,1873413,4350143,6906112,2536437,9478836,5441497,9173278,8342300,8581115,2676376,3102645,5790725,3300399,2581344,1209014,7187911,4402877,6129516,9254028,8025482,7049758,7237350,6868759,6244735,7693283,1226455,6558395,6015396,6962966,5222869,9681259,5745407,3885696,6958709,6495498,1543685,9283279,5948654,9869125,5851013,2692443,9506988,8744674,4460968,4648147,3575607,1954162,4647460,8678619,3831451,7477539,7618713,7850387,9041580,9737701,4016433,4211715,7136001,1026779,5677841,1975311,8964263,7656478,5381347,7785430,8208404,4928024,3792312,2912307,4417709,7512557,4328857,9718750,5635406,5338775,7167449,1241424,3586044,4579208,2104400,1230850,8892166,5830688,9494354,6495361,4289169,8081100,6983703,6889770,2306961,5557952,7257400,4796051,2386474,3050186,7518600,3436630,6901718,7799987,3918792,9866241,8053634,5555618,7658538,3985122,6106307,4879959,3976608,9416625,6934402,4309494,6746124,1595596,5348388,2456649,5898254,4907012,1169189,4647735,5388626,6224136,9518524,2193664,2929748,9683593,4296173,3884460,1203933,4047058,8309890,5801712,9778625,5489837,8029602,6043823,1441375,1160125,5433120,4456710,7173080,1354446,1911590,3964248,7478637,7652221,1706008,7592483,2295013,5852111,9839462,9779861,7191894,7055389,4018493,3069549,7088897,2740234,8468368,7775405,2202453,1168365,6172912,1716995,6445648,1971328,6488357,9616577,6997436,4256210,4597885,4251403,6260665,4079055,5777130,4956176,1926696,4624389,3939117,7569137,8367843,3940353,6426834,5414031,2072952,1567993,3523422,5414718,2348022,6912017,1646820,1932601,7998428,9695816,9699523,1423660,1212448,3342422,7540847,6507171,9365539,3629714,2051803,7540298,3961776,9458236,1759292,7292007,5433807,1079238,6490966,9811035,2019119,3625869,5026763,8080276,6429992,5289886,5218612,9552169,2538909,9989013,8544448,8159515,6794601,4868148,7567077,4892868,5590774,5479263,8266906,3542373,2303253,3980590,2714279,2693130,7217575,1203659,2055099,9571945,6062225,1927520,1273422,6836624,1369415,1206130,3703598,5902236,9379959,3092895,3758117,9898788,7712097,9604354,1842376,1853500,4512878,3268402,3922088,6190216,8310577,5100921,7714981,6142974,6286895,6352264,8973876,8173522,9187973,8870880,2830322,8990081,9592819,8423873,4667098,3257827,1758468,2822631,2489883,3597442,8758407,3192733,9264739,3965072,4136734,4235610,1190887,2005386,6793365,8823089,9379272,2474227,2320968,8770904,6902542,9323104,5511398,8132461,2687774,9538986,7251495,8858795,2219345,1334396,3525619,9166824,3521362,6780456,2744628,6460342,3387741,4477172,2120056,1148727,2329895,1354995,9301132,2203689,1208877,8199890,9995468,3802337,5022644,2997863,2789672,5896057,8815811,6691329,1890853,3052383,8181900,4440643,3005828,5410736,9325714,7986343,2078857,7098373,9154190,1204071,8104995,1948257,1367492,1446594,4737823,6863677,6014160,5766830,8911804,3673385,7483993,9615615,1196792,2820159,5404418,2107421,2103164,4727249,9409347,8449142,6057556,8186843,2250930,2623092,2266860,3613098,8221176,3921401,1190063,1504409,3352722,9422119,7835418,6958709,2368209,4004486,4603790,8584686,4846313,5992187,1894561,9653381,9572631,3024642,3194107,7834320,4545974,6243225,5866668,5358825,6606872,5392471,1362960,9954544,4158294,7925231,6069641,9396301,2946640,7708389,5514968,6014709,1372299,3421661,5150497,4008468,5298126,2243103,7428649,8902191,7824295,2916702,9393417,3995971,7999801,1792938,2502792,8146469,2937164,6939071,5904022,8729019,9300720,4910720,6877136,9117935,3636032,9279434,1667831,2534515,8511627,9510559,1428466,3602523,6937561,3283370,7483444,3457229,2033676,2848999,9641845,6750656,3414657,9519485,2771545,7396926,5259674,8880355,3356979,7401870,7537002,7822784,7258224,7619949,1351837,3986770,5388900,2783355,5885345,7711685,7533843,8645797,5894409,7084091,2023925,9585128,3241348,5181808,8486633,7509124,4420455,2102203,7391571,6408020,4552703,5873672,2610733,5396316,5814620,7840362,9709548,5589263,4772842,6615524,1190475,4657211,4590332,7197799,6405685,2400756,4575637,7341857,1358840,9191680,5042007,5779602,2113876,8623138,6945663,8385284,6030639,1211624,8272674,3876358,5544769,8496246,3642486,2145874,6711380,2377685,7096176,7819900,7232131,8041687,5540786,4132888,1181274,3310287,6814514,8714462,1154083,6763565,8845474,6383575,1052734,4477722,8870193,9541183,5229187,8721603,5181121,6255996,2205200,6456222,2373291,1638992,8686996,9980773,8556671,2596588,8093048,3568054,8504623,7560211,8314971,7435653,9206100,4283401,6929321,7892547,6791992,1301025,7579025,2009506,7302032,6144348,1744049,4652954,4263351,2906402,5619476,5228500,9547088,4249618,3318664,9977890,4474014,5451385,3122970,4170928,6637084,5580062,3993637,6038879,2408584,4396011,7067474,1791290,3602249,5070022,4352478,5560974,5258575,3315643,7344192,6619781,4021240,2025161,2780471,2710296,7075027,5007125,6253387,7836242,2111541,1915847,1898132,8355621,7295303,5968704,1875610,7719787,9693756,3544433,4869796,7704544,1145706,3255493,6317245,3472610,1031860,7589187,1587219,2316024,4919235,4710357,8832290,8419067,9547775,1521026,7727890,1486557,8126968,6568695,9818313,4580718,7411621,1897857,3689453,8011749,5526229,1439590,8686996,6624313,9006011,1031448,7397201,7323867,1022659,7661285,8611053,3187515,2266174,7030807,1988632,5002456,1447555,3030685,2144638,9576477,4895065,6220428,6371353,4662017,9210083,5910064,9719985,6841293,2452667,9932708,9657226,7213043,4825027,6706710,9017822,1225082,2321380,5676330,3470275,4499008,9314453,1728942,7214279,5987243,5545181,1679092,4130966,3308502,1485870,3416030,4101303,8604049,4545288,2805877,1714660,7760848,5083892,8944076,8083297,4341766,6709320,7851348,6984664,5069198,3818130,8206207,6047531,6206283,2856552,1208740,7201782,8676147,8264846,4168457,4111053,4267471,6577621,1911727,1806671,5765869,4645263,9599685,4241104,9358261,2449234,8053222,9979949,7151107,1476669,2177322,6751754,1148864,1124420,7578201,5074142,1534347,3101135,8968246,2674316,5595993,3296829,1451263,9923645,3144943,9086761,5283157,1004257,4766937,7540847,3200012,2027496,3750564,3505432,5908416,9821609,3038925,8026718,5832611,6608383,9044326,6085433,6710281,7287475,6673751,9109970,6131713,8546234,6405960,5238250,1616333,1514984,6766036,2796127,5320922,7186264,8038940,6961318,2970397,8315383,1568405,8081375,4109130,7023391,7482070,1615234,2262878,9819137,4189880,1166305,1107666,7260147,2496063,1575958,6237045,1971740,8670928,6546585,3623809,8240676,3325531,5762435,4368408,4905502,4432128,6977523,5828079,7759201,8335571,8038803,2721008,9185089,3098388,5313919,6298019,5243469,1023483,4491729,7177612,1928619,5698440,4224899,1935623,4813766,4405349,8582626,1045181,9804031,9238922,2783630,3260299,8215820,3778030,2175399,7035339,5900039,7653457,9932296,8077117,6630218,7855743,2438110,8619705,4472229,5127288,2822357,5519500,7355453,5281784,1621139,9760635,1564010,5795806,1028564,1467605,5366516,5515106,4708984,8016555,4503128,6819732,4639083,2340744,7748764,2092453,2947463,7022430,6272064,3833236,3221023,2265899,3006378,2264389,9246887,5345092,3754959,8768981,1659179,9620010,1245819,6007843,2458297,6713989,5858016,8057067,8871841,4948623,1234832,6412139,5526779,6626510,4506011,5199249,7400085,1258590,1335357,2441131,9518112,9328323,7513244,3718154,2872482,8686172,9312942,6069915,4521530,3169250,7329635,2481369,9345626,2539459,6019790,7796005,9426788,2333190,2661682,3400787,6518432,2717163,6953353,8526733,1576919,1944000,9968826,4507247,3821975,3500900,5690200,9840835,7295028,8545684,1834411,5398788,4384613,5723571,6194335,7624618,2287048,1958282,6211776,7065826,3871688,7312057,9001205,7084503,8918945,8507644,6545211,6089553,6200378,6205596,5275878,5133193,3368927,6631866,2766326,1216979,2129257,6648345,5746505,3151260,1655197,6860656,8165008,3309600,9723968,1857208,5513595,5124679,9537612,9171768,9135513,3667617,5696105,5065490,1733062,1155456,7295852,8720642,4797424,8729431,8618469,2940185,1174819,8349166,5381072,4946838,9492019,6145721,8015182,2375488,8656646,7076538,8943801,5053405,9153228,6228530,9325851,8660079,5352508,6609756,8235595,3863174,6553588,5775894,5746368,7021057,6976562,6134460,3887207,3048950,2425750,9270370,2942520,1540664,3841339,4136734,4060379,6738983,2458023,8454223,6641342,3450637,7791198,2164138,2475189,2497436,5165878,1277404,9094314,4799072,8011611,2963394,9312530,8679718,6637908,5223281,1418579,9493942,6712203,2990997,8991867,8163360,4156784,2006210,2811096,4720794,8685211,6300903,6822616,2452804,7695617,2647125,7638488,7735992,9739898,5805557,2532318,6160552,5288925,7921936,3402160,8034545,2010192,3913024,7668701,8862503,8278717,8186294,5577865,2893081,5138687,9538436,7876892,3328140,5435317,4574264,1331100,9287811,6335372,2491119,5052169,8125869,5954284,6572814,9105850,7187225,7311096,9235763,4366760,3604034,9326538,5971450,2090805,3220886,7086151,2029556,9172729,6246246,1085006,8185333,1558105,7721298,1673873,8433761,5778503,2401443,1425445,3955734,7078598,6142837,9639099,8200164,1102584,2389770,4702804,7423568,6611816,5854034,6531890,4533752,5199249,7982772,7802185,7578750,3470687,5305953,2196548,8727920,3662261,1259277,1384796,4084274);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.5 tests
#
# Bug#12977203: SERVER CRASH ON A DERIVED TABLE WITH QUERY CACHE ENABLED
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index b55b462c8ef..9ea0dc12a0b 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -2136,6 +2136,26 @@ value1 1003560 12345
value1 1004807 12345
drop table t1;
#
+# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
+#
+set @save_optimizer_switch=@@optimizer_switch;
+set @save_optimizer_switch="index_merge_sort_union=OFF";
+CREATE TABLE t1 (a INT, INDEX(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+explain
+SELECT * FROM t1 WHERE a > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
+SELECT * FROM t1 WHERE a > 5;
+a
+6
+7
+8
+9
+set @@optimizer_switch=@save_optimizer_switch;
+drop table t1;
+# End of 5.5 tests
+#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
@@ -3034,5 +3054,110 @@ a b
set eq_range_index_dive_limit=default;
drop table t1;
#
+# MDEV-24117: Memory management problem in statistics state...
+# (just the testcase)
+#
+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 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D
+where D.a<4;
+create table t2 (
+a int,
+b int,
+key(a)
+);
+insert into t2 values (1,1),(2,2),(3,3);
+set @query=(select group_concat(a) from t1);
+set @tmp_24117= @@max_session_mem_used;
+#
+# On debug build, the usage was
+# - 2.8M without the bug
+# - 1G with the bug.
+set max_session_mem_used=64*1024*1024;
+set @query=concat('explain select * from t2 where a in (', @query, ')');
+prepare s from @query;
+# This should not fail with an error:
+execute s;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
+set max_session_mem_used=@tmp_24117;
+deallocate prepare s;
+drop table t0,t1,t2;
+#
+# MDEV-23811: Both disjunct of WHERE condition contain range conditions
+# for the same index such that the second range condition
+# fully covers the first one. Additionally one of the disjuncts
+# contains a range condition for the other index.
+#
+create table t1 (
+pk int primary key auto_increment, a int, b int,
+index idx1(a), index idx2(b)
+);
+insert into t1(a,b) values
+(5,50), (1,10), (3,30), (7,70), (8,80), (4,40), (2,20), (6,60);
+insert into t1(a,b) select a+10, b+100 from t1;
+insert into t1(a,b) select a+20, b+200 from t1;
+insert into t1(a,b) select a+30, b+300 from t1;
+insert into t1(a,b) select a,b from t1;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+explain select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where
+select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5);
+pk a b
+7 2 20
+71 2 20
+3 3 30
+67 3 30
+6 4 40
+70 4 40
+1 5 50
+65 5 50
+explain select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where
+select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100);
+pk a b
+7 2 20
+71 2 20
+3 3 30
+67 3 30
+6 4 40
+70 4 40
+1 5 50
+65 5 50
+explain select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where
+select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100);
+pk a b
+7 2 20
+71 2 20
+3 3 30
+67 3 30
+6 4 40
+70 4 40
+1 5 50
+65 5 50
+explain select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where
+select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4);
+pk a b
+7 2 20
+71 2 20
+3 3 30
+67 3 30
+6 4 40
+70 4 40
+1 5 50
+65 5 50
+drop table t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result
index 6572b248911..f2349f26571 100644
--- a/mysql-test/r/range_innodb.result
+++ b/mysql-test/r/range_innodb.result
@@ -37,6 +37,33 @@ 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;
+#
+# MDEV-10466: constructing an invalid SEL_ARG
+#
+create table t1 (
+pk int, a int, b int,
+primary key (pk), index idx1(b), index idx2(b)
+) engine=innodb;
+Warnings:
+Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
+insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0);
+create table t2 (c int) engine=innodb;
+insert into t2 values (1),(2);
+create table t3 (d int) engine=innodb;
+insert into t3 values (3),(-1),(4);
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='extended_keys=on';
+explain
+select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join)
+select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
+pk a b
+1 6 0
+set optimizer_switch=@save_optimizer_switch;
+drop table t1,t2,t3;
CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2)
@@ -70,6 +97,7 @@ key(a),key(b),key(c)
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 @saved_dbug = @@GLOBAL.debug_dbug;
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
@@ -77,5 +105,6 @@ id select_type table type possible_keys key key_len ref rows Extra
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 @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
+# End of 10.1 tests
diff --git a/mysql-test/r/range_interrupted-13751.result b/mysql-test/r/range_interrupted-13751.result
index f4f995721ad..68610cdda8e 100644
--- a/mysql-test/r/range_interrupted-13751.result
+++ b/mysql-test/r/range_interrupted-13751.result
@@ -7,10 +7,10 @@ INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
set @old_dbug=@@session.debug_dbug;
-set debug_dbug="+d,kill_join_init_read_record";
+SET debug_dbug="+d,kill_join_init_read_record";
SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
WHERE alias1.c = alias2.c OR alias1.i <= 1
;
ERROR 70100: Query execution was interrupted
-set debug_dbug=@old_dbug;
+SET debug_dbug=@old_dbug;
DROP TABLE t1;
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 2584fc5a8bf..55613261ce9 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -2138,6 +2138,26 @@ value1 1003560 12345
value1 1004807 12345
drop table t1;
#
+# MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
+#
+set @save_optimizer_switch=@@optimizer_switch;
+set @save_optimizer_switch="index_merge_sort_union=OFF";
+CREATE TABLE t1 (a INT, INDEX(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+explain
+SELECT * FROM t1 WHERE a > 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index
+SELECT * FROM t1 WHERE a > 5;
+a
+6
+7
+8
+9
+set @@optimizer_switch=@save_optimizer_switch;
+drop table t1;
+# End of 5.5 tests
+#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
@@ -3046,6 +3066,111 @@ a b
set eq_range_index_dive_limit=default;
drop table t1;
#
+# MDEV-24117: Memory management problem in statistics state...
+# (just the testcase)
+#
+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 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D
+where D.a<4;
+create table t2 (
+a int,
+b int,
+key(a)
+);
+insert into t2 values (1,1),(2,2),(3,3);
+set @query=(select group_concat(a) from t1);
+set @tmp_24117= @@max_session_mem_used;
+#
+# On debug build, the usage was
+# - 2.8M without the bug
+# - 1G with the bug.
+set max_session_mem_used=64*1024*1024;
+set @query=concat('explain select * from t2 where a in (', @query, ')');
+prepare s from @query;
+# This should not fail with an error:
+execute s;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where
+set max_session_mem_used=@tmp_24117;
+deallocate prepare s;
+drop table t0,t1,t2;
+#
+# MDEV-23811: Both disjunct of WHERE condition contain range conditions
+# for the same index such that the second range condition
+# fully covers the first one. Additionally one of the disjuncts
+# contains a range condition for the other index.
+#
+create table t1 (
+pk int primary key auto_increment, a int, b int,
+index idx1(a), index idx2(b)
+);
+insert into t1(a,b) values
+(5,50), (1,10), (3,30), (7,70), (8,80), (4,40), (2,20), (6,60);
+insert into t1(a,b) select a+10, b+100 from t1;
+insert into t1(a,b) select a+20, b+200 from t1;
+insert into t1(a,b) select a+30, b+300 from t1;
+insert into t1(a,b) select a,b from t1;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+explain select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan
+select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5);
+pk a b
+1 5 50
+3 3 30
+6 4 40
+7 2 20
+65 5 50
+67 3 30
+70 4 40
+71 2 20
+explain select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan
+select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100);
+pk a b
+1 5 50
+3 3 30
+6 4 40
+7 2 20
+65 5 50
+67 3 30
+70 4 40
+71 2 20
+explain select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan
+select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100);
+pk a b
+1 5 50
+3 3 30
+6 4 40
+7 2 20
+65 5 50
+67 3 30
+70 4 40
+71 2 20
+explain select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan
+select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4);
+pk a b
+1 5 50
+3 3 30
+6 4 40
+7 2 20
+65 5 50
+67 3 30
+70 4 40
+71 2 20
+drop table t1;
+#
# End of 10.2 tests
#
set optimizer_switch=@mrr_icp_extra_tmp;
diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result
index 4f3c36b7660..faab314896c 100644
--- a/mysql-test/r/range_vs_index_merge.result
+++ b/mysql-test/r/range_vs_index_merge.result
@@ -1659,7 +1659,7 @@ SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 2 Using where
+1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where
SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result
index 581f512768c..916c30bb770 100644
--- a/mysql-test/r/range_vs_index_merge_innodb.result
+++ b/mysql-test/r/range_vs_index_merge_innodb.result
@@ -369,7 +369,7 @@ WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 200) AND
(Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Population,PRIMARY 39,4,4 NULL 307 Using sort_union(Name,Population,PRIMARY); Using where
+1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where
SELECT * FROM City USE INDEX ()
WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
OR ((ID BETWEEN 100 AND 110) AND
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index 171ef836bda..749b8a74b4f 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -233,3 +233,24 @@ i
UNLOCK TABLES;
DROP TABLE t1;
# End of 10.0 tests
+create table t1 (a int, b varchar(200));
+insert t1 select seq, repeat(200, seq) from seq_1_to_30;
+delete from t1 where a % 13 = 0;
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 28
+test.t1 repair status OK
+delete from t1 where a % 11 = 0;
+repair table t1 extended use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 26
+test.t1 repair status OK
+delete from t1 where a % 7 = 0;
+set myisam_repair_threads = 2;
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 22
+test.t1 repair status OK
+set myisam_repair_threads = default;
+drop table t1;
+# End of 10.2 tests
diff --git a/mysql-test/r/rpl_mysql_upgrade_slave_repo_check.result b/mysql-test/r/rpl_mysql_upgrade_slave_repo_check.result
new file mode 100644
index 00000000000..87cc9ab5a24
--- /dev/null
+++ b/mysql-test/r/rpl_mysql_upgrade_slave_repo_check.result
@@ -0,0 +1,33 @@
+include/master-slave.inc
+[connection master]
+********************************************************************
+* Test case1: Upgrade when repository tables have data. *
+* mysql_upgrade script should report warnings. *
+********************************************************************
+connection master;
+Slave info repository compatibility check: Found data in `mysql`.`slave_master_info` table.
+Warning: Content of `mysql`.`slave_master_info` table will be ignored as MariaDB supports file based info repository.
+Slave info repository compatibility check: Found data in `mysql`.`slave_relay_log_info` table.
+Warning: Content of `mysql`.`slave_relay_log_info` table will be ignored as MariaDB supports file based repository.
+Slave server may not possess the correct replication metadata.
+Execution of CHANGE MASTER as per `mysql`.`slave_master_info` and `mysql`.`slave_relay_log_info` table content is recommended.
+connection slave;
+Slave info repository compatibility check: Found data in `mysql`.`slave_master_info` table.
+Warning: Content of `mysql`.`slave_master_info` table will be ignored as MariaDB supports file based info repository.
+Slave info repository compatibility check: Found data in `mysql`.`slave_relay_log_info` table.
+Warning: Content of `mysql`.`slave_relay_log_info` table will be ignored as MariaDB supports file based repository.
+Slave server may not possess the correct replication metadata.
+Execution of CHANGE MASTER as per `mysql`.`slave_master_info` and `mysql`.`slave_relay_log_info` table content is recommended.
+connection master;
+TRUNCATE TABLE `mysql`.`slave_master_info`;
+TRUNCATE TABLE `mysql`.`slave_relay_log_info`;
+********************************************************************
+* Test case2: Upgrade when repository tables are empty. *
+* mysql_upgrade script should not report any warning. *
+********************************************************************
+connection master;
+connection slave;
+"====== Clean up ======"
+connection master;
+DROP TABLE `mysql`.`slave_master_info`, `mysql`.`slave_relay_log_info`;
+include/rpl_end.inc
diff --git a/mysql-test/r/select_debug.result b/mysql-test/r/select_debug.result
index 55882ad337a..dfe49aed215 100644
--- a/mysql-test/r/select_debug.result
+++ b/mysql-test/r/select_debug.result
@@ -6,6 +6,7 @@ insert into t1 values (2,2), (1,1);
create table t2 (a int);
insert into t2 values (2), (3);
set session join_cache_level=3;
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
explain select t1.b from t1,t2 where t1.b=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
@@ -16,3 +17,4 @@ b
2
set session join_cache_level=default;
drop table t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result
index d16bd41b2cb..10af9265649 100644
--- a/mysql-test/r/selectivity.result
+++ b/mysql-test/r/selectivity.result
@@ -1871,5 +1871,20 @@ id select_type table type possible_keys key key_len ref rows Extra
set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
+#
+# MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
+set optimizer_use_condition_selectivity=4;
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+SELECT * from t1 WHERE a = 5 and b = 5;
+a b
+5 5
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
# End of 10.1 tests
set @@global.histogram_size=@save_histogram_size;
diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result
index f2435179a85..ee0f56ae7ed 100644
--- a/mysql-test/r/selectivity_innodb.result
+++ b/mysql-test/r/selectivity_innodb.result
@@ -1881,6 +1881,21 @@ id select_type table type possible_keys key key_len ref rows Extra
set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
+#
+# MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
+set optimizer_use_condition_selectivity=4;
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+SELECT * from t1 WHERE a = 5 and b = 5;
+a b
+5 5
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
# End of 10.1 tests
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result
index 0819ae5ba37..e280ae7040e 100644
--- a/mysql-test/r/show_explain.result
+++ b/mysql-test/r/show_explain.result
@@ -23,7 +23,7 @@ show explain for $thr1;
ERROR HY000: Target is not running an EXPLAINable command
connection con1;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select count(*) from t1 where a < 100000;
connection default;
show explain for $thr2;
@@ -58,10 +58,10 @@ connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
set optimizer_switch= @show_expl_tmp;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# UNION, first branch
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
connection default;
show explain for $thr2;
@@ -76,10 +76,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# UNION, second branch
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
connection default;
show explain for $thr2;
@@ -94,10 +94,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# Uncorrelated subquery, select
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
show explain for $thr2;
@@ -109,10 +109,10 @@ Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
connection con1;
a (select max(a) from t0 B)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# Uncorrelated subquery, explain
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
show explain for $thr2;
@@ -125,10 +125,10 @@ connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# correlated subquery, select
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@@ -140,10 +140,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# correlated subquery, explain
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@@ -155,10 +155,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@@ -170,10 +170,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@@ -185,10 +185,10 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
@@ -200,12 +200,12 @@ Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a
connection con1;
a (select max(a) from t0 b where b.a+a.a<10)
0 9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# Try to do SHOW EXPLAIN for a query that runs a SET command:
# I've found experimentally that select_id==2 here...
#
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
show explain for $thr2;
@@ -213,13 +213,13 @@ ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for an UPDATE
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
show explain for $thr2;
@@ -236,13 +236,13 @@ Warnings:
Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
connection con1;
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
show explain for $thr2;
@@ -259,13 +259,13 @@ Warnings:
Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
connection con1;
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Multiple SHOW EXPLAIN calls for one select
#
create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
show explain for $thr2;
@@ -292,14 +292,14 @@ a SUBQ
1 0
2 0
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
#
explain select * from t0 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select * from t0 order by a;
connection default;
@@ -320,7 +320,7 @@ a
7
8
9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary"
#
@@ -329,7 +329,7 @@ explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
connection con1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
connection default;
@@ -350,7 +350,7 @@ a
7
8
9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
#
@@ -359,7 +359,7 @@ explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
connection con1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
connection default;
@@ -380,7 +380,7 @@ a
7
8
9
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
#
@@ -390,7 +390,7 @@ explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
-set debug_dbug='+d,show_explain_in_find_all_keys';
+SET debug_dbug='+d,show_explain_in_find_all_keys';
SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
connection default;
# FIXED by "conservative assumptions about when QEP is available" fix:
@@ -406,7 +406,7 @@ a
1
2
4
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
@@ -421,7 +421,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
connection default;
show explain for $thr2;
@@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
@@ -453,7 +453,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 6
2 DERIVED t3 system NULL NULL NULL NULL 1
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM v1, t2;
connection default;
show explain for $thr2;
@@ -461,14 +461,14 @@ ERROR HY000: Target is not running an EXPLAINable command
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;
#
# MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
#
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
select sleep(1);
connection default;
show explain for $thr2;
@@ -479,12 +479,12 @@ Note 1003 select sleep(1)
connection con1;
sleep(1)
0
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate
#
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0 where 1>10;
connection default;
show explain for $thr2;
@@ -494,14 +494,14 @@ Warnings:
Note 1003 select * from t0 where 1>10
connection con1;
a
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate (2)
#
create table t3(a int primary key);
insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0,t3 where t3.a=112233;
connection default;
show explain for $thr2;
@@ -511,7 +511,7 @@ Warnings:
Note 1003 select * from t0,t3 where t3.a=112233
connection con1;
a a
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t3;
#
# MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
@@ -530,7 +530,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
@@ -552,7 +552,7 @@ pk a
6 7
7 7
9 7
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t2;
#
# MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
@@ -584,7 +584,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join)
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
SELECT count(*) FROM t2, t3
WHERE a1 < ALL (
SELECT a1 FROM t2
@@ -605,7 +605,7 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 )
connection con1;
count(*)
1740
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t2, t3, t4;
#
# MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
@@ -615,7 +615,7 @@ INSERT INTO t2 VALUES
(1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
connection default;
show explain for $thr2;
@@ -627,7 +627,7 @@ Warnings:
Note 1003 SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`)
connection con1;
pk a1
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
DROP TABLE t1;
#
@@ -636,7 +636,7 @@ DROP TABLE t1;
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT 'test' FROM t1 WHERE a=1;
connection default;
show explain for $thr2;
@@ -648,7 +648,7 @@ connection con1;
test
test
test
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
@@ -666,7 +666,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_test_if_quick_select';
+SET debug_dbug='+d,show_explain_probe_test_if_quick_select';
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
connection default;
show explain for $thr2;
@@ -696,7 +696,7 @@ Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND
connection con1;
count(*)
212
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
@@ -705,7 +705,7 @@ drop table t1;
CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SHOW INDEX FROM t1;
connection default;
show explain for $thr2;
@@ -718,7 +718,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
t1 1 b 1 b A NULL NULL NULL YES BTREE
t1 1 c 1 c A NULL NULL NULL YES BTREE
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
@@ -731,7 +731,7 @@ EXPLAIN SELECT a + 1 FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 2
-set debug_dbug='+d,show_explain_probe_join_tab_preread';
+SET debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
SELECT a + 1 FROM v1;
connection default;
@@ -745,7 +745,7 @@ connection con1;
a + 1
2
3
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t1;
#
@@ -761,7 +761,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
-set debug_dbug='+d,show_explain_probe_union_read';
+SET debug_dbug='+d,show_explain_probe_union_read';
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
connection default;
show explain for $thr2;
@@ -782,7 +782,7 @@ Warnings:
Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
connection con1;
a
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
@@ -805,7 +805,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
connection default;
@@ -820,7 +820,7 @@ Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
connection con1;
a b
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1, t2;
#
# Test that SHOW EXPLAIN will print 'Distinct'.
@@ -842,7 +842,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select distinct t1.a from t1,t3 where t1.a=t3.a;
connection default;
show explain for $thr2;
@@ -855,7 +855,7 @@ connection con1;
a
1
2
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1,t3,t4;
#
# ---------- SHOW EXPLAIN and permissions -----------------
@@ -869,7 +869,7 @@ connection con1;
# First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
#
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection default;
connection con2;
@@ -886,14 +886,14 @@ a
0
1
2
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
#
# Check that user test2 can do SHOW EXPLAIN on its own queries
#
connect con3, localhost, test2,,;
connection con2;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection con1;
connection con3;
@@ -916,9 +916,9 @@ disconnect con2;
grant process on *.* to test2@localhost;
connect con2, localhost, test2,,;
connection con1;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
connection default;
connection con2;
@@ -932,7 +932,7 @@ a
0
1
2
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
disconnect con2;
@@ -1009,7 +1009,7 @@ ORDER BY b;
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 8 Using sort_union(a,b); Using where; Using filesort
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@@ -1030,9 +1030,9 @@ a+SLEEP(0.01)
0
0
0
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@@ -1053,7 +1053,7 @@ a+SLEEP(0.01)
0
0
0
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
@@ -1067,7 +1067,7 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a FROM t1 GROUP BY a;
connection default;
show explain for $thr2;
@@ -1093,7 +1093,7 @@ a
14
15
16
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
#
# MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
@@ -1107,7 +1107,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
connection default;
show explain for $thr2;
@@ -1119,7 +1119,7 @@ Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE
connection con1;
SUM(a + SLEEP(0.1))
7862
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1, t2;
#
# MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
@@ -1157,7 +1157,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index
1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
connection default;
show explain for $thr2;
@@ -1169,7 +1169,7 @@ Warnings:
Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2
connection con1;
field1 field2
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
@@ -1190,7 +1190,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20
3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
connection default;
@@ -1205,7 +1205,7 @@ WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10
connection con1;
max(a+b+c)
279
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
@@ -1231,7 +1231,7 @@ select hex('');
hex('')
E3FB
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where length('') = a;
connection default;
set names utf8;
@@ -1244,7 +1244,7 @@ set names default;
connection con1;
a
2
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set names default;
#
# MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
@@ -1270,7 +1270,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1)
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
WHERE b <= ANY (
SELECT a FROM t1
@@ -1290,7 +1290,7 @@ WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ))
connection con1;
SUM(b)
0
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2;
drop table t0;
#
@@ -1302,7 +1302,7 @@ create table t1 (a int, b int);
insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
+SET debug_dbug='+d,show_explain_probe_best_ext_lim_search';
explain
select * from t0
where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null;
diff --git a/mysql-test/r/show_explain_non_select.result b/mysql-test/r/show_explain_non_select.result
index 6076a848e22..8d96056ca91 100644
--- a/mysql-test/r/show_explain_non_select.result
+++ b/mysql-test/r/show_explain_non_select.result
@@ -14,7 +14,7 @@ from t0 A, t0 B, t0 C;
# Test SHOW EXPLAIN for single-table DELETE
#
connection con2;
-set debug_dbug='+d,show_explain_probe_delete_exec_start';
+SET debug_dbug='+d,show_explain_probe_delete_exec_start';
delete from t1 where a<10 and b+1>1000;
connection default;
show explain for $thr2;
@@ -27,7 +27,7 @@ connection con2;
# Test SHOW EXPLAIN for multi-table DELETE
#
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
connection default;
show explain for $thr2;
@@ -41,7 +41,7 @@ connection con2;
# Test SHOW EXPLAIN for single-table UPDATE
#
connection con2;
-set debug_dbug='+d,show_explain_probe_update_exec_start';
+SET debug_dbug='+d,show_explain_probe_update_exec_start';
update t1 set filler='filler-data-2' where a<10 and b+1>1000;
connection default;
show explain for $thr2;
@@ -51,5 +51,5 @@ Warnings:
Note 1003 update t1 set filler='filler-data-2' where a<10 and b+1>1000
connection con2;
drop table t0,t1;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set debug_sync='RESET';
diff --git a/mysql-test/r/show_explain_ps.result b/mysql-test/r/show_explain_ps.result
index 38f368ec4f5..88f4ac7517a 100644
--- a/mysql-test/r/show_explain_ps.result
+++ b/mysql-test/r/show_explain_ps.result
@@ -17,7 +17,8 @@ connection con1;
connection default;
connection con1;
set @show_explain_probe_select_id=1;
-set debug_dbug='d,show_explain_probe_join_exec_start';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='d,show_explain_probe_join_exec_start';
select count(*) from t0 where a < 100000;
connection default;
show explain for $thr2;
@@ -28,7 +29,7 @@ Note 1003 select count(*) from t0 where a < 100000
connection con1;
count(*)
10
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
select event_name
from
performance_schema.events_stages_history_long join
diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result
index f05e357104d..5dab89dbd4d 100644
--- a/mysql-test/r/signal.result
+++ b/mysql-test/r/signal.result
@@ -2347,21 +2347,21 @@ DECLARE céèçà foo CONDITION FOR SQLSTATE '12345';
SIGNAL céèçà SET MYSQL_ERRNO = 1000;
end $$
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 'èçà foo CONDITION FOR SQLSTATE '12345';
-SIGNAL céèçà SET ' at line 3
+SIGNAL céèçà S...' at line 3
create procedure test_signal()
begin
DECLARE "céèçà" CONDITION FOR SQLSTATE '12345';
SIGNAL "céèçà" SET MYSQL_ERRNO = 1000;
end $$
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 '"céèçà" CONDITION FOR SQLSTATE '12345';
-SIGNAL "céèçà" S' at line 3
+SIGNAL "céèçà...' at line 3
create procedure test_signal()
begin
DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345';
SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000;
end $$
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 ''céèçà' CONDITION FOR SQLSTATE '12345';
-SIGNAL 'céèçà' S' at line 3
+SIGNAL 'céèçà...' at line 3
create procedure test_signal()
begin
DECLARE `céèçà` CONDITION FOR SQLSTATE '12345';
diff --git a/mysql-test/r/slowlog_enospace-10508.result b/mysql-test/r/slowlog_enospace-10508.result
index f39bfa2f00e..66fb19eed6a 100644
--- a/mysql-test/r/slowlog_enospace-10508.result
+++ b/mysql-test/r/slowlog_enospace-10508.result
@@ -3,7 +3,8 @@ create table t1 (a int, b int) engine=memory;
insert t1 select seq, seq+1 from seq_1_to_1000;
set global general_log=0;
set global log_queries_not_using_indexes=1;
-set debug_dbug='+d,simulate_file_write_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,simulate_file_write_error';
select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
@@ -54,7 +55,7 @@ select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
select * from t1 where a>10;
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
set global general_log=1;
set global log_queries_not_using_indexes=default;
drop table t1;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index a6c8822b4e8..877c8bb1666 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1716,17 +1716,17 @@ DROP TABLE t1;
# WITH OBSCURE QUERY
#
SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
-ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...' is too long
CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
-ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...' is too long
SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
-ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
+ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...'
CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
-ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222'
+ERROR 42000: Incorrect database name 'very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...'
SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
-ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+ERROR 42000: Identifier name 'very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...' is too long
CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
-ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222' is too long
+ERROR 42000: Identifier name 'very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222...' is too long
End of 5.1 tests
#
# Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
@@ -2872,3 +2872,16 @@ SELECT @msg;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP TABLE t1;
+#
+# 10.2 Test
+#
+# MDEV-MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed in Diagnostics_area::set_ok_status
+#
+SET @old_optimizer_switch = @@SESSION.OPTIMIZER_SWITCH;
+SET @cmd:="SET @@SESSION.SQL_MODE=(SELECT 'a')";
+SET @@SESSION.OPTIMIZER_SWITCH="in_to_exists=OFF,materialization=OFF";
+ERROR HY000: At least one of the 'in_to_exists' or 'materialization' optimizer_switch flags must be 'on'
+PREPARE stmt FROM @cmd;
+set @@SESSION.OPTIMIZER_SWITCH=@old_optimizer_switch;
+# End of 10.2 Test
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 1df2e8ef30e..c4d3779e484 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -5302,7 +5302,7 @@ CREATE DEFINER=longer_than_80_45678901234567890123456789012345678901234567890123
BEGIN
SET @a = 1;
END|
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
FUNCTION bug16899_f1() RETURNS INT
BEGIN
diff --git a/mysql-test/r/sp2.result b/mysql-test/r/sp2.result
new file mode 100644
index 00000000000..30e97890e5a
--- /dev/null
+++ b/mysql-test/r/sp2.result
@@ -0,0 +1,20 @@
+CREATE DATABASE test1;
+CREATE PROCEDURE test1.sp3() BEGIN END;
+SHOW PROCEDURE STATUS;
+Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
+mtr add_suppression PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
+mtr check_testcase PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
+mtr check_warnings PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
+mysql AddGeometryColumn PROCEDURE root@localhost # # INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
+mysql DropGeometryColumn PROCEDURE root@localhost # # INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
+test sp2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test1 sp1 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+test1 sp3 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
+DROP PROCEDURE sp2;
+DROP DATABASE test1;
+select count(*) from mysql.event;
+count(*)
+416
+flush tables;
+show events;
+truncate table mysql.event;
diff --git a/mysql-test/r/ssl_system_ca,bad.result b/mysql-test/r/ssl_system_ca,bad.result
new file mode 100644
index 00000000000..b9c6d3e29d8
--- /dev/null
+++ b/mysql-test/r/ssl_system_ca,bad.result
@@ -0,0 +1 @@
+ERROR 2026 (HY000): SSL connection error: Validation of SSL server certificate failed
diff --git a/mysql-test/r/ssl_system_ca.result b/mysql-test/r/ssl_system_ca.result
new file mode 100644
index 00000000000..78f8bf805dd
--- /dev/null
+++ b/mysql-test/r/ssl_system_ca.result
@@ -0,0 +1,2 @@
+*************************** 1. row ***************************
+have_ssl: 1
diff --git a/mysql-test/r/stat_tables-enospc.result b/mysql-test/r/stat_tables-enospc.result
index 943cbca6bc5..9ac24a2af99 100644
--- a/mysql-test/r/stat_tables-enospc.result
+++ b/mysql-test/r/stat_tables-enospc.result
@@ -1,11 +1,12 @@
call mtr.add_suppression("No space left on device");
create table t1 (a varchar(255), b varchar(255), c varchar(255));
set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
-set debug_dbug='+d,simulate_file_write_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,simulate_file_write_error';
set @@max_heap_table_size=128*1024;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze Error Error writing file 'tmp-file' (Errcode: 28 "No space left on device")
test.t1 analyze status Operation failed
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
drop table t1;
diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result
index a436efb5fea..23b952cc891 100644
--- a/mysql-test/r/stat_tables_innodb.result
+++ b/mysql-test/r/stat_tables_innodb.result
@@ -855,4 +855,28 @@ drop table t1;
# please keep this at the last
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
+#
+# MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows.
+#
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+INSERT INTO t1 SELECT 1 FROM seq_1_to_60000;
+SET @save_use_stat_tables= @@use_stat_tables;
+SET use_stat_tables= preferably;
+SELECT count(*) FROM t1;
+count(*)
+60000
+CREATE INDEX idx ON t1(a);
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (idx);
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+SELECT * FROM mysql.index_stats where table_name='t1';
+db_name table_name index_name prefix_arity avg_frequency
+test t1 idx 1 60000.0000
+SELECT * FROM mysql.column_stats where table_name='t1';
+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 1 0.0000 4.0000 60000.0000 0 NULL NULL
+SET use_stat_tables= @save_use_stat_tables;
+DROP TABLE t1;
+# end of 10.1 tests
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/stat_tables_partition.result b/mysql-test/r/stat_tables_partition.result
index 12ae2570272..2dd63e858d4 100644
--- a/mysql-test/r/stat_tables_partition.result
+++ b/mysql-test/r/stat_tables_partition.result
@@ -9,5 +9,37 @@ 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 = DEFAULT;
DROP TABLE t1;
+#
+# MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows
+#
+CREATE TABLE t1 (
+id int(11) auto_increment primary key,
+c1 int(11) DEFAULT NULL
+) PARTITION BY RANGE (id) (
+PARTITION p0 VALUES LESS THAN (4),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+);
+insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1);
+insert into t1(c1) select c1 from t1;
+insert into t1(c1) select c1 from t1;
+select count(*) from t1;
+count(*)
+32
+select count(*) from t1 where id <4;
+count(*)
+3
+flush status;
+set session use_stat_tables='preferably';
+# Must NOT show "Engine-independent statistics collected":
+alter table t1 analyze partition p0;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+# Should not have Handler_read_rnd_next=34
+show session status like 'Handler_read_rnd%';
+Variable_name Value
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+drop table t1;
+SET use_stat_tables = DEFAULT;
diff --git a/mysql-test/r/stat_tables_rbr.result b/mysql-test/r/stat_tables_rbr.result
index 7ae7ade4398..9b43d0709c0 100644
--- a/mysql-test/r/stat_tables_rbr.result
+++ b/mysql-test/r/stat_tables_rbr.result
@@ -16,7 +16,6 @@ SET use_stat_tables = PREFERABLY;
CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
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
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 2fc87a9e0d8..c0df4f626b1 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2534,3 +2534,156 @@ x
c1
1
drop table t1;
+#
+# MDEV-22498: SIGSEGV in Bitmap<64u>::merge on SELECT
+#
+set @save_sql_select_limit= @@sql_select_limit;
+SET sql_select_limit=0;
+CREATE TABLE t1(b INT, c INT);
+CREATE TABLE t2(a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
+EXPLAIN EXTENDED SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select sum(`test`.`t2`.`a`) AS `sum(a)`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` having <in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t1` where <cache>(`test`.`t2`.`a`) = `test`.`t2`.`b`))
+SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1);
+sum(a) a b
+SET @@sql_select_limit= @save_sql_select_limit;
+EXPLAIN EXTENDED SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select sum(`test`.`t2`.`a`) AS `sum(a)`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` having <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t1` where <cache>(`test`.`t2`.`a`) = `test`.`t2`.`b`)))
+SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1);
+sum(a) a b
+6 1 1
+DROP TABLE t1,t2;
+#
+# MDEV-17606: Query returns wrong results (while using CHARACTER SET utf8)
+#
+CREATE TABLE t1(l1 varchar(10), i2 int);
+INSERT INTO t1 VALUES ('e',2),('o',6),('x',4);
+CREATE TABLE t2 (v1 varchar(10) CHARACTER SET utf8, KEY v1 (v1(3)));
+INSERT INTO t2 VALUES ('k'),('rid'),('f'),('x');
+EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+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
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`l1` AS `l1`,`test`.`t1`.`i2` AS `i2` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`l1`,<max>(select max(`test`.`t2`.`v1`) from `test`.`t2`) > convert(<cache>(`test`.`t1`.`l1`) using utf8)))
+SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+l1 i2
+e 2
+o 6
+DROP TABLE t1, t2;
+#
+# MDEV-19232: Floating point precision / value comparison problem
+#
+CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0));
+INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797);
+INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422);
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=on';
+SELECT
+population, area, population/area,
+cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1;
+population area population/area cast(population/area as DECIMAL(20,9))
+11797 91 129.6374 129.637362637
+SELECT * FROM t1 A
+WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
+region area population
+Central America and the Caribbean 442 66422
+SET optimizer_switch='subquery_cache=off';
+SELECT * FROM t1 A
+WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
+region area population
+Central America and the Caribbean 442 66422
+SET @@optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1;
+#
+# MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (2),(3);
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+EXPLAIN
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY A ALL NULL NULL NULL NULL 2
+3 UNION B ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+DROP TABLE t1,t2;
+# end of 10.1 tests
+#
+# MDEV-22852: SIGSEGV in sortlength (optimized builds)
+#
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=off';
+CREATE TABLE t1 (a INT,b INT);
+INSERT INTO t1 VALUES (0,0),(0,0);
+SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
+(SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b))
+0
+SET @@optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1;
+#
+# MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE
+# with subquery with ROLLUP
+#
+CREATE TABLE t1 (i INT DEFAULT 0, c VARCHAR(2048));
+INSERT INTO t1 SELECT 0, seq FROM seq_1_to_6000;
+CREATE TABLE t2 (f VARCHAR(2048) DEFAULT '');
+INSERT INTO t2 VALUES ('1'),('bar');
+EXPLAIN
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6000 Using filesort
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+f
+1
+SELECT * FROM t2;
+f
+1
+bar
+DELETE FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP );
+SELECT * FROM t2;
+f
+bar
+DROP TABLE t1, t2;
+# End of 10.2 tests
diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result
index de01a4e7304..de4e428e462 100644
--- a/mysql-test/r/subselect_exists2in.result
+++ b/mysql-test/r/subselect_exists2in.result
@@ -437,8 +437,8 @@ drop table t1,t3;
# MDEV-159 Assertion about not marked for read failed in
# String* Field_varstring::val_str(String*, String*)
#
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch='in_to_exists=on,exists_to_in=on';
+SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'in_to_exists=off', 'in_to_exists=on');
+SET optimizer_switch='exists_to_in=on';
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('k'),('m');
CREATE TABLE t2 ( b INT,
@@ -593,8 +593,8 @@ Warnings:
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a`
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
+SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'materialization=off', 'materialization=on');
+SET optimizer_switch = 'exists_to_in=on,semijoin=off';
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
a b
@@ -972,4 +972,131 @@ id
DROP PROCEDURE p1;
DROP TABLE t1;
# End of 10.0 tests
+#
+# MDEV-23221: A subquery causes crash
+#
+create table t1 (
+location_code varchar(10),
+country_id varchar(10)
+);
+insert into t1 values ('HKG', 'HK');
+insert into t1 values ('NYC', 'US');
+insert into t1 values ('LAX', 'US');
+create table t2 (
+container_id varchar(10),
+cntr_activity_type varchar(10),
+cntr_dest varchar(10)
+);
+insert into t2 values ('AAAA1111', 'VSL', 'NYC');
+insert into t2 values ('AAAA1111', 'CUV', 'NYC');
+insert into t2 values ('BBBB2222', 'VSL', 'LAX');
+insert into t2 values ('BBBB2222', 'XYZ', 'LAX');
+# Must not crash or return an error:
+select
+(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
+(select
+max(container_id)
+from t2 as cl2
+where
+cl2.container_id = cl1.container_id and
+cl2.cntr_activity_type = 'CUV' and
+exists (select location_code
+from t1
+where
+location_code = cl2.cntr_dest and
+country_id = dest_cntry)
+) as CUV
+from
+t2 cl1;
+dest_cntry CUV
+US AAAA1111
+US AAAA1111
+US NULL
+US NULL
+prepare s from "select
+(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
+(select
+max(container_id)
+from t2 as cl2
+where
+cl2.container_id = cl1.container_id and
+cl2.cntr_activity_type = 'CUV' and
+exists (select location_code
+from t1
+where
+location_code = cl2.cntr_dest and
+country_id = dest_cntry)
+) as CUV
+from
+t2 cl1";
+execute s;
+dest_cntry CUV
+US AAAA1111
+US AAAA1111
+US NULL
+US NULL
+execute s;
+dest_cntry CUV
+US AAAA1111
+US AAAA1111
+US NULL
+US NULL
+drop table t1,t2;
+#
+# MDEV-20557: SQL query with duplicate table aliases consistently crashes server
+# (Just a testcase)
+#
+create table t1 (id int, id2 int);
+create table t2 (id int, id2 int, a int);
+create table t3 (id int);
+create table t4 (id int);
+select (select 1 from t1 where (exists
+(select 1 from t2
+where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt
+from t3;
+ERROR 42000: This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left expression of IN/ALL/ANY'
+drop table t1,t2,t3,t4;
+#
+# MDEV-21649: Crash when using nested EXISTS
+# (Just a testcase)
+#
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
+CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id));
+CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id));
+SELECT
+W0.`id`
+FROM
+`t1` W0
+WHERE (
+EXISTS(
+SELECT
+V0.`id`
+ FROM
+`t2` V0
+WHERE (
+EXISTS(
+SELECT
+U0.`id`
+ FROM
+`t2` U0
+INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`)
+WHERE (
+U0.`ip_id` = V0.`ip_id`
+ AND U4.`storage_method_id` = (
+SELECT
+U5.`storage_method_id`
+ FROM
+`t3` U5
+WHERE
+U5.`storage_target_id` = V0.`id`
+ LIMIT
+1
+)
+)
+)
+)
+)
+);
+id
+drop table t1,t2,t3;
set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index ec7f2c0a3d5..4eaea099451 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -615,3 +615,17 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2`
DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
+#
+set @save_character_set_connection=@@character_set_connection;
+set character_set_connection='utf8';
+CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB;
+INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05');
+CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB;
+INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
+SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
+a b
+2019-03-10 02:55:05 2019-03-10 02:55:05
+DROP TABLE t1,t2;
+set character_set_connection=@save_character_set_connection;
diff --git a/mysql-test/r/sum_distinct-big.result b/mysql-test/r/sum_distinct-big.result
index 13e3e62fed2..08afa1dd1b0 100644
--- a/mysql-test/r/sum_distinct-big.result
+++ b/mysql-test/r/sum_distinct-big.result
@@ -3,27 +3,7 @@ set @save_max_heap_table_size=@@max_heap_table_size;
set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
-INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
-INSERT INTO t1 (id) SELECT id FROM t1;
-/* 8 */
-INSERT INTO t1 (id) SELECT id FROM t1;
-/* 12 */
-INSERT INTO t1 (id) SELECT id FROM t1;
-/* 16 */
-INSERT INTO t1 (id) SELECT id FROM t1;
-/* 20 */
-INSERT INTO t1 (id) SELECT id FROM t1;
-/* 24 */
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1_to_1024 b;
SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
AVG(DISTINCT id)
513.5000
@@ -54,11 +34,9 @@ SUM(DISTINCT id)/COUNT(DISTINCT id)
517.0000
511.5000
512.5000
-INSERT INTO t1 SELECT id+1024 FROM t1;
-INSERT INTO t1 SELECT id+2048 FROM t1;
-INSERT INTO t1 SELECT id+4096 FROM t1;
-INSERT INTO t1 SELECT id+8192 FROM t1;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1025_to_16384 b;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_16384 b
+ORDER by (a.seq*0+b.seq)*rand();
SELECT SUM(DISTINCT id) sm FROM t1;
sm
134225920
@@ -110,9 +88,10 @@ sm
# (bug #56927)
#
SET max_heap_table_size=default;
-INSERT INTO t1 SELECT id+16384 FROM t1;
-DELETE FROM t2;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_16385_to_32768 b;
+TRUNCATE t2;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_32768 b
+ORDER BY (a.seq*0+b.seq)*rand();
SELECT SUM(DISTINCT id) sm FROM t2;
sm
536887296
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 78ca7a66682..cd6621ac487 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -584,3 +584,21 @@ ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL;
ERROR 42S22: Unknown column 'no_such_col1' in 't1'
TRUNCATE TABLE t1;
DROP TEMPORARY TABLE t1;
+#
+# MDEV-21695 Server crashes in TABLE::evaluate_update_default_function upon UPDATE on temporary table
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TEMPORARY TABLE t1 (a DATETIME ON UPDATE CURRENT_TIMESTAMP);
+ALTER TABLE t1 ADD b INT;
+INSERT INTO t1 (b) VALUES (1),(2);
+ALTER TABLE t1 CHANGE COLUMN x xx INT;
+ERROR 42S22: Unknown column 'x' in 't1'
+UPDATE t1 SET b = 3;
+SELECT * FROM t1;
+a b
+2001-01-01 10:20:30 3
+2001-01-01 10:20:30 3
+DROP TEMPORARY TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/temp_table_symlink.result b/mysql-test/r/temp_table_symlink.result
new file mode 100644
index 00000000000..1c5c68170ff
--- /dev/null
+++ b/mysql-test/r/temp_table_symlink.result
@@ -0,0 +1,13 @@
+create table d1 (a int);
+create temporary table t1 (a int);
+create temporary table t2 (a int);
+Got one of the listed errors
+create temporary table t3 (a int) engine=Aria;
+Got one of the listed errors
+select * from information_schema.columns where table_schema='test';
+Got one of the listed errors
+flush tables;
+select * from d1;
+a
+drop temporary table t1;
+drop table d1;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 00f16accb3e..b08139a346b 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1185,7 +1185,7 @@ CREATE TABLE t1(c INT);
CREATE TABLE t2(c INT);
CREATE DEFINER=longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost
TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW SET @a = 2;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 5429d8cd059..ee50b1c4f2d 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -429,6 +429,7 @@ select @a;
#
# BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
#
+SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-01 00:00:01');
create table t1(a date,key(a));
insert into t1 values ('2012-01-01'),('2012-02-02');
explain
@@ -440,6 +441,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
1
drop table t1;
+SET TIMESTAMP=DEFAULT;
#
# MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
# MDEV-9972 Least function retuns date in date time format
@@ -914,3 +916,21 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
+#
+# Start of 10.2 tests
+#
+#
+# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+#
+CREATE TABLE t1 (f DATE, KEY(f));
+INSERT INTO t1 VALUES ('2020-01-01'),('2020-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index f f 4 NULL 2 50.00 Using where; Using index
+Warnings:
+Warning 1292 Incorrect datetime value: '1995.0000000'
+Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00' between `test`.`t1`.`f` and <cache>('2012-12-12')
+DROP TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index ccb0e64d0fa..27be65c8641 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -57,6 +57,7 @@ select * from t1;
t
0000-00-00 00:00:00
drop table t1;
+SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
Warnings:
@@ -65,6 +66,7 @@ select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
date_format(a,"%Y-%m-%d")=b right(a+0,6)=c+0 a=d+0
1 1 1
drop table t1;
+SET TIMESTAMP=DEFAULT;
CREATE TABLE t1 (a datetime not null);
insert into t1 values (0);
select * from t1 where a is null;
@@ -298,8 +300,10 @@ f2 f3
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
f2
2001-04-15 00:00:00
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
1
+SET timestamp=DEFAULT;
drop table t1;
create table t1 (f1 date);
insert into t1 values('01-01-01'),('01-01-02'),('01-01-03');
@@ -1198,6 +1202,87 @@ Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
DROP VIEW v1;
DROP TABLE t1;
#
+# MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+#
+CREATE TABLE t1
+(
+id INT NOT NULL PRIMARY KEY,
+id2 INT,
+k TINYINT,
+j INT,
+t DATETIME,
+KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'2019-12-13 10:09:59'),
+(54,54,1,0,'2019-12-13 16:28:41'),
+(55,54,1,0,'2019-12-13 16:29:10'),
+(56,54,1,0,'2019-12-13 16:29:43'),
+(57,54,1,0,'2019-12-13 16:30:16'),
+(58,54,1,0,'2019-12-13 16:30:49'),
+(59,54,1,0,'2019-12-13 16:31:23'),
+(60,54,1,0,'2019-12-13 16:31:55'),
+(61,54,1,0,'2019-12-13 16:32:28'),
+(62,54,1,0,'2019-12-13 16:33:01'),
+(63,54,1,0,'2019-12-13 16:33:34'),
+(64,54,1,0,'2019-12-13 16:34:07'),
+(65,54,1,0,'2019-12-13 16:34:40'),
+(66,54,1,0,'2019-12-13 16:35:13'),
+(67,54,1,0,'2019-12-13 16:35:46'),
+(68,54,1,0,'2019-12-13 16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=max(t);
+t
+2019-12-13 10:09:59
+2019-12-13 16:28:41
+2019-12-13 16:29:10
+2019-12-13 16:29:43
+2019-12-13 16:30:16
+2019-12-13 16:30:49
+2019-12-13 16:31:23
+2019-12-13 16:31:55
+2019-12-13 16:32:28
+2019-12-13 16:33:01
+2019-12-13 16:33:34
+2019-12-13 16:34:07
+2019-12-13 16:34:40
+2019-12-13 16:35:13
+2019-12-13 16:35:46
+2019-12-13 16:36:19
+SELECT t FROM t1 WHERE id2=54 and j=0 and k=1 GROUP BY t HAVING t=max(t);
+t
+2019-12-13 10:09:59
+2019-12-13 16:28:41
+2019-12-13 16:29:10
+2019-12-13 16:29:43
+2019-12-13 16:30:16
+2019-12-13 16:30:49
+2019-12-13 16:31:23
+2019-12-13 16:31:55
+2019-12-13 16:32:28
+2019-12-13 16:33:01
+2019-12-13 16:33:34
+2019-12-13 16:34:07
+2019-12-13 16:34:40
+2019-12-13 16:35:13
+2019-12-13 16:35:46
+2019-12-13 16:36:19
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1);
+SELECT pk<DATE'2001-01-01' FROM t1 GROUP BY pk;
+pk<DATE'2001-01-01'
+1
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+SELECT pk<DATE'2001-01-01' FROM v1 GROUP BY pk;
+pk<DATE'2001-01-01'
+1
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+DROP VIEW v1;
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
@@ -1249,5 +1334,17 @@ a
2000-10-00 00:00:00
DROP TABLE t1;
#
+# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+#
+CREATE TABLE t1 (f DATETIME, KEY(f));
+INSERT INTO t1 VALUES ('2020-01-01 00:00:00'),('2020-01-02 00:00:00');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index f f 6 NULL 2 50.00 Using where; Using index
+Warnings:
+Warning 1292 Incorrect datetime value: '1995.0000000'
+Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00 00:00:00.000000' between `test`.`t1`.`f` and <cache>('2012-12-12')
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index e7df21b170b..f588b18b85b 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -676,6 +676,27 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0
DROP TABLE t1;
#
+# MDEV-23282 FLOAT(53,0) badly handles out-of-range values
+#
+CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL);
+INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
+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
+SELECT c1, c2 FROM t1;
+c1 c2
+3.40282e38 -3.40282e38
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL);
+INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
+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
+SELECT c1, c2 FROM t1;
+c1 c2
+340282346638528860000000000000000000000 -340282346638528860000000000000000000000
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
diff --git a/mysql-test/r/type_int.result b/mysql-test/r/type_int.result
index 5530cb26cee..c4c09b927f8 100644
--- a/mysql-test/r/type_int.result
+++ b/mysql-test/r/type_int.result
@@ -20,6 +20,19 @@ COALESCE(@a)
1
DROP TABLE t1;
#
+# MDEV-21065 UNIQUE constraint causes a query with string comparison to omit a row in the result set
+#
+CREATE TABLE t1 (c0 INT UNIQUE);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL), (NULL), (1), (0);
+SELECT * FROM t1 WHERE c0 < '\n2';
+c0
+0
+1
+DROP TABLE t1;
+SELECT CAST('\n2' AS INT);
+CAST('\n2' AS INT)
+2
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index e00b77a0463..0fbf64a4b18 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -2345,6 +2345,53 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
+# MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result
+#
+SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val;
+val
+20.01
+SET sql_mode='';
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999'));
+CREATE TABLE t2 (a TEXT, d DECIMAL(15,2));
+INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1;
+Warnings:
+Note 1265 Data truncated for column 'd' at row 5
+Note 1265 Data truncated for column 'd' at row 6
+Note 1265 Data truncated for column 'd' at row 7
+INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1;
+Warnings:
+Note 1265 Data truncated for column 'd' at row 5
+Note 1265 Data truncated for column 'd' at row 6
+Note 1265 Data truncated for column 'd' at row 7
+SELECT d, a FROM t2 ORDER BY d,a;
+d a
+-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995
+-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999
+-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99
+-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994
+-1.90 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9
+-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0
+1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0
+1.90 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9
+1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99
+1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994
+2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995
+2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+#
+# End of 10.1 tests
+#
+#
# Bug#18408499 UNSIGNED BIGINT HIGH VALUES
# WRONG NUMERICAL COMPARISON RESULTS
#
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 742ee5a33e9..73e59bf211c 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -109,7 +109,7 @@ End of 5.0 tests
# Start of 10.0 tests
#
#
-# MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns
+# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
#
CREATE TABLE t1 (c1 DATE PRIMARY KEY);
INSERT INTO t1 VALUES ('2001-01-01');
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index d196d0ae2d5..90d09ea595f 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -1246,6 +1246,72 @@ drop table t1;
SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @@old_mode= @save_old_mode;
#
+# MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+#
+CREATE OR REPLACE TABLE t1
+(
+id INT NOT NULL PRIMARY KEY,
+id2 INT,
+k TINYINT,
+j INT,
+t TIME,
+KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'10:09:59'),
+(54,54,1,0,'16:28:41'),
+(55,54,1,0,'16:29:10'),
+(56,54,1,0,'16:29:43'),
+(57,54,1,0,'16:30:16'),
+(58,54,1,0,'16:30:49'),
+(59,54,1,0,'16:31:23'),
+(60,54,1,0,'16:31:55'),
+(61,54,1,0,'16:32:28'),
+(62,54,1,0,'16:33:01'),
+(63,54,1,0,'16:33:34'),
+(64,54,1,0,'16:34:07'),
+(65,54,1,0,'16:34:40'),
+(66,54,1,0,'16:35:13'),
+(67,54,1,0,'16:35:46'),
+(68,54,1,0,'16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=MAX(t);
+t
+10:09:59
+16:28:41
+16:29:10
+16:29:43
+16:30:16
+16:30:49
+16:31:23
+16:31:55
+16:32:28
+16:33:01
+16:33:34
+16:34:07
+16:34:40
+16:35:13
+16:35:46
+16:36:19
+SELECT t FROM t1 WHERE id2=54 AND j=0 AND k=1 GROUP BY t HAVING t=MAX(t);
+t
+10:09:59
+16:28:41
+16:29:10
+16:29:43
+16:30:16
+16:30:49
+16:31:23
+16:31:55
+16:32:28
+16:33:01
+16:33:34
+16:34:07
+16:34:40
+16:35:13
+16:35:46
+16:36:19
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
@@ -1290,5 +1356,17 @@ CAST(f1() AS TIME)
00:00:00
DROP FUNCTION f1;
#
+# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+#
+CREATE TABLE t1 (f TIME, KEY(f));
+INSERT INTO t1 VALUES ('10:10:10'),('20:20:20');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '23:59:59';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index f f 4 NULL 2 100.00 Using where; Using index
+Warnings:
+Warning 1292 Incorrect datetime value: '1995.0000000'
+Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '00:00:00.000000' between `test`.`t1`.`f` and <cache>('23:59:59')
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 3a84caa828a..49768f6c514 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -30,9 +30,9 @@ lookup("127.0.0.1")
127.0.0.1
select lookup(127,0,0,1);
ERROR HY000: Can't initialize function 'lookup'; Wrong arguments to lookup; Use the source
-select lookup("localhost");
-lookup("localhost")
-127.0.0.1
+select lookup("localhost") rlike '^127\.\\d+\.\\d+.\\d+$';
+lookup("localhost") rlike '^127\.\\d+\.\\d+.\\d+$'
+1
select reverse_lookup();
ERROR HY000: Can't initialize function 'reverse_lookup'; Wrong number of arguments to reverse_lookup; Use the source
select reverse_lookup("127.0.0.1");
@@ -479,3 +479,17 @@ myfunc_int(max(a) over (order by b) , b)
drop view v1;
drop function myfunc_int;
drop table t1;
+#
+# MDEV-23327: Can't uninstall UDF if the implementation library
+# file doesn't exist
+#
+insert into mysql.func values ("unexisting_udf", 0, "soname", "function");
+select * from mysql.func WHERE name='unexisting_udf';
+name ret dl type
+unexisting_udf 0 soname function
+DROP FUNCTION unexisting_udf;
+select * from mysql.plugin WHERE name='unexisting_udf';
+name dl
+DROP FUNCTION unexisting_udf;
+ERROR 42000: FUNCTION test.unexisting_udf does not exist
+# End of 10.2 tests
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index c02e590490e..f9df02b7f81 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1757,8 +1757,7 @@ union
select 4
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
;
-foo
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
prepare stmt1 from 'select 1 as foo
union
select 2
@@ -1768,12 +1767,7 @@ union
select 4
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
';
-execute stmt1;
-foo
-1
-execute stmt1;
-foo
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
select 1 as foo
union
select 2
@@ -1783,8 +1777,7 @@ union
(select 4)
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
;
-foo
-1
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
prepare stmt1 from 'select 1 as foo
union
select 2
@@ -1794,13 +1787,7 @@ union
(select 4)
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
';
-execute stmt1;
-foo
-1
-execute stmt1;
-foo
-1
-deallocate prepare stmt1;
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
End of 5.1 tests
#
# mdev-5091: Asseirtion failure for UNION with ORDER BY
@@ -2299,3 +2286,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0
DROP TABLE t1,t2;
+#
+# MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT()
+#
+CREATE TABLE t1 (a INT);
+INSERT t1 VALUES (1),(2),(3);
+(SELECT 1 AS a) UNION (SELECT a FROM t1 GROUP BY a) ORDER BY GROUP_CONCAT(a);
+ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
+DROP TABLE t1;
diff --git a/mysql-test/r/union_crash-714.result b/mysql-test/r/union_crash-714.result
index 4a51f88b76f..371be1e03d0 100644
--- a/mysql-test/r/union_crash-714.result
+++ b/mysql-test/r/union_crash-714.result
@@ -1,5 +1,7 @@
create table t1 (i tinyint);
-set debug_dbug='+d,bug11747970_raise_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,bug11747970_raise_error';
insert into t1 (i) select i from t1 union select i from t1;
ERROR 70100: Query execution was interrupted
drop table t1;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/r/uniques_crash-7912.result b/mysql-test/r/uniques_crash-7912.result
deleted file mode 100644
index bf3aab684ae..00000000000
--- a/mysql-test/r/uniques_crash-7912.result
+++ /dev/null
@@ -1,11 +0,0 @@
-call mtr.add_suppression("Out of memory");
-set sql_mode="";
-drop table if exists t1,t2;
-create table `t1` (`a` datetime not null) engine=InnoDB;
-create table `t2` (`a` int not null) engine=innodb;
-replace into t1 values (),();
-insert into t2 values(0);
-set session sort_buffer_size = 1024*1024*1024*1024;
-delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a;
-drop table t2;
-drop table t1;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index b9bde3adefd..994d5949460 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2954,7 +2954,7 @@ DROP VIEW IF EXISTS v2;
CREATE TABLE t1(a INT, b INT);
CREATE DEFINER=longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost
VIEW v1 AS SELECT a FROM t1;
-ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80)
+ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345...' is too long for user name (should be no longer than 80)
CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
VIEW v2 AS SELECT b FROM t1;
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
@@ -6649,17 +6649,6 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
ERROR HY000: Can not modify more than one base table through a join view 'test.v'
drop view v;
drop tables t1,t2,t3;
-create table t1 (i int, j int);
-insert t1 values (1,1),(2,2);
-create view v1 as select (2, 3) not in (select i, j from t1);
-select * from v1;
-(2, 3) not in (select i, j from t1)
-1
-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 !((2,3) in (select `t1`.`i`,`t1`.`j` from `t1`)) AS `(2, 3) not in (select i, j from t1)` latin1 latin1_swedish_ci
-drop view v1;
-drop table t1;
#
# MDEV-10704: Assertion `field->field->table == table_arg'
# failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
diff --git a/mysql-test/r/warnings_debug.result b/mysql-test/r/warnings_debug.result
index 4cdce7a5feb..3a9d8225795 100644
--- a/mysql-test/r/warnings_debug.result
+++ b/mysql-test/r/warnings_debug.result
@@ -1,5 +1,6 @@
drop table if exists t1;
create table t1 (a int primary key) engine=innodb;
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
INSERT INTO t1 VALUES (1);
Warnings:
@@ -8,3 +9,4 @@ SHOW WARNINGS;
Level Code Message
Warning 1196 Some non-transactional changed tables couldn't be rolled back
drop table t1;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 13d452f3ef2..3023a86eaad 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3634,5 +3634,237 @@ rank() over (partition by 'abc' order by 'xyz')
1
drop table t1;
#
+# MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
+x
+foo
+drop table t1;
+#
+# MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*)
+#
+CREATE TABLE t1 (i int) ;
+INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2);
+SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ;
+COUNT(*) OVER () MOD(MIN(i),2)
+3 0
+3 1
+drop table t1;
+#
+# MDEV-21318: Wrong results with window functions and implicit grouping
+#
+CREATE TABLE t1 (a INT);
+#
+# With empty const table
+# The expected result here is 1, NULL
+#
+explain
+SELECT row_number() over(), sum(1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found; Using temporary
+SELECT row_number() over(), sum(1) FROM t1;
+row_number() over() sum(1)
+1 NULL
+insert into t1 values (2);
+#
+# Const table has 1 row, but still impossible where
+# The expected result here is 1, NULL
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1;
+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 row_number() over(), sum(1) FROM t1 where a=1;
+row_number() over() sum(1)
+1 NULL
+#
+# Impossible HAVING
+# Empty result is expected
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+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 row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+row_number() over() sum(1)
+#
+# const table has 1 row, no impossible where
+# The expected result here is 1, 2
+#
+EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
+SELECT row_number() over(), sum(a) FROM t1 where a=2;
+row_number() over() sum(a)
+1 2
+drop table t1;
+#
+# Impossible Where
+#
+create table t1(a int);
+insert into t1 values (1);
+#
+# Expected result is NULL, 0, NULL
+#
+EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(a) OVER () COUNT(a) abs(a)
+NULL 0 NULL
+#
+# Expected result is 1, 0, NULL
+#
+EXPLAIN
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(1) OVER () COUNT(a) abs(a)
+1 0 NULL
+drop table t1;
+#
+# MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
+#
+CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY ) ;
+INSERT INTO t0 VALUES (1),(2),(3);
+SELECT a FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+a
+1
+SELECT a, ROW_NUMBER() OVER v2
+FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+a ROW_NUMBER() OVER v2
+1 1
+drop table t0;
+#
+# MDEV-16230:Server crashes when Analyze format=json is run with a window function with
+# empty PARTITION BY and ORDER BY clauses
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "`row_number() OVER()`",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 3,
+ "r_buffer_size": "REPLACED"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ }
+}
+SELECT row_number() OVER() FROM t1;
+row_number() OVER()
+1
+2
+3
+DROP TABLE t1;
+#
+# MDEV-22984: Throw an error when arguments to window functions are window functions
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+DROP TABLE t1;
+#
+# MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
+#
+CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED);
+INSERT INTO t1 VALUES (1),(2);
+SELECT MIN(d) OVER () FROM t1;
+MIN(d) OVER ()
+1
+1
+DROP TABLE t1;
+#
+# MDEV-22463: Element_type &Bounds_checked_array<Item *>::operator[](size_t) [Element_type = Item *]:
+# Assertion `n < m_size' failed
+#
+CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT, g int, h INT, i INT);
+INSERT INTO t1 SELECT seq,seq,seq,seq, seq,seq,seq,seq,seq FROM seq_1_to_5;
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+ROW_NUMBER() OVER w2
+1
+2
+3
+4
+5
+SELECT a FROM t1 ORDER BY ROW_NUMBER() OVER (PARTITION BY -1,1,0,2,3,4,5,6,7,8);
+a
+1
+2
+3
+4
+5
+SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4);
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+ROW_NUMBER() OVER w2
+1
+2
+3
+4
+5
+DROP TABLE t1;
+#
+# MDEV-18916: crash in Window_spec::print_partition() with decimals
+#
+SELECT cast((rank() over w1) as decimal (53,56));
+ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
+SELECT cast((rank() over w1) as decimal (53,30));
+ERROR HY000: Window specification with name 'w1' is not defined
+#
+# MDEV-15180: server crashed with NTH_VALUE()
+#
+CREATE TABLE t1 (i1 int, a int);
+INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
+CREATE VIEW v1 AS (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) ;
+SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
+NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
+1
+1
+NULL
+NULL
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/r/win_ntile.result b/mysql-test/r/win_ntile.result
index 41cb1a594bf..4d02a230e13 100644
--- a/mysql-test/r/win_ntile.result
+++ b/mysql-test/r/win_ntile.result
@@ -433,3 +433,81 @@ ntile((select a from t1)) over (partition by b order by pk)
from t1;
ERROR 21000: Subquery returns more than 1 row
drop table t1;
+#
+# MDEV-9911 NTILE must return an error when parameter is not stable
+#
+create table t1 (
+pk int primary key,
+c1 nvarchar(10),
+c2 nvarchar(10),
+c3 int
+);
+insert into t1 values
+(1, 'Mark', 'Male', 5),
+(2, 'John', 'Male', 5),
+(3, 'Pam', 'Female', 6),
+(4, 'Sara', 'Female', 6),
+(5, 'Todd', 'Male', 5),
+(6, 'Mary', 'Female', 6),
+(7, 'Ben', 'Male', 5),
+(8, 'Jodi', 'Female', 6),
+(9, 'Tom', 'Male', 5),
+(10, 'Lucky', 'Male', 5),
+(11, 'Mark', 'Male', 5),
+(12, 'John', 'Male', 5),
+(13, 'Pam', 'Female', 6),
+(14, 'Sara', 'Female', 6),
+(15, 'Todd', 'Male', 5),
+(16, 'Mary', 'Female', 6),
+(17, 'Ben', 'Male', 5),
+(18, 'Jodi', 'Female', 6),
+(19, 'Tom', 'Male', 5),
+(20, 'Lucky', 'Male', 5);
+select c1, c2, c3, ntile(6) over (partition by c2 order by pk) from t1;
+c1 c2 c3 ntile(6) over (partition by c2 order by pk)
+Pam Female 6 1
+Sara Female 6 1
+Mary Female 6 2
+Jodi Female 6 2
+Pam Female 6 3
+Sara Female 6 4
+Mary Female 6 5
+Jodi Female 6 6
+Mark Male 5 1
+John Male 5 1
+Todd Male 5 2
+Ben Male 5 2
+Tom Male 5 3
+Lucky Male 5 3
+Mark Male 5 4
+John Male 5 4
+Todd Male 5 5
+Ben Male 5 5
+Tom Male 5 6
+Lucky Male 5 6
+select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
+c1 c2 c3 ntile(c3) over (partition by c2 order by pk)
+Pam Female 6 1
+Sara Female 6 1
+Mary Female 6 2
+Jodi Female 6 2
+Pam Female 6 3
+Sara Female 6 4
+Mary Female 6 5
+Jodi Female 6 6
+Mark Male 5 1
+John Male 5 1
+Todd Male 5 1
+Ben Male 5 2
+Tom Male 5 2
+Lucky Male 5 2
+Mark Male 5 3
+John Male 5 3
+Todd Male 5 4
+Ben Male 5 4
+Tom Male 5 5
+Lucky Male 5 5
+update t1 set c3= 1 where pk = 1;
+select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
+ERROR HY000: Argument of NTILE must be greater than 0
+drop table t1;
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 2cd70c08a94..14abf503b18 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1007,11 +1007,11 @@ Warning 1292 Truncated incorrect INTEGER value: 'string '
Warning 1292 Truncated incorrect INTEGER value: 'string '
DROP PROCEDURE spxml;
select UpdateXML('<a>a</a>',repeat('a b ',1000),'');
-ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b a '
+ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b...'
select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]');
-ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123456'
+ERROR HY000: XPATH error: comparison of two nodesets is not supported: '=@y0123456789_0123456789_0123...'
select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]');
-ERROR HY000: Unknown XPATH variable at: '$y0123456789_0123456789_01234567'
+ERROR HY000: Unknown XPATH variable at: '$y0123456789_0123456789_01234...'
select updatexml(NULL, 1, 1), updatexml(1, NULL, 1), updatexml(1, 1, NULL);
updatexml(NULL, 1, 1) updatexml(1, NULL, 1) updatexml(1, 1, NULL)
NULL NULL NULL
@@ -1110,9 +1110,9 @@ NULL
# Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
#
SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
-ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...' value found during parsing
SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
-ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing
+ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...' value found during parsing
#
# Bug #44332 my_xml_scan reads behind the end of buffer
#
diff --git a/mysql-test/std_data/checkDBI_DBD-mysql.pl b/mysql-test/std_data/checkDBI_DBD-mysql.pl
index 328a7ad774f..0c26325b715 100755
--- a/mysql-test/std_data/checkDBI_DBD-mysql.pl
+++ b/mysql-test/std_data/checkDBI_DBD-mysql.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2011, Oracle and/or its affiliates
#
diff --git a/mysql-test/std_data/mysql57user.MYD b/mysql-test/std_data/mysql57user.MYD
new file mode 100644
index 00000000000..0fe0eef8d2a
--- /dev/null
+++ b/mysql-test/std_data/mysql57user.MYD
Binary files differ
diff --git a/mysql-test/std_data/mysql57user.MYI b/mysql-test/std_data/mysql57user.MYI
new file mode 100644
index 00000000000..16e9fa662a3
--- /dev/null
+++ b/mysql-test/std_data/mysql57user.MYI
Binary files differ
diff --git a/mysql-test/std_data/mysql57user.frm b/mysql-test/std_data/mysql57user.frm
new file mode 100644
index 00000000000..2ae83ceb606
--- /dev/null
+++ b/mysql-test/std_data/mysql57user.frm
Binary files differ
diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result
index bb5d9ff74f1..1f3428e6eef 100644
--- a/mysql-test/suite/binlog/r/binlog_index.result
+++ b/mysql-test/suite/binlog/r/binlog_index.result
@@ -5,6 +5,7 @@ call mtr.add_suppression('Turning logging off for the whole duration of the MySQ
call mtr.add_suppression('Could not open .*');
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;
+SET @saved_dbug = @@SESSION.debug_dbug;
RESET MASTER;
flush logs;
flush logs;
@@ -183,5 +184,5 @@ master-bin.000011
master-bin.000012
master-bin.000013
-SET SESSION debug_dbug="";
+SET @@SESSION.debug_dbug = @saved_dbug;
End of tests
diff --git a/mysql-test/suite/binlog/r/binlog_invalid_read_in_rotate.result b/mysql-test/suite/binlog/r/binlog_invalid_read_in_rotate.result
new file mode 100644
index 00000000000..442fc951289
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_invalid_read_in_rotate.result
@@ -0,0 +1,18 @@
+RESET MASTER;
+call mtr.add_suppression("Error in Log_event::read_log_event*");
+call mtr.add_suppression("Replication event checksum verification failed while reading from a log file*");
+DROP TABLE /*! IF EXISTS*/ t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE `t1` (
+`col_int` int,
+pk integer auto_increment,
+`col_char_12_key` char(12),
+`col_int_key` int,
+`col_char_12` char(12),
+primary key (pk),
+key (`col_char_12_key` ),
+key (`col_int_key` )) ENGINE=InnoDB;
+INSERT /*! IGNORE */ INTO t1 VALUES (183173120, NULL, 'abcd', 1, 'efghijk'), (1, NULL, 'lmno', 2, 'p');
+ALTER TABLE `t1` ENABLE KEYS;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_ioerr.result b/mysql-test/suite/binlog/r/binlog_ioerr.result
index 1d3c3d7d12d..e4f00a017ba 100644
--- a/mysql-test/suite/binlog/r/binlog_ioerr.result
+++ b/mysql-test/suite/binlog/r/binlog_ioerr.result
@@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'");
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
INSERT INTO t1 VALUES(1);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
INSERT INTO t1 VALUES(2);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
-SET SESSION debug_dbug='';
+SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;
a
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 716d887b138..6ce77934ac4 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -339,7 +339,11 @@ a
123.47
999.99
DROP TABLE t1dec102;
-flush logs;
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (POINT(10,10));
+DROP TABLE t1;
+FLUSH LOGS;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -5161,6 +5165,62 @@ SET TIMESTAMP=1000000000/*!*/;
DROP TABLE `t1dec102` /* generated by server */
/*!*/;
# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-321 ddl
+/*!100001 SET @@session.gtid_seq_no=321*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL)
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-322
+/*!100001 SET @@session.gtid_seq_no=322*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (NULL)
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1=NULL /* GEOMETRY meta=4 nullable=1 is_null=1 */
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-323
+/*!100001 SET @@session.gtid_seq_no=323*//*!*/;
+BEGIN
+/*!*/;
+# at #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows:
+#Q> INSERT INTO t1 VALUES (POINT(10,10))
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number #
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
+### INSERT INTO `test`.`t1`
+### SET
+### @1='\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00$@\x00\x00\x00\x00\x00\x00$@' /* GEOMETRY meta=4 nullable=1 is_null=0 */
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+COMMIT
+/*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-324 ddl
+/*!100001 SET @@session.gtid_seq_no=324*//*!*/;
+# at #
+#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0
+SET TIMESTAMP=1000000000/*!*/;
+DROP TABLE `t1` /* generated by server */
+/*!*/;
+# at #
#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ;
# End of log file
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
index 04846efc274..fd0184c2ecc 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
@@ -20,5 +20,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SET @binlog_fragment_0='012345';
BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
ERROR 42000: Incorrect argument type to variable 'binlog_fragment_not_exist'
+SET @a= '42';
+BINLOG @a, @a;
+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
# Cleanup
DROP TABLE t;
diff --git a/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result
new file mode 100644
index 00000000000..349de2f01d0
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result
@@ -0,0 +1,44 @@
+call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0");
+call mtr.add_suppression("Log filename extension number exhausted:.");
+call mtr.add_suppression("Can't generate a unique log-filename");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to generate new file name.");
+call mtr.add_suppression("Could not use master-bin for logging");
+"Test case verifies creation of binary log with max entension value."
+RESET MASTER TO 2147483647;
+show binary logs;
+Log_name File_size
+master-bin.2147483647 #
+FOUND 1 /Next log extension: 2147483647. Remaining log filename extensions: 0./ in mysqld.1.err
+CREATE DATABASE db1;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.2147483647 # Gtid # # GTID #-#-#
+master-bin.2147483647 # Query # # CREATE DATABASE db1
+RESET MASTER TO 2147483648;
+ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
+
+FOUND 1 /Turning logging off for the whole duration of the MySQL server process/ in mysqld.1.err
+"Following CREATE DATABSE db2 command will not be present in binary log"
+"as binary log got closed due to ER_NO_UNIQUE_LOGFILE error."
+CREATE DATABASE db2;
+"RESET MASTER command fails to generate a new binary log"
+"log-bin will be disabled and server needs to be restarted to"
+"re-enable the binary log."
+SHOW BINARY LOGS;
+ERROR HY000: You are not using binary logging
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+SHOW DATABASES LIKE 'db%';
+Database (db%)
+db1
+db2
+include/show_binlog_events.inc
+DROP DATABASE db1;
+DROP DATABASE db2;
+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 # # DROP DATABASE db1
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # DROP DATABASE db2
diff --git a/mysql-test/suite/binlog/r/binlog_recover_checksum_error.result b/mysql-test/suite/binlog/r/binlog_recover_checksum_error.result
new file mode 100644
index 00000000000..f65f7797d7f
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_recover_checksum_error.result
@@ -0,0 +1,7 @@
+set @@global.binlog_checksum = CRC32;
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("Error in Log_event::read_log_event");
+set @@global.debug_dbug = VALUE;
+set @@global.master_verify_checksum = DO_CHECKSUM;
+set @@global.binlog_checksum = BINLOG_CHECKSUM;
+# EOF the test
diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result
index 2104d6b0e51..732ecdd02fd 100644
--- a/mysql-test/suite/binlog/r/binlog_row_annotate.result
+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
@@ -442,7 +442,6 @@ BEGIN
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
@@ -1053,7 +1052,6 @@ BEGIN
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result
new file mode 100644
index 00000000000..c2e634ebe82
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result
@@ -0,0 +1,15 @@
+RESET MASTER;
+call mtr.add_suppression("Error in Log_event::read_log_event*");
+call mtr.add_suppression("Replication event checksum verification failed while reading from a log file*");
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+CREATE TABLE t1 (c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+UPDATE t1 SET c1=repeat('b',255);
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+SHOW BINLOG EVENTS FROM POS;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Invalid pos specified. Requested from pos:POS is greater than actual file size:MAX_POS
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/r/binlog_write_error.result b/mysql-test/suite/binlog/r/binlog_write_error.result
index 2606a9f40b3..6e8a212035a 100644
--- a/mysql-test/suite/binlog/r/binlog_write_error.result
+++ b/mysql-test/suite/binlog/r/binlog_write_error.result
@@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2;
#
# Test injecting binlog write error when executing queries
#
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
INSERT INTO t1 VALUES (1),(2),(3);
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
INSERT INTO t1 VALUES (4),(5),(6);
INSERT INTO t1 VALUES (4),(5),(6);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
UPDATE t1 set a=a+1;
UPDATE t1 set a=a+1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DELETE FROM t1;
DELETE FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TRIGGER tr1;
DROP TRIGGER tr1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
ALTER TABLE t1 ADD (b INT);
ALTER TABLE t1 ADD (b INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE VIEW v1 AS SELECT a FROM t1;
CREATE VIEW v1 AS SELECT a FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP VIEW v1;
DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP PROCEDURE p1;
DROP PROCEDURE p1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TABLE t1;
DROP TABLE t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE FUNCTION f1() RETURNS INT return 1;
CREATE FUNCTION f1() RETURNS INT return 1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP FUNCTION f1;
DROP FUNCTION f1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE USER user1;
CREATE USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
#
# Cleanup
#
diff --git a/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.combinations b/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.combinations
new file mode 100644
index 00000000000..72076e12d48
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.combinations
@@ -0,0 +1,5 @@
+[enable_checksum]
+binlog_checksum=1
+
+[disable_checksum]
+binlog_checksum=0
diff --git a/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.test b/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.test
new file mode 100644
index 00000000000..36bb56c8342
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_invalid_read_in_rotate.test
@@ -0,0 +1,48 @@
+# ==== Purpose ====
+#
+# Test verifies that reading binary log by using "SHOW BINLOG EVENTS" command
+# from various random positions doesn't lead to crash. It should exit
+# gracefully with appropriate error.
+#
+# ==== References ====
+#
+# MDEV-18046:Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events
+
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+
+RESET MASTER;
+
+call mtr.add_suppression("Error in Log_event::read_log_event*");
+call mtr.add_suppression("Replication event checksum verification failed while reading from a log file*");
+
+DROP TABLE /*! IF EXISTS*/ t1;
+CREATE TABLE `t1` (
+`col_int` int,
+pk integer auto_increment,
+`col_char_12_key` char(12),
+`col_int_key` int,
+`col_char_12` char(12),
+primary key (pk),
+key (`col_char_12_key` ),
+key (`col_int_key` )) ENGINE=InnoDB;
+
+INSERT /*! IGNORE */ INTO t1 VALUES (183173120, NULL, 'abcd', 1, 'efghijk'), (1, NULL, 'lmno', 2, 'p');
+
+--disable_warnings
+ALTER TABLE `t1` ENABLE KEYS;
+--enable_warnings
+
+--let $max_pos= query_get_value(SHOW MASTER STATUS,Position,1)
+--let $pos= 1
+while ($pos <= $max_pos)
+{
+ --disable_query_log
+ --disable_result_log
+ --error 0,1220
+ eval SHOW BINLOG EVENTS FROM $pos;
+ --inc $pos
+ --enable_result_log
+ --enable_query_log
+}
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/binlog_max_extension.test b/mysql-test/suite/binlog/t/binlog_max_extension.test
index 199a31ea05c..81e357448f6 100644
--- a/mysql-test/suite/binlog/t/binlog_max_extension.test
+++ b/mysql-test/suite/binlog/t/binlog_max_extension.test
@@ -41,7 +41,7 @@ RESET MASTER;
# 1. Stop master server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server 10
+-- shutdown_server
-- source include/wait_until_disconnected.inc
# 2. Prepare log and index file
@@ -70,7 +70,7 @@ FLUSH LOGS;
# 1. Stop the server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- shutdown_server 10
+-- shutdown_server
-- source include/wait_until_disconnected.inc
# 2. Undo changes to index and log files
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
index 90ea96dd64d..65a043b1445 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
@@ -450,7 +450,19 @@ INSERT INTO t1dec102 VALUES (999.99);
SELECT * FROM t1dec102 ORDER BY a;
DROP TABLE t1dec102;
-flush logs;
+
+#
+# MDEV-22330: mysqlbinlog stops with an error Don't know how to handle column
+# type: 255 meta: 4 (0004)
+# Check support for GEOMETRY type with verbose mode.
+#
+CREATE TABLE t1 (a GEOMETRY DEFAULT NULL);
+
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (POINT(10,10));
+DROP TABLE t1;
+
+FLUSH LOGS;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
index 2d55aa79d48..9f79deea3db 100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
@@ -11,8 +11,7 @@ SELECT a from t into @a;
FLUSH LOGS;
DELETE FROM t;
-# Todo: MDEV-10362 to test multi-row Rows_log_event:s in verbose mode
---exec $MYSQL_BINLOG -vv --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+--exec $MYSQL_BINLOG --verbose --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--let SEARCH_PATTERN= BINLOG @binlog_fragment_0, @binlog_fragment_1
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
@@ -41,6 +40,11 @@ SET @binlog_fragment_0='012345';
--error ER_WRONG_TYPE_FOR_VAR
BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+# MDEV-22520
+SET @a= '42';
+--error ER_SYNTAX_ERROR
+BINLOG @a, @a;
+
--echo # Cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
DROP TABLE t;
diff --git a/mysql-test/suite/binlog/t/binlog_no_uniqfile_crash.test b/mysql-test/suite/binlog/t/binlog_no_uniqfile_crash.test
new file mode 100644
index 00000000000..2a685a786c5
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_no_uniqfile_crash.test
@@ -0,0 +1,83 @@
+# ==== Purpose ====
+#
+# Test verifies that when RESET MASTER TO # command is supplied with binlog
+# extension number greater than 2147483647 the command should report
+# appropriate error and binary log should be disabled. It should not result in
+# a crash.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Verify case with max binary log extension. Max value is '2147483647'
+# 1 - Confirm that SHOW BINARY LOGS displays a binary log with '2147483647'
+# 2 - Verify that events are successfully written into max extension file.
+# 3 - Try to create a binary log with extension greater than max allowed
+# value '2147483648', verify ER_NO_UNIQUE_LOGFILE error is reported.
+# 4 - Execute CREATE DATABASE db2 statement and verify server dosn't crash.
+# 5 - Execute SHOW BINARY LOG command and verify that it reports
+# ER_NO_BINARY_LOGGING error.
+# 6 - Restart the server and verify that databse 'db2' exists and it it not
+# present in the binary log.
+#
+# ==== References ====
+#
+# MDEV-22451: SIGSEGV in __memmove_avx_unaligned_erms/memcpy from
+# _my_b_write on CREATE after RESET MASTER
+#
+--source include/have_log_bin.inc
+
+call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0");
+call mtr.add_suppression("Log filename extension number exhausted:.");
+call mtr.add_suppression("Can't generate a unique log-filename");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to generate new file name.");
+call mtr.add_suppression("Could not use master-bin for logging");
+
+
+--echo "Test case verifies creation of binary log with max entension value."
+RESET MASTER TO 2147483647;
+--source include/show_binary_logs.inc
+
+# Check error log for correct messages.
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!$log_error_)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+
+--let SEARCH_FILE=$log_error_
+--let SEARCH_PATTERN=Next log extension: 2147483647. Remaining log filename extensions: 0.
+--source include/search_pattern_in_file.inc
+
+CREATE DATABASE db1;
+--source include/show_binlog_events.inc
+
+--error ER_NO_UNIQUE_LOGFILE
+RESET MASTER TO 2147483648;
+
+--let SEARCH_FILE=$log_error_
+--let SEARCH_PATTERN=Turning logging off for the whole duration of the MySQL server process
+--source include/search_pattern_in_file.inc
+
+--echo "Following CREATE DATABSE db2 command will not be present in binary log"
+--echo "as binary log got closed due to ER_NO_UNIQUE_LOGFILE error."
+CREATE DATABASE db2;
+
+
+--echo "RESET MASTER command fails to generate a new binary log"
+--echo "log-bin will be disabled and server needs to be restarted to"
+--echo "re-enable the binary log."
+--error ER_NO_BINARY_LOGGING
+SHOW BINARY LOGS;
+
+--source include/restart_mysqld.inc
+
+--source include/show_binary_logs.inc
+SHOW DATABASES LIKE 'db%';
+--source include/show_binlog_events.inc
+
+# Cleanup
+DROP DATABASE db1;
+DROP DATABASE db2;
+--source include/show_binlog_events.inc
diff --git a/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test b/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test
new file mode 100644
index 00000000000..12c9f3d914f
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_recover_checksum_error.test
@@ -0,0 +1,37 @@
+# The test verifies server binlog-based recovery.
+#
+# MDEV-23832 checksum error at server binlog recovery should not crash
+
+# The test logic really requires --log-bin.
+--source include/have_binlog_format_mixed.inc
+--source include/have_debug.inc
+
+--let $do_checksum = `SELECT @@global.master_verify_checksum`
+--let $debug_dbug_saved = `SELECT @@global.debug_dbug`
+--let $binlog_checksum = `SELECT @@global.binlog_checksum`
+set @@global.binlog_checksum = CRC32;
+
+call mtr.add_suppression("Replication event checksum verification failed");
+call mtr.add_suppression("Error in Log_event::read_log_event");
+
+# Proof of no crash follows.
+# There's no need for actual bin-loggable queries to the server
+--let $restart_parameters= --master_verify_checksum=ON --debug_dbug="+d,corrupt_read_log_event_char"
+--let $shutdown_timeout=0
+--source include/restart_mysqld.inc
+--let $restart_parameters=
+--let $shutdown_timeout=
+
+#
+# Cleanup
+
+--replace_regex /= .*/= VALUE/
+--eval set @@global.debug_dbug = "$debug_dbug_saved"
+
+--replace_result $do_checksum DO_CHECKSUM
+--eval set @@global.master_verify_checksum = $do_checksum
+--replace_result $binlog_checksum BINLOG_CHECKSUM
+--eval set @@global.binlog_checksum = $binlog_checksum
+#
+--echo # EOF the test
+#
diff --git a/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.combinations b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.combinations
new file mode 100644
index 00000000000..72076e12d48
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.combinations
@@ -0,0 +1,5 @@
+[enable_checksum]
+binlog_checksum=1
+
+[disable_checksum]
+binlog_checksum=0
diff --git a/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test
new file mode 100644
index 00000000000..05e6967c538
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test
@@ -0,0 +1,42 @@
+# ==== Purpose ====
+#
+# Test verifies that reading binary log by using "SHOW BINLOG EVENTS" command
+# from various random positions doesn't lead to crash. It should exit
+# gracefully with appropriate error.
+#
+# ==== References ====
+#
+# MDEV-18046:Assortment of crashes, assertion failures and ASAN errors in mysql_show_binlog_events
+
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+
+RESET MASTER;
+call mtr.add_suppression("Error in Log_event::read_log_event*");
+call mtr.add_suppression("Replication event checksum verification failed while reading from a log file*");
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255));
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+UPDATE t1 SET c1=repeat('b',255);
+INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
+--let $max_pos= query_get_value(SHOW MASTER STATUS,Position,1)
+--let $pos= 1
+while ($pos <= $max_pos)
+{
+ --disable_query_log
+ --disable_result_log
+ --error 0,1220
+ eval SHOW BINLOG EVENTS FROM $pos LIMIT 100;
+ --inc $pos
+ --enable_result_log
+ --enable_query_log
+}
+
+# Testing a case where input position is greater than actual binlog file size.
+--replace_result $pos POS $max_pos MAX_POS
+--error 1220
+eval SHOW BINLOG EVENTS FROM $pos;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog_encryption/binlog_index.result b/mysql-test/suite/binlog_encryption/binlog_index.result
index bb5d9ff74f1..1f3428e6eef 100644
--- a/mysql-test/suite/binlog_encryption/binlog_index.result
+++ b/mysql-test/suite/binlog_encryption/binlog_index.result
@@ -5,6 +5,7 @@ call mtr.add_suppression('Turning logging off for the whole duration of the MySQ
call mtr.add_suppression('Could not open .*');
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;
+SET @saved_dbug = @@SESSION.debug_dbug;
RESET MASTER;
flush logs;
flush logs;
@@ -183,5 +184,5 @@ master-bin.000011
master-bin.000012
master-bin.000013
-SET SESSION debug_dbug="";
+SET @@SESSION.debug_dbug = @saved_dbug;
End of tests
diff --git a/mysql-test/suite/binlog_encryption/binlog_ioerr.result b/mysql-test/suite/binlog_encryption/binlog_ioerr.result
index 6b3120b6d89..2823b7050c3 100644
--- a/mysql-test/suite/binlog_encryption/binlog_ioerr.result
+++ b/mysql-test/suite/binlog_encryption/binlog_ioerr.result
@@ -2,12 +2,13 @@ CALL mtr.add_suppression("Error writing file 'master-bin'");
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
INSERT INTO t1 VALUES(0);
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug='+d,fail_binlog_write_1';
INSERT INTO t1 VALUES(1);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
INSERT INTO t1 VALUES(2);
ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device")
-SET SESSION debug_dbug='';
+SET SESSION debug_dbug=@saved_dbug;
INSERT INTO t1 VALUES(3);
SELECT * FROM t1;
a
diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result
index 9b843dc8a6b..83903ecc18a 100644
--- a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result
+++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result
@@ -449,7 +449,6 @@ BEGIN
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.result b/mysql-test/suite/binlog_encryption/binlog_write_error.result
index 2606a9f40b3..6e8a212035a 100644
--- a/mysql-test/suite/binlog_encryption/binlog_write_error.result
+++ b/mysql-test/suite/binlog_encryption/binlog_write_error.result
@@ -12,92 +12,109 @@ DROP VIEW IF EXISTS v1, v2;
#
# Test injecting binlog write error when executing queries
#
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
INSERT INTO t1 VALUES (1),(2),(3);
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
INSERT INTO t1 VALUES (4),(5),(6);
INSERT INTO t1 VALUES (4),(5),(6);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
UPDATE t1 set a=a+1;
UPDATE t1 set a=a+1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DELETE FROM t1;
DELETE FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TRIGGER tr1;
DROP TRIGGER tr1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
ALTER TABLE t1 ADD (b INT);
ALTER TABLE t1 ADD (b INT);
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE VIEW v1 AS SELECT a FROM t1;
CREATE VIEW v1 AS SELECT a FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP VIEW v1;
DROP VIEW v1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
CREATE PROCEDURE p1(OUT rows_cnt INT) SELECT count(*) INTO rows_cnt FROM t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP PROCEDURE p1;
DROP PROCEDURE p1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP TABLE t1;
DROP TABLE t1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE FUNCTION f1() RETURNS INT return 1;
CREATE FUNCTION f1() RETURNS INT return 1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP FUNCTION f1;
DROP FUNCTION f1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
CREATE USER user1;
CREATE USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug='d,injecting_fault_writing';
DROP USER user1;
DROP USER user1;
ERROR HY000: Error writing file 'master-bin' ((errno: #)
-SET GLOBAL debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
#
# Cleanup
#
diff --git a/mysql-test/suite/binlog_encryption/restart_server.inc b/mysql-test/suite/binlog_encryption/restart_server.inc
index 6cd0788cf43..8f0fe7d8970 100644
--- a/mysql-test/suite/binlog_encryption/restart_server.inc
+++ b/mysql-test/suite/binlog_encryption/restart_server.inc
@@ -22,7 +22,7 @@
--enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
-shutdown_server 10;
+shutdown_server;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result
index 06be72d523b..eb4e45ad28e 100644
--- a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result
+++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result
@@ -9,6 +9,7 @@ connection master;
call mtr.add_suppression("Can't generate a unique log-filename");
call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
call mtr.add_suppression("Error writing file .*");
+call mtr.add_suppression("Could not use master-bin for logging");
SET @old_debug= @@global.debug_dbug;
SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data';
SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data';
@@ -22,7 +23,7 @@ master-bin.000001 #
master-bin.000002 #
###################### TEST #2
RESET MASTER;
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
FLUSH LOGS;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@@ -30,7 +31,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
show binary logs;
Log_name File_size
master-bin.000001 #
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
###################### TEST #3
CREATE TABLE t1 (a INT);
@@ -44,11 +45,11 @@ show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #4
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@@ -56,21 +57,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
SELECT count(*) FROM t2;
count(*)
1
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #5
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2;
# assert: must show one entry
SELECT count(*) FROM t2;
count(*)
1
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #6
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse');
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@@ -83,11 +84,11 @@ SELECT count(*) FROM t2;
count(*)
3
SET AUTOCOMMIT= 1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #7
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET @@binlog_annotate_row_events= 0;
SELECT count(*) FROM t4;
count(*)
@@ -100,14 +101,14 @@ SELECT count(*) FROM t4;
count(*)
1
### check that the incident event is written to the current log
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Incident # # #1 (LOST_EVENTS)
DELETE FROM t4;
RESET MASTER;
###################### TEST #8
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
# must show 0 entries
SELECT count(*) FROM t4;
count(*)
@@ -147,9 +148,9 @@ count(*)
SELECT count(*) FROM t2;
count(*)
0
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
###################### TEST #9
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@@ -170,17 +171,17 @@ SELECT count(*) FROM t4;
count(*)
0
SET SQL_LOG_BIN=1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
###################### TEST #10
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not open .*");
RESET MASTER;
SHOW WARNINGS;
Level Code Message
-SET GLOBAL debug_dbug="+d,fault_injection_registering_index";
+SET @@global.debug_dbug="d,fault_injection_registering_index";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging
CREATE TABLE t5 (a INT);
@@ -192,10 +193,10 @@ DROP TABLE t5;
flush tables;
###################### TEST #11
include/rpl_restart_server.inc [server_number=1]
-SET GLOBAL debug_dbug="+d,fault_injection_openning_index";
+SET @@global.debug_dbug="d,fault_injection_openning_index";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT);
@@ -207,10 +208,10 @@ DROP TABLE t5;
flush tables;
include/rpl_restart_server.inc [server_number=1]
###################### TEST #12
-SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event";
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT);
@@ -237,44 +238,40 @@ call mtr.add_suppression("Could not open .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,error_unique_log_filename";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #14
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event";
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #15
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_registering_index";
+SET @@global.debug_dbug="d,fault_injection_registering_index";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_registering_index";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #16
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_openning_index";
+SET @@global.debug_dbug="d,fault_injection_openning_index";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_openning_index";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
include/stop_slave_sql.inc
Warnings:
diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result
index 41c4cd94aff..22220b8e9fb 100644
--- a/mysql-test/suite/binlog_encryption/rpl_checksum.result
+++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result
@@ -76,6 +76,7 @@ connection master;
set @@global.binlog_checksum = CRC32;
insert into t1 values (1) /* will not be applied on slave due to simulation */;
connection slave;
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
@@ -83,15 +84,16 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary
select count(*) as zero from t1;
zero
0
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
connection slave;
include/start_slave.inc
connection master;
set @@global.master_verify_checksum = 1;
+set @save_dbug = @@session.debug_dbug;
set @@session.debug_dbug='d,simulate_checksum_test_failure';
show binlog events;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
-set @@session.debug_dbug='';
+SET debug_dbug= @save_dbug;
set @@global.master_verify_checksum = default;
connection slave;
connection slave;
@@ -99,10 +101,11 @@ include/stop_slave.inc
connection master;
create table t2 (a int);
connection slave;
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave io_thread;
include/wait_for_slave_io_error.inc [errno=1595,1913]
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
start slave io_thread;
include/wait_for_slave_param.inc [Read_Master_Log_Pos]
set @@global.slave_sql_verify_checksum = 1;
@@ -110,7 +113,7 @@ set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave sql_thread;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4'
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result
index 25a82fd60cd..73bb373d6be 100644
--- a/mysql-test/suite/binlog_encryption/rpl_corruption.result
+++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result
@@ -13,40 +13,40 @@ connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
include/stop_slave.inc
# 2. Corruption in master binlog and SHOW BINLOG EVENTS
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @saved_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
+SET @@global.debug_dbug=@saved_dbug;
# 3. Master read a corrupted event from binlog and send the error to slave
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236]
connection master;
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug=@saved_dbug;
# 4. Master read a corrupted event from binlog and send it to slave
connection master;
SET GLOBAL master_verify_checksum=0;
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743]
connection master;
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network
connection slave;
-SET GLOBAL debug_dbug="+d,corrupt_queue_event";
+SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743]
-SET GLOBAL debug_dbug="-d,corrupt_queue_event";
+SET @@global.debug_dbug=@saved_dbug_slave;
# 6. Slave. Corruption in relay log
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1593]
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug_slave;
# 7. Seek diff for tables on master and slave
connection slave;
include/start_slave.inc
@@ -55,9 +55,8 @@ connection slave;
include/diff_tables.inc [master:test.t1, slave:test.t1]
# 8. Clean up
connection master;
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
DROP TABLE t1;
connection slave;
-SET GLOBAL debug_dbug= "";
include/rpl_end.inc
diff --git a/mysql-test/suite/binlog_encryption/rpl_incident.result b/mysql-test/suite/binlog_encryption/rpl_incident.result
index 8fb4aa907cc..6dbe4417c5a 100644
--- a/mysql-test/suite/binlog_encryption/rpl_incident.result
+++ b/mysql-test/suite/binlog_encryption/rpl_incident.result
@@ -14,6 +14,7 @@ a
1
2
3
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
@@ -22,6 +23,7 @@ a
2
3
4
+set @@global.debug_dbug = @saved_dbug;
connection slave;
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
include/wait_for_slave_sql_error.inc [errno=1590]
diff --git a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result
index 91742814b4c..fc23734c645 100644
--- a/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result
+++ b/mysql-test/suite/binlog_encryption/rpl_init_slave_errors.result
@@ -4,12 +4,13 @@ connection slave;
stop slave;
reset slave;
connection slave;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Failed during slave thread initialization'
call mtr.add_suppression("Failed during slave.* thread initialization");
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
connection slave;
reset slave;
SET GLOBAL init_slave= "garbage";
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result
index 20f3facea27..12e5455c6c1 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result
@@ -1513,7 +1513,7 @@ SET GLOBAL slave_parallel_threads=10;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10000;
ANALYZE TABLE t2;
@@ -1522,7 +1522,7 @@ test.t2 analyze status OK
INSERT INTO t3 VALUES (120, 0);
SET @commit_id= 10001;
INSERT INTO t3 VALUES (121, 0);
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
a b
120 0
@@ -1544,7 +1544,7 @@ include/stop_slave.inc
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @old_server_id= @@SESSION.server_id;
SET SESSION server_id= 100;
@@ -1554,7 +1554,7 @@ SET SESSION server_id= @old_server_id;
INSERT INTO t3 VALUES (130, 0);
SET @commit_id= 10011;
INSERT INTO t3 VALUES (131, 0);
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
a b
130 0
@@ -1580,7 +1580,7 @@ include/stop_slave.inc
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_mdev8031';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10200;
INSERT INTO t3 VALUES (203, 1);
@@ -1601,7 +1601,7 @@ UPDATE t3 SET b=b+1 WHERE a=204;
UPDATE t3 SET b=b+1 WHERE a=203;
UPDATE t3 SET b=b+1 WHERE a=205;
UPDATE t3 SET b=b+1 WHERE a=205;
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
a b
201 3
@@ -1631,11 +1631,11 @@ SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill';
SET @old_max= @@GLOBAL.max_relay_log_size;
SET GLOBAL max_relay_log_size= 4096;
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10210;
Omit long queries that cause relaylog rotations and transaction retries...
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
a b
201 6
@@ -1655,7 +1655,7 @@ a b
204 7
205 5
include/stop_slave.inc
-SET GLOBAL debug_dbug= @old_debg;
+SET GLOBAL debug_dbug= @old_dbug;
SET GLOBAL max_relay_log_size= @old_max;
include/start_slave.inc
*** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
index 570d2534ed7..3dd5a3ea83c 100644
--- a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result
@@ -4,7 +4,7 @@ connection server_2;
include/stop_slave.inc
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL slave_parallel_mode='optimistic';
SET GLOBAL slave_parallel_threads= 3;
CHANGE MASTER TO master_use_gtid=slave_pos;
diff --git a/mysql-test/suite/encryption/r/create_or_replace.result b/mysql-test/suite/encryption/r/create_or_replace.result
index 1671043b50d..69ea113289b 100644
--- a/mysql-test/suite/encryption/r/create_or_replace.result
+++ b/mysql-test/suite/encryption/r/create_or_replace.result
@@ -1,8 +1,5 @@
+SET @save_threads = @@GLOBAL.innodb_encryption_threads;
SET default_storage_engine = InnoDB;
-CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
-CREATE TABLE t2 AS SELECT * FROM t1;
-drop table t1,t2;
-SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
@@ -14,13 +11,9 @@ INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 )
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
connect con1,localhost,root,,test;
connect con2,localhost,root,,test;
-connection default;
-drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
disconnect con1;
disconnect con2;
-SET GLOBAL innodb_encrypt_tables = OFF;
-SET GLOBAL innodb_encryption_threads = 4;
-# Wait max 10 min for key encryption threads to decrypt all spaces
-# Success!
-SET GLOBAL innodb_encryption_threads = 0;
-SET GLOBAL innodb_encrypt_tables = OFF;
+connection default;
+drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
+table10_int_autoinc;
+SET GLOBAL innodb_encryption_threads = @save_threads;
diff --git a/mysql-test/suite/encryption/r/create_or_replace_big.result b/mysql-test/suite/encryption/r/create_or_replace_big.result
new file mode 100644
index 00000000000..87f56cc3e2c
--- /dev/null
+++ b/mysql-test/suite/encryption/r/create_or_replace_big.result
@@ -0,0 +1,19 @@
+SET default_storage_engine = InnoDB;
+CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
+CREATE TABLE t2 AS SELECT * FROM t1;
+drop table t1,t2;
+SET GLOBAL innodb_encryption_threads = 0;
+SET GLOBAL innodb_encryption_threads = 4;
+CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
+INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
+CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
+CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
+INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL);
+INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
+INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
+INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
+# Wait max 10 min for key encryption threads to decrypt all spaces
+# Success!
+SET GLOBAL innodb_encryption_threads = 0;
+SET GLOBAL innodb_encrypt_tables = OFF;
+DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
index 808345ab4ca..e8e88a1e41f 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result
@@ -41,6 +41,14 @@ call innodb_insert_proc(2000);
insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
commit;
+FLUSH TABLES innodb_compact FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT;
+UNLOCK TABLES;
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
+variable_value > 0
+1
set global innodb_compression_algorithm = 1;
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;
@@ -63,6 +71,16 @@ innodb_dynamic CREATE TABLE `innodb_dynamic` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+FLUSH TABLES innodb_normal FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT;
+UNLOCK TABLES;
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
+variable_value > 0
+1
drop procedure innodb_insert_proc;
drop table innodb_normal;
drop table innodb_compact;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
index 189be75b83f..a550b6b01b3 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result
@@ -37,40 +37,43 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT `encrypted`=yes `encryption_key_id`=4
-create procedure innodb_insert_proc (repeat_count int)
-begin
-declare current_num int;
-set current_num = 0;
-while current_num < repeat_count do
-insert into innodb_normal values(current_num, substring(MD5(RAND()), -64));
-set current_num = current_num + 1;
-end while;
-end//
-commit;
-begin;
-call innodb_insert_proc(2000);
-insert into innodb_compact select * from innodb_normal;
-insert into innodb_compressed select * from innodb_normal;
-insert into innodb_dynamic select * from innodb_normal;
-insert into innodb_redundant select * from innodb_normal;
-commit;
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-variable_value > 0
-1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-variable_value >= 0
-1
-update innodb_normal set c1 = c1 +1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_compressed set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-update innodb_redundant set c1 = c1 + 1;
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-variable_value > 0
-1
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+FLUSH TABLES innodb_normal FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT;
+UNLOCK TABLES;
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
variable_value > 0
1
+BEGIN;
+INSERT INTO innodb_normal SET c1 = 1;
+INSERT INTO innodb_compact SET c1 = 1;
+INSERT INTO innodb_compressed SET c1 = 1;
+INSERT INTO innodb_dynamic SET c1 = 1;
+INSERT INTO innodb_redundant SET c1 = 1;
+COMMIT;
+FLUSH TABLES innodb_normal FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT;
+UNLOCK TABLES;
+select variable_name from information_schema.global_status
+where variable_value > 0 and variable_name
+IN ('INNODB_NUM_PAGES_ENCRYPTED','INNODB_NUM_PAGES_DECRYPTED');
+variable_name
+INNODB_NUM_PAGES_ENCRYPTED
+INNODB_NUM_PAGES_DECRYPTED
SET GLOBAL innodb_encrypt_tables=OFF;
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_compact;
@@ -100,13 +103,16 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`c1` bigint(20) NOT NULL,
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-variable_value >= 0
-1
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
-variable_value >= 0
-1
-drop procedure innodb_insert_proc;
+FLUSH TABLES innodb_normal FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT;
+UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT;
+UNLOCK TABLES;
drop table innodb_normal;
drop table innodb_compact;
drop table innodb_compressed;
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
index b999e8cb34a..cd37330f2b0 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
@@ -7,7 +7,7 @@
#
SET GLOBAL innodb_log_checksums=0;
Warnings:
-Warning 138 innodb_encrypt_log implies innodb_log_checksums
+Warning 138 innodb_log_checksums is deprecated and has no effect outside recovery
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result b/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
index 9a291ae1354..541680ae862 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_temporary_tables.result
@@ -9,6 +9,9 @@ INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
COUNT(*)
8192
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
new file mode 100644
index 00000000000..1856c30a36b
--- /dev/null
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -0,0 +1,3896 @@
+#
+# Tests when the temporary files are encrypted
+#
+select @@encrypt_tmp_files;
+@@encrypt_tmp_files
+1
+drop table if exists t1,t2;
+drop view if exists v1;
+# ########################################################################
+# # Parser tests
+# ########################################################################
+#
+# Check what happens when one attempts to use window function without OVER clause
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2);
+select row_number() 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 'from t1' at line 1
+select rank() 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 'from t1' at line 1
+# Attempt to use window function in the WHERE clause
+select * from t1 where 1=rank() over (order by a);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select * from t1 where 1>row_number() over (partition by b order by a);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+drop table t1;
+# ########################################################################
+# # Functionality tests
+# ########################################################################
+#
+# Check if ROW_NUMBER() works in basic cases
+create table t1(a int, b int, x char(32));
+insert into t1 values (2, 10, 'xx');
+insert into t1 values (2, 10, 'zz');
+insert into t1 values (2, 20, 'yy');
+insert into t1 values (3, 10, 'xxx');
+insert into t1 values (3, 20, 'vvv');
+select a, row_number() over (partition by a order by b) from t1;
+a row_number() over (partition by a order by b)
+2 1
+2 2
+2 3
+3 1
+3 2
+select a, b, x, row_number() over (partition by a order by x) from t1;
+a b x row_number() over (partition by a order by x)
+2 10 xx 1
+2 20 yy 2
+2 10 zz 3
+3 20 vvv 1
+3 10 xxx 2
+drop table t1;
+create table t1 (pk int primary key, a int, b int);
+insert into t1 values
+(1, 10, 22),
+(2, 11, 21),
+(3, 12, 20),
+(4, 13, 19),
+(5, 14, 18);
+select
+pk, a, b,
+row_number() over (order by a),
+row_number() over (order by b)
+from t1
+order by b;
+pk a b row_number() over (order by a) row_number() over (order by b)
+5 14 18 5 1
+4 13 19 4 2
+3 12 20 3 3
+2 11 21 2 4
+1 10 22 1 5
+drop table t1;
+#
+# Try RANK() function
+#
+create table t2 (
+pk int primary key,
+a int
+);
+insert into t2 values
+( 1 , 0),
+( 2 , 0),
+( 3 , 1),
+( 4 , 1),
+( 8 , 2),
+( 5 , 2),
+( 6 , 2),
+( 7 , 2),
+( 9 , 4),
+(10 , 4);
+select pk, a, rank() over (order by a) from t2;
+pk a rank() over (order by a)
+1 0 1
+10 4 9
+2 0 1
+3 1 3
+4 1 3
+5 2 5
+6 2 5
+7 2 5
+8 2 5
+9 4 9
+select pk, a, rank() over (order by a desc) from t2;
+pk a rank() over (order by a desc)
+1 0 9
+10 4 1
+2 0 9
+3 1 7
+4 1 7
+5 2 3
+6 2 3
+7 2 3
+8 2 3
+9 4 1
+drop table t2;
+#
+# Try Aggregates as window functions. With frames.
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (pk int, c int);
+insert into t1 select a+1,1 from t0;
+update t1 set c=2 where pk not in (1,2,3,4);
+select * from t1;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 2 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 3
+2 1 4
+3 1 3
+4 1 2
+5 2 3
+6 2 4
+7 2 4
+8 2 4
+9 2 3
+10 2 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between 2 preceding and current row) as CNT
+from t1;
+pk c CNT
+1 1 1
+2 1 2
+3 1 3
+4 1 3
+5 2 1
+6 2 2
+7 2 3
+8 2 3
+9 2 3
+10 2 3
+select
+pk,c,
+count(*) over (partition by c order by pk rows
+between 1 following and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 2
+2 1 2
+3 1 1
+4 1 0
+5 2 2
+6 2 2
+7 2 2
+8 2 2
+9 2 1
+10 2 0
+select
+pk,c,
+count(*) over (partition by c order by pk rows
+between 2 preceding and 1 preceding) as CNT
+from t1;
+pk c CNT
+1 1 0
+2 1 1
+3 1 2
+4 1 2
+5 2 0
+6 2 1
+7 2 2
+8 2 2
+9 2 2
+10 2 2
+select
+pk, c,
+count(*) over (partition by c order by pk
+rows between current row and 1 following) as CNT
+from t1;
+pk c CNT
+1 1 2
+2 1 2
+3 1 2
+4 1 1
+5 2 2
+6 2 2
+7 2 2
+8 2 2
+9 2 2
+10 2 1
+# Check ORDER BY DESC
+select
+pk, c,
+count(*) over (partition by c order by pk desc
+rows between 2 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+4 1 3
+3 1 4
+2 1 4
+1 1 3
+10 2 3
+9 2 4
+8 2 5
+7 2 5
+6 2 4
+5 2 3
+drop table t0,t1;
+#
+# Resolution of window names
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (pk int, c int);
+insert into t1 select a+1,1 from t0;
+update t1 set c=2 where pk not in (1,2,3,4);
+select * from t1;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select
+pk, c,
+count(*) over w1 as CNT
+from t1
+window w1 as (partition by c order by pk
+rows between 2 preceding and 2 following);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over (w1 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c order by pk);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over (w1 order by pk rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over (w2 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c), w2 as (w1 order by pk);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over w3 as CNT
+from t1
+window
+w1 as (partition by c),
+w2 as (w1 order by pk),
+w3 as (w2 rows between 2 preceding and 2 following);
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+select
+pk, c,
+count(*) over w as CNT
+from t1
+window w1 as (partition by c order by pk
+rows between 2 preceding and 2 following);
+ERROR HY000: Window specification with name 'w' is not defined
+select
+pk, c,
+count(*) over (w2 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c), w1 as (order by pk);
+ERROR HY000: Multiple window specifications with the same name 'w1'
+select
+pk, c,
+count(*) over (w2 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c), w2 as (w partition by c order by pk);
+ERROR HY000: Window specification with name 'w' is not defined
+select
+pk, c,
+count(*) over (w2 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c), w2 as (w1 partition by c order by pk);
+ERROR HY000: Window specification referencing another one 'w1' cannot contain partition list
+select
+pk, c,
+count(*) over (w2 rows between 2 preceding and 2 following) as CNT
+from t1
+window w1 as (partition by c order by pk), w2 as (w1 order by pk);
+ERROR HY000: Referenced window specification 'w1' already contains order list
+select
+pk, c,
+count(*) over w3 as CNT
+from t1
+window
+w1 as (partition by c),
+w2 as (w1 order by pk rows between 3 preceding and 2 following),
+w3 as (w2 rows between 2 preceding and 2 following);
+ERROR HY000: Referenced window specification 'w2' cannot contain window frame
+select
+pk, c,
+count(*) over w1 as CNT
+from t1
+window w1 as (partition by c order by pk
+rows between unbounded following and 2 following);
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select
+pk, c,
+count(*) over (w1 rows between 2 preceding and unbounded preceding) as CNT
+from t1
+window w1 as (partition by c order by pk);
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select
+pk, c,
+count(*) over (w1 order by pk rows between current row and 2 preceding) as CNT
+from t1
+window w1 as (partition by c);
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select
+pk, c,
+count(*) over (w2 rows between 2 following and current row) as CNT
+from t1
+window w1 as (partition by c), w2 as (w1 order by pk);
+ERROR HY000: Unacceptable combination of window frame bound specifications
+select
+pk, c
+from t1 where rank() over w1 > 2
+window w1 as (partition by c order by pk);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m
+from t1
+group by c + rank() over w1
+window w1 as (order by m);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m, rank() over w1 as r
+from t1
+group by c+r
+window w1 as (order by m);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m, rank() over w1 as r
+from t1
+group by c having c+r > 3
+window w1 as (order by m);
+ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause
+select
+c, max(pk) as m, rank() over w1 as r,
+rank() over (partition by r+1 order by m)
+from t1
+group by c
+window w1 as (order by m);
+ERROR HY000: Window function is not allowed in window specification
+select
+c, max(pk) as m, rank() over w1 as r,
+rank() over (partition by m order by r)
+from t1
+group by c
+window w1 as (order by m);
+ERROR HY000: Window function is not allowed in window specification
+select
+c, max(pk) as m, rank() over w1 as r, dense_rank() over w2 as dr
+from t1
+group by c
+window w1 as (order by m), w2 as (partition by r order by m);
+ERROR HY000: Window function is not allowed in window specification
+select
+pk, c,
+row_number() over (partition by c order by pk
+range between unbounded preceding and current row) as r
+from t1;
+ERROR HY000: Window frame is not allowed with 'row_number'
+select
+pk, c,
+rank() over w1 as r
+from t1
+window w1 as (partition by c order by pk
+rows between 2 preceding and 2 following);
+ERROR HY000: Window frame is not allowed with 'rank'
+select
+pk, c,
+dense_rank() over (partition by c order by pk
+rows between 1 preceding and 1 following) as r
+from t1;
+ERROR HY000: Window frame is not allowed with 'dense_rank'
+select
+pk, c,
+rank() over w1 as r
+from t1
+window w1 as (partition by c);
+ERROR HY000: No order list in window specification for 'rank'
+select
+pk, c,
+dense_rank() over (partition by c) as r
+from t1;
+ERROR HY000: No order list in window specification for 'dense_rank'
+drop table t0,t1;
+#
+# MDEV-9634: Window function produces incorrect value
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (part_id int, pk int, a int);
+insert into t2 select
+if(a<5, 0, 1), a, if(a<5, NULL, 1) from t0;
+select * from t2;
+part_id pk a
+0 0 NULL
+0 1 NULL
+0 2 NULL
+0 3 NULL
+0 4 NULL
+1 5 1
+1 6 1
+1 7 1
+1 8 1
+1 9 1
+select
+part_id, pk, a,
+count(a) over (partition by part_id order by pk
+rows between 1 preceding and 1 following) as CNT
+from t2;
+part_id pk a CNT
+0 0 NULL 0
+0 1 NULL 0
+0 2 NULL 0
+0 3 NULL 0
+0 4 NULL 0
+1 5 1 2
+1 6 1 3
+1 7 1 3
+1 8 1 3
+1 9 1 2
+drop table t0, t2;
+#
+# RANGE-type bounds
+#
+create table t3 (
+pk int,
+val int
+);
+insert into t3 values
+(0, 1),
+(1, 1),
+(2, 1),
+(3, 2),
+(4, 2),
+(5, 2),
+(6, 2);
+select
+val,
+count(val) over (order by val
+range between current row and
+current row)
+as CNT
+from t3;
+val CNT
+1 3
+1 3
+1 3
+2 4
+2 4
+2 4
+2 4
+insert into t3 values
+(7, 3),
+(8, 3);
+select
+val,
+count(val) over (order by val
+range between current row and
+current row)
+as CNT
+from t3;
+val CNT
+1 3
+1 3
+1 3
+2 4
+2 4
+2 4
+2 4
+3 2
+3 2
+drop table t3;
+# Now, check with PARTITION BY
+create table t4 (
+part_id int,
+pk int,
+val int
+);
+insert into t4 values
+(1234, 100, 1),
+(1234, 101, 1),
+(1234, 102, 1),
+(1234, 103, 2),
+(1234, 104, 2),
+(1234, 105, 2),
+(1234, 106, 2),
+(1234, 107, 3),
+(1234, 108, 3),
+(5678, 200, 1),
+(5678, 201, 1),
+(5678, 202, 1),
+(5678, 203, 2),
+(5678, 204, 2),
+(5678, 205, 2),
+(5678, 206, 2),
+(5678, 207, 3),
+(5678, 208, 3);
+select
+part_id,
+val,
+count(val) over (partition by part_id
+order by val
+range between current row and
+current row)
+as CNT
+from t4;
+part_id val CNT
+1234 1 3
+1234 1 3
+1234 1 3
+1234 2 4
+1234 2 4
+1234 2 4
+1234 2 4
+1234 3 2
+1234 3 2
+5678 1 3
+5678 1 3
+5678 1 3
+5678 2 4
+5678 2 4
+5678 2 4
+5678 2 4
+5678 3 2
+5678 3 2
+#
+# Try RANGE UNBOUNDED PRECEDING | FOLLOWING
+#
+select
+part_id,
+val,
+count(val) over (partition by part_id
+order by val
+range between unbounded preceding and
+current row)
+as CNT
+from t4;
+part_id val CNT
+1234 1 3
+1234 1 3
+1234 1 3
+1234 2 7
+1234 2 7
+1234 2 7
+1234 2 7
+1234 3 9
+1234 3 9
+5678 1 3
+5678 1 3
+5678 1 3
+5678 2 7
+5678 2 7
+5678 2 7
+5678 2 7
+5678 3 9
+5678 3 9
+select
+part_id,
+val,
+count(val) over (partition by part_id
+order by val
+range between current row and
+unbounded following)
+as CNT
+from t4;
+part_id val CNT
+1234 1 9
+1234 1 9
+1234 1 9
+1234 2 6
+1234 2 6
+1234 2 6
+1234 2 6
+1234 3 2
+1234 3 2
+5678 1 9
+5678 1 9
+5678 1 9
+5678 2 6
+5678 2 6
+5678 2 6
+5678 2 6
+5678 3 2
+5678 3 2
+select
+part_id,
+val,
+count(val) over (partition by part_id
+order by val
+range between unbounded preceding and
+unbounded following)
+as CNT
+from t4;
+part_id val CNT
+1234 1 9
+1234 1 9
+1234 1 9
+1234 2 9
+1234 2 9
+1234 2 9
+1234 2 9
+1234 3 9
+1234 3 9
+5678 1 9
+5678 1 9
+5678 1 9
+5678 2 9
+5678 2 9
+5678 2 9
+5678 2 9
+5678 3 9
+5678 3 9
+drop table t4;
+#
+# MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING
+#
+create table t1 (pk int, a int, b int);
+insert into t1 values
+( 1 , 0, 1),
+( 2 , 0, 2),
+( 3 , 1, 4),
+( 4 , 1, 8),
+( 5 , 2, 32),
+( 6 , 2, 64),
+( 7 , 2, 128),
+( 8 , 2, 16);
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or
+from t1;
+pk a b bit_or
+1 0 1 3
+2 0 2 3
+3 1 4 12
+4 1 8 12
+5 2 32 96
+6 2 64 224
+7 2 128 208
+8 2 16 144
+# Extra ROWS n PRECEDING tests
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or
+from t1;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 1 4 0
+4 1 8 4
+5 2 32 0
+6 2 64 32
+7 2 128 64
+8 2 16 128
+drop table t1;
+create table t2 (
+pk int,
+a int,
+b int
+);
+insert into t2 values
+( 1, 0, 1),
+( 2, 0, 2),
+( 3, 0, 4),
+( 4, 0, 8),
+( 5, 1, 16),
+( 6, 1, 32),
+( 7, 1, 64),
+( 8, 1, 128),
+( 9, 2, 256),
+(10, 2, 512),
+(11, 2, 1024),
+(12, 2, 2048);
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or
+from t2;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 0 4 2
+4 0 8 4
+5 1 16 0
+6 1 32 16
+7 1 64 32
+8 1 128 64
+9 2 256 0
+10 2 512 256
+11 2 1024 512
+12 2 2048 1024
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) as bit_or
+from t2;
+pk a b bit_or
+1 0 1 0
+2 0 2 0
+3 0 4 1
+4 0 8 2
+5 1 16 0
+6 1 32 0
+7 1 64 16
+8 1 128 32
+9 2 256 0
+10 2 512 0
+11 2 1024 256
+12 2 2048 512
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) as bit_or
+from t2;
+pk a b bit_or
+1 0 1 0
+2 0 2 1
+3 0 4 3
+4 0 8 6
+5 1 16 0
+6 1 32 16
+7 1 64 48
+8 1 128 96
+9 2 256 0
+10 2 512 256
+11 2 1024 768
+12 2 2048 1536
+# Check CURRENT ROW
+select pk, a, b,
+bit_or(b) over (partition by a order by pk ROWS BETWEEN CURRENT ROW AND CURRENT ROW) as bit_or
+from t2;
+pk a b bit_or
+1 0 1 1
+2 0 2 2
+3 0 4 4
+4 0 8 8
+5 1 16 16
+6 1 32 32
+7 1 64 64
+8 1 128 128
+9 2 256 256
+10 2 512 512
+11 2 1024 1024
+12 2 2048 2048
+drop table t2;
+#
+# Try RANGE PRECEDING|FOLLWING n
+#
+create table t1 (
+part_id int,
+pk int,
+a int
+);
+insert into t1 values
+(10, 1, 1),
+(10, 2, 2),
+(10, 3, 4),
+(10, 4, 8),
+(10, 5,26),
+(10, 6,27),
+(10, 7,40),
+(10, 8,71),
+(10, 9,72);
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 4
+2 2 4
+3 4 4
+4 8 4
+5 26 6
+6 27 6
+7 40 7
+8 71 9
+9 72 9
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 FOLLOWING) as cnt
+from t1;
+pk a cnt
+9 72 2
+8 71 2
+7 40 3
+6 27 5
+5 26 5
+4 8 9
+3 4 9
+2 2 9
+1 1 9
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 2
+3 4 3
+4 8 4
+5 26 6
+6 27 6
+7 40 7
+8 71 9
+9 72 9
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 0
+3 4 0
+4 8 0
+5 26 4
+6 27 4
+7 40 6
+8 71 7
+9 72 7
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 PRECEDING) as cnt
+from t1;
+pk a cnt
+9 72 0
+8 71 0
+7 40 2
+6 27 3
+5 26 3
+4 8 5
+3 4 5
+2 2 5
+1 1 5
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN 1 PRECEDING
+AND CURRENT ROW) as cnt
+from t1;
+pk a cnt
+1 1 1
+2 2 2
+3 4 1
+4 8 1
+5 26 1
+6 27 2
+7 40 1
+8 71 1
+9 72 2
+select
+pk, a,
+count(a) over (ORDER BY a DESC
+RANGE BETWEEN 1 PRECEDING
+AND CURRENT ROW) as cnt
+from t1;
+pk a cnt
+9 72 1
+8 71 2
+7 40 1
+6 27 1
+5 26 2
+4 8 1
+3 4 1
+2 2 1
+1 1 2
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN 1 FOLLOWING
+AND 3 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 1
+3 4 0
+4 8 0
+5 26 1
+6 27 0
+7 40 0
+8 71 1
+9 72 0
+# Try CURRENT ROW with[out] DESC
+select
+pk, a,
+count(a) over (ORDER BY a
+RANGE BETWEEN CURRENT ROW
+AND 1 FOLLOWING) as cnt
+from t1;
+pk a cnt
+1 1 2
+2 2 1
+3 4 1
+4 8 1
+5 26 2
+6 27 1
+7 40 1
+8 71 2
+9 72 1
+select
+pk, a,
+count(a) over (order by a desc
+range between current row
+and 1 following) as cnt
+from t1;
+pk a cnt
+9 72 2
+8 71 1
+7 40 1
+6 27 2
+5 26 1
+4 8 1
+3 4 1
+2 2 2
+1 1 1
+insert into t1 select 22, pk, a from t1;
+select
+part_id, pk, a,
+count(a) over (PARTITION BY part_id
+ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 10 FOLLOWING) as cnt
+from t1;
+part_id pk a cnt
+10 1 1 4
+10 2 2 4
+10 3 4 4
+10 4 8 4
+10 5 26 6
+10 6 27 6
+10 7 40 7
+10 8 71 9
+10 9 72 9
+22 1 1 4
+22 2 2 4
+22 3 4 4
+22 4 8 4
+22 5 26 6
+22 6 27 6
+22 7 40 7
+22 8 71 9
+22 9 72 9
+select
+pk, a,
+count(a) over (PARTITION BY part_id
+ORDER BY a
+RANGE BETWEEN UNBOUNDED PRECEDING
+AND 1 PRECEDING) as cnt
+from t1;
+pk a cnt
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+1 1 0
+2 2 1
+3 4 2
+4 8 3
+5 26 4
+6 27 5
+7 40 6
+8 71 7
+9 72 8
+drop table t1;
+# Try a RANGE frame over non-integer datatype:
+create table t1 (
+col1 int,
+a decimal(5,3)
+);
+insert into t1 values (1, 0.45);
+insert into t1 values (1, 0.5);
+insert into t1 values (1, 0.55);
+insert into t1 values (1, 1.21);
+insert into t1 values (1, 1.22);
+insert into t1 values (1, 3.33);
+select
+a,
+count(col1) over (order by a
+range between 0.1 preceding
+and 0.1 following)
+from t1;
+a count(col1) over (order by a
+range between 0.1 preceding
+and 0.1 following)
+0.450 3
+0.500 3
+0.550 3
+1.210 2
+1.220 2
+3.330 1
+drop table t1;
+#
+# RANGE-type frames and NULL values
+#
+create table t1 (
+pk int,
+a int,
+b int
+);
+insert into t1 values (1, NULL,1);
+insert into t1 values (2, NULL,1);
+insert into t1 values (3, NULL,1);
+insert into t1 values (4, 10 ,1);
+insert into t1 values (5, 11 ,1);
+insert into t1 values (6, 12 ,1);
+insert into t1 values (7, 13 ,1);
+insert into t1 values (8, 14 ,1);
+select
+pk, a,
+count(b) over (order by a
+range between 2 preceding
+and 2 following) as CNT
+from t1
+order by a, pk;
+pk a CNT
+1 NULL 3
+2 NULL 3
+3 NULL 3
+4 10 3
+5 11 4
+6 12 5
+7 13 4
+8 14 3
+drop table t1;
+#
+# Try ranges that have bound1 > bound2. The standard actually allows them
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (pk int, c int);
+insert into t1 select a+1,1 from t0;
+update t1 set c=2 where pk not in (1,2,3,4);
+select * from t1;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select
+pk, c,
+count(*) over (partition by c
+order by pk
+rows between 1 preceding
+and 2 preceding)
+as cnt
+from t1;
+pk c cnt
+1 1 0
+2 1 0
+3 1 0
+4 1 0
+5 2 0
+6 2 0
+7 2 0
+8 2 0
+9 2 0
+10 2 0
+select
+pk, c,
+sum(c) over (partition by c
+order by pk
+rows between 1 preceding
+and 2 preceding)
+as sum
+from t1;
+pk c sum
+1 1 NULL
+2 1 NULL
+3 1 NULL
+4 1 NULL
+5 2 NULL
+6 2 NULL
+7 2 NULL
+8 2 NULL
+9 2 NULL
+10 2 NULL
+select
+pk, c,
+sum(c) over (partition by c
+order by pk
+rows between 2 following
+and 1 following)
+as sum
+from t1;
+pk c sum
+1 1 NULL
+2 1 NULL
+3 1 NULL
+4 1 NULL
+5 2 NULL
+6 2 NULL
+7 2 NULL
+8 2 NULL
+9 2 NULL
+10 2 NULL
+select
+pk, c,
+count(*) over (partition by c
+order by pk
+range between 1 preceding
+and 2 preceding)
+as cnt
+from t1;
+pk c cnt
+1 1 0
+2 1 0
+3 1 0
+4 1 0
+5 2 0
+6 2 0
+7 2 0
+8 2 0
+9 2 0
+10 2 0
+drop table t0, t1;
+#
+# Error checking for frame bounds
+#
+create table t1 (a int, b int, c varchar(32));
+insert into t1 values (1,1,'foo');
+insert into t1 values (2,2,'bar');
+select
+count(*) over (order by a,b
+range between unbounded preceding and current row)
+from t1;
+ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key
+select
+count(*) over (order by c
+range between unbounded preceding and current row)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+select
+count(*) over (order by a
+range between 'abcd' preceding and current row)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+select
+count(*) over (order by a
+range between current row and 'foo' following)
+from t1;
+ERROR HY000: Numeric datatype is required for RANGE-type frame
+# Try range frame with invalid bounds
+select
+count(*) over (order by a
+rows between 0.5 preceding and current row)
+from t1;
+ERROR HY000: Integer is required for ROWS-type frame
+select
+count(*) over (order by a
+rows between current row and 3.14 following)
+from t1;
+ERROR HY000: Integer is required for ROWS-type frame
+#
+# EXCLUDE clause is parsed but not supported
+#
+select
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude current row)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+range between 1 preceding and 1 following
+exclude ties)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+range between 1 preceding and 1 following
+exclude group)
+from t1;
+ERROR HY000: Frame exclusion is not supported yet
+select
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude no others)
+from t1;
+count(*) over (order by a
+rows between 1 preceding and 1 following
+exclude no others)
+2
+2
+drop table t1;
+#
+# Window function in grouping query
+#
+create table t1 (
+username varchar(32),
+amount int
+);
+insert into t1 values
+('user1',1),
+('user1',5),
+('user1',3),
+('user2',10),
+('user2',20),
+('user2',30);
+select
+username,
+sum(amount) as s,
+rank() over (order by s desc)
+from t1
+group by username;
+username s rank() over (order by s desc)
+user1 9 2
+user2 60 1
+drop table t1;
+#
+# mdev-9719: Window function in prepared statement
+#
+create table t1(a int, b int, x char(32));
+insert into t1 values (2, 10, 'xx');
+insert into t1 values (2, 10, 'zz');
+insert into t1 values (2, 20, 'yy');
+insert into t1 values (3, 10, 'xxx');
+insert into t1 values (3, 20, 'vvv');
+prepare stmt from 'select a, row_number() over (partition by a order by b) from t1';
+execute stmt;
+a row_number() over (partition by a order by b)
+2 1
+2 2
+2 3
+3 1
+3 2
+drop table t1;
+#
+# mdev-9754: Window name resolution in prepared statement
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (pk int, c int);
+insert into t1 select a+1,1 from t0;
+update t1 set c=2 where pk not in (1,2,3,4);
+select * from t1;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+prepare stmt from
+'select
+ pk, c,
+ count(*) over w1 as CNT
+from t1
+window w1 as (partition by c order by pk
+ rows between 2 preceding and 2 following)';
+execute stmt;
+pk c CNT
+1 1 3
+2 1 4
+3 1 4
+4 1 3
+5 2 3
+6 2 4
+7 2 5
+8 2 5
+9 2 4
+10 2 3
+drop table t0,t1;
+#
+# EXPLAIN FORMAT=JSON support for window functions
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+explain format=json select rank() over (order by a) from t0;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t0.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+create table t1 (a int, b int, c int);
+insert into t1 select a,a,a from t0;
+explain format=json
+select
+a,
+rank() over (order by sum(b))
+from t1
+group by a;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "filesort": {
+ "sort_key": "t1.a",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+a,
+rank() over (order by sum(b))
+from t1
+group by a
+order by null;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "sum(t1.b)"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+#
+# Check how window function works together with GROUP BY and HAVING
+#
+select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
+b MX rank() over (order by b)
+3 3 1
+5 5 2
+7 7 3
+explain format=json
+select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "having_condition": "MX in (3,5,7)",
+ "filesort": {
+ "sort_key": "t1.b",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.b"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+drop table t0;
+#
+# Building ordering index for window functions
+#
+create table t1 (
+pk int primary key,
+a int,
+b int,
+c int
+);
+insert into t1 values
+(101 , 0, 10, 1),
+(102 , 0, 10, 2),
+(103 , 1, 10, 3),
+(104 , 1, 10, 4),
+(108 , 2, 10, 5),
+(105 , 2, 20, 6),
+(106 , 2, 20, 7),
+(107 , 2, 20, 8),
+(109 , 4, 20, 9),
+(110 , 4, 20, 10),
+(111 , 5, NULL, 11),
+(112 , 5, 1, 12),
+(113 , 5, NULL, 13),
+(114 , 5, NULL, 14),
+(115 , 5, NULL, 15),
+(116 , 6, 1, NULL),
+(117 , 6, 1, 10),
+(118 , 6, 1, 1),
+(119 , 6, 1, NULL),
+(120 , 6, 1, NULL),
+(121 , 6, 1, NULL),
+(122 , 6, 1, 2),
+(123 , 6, 1, 20),
+(124 , 6, 1, -10),
+(125 , 6, 1, NULL),
+(126 , 6, 1, NULL),
+(127 , 6, 1, NULL);
+select sum(b) over (partition by a order by b,pk
+rows between unbounded preceding and current row) as c1,
+avg(b) over (w1 rows between 1 preceding and 1 following) as c2,
+sum(c) over (w2 rows between 1 preceding and 1 following) as c5,
+avg(b) over (w1 rows between 5 preceding and 5 following) as c3,
+sum(b) over (w1 rows between 1 preceding and 1 following) as c4
+from t1
+window w1 as (partition by a order by b,pk),
+w2 as (partition by b order by c,pk);
+c1 c2 c5 c3 c4
+1 1.0000 42 1.0000 1
+1 1.0000 NULL 1.0000 2
+10 1.0000 NULL 1.0000 3
+10 10.0000 3 10.0000 20
+10 10.0000 9 10.0000 20
+10 15.0000 9 17.5000 30
+11 1.0000 NULL 1.0000 3
+12 1.0000 -10 1.0000 2
+2 1.0000 24 1.0000 3
+20 10.0000 12 10.0000 20
+20 10.0000 6 10.0000 20
+20 20.0000 27 20.0000 40
+3 1.0000 -7 1.0000 3
+30 16.6667 13 17.5000 50
+4 1.0000 NULL 1.0000 3
+40 20.0000 19 20.0000 40
+5 1.0000 NULL 1.0000 3
+50 20.0000 21 17.5000 60
+6 1.0000 NULL 1.0000 3
+7 1.0000 13 1.0000 3
+70 20.0000 24 17.5000 40
+8 1.0000 32 1.0000 3
+9 1.0000 -9 1.0000 3
+NULL 1.0000 29 1.0000 1
+NULL NULL 24 1.0000 NULL
+NULL NULL 38 1.0000 NULL
+NULL NULL 42 1.0000 NULL
+drop table t1;
+#
+# MDEV-9848: Window functions: reuse sorting and/or scanning
+#
+create table t1 (a int, b int, c int);
+insert into t1 values
+(1,3,1),
+(2,2,1),
+(3,1,1);
+# Check using counters
+flush status;
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by b)
+from t1;
+rank() over (partition by c order by a) rank() over (partition by c order by b)
+1 3
+2 2
+3 1
+show status like '%sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 6
+Sort_scan 2
+flush status;
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by a)
+from t1;
+rank() over (partition by c order by a) rank() over (partition by c order by a)
+1 1
+2 2
+3 3
+show status like '%sort%';
+Variable_name Value
+Sort_merge_passes 0
+Sort_priority_queue_sorts 0
+Sort_range 0
+Sort_rows 3
+Sort_scan 1
+explain format=json
+select
+rank() over (partition by c order by a),
+rank() over (partition by c order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+rank() over (order by a),
+row_number() over (order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+rank() over (partition by c order by a),
+count(*) over (partition by c)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+explain format=json
+select
+count(*) over (partition by c),
+rank() over (partition by c order by a)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.c, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-9847: Window functions: crash with big_tables=1
+#
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+set @tmp=@@big_tables;
+set big_tables=1;
+select rank() over (order by a) from t1;
+rank() over (order by a)
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+set big_tables=@tmp;
+drop table t1;
+#
+# Check if "ORDER BY window_func" works
+#
+create table t1 (s1 int, s2 char(5));
+insert into t1 values (1,'a');
+insert into t1 values (null,null);
+insert into t1 values (1,null);
+insert into t1 values (null,'a');
+insert into t1 values (2,'b');
+insert into t1 values (-1,'');
+explain format=json
+select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "filesort": {
+ "sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.s1, t1.s2"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
+s1 s2 X
+2 b 6
+1 a 5
+1 NULL 4
+-1 3
+NULL a 2
+NULL NULL 1
+drop table t1;
+#
+# Try window functions that are not directly present in the select list
+#
+create table t1 (a int, b int);
+insert into t1 values
+(1,3),
+(2,2),
+(3,1);
+select
+a, b,
+rank() over (order by a), rank() over (order by b),
+rank() over (order by a) - rank() over (order by b) as diff
+from
+t1;
+a b rank() over (order by a) rank() over (order by b) diff
+1 3 1 3 -2
+2 2 2 2 0
+3 1 3 1 2
+drop table t1;
+create table t1 (i int);
+insert into t1 values (1),(2);
+SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1;
+MAX(i) OVER (PARTITION BY (i))
+1
+2
+drop table t1;
+#
+# Check the 0 in ROWS 0 PRECEDING
+#
+create table t1 (
+part_id int,
+pk int,
+a int
+);
+insert into t1 values (1, 1, 1);
+insert into t1 values (1, 2, 2);
+insert into t1 values (1, 3, 4);
+insert into t1 values (1, 4, 8);
+select
+pk, a,
+sum(a) over (order by pk rows between 0 preceding and current row)
+from t1;
+pk a sum(a) over (order by pk rows between 0 preceding and current row)
+1 1 1
+2 2 2
+3 4 4
+4 8 8
+select
+pk, a,
+sum(a) over (order by pk rows between 1 preceding and 0 preceding)
+from t1;
+pk a sum(a) over (order by pk rows between 1 preceding and 0 preceding)
+1 1 1
+2 2 3
+3 4 6
+4 8 12
+insert into t1 values (200, 1, 1);
+insert into t1 values (200, 2, 2);
+insert into t1 values (200, 3, 4);
+insert into t1 values (200, 4, 8);
+select
+part_id, pk, a,
+sum(a) over (partition by part_id order by pk rows between 0 preceding and current row)
+from t1;
+part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preceding and current row)
+1 1 1 1
+1 2 2 2
+1 3 4 4
+1 4 8 8
+200 1 1 1
+200 2 2 2
+200 3 4 4
+200 4 8 8
+select
+part_id, pk, a,
+sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding)
+from t1;
+part_id pk a sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding)
+1 1 1 1
+1 2 2 3
+1 3 4 6
+1 4 8 12
+200 1 1 1
+200 2 2 3
+200 3 4 6
+200 4 8 12
+drop table t1;
+#
+# MDEV-9780, The "DISTINCT must not bet converted into GROUP BY when
+# window functions are present" part
+#
+create table t1 (part_id int, a int);
+insert into t1 values
+(100, 1),
+(100, 2),
+(100, 2),
+(100, 3),
+(2000, 1),
+(2000, 2),
+(2000, 3),
+(2000, 3),
+(2000, 3);
+select rank() over (partition by part_id order by a) from t1;
+rank() over (partition by part_id order by a)
+1
+2
+2
+4
+1
+2
+3
+3
+3
+select distinct rank() over (partition by part_id order by a) from t1;
+rank() over (partition by part_id order by a)
+1
+2
+4
+3
+explain format=json
+select distinct rank() over (partition by part_id order by a) from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "duplicate_removal": {
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.part_id, t1.a"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 9,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-9893: Window functions with different ORDER BY lists,
+# one of these lists containing an expression
+#
+create table t1 (s1 int, s2 char(5));
+insert into t1 values (1,'a');
+insert into t1 values (null,null);
+insert into t1 values (3,null);
+insert into t1 values (4,'a');
+insert into t1 values (2,'b');
+insert into t1 values (-1,'');
+select
+*,
+ROW_NUMBER() OVER (order by s1),
+CUME_DIST() OVER (order by -s1)
+from t1;
+s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1)
+-1 2 1.0000000000
+1 a 3 0.8333333333
+2 b 4 0.6666666667
+3 NULL 5 0.5000000000
+4 a 6 0.3333333333
+NULL NULL 1 0.1666666667
+drop table t1;
+#
+# MDEV-9925: Wrong result with aggregate function as a window function
+#
+create table t1 (i int);
+insert into t1 values (1),(2);
+select i, sum(i) over (partition by i) from t1;
+i sum(i) over (partition by i)
+1 1
+2 2
+drop table t1;
+#
+# MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index
+#
+create view v1 as select 1 as i;
+select rank() over (order by i) from v1;
+rank() over (order by i)
+1
+drop view v1;
+#
+# MDEV-10097: Assertion `count > 0' failed in Item_sum_sum::add_helper(bool)
+#
+CREATE TABLE `orders` (
+`o_orderkey` int(11) NOT NULL,
+`o_custkey` int(11) DEFAULT NULL,
+PRIMARY KEY (`o_orderkey`)
+) DEFAULT CHARSET=latin1;
+INSERT INTO `orders` VALUES (59908,242);
+INSERT INTO `orders` VALUES (59940,238);
+SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey)
+ORDER BY o_custkey
+RANGE BETWEEN 15 FOLLOWING
+AND 15 FOLLOWING) from orders;
+o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey)
+ORDER BY o_custkey
+RANGE BETWEEN 15 FOLLOWING
+AND 15 FOLLOWING)
+238 NULL
+242 NULL
+DROP table orders;
+#
+# MDEV-10842: window functions with the same order column
+# but different directions
+#
+create table t1 (
+pk int primary key,
+a int,
+b int,
+c char(10)
+);
+insert into t1 values
+( 1, 0, 1, 'one'),
+( 2, 0, 2, 'two'),
+( 3, 0, 3, 'three'),
+( 4, 1, 1, 'one'),
+( 5, 1, 1, 'two'),
+( 6, 1, 2, 'three'),
+( 7, 2, NULL, 'n_one'),
+( 8, 2, 1, 'n_two'),
+( 9, 2, 2, 'n_three'),
+(10, 2, 0, 'n_four'),
+(11, 2, 10, NULL);
+select pk,
+row_number() over (order by pk desc) as r_desc,
+row_number() over (order by pk asc) as r_asc
+from t1;
+pk r_desc r_asc
+11 1 11
+10 2 10
+9 3 9
+8 4 8
+7 5 7
+6 6 6
+5 7 5
+4 8 4
+3 9 3
+2 10 2
+1 11 1
+drop table t1;
+#
+# MDEV-10874: two window functions with compatible sorting
+#
+create table t1 (
+pk int primary key,
+a int,
+b int,
+c char(10),
+d decimal(10, 3),
+e real
+);
+insert into t1 values
+( 1, 0, 1, 'one', 0.1, 0.001),
+( 2, 0, 2, 'two', 0.2, 0.002),
+( 3, 0, 3, 'three', 0.3, 0.003),
+( 4, 1, 2, 'three', 0.4, 0.004),
+( 5, 1, 1, 'two', 0.5, 0.005),
+( 6, 1, 1, 'one', 0.6, 0.006),
+( 7, 2, NULL, 'n_one', 0.5, 0.007),
+( 8, 2, 1, 'n_two', NULL, 0.008),
+( 9, 2, 2, NULL, 0.7, 0.009),
+(10, 2, 0, 'n_four', 0.8, 0.010),
+(11, 2, 10, NULL, 0.9, NULL);
+select pk, a, d,
+sum(d) over (partition by a order by pk
+ROWS between 1 preceding and current row) as sum_1,
+sum(d) over (order by a
+ROWS BETWEEN 1 preceding and 2 following) as sum_2
+from t1;
+pk a d sum_1 sum_2
+1 0 0.100 0.100 0.600
+2 0 0.200 0.300 1.000
+3 0 0.300 0.500 1.400
+4 1 0.400 0.400 1.800
+5 1 0.500 0.900 2.000
+6 1 0.600 1.100 1.600
+7 2 0.500 0.500 1.800
+8 2 NULL 0.500 2.000
+9 2 0.700 0.700 2.400
+10 2 0.800 1.500 2.400
+11 2 0.900 1.700 1.700
+explain format=json
+select pk, a, d,
+sum(d) over (partition by a order by pk
+ROWS between 1 preceding and current row) as sum_1,
+sum(d) over (order by a
+ROWS BETWEEN 1 preceding and 2 following) as sum_2
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a, t1.pk"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 11,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+select pk, a, d,
+sum(d) over (partition by a order by pk desc
+ROWS between 1 preceding and current row) as sum_1,
+sum(d) over (order by a
+ROWS BETWEEN 1 preceding and 2 following) as sum_2
+from t1;
+pk a d sum_1 sum_2
+3 0 0.300 0.300 0.600
+2 0 0.200 0.500 1.200
+1 0 0.100 0.300 1.400
+6 1 0.600 0.600 1.600
+5 1 0.500 1.100 2.400
+4 1 0.400 0.900 2.600
+11 2 0.900 0.900 2.800
+10 2 0.800 1.700 2.400
+9 2 0.700 1.500 2.000
+8 2 NULL 0.700 1.200
+7 2 0.500 0.500 0.500
+drop table t1;
+#
+# MDEV-9941: two window functions with compatible partitions
+#
+create table t1 (
+a int,
+b int,
+c int
+);
+insert into t1 values
+(10, 1, 1),
+(10, 3, 10),
+(10, 1, 10),
+(10, 3, 100),
+(10, 5, 1000),
+(10, 1, 100);
+explain format=json
+select
+a,b,c,
+row_number() over (partition by a),
+row_number() over (partition by a, b)
+from t1;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "t1.a, t1.b"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 6,
+ "filtered": 100
+ }
+ }
+ }
+ }
+}
+drop table t1;
+#
+# MDEV-10815: Window Function Expressions Wrong Results
+#
+create table t(a decimal(35,10), b int);
+insert into t(a,b) values(1,1);
+insert into t(a,b) values(2,1);
+insert into t(a,b) values(0,1);
+insert into t(a,b) values(1, 2);
+insert into t(a,b) values(1.5,2);
+insert into t(a,b) values(3, 2);
+insert into t(a,b) values(4.5,2);
+select a, b,
+sum(t.a) over (partition by t.b order by a) as simple_sum,
+sum(t.a) over (partition by t.b order by a) + 1 as sum_and_const,
+sum(t.b) over (partition by t.b order by a) + sum(t.a) over (partition by t.b order by a) as sum_and_sum
+from t
+order by t.b, t.a;
+a b simple_sum sum_and_const sum_and_sum
+0.0000000000 1 0.0000000000 1.0000000000 1.0000000000
+1.0000000000 1 1.0000000000 2.0000000000 3.0000000000
+2.0000000000 1 3.0000000000 4.0000000000 6.0000000000
+1.0000000000 2 1.0000000000 2.0000000000 3.0000000000
+1.5000000000 2 2.5000000000 3.5000000000 6.5000000000
+3.0000000000 2 5.5000000000 6.5000000000 11.5000000000
+4.5000000000 2 10.0000000000 11.0000000000 18.0000000000
+drop table t;
+#
+# MDEV-10669: Crash in SELECT with window function used
+#
+create table t(a decimal(35,10), b int);
+insert into t(a,b) values(1,1);
+insert into t(a,b) values(2,1);
+insert into t(a,b) values(0,1);
+SELECT (CASE WHEN sum(t.a) over (partition by t.b)=0 THEN null ELSE null END) AS a FROM t;
+a
+NULL
+NULL
+NULL
+SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t;
+ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0)
+0.00000000000000
+0.00000000000000
+0.00000000000000
+SELECT sum(t.a) over (partition by t.b order by a),
+sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0))
+from t;
+sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0))
+0.0000000000 0
+1.0000000000 1
+3.0000000000 1.7320508075688772
+drop table t;
+#
+# MDEV-10868: view definitions with window functions
+#
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (pk int, c int);
+insert into t1 select a+1,1 from t0;
+update t1 set c=2 where pk not in (1,2,3,4);
+select * from t1;
+pk c
+1 1
+2 1
+3 1
+4 1
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+select pk, c, c/count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+create view v1 as select pk, c, c/count(*) over (partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+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 `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v1;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows between 1 preceding and 2 following);
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+create view v2 as select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows between 1 preceding and 2 following);
+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 `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v2;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 0.6667
+6 2 0.5000
+7 2 0.5000
+8 2 0.5000
+9 2 0.6667
+10 2 1.0000
+select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows unbounded preceding);
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.4000
+10 2 0.3333
+create view v3 as select pk, c, c/count(*) over w1 as CNT from t1
+window w1 as (partition by c order by pk rows unbounded preceding);
+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 `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between unbounded preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v3;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.4000
+10 2 0.3333
+select pk, c, c/count(*) over (partition by c order by pk
+range between 3 preceding and current row) as CNT
+from t1;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.5000
+10 2 0.5000
+create view v4 as select pk, c, c/count(*) over (partition by c order by pk
+range between 3 preceding and current row) as CNT
+from t1;
+show create view v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci
+select * from v4;
+pk c CNT
+1 1 1.0000
+2 1 0.5000
+3 1 0.3333
+4 1 0.2500
+5 2 2.0000
+6 2 1.0000
+7 2 0.6667
+8 2 0.5000
+9 2 0.5000
+10 2 0.5000
+drop view v1,v2,v3,v4;
+drop table t0,t1;
+#
+# MDEV-10875: window function in subquery
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (3),(1);
+CREATE TABLE t2 (c VARCHAR(8));
+INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
+SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
+COUNT(*) OVER (PARTITION BY c)
+1
+2
+2
+SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
+i
+1
+DROP TABLE t1, t2;
+#
+# MDEV-9976: window function without PARTITION BY and ORDER BY
+#
+CREATE TABLE t1 (id int, a int);
+INSERT INTO t1 VALUES
+(1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200),
+(7,2000), (8,2100), (9,1600);
+SELECT id, sum(a) OVER (PARTITION BY id
+ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+id sum(a) OVER (PARTITION BY id
+1 1000
+2 1100
+3 1800
+4 1500
+5 1700
+6 1200
+7 2000
+8 2100
+9 1600
+ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+FROM t1;
+id sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
+1 14000
+2 13000
+3 5900
+4 10700
+5 7600
+6 11900
+7 4100
+8 2100
+9 9200
+DROP TABLE t1;
+#
+# MDEV-11867: window function with aggregation
+# over the result of grouping
+#
+create table t1 (
+username varchar(32),
+amount int
+);
+insert into t1 values
+('user1',1),
+('user1',5),
+('user1',3),
+('user2',10),
+('user2',20),
+('user2',30);
+select username, sum(amount) as s, avg(sum(amount)) over (order by s desc)
+from t1
+group by username;
+username s avg(sum(amount)) over (order by s desc)
+user1 9 34.5000
+user2 60 60.0000
+select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc)
+from t1
+group by username;
+username sum(amount) avg(sum(amount)) over (order by sum(amount) desc)
+user1 9 34.5000
+user2 60 60.0000
+drop table t1;
+#
+# MDEV-11594: window function over implicit grouping
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2);
+select sum(id) over (order by sum(id)) from t1;
+sum(id) over (order by sum(id))
+1
+select sum(sum(id)) over (order by sum(id)) from t1;
+sum(sum(id)) over (order by sum(id))
+8
+drop table t1;
+#
+# MDEV-9923: integer constant in order by list
+# of window specification
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2);
+select rank() over (order by 1) from t1;
+rank() over (order by 1)
+1
+1
+1
+1
+select rank() over (order by 2) from t1;
+rank() over (order by 2)
+1
+1
+1
+1
+select rank() over (partition by id order by 2) from t1;
+rank() over (partition by id order by 2)
+1
+1
+1
+1
+drop table t1;
+#
+# MDEV-10660: view using a simple window function
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2);
+create view v1(id,rnk) as
+select id, rank() over (order by id) from t1;
+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 `t1`.`id` AS `id`,rank() over ( order by `t1`.`id`) AS `rnk` from `t1` latin1 latin1_swedish_ci
+select id, rank() over (order by id) from t1;
+id rank() over (order by id)
+1 1
+2 2
+2 2
+3 4
+select * from v1;
+id rnk
+1 1
+2 2
+2 2
+3 4
+drop view v1;
+drop table t1;
+#
+# MDEV-11138: window function in the query without tables
+#
+select row_number() over ();
+row_number() over ()
+1
+select count(*) over ();
+count(*) over ()
+1
+select sum(5) over ();
+sum(5) over ()
+5
+select row_number() over (), sum(5) over ();
+row_number() over () sum(5) over ()
+1 5
+select row_number() over (order by 2);
+row_number() over (order by 2)
+1
+select row_number() over (partition by 2);
+row_number() over (partition by 2)
+1
+select row_number() over (partition by 4 order by 1+2);
+row_number() over (partition by 4 order by 1+2)
+1
+#
+# MDEV-11999: execution of prepared statement for
+# tableless query with window functions
+#
+prepare stmt from
+"select row_number() over (partition by 4 order by 1+2)";
+execute stmt;
+row_number() over (partition by 4 order by 1+2)
+1
+execute stmt;
+row_number() over (partition by 4 order by 1+2)
+1
+deallocate prepare stmt;
+#
+# MDEV-11745: window function with min/max
+#
+create table t1 (i int, b int);
+insert into t1 values
+(1,1),(2,1),(3,1),(4,4),(5,4),(6,4),(7,8),(8,8),(9,8),(10,8);
+select b, min(i) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 1
+1 1
+1 1
+4 4
+4 4
+4 4
+8 7
+8 7
+8 7
+8 7
+select b, min(i) over (partition by b) as f
+from (select * from t1) as tt
+order by i;
+b f
+1 1
+1 1
+1 1
+4 4
+4 4
+4 4
+8 7
+8 7
+8 7
+8 7
+select b, min(i+10) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 11
+1 11
+1 11
+4 14
+4 14
+4 14
+8 17
+8 17
+8 17
+8 17
+select b, min(i) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 11
+1 11
+1 11
+4 14
+4 14
+4 14
+8 17
+8 17
+8 17
+8 17
+select b, min(i+20) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 31
+1 31
+1 31
+4 34
+4 34
+4 34
+8 37
+8 37
+8 37
+8 37
+select b, max(i) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 3
+1 3
+1 3
+4 6
+4 6
+4 6
+8 10
+8 10
+8 10
+8 10
+select b, max(i) over (partition by b) as f
+from (select * from t1) as tt
+order by i;
+b f
+1 3
+1 3
+1 3
+4 6
+4 6
+4 6
+8 10
+8 10
+8 10
+8 10
+select b, max(i+10) over (partition by b) as f
+from t1 as tt
+order by i;
+b f
+1 13
+1 13
+1 13
+4 16
+4 16
+4 16
+8 20
+8 20
+8 20
+8 20
+select b, max(i) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 13
+1 13
+1 13
+4 16
+4 16
+4 16
+8 20
+8 20
+8 20
+8 20
+select b, max(i+20) over (partition by b) as f
+from (select i+10 as i, b from t1) as tt
+order by i;
+b f
+1 33
+1 33
+1 33
+4 36
+4 36
+4 36
+8 40
+8 40
+8 40
+8 40
+select max(i), max(i), sum(i), count(i)
+from t1 as tt
+group by b;
+max(i) max(i) sum(i) count(i)
+3 3 6 3
+6 6 15 3
+10 10 34 4
+select max(i), min(sum(i)) over (partition by count(i)) f
+from t1 as tt
+group by b;
+max(i) f
+3 6
+6 6
+10 34
+select max(i), min(sum(i)) over (partition by count(i)) f
+from (select * from t1) as tt
+group by b;
+max(i) f
+3 6
+6 6
+10 34
+select max(i+10), min(sum(i)+10) over (partition by count(i)) f
+from t1 as tt
+group by b;
+max(i+10) f
+13 16
+16 16
+20 44
+select max(i), max(i), sum(i), count(i)
+from (select i+10 as i, b from t1) as tt
+group by b;
+max(i) max(i) sum(i) count(i)
+13 13 36 3
+16 16 45 3
+20 20 74 4
+select max(i), min(sum(i)) over (partition by count(i)) f
+from (select i+10 as i, b from t1) as tt
+group by b;
+max(i) f
+13 36
+16 36
+20 74
+select max(i), min(i), min(max(i)-min(i)) over (partition by count(i)) f
+from (select i+10 as i, b from t1) as tt
+group by b;
+max(i) min(i) f
+13 11 2
+16 14 2
+20 17 3
+drop table t1;
+#
+# MDEV-12015: window function over select with WHERE
+# that is always FALSE
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (3), (1), (2);
+SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2;
+i ROW_NUMBER() OVER ()
+SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2;
+i COUNT(*) OVER ()
+DROP TABLE t1;
+#
+# MDEV-12051: window function in query with implicit grouping
+# on always empty set
+#
+create table t1 (a int, b varchar(8));
+insert into t1 values (1,'foo'),(2,'bar');
+select max(a), row_number() over () from t1 where a > 10;
+max(a) row_number() over ()
+NULL 1
+select max(a), sum(max(a)) over () from t1 where a > 10;
+max(a) sum(max(a)) over ()
+NULL NULL
+select max(a), sum(max(a)) over (partition by max(a)) from t1 where a > 10;
+max(a) sum(max(a)) over (partition by max(a))
+NULL NULL
+select max(a), row_number() over () from t1 where 1 = 2;
+max(a) row_number() over ()
+NULL 1
+select max(a), sum(max(a)) over () from t1 where 1 = 2;
+max(a) sum(max(a)) over ()
+NULL NULL
+select max(a), sum(max(a)) over (partition by max(a)) from t1 where 1 = 2;
+max(a) sum(max(a)) over (partition by max(a))
+NULL NULL
+select max(a), row_number() over () from t1 where 1 = 2
+having max(a) is not null;
+max(a) row_number() over ()
+select max(a), sum(max(a)) over () from t1 where 1 = 2
+having max(a) is not null;
+max(a) sum(max(a)) over ()
+drop table t1;
+#
+# MDEV-10885: window function in query with implicit grouping
+# with constant condition evaluated to false
+#
+CREATE TABLE t1 (a INT, b VARCHAR(8));
+INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
+CREATE TABLE t2 (c INT);
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (d INT);
+INSERT INTO t3 VALUES (5),(6);
+SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a))
+NULL 1
+SELECT MAX(a), COUNT(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+MAX(a) COUNT(MAX(a)) OVER (PARTITION BY MAX(a))
+NULL 0
+SELECT MAX(a), SUM(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+MAX(a) SUM(MAX(a)) OVER (PARTITION BY MAX(a))
+NULL NULL
+SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) )
+HAVING MAX(a) IS NOT NULL;
+MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a))
+SELECT a, MAX(a), ROW_NUMBER() OVER (PARTITION BY b) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+a MAX(a) ROW_NUMBER() OVER (PARTITION BY b)
+NULL NULL 1
+SELECT a, COUNT(a), AVG(a) OVER (PARTITION BY b) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+a COUNT(a) AVG(a) OVER (PARTITION BY b)
+NULL 0 NULL
+SELECT a, MAX(a), AVG(a) OVER (PARTITION BY b) FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
+a MAX(a) AVG(a) OVER (PARTITION BY b)
+NULL NULL NULL
+DROP TABLE t1,t2,t3;
+#
+# MDEV-10859: Wrong result of aggregate window function in query
+# with HAVING and no ORDER BY
+#
+create table empsalary (depname varchar(32), empno smallint primary key, salary int);
+insert into empsalary values
+('develop', 1, 5000), ('develop', 2, 4000),('sales', 3, '6000'),('sales', 4, 5000);
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 1 5000 4500.0000
+develop 2 4000 4500.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 1 5000 4500.0000
+develop 2 4000 4500.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+#
+# These last 2 should have the same row results, ignoring order.
+#
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 2 4000 4000.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1 ORDER BY depname;
+depname empno salary avg(salary) OVER (PARTITION BY depname)
+develop 2 4000 4000.0000
+sales 3 6000 5500.0000
+sales 4 5000 5500.0000
+drop table empsalary;
+#
+# MDEV-11868: min(distinct) over () returns wrong value
+#
+create table TDEC (CDEC int, RNUM int);
+create view VDEC as select * from TDEC;
+insert into TDEC (CDEC) values (null),(-1),(0),(1),(0),(10);
+select TDEC.CDEC, min(TDEC.CDEC) over () from TDEC;
+CDEC min(TDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+0 -1
+1 -1
+10 -1
+select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC;
+CDEC min(VDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+0 -1
+1 -1
+10 -1
+select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC;
+CDEC max(TDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+0 10
+1 10
+10 10
+select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC;
+CDEC max(VDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+0 10
+1 10
+10 10
+select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC;
+CDEC min(distinct TDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+0 -1
+1 -1
+10 -1
+select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC;
+CDEC min(distinct VDEC.CDEC) over ()
+NULL -1
+-1 -1
+0 -1
+0 -1
+1 -1
+10 -1
+select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC;
+CDEC max(distinct TDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+0 10
+1 10
+10 10
+select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC;
+CDEC max(distinct VDEC.CDEC) over ()
+NULL 10
+-1 10
+0 10
+0 10
+1 10
+10 10
+#
+# These should be removed once support for them is added.
+#
+select TDEC.CDEC, count(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function'
+select VDEC.CDEC, count(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function'
+select TDEC.CDEC, sum(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function'
+select VDEC.CDEC, sum(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function'
+select TDEC.CDEC, avg(distinct TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function'
+select VDEC.CDEC, avg(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function'
+select TDEC.CDEC, GROUP_CONCAT(TDEC.CDEC) over () from TDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'
+select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC;
+ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'
+drop table TDEC;
+drop view VDEC;
+#
+# MDEV-10700: 10.2.2 windowing function returns incorrect result
+#
+create table t(a int,b int, c int , d int);
+insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
+insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
+replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17;
+select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0;
+count(distinct s)
+993
+select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0;
+count(distinct s)
+1
+select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
+count(distinct s)
+1
+drop table t;
+#
+# MDEV-9924: window function in query with group by optimized away
+#
+create table t1 (i int);
+insert into t1 values (2),(3),(1);
+select row_number() over () from t1 group by 1+2;
+row_number() over ()
+1
+select max(i), row_number() over () from t1 group by 1+2;
+max(i) row_number() over ()
+3 1
+select rank() over (order by max(i)) from t1 group by 1+2;
+rank() over (order by max(i))
+1
+select i, row_number() over () from t1 group by 1+2;
+i row_number() over ()
+2 1
+select i, rank() over (order by i) rnk from t1 group by 1+2;
+i rnk
+2 1
+drop table t1;
+#
+# MDEV-11907: window function as the second operand of division
+#
+create table t1 (pk int, c int);
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2);
+set @sql_mode_save= @@sql_mode;
+set sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
+select pk, c, c/count(*) over
+(partition by c order by pk
+rows between 1 preceding and 2 following) as CNT
+from t1;
+pk c CNT
+1 1 0.3333
+2 1 0.2500
+3 1 0.3333
+4 1 0.5000
+5 2 2.0000
+show warnings;
+Level Code Message
+set sql_mode=@sql_mode_save;
+drop table t1;
+#
+# MDEV-12336: several functions over a window function
+#
+create table t1 (name varchar(10), cnt int);
+insert into t1 values ('Fred', 23), ('Fred', 35), ('Joe', 10);
+select q.name, q.row_cnt,
+round( 100 * ( q.row_cnt /
+sum(q.row_cnt) over
+(
+order by q.name
+rows between
+unbounded preceding and
+unbounded following
+)
+),2
+) pct_of_total
+from
+(
+select name, count(*) row_cnt, sum(cnt) sum_cnt
+from t1
+group by 1
+) q;
+name row_cnt pct_of_total
+Fred 2 66.67
+Joe 1 33.33
+drop table t1;
+#
+# MDEV-11990: window function over min/max aggregation
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2), (4), (2);
+select sum(max(id)) over (order by max(id)) from t1;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
+create index idx on t1(id);
+select sum(max(id)) over (order by max(id)) from t1;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+select sum(max(id)) over (order by max(id)) from t1 where id < 3;
+sum(max(id)) over (order by max(id))
+2
+select count(max(id)) over (order by max(id)) from t1 where id < 3;
+count(max(id)) over (order by max(id))
+1
+select max(id), rank() over (order by max(id)) from t1 where id < 3;
+max(id) rank() over (order by max(id))
+2 1
+drop table t1;
+#
+# main.win failure post MDEV-12336
+#
+create table t(a decimal(35,10), b int);
+insert into t values (1, 10), (2, 20), (3, 30);
+prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t";
+execute stmt;
+a
+1000
+300
+300
+drop table t;
+#
+# MDEV-12851 case with window functions query crashes server
+#
+create table t1(dt datetime);
+insert into t1 values ('2017-05-17'), ('2017-05-18');
+select dt,
+case when (max(dt) over (order by dt rows between 1 following and 1 following) is null)
+then '9999-12-31 12:00:00'
+ else max(dt) over (order by dt rows between 1 following and 1 following)
+end x,
+case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null)
+then '9999-12-31 12:00:00'
+ else max(dt) over (order by dt rows between 1 following and 1 following)
+end x
+from t1;
+dt x x
+2017-05-17 00:00:00 2017-05-18 00:00:00 9999-12-31 12:00:00
+2017-05-18 00:00:00 9999-12-31 12:00:00 NULL
+drop table t1;
+create table t1(i int);
+insert into t1 values (null),(1),(2);
+select max(i) over (order by i),
+max(i) over (order by i) is null,
+max(i) over (order by i) is not null
+from t1;
+max(i) over (order by i) max(i) over (order by i) is null max(i) over (order by i) is not null
+NULL 1 0
+1 0 1
+2 0 1
+drop table t1;
+#
+# MDEV-13189: Window functions crash when using INTERVAL function
+#
+create table t1(i int);
+insert into t1 values (1),(2),(10),(20),(30);
+select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20)
+from t1;
+sum(i) over (order by i) interval(sum(i) over (order by i), 10, 20)
+1 0
+3 0
+13 1
+33 2
+63 2
+drop table t1;
+#
+# MDEV-13352: Server crashes in st_join_table::remove_duplicates
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+DROP TABLE t1;
+#
+# MDEV-13344: Server crashes in in AGGR_OP::put_record on subquery
+# with window function and constant table
+# (Testcase only)
+#
+CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM;
+INSERT IGNORE INTO t1 VALUES ('foo');
+SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1);
+('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1)
+0
+DROP TABLE t1;
+#
+# MDEV-13351: Server crashes in st_select_lex::set_explain_type upon UNION with window function
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT Nth_value(i,1) OVER() FROM t1
+UNION ALL
+( SELECT Nth_value(i,2) OVER() FROM t1 LIMIT 0 )
+;
+Nth_value(i,1) OVER()
+1
+1
+DROP TABLE t1;
+#
+# A regression after MDEV-13351:
+# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
+# upon UNION with aggregate function
+#
+CREATE TABLE t1 (i INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
+fld
+1
+2
+DROP TABLE t1;
+#
+# MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...)
+#
+CREATE TABLE t1 (dt DATETIME);
+INSERT INTO t1 VALUES ('2017-05-17');
+SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1;
+MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING)
+NULL
+DROP TABLE t1;
+#
+# MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value
+#
+CREATE TABLE IF NOT EXISTS `fv_test` (
+`SOME_DATE` datetime NOT NULL
+);
+INSERT INTO `fv_test` (`SOME_DATE`) VALUES ('2017-07-20 12:47:56');
+CREATE TABLE fv_result
+SELECT
+FIRST_VALUE(SOME_DATE) OVER(ORDER BY SOME_DATE DESC) AS somedate
+FROM fv_test;
+SHOW CREATE TABLE fv_result;
+Table Create Table
+fv_result CREATE TABLE `fv_result` (
+ `somedate` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM fv_result;
+somedate
+2017-07-20 12:47:56
+DROP TABLE fv_test, fv_result;
+#
+# MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (0),(1),(2);
+SELECT LEAD(a) OVER (PARTITION BY a ORDER BY a) as lead,
+a AND LEAD(a) OVER (PARTITION BY a ORDER BY a) AS a_and_lead_part
+FROM t1;
+lead a_and_lead_part
+NULL 0
+NULL NULL
+NULL NULL
+SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order
+FROM t1
+ORDER BY a;
+a_or_lead_order
+1
+1
+1
+SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order
+FROM t1
+ORDER BY a;
+a_and_lead_order
+0
+1
+NULL
+SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order
+FROM t1
+ORDER BY a;
+a_xor_lead_order
+1
+0
+NULL
+SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order
+FROM t1
+ORDER BY a;
+not_lead_order
+0
+0
+NULL
+SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order
+FROM t1
+ORDER BY a;
+is_not_null_lead_order
+1
+1
+0
+drop table t1;
+#
+# MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery
+#
+CREATE TABLE t1 (i INT, a char);
+INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
+PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM (SELECT * from t1) as sq";
+EXECUTE stmt;
+row_number() over (partition by i order by i) i
+1 1
+1 2
+DROP TABLE t1;
+#
+# MDEV-13384: "window" seems like a reserved column name but it's not listed as one
+#
+# Currently we allow window as an identifier, except for table aliases.
+#
+CREATE TABLE door (id INT, window VARCHAR(10));
+SELECT id
+FROM door as window;
+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 'window' at line 2
+SELECT id, window
+FROM door;
+id window
+SELECT id, window
+FROM door as window;
+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 'window' at line 2
+DROP TABLE door;
+#
+# MDEV-13352: Server crashes in st_join_table::remove_duplicates
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
+ROW_NUMBER() OVER() i
+DROP TABLE t1;
+#
+# MDEV-15853: Assertion `tab->filesort_result == 0' failed
+#
+CREATE TABLE t1 ( a1 int);
+insert into t1 values (1),(2),(3);
+CREATE TABLE t2 (b1 int, a1 int, a2 int);
+insert into t2 values (1,2,3),(2,3,4),(3,4,5);
+SELECT COUNT(DISTINCT t2.a2),
+rank() OVER (ORDER BY t2.b1)
+FROM t2 ,t1 GROUP BY t2.b1 ORDER BY t1.a1;
+COUNT(DISTINCT t2.a2) rank() OVER (ORDER BY t2.b1)
+1 1
+1 2
+1 3
+DROP TABLE t1,t2;
+#
+# MDEV-16990: server crashes in base_list_iterator::next
+#
+CREATE TABLE t1(i int);
+insert into t1 values (1),(2);
+SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1;
+row_number() OVER () MAX(1)
+1 1
+SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1;
+BIT_AND(0) OVER () MAX(1)
+0 1
+drop table t1;
+#
+# MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode
+#
+CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT);
+INSERT INTO t1 VALUES
+('Chun', 'SQL', 75), ('Chun', 'Tuning', 73),
+('Esben', 'SQL', 43), ('Esben', 'Tuning', 31),
+('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88),
+('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83);
+SET @save_sql_mode= @@sql_mode;
+SET sql_mode = 'ONLY_FULL_GROUP_BY';
+SELECT name, test, score,
+AVG(score) OVER (PARTITION BY test) AS average_by_test
+FROM t1
+ORDER BY test, name;
+name test score average_by_test
+Chun SQL 75 65.2500
+Esben SQL 43 65.2500
+Kaolin SQL 56 65.2500
+Tatiana SQL 87 65.2500
+Chun Tuning 73 68.7500
+Esben Tuning 31 68.7500
+Kaolin Tuning 88 68.7500
+Tatiana Tuning 83 68.7500
+set @@sql_mode= @save_sql_mode;
+SELECT name, test, score,
+AVG(score) OVER (PARTITION BY test) AS average_by_test
+FROM t1
+ORDER BY test, name;
+name test score average_by_test
+Chun SQL 75 65.2500
+Esben SQL 43 65.2500
+Kaolin SQL 56 65.2500
+Tatiana SQL 87 65.2500
+Chun Tuning 73 68.7500
+Esben Tuning 31 68.7500
+Kaolin Tuning 88 68.7500
+Tatiana Tuning 83 68.7500
+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
+#
+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;
+#
+# MDEV-18431: Select max + row_number giving incorrect result
+#
+create table t1 (id int, v int);
+insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2);
+select e.id,
+(select max(t1.v) from t1 where t1.id=e.id) as a,
+row_number() over (partition by e.id order by e.v) as b,
+(select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b
+from t1 e;
+id a b sum_a_b
+1 3 1 4
+1 3 2 5
+1 3 3 6
+2 2 1 3
+2 2 2 4
+drop table t1;
+#
+# MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM'
+# failed in compare_order_elements function
+#
+CREATE TABLE t1 (a1 int);
+insert into t1 values (1),(2),(3);
+SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) FROM t1;
+rank() OVER (ORDER BY 1) ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4)))
+1 1
+1 2
+1 3
+drop table t1;
+#
+# MDEV-17781: Server crashes in next_linear_tab
+#
+CREATE TABLE t1 (i1 int);
+explain
+(SELECT AVG(0) OVER (), MAX('2') FROM t1)
+UNION ALL
+(SELECT AVG(0) OVER (), MAX('2') FROM t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+(SELECT AVG(0) OVER (), MAX('2') FROM t1)
+UNION ALL
+(SELECT AVG(0) OVER (), MAX('2') FROM t1);
+AVG(0) OVER () MAX('2')
+0.0000 NULL
+0.0000 NULL
+drop table t1;
+#
+# MDEV-14791: Crash with order by expression containing window functions
+#
+CREATE TABLE t1 (b1 int, b2 int);
+INSERT INTO t1 VALUES (1,1),(0,0);
+explain
+SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1;
+b1
+0
+1
+explain
+SELECT b1 from t1 order by row_number() over (ORDER BY b2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+SELECT b1 from t1 order by row_number() over (ORDER BY b2);
+b1
+0
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248);
+explain
+SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c);
+a b c
+1 21 909
+2 3 207
+7 13 312
+8 64 248
+explain
+SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c);
+x b c
+1 21 909
+2 3 207
+7 13 312
+8 64 248
+drop table t1;
+#
+# MDEV-18373: DENSE_RANK is not calculated correctly
+#
+create table t1 (a int, b int);
+insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600);
+select b, dense_rank() over (order by sum(a)) from t1 group by b;
+b dense_rank() over (order by sum(a))
+1515 2
+1600 1
+2000 3
+select b, dense_rank() over (order by sum(a)+1) from t1 group by b;
+b dense_rank() over (order by sum(a)+1)
+1515 2
+1600 1
+2000 3
+select b, row_number() over (partition by sum(a)) from t1 group by b;
+b row_number() over (partition by sum(a))
+1515 1
+1600 1
+2000 1
+select b, row_number() over (partition by sum(a)+1) from t1 group by b;
+b row_number() over (partition by sum(a)+1)
+1515 1
+1600 1
+2000 1
+drop table t1;
+#
+# MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF,
+# window functions and views
+#
+create table t1 (id int, n1 int);
+insert into t1 values (1,1),(2,1),(3,2),(4,4);
+explain
+select max(n1) over (partition by 'abc') from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
+select max(n1) over (partition by 'abc') from t1;
+max(n1) over (partition by 'abc')
+4
+4
+4
+4
+explain
+select rank() over (partition by 'abc' order by 'xyz') from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
+select rank() over (partition by 'abc' order by 'xyz') from t1;
+rank() over (partition by 'abc' order by 'xyz')
+1
+1
+1
+1
+drop table t1;
+#
+# MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
+x
+foo
+drop table t1;
+#
+# MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*)
+#
+CREATE TABLE t1 (i int) ;
+INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2);
+SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ;
+COUNT(*) OVER () MOD(MIN(i),2)
+3 0
+3 1
+drop table t1;
+#
+# MDEV-21318: Wrong results with window functions and implicit grouping
+#
+CREATE TABLE t1 (a INT);
+#
+# With empty const table
+# The expected result here is 1, NULL
+#
+explain
+SELECT row_number() over(), sum(1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found; Using temporary
+SELECT row_number() over(), sum(1) FROM t1;
+row_number() over() sum(1)
+1 NULL
+insert into t1 values (2);
+#
+# Const table has 1 row, but still impossible where
+# The expected result here is 1, NULL
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1;
+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 row_number() over(), sum(1) FROM t1 where a=1;
+row_number() over() sum(1)
+1 NULL
+#
+# Impossible HAVING
+# Empty result is expected
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+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 row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+row_number() over() sum(1)
+#
+# const table has 1 row, no impossible where
+# The expected result here is 1, 2
+#
+EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
+SELECT row_number() over(), sum(a) FROM t1 where a=2;
+row_number() over() sum(a)
+1 2
+drop table t1;
+#
+# Impossible Where
+#
+create table t1(a int);
+insert into t1 values (1);
+#
+# Expected result is NULL, 0, NULL
+#
+EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(a) OVER () COUNT(a) abs(a)
+NULL 0 NULL
+#
+# Expected result is 1, 0, NULL
+#
+EXPLAIN
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(1) OVER () COUNT(a) abs(a)
+1 0 NULL
+drop table t1;
+#
+# MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
+#
+CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY ) ;
+INSERT INTO t0 VALUES (1),(2),(3);
+SELECT a FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+a
+1
+SELECT a, ROW_NUMBER() OVER v2
+FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+a ROW_NUMBER() OVER v2
+1 1
+drop table t0;
+#
+# MDEV-16230:Server crashes when Analyze format=json is run with a window function with
+# empty PARTITION BY and ORDER BY clauses
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1;
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "window_functions_computation": {
+ "sorts": {
+ "filesort": {
+ "sort_key": "`row_number() OVER()`",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 3,
+ "r_buffer_size": "REPLACED"
+ }
+ },
+ "temporary_table": {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "r_total_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ }
+}
+SELECT row_number() OVER() FROM t1;
+row_number() OVER()
+1
+2
+3
+DROP TABLE t1;
+#
+# MDEV-22984: Throw an error when arguments to window functions are window functions
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+DROP TABLE t1;
+#
+# MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
+#
+CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED);
+INSERT INTO t1 VALUES (1),(2);
+SELECT MIN(d) OVER () FROM t1;
+MIN(d) OVER ()
+1
+1
+DROP TABLE t1;
+#
+# MDEV-22463: Element_type &Bounds_checked_array<Item *>::operator[](size_t) [Element_type = Item *]:
+# Assertion `n < m_size' failed
+#
+CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT, g int, h INT, i INT);
+INSERT INTO t1 SELECT seq,seq,seq,seq, seq,seq,seq,seq,seq FROM seq_1_to_5;
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+ROW_NUMBER() OVER w2
+1
+2
+3
+4
+5
+SELECT a FROM t1 ORDER BY ROW_NUMBER() OVER (PARTITION BY -1,1,0,2,3,4,5,6,7,8);
+a
+1
+2
+3
+4
+5
+SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4);
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+ROW_NUMBER() OVER w2
+1
+2
+3
+4
+5
+DROP TABLE t1;
+#
+# MDEV-18916: crash in Window_spec::print_partition() with decimals
+#
+SELECT cast((rank() over w1) as decimal (53,56));
+ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
+SELECT cast((rank() over w1) as decimal (53,30));
+ERROR HY000: Window specification with name 'w1' is not defined
+#
+# MDEV-15180: server crashed with NTH_VALUE()
+#
+CREATE TABLE t1 (i1 int, a int);
+INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
+CREATE VIEW v1 AS (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) ;
+SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
+NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
+1
+1
+NULL
+NULL
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
+# End of 10.2 tests
+#
+#
+# MDEV-23867: select crash in compute_window_func
+#
+set @save_sort_buffer_size=@@sort_buffer_size;
+set sort_buffer_size= 2000;
+CREATE TABLE t1( a INT, b INT, c INT);
+INSERT INTO t1 select seq, seq, seq from seq_1_to_5000;
+CREATE TABLE t2( a INT, b INT, c INT);
+INSERT INTO t2 SELECT a, b, ROW_NUMBER() OVER (PARTITION BY b) FROM t1;
+SELECT COUNT(*), MAX(c) FROM t2;
+COUNT(*) MAX(c)
+5000 1
+CREATE TABLE t3( a INT, b INT, c INT);
+INSERT INTO t3 SELECT a, b, SUM(a) OVER () FROM t1;
+SELECT COUNT(*), MAX(c) FROM t3;
+COUNT(*) MAX(c)
+5000 12502500
+set @@sort_buffer_size=@save_sort_buffer_size;
+DROP TABLE t1,t2,t3;
+# end of 10.2 test
diff --git a/mysql-test/suite/encryption/t/create_or_replace.opt b/mysql-test/suite/encryption/t/create_or_replace.opt
index 7d3f2da7971..66892f34897 100644
--- a/mysql-test/suite/encryption/t/create_or_replace.opt
+++ b/mysql-test/suite/encryption/t/create_or_replace.opt
@@ -1 +1 @@
---innodb-tablespaces-encryption
+--innodb-encrypt-tables
diff --git a/mysql-test/suite/encryption/t/create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace.test
index 3b2970e5162..2ebd599d460 100644
--- a/mysql-test/suite/encryption/t/create_or_replace.test
+++ b/mysql-test/suite/encryption/t/create_or_replace.test
@@ -1,41 +1,10 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
---source include/not_embedded.inc
-# This is needed for longer testcase timeout at least P7/P8
---source include/big_test.inc
+--source include/count_sessions.inc
-#
-# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
-#
-SET default_storage_engine = InnoDB;
-
-CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
-CREATE TABLE t2 AS SELECT * FROM t1;
-
---disable_abort_on_error
---disable_warnings
---disable_query_log
+SET @save_threads = @@GLOBAL.innodb_encryption_threads;
-let $i = 40;
-while ($i)
-{
-SET GLOBAL innodb_encrypt_tables = ON;
-SET GLOBAL innodb_encryption_threads = 1;
-CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
-CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
-SET GLOBAL innodb_encryption_rotation_iops = 100;
-SET GLOBAL innodb_encrypt_tables = OFF;
-CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
-CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
-dec $i;
-}
-
---enable_abort_on_error
---enable_warnings
---enable_query_log
-
-drop table t1,t2;
-SET GLOBAL innodb_encryption_threads = 0;
+SET default_storage_engine = InnoDB;
#
# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
@@ -58,11 +27,9 @@ INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3
--connect (con1,localhost,root,,test)
--connect (con2,localhost,root,,test)
---disable_abort_on_error
---disable_warnings
--disable_query_log
-let $i = 500;
+let $i = 100;
while ($i)
{
connection con1;
@@ -101,42 +68,11 @@ dec $i;
}
--enable_query_log
+disconnect con1;
+disconnect con2;
connection default;
-drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
---disconnect con1
---disconnect con2
---enable_abort_on_error
---enable_warnings
-
-SET GLOBAL innodb_encrypt_tables = OFF;
-SET GLOBAL innodb_encryption_threads = 4;
-
---echo # Wait max 10 min for key encryption threads to decrypt all spaces
-let $cnt=600;
-while ($cnt)
-{
- let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
- if ($success)
- {
- let $cnt=0;
- }
- if (!$success)
- {
- real_sleep 1;
- dec $cnt;
- }
-}
-if (!$success)
-{
- SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
- SHOW STATUS LIKE 'innodb_encryption%';
- -- die Timeout waiting for encryption threads
-}
---echo # Success!
-
-SET GLOBAL innodb_encryption_threads = 0;
-SET GLOBAL innodb_encrypt_tables = OFF;
-
-# Make sure that all dirty pages are flushed
+drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
+table10_int_autoinc;
--- source include/restart_mysqld.inc
+SET GLOBAL innodb_encryption_threads = @save_threads;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/encryption/t/create_or_replace_big.opt b/mysql-test/suite/encryption/t/create_or_replace_big.opt
new file mode 100644
index 00000000000..7d3f2da7971
--- /dev/null
+++ b/mysql-test/suite/encryption/t/create_or_replace_big.opt
@@ -0,0 +1 @@
+--innodb-tablespaces-encryption
diff --git a/mysql-test/suite/encryption/t/create_or_replace_big.test b/mysql-test/suite/encryption/t/create_or_replace_big.test
new file mode 100644
index 00000000000..133bdfa3cb2
--- /dev/null
+++ b/mysql-test/suite/encryption/t/create_or_replace_big.test
@@ -0,0 +1,86 @@
+--source include/have_innodb.inc
+--source include/have_file_key_management_plugin.inc
+--source include/not_embedded.inc
+# This is needed for longer testcase timeout at least P7/P8
+--source include/big_test.inc
+
+#
+# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
+#
+SET default_storage_engine = InnoDB;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
+CREATE TABLE t2 AS SELECT * FROM t1;
+
+--disable_abort_on_error
+--disable_warnings
+--disable_query_log
+
+let $i = 40;
+while ($i)
+{
+SET GLOBAL innodb_encrypt_tables = ON;
+SET GLOBAL innodb_encryption_threads = 1;
+CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
+CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
+SET GLOBAL innodb_encryption_rotation_iops = 100;
+SET GLOBAL innodb_encrypt_tables = OFF;
+CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
+CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
+dec $i;
+}
+
+--enable_abort_on_error
+--enable_warnings
+--enable_query_log
+
+drop table t1,t2;
+SET GLOBAL innodb_encryption_threads = 0;
+
+#
+# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
+#
+
+SET GLOBAL innodb_encryption_threads = 4;
+
+CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
+INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
+
+CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
+
+CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
+
+INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL);
+INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
+INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
+INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
+
+--echo # Wait max 10 min for key encryption threads to decrypt all spaces
+let $cnt=600;
+while ($cnt)
+{
+ let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
+ if ($success)
+ {
+ let $cnt=0;
+ }
+ if (!$success)
+ {
+ real_sleep 1;
+ dec $cnt;
+ }
+}
+if (!$success)
+{
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
+ SHOW STATUS LIKE 'innodb_encryption%';
+ -- die Timeout waiting for encryption threads
+}
+--echo # Success!
+
+SET GLOBAL innodb_encryption_threads = 0;
+SET GLOBAL innodb_encrypt_tables = OFF;
+
+DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc;
+
+-- source include/restart_mysqld.inc
diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test
index 47da8525130..5423a70f5d9 100644
--- a/mysql-test/suite/encryption/t/innochecksum.test
+++ b/mysql-test/suite/encryption/t/innochecksum.test
@@ -63,7 +63,7 @@ let MYSQLD_DATADIR=`select @@datadir`;
--echo # We give 30 seconds to do a clean shutdown because we do not want
--echo # to redo apply the pages of t1.ibd at the time of recovery.
--echo # We want SQL to initiate the first access to t1.ibd.
-shutdown_server 30;
+shutdown_server;
--echo # Wait until disconnected.
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
index d902fa38508..5fe6f686576 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test
@@ -37,8 +37,10 @@ insert into innodb_compact select * from innodb_normal;
insert into innodb_dynamic select * from innodb_normal;
commit;
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
---source include/wait_condition.inc
+FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
--let $restart_parameters=--innodb-encrypt-tables=OFF
--source include/restart_mysqld.inc
@@ -52,8 +54,13 @@ alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEF
show create table innodb_compact;
alter table innodb_dynamic engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT page_compressed=DEFAULT;
show create table innodb_dynamic;
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
---source include/wait_condition.inc
+
+FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
+
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
drop procedure innodb_insert_proc;
drop table innodb_normal;
diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
index 5b472094653..a736c7292ad 100644
--- a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
+++ b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test
@@ -18,47 +18,34 @@ show create table innodb_compressed;
show create table innodb_dynamic;
show create table innodb_redundant;
-delimiter //;
-create procedure innodb_insert_proc (repeat_count int)
-begin
- declare current_num int;
- set current_num = 0;
- while current_num < repeat_count do
- insert into innodb_normal values(current_num, substring(MD5(RAND()), -64));
- set current_num = current_num + 1;
- end while;
-end//
-delimiter ;//
-commit;
+FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
-begin;
-call innodb_insert_proc(2000);
-insert into innodb_compact select * from innodb_normal;
-insert into innodb_compressed select * from innodb_normal;
-insert into innodb_dynamic select * from innodb_normal;
-insert into innodb_redundant select * from innodb_normal;
-commit;
-
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
---source include/wait_condition.inc
-
-# Note there that these variables are updated only when real I/O is done, thus they are not reliable
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+select variable_value > 0 from information_schema.global_status
+where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
--source include/restart_mysqld.inc
-update innodb_normal set c1 = c1 +1;
-update innodb_compact set c1 = c1 + 1;
-update innodb_compressed set c1 = c1 + 1;
-update innodb_dynamic set c1 = c1 + 1;
-update innodb_redundant set c1 = c1 + 1;
+BEGIN;
+INSERT INTO innodb_normal SET c1 = 1;
+INSERT INTO innodb_compact SET c1 = 1;
+INSERT INTO innodb_compressed SET c1 = 1;
+INSERT INTO innodb_dynamic SET c1 = 1;
+INSERT INTO innodb_redundant SET c1 = 1;
+COMMIT;
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
---source include/wait_condition.inc
+FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+select variable_name from information_schema.global_status
+where variable_value > 0 and variable_name
+IN ('INNODB_NUM_PAGES_ENCRYPTED','INNODB_NUM_PAGES_DECRYPTED');
SET GLOBAL innodb_encrypt_tables=OFF;
alter table innodb_compact engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
@@ -70,13 +57,12 @@ show create table innodb_dynamic;
alter table innodb_redundant engine=innodb encrypted=DEFAULT encryption_key_id=DEFAULT;
show create table innodb_redundant;
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED';
---source include/wait_condition.inc
-
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
-SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
+FLUSH TABLES innodb_normal FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compact FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_compressed FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
+FLUSH TABLES innodb_redundant FOR EXPORT; UNLOCK TABLES;
-drop procedure innodb_insert_proc;
drop table innodb_normal;
drop table innodb_compact;
drop table innodb_compressed;
diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
index 6c16afa28f4..c1a6ad38456 100644
--- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test
@@ -15,6 +15,8 @@ CREATE TEMPORARY TABLE t2(f1 CHAR(100), f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB
INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
SELECT variable_value > @old_encrypted FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
diff --git a/mysql-test/suite/encryption/t/innodb_encryption_tables.test b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
index bc762faf12e..d03bc890ba4 100644
--- a/mysql-test/suite/encryption/t/innodb_encryption_tables.test
+++ b/mysql-test/suite/encryption/t/innodb_encryption_tables.test
@@ -1,6 +1,8 @@
-- source include/have_innodb.inc
-- source include/have_example_key_management_plugin.inc
-- source include/not_embedded.inc
+# We can't run this test under valgrind as it 'takes forever'
+-- source include/not_valgrind.inc
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
diff --git a/mysql-test/suite/encryption/t/tempfiles_encrypted.opt b/mysql-test/suite/encryption/t/tempfiles_encrypted.opt
new file mode 100644
index 00000000000..81877a8d1c5
--- /dev/null
+++ b/mysql-test/suite/encryption/t/tempfiles_encrypted.opt
@@ -0,0 +1 @@
+--encrypt-tmp_files=ON
diff --git a/mysql-test/suite/encryption/t/tempfiles_encrypted.test b/mysql-test/suite/encryption/t/tempfiles_encrypted.test
new file mode 100644
index 00000000000..7ba63cedaaa
--- /dev/null
+++ b/mysql-test/suite/encryption/t/tempfiles_encrypted.test
@@ -0,0 +1,31 @@
+--echo #
+--echo # Tests when the temporary files are encrypted
+--echo #
+
+source include/have_file_key_management_plugin.inc;
+source include/have_sequence.inc;
+source include/have_innodb.inc;
+
+select @@encrypt_tmp_files;
+
+--source t/win.test
+
+--echo #
+--echo # MDEV-23867: select crash in compute_window_func
+--echo #
+
+set @save_sort_buffer_size=@@sort_buffer_size;
+
+set sort_buffer_size= 2000;
+CREATE TABLE t1( a INT, b INT, c INT);
+INSERT INTO t1 select seq, seq, seq from seq_1_to_5000;
+CREATE TABLE t2( a INT, b INT, c INT);
+INSERT INTO t2 SELECT a, b, ROW_NUMBER() OVER (PARTITION BY b) FROM t1;
+SELECT COUNT(*), MAX(c) FROM t2;
+CREATE TABLE t3( a INT, b INT, c INT);
+INSERT INTO t3 SELECT a, b, SUM(a) OVER () FROM t1;
+SELECT COUNT(*), MAX(c) FROM t3;
+set @@sort_buffer_size=@save_sort_buffer_size;
+DROP TABLE t1,t2,t3;
+
+--echo # end of 10.2 test
diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result
index 860fa8a2c4c..c0f3224e26f 100644
--- a/mysql-test/suite/engines/iuds/r/insert_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result
@@ -1896,9 +1896,13 @@ Warnings:
Warning 1264 Out of range value for column 'c1' at row 3
INSERT IGNORE INTO t5 VALUES('1e+52','-1e+52','1e+52',5),('1e-52','-1e-52','1e-52',6);
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
INSERT IGNORE INTO t5 VALUES('1e+53','-1e+53','1e+53',7),('1e-53','-1e-53','1e-53',8);
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
SELECT * FROM t5;
c1 c2 c3 c4
diff --git a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
index f277bce018e..e997f479466 100755
--- a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
+++ b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
################################################################################
#
# This script runs the transactional stress test "stress_tx_rr" against the
diff --git a/mysql-test/suite/funcs_1/lib/DataGen_local.pl b/mysql-test/suite/funcs_1/lib/DataGen_local.pl
index 738a73e0fd5..8ca74407141 100755
--- a/mysql-test/suite/funcs_1/lib/DataGen_local.pl
+++ b/mysql-test/suite/funcs_1/lib/DataGen_local.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
if ( (scalar(@ARGV) != 1 ) || ($ARGV[0] =~ /[^0-9]/i ) )
diff --git a/mysql-test/suite/funcs_1/lib/DataGen_modify.pl b/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
index 4675049ff0d..8ad8e619a20 100755
--- a/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
+++ b/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
if ( (scalar(@ARGV) != 2 ) || ($ARGV[0] =~ /[^0-9]/i ) )
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 8101f2a0df3..fd8e0ff338c 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -2099,7 +2099,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2115,7 +2115,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2169,7 +2169,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2185,7 +2185,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2689,7 +2689,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2706,7 +2706,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -2763,7 +2763,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2780,7 +2780,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -3055,7 +3055,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3071,7 +3071,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3125,7 +3125,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3141,7 +3141,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3416,7 +3416,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
@@ -3436,7 +3436,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3504,7 +3504,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -3524,7 +3524,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3784,7 +3784,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3801,7 +3801,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3860,7 +3860,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3877,7 +3877,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -4138,7 +4138,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4156,7 +4156,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4216,7 +4216,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4234,7 +4234,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4494,7 +4494,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4512,7 +4512,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4572,7 +4572,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4590,7 +4590,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
index 6819e2356c3..33778d60ffc 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result
@@ -488,8 +488,7 @@ DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
END//
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 'CHECK SQLSTATE '23000';
END;
-DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
-' at line 5
+DECLARE CONTINUE HANDLER FOR condname1 SET x1 = ...' at line 5
CREATE PROCEDURE h1 ()
BEGIN
DECLARE x1 INT DEFAULT 0;
@@ -522,8 +521,7 @@ SELECT 'end of 1';
end;//
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 'undo handler for sqlexception select '1';
select * from tqq;
-SELECT 'end of 1';
-' at line 3
+SELECT 'end of 1...' at line 3
create procedure p1 ()
begin
declare exit handler for sqlexception select 'exit handler 1';
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 0ce0130e727..1316988ffc3 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -3569,7 +3569,7 @@ DROP VIEW v1;
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH CASCADED CHECK ' at line 1
+FROM test.tb2 my_table WITH CASCADED CHE...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'SELECT AS F59, F60
@@ -3598,7 +3598,7 @@ FROM test.tb2 my_table WITH CASCADED CHECK OPTION VIEW v1' at line 1
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH LOCAL CHECK OPT' at line 1
+FROM test.tb2 my_table WITH LOCAL CHECK ...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'SELECT AS F59, F60
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result
index e36db395eb9..4d7c7b446e6 100644
--- a/mysql-test/suite/funcs_1/r/is_check_constraint.result
+++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result
@@ -119,3 +119,29 @@ disconnect con1;
connection default;
DROP USER boo1;
DROP USER boo2;
+#
+# MDEV-18440: Information_schema.check_constraints possible data leak
+#
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+SHOW GRANTS FOR foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%'
+GRANT SELECT (a) ON `db`.`t1` TO 'foo'@'%'
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def db t1 CONSTRAINT_1 `b` > 0
+CONNECT con1,localhost, foo,, db;
+SELECT a FROM t1;
+a
+1
+2
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+connection default;
+DROP USER foo;
+DROP DATABASE db;
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 193265433aa..282efe8e977 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', 'innodb_file_format_max') 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; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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', 'innodb_file_format_max') 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' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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_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; 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
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
@@ -213,7 +213,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', 'innodb_file_format_max') 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; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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', 'innodb_file_format_max') 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' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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_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; 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
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
@@ -229,7 +229,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', 'innodb_file_format_max') 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; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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', 'innodb_file_format_max') 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' AND variable_name != 'THREAD_POOL_SIZE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); 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.host, 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_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; 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
AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin
set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
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 9b390b071ba..a5595259881 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -2100,7 +2100,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2116,7 +2116,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2170,7 +2170,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2186,7 +2186,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2690,7 +2690,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2707,7 +2707,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -2764,7 +2764,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2781,7 +2781,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -3056,7 +3056,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3072,7 +3072,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3126,7 +3126,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3142,7 +3142,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3417,7 +3417,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
@@ -3437,7 +3437,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3505,7 +3505,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -3525,7 +3525,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3785,7 +3785,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3802,7 +3802,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3861,7 +3861,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3878,7 +3878,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -4139,7 +4139,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4157,7 +4157,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4217,7 +4217,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4235,7 +4235,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4495,7 +4495,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4513,7 +4513,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4573,7 +4573,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4591,7 +4591,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
index fe23f9de0c5..6e9615c284f 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result
@@ -489,8 +489,7 @@ DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
END//
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 'CHECK SQLSTATE '23000';
END;
-DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
-' at line 5
+DECLARE CONTINUE HANDLER FOR condname1 SET x1 = ...' at line 5
CREATE PROCEDURE h1 ()
BEGIN
DECLARE x1 INT DEFAULT 0;
@@ -523,8 +522,7 @@ SELECT 'end of 1';
end;//
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 'undo handler for sqlexception select '1';
select * from tqq;
-SELECT 'end of 1';
-' at line 3
+SELECT 'end of 1...' at line 3
create procedure p1 ()
begin
declare exit handler for sqlexception select 'exit handler 1';
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 0ca6e8d94d8..9f3fbd7bb1a 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -3570,7 +3570,7 @@ DROP VIEW v1;
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH CASCADED CHECK ' at line 1
+FROM test.tb2 my_table WITH CASCADED CHE...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'SELECT AS F59, F60
@@ -3599,7 +3599,7 @@ FROM test.tb2 my_table WITH CASCADED CHECK OPTION VIEW v1' at line 1
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH LOCAL CHECK OPT' at line 1
+FROM test.tb2 my_table WITH LOCAL CHECK ...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'SELECT AS F59, F60
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 9b390b071ba..a5595259881 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -2100,7 +2100,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2116,7 +2116,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2170,7 +2170,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -2186,7 +2186,7 @@ IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
-Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2690,7 +2690,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2707,7 +2707,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -2764,7 +2764,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
SHOW CREATE VIEW v1;
@@ -2781,7 +2781,7 @@ NULL NULL 1
18446744073709551615 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
Note 1105 Cast to unsigned converted negative integer to it's positive complement
DROP VIEW v1;
@@ -3056,7 +3056,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3072,7 +3072,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3126,7 +3126,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3142,7 +3142,7 @@ NULL NULL 1
-1 -1 5
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
-Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect INTEGER value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3417,7 +3417,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
@@ -3437,7 +3437,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3505,7 +3505,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -3525,7 +3525,7 @@ Warnings:
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1918 Encountered illegal value '' when converting to DECIMAL
-Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1918 Encountered illegal value '' when converting to DECIMAL
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -3785,7 +3785,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3802,7 +3802,7 @@ NULL 2
41:58:00 1 17:58 23
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -3861,7 +3861,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
@@ -3878,7 +3878,7 @@ NULL 2
41:58:00 1 17:58 21
Warnings:
Warning 1292 Truncated incorrect time value: ''
-Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Truncated incorrect time value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -4139,7 +4139,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4157,7 +4157,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 17
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4217,7 +4217,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4235,7 +4235,7 @@ NULL -1 5
2005-06-27 17:58:00 2005-06-27 17:58 15
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4495,7 +4495,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4513,7 +4513,7 @@ NULL -1 5
2005-06-27 2005-06-27 11
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
@@ -4573,7 +4573,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
SHOW CREATE VIEW v1;
@@ -4591,7 +4591,7 @@ NULL -1 5
2005-06-27 2005-06-27 9
Warnings:
Warning 1292 Incorrect datetime value: ''
-Warning 1292 Incorrect datetime value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
+Warning 1292 Incorrect datetime value: '<---------1000 characters----------------------------------------------------------------------------------------------------...'
Warning 1292 Incorrect datetime value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
Warning 1292 Incorrect datetime value: '-1'
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
index fe23f9de0c5..6e9615c284f 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result
@@ -489,8 +489,7 @@ DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
END//
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 'CHECK SQLSTATE '23000';
END;
-DECLARE CONTINUE HANDLER FOR condname1 SET x1 = 1;
-' at line 5
+DECLARE CONTINUE HANDLER FOR condname1 SET x1 = ...' at line 5
CREATE PROCEDURE h1 ()
BEGIN
DECLARE x1 INT DEFAULT 0;
@@ -523,8 +522,7 @@ SELECT 'end of 1';
end;//
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 'undo handler for sqlexception select '1';
select * from tqq;
-SELECT 'end of 1';
-' at line 3
+SELECT 'end of 1...' at line 3
create procedure p1 ()
begin
declare exit handler for sqlexception select 'exit handler 1';
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index b6537582055..a1d59e1c2f9 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -4072,7 +4072,7 @@ DROP VIEW v1;
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH CASCADED CHECK ' at line 1
+FROM test.tb2 my_table WITH CASCADED CHE...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH CASCADED CHECK OPTION;
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 'SELECT AS F59, F60
@@ -4101,7 +4101,7 @@ FROM test.tb2 my_table WITH CASCADED CHECK OPTION VIEW v1' at line 1
REPLACE OR CREATE VIEW v1 AS SELECT F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'OR CREATE VIEW v1 AS SELECT F59, F60
-FROM test.tb2 my_table WITH LOCAL CHECK OPT' at line 1
+FROM test.tb2 my_table WITH LOCAL CHECK ...' at line 1
CREATE OR REPLACE VIEW v1 SELECT AS F59, F60
FROM test.tb2 my_table WITH LOCAL CHECK OPTION;
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 'SELECT AS F59, F60
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 155442ad00b..ac48e20eaed 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -2854,11 +2854,11 @@ return f1' at line 1
CREATE FUNCTION char binary not null(f1 char binary not null) returns char binary not null
return f1;
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 'char binary not null(f1 char binary not null) returns char binary not null
-retur' at line 1
+re...' at line 1
CREATE FUNCTION char ascii not null(f1 char ascii not null) returns char ascii not null
return f1;
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 'char ascii not null(f1 char ascii not null) returns char ascii not null
-return f' at line 1
+retur...' at line 1
CREATE FUNCTION tinytext(f1 tinytext) returns tinytext
return f1;
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 'tinytext(f1 tinytext) returns tinytext
@@ -2885,7 +2885,7 @@ return f1' at line 1
CREATE FUNCTION mediumtext not null(f1 mediumtext not null) returns mediumtext not null
return f1;
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 'mediumtext not null(f1 mediumtext not null) returns mediumtext not null
-return f' at line 1
+retur...' at line 1
CREATE FUNCTION longtext not null(f1 longtext not null) returns longtext not null
return f1;
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 'longtext not null(f1 longtext not null) returns longtext not null
@@ -2917,7 +2917,7 @@ return f1' at line 1
CREATE FUNCTION mediumblob not null(f1 mediumblob not null) returns mediumblob not null
return f1;
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 'mediumblob not null(f1 mediumblob not null) returns mediumblob not null
-return f' at line 1
+retur...' at line 1
CREATE FUNCTION longblob not null(f1 longblob not null) returns longblob not null
return f1;
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 'longblob not null(f1 longblob not null) returns longblob not null
@@ -2944,7 +2944,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION tinyint unsigned zerofill(f1 tinyint unsigned zerofill) returns tinyint unsigned zerofill
return f1;
-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 'tinyint unsigned zerofill(f1 tinyint unsigned zerofill) returns tinyint unsigned' 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 'tinyint unsigned zerofill(f1 tinyint unsigned zerofill) returns tinyint unsig...' at line 1
CREATE FUNCTION smallint(f1 smallint) returns smallint
return f1;
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 'smallint(f1 smallint) returns smallint
@@ -2959,7 +2959,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION smallint unsigned zerofill(f1 smallint unsigned zerofill) returns smallint unsigned zerofill
return f1;
-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 'smallint unsigned zerofill(f1 smallint unsigned zerofill) returns smallint unsig' 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 'smallint unsigned zerofill(f1 smallint unsigned zerofill) returns smallint un...' at line 1
CREATE FUNCTION mediumint(f1 mediumint) returns mediumint
return f1;
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 'mediumint(f1 mediumint) returns mediumint
@@ -2974,7 +2974,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION mediumint unsigned zerofill(f1 mediumint unsigned zerofill) returns mediumint unsigned zerofill
return f1;
-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 'mediumint unsigned zerofill(f1 mediumint unsigned zerofill) returns mediumint un' 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 'mediumint unsigned zerofill(f1 mediumint unsigned zerofill) returns mediumint...' at line 1
CREATE FUNCTION int(f1 int) returns int
return f1;
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 'int(f1 int) returns int
@@ -3009,8 +3009,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION int unsigned zerofill(f1 int unsigned zerofill) returns int unsigned zerofill
return f1;
-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 'int unsigned zerofill(f1 int unsigned zerofill) returns int unsigned zerofill
-re' 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 'int unsigned zerofill(f1 int unsigned zerofill) returns int unsigned zerofill...' at line 1
CREATE FUNCTION bigint(f1 bigint) returns bigint
return f1;
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 'bigint(f1 bigint) returns bigint
@@ -3025,7 +3024,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION bigint unsigned zerofill(f1 bigint unsigned zerofill) returns bigint unsigned zerofill
return f1;
-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 'bigint unsigned zerofill(f1 bigint unsigned zerofill) returns bigint unsigned ze' 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 'bigint unsigned zerofill(f1 bigint unsigned zerofill) returns bigint unsigned...' at line 1
CREATE FUNCTION decimal(f1 decimal) returns decimal
return f1;
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 'decimal(f1 decimal) returns decimal
@@ -3040,7 +3039,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION decimal unsigned zerofill(f1 decimal unsigned zerofill) returns decimal unsigned zerofill
return f1;
-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 'decimal unsigned zerofill(f1 decimal unsigned zerofill) returns decimal unsigned' 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 'decimal unsigned zerofill(f1 decimal unsigned zerofill) returns decimal unsig...' at line 1
CREATE FUNCTION numeric(f1 numeric) returns numeric
return f1;
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 'numeric(f1 numeric) returns numeric
@@ -3055,7 +3054,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION numeric unsigned zerofill(f1 numeric unsigned zerofill) returns numeric unsigned zerofill
return f1;
-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 'numeric unsigned zerofill(f1 numeric unsigned zerofill) returns numeric unsigned' 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 'numeric unsigned zerofill(f1 numeric unsigned zerofill) returns numeric unsig...' at line 1
CREATE FUNCTION real(f1 real) returns real
return f1;
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 'real(f1 real) returns real
@@ -3070,7 +3069,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION real unsigned zerofill(f1 real unsigned zerofill) returns real unsigned zerofill
return f1;
-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 'real unsigned zerofill(f1 real unsigned zerofill) returns real unsigned zerofill' 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 'real unsigned zerofill(f1 real unsigned zerofill) returns real unsigned zerof...' at line 1
CREATE FUNCTION float(f1 float) returns float
return f1;
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 'float(f1 float) returns float
@@ -3085,7 +3084,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
return f1' at line 1
CREATE FUNCTION float unsigned zerofill(f1 float unsigned zerofill) returns float unsigned zerofill
return f1;
-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 'float unsigned zerofill(f1 float unsigned zerofill) returns float unsigned zerof' 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 'float unsigned zerofill(f1 float unsigned zerofill) returns float unsigned ze...' at line 1
CREATE FUNCTION date(f1 date) returns date
return f1;
DROP FUNCTION date;
@@ -3112,11 +3111,11 @@ return f1' at line 1
CREATE FUNCTION enum("1enum", "2enum")(f1 enum("1enum", "2enum")) returns enum("1enum", "2enum")
return f1;
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 '"1enum", "2enum")(f1 enum("1enum", "2enum")) returns enum("1enum", "2enum")
-retu' at line 1
+r...' at line 1
CREATE FUNCTION set("1set", "2set")(f1 set("1set", "2set")) returns set("1set", "2set")
return f1;
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 'set("1set", "2set")(f1 set("1set", "2set")) returns set("1set", "2set")
-return f' at line 1
+retur...' at line 1
DROP FUNCTION IF EXISTS fn1;
Warnings:
Note 1305 FUNCTION db_storedproc.fn1 does not exist
@@ -3801,7 +3800,7 @@ END//
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 '!_fn1( f1 char(20) ) returns int
BEGIN
SELECT * from t1 where f2 = f1;
-return 1;' at line 1
+return...' at line 1
CREATE FUNCTION fn1( f1 char(20) ) return int
BEGIN
SELECT * from t1 where f2 = f1;
@@ -5790,8 +5789,7 @@ END begin_label//
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 'BEGIN
declare x char;
declare y char;
-SELECT f1, f2 into x, y from t2 limit 1;
-E' at line 2
+SELECT f1, f2 into x, y from t2 limit 1...' at line 2
Testcase 4.2.11:
----------------
@@ -5905,7 +5903,7 @@ SELECT f1, f2 into x, y from t2 limit 1;
END//
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 'char x, y1 integer default 0;
declare char y;
-SELECT f1, f2 into x, y from t2 li' at line 3
+SELECT f1, f2 into x, y from t2...' at line 3
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6( )
BEGIN
@@ -6305,7 +6303,7 @@ declare decimal unsigned zerofill not null x;
SELECT f36 into x from tb1 limit 9998, 1;
END//
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 'decimal unsigned zerofill not null x;
-SELECT f36 into x from tb1 limit 9998, 1;' at line 3
+SELECT f36 into x from tb1 limit 9998,...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6367,7 +6365,7 @@ declare decimal (0) unsigned zerofill not null x;
SELECT f43 into x from tb1 limit 9998, 1;
END//
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 'decimal (0) unsigned zerofill not null x;
-SELECT f43 into x from tb1 limit 9998' at line 3
+SELECT f43 into x from tb1 limit 9...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6375,7 +6373,7 @@ declare decimal (64) unsigned zerofill not null x;
SELECT f44 into x from tb1 limit 9998, 1;
END//
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 'decimal (64) unsigned zerofill not null x;
-SELECT f44 into x from tb1 limit 999' at line 3
+SELECT f44 into x from tb1 limit ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6410,7 +6408,7 @@ declare decimal (63, 30) unsigned not null x;
SELECT f48 into x from tb1 limit 9998, 1;
END//
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 'decimal (63, 30) unsigned not null x;
-SELECT f48 into x from tb1 limit 9998, 1;' at line 3
+SELECT f48 into x from tb1 limit 9998,...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6427,7 +6425,7 @@ declare decimal (63, 30) zerofill not null x;
SELECT f50 into x from tb1 limit 9998, 1;
END//
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 'decimal (63, 30) zerofill not null x;
-SELECT f50 into x from tb1 limit 9998, 1;' at line 3
+SELECT f50 into x from tb1 limit 9998,...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6435,7 +6433,7 @@ declare decimal (00) unsigned zerofill not null x;
SELECT f51 into x from tb1 limit 9998, 1;
END//
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 'decimal (00) unsigned zerofill not null x;
-SELECT f51 into x from tb1 limit 999' at line 3
+SELECT f51 into x from tb1 limit ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6443,7 +6441,7 @@ declare decimal (63, 30) unsigned zerofill not null x;
SELECT f52 into x from tb1 limit 9998, 1;
END//
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 'decimal (63, 30) unsigned zerofill not null x;
-SELECT f52 into x from tb1 limit' at line 3
+SELECT f52 into x from tb1 li...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6478,7 +6476,7 @@ declare numeric unsigned zerofill not null x;
SELECT f56 into x from tb1 limit 9998, 1;
END//
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 'numeric unsigned zerofill not null x;
-SELECT f56 into x from tb1 limit 9998, 1;' at line 3
+SELECT f56 into x from tb1 limit 9998,...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6621,7 +6619,7 @@ declare numeric (63, 30) unsigned zerofill x;
SELECT f72 into x from tb2 limit 9998, 1;
END//
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 'numeric (63, 30) unsigned zerofill x;
-SELECT f72 into x from tb2 limit 9998, 1;' at line 3
+SELECT f72 into x from tb2 limit 9998,...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6728,8 +6726,7 @@ declare float unsigned zerofill not null x;
SELECT f84 into x from tb2 limit 9998, 1;
END//
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 'float unsigned zerofill not null x;
-SELECT f84 into x from tb2 limit 9998, 1;
-E' at line 3
+SELECT f84 into x from tb2 limit 9998, 1...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6791,7 +6788,7 @@ declare float(0) unsigned zerofill not null x;
SELECT f91 into x from tb2 limit 9998, 1;
END//
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 'float(0) unsigned zerofill not null x;
-SELECT f91 into x from tb2 limit 9998, 1' at line 3
+SELECT f91 into x from tb2 limit 9998...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6799,7 +6796,7 @@ declare float(23) unsigned zerofill not null x;
SELECT f92 into x from tb2 limit 9998, 1;
END//
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 'float(23) unsigned zerofill not null x;
-SELECT f92 into x from tb2 limit 9998, ' at line 3
+SELECT f92 into x from tb2 limit 999...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6861,7 +6858,7 @@ declare float(24) unsigned zerofill not null x;
SELECT f99 into x from tb2 limit 9998, 1;
END//
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 'float(24) unsigned zerofill not null x;
-SELECT f99 into x from tb2 limit 9998, ' at line 3
+SELECT f99 into x from tb2 limit 999...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -6869,7 +6866,7 @@ declare float(53) unsigned zerofill not null x;
SELECT f100 into x from tb2 limit 9998, 1;
END//
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 'float(53) unsigned zerofill not null x;
-SELECT f100 into x from tb2 limit 9998,' at line 3
+SELECT f100 into x from tb2 limit 99...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1( )
BEGIN
@@ -9358,7 +9355,7 @@ declare accessible condition for sqlstate '02000';
declare exit handler for add set @var2 = 1;
END//
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 'accessible condition for sqlstate '02000';
-declare exit handler for add set @var' at line 3
+declare exit handler for add set @...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9368,8 +9365,7 @@ declare add condition for sqlstate '02000';
declare exit handler for add set @var2 = 1;
END//
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 'add condition for sqlstate '02000';
-declare exit handler for add set @var2 = 1;
-' at line 3
+declare exit handler for add set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9379,8 +9375,7 @@ declare all condition for sqlstate '02000';
declare exit handler for all set @var2 = 1;
END//
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 'all condition for sqlstate '02000';
-declare exit handler for all set @var2 = 1;
-' at line 3
+declare exit handler for all set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9390,7 +9385,7 @@ declare alter condition for sqlstate '02000';
declare exit handler for alter set @var2 = 1;
END//
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 'alter condition for sqlstate '02000';
-declare exit handler for alter set @var2 =' at line 3
+declare exit handler for alter set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9400,7 +9395,7 @@ declare analyze condition for sqlstate '02000';
declare exit handler for analyze set @var2 = 1;
END//
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 'analyze condition for sqlstate '02000';
-declare exit handler for analyze set @va' at line 3
+declare exit handler for analyze set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9410,8 +9405,7 @@ declare and condition for sqlstate '02000';
declare exit handler for and set @var2 = 1;
END//
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 'and condition for sqlstate '02000';
-declare exit handler for and set @var2 = 1;
-' at line 3
+declare exit handler for and set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9421,8 +9415,7 @@ declare as condition for sqlstate '02000';
declare exit handler for as set @var2 = 1;
END//
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 'as condition for sqlstate '02000';
-declare exit handler for as set @var2 = 1;
-EN' at line 3
+declare exit handler for as set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9432,8 +9425,7 @@ declare asc condition for sqlstate '02000';
declare exit handler for asc set @var2 = 1;
END//
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 'asc condition for sqlstate '02000';
-declare exit handler for asc set @var2 = 1;
-' at line 3
+declare exit handler for asc set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9443,7 +9435,7 @@ declare asensitive condition for sqlstate '02000';
declare exit handler for asensitive set @var2 = 1;
END//
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 'asensitive condition for sqlstate '02000';
-declare exit handler for asensitive s' at line 3
+declare exit handler for asensitiv...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9453,7 +9445,7 @@ declare before condition for sqlstate '02000';
declare exit handler for before set @var2 = 1;
END//
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 'before condition for sqlstate '02000';
-declare exit handler for before set @var2' at line 3
+declare exit handler for before set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9463,7 +9455,7 @@ declare between condition for sqlstate '02000';
declare exit handler for between set @var2 = 1;
END//
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 'between condition for sqlstate '02000';
-declare exit handler for between set @va' at line 3
+declare exit handler for between set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9473,7 +9465,7 @@ declare bigint condition for sqlstate '02000';
declare exit handler for bigint set @var2 = 1;
END//
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 'bigint condition for sqlstate '02000';
-declare exit handler for bigint set @var2' at line 3
+declare exit handler for bigint set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9483,7 +9475,7 @@ declare binary condition for sqlstate '02000';
declare exit handler for binary set @var2 = 1;
END//
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 'binary condition for sqlstate '02000';
-declare exit handler for binary set @var2' at line 3
+declare exit handler for binary set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9493,7 +9485,7 @@ declare blob condition for sqlstate '02000';
declare exit handler for blob set @var2 = 1;
END//
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 'blob condition for sqlstate '02000';
-declare exit handler for blob set @var2 = 1' at line 3
+declare exit handler for blob set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9503,7 +9495,7 @@ declare both condition for sqlstate '02000';
declare exit handler for both set @var2 = 1;
END//
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 'both condition for sqlstate '02000';
-declare exit handler for both set @var2 = 1' at line 3
+declare exit handler for both set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9513,8 +9505,7 @@ declare by condition for sqlstate '02000';
declare exit handler for by set @var2 = 1;
END//
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 'by condition for sqlstate '02000';
-declare exit handler for by set @var2 = 1;
-EN' at line 3
+declare exit handler for by set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9524,7 +9515,7 @@ declare call condition for sqlstate '02000';
declare exit handler for CALL set @var2 = 1;
END//
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 'call condition for sqlstate '02000';
-declare exit handler for CALL set @var2 = 1' at line 3
+declare exit handler for CALL set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9534,7 +9525,7 @@ declare cascade condition for sqlstate '02000';
declare exit handler for cascade set @var2 = 1;
END//
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 'cascade condition for sqlstate '02000';
-declare exit handler for cascade set @va' at line 3
+declare exit handler for cascade set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9544,7 +9535,7 @@ declare case condition for sqlstate '02000';
declare exit handler for case set @var2 = 1;
END//
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 'case condition for sqlstate '02000';
-declare exit handler for case set @var2 = 1' at line 3
+declare exit handler for case set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9554,7 +9545,7 @@ declare change condition for sqlstate '02000';
declare exit handler for change set @var2 = 1;
END//
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 'change condition for sqlstate '02000';
-declare exit handler for change set @var2' at line 3
+declare exit handler for change set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9564,7 +9555,7 @@ declare char condition for sqlstate '02000';
declare exit handler for char set @var2 = 1;
END//
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 'char condition for sqlstate '02000';
-declare exit handler for char set @var2 = 1' at line 3
+declare exit handler for char set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9574,7 +9565,7 @@ declare character condition for sqlstate '02000';
declare exit handler for character set @var2 = 1;
END//
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 'character condition for sqlstate '02000';
-declare exit handler for character set' at line 3
+declare exit handler for character ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9584,7 +9575,7 @@ declare check condition for sqlstate '02000';
declare exit handler for check set @var2 = 1;
END//
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 'check condition for sqlstate '02000';
-declare exit handler for check set @var2 =' at line 3
+declare exit handler for check set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9594,7 +9585,7 @@ declare collate condition for sqlstate '02000';
declare exit handler for collate set @var2 = 1;
END//
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 'collate condition for sqlstate '02000';
-declare exit handler for collate set @va' at line 3
+declare exit handler for collate set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9604,7 +9595,7 @@ declare column condition for sqlstate '02000';
declare exit handler for column set @var2 = 1;
END//
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 'column condition for sqlstate '02000';
-declare exit handler for column set @var2' at line 3
+declare exit handler for column set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9614,7 +9605,7 @@ declare condition condition for sqlstate '02000';
declare exit handler for condition set @var2 = 1;
END//
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 'condition condition for sqlstate '02000';
-declare exit handler for condition set' at line 3
+declare exit handler for condition ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9630,7 +9621,7 @@ declare constraint condition for sqlstate '02000';
declare exit handler for constraint set @var2 = 1;
END//
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 'constraint condition for sqlstate '02000';
-declare exit handler for constraint s' at line 3
+declare exit handler for constrain...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9640,7 +9631,7 @@ declare continue condition for sqlstate '02000';
declare exit handler for continue set @var2 = 1;
END//
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 'condition for sqlstate '02000';
-declare exit handler for continue set @var2 = 1;' at line 3
+declare exit handler for continue set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9650,7 +9641,7 @@ declare convert condition for sqlstate '02000';
declare exit handler for convert set @var2 = 1;
END//
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 'convert condition for sqlstate '02000';
-declare exit handler for convert set @va' at line 3
+declare exit handler for convert set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9660,7 +9651,7 @@ declare create condition for sqlstate '02000';
declare exit handler for create set @var2 = 1;
END//
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 'create condition for sqlstate '02000';
-declare exit handler for create set @var2' at line 3
+declare exit handler for create set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9670,7 +9661,7 @@ declare cross condition for sqlstate '02000';
declare exit handler for cross set @var2 = 1;
END//
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 'cross condition for sqlstate '02000';
-declare exit handler for cross set @var2 =' at line 3
+declare exit handler for cross set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9680,7 +9671,7 @@ declare current_date condition for sqlstate '02000';
declare exit handler for current_date set @var2 = 1;
END//
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 'current_date condition for sqlstate '02000';
-declare exit handler for current_da' at line 3
+declare exit handler for current...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9690,7 +9681,7 @@ declare current_time condition for sqlstate '02000';
declare exit handler for current_time set @var2 = 1;
END//
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 'current_time condition for sqlstate '02000';
-declare exit handler for current_ti' at line 3
+declare exit handler for current...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9700,7 +9691,7 @@ declare current_timestamp condition for sqlstate '02000';
declare exit handler for current_timestamp set @var2 = 1;
END//
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 'current_timestamp condition for sqlstate '02000';
-declare exit handler for curre' at line 3
+declare exit handler for cu...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9710,7 +9701,7 @@ declare current_user condition for sqlstate '02000';
declare exit handler for current_user set @var2 = 1;
END//
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 'current_user condition for sqlstate '02000';
-declare exit handler for current_us' at line 3
+declare exit handler for current...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9720,7 +9711,7 @@ declare cursor condition for sqlstate '02000';
declare exit handler for cursor set @var2 = 1;
END//
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 'cursor condition for sqlstate '02000';
-declare exit handler for cursor set @var2' at line 3
+declare exit handler for cursor set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9730,7 +9721,7 @@ declare database condition for sqlstate '02000';
declare exit handler for database set @var2 = 1;
END//
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 'database condition for sqlstate '02000';
-declare exit handler for database set @' at line 3
+declare exit handler for database se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9740,7 +9731,7 @@ declare databases condition for sqlstate '02000';
declare exit handler for databases set @var2 = 1;
END//
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 'databases condition for sqlstate '02000';
-declare exit handler for databases set' at line 3
+declare exit handler for databases ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9750,7 +9741,7 @@ declare day_hour condition for sqlstate '02000';
declare exit handler for day_hour set @var2 = 1;
END//
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 'day_hour condition for sqlstate '02000';
-declare exit handler for day_hour set @' at line 3
+declare exit handler for day_hour se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9760,7 +9751,7 @@ declare day_microsecond condition for sqlstate '02000';
declare exit handler for day_microsecond set @var2 = 1;
END//
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 'day_microsecond condition for sqlstate '02000';
-declare exit handler for day_mic' at line 3
+declare exit handler for day_...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9770,7 +9761,7 @@ declare day_minute condition for sqlstate '02000';
declare exit handler for day_minute set @var2 = 1;
END//
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 'day_minute condition for sqlstate '02000';
-declare exit handler for day_minute s' at line 3
+declare exit handler for day_minut...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9780,7 +9771,7 @@ declare day_second condition for sqlstate '02000';
declare exit handler for day_second set @var2 = 1;
END//
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 'day_second condition for sqlstate '02000';
-declare exit handler for day_second s' at line 3
+declare exit handler for day_secon...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9790,8 +9781,7 @@ declare dec condition for sqlstate '02000';
declare exit handler for dec set @var2 = 1;
END//
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 'dec condition for sqlstate '02000';
-declare exit handler for dec set @var2 = 1;
-' at line 3
+declare exit handler for dec set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9801,7 +9791,7 @@ declare decimal condition for sqlstate '02000';
declare exit handler for decimal set @var2 = 1;
END//
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 'decimal condition for sqlstate '02000';
-declare exit handler for decimal set @va' at line 3
+declare exit handler for decimal set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9811,7 +9801,7 @@ declare declare condition for sqlstate '02000';
declare exit handler for declare set @var2 = 1;
END//
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 'declare condition for sqlstate '02000';
-declare exit handler for declare set @va' at line 3
+declare exit handler for declare set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9821,7 +9811,7 @@ declare default condition for sqlstate '02000';
declare exit handler for default set @var2 = 1;
END//
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 'default condition for sqlstate '02000';
-declare exit handler for default set @va' at line 3
+declare exit handler for default set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9831,7 +9821,7 @@ declare delayed condition for sqlstate '02000';
declare exit handler for delayed set @var2 = 1;
END//
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 'delayed condition for sqlstate '02000';
-declare exit handler for delayed set @va' at line 3
+declare exit handler for delayed set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9841,7 +9831,7 @@ declare delete condition for sqlstate '02000';
declare exit handler for delete set @var2 = 1;
END//
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 'delete condition for sqlstate '02000';
-declare exit handler for delete set @var2' at line 3
+declare exit handler for delete set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9851,7 +9841,7 @@ declare desc condition for sqlstate '02000';
declare exit handler for desc set @var2 = 1;
END//
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 'desc condition for sqlstate '02000';
-declare exit handler for desc set @var2 = 1' at line 3
+declare exit handler for desc set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9861,7 +9851,7 @@ declare describe condition for sqlstate '02000';
declare exit handler for describe set @var2 = 1;
END//
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 'describe condition for sqlstate '02000';
-declare exit handler for describe set @' at line 3
+declare exit handler for describe se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9871,7 +9861,7 @@ declare deterministic condition for sqlstate '02000';
declare exit handler for deterministic set @var2 = 1;
END//
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 'deterministic condition for sqlstate '02000';
-declare exit handler for determini' at line 3
+declare exit handler for determ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9881,7 +9871,7 @@ declare distinct condition for sqlstate '02000';
declare exit handler for distinct set @var2 = 1;
END//
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 'distinct condition for sqlstate '02000';
-declare exit handler for distinct set @' at line 3
+declare exit handler for distinct se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9891,7 +9881,7 @@ declare distinctrow condition for sqlstate '02000';
declare exit handler for distinctrow set @var2 = 1;
END//
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 'distinctrow condition for sqlstate '02000';
-declare exit handler for distinctrow' at line 3
+declare exit handler for distinct...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9901,8 +9891,7 @@ declare div condition for sqlstate '02000';
declare exit handler for div set @var2 = 1;
END//
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 'div condition for sqlstate '02000';
-declare exit handler for div set @var2 = 1;
-' at line 3
+declare exit handler for div set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9912,7 +9901,7 @@ declare double condition for sqlstate '02000';
declare exit handler for double set @var2 = 1;
END//
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 'double condition for sqlstate '02000';
-declare exit handler for double set @var2' at line 3
+declare exit handler for double set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9922,7 +9911,7 @@ declare drop condition for sqlstate '02000';
declare exit handler for drop set @var2 = 1;
END//
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 'drop condition for sqlstate '02000';
-declare exit handler for drop set @var2 = 1' at line 3
+declare exit handler for drop set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9932,7 +9921,7 @@ declare dual condition for sqlstate '02000';
declare exit handler for dual set @var2 = 1;
END//
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 'dual condition for sqlstate '02000';
-declare exit handler for dual set @var2 = 1' at line 3
+declare exit handler for dual set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9942,7 +9931,7 @@ declare each condition for sqlstate '02000';
declare exit handler for each set @var2 = 1;
END//
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 'each condition for sqlstate '02000';
-declare exit handler for each set @var2 = 1' at line 3
+declare exit handler for each set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9952,7 +9941,7 @@ declare else condition for sqlstate '02000';
declare exit handler for else set @var2 = 1;
END//
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 'else condition for sqlstate '02000';
-declare exit handler for else set @var2 = 1' at line 3
+declare exit handler for else set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9962,7 +9951,7 @@ declare elseif condition for sqlstate '02000';
declare exit handler for elseif set @var2 = 1;
END//
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 'elseif condition for sqlstate '02000';
-declare exit handler for elseif set @var2' at line 3
+declare exit handler for elseif set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9972,7 +9961,7 @@ declare enclosed condition for sqlstate '02000';
declare exit handler for enclosed set @var2 = 1;
END//
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 'enclosed condition for sqlstate '02000';
-declare exit handler for enclosed set @' at line 3
+declare exit handler for enclosed se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9982,7 +9971,7 @@ declare escaped condition for sqlstate '02000';
declare exit handler for escaped set @var2 = 1;
END//
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 'escaped condition for sqlstate '02000';
-declare exit handler for escaped set @va' at line 3
+declare exit handler for escaped set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -9992,7 +9981,7 @@ declare exists condition for sqlstate '02000';
declare exit handler for exists set @var2 = 1;
END//
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 'exists condition for sqlstate '02000';
-declare exit handler for exists set @var2' at line 3
+declare exit handler for exists set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10013,7 +10002,7 @@ declare explain condition for sqlstate '02000';
declare exit handler for explain set @var2 = 1;
END//
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 'explain condition for sqlstate '02000';
-declare exit handler for explain set @va' at line 3
+declare exit handler for explain set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10023,7 +10012,7 @@ declare false condition for sqlstate '02000';
declare exit handler for false set @var2 = 1;
END//
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 'false condition for sqlstate '02000';
-declare exit handler for false set @var2 =' at line 3
+declare exit handler for false set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10033,7 +10022,7 @@ declare fetch condition for sqlstate '02000';
declare exit handler for fetch set @var2 = 1;
END//
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 'fetch condition for sqlstate '02000';
-declare exit handler for fetch set @var2 =' at line 3
+declare exit handler for fetch set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10043,7 +10032,7 @@ declare float condition for sqlstate '02000';
declare exit handler for float set @var2 = 1;
END//
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 'float condition for sqlstate '02000';
-declare exit handler for float set @var2 =' at line 3
+declare exit handler for float set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10053,7 +10042,7 @@ declare float4 condition for sqlstate '02000';
declare exit handler for add set @var2 = 1;
END//
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 'float4 condition for sqlstate '02000';
-declare exit handler for add set @var2 = ' at line 3
+declare exit handler for add set @var2...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10063,7 +10052,7 @@ declare float8 condition for sqlstate '02000';
declare exit handler for add set @var2 = 1;
END//
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 'float8 condition for sqlstate '02000';
-declare exit handler for add set @var2 = ' at line 3
+declare exit handler for add set @var2...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10073,8 +10062,7 @@ declare for condition for sqlstate '02000';
declare exit handler for for set @var2 = 1;
END//
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 'for condition for sqlstate '02000';
-declare exit handler for for set @var2 = 1;
-' at line 3
+declare exit handler for for set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10084,7 +10072,7 @@ declare force condition for sqlstate '02000';
declare exit handler for force set @var2 = 1;
END//
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 'force condition for sqlstate '02000';
-declare exit handler for force set @var2 =' at line 3
+declare exit handler for force set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10094,7 +10082,7 @@ declare foreign condition for sqlstate '02000';
declare exit handler for foreign set @var2 = 1;
END//
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 'foreign condition for sqlstate '02000';
-declare exit handler for foreign set @va' at line 3
+declare exit handler for foreign set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10104,7 +10092,7 @@ declare from condition for sqlstate '02000';
declare exit handler for from set @var2 = 1;
END//
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 'from condition for sqlstate '02000';
-declare exit handler for from set @var2 = 1' at line 3
+declare exit handler for from set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10114,7 +10102,7 @@ declare fulltext condition for sqlstate '02000';
declare exit handler for fulltext set @var2 = 1;
END//
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 'fulltext condition for sqlstate '02000';
-declare exit handler for fulltext set @' at line 3
+declare exit handler for fulltext se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10124,7 +10112,7 @@ declare grant condition for sqlstate '02000';
declare exit handler for grant set @var2 = 1;
END//
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 'grant condition for sqlstate '02000';
-declare exit handler for grant set @var2 =' at line 3
+declare exit handler for grant set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10134,7 +10122,7 @@ declare group condition for sqlstate '02000';
declare exit handler for group set @var2 = 1;
END//
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 'group condition for sqlstate '02000';
-declare exit handler for group set @var2 =' at line 3
+declare exit handler for group set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10144,7 +10132,7 @@ declare having condition for sqlstate '02000';
declare exit handler for having set @var2 = 1;
END//
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 'having condition for sqlstate '02000';
-declare exit handler for having set @var2' at line 3
+declare exit handler for having set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10154,7 +10142,7 @@ declare high_priority condition for sqlstate '02000';
declare exit handler for high_priority set @var2 = 1;
END//
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 'high_priority condition for sqlstate '02000';
-declare exit handler for high_prio' at line 3
+declare exit handler for high_p...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10164,7 +10152,7 @@ declare hour_microsecond condition for sqlstate '02000';
declare exit handler for hour_microsecond set @var2 = 1;
END//
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 'hour_microsecond condition for sqlstate '02000';
-declare exit handler for hour_m' at line 3
+declare exit handler for hou...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10174,7 +10162,7 @@ declare hour_minute condition for sqlstate '02000';
declare exit handler for hour_minute set @var2 = 1;
END//
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 'hour_minute condition for sqlstate '02000';
-declare exit handler for hour_minute' at line 3
+declare exit handler for hour_min...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10184,7 +10172,7 @@ declare hour_second condition for sqlstate '02000';
declare exit handler for hour_second set @var2 = 1;
END//
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 'hour_second condition for sqlstate '02000';
-declare exit handler for hour_second' at line 3
+declare exit handler for hour_sec...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10194,8 +10182,7 @@ declare if condition for sqlstate '02000';
declare exit handler for if set @var2 = 1;
END//
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 'if condition for sqlstate '02000';
-declare exit handler for if set @var2 = 1;
-EN' at line 3
+declare exit handler for if set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10205,7 +10192,7 @@ declare ignore condition for sqlstate '02000';
declare exit handler for ignore set @var2 = 1;
END//
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 'ignore condition for sqlstate '02000';
-declare exit handler for ignore set @var2' at line 3
+declare exit handler for ignore set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10215,8 +10202,7 @@ declare in condition for sqlstate '02000';
declare exit handler for in set @var2 = 1;
END//
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 'in condition for sqlstate '02000';
-declare exit handler for in set @var2 = 1;
-EN' at line 3
+declare exit handler for in set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10226,7 +10212,7 @@ declare index condition for sqlstate '02000';
declare exit handler for index set @var2 = 1;
END//
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 'index condition for sqlstate '02000';
-declare exit handler for index set @var2 =' at line 3
+declare exit handler for index set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10236,7 +10222,7 @@ declare infile condition for sqlstate '02000';
declare exit handler for infile set @var2 = 1;
END//
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 'infile condition for sqlstate '02000';
-declare exit handler for infile set @var2' at line 3
+declare exit handler for infile set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10246,7 +10232,7 @@ declare inner condition for sqlstate '02000';
declare exit handler for inner set @var2 = 1;
END//
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 'inner condition for sqlstate '02000';
-declare exit handler for inner set @var2 =' at line 3
+declare exit handler for inner set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10256,7 +10242,7 @@ declare inout condition for sqlstate '02000';
declare exit handler for inout set @var2 = 1;
END//
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 'inout condition for sqlstate '02000';
-declare exit handler for inout set @var2 =' at line 3
+declare exit handler for inout set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10266,7 +10252,7 @@ declare insensitive condition for sqlstate '02000';
declare exit handler for insensitive set @var2 = 1;
END//
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 'insensitive condition for sqlstate '02000';
-declare exit handler for insensitive' at line 3
+declare exit handler for insensit...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10276,7 +10262,7 @@ declare insert condition for sqlstate '02000';
declare exit handler for insert set @var2 = 1;
END//
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 'insert condition for sqlstate '02000';
-declare exit handler for insert set @var2' at line 3
+declare exit handler for insert set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10286,8 +10272,7 @@ declare int condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;
-' at line 3
+declare exit handler for int set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10297,7 +10282,7 @@ declare int1 condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int1 condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;' at line 3
+declare exit handler for int set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10307,7 +10292,7 @@ declare int2 condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int2 condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;' at line 3
+declare exit handler for int set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10317,7 +10302,7 @@ declare int3 condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int3 condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;' at line 3
+declare exit handler for int set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10327,7 +10312,7 @@ declare int4 condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int4 condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;' at line 3
+declare exit handler for int set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10337,7 +10322,7 @@ declare int8 condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'int8 condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1;' at line 3
+declare exit handler for int set @var2 =...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10347,7 +10332,7 @@ declare integer condition for sqlstate '02000';
declare exit handler for integer set @var2 = 1;
END//
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 'integer condition for sqlstate '02000';
-declare exit handler for integer set @va' at line 3
+declare exit handler for integer set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10357,7 +10342,7 @@ declare interval condition for sqlstate '02000';
declare exit handler for interval set @var2 = 1;
END//
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 'interval condition for sqlstate '02000';
-declare exit handler for interval set @' at line 3
+declare exit handler for interval se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10367,7 +10352,7 @@ declare into condition for sqlstate '02000';
declare exit handler for into set @var2 = 1;
END//
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 'into condition for sqlstate '02000';
-declare exit handler for into set @var2 = 1' at line 3
+declare exit handler for into set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10377,8 +10362,7 @@ declare is condition for sqlstate '02000';
declare exit handler for is set @var2 = 1;
END//
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 'is condition for sqlstate '02000';
-declare exit handler for is set @var2 = 1;
-EN' at line 3
+declare exit handler for is set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10388,7 +10372,7 @@ declare iterate condition for sqlstate '02000';
declare exit handler for iterate set @var2 = 1;
END//
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 'iterate condition for sqlstate '02000';
-declare exit handler for iterate set @va' at line 3
+declare exit handler for iterate set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10398,7 +10382,7 @@ declare join condition for sqlstate '02000';
declare exit handler for join set @var2 = 1;
END//
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 'join condition for sqlstate '02000';
-declare exit handler for join set @var2 = 1' at line 3
+declare exit handler for join set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10408,8 +10392,7 @@ declare key condition for sqlstate '02000';
declare exit handler for key set @var2 = 1;
END//
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 'key condition for sqlstate '02000';
-declare exit handler for key set @var2 = 1;
-' at line 3
+declare exit handler for key set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10419,7 +10402,7 @@ declare keys condition for sqlstate '02000';
declare exit handler for keys set @var2 = 1;
END//
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 'keys condition for sqlstate '02000';
-declare exit handler for keys set @var2 = 1' at line 3
+declare exit handler for keys set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10429,7 +10412,7 @@ declare kill condition for sqlstate '02000';
declare exit handler for kill set @var2 = 1;
END//
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 'kill condition for sqlstate '02000';
-declare exit handler for kill set @var2 = 1' at line 3
+declare exit handler for kill set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10439,7 +10422,7 @@ declare leading condition for sqlstate '02000';
declare exit handler for leading set @var2 = 1;
END//
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 'leading condition for sqlstate '02000';
-declare exit handler for leading set @va' at line 3
+declare exit handler for leading set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10449,7 +10432,7 @@ declare leave condition for sqlstate '02000';
declare exit handler for leave set @var2 = 1;
END//
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 'leave condition for sqlstate '02000';
-declare exit handler for leave set @var2 =' at line 3
+declare exit handler for leave set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10459,7 +10442,7 @@ declare left condition for sqlstate '02000';
declare exit handler for left set @var2 = 1;
END//
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 'left condition for sqlstate '02000';
-declare exit handler for left set @var2 = 1' at line 3
+declare exit handler for left set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10469,7 +10452,7 @@ declare like condition for sqlstate '02000';
declare exit handler for like set @var2 = 1;
END//
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 'like condition for sqlstate '02000';
-declare exit handler for like set @var2 = 1' at line 3
+declare exit handler for like set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10479,7 +10462,7 @@ declare limit condition for sqlstate '02000';
declare exit handler for limit set @var2 = 1;
END//
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 'limit condition for sqlstate '02000';
-declare exit handler for limit set @var2 =' at line 3
+declare exit handler for limit set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10489,7 +10472,7 @@ declare linear condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'linear condition for sqlstate '02000';
-declare exit handler for int set @var2 = ' at line 3
+declare exit handler for int set @var2...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10499,7 +10482,7 @@ declare lines condition for sqlstate '02000';
declare exit handler for lines set @var2 = 1;
END//
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 'lines condition for sqlstate '02000';
-declare exit handler for lines set @var2 =' at line 3
+declare exit handler for lines set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10509,7 +10492,7 @@ declare load condition for sqlstate '02000';
declare exit handler for load set @var2 = 1;
END//
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 'load condition for sqlstate '02000';
-declare exit handler for load set @var2 = 1' at line 3
+declare exit handler for load set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10519,7 +10502,7 @@ declare localtime condition for sqlstate '02000';
declare exit handler for localtime set @var2 = 1;
END//
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 'localtime condition for sqlstate '02000';
-declare exit handler for localtime set' at line 3
+declare exit handler for localtime ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10529,7 +10512,7 @@ declare localtimestamp condition for sqlstate '02000';
declare exit handler for localtimestamp set @var2 = 1;
END//
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 'localtimestamp condition for sqlstate '02000';
-declare exit handler for localtim' at line 3
+declare exit handler for local...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10539,7 +10522,7 @@ declare lock condition for sqlstate '02000';
declare exit handler for lock set @var2 = 1;
END//
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 condition for sqlstate '02000';
-declare exit handler for lock set @var2 = 1' at line 3
+declare exit handler for lock set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10549,7 +10532,7 @@ declare long condition for sqlstate '02000';
declare exit handler for long set @var2 = 1;
END//
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 'long condition for sqlstate '02000';
-declare exit handler for long set @var2 = 1' at line 3
+declare exit handler for long set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10559,7 +10542,7 @@ declare longblob condition for sqlstate '02000';
declare exit handler for longblob set @var2 = 1;
END//
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 'longblob condition for sqlstate '02000';
-declare exit handler for longblob set @' at line 3
+declare exit handler for longblob se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10569,7 +10552,7 @@ declare longtext condition for sqlstate '02000';
declare exit handler for longtext set @var2 = 1;
END//
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 'longtext condition for sqlstate '02000';
-declare exit handler for longtext set @' at line 3
+declare exit handler for longtext se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10579,7 +10562,7 @@ declare loop condition for sqlstate '02000';
declare exit handler for loop set @var2 = 1;
END//
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 'loop condition for sqlstate '02000';
-declare exit handler for loop set @var2 = 1' at line 3
+declare exit handler for loop set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10589,7 +10572,7 @@ declare low_priority condition for sqlstate '02000';
declare exit handler for low_priority set @var2 = 1;
END//
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 'low_priority condition for sqlstate '02000';
-declare exit handler for low_priori' at line 3
+declare exit handler for low_pri...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10599,7 +10582,7 @@ declare master_ssl_verify_server_cert condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'master_ssl_verify_server_cert condition for sqlstate '02000';
-declare exit handl' at line 3
+declare exit ha...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10609,7 +10592,7 @@ declare match condition for sqlstate '02000';
declare exit handler for match set @var2 = 1;
END//
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 'match condition for sqlstate '02000';
-declare exit handler for match set @var2 =' at line 3
+declare exit handler for match set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10619,7 +10602,7 @@ declare mediumblob condition for sqlstate '02000';
declare exit handler for mediumblob set @var2 = 1;
END//
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 'mediumblob condition for sqlstate '02000';
-declare exit handler for mediumblob s' at line 3
+declare exit handler for mediumblo...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10629,7 +10612,7 @@ declare mediumint condition for sqlstate '02000';
declare exit handler for mediumint set @var2 = 1;
END//
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 'mediumint condition for sqlstate '02000';
-declare exit handler for mediumint set' at line 3
+declare exit handler for mediumint ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10639,7 +10622,7 @@ declare mediumtext condition for sqlstate '02000';
declare exit handler for mediumtext set @var2 = 1;
END//
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 'mediumtext condition for sqlstate '02000';
-declare exit handler for mediumtext s' at line 3
+declare exit handler for mediumtex...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10649,7 +10632,7 @@ declare middleint condition for sqlstate '02000';
declare exit handler for middleint set @var2 = 1;
END//
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 'middleint condition for sqlstate '02000';
-declare exit handler for middleint set' at line 3
+declare exit handler for middleint ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10659,7 +10642,7 @@ declare minute_microsecond condition for sqlstate '02000';
declare exit handler for minute_microsecond set @var2 = 1;
END//
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 'minute_microsecond condition for sqlstate '02000';
-declare exit handler for minu' at line 3
+declare exit handler for m...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10669,7 +10652,7 @@ declare minute_second condition for sqlstate '02000';
declare exit handler for minute_second set @var2 = 1;
END//
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 'minute_second condition for sqlstate '02000';
-declare exit handler for minute_se' at line 3
+declare exit handler for minute...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10679,8 +10662,7 @@ declare mod condition for sqlstate '02000';
declare exit handler for mod set @var2 = 1;
END//
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 'mod condition for sqlstate '02000';
-declare exit handler for mod set @var2 = 1;
-' at line 3
+declare exit handler for mod set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10690,7 +10672,7 @@ declare modifies condition for sqlstate '02000';
declare exit handler for modifies set @var2 = 1;
END//
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 'modifies condition for sqlstate '02000';
-declare exit handler for modifies set @' at line 3
+declare exit handler for modifies se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10700,7 +10682,7 @@ declare natural condition for sqlstate '02000';
declare exit handler for natural set @var2 = 1;
END//
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 'natural condition for sqlstate '02000';
-declare exit handler for natural set @va' at line 3
+declare exit handler for natural set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10710,8 +10692,7 @@ declare not condition for sqlstate '02000';
declare exit handler for not set @var2 = 1;
END//
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 'not condition for sqlstate '02000';
-declare exit handler for not set @var2 = 1;
-' at line 3
+declare exit handler for not set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10721,7 +10702,7 @@ declare no_write_to_binlog condition for sqlstate '02000';
declare exit handler for no_write_to_binlog set @var2 = 1;
END//
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 'no_write_to_binlog condition for sqlstate '02000';
-declare exit handler for no_w' at line 3
+declare exit handler for n...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10731,7 +10712,7 @@ declare null condition for sqlstate '02000';
declare exit handler for null set @var2 = 1;
END//
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 'null condition for sqlstate '02000';
-declare exit handler for null set @var2 = 1' at line 3
+declare exit handler for null set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10741,7 +10722,7 @@ declare numeric condition for sqlstate '02000';
declare exit handler for numeric set @var2 = 1;
END//
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 'numeric condition for sqlstate '02000';
-declare exit handler for numeric set @va' at line 3
+declare exit handler for numeric set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10751,8 +10732,7 @@ declare on condition for sqlstate '02000';
declare exit handler for on set @var2 = 1;
END//
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 'on condition for sqlstate '02000';
-declare exit handler for on set @var2 = 1;
-EN' at line 3
+declare exit handler for on set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10762,7 +10742,7 @@ declare optimize condition for sqlstate '02000';
declare exit handler for optimize set @var2 = 1;
END//
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 'optimize condition for sqlstate '02000';
-declare exit handler for optimize set @' at line 3
+declare exit handler for optimize se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10778,7 +10758,7 @@ declare optionally condition for sqlstate '02000';
declare exit handler for optionally set @var2 = 1;
END//
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 'optionally condition for sqlstate '02000';
-declare exit handler for optionally s' at line 3
+declare exit handler for optionall...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10788,8 +10768,7 @@ declare or condition for sqlstate '02000';
declare exit handler for or set @var2 = 1;
END//
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 'or condition for sqlstate '02000';
-declare exit handler for or set @var2 = 1;
-EN' at line 3
+declare exit handler for or set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10799,7 +10778,7 @@ declare order condition for sqlstate '02000';
declare exit handler for order set @var2 = 1;
END//
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 'order condition for sqlstate '02000';
-declare exit handler for order set @var2 =' at line 3
+declare exit handler for order set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10809,8 +10788,7 @@ declare out condition for sqlstate '02000';
declare exit handler for out set @var2 = 1;
END//
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 'out condition for sqlstate '02000';
-declare exit handler for out set @var2 = 1;
-' at line 3
+declare exit handler for out set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10820,7 +10798,7 @@ declare outer condition for sqlstate '02000';
declare exit handler for outer set @var2 = 1;
END//
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 'outer condition for sqlstate '02000';
-declare exit handler for outer set @var2 =' at line 3
+declare exit handler for outer set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10830,7 +10808,7 @@ declare outfile condition for sqlstate '02000';
declare exit handler for outfile set @var2 = 1;
END//
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 'outfile condition for sqlstate '02000';
-declare exit handler for outfile set @va' at line 3
+declare exit handler for outfile set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10840,7 +10818,7 @@ declare precision condition for sqlstate '02000';
declare exit handler for precision set @var2 = 1;
END//
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 'precision condition for sqlstate '02000';
-declare exit handler for precision set' at line 3
+declare exit handler for precision ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10850,7 +10828,7 @@ declare primary condition for sqlstate '02000';
declare exit handler for primary set @var2 = 1;
END//
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 'primary condition for sqlstate '02000';
-declare exit handler for primary set @va' at line 3
+declare exit handler for primary set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10860,7 +10838,7 @@ declare procedure condition for sqlstate '02000';
declare exit handler for procedure set @var2 = 1;
END//
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 'procedure condition for sqlstate '02000';
-declare exit handler for procedure set' at line 3
+declare exit handler for procedure ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10870,7 +10848,7 @@ declare purge condition for sqlstate '02000';
declare exit handler for purge set @var2 = 1;
END//
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 'purge condition for sqlstate '02000';
-declare exit handler for purge set @var2 =' at line 3
+declare exit handler for purge set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10880,7 +10858,7 @@ declare range condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'range condition for sqlstate '02000';
-declare exit handler for int set @var2 = 1' at line 3
+declare exit handler for int set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10890,7 +10868,7 @@ declare read condition for sqlstate '02000';
declare exit handler for read set @var2 = 1;
END//
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 'read condition for sqlstate '02000';
-declare exit handler for read set @var2 = 1' at line 3
+declare exit handler for read set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10900,7 +10878,7 @@ declare reads condition for sqlstate '02000';
declare exit handler for reads set @var2 = 1;
END//
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 'reads condition for sqlstate '02000';
-declare exit handler for reads set @var2 =' at line 3
+declare exit handler for reads set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10920,7 +10898,7 @@ declare read_write condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'read_write condition for sqlstate '02000';
-declare exit handler for int set @var' at line 3
+declare exit handler for int set @...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10930,7 +10908,7 @@ declare real condition for sqlstate '02000';
declare exit handler for real set @var2 = 1;
END//
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 'real condition for sqlstate '02000';
-declare exit handler for real set @var2 = 1' at line 3
+declare exit handler for real set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10940,7 +10918,7 @@ declare references condition for sqlstate '02000';
declare exit handler for references set @var2 = 1;
END//
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 'references condition for sqlstate '02000';
-declare exit handler for references s' at line 3
+declare exit handler for reference...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10950,7 +10928,7 @@ declare regexp condition for sqlstate '02000';
declare exit handler for regexp set @var2 = 1;
END//
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 'regexp condition for sqlstate '02000';
-declare exit handler for regexp set @var2' at line 3
+declare exit handler for regexp set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10960,7 +10938,7 @@ declare release condition for sqlstate '02000';
declare exit handler for int set @var2 = 1;
END//
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 'release condition for sqlstate '02000';
-declare exit handler for int set @var2 =' at line 3
+declare exit handler for int set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10970,7 +10948,7 @@ declare rename condition for sqlstate '02000';
declare exit handler for rename set @var2 = 1;
END//
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 'rename condition for sqlstate '02000';
-declare exit handler for rename set @var2' at line 3
+declare exit handler for rename set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10980,7 +10958,7 @@ declare repeat condition for sqlstate '02000';
declare exit handler for repeat set @var2 = 1;
END//
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 'repeat condition for sqlstate '02000';
-declare exit handler for repeat set @var2' at line 3
+declare exit handler for repeat set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -10990,7 +10968,7 @@ declare replace condition for sqlstate '02000';
declare exit handler for replace set @var2 = 1;
END//
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 'replace condition for sqlstate '02000';
-declare exit handler for replace set @va' at line 3
+declare exit handler for replace set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11000,7 +10978,7 @@ declare require condition for sqlstate '02000';
declare exit handler for require set @var2 = 1;
END//
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 'require condition for sqlstate '02000';
-declare exit handler for require set @va' at line 3
+declare exit handler for require set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11010,7 +10988,7 @@ declare restrict condition for sqlstate '02000';
declare exit handler for restrict set @var2 = 1;
END//
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 'restrict condition for sqlstate '02000';
-declare exit handler for restrict set @' at line 3
+declare exit handler for restrict se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11020,7 +10998,7 @@ declare return condition for sqlstate '02000';
declare exit handler for return set @var2 = 1;
END//
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 'return condition for sqlstate '02000';
-declare exit handler for return set @var2' at line 3
+declare exit handler for return set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11030,7 +11008,7 @@ declare revoke condition for sqlstate '02000';
declare exit handler for revoke set @var2 = 1;
END//
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 'revoke condition for sqlstate '02000';
-declare exit handler for revoke set @var2' at line 3
+declare exit handler for revoke set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11040,7 +11018,7 @@ declare right condition for sqlstate '02000';
declare exit handler for right set @var2 = 1;
END//
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 'right condition for sqlstate '02000';
-declare exit handler for right set @var2 =' at line 3
+declare exit handler for right set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11050,7 +11028,7 @@ declare rlike condition for sqlstate '02000';
declare exit handler for rlike set @var2 = 1;
END//
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 'rlike condition for sqlstate '02000';
-declare exit handler for rlike set @var2 =' at line 3
+declare exit handler for rlike set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11060,7 +11038,7 @@ declare schema condition for sqlstate '02000';
declare exit handler for schema set @var2 = 1;
END//
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 'schema condition for sqlstate '02000';
-declare exit handler for schema set @var2' at line 3
+declare exit handler for schema set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11070,7 +11048,7 @@ declare schemas condition for sqlstate '02000';
declare exit handler for schemas set @var2 = 1;
END//
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 'schemas condition for sqlstate '02000';
-declare exit handler for schemas set @va' at line 3
+declare exit handler for schemas set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11080,7 +11058,7 @@ declare second_microsecond condition for sqlstate '02000';
declare exit handler for second_microsecond set @var2 = 1;
END//
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 'second_microsecond condition for sqlstate '02000';
-declare exit handler for seco' at line 3
+declare exit handler for s...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11090,7 +11068,7 @@ declare select condition for sqlstate '02000';
declare exit handler for SELECT set @var2 = 1;
END//
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 'select condition for sqlstate '02000';
-declare exit handler for SELECT set @var2' at line 3
+declare exit handler for SELECT set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11100,7 +11078,7 @@ declare sensitive condition for sqlstate '02000';
declare exit handler for sensitive set @var2 = 1;
END//
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 'sensitive condition for sqlstate '02000';
-declare exit handler for sensitive set' at line 3
+declare exit handler for sensitive ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11110,7 +11088,7 @@ declare separator condition for sqlstate '02000';
declare exit handler for separator set @var2 = 1;
END//
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 'separator condition for sqlstate '02000';
-declare exit handler for separator set' at line 3
+declare exit handler for separator ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11120,8 +11098,7 @@ declare set condition for sqlstate '02000';
declare exit handler for set set @var2 = 1;
END//
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 'set condition for sqlstate '02000';
-declare exit handler for set set @var2 = 1;
-' at line 3
+declare exit handler for set set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11131,7 +11108,7 @@ declare show condition for sqlstate '02000';
declare exit handler for show set @var2 = 1;
END//
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 'show condition for sqlstate '02000';
-declare exit handler for show set @var2 = 1' at line 3
+declare exit handler for show set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11141,7 +11118,7 @@ declare smallint condition for sqlstate '02000';
declare exit handler for smallint set @var2 = 1;
END//
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 'smallint condition for sqlstate '02000';
-declare exit handler for smallint set @' at line 3
+declare exit handler for smallint se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11151,7 +11128,7 @@ declare spatial condition for sqlstate '02000';
declare exit handler for spatial set @var2 = 1;
END//
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 'spatial condition for sqlstate '02000';
-declare exit handler for spatial set @va' at line 3
+declare exit handler for spatial set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11161,7 +11138,7 @@ declare specific condition for sqlstate '02000';
declare exit handler for specific set @var2 = 1;
END//
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 'specific condition for sqlstate '02000';
-declare exit handler for specific set @' at line 3
+declare exit handler for specific se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11171,8 +11148,7 @@ declare sql condition for sqlstate '02000';
declare exit handler for sql set @var2 = 1;
END//
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 'sql condition for sqlstate '02000';
-declare exit handler for sql set @var2 = 1;
-' at line 3
+declare exit handler for sql set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11182,7 +11158,7 @@ declare sqlexception condition for sqlstate '02000';
declare exit handler for sqlexception set @var2 = 1;
END//
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 'sqlexception condition for sqlstate '02000';
-declare exit handler for sqlexcepti' at line 3
+declare exit handler for sqlexce...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11192,7 +11168,7 @@ declare sqlstate condition for sqlstate '02000';
declare exit handler for sqlstate set @var2 = 1;
END//
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 'sqlstate condition for sqlstate '02000';
-declare exit handler for sqlstate set @' at line 3
+declare exit handler for sqlstate se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11202,7 +11178,7 @@ declare sqlwarning condition for sqlstate '02000';
declare exit handler for sqlwarning set @var2 = 1;
END//
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 'sqlwarning condition for sqlstate '02000';
-declare exit handler for sqlwarning s' at line 3
+declare exit handler for sqlwarnin...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11212,7 +11188,7 @@ declare sql_big_result condition for sqlstate '02000';
declare exit handler for sql_big_result set @var2 = 1;
END//
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 'sql_big_result condition for sqlstate '02000';
-declare exit handler for sql_big_' at line 3
+declare exit handler for sql_b...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11222,7 +11198,7 @@ declare sql_calc_found_rows condition for sqlstate '02000';
declare exit handler for sql_calc_found_rows set @var2 = 1;
END//
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 'sql_calc_found_rows condition for sqlstate '02000';
-declare exit handler for sql' at line 3
+declare exit handler for ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11232,7 +11208,7 @@ declare sql_small_result condition for sqlstate '02000';
declare exit handler for sql_small_result set @var2 = 1;
END//
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 'sql_small_result condition for sqlstate '02000';
-declare exit handler for sql_sm' at line 3
+declare exit handler for sql...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11242,8 +11218,7 @@ declare ssl condition for sqlstate '02000';
declare exit handler for ssl set @var2 = 1;
END//
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 'ssl condition for sqlstate '02000';
-declare exit handler for ssl set @var2 = 1;
-' at line 3
+declare exit handler for ssl set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11253,7 +11228,7 @@ declare starting condition for sqlstate '02000';
declare exit handler for starting set @var2 = 1;
END//
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 'starting condition for sqlstate '02000';
-declare exit handler for starting set @' at line 3
+declare exit handler for starting se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11263,7 +11238,7 @@ declare straight_join condition for sqlstate '02000';
declare exit handler for straight_join set @var2 = 1;
END//
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 'straight_join condition for sqlstate '02000';
-declare exit handler for straight_' at line 3
+declare exit handler for straig...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11273,7 +11248,7 @@ declare table condition for sqlstate '02000';
declare exit handler for table set @var2 = 1;
END//
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 condition for sqlstate '02000';
-declare exit handler for table set @var2 =' at line 3
+declare exit handler for table set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11283,7 +11258,7 @@ declare terminated condition for sqlstate '02000';
declare exit handler for terminated set @var2 = 1;
END//
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 'terminated condition for sqlstate '02000';
-declare exit handler for terminated s' at line 3
+declare exit handler for terminate...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11293,7 +11268,7 @@ declare then condition for sqlstate '02000';
declare exit handler for then set @var2 = 1;
END//
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 'then condition for sqlstate '02000';
-declare exit handler for then set @var2 = 1' at line 3
+declare exit handler for then set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11303,7 +11278,7 @@ declare tinyblob condition for sqlstate '02000';
declare exit handler for tinyblob set @var2 = 1;
END//
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 'tinyblob condition for sqlstate '02000';
-declare exit handler for tinyblob set @' at line 3
+declare exit handler for tinyblob se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11313,7 +11288,7 @@ declare tinyint condition for sqlstate '02000';
declare exit handler for tinyint set @var2 = 1;
END//
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 'tinyint condition for sqlstate '02000';
-declare exit handler for tinyint set @va' at line 3
+declare exit handler for tinyint set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11323,7 +11298,7 @@ declare tinytext condition for sqlstate '02000';
declare exit handler for tinytext set @var2 = 1;
END//
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 'tinytext condition for sqlstate '02000';
-declare exit handler for tinytext set @' at line 3
+declare exit handler for tinytext se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11333,8 +11308,7 @@ declare to condition for sqlstate '02000';
declare exit handler for to set @var2 = 1;
END//
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 'to condition for sqlstate '02000';
-declare exit handler for to set @var2 = 1;
-EN' at line 3
+declare exit handler for to set @var2 = 1;...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11344,7 +11318,7 @@ declare trailing condition for sqlstate '02000';
declare exit handler for trailing set @var2 = 1;
END//
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 'trailing condition for sqlstate '02000';
-declare exit handler for trailing set @' at line 3
+declare exit handler for trailing se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11354,7 +11328,7 @@ declare trigger condition for sqlstate '02000';
declare exit handler for trigger set @var2 = 1;
END//
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 'trigger condition for sqlstate '02000';
-declare exit handler for trigger set @va' at line 3
+declare exit handler for trigger set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11364,7 +11338,7 @@ declare true condition for sqlstate '02000';
declare exit handler for true set @var2 = 1;
END//
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 'true condition for sqlstate '02000';
-declare exit handler for true set @var2 = 1' at line 3
+declare exit handler for true set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11374,7 +11348,7 @@ declare undo condition for sqlstate '02000';
declare exit handler for undo set @var2 = 1;
END//
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 'undo condition for sqlstate '02000';
-declare exit handler for undo set @var2 = 1' at line 3
+declare exit handler for undo set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11384,7 +11358,7 @@ declare union condition for sqlstate '02000';
declare exit handler for union set @var2 = 1;
END//
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 'union condition for sqlstate '02000';
-declare exit handler for union set @var2 =' at line 3
+declare exit handler for union set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11394,7 +11368,7 @@ declare unique condition for sqlstate '02000';
declare exit handler for unique set @var2 = 1;
END//
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 'unique condition for sqlstate '02000';
-declare exit handler for unique set @var2' at line 3
+declare exit handler for unique set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11404,7 +11378,7 @@ declare unlock condition for sqlstate '02000';
declare exit handler for unlock set @var2 = 1;
END//
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 'unlock condition for sqlstate '02000';
-declare exit handler for unlock set @var2' at line 3
+declare exit handler for unlock set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11414,7 +11388,7 @@ declare unsigned condition for sqlstate '02000';
declare exit handler for unsigned set @var2 = 1;
END//
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 'unsigned condition for sqlstate '02000';
-declare exit handler for unsigned set @' at line 3
+declare exit handler for unsigned se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11424,7 +11398,7 @@ declare update condition for sqlstate '02000';
declare exit handler for update set @var2 = 1;
END//
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 'update condition for sqlstate '02000';
-declare exit handler for update set @var2' at line 3
+declare exit handler for update set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11434,7 +11408,7 @@ declare usage condition for sqlstate '02000';
declare exit handler for usage set @var2 = 1;
END//
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 'usage condition for sqlstate '02000';
-declare exit handler for usage set @var2 =' at line 3
+declare exit handler for usage set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11444,8 +11418,7 @@ declare use condition for sqlstate '02000';
declare exit handler for USE set @var2 = 1;
END//
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 'use condition for sqlstate '02000';
-declare exit handler for USE set @var2 = 1;
-' at line 3
+declare exit handler for USE set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11455,7 +11428,7 @@ declare using condition for sqlstate '02000';
declare exit handler for using set @var2 = 1;
END//
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 'using condition for sqlstate '02000';
-declare exit handler for using set @var2 =' at line 3
+declare exit handler for using set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11465,7 +11438,7 @@ declare utc_date condition for sqlstate '02000';
declare exit handler for utc_date set @var2 = 1;
END//
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 'utc_date condition for sqlstate '02000';
-declare exit handler for utc_date set @' at line 3
+declare exit handler for utc_date se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11475,7 +11448,7 @@ declare utc_time condition for sqlstate '02000';
declare exit handler for utc_time set @var2 = 1;
END//
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 'utc_time condition for sqlstate '02000';
-declare exit handler for utc_time set @' at line 3
+declare exit handler for utc_time se...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11485,7 +11458,7 @@ declare utc_timestamp condition for sqlstate '02000';
declare exit handler for utc_timestamp set @var2 = 1;
END//
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 'utc_timestamp condition for sqlstate '02000';
-declare exit handler for utc_times' at line 3
+declare exit handler for utc_ti...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11495,7 +11468,7 @@ declare values condition for sqlstate '02000';
declare exit handler for values set @var2 = 1;
END//
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 'values condition for sqlstate '02000';
-declare exit handler for values set @var2' at line 3
+declare exit handler for values set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11505,7 +11478,7 @@ declare varbinary condition for sqlstate '02000';
declare exit handler for varbinary set @var2 = 1;
END//
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 'varbinary condition for sqlstate '02000';
-declare exit handler for varbinary set' at line 3
+declare exit handler for varbinary ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11515,7 +11488,7 @@ declare varchar condition for sqlstate '02000';
declare exit handler for varchar set @var2 = 1;
END//
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 'varchar condition for sqlstate '02000';
-declare exit handler for varchar set @va' at line 3
+declare exit handler for varchar set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11525,7 +11498,7 @@ declare varcharacter condition for sqlstate '02000';
declare exit handler for varcharacter set @var2 = 1;
END//
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 'varcharacter condition for sqlstate '02000';
-declare exit handler for varcharact' at line 3
+declare exit handler for varchar...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11535,7 +11508,7 @@ declare varying condition for sqlstate '02000';
declare exit handler for varying set @var2 = 1;
END//
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 'varying condition for sqlstate '02000';
-declare exit handler for varying set @va' at line 3
+declare exit handler for varying set ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11545,7 +11518,7 @@ declare when condition for sqlstate '02000';
declare exit handler for when set @var2 = 1;
END//
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 'when condition for sqlstate '02000';
-declare exit handler for when set @var2 = 1' at line 3
+declare exit handler for when set @var2 ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11555,7 +11528,7 @@ declare where condition for sqlstate '02000';
declare exit handler for where set @var2 = 1;
END//
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 'where condition for sqlstate '02000';
-declare exit handler for where set @var2 =' at line 3
+declare exit handler for where set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11565,7 +11538,7 @@ declare while condition for sqlstate '02000';
declare exit handler for while set @var2 = 1;
END//
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 'while condition for sqlstate '02000';
-declare exit handler for while set @var2 =' at line 3
+declare exit handler for while set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11586,7 +11559,7 @@ declare write condition for sqlstate '02000';
declare exit handler for write set @var2 = 1;
END//
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 'write condition for sqlstate '02000';
-declare exit handler for write set @var2 =' at line 3
+declare exit handler for write set @var...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11596,8 +11569,7 @@ declare xor condition for sqlstate '02000';
declare exit handler for xor set @var2 = 1;
END//
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 'xor condition for sqlstate '02000';
-declare exit handler for xor set @var2 = 1;
-' at line 3
+declare exit handler for xor set @var2 = ...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11607,7 +11579,7 @@ declare year_month condition for sqlstate '02000';
declare exit handler for year_month set @var2 = 1;
END//
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 'year_month condition for sqlstate '02000';
-declare exit handler for year_month s' at line 3
+declare exit handler for year_mont...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -11617,7 +11589,7 @@ declare zerofill condition for sqlstate '02000';
declare exit handler for zerofill set @var2 = 1;
END//
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 'zerofill condition for sqlstate '02000';
-declare exit handler for zerofill set @' at line 3
+declare exit handler for zerofill se...' at line 3
Testcase :
----------
@@ -11652,7 +11624,7 @@ set @x = 3;
END//
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 'undo handler for sqlstate '23000' set @x2 = 1;
set @x = 1;
-insert into t values ' at line 3
+insert into t valu...' at line 3
DROP PROCEDURE IF EXISTS handler1;
Warnings:
Note 1305 PROCEDURE db_storedproc.handler1 does not exist
@@ -11667,8 +11639,7 @@ set @x = 3;
END//
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 'handler for sqlstate '2300' set @x2 = 1;
set @x = 1;
-insert into t values (1);
-s' at line 3
+insert into t values (1)...' at line 3
DROP PROCEDURE IF EXISTS handler1;
Warnings:
Note 1305 PROCEDURE db_storedproc.handler1 does not exist
@@ -11683,8 +11654,7 @@ set @x = 3;
END//
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 'handler for sqlstate '2300' set @x2 = 1;
set @x = 1;
-insert into t values (1);
-s' at line 3
+insert into t values (1)...' at line 3
DROP PROCEDURE IF EXISTS handler1;
Warnings:
Note 1305 PROCEDURE db_storedproc.handler1 does not exist
@@ -11699,8 +11669,7 @@ set @x = 3;
END//
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 'handler for sqlstate '2300' set @x2 = 1;
set @x = 1;
-insert into t values (1);
-s' at line 3
+insert into t values (1)...' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -14498,7 +14467,7 @@ insert into tnull values( 1);
END//
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 '1234567890;
declare continue handler for cond1 set @var2 = 1;
-insert into tnull ' at line 3
+insert into tnu...' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -15347,7 +15316,7 @@ END case label1;
END//
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 'case
when action = 'delete' then
-delete from res_t3_itisalongname_1381742_itsav' at line 3
+delete from res_t3_itisalongname_1381742_it...' at line 3
DROP PROCEDURE IF EXISTS sp3;
CREATE PROCEDURE sp3( action char(20) )
BEGIN
@@ -15364,7 +15333,7 @@ END//
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 'then
delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
else
-set' at line 5
+...' at line 5
DROP PROCEDURE IF EXISTS sp3;
CREATE PROCEDURE sp3( action char(20) )
BEGIN
@@ -15379,7 +15348,7 @@ iterate label1;
END case;
END//
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 'then action = 'truncate' when
-truncate from res_t3_itisalongname_1381742_itsave' at line 6
+truncate from res_t3_itisalongname_1381742_its...' at line 6
DROP PROCEDURE IF EXISTS sp3;
CREATE PROCEDURE sp3( action char(20) )
BEGIN
@@ -15396,7 +15365,7 @@ delete from res_t3_itisalongname_1381742_itsaverylongname_1381742;
END case;
END//
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 'when 'delete' then
-delete from res_t3_itisalongname_1381742_itsaverylongname_13' at line 11
+delete from res_t3_itisalongname_1381742_itsaverylongname...' at line 11
DROP PROCEDURE IF EXISTS sp3;
CREATE PROCEDURE sp3( action char(20) )
BEGIN
@@ -15459,8 +15428,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
leave label1;
END if;
iterate label1;
-END loop label1;
-EN' at line 9
+END loop label1;...' at line 9
DROP PROCEDURE IF EXISTS sp4;
CREATE PROCEDURE sp4()
BEGIN
@@ -15480,7 +15448,7 @@ set count = count + 1;
if count > 20 then
leave label1;
END if;
-iterate lab' at line 6
+iterate ...' at line 6
DROP PROCEDURE IF EXISTS sp4;
CREATE PROCEDURE sp4()
BEGIN
@@ -15500,7 +15468,7 @@ leave label1;
else
set count=count+1;
END if;
-iterate lab' at line 6
+iterate ...' at line 6
DROP PROCEDURE IF EXISTS sp4;
CREATE PROCEDURE sp4()
BEGIN
@@ -15520,7 +15488,7 @@ if count > 20 then
leave label1;
else
set count=count+1;
-iterate label1;' at line 6
+iterate labe...' at line 6
DROP PROCEDURE IF EXISTS sp4;
CREATE PROCEDURE sp4()
BEGIN
@@ -15542,8 +15510,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
set count = 1;
label1: loop
if count > 20 then
-leave label1;
-' at line 7
+leave label...' at line 7
DROP PROCEDURE IF EXISTS sp4;
CREATE PROCEDURE sp4()
BEGIN
@@ -15603,7 +15570,7 @@ END//
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 'when case count = 1 then
set count = 10;
when count = 2 then
-set count = count' at line 3
+set count = co...' at line 3
DROP PROCEDURE IF EXISTS sp5;
CREATE PROCEDURE sp5(count int)
BEGIN
@@ -15618,7 +15585,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
when count = 1 then
set count = 10;
when count = 2 then
-set count = coun' at line 3
+set count = c...' at line 3
DROP PROCEDURE IF EXISTS sp5;
CREATE PROCEDURE sp5(count int)
BEGIN
@@ -15631,7 +15598,7 @@ END//
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 'when count = 1 then
set count = 10;
case when count = 2 then
-set count = count' at line 3
+set count = co...' at line 3
Testcase 4.3.6:
---------------
@@ -15663,7 +15630,7 @@ END//
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 'until count1 > 5
repeat
set count1 = count1 + 1;
-if count1 > 5 then leave label1' at line 4
+if count1 > 5 then leave lab...' at line 4
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6()
BEGIN
@@ -15677,7 +15644,7 @@ END//
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 'END repeat
set count1 = count1 + 1;
if count1 > 5 then leave label1; END if;
-unt' at line 4
+...' at line 4
DROP PROCEDURE IF EXISTS sp6;
CREATE PROCEDURE sp6()
BEGIN
@@ -15747,7 +15714,7 @@ END//
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 'END loop;
set @dummystring = 'temp value';
if count > 10 then leave label1;
-END ' at line 3
+E...' at line 3
DROP PROCEDURE IF EXISTS sp7;
CREATE PROCEDURE sp7()
BEGIN
@@ -15761,7 +15728,7 @@ END//
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 'iterate label1;
loop
set @dummystring = 'temp value';
-if count > 10 then leave l' at line 3
+if count > 10 then leav...' at line 3
Testcase 4.3.8:
--------------------------------------------------------------------------------
@@ -15889,7 +15856,7 @@ END//
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 'loop
if count1 > 2 then leave lable1;
END if;
-insert into res_t3_itisalongname_1' at line 4
+insert into res_t3_itisalongnam...' at line 4
Testcase 4.3.16:
----------------
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraint.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test
index 30a72d02b34..eadfd817832 100644
--- a/mysql-test/suite/funcs_1/t/is_check_constraint.test
+++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test
@@ -40,7 +40,7 @@ CREATE TABLE t1
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
+--sorted_result
SELECT * from information_schema.check_constraints;
ALTER TABLE t1
@@ -55,7 +55,7 @@ start_date DATE,
end_date DATE,
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
)ENGINE=Innodb;
- --sorted_result
+--sorted_result
SELECT * from information_schema.check_constraints;
ALTER TABLE t1
@@ -70,12 +70,12 @@ a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
- --sorted_result
+--sorted_result
SELECT * from information_schema.check_constraints;
DISCONNECT con1;
CONNECT(con2, localhost, boo2,, test);
- --sorted_result
+--sorted_result
SELECT * from information_schema.check_constraints;
DISCONNECT con2;
@@ -90,3 +90,28 @@ DISCONNECT con1;
--CONNECTION default
DROP USER boo1;
DROP USER boo2;
+
+--echo #
+--echo # MDEV-18440: Information_schema.check_constraints possible data leak
+--echo #
+
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+
+SHOW GRANTS FOR foo;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
+
+CONNECT(con1,localhost, foo,, db);
+SELECT a FROM t1;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
+
+--CONNECTION default
+
+DROP USER foo;
+DROP DATABASE db;
diff --git a/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl b/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
index 3b85ed02f5b..c0973a10950 100755
--- a/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
+++ b/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#################################################################################
# Author: Serge Kozlov #
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index f6853e35ca3..4d911c60a5e 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -10,22 +10,20 @@
#
##############################################################################
+MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
+MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
+MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-329 : MDEV-19962 Galera test failure on MW-329
-MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388
-galera_account_management : MariaDB 10.0 does not support ALTER USER
-galera_as_master_gtid : Requires MySQL GTID
-galera_as_master_gtid_change_master : Requires MySQL GTID
-galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
+galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
-galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
-galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
-galera_flush : MariaDB does not have global.thread_statistics
+galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
-galera_ist_mariabackup : MDEV-18829 test leaves port open
-galera_ist_progress : MDEV-15236 fails when trying to read transfer status
-galera_migrate : MariaDB does not support START SLAVE USER
+galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
+galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
+galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
galera_var_node_address : MDEV-20485 Galera test failure
galera_wan : MDEV-17259 Test failure on galera.galera_wan
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
+sql_log_bin : MDEV-21491 galera.sql_log_bin
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index b24f3603894..67e9893179f 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
@@ -12,18 +12,26 @@ wsrep_node_address=127.0.0.1
wsrep-sync-wait=15
[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
+
[mysqld.2]
+loose-innodb
#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'
@@ -36,7 +44,6 @@ 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'
-
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
index ac1ca34e242..28fa5095a56 100644
--- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
+++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
@@ -18,6 +18,7 @@ server-id=1
#sst_port=@OPT.port
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -39,6 +40,7 @@ server-id=2
#sst_port=@OPT.port
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -60,6 +62,7 @@ server-id=3
#sst_port=@OPT.port
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf
index 1c195afd54b..426a6ae6d92 100644
--- a/mysql-test/suite/galera/galera_4nodes.cnf
+++ b/mysql-test/suite/galera/galera_4nodes.cnf
@@ -16,6 +16,7 @@ wsrep-sync-wait=15
#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
@@ -25,6 +26,7 @@ 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;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
@@ -35,6 +37,7 @@ 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;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
@@ -45,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#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.4.#galera_port;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
index 7c0156052d8..21e7b3c88c3 100644
--- a/mysql-test/suite/galera/include/galera_have_debug_sync.inc
+++ b/mysql-test/suite/galera/include/galera_have_debug_sync.inc
@@ -3,7 +3,7 @@
--let $galera_have_debug_sync = `SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'`
--if (!$galera_have_debug_sync) {
- --skip "Test requires Galera debug library with debug_sync functionality"
+ --skip Test requires Galera debug library with debug_sync functionality
}
--enable_query_log
diff --git a/mysql-test/suite/galera/include/galera_st_clean_slave.inc b/mysql-test/suite/galera/include/galera_st_clean_slave.inc
index 3a49f4f6ad2..44cbf67fd12 100644
--- a/mysql-test/suite/galera/include/galera_st_clean_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_clean_slave.inc
@@ -102,12 +102,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;
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..4674fc7867f 100644
--- a/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_disconnect_slave.inc
@@ -92,12 +92,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave.inc b/mysql-test/suite/galera/include/galera_st_kill_slave.inc
index 0b96de55a32..a4d9e91e8be 100644
--- a/mysql-test/suite/galera/include/galera_st_kill_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_kill_slave.inc
@@ -96,12 +96,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc
index 44a1513fa6e..bb8c68bd181 100644
--- a/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc
+++ b/mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc
@@ -110,6 +110,9 @@ INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
@@ -117,6 +120,8 @@ COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc
index 6c09b0ceb0c..eeb6a15e0a3 100644
--- a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc
+++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc
@@ -12,6 +12,9 @@ INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
@@ -94,12 +97,18 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
ROLLBACK;
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COMMIT;
SET AUTOCOMMIT=ON;
--connection node_1
+--let $wait_condition = SELECT COUNT(*)=35 FROM t1
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 35 FROM t1;
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-20225.result b/mysql-test/suite/galera/r/MDEV-20225.result
new file mode 100644
index 00000000000..d769a3e021b
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-20225.result
@@ -0,0 +1,20 @@
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, f2 INT) ENGINE=InnoDB;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.f1);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL debug_dbug = 'd,sync.mdev_20225';
+DROP TRIGGER tr1;
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (NULL);
+connection node_2;
+SET GLOBAL debug_dbug = 'RESET';
+SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue';
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL wsrep_slave_threads = 1;
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/MDEV-22021.result b/mysql-test/suite/galera/r/MDEV-22021.result
new file mode 100644
index 00000000000..590fa518c3c
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22021.result
@@ -0,0 +1,55 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+DELETE FROM t1;
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp2;
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DELETE FROM t1;
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (5);
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO t1 VALUES (8);
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22707.result b/mysql-test/suite/galera/r/MDEV-22707.result
new file mode 100644
index 00000000000..a74844d7e12
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22707.result
@@ -0,0 +1,26 @@
+CREATE TABLE t1(f2 INT) ENGINE=InnoDB;
+connect node_1_applier_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+INSERT INTO t1 (f2) VALUES (2);
+connection node_1_applier_thd;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR continue';
+INSERT INTO t1 (f2) VALUES (1);
+connect node_1_flush_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET DEBUG_SYNC="now WAIT_FOR wsrep_before_replication_reached";
+SET GLOBAL debug_dbug = "+d,sync.wsrep_before_mdl_wait";
+FLUSH TABLES;
+connect node_1_sync_release_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL continue";
+SET DEBUG_SYNC = "RESET";
+connection node_1;
+connection node_1_flush_thd;
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result
index 0f6c0be25fe..6f7bdf3917a 100644
--- a/mysql-test/suite/galera/r/MW-284.result
+++ b/mysql-test/suite/galera/r/MW-284.result
@@ -1,4 +1,6 @@
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*");
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
@@ -6,6 +8,9 @@ SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON;
SET global wsrep_sync_wait=0;
connection node_3;
+SELECT @@wsrep_on;
+@@wsrep_on
+0
START SLAVE;
include/wait_for_slave_param.inc [Slave_IO_Running]
connection node_1;
@@ -22,9 +27,3 @@ connection node_3;
STOP SLAVE;
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;
-RESET MASTER;
-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-328C.result b/mysql-test/suite/galera/r/MW-328C.result
deleted file mode 100644
index f8d747c5df1..00000000000
--- a/mysql-test/suite/galera/r/MW-328C.result
+++ /dev/null
@@ -1,23 +0,0 @@
-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;
-CREATE PROCEDURE proc_update ()
-BEGIN
-DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
-SET SESSION wsrep_sync_wait = 0;
-WHILE 1 DO
-UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
-END WHILE;
-END|
-connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-connection node_1X;
-CALL proc_update();;
-connection node_2;
-SET SESSION wsrep_retry_autocommit = 10000;
-connection node_1;
-connection node_1X;
-Got one of the listed errors
-connection node_1;
-DROP PROCEDURE proc_update;
-DROP TABLE t1, t2;
-CALL mtr.add_suppression("conflict state ABORTED after post commit");
diff --git a/mysql-test/suite/galera/r/MW-336.result b/mysql-test/suite/galera/r/MW-336.result
index b91e73aaada..dc1f0763a3f 100644
--- a/mysql-test/suite/galera/r/MW-336.result
+++ b/mysql-test/suite/galera/r/MW-336.result
@@ -2,14 +2,27 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
SET GLOBAL wsrep_slave_threads = 10;
# Set slave threads to 10 step 1
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1);
connection node_1;
+# Wait until one of the appliers has exited
+SELECT VARIABLE_VALUE AS EXPECT_9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_9
+9
SET GLOBAL wsrep_slave_threads = 10;
# Set slave threads to 10 step 2
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
SET GLOBAL wsrep_slave_threads = 20;
# Set slave threads to 20
+SELECT VARIABLE_VALUE AS EXPECT_20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_20
+20
SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1);
@@ -22,28 +35,47 @@ INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10);
-connection node_1;
-SET GLOBAL wsrep_slave_threads = 10;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-11
-# Set slave threads to 10 step 3
-connection node_2;
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);
INSERT INTO t1 VALUES (16);
INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
+connection node_1;
+# Wait until 19 of the appliers has exited
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20
+SET GLOBAL wsrep_slave_threads = 10;
+# Set slave threads to 10 step 3
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
+connection node_1;
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
INSERT INTO t1 VALUES (21);
INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+INSERT INTO t1 VALUES (25);
+INSERT INTO t1 VALUES (26);
+INSERT INTO t1 VALUES (27);
+INSERT INTO t1 VALUES (28);
+INSERT INTO t1 VALUES (29);
+INSERT INTO t1 VALUES (30);
connection node_1;
+# Wait until slave threads back to 1
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
+1
SELECT COUNT(*) FROM t1;
COUNT(*)
-23
-SET GLOBAL wsrep_slave_threads = 1;
+30
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result
index 4b4b321c542..2785c1d0326 100644
--- a/mysql-test/suite/galera/r/MW-388.result
+++ b/mysql-test/suite/galera/r/MW-388.result
@@ -18,12 +18,10 @@ 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';
CALL insert_proc ();;
connection node_1a;
-SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
+SET SESSION wsrep_sync_wait = 0;
SET GLOBAL debug_dbug = "";
-SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2;
connection node_1;
diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result
index 83668339310..7335acc445a 100644
--- a/mysql-test/suite/galera/r/MW-44.result
+++ b/mysql-test/suite/galera/r/MW-44.result
@@ -1,24 +1,11 @@
connection node_1;
TRUNCATE TABLE mysql.general_log;
connection node_2;
-TRUNCATE TABLE mysql.general_log;
connection node_1;
-SELECT Argument FROM mysql.general_log;
-Argument
-SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET SESSION wsrep_osu_method=TOI;
-SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
-argument
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
-ALTER TABLE t1 ADD COLUMN f2 INTEGER
connection node_2;
-SELECT Argument FROM mysql.general_log;
-Argument
DROP TABLE t1;
-SET GLOBAL general_log='OFF';
-connection node_1;
-SET GLOBAL general_log='OFF';
diff --git a/mysql-test/suite/galera/r/galera_account_management.result b/mysql-test/suite/galera/r/galera_account_management.result
deleted file mode 100644
index 6c81d401136..00000000000
--- a/mysql-test/suite/galera/r/galera_account_management.result
+++ /dev/null
@@ -1,65 +0,0 @@
-connection node_1;
-CREATE USER user1, user2 IDENTIFIED BY 'password';
-connection node_2;
-SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
-COUNT(*) = 2
-1
-connection node_1;
-ALTER USER user1 PASSWORD EXPIRE;
-SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
-password_expired = 'Y'
-1
-connection node_2;
-SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
-password_expired = 'Y'
-1
-connection node_1;
-RENAME USER user2 TO user3;
-connection node_2;
-SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';
-COUNT(*) = 0
-1
-SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3';
-COUNT(*) = 1
-1
-connection node_1;
-SET PASSWORD FOR user3 = PASSWORD('foo');
-connection node_1;
-SELECT password != '' FROM mysql.user WHERE user = 'user3';
-password != ''
-1
-connection node_1;
-DROP USER user1, user3;
-connection node_2;
-SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2');
-COUNT(*) = 0
-1
-connection node_1;
-GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password';
-connection node_2;
-SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4';
-COUNT(*) = 1
-1
-SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4';
-Select_priv = 'Y'
-1
-connection node_1;
-CREATE USER user5;
-GRANT PROXY ON user4 TO user5;
-connection node_2;
-SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5';
-COUNT(*) = 1
-1
-connection node_1;
-REVOKE ALL PRIVILEGES ON *.* FROM user4;
-connection node_2;
-SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4';
-Select_priv = 'N'
-1
-connection node_1;
-REVOKE PROXY ON user4 FROM user5;
-connection node_2;
-SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5';
-COUNT(*) = 0
-1
-DROP USER user4, user5;
diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid.result b/mysql-test/suite/galera/r/galera_as_master_gtid.result
deleted file mode 100644
index 8dfe462d495..00000000000
--- a/mysql-test/suite/galera/r/galera_as_master_gtid.result
+++ /dev/null
@@ -1,59 +0,0 @@
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-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;
-STOP SLAVE;
-RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result b/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result
deleted file mode 100644
index 80fbccf58e2..00000000000
--- a/mysql-test/suite/galera/r/galera_as_master_gtid_change_master.result
+++ /dev/null
@@ -1,15 +0,0 @@
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1);
-INSERT INTO t1 VALUES(2);
-STOP SLAVE;
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-INSERT INTO t1 VALUES(3);
-INSERT INTO t1 VALUES(4);
-DROP TABLE t1;
-STOP SLAVE;
-RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_ctas.result b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
new file mode 100644
index 00000000000..13cbbc905e3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
@@ -0,0 +1,28 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_1;
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+connection node_1;
+CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE target AS SELECT * FROM source;
+connection node_2;
+connection node_3;
+connection node_1;
+DROP TABLE target;
+INSERT INTO source VALUES(1);
+CREATE TABLE target AS SELECT * FROM source;
+connection node_2;
+connection node_3;
+connection node_1;
+DROP TABLE source;
+DROP TABLE target;
+connection node_3;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
new file mode 100644
index 00000000000..bea76e19dbb
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
@@ -0,0 +1,35 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SELECT @@WSREP_ON;
+@@WSREP_ON
+0
+connection node_2;
+ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
+START SLAVE;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+connection node_2;
+gtid_binlog_state_equal
+0
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+gtid_binlog_state_equal
+0
+#cleanup
+connection node_1;
+DROP TABLE t1;
+connection node_2;
+connection node_3;
+connection node_1;
+reset master;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+reset master;
+connection node_3;
+reset master;
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..6d0bcd4204a 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,27 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
START SLAVE;
SET SESSION wsrep_sync_wait = 0;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+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;
+connection node_1;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+connection node_3;
expected_error
1
+connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_3;
+connection node_2;
START SLAVE;
+connection node_1;
DROP TABLE t1;
+connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query");
@@ -15,4 +29,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_1;
RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_preordered.result b/mysql-test/suite/galera/r/galera_as_slave_preordered.result
deleted file mode 100644
index 27a08e73491..00000000000
--- a/mysql-test/suite/galera/r/galera_as_slave_preordered.result
+++ /dev/null
@@ -1,19 +0,0 @@
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-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 INTEGER) ENGINE=InnoDB;
-SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
-COUNT(DISTINCT f1) = 2 * 100 * 10 * 10
-1
-SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
-COUNT(*) = 2 * 100 * 10 * 10
-1
-SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
-COUNT(DISTINCT f1) = 2 * 100 * 10 * 10
-1
-DROP TABLE t1;
-DROP TABLE ten;
-STOP SLAVE;
-RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
index d0fac1e3d14..432b56a94ce 100644
--- a/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
+++ b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
@@ -1,47 +1,44 @@
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
-CREATE PROCEDURE p1 ()
-BEGIN
-DECLARE x INT DEFAULT 1;
-DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
-WHILE 1 DO
-INSERT INTO t1 VALUES (DEFAULT);
-COMMIT;
-END WHILE;
-END|
-CALL p1();;
-connection node_2;
-CALL p1();;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
Killing server ...
-INSERT INTO t1 VALUES (DEFAULT);
-connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-connection node_1a;
-INSERT INTO t1 VALUES (DEFAULT);
connection node_1;
-Got one of the listed errors
-connection node_2;
-Got one of the listed errors
-connection node_1a;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
connection node_2a;
-count_equal
-1
-CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE
-2
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 2
-1
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE
-2
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 2
-1
-DROP PROCEDURE p1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+132
+connection node_2a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+132
+connection node_1;
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");
+disconnect node_1a;
+disconnect node_2a;
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..0b22f963b29 100644
--- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result
+++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
@@ -1,23 +1,41 @@
+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()
+CREATE PROCEDURE p1(repeat_count INT)
BEGIN
+DECLARE current_num int;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
-WHILE 1 DO
+SET current_num = 0;
+WHILE current_num < repeat_count DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
+SET current_num = current_num + 1;
END WHILE;
END|
+connection node_2;
connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-call p1;
-connection default;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
+connection node_1;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
+connection node_1_p1;
+connection node_1_p2;
+connection node_2_p1;
+connection node_2_p2;
+connection node_1;
drop table t1;
drop procedure p1;
+disconnect node_1_p1;
+disconnect node_1_p2;
+disconnect node_2_p1;
+disconnect node_2_p2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result b/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result
deleted file mode 100644
index 80ae3d0de2c..00000000000
--- a/mysql-test/suite/galera/r/galera_binlog_rows_query_log_events.result
+++ /dev/null
@@ -1,12 +0,0 @@
-SET GLOBAL binlog_rows_query_log_events=TRUE;
-CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
-UPDATE t1 SET f1 = 2 WHERE f1 = 1;
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
-COUNT(*) = 1
-1
-SET GLOBAL binlog_rows_query_log_events = 0;
-DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result
index 86135625a71..914cdffceed 100644
--- a/mysql-test/suite/galera/r/galera_drop_database.result
+++ b/mysql-test/suite/galera/r/galera_drop_database.result
@@ -11,9 +11,33 @@ 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';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
connection node_2;
connection node_1;
connection node_2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
connection node_1;
USE fts;
DROP TABLE fts_t1;
@@ -21,3 +45,4 @@ DROP TABLE fts_t2;
SHOW TABLES;
Tables_in_fts
DROP DATABASE fts;
+connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result
index fa33e75ff57..36441e15f7d 100644
--- a/mysql-test/suite/galera/r/galera_events2.result
+++ b/mysql-test/suite/galera/r/galera_events2.result
@@ -14,6 +14,7 @@ SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFIN
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND ENABLED NOT PRESERVE
connection node_2;
+set global wsrep_sync_wait=15;
# node_2 event should be there
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
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..a6c6504dc39 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,8 @@
+#
+# test phase with cascading foreign key through 3 tables
+#
+connection node_1;
+set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
@@ -19,14 +24,15 @@ INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
connection node_2;
+set wsrep_sync_wait=0;
DELETE FROM grandparent WHERE id = 1;
connection node_1;
-SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
-COUNT(*) = 0
-1
-SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
-COUNT(*) = 0
-1
+SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
+COUNT(*) COUNT(*) = 0
+0 1
+SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
+COUNT(*) COUNT(*) = 0
+0 1
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
new file mode 100644
index 00000000000..89613b2856a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
@@ -0,0 +1,67 @@
+#
+# test phase with foreign key of varchar type
+#
+connection node_1;
+CREATE TABLE parent (
+`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TABLE child (
+`id` int NOT NULL,
+`parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `parent_id` (`parent_id`),
+CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO parent VALUES ('row one'), ('row two');
+INSERT INTO child VALUES (1,'row one'), (2,'row two');
+connection node_2;
+DELETE FROM parent;
+connection node_1;
+SELECT COUNT(*), COUNT(*) = 0 FROM parent;
+COUNT(*) COUNT(*) = 0
+0 1
+SELECT COUNT(*), COUNT(*) = 0 FROM child;
+COUNT(*) COUNT(*) = 0
+0 1
+DROP TABLE child;
+DROP TABLE parent;
+#
+# test phase with MM conflict in FK cascade
+#
+connection node_1;
+set wsrep_retry_autocommit=0;
+CREATE TABLE parent (
+id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT NOT NULL PRIMARY KEY,
+j int default 0,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1);
+INSERT INTO child VALUES (1,0,1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_2;
+DELETE FROM parent;
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+update child set j=2;;
+connection node_1a;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "RESET";
+connection node_1;
+SELECT COUNT(*), COUNT(*) = 0 FROM parent;
+COUNT(*) COUNT(*) = 0
+0 1
+SELECT COUNT(*), COUNT(*) = 0 FROM child;
+COUNT(*) COUNT(*) = 0
+0 1
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_flush.result b/mysql-test/suite/galera/r/galera_flush.result
deleted file mode 100644
index 71226432eda..00000000000
--- a/mysql-test/suite/galera/r/galera_flush.result
+++ /dev/null
@@ -1,88 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-FLUSH DES_KEY_FILE;
-wsrep_last_committed_diff
-1
-FLUSH HOSTS;
-wsrep_last_committed_diff
-1
-SET GLOBAL wsrep_replicate_myisam = TRUE;
-INSERT INTO mysql.user VALUES('localhost','user1',PASSWORD('pass1'), '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,'mysql_native_password','','N','N','',0);
-FLUSH PRIVILEGES;
-DELETE FROM mysql.user WHERE user = 'user1';
-SET GLOBAL wsrep_replicate_myisam = FALSE;
-FLUSH PRIVILEGES;
-FLUSH QUERY CACHE;
-wsrep_last_committed_diff
-1
-FLUSH STATUS;
-wsrep_last_committed_diff
-1
-FLUSH USER_RESOURCES;
-wsrep_last_committed_diff
-1
-FLUSH TABLES;
-wsrep_last_committed_diff
-1
-CREATE TABLE t2 (f1 INTEGER);
-FLUSH TABLES t2;
-wsrep_last_committed_diff
-1
-FLUSH ERROR LOGS;
-wsrep_last_committed_diff
-1
-FLUSH SLOW LOGS;
-wsrep_last_committed_diff
-1
-FLUSH GENERAL LOGS;
-wsrep_last_committed_diff
-1
-FLUSH ENGINE LOGS;
-wsrep_last_committed_diff
-1
-FLUSH RELAY LOGS;
-wsrep_last_committed_diff
-1
-SET @userstat_old= @@userstat;
-SET GLOBAL userstat=ON;
-FLUSH CLIENT_STATISTICS;
-FLUSH INDEX_STATISTICS;
-FLUSH TABLE_STATISTICS;
-FLUSH USER_STATISTICS;
-wsrep_last_committed_diff
-1
-SET @old_thread_statistics= @@global.thread_statistics;
-SET GLOBAL thread_statistics= ON;
-FLUSH THREAD_STATISTICS;
-wsrep_last_committed_diff
-1
-FLUSH CHANGED_PAGE_BITMAPS;
-wsrep_last_committed_diff
-1
-CREATE TABLE t1 (f1 INTEGER);
-FLUSH LOGS;
-FLUSH TABLES WITH READ LOCK;
-UNLOCK TABLES;
-FLUSH TABLES t1 WITH READ LOCK;
-UNLOCK TABLES;
-FLUSH TABLES t1 FOR EXPORT;
-UNLOCK TABLES;
-wsrep_last_committed_diff
-1
-LOCK TABLES t1 WRITE;
-FLUSH TABLES t1;
-UNLOCK TABLES;
-wsrep_last_committed_diff
-1
-LOCK TABLES t1 READ;
-FLUSH TABLES t1;
-ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
-UNLOCK TABLES;
-wsrep_last_committed_diff
-1
-FLUSH TABLES t1;
-wsrep_last_committed_diff
-1
-DROP TABLE t1;
-DROP TABLE t2;
-SET GLOBAL userstat= @userstat_old;
-SET GLOBAL thread_statistics= @old_thread_statistics;
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..2a31893ca1d 100644
--- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
@@ -1,13 +1,11 @@
connection node_1;
+SET SESSION wsrep_on=OFF;
RESET MASTER;
+SET SESSION wsrep_on=ON;
SET SESSION binlog_format = 'STATEMENT';
-Warnings:
-Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION binlog_format = 'MIXED';
-Warnings:
-Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
INSERT INTO t1 VALUES (2);
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
Log_name Pos Event_type Server_id End_log_pos Info
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 588af5668bb..9b8408b1b58 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
@@ -17,10 +17,18 @@ connection node_2;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+connection node_2;
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
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 [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_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result
index acc5eae9876..0346abc5a6c 100644
--- a/mysql-test/suite/galera/r/galera_gtid.result
+++ b/mysql-test/suite/galera/r/galera_gtid.result
@@ -1,14 +1,12 @@
CREATE TABLE t1 (f1 INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
UPDATE t1 SET f1 = 2;
connection node_1;
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
-COUNT(*) = 1
-1
+SET SESSION wsrep_sync_wait = 15;
+SELECT * from t1;
+f1
+2
gtid_binlog_state_equal
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_progress.result b/mysql-test/suite/galera/r/galera_ist_progress.result
index 9fc7febbea5..ed36a217624 100644
--- a/mysql-test/suite/galera/r/galera_ist_progress.result
+++ b/mysql-test/suite/galera/r/galera_ist_progress.result
@@ -1,6 +1,10 @@
+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);
@@ -12,8 +16,13 @@ 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_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
index c81cecfae1c..d38d664b6fa 100644
--- a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
+++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
@@ -13,7 +13,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_load_data.result b/mysql-test/suite/galera/r/galera_load_data.result
index 8a7397c7cb5..bbfd14a98f6 100644
--- a/mysql-test/suite/galera/r/galera_load_data.result
+++ b/mysql-test/suite/galera/r/galera_load_data.result
@@ -1,7 +1,7 @@
connection node_1;
create database cardtest02;
use cardtest02;
-CREATE TABLE `cardtest_tbl` (
+CREATE TABLE cardtest_tbl (
`id` bigint(18) NOT NULL AUTO_INCREMENT,
`course` bigint(18) NOT NULL,
`name` varchar(200) DEFAULT NULL,
@@ -22,24 +22,29 @@ CREATE TABLE `cardtest_tbl` (
`type` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1324 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;
-LOCK TABLES `cardtest_tbl` WRITE;
-ALTER TABLE `cardtest_tbl` DISABLE KEYS;
+LOCK TABLES cardtest_tbl WRITE;
+ALTER TABLE cardtest_tbl DISABLE KEYS;
Warnings:
Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option
-INSERT INTO `cardtest_tbl` VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL);
-ALTER TABLE `cardtest_tbl` ENABLE KEYS;
+INSERT INTO cardtest_tbl VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL);
+ALTER TABLE cardtest_tbl ENABLE KEYS;
Warnings:
Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option
UNLOCK TABLES;
use cardtest02;
-select count(*) from cardtest_tbl;
-count(*)
+ANALYZE TABLE cardtest_tbl;
+Table Op Msg_type Msg_text
+cardtest02.cardtest_tbl analyze status OK
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
+EXPECT_301
301
connection node_2;
-set session wsrep_sync_wait=15;
use cardtest02;
-select count(*) from cardtest_tbl;
-count(*)
+ANALYZE TABLE cardtest_tbl;
+Table Op Msg_type Msg_text
+cardtest02.cardtest_tbl analyze status OK
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
+EXPECT_301
301
connection node_1;
use test;
diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result
index 2fb59fc200f..eb009a620e0 100644
--- a/mysql-test/suite/galera/r/galera_log_bin.result
+++ b/mysql-test/suite/galera/r/galera_log_bin.result
@@ -71,5 +71,3 @@ DROP TABLE t2;
#cleanup
connection node_1;
RESET MASTER;
-connection node_2;
-reset master;
diff --git a/mysql-test/suite/galera/r/galera_migrate.result b/mysql-test/suite/galera/r/galera_migrate.result
deleted file mode 100644
index aab3ffbd6b6..00000000000
--- a/mysql-test/suite/galera/r/galera_migrate.result
+++ /dev/null
@@ -1,79 +0,0 @@
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-INSERT INTO t1 VALUES (2);
-START SLAVE USER='root';
-Warnings:
-Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
-INSERT INTO t1 VALUES (3);
-INSERT INTO t1 VALUES (4);
-SET GLOBAL wsrep_cluster_address='gcomm://';
-INSERT INTO t1 VALUES (5);
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 1
-1
-INSERT INTO t1 VALUES (6);
-GRANT ALL PRIVILEGES ON *.* TO 'sst';
-SET GLOBAL wsrep_sst_auth = 'sst:';
-GRANT ALL PRIVILEGES ON *.* TO 'sst';
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 2
-1
-STOP SLAVE;
-RESET SLAVE ALL;
-STOP SLAVE;
-RESET SLAVE ALL;
-INSERT INTO t1 VALUES (7);
-INSERT INTO t1 VALUES (8);
-SELECT COUNT(*) = 8 FROM t1;
-COUNT(*) = 8
-1
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 2
-1
-SELECT COUNT(*) = 8 FROM t1;
-COUNT(*) = 8
-1
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 2
-1
-DROP TABLE t1;
-DROP TABLE t1;
-SET GLOBAL wsrep_provider = 'none';
-SET GLOBAL wsrep_sst_auth = '';
-SET GLOBAL wsrep_provider_options = '';
-DROP TABLE t1;
-DROP USER sst;
-SET GLOBAL wsrep_provider = 'none';
-SET GLOBAL wsrep_sst_method = 'rsync';
-SET GLOBAL wsrep_provider_options = '';
-SET GLOBAL wsrep_sst_receive_address = 'AUTO';
-DROP TABLE t1;
-DROP USER sst;
-CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
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 b21a9d0bdca..8d8f4c1a371 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -15,11 +15,11 @@ connection node_1;
connection node_1a;
connection node_2;
disconnect node_1a;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_30000 FROM t1;
+EXPECT_30000
30000
-SELECT COUNT(DISTINCT f1) FROM t1;
-COUNT(DISTINCT f1)
+SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
+EXPECT_30000
30000
connection default;
DROP TABLE t1;
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 0fd0f0b505a..445b818746a 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
@@ -16,6 +16,8 @@ COMMIT;
SET current_num = current_num + 1;
END WHILE;
END|
+call p1(1000);
+connection node_1;
connection node_1a;
connection node_1b;
connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result
new file mode 100644
index 00000000000..c21d1005293
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_partition.result
@@ -0,0 +1,424 @@
+connection node_1;
+call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+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;
+CREATE TABLE t1(
+id bigint unsigned NOT NULL AUTO_INCREMENT,
+dt datetime NOT NULL,
+PRIMARY KEY (id,dt),
+KEY dt_idx (dt)
+) ENGINE=InnoDB
+PARTITION BY RANGE( TO_DAYS(dt) ) (
+PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
+PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
+PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
+PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
+PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
+PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
+PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
+PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
+PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
+PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
+PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
+PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
+PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
+PARTITION rx2011 VALUES LESS THAN MAXVALUE);
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+DECLARE current_num int;
+SET current_num = 0;
+WHILE current_num < repeat_count do
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
+COMMIT;
+SET current_num = current_num + 1;
+END WHILE;
+END|
+insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
+insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
+insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
+insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
+insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
+insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
+insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
+insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
+insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
+insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
+insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
+insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
+insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
+insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
+insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
+insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
+insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
+insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
+insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
+insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
+insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
+insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
+insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
+insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
+insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
+insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
+insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
+insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
+insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
+insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
+insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
+insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
+insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
+insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
+insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
+insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
+insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
+insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
+insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
+insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
+insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
+insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
+insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
+insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
+insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
+insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
+insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
+insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
+insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
+insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
+insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
+insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
+insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
+insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
+insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
+insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
+insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
+insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
+insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
+insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
+insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
+insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
+insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
+insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
+insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
+insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
+insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
+insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
+insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
+insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
+insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
+insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
+insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
+insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
+insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
+insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
+insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
+insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
+insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
+insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
+insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
+insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
+insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
+insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
+insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
+insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
+insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
+insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
+insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
+insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
+insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
+insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
+insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
+insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
+insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
+insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
+insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
+insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
+insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
+insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
+insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
+insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
+insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
+insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
+insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
+insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
+insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
+insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
+insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
+insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
+insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
+insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
+insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
+insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
+insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
+insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
+insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
+insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
+insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
+insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
+insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
+insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
+insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
+insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
+insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
+insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
+insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
+insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
+insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
+insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
+insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
+insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
+insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
+insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
+insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
+insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
+insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
+insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
+insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
+insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
+insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
+insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
+insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
+insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
+insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
+insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
+insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
+insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
+insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
+insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
+insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
+insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
+insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
+insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
+insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
+insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
+insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
+insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
+insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
+insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
+insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
+insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
+insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
+insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
+insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
+insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
+insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
+insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
+insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
+insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
+insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
+insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
+insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
+insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
+insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
+insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
+insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
+insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
+insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
+insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
+insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
+insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
+insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
+insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
+insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
+insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
+insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
+insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
+insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
+insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
+insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
+insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
+insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
+insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
+insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
+insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
+insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
+insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
+insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
+insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
+insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
+insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
+insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
+insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
+insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
+insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
+insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
+insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
+insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
+insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
+insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
+insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
+insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
+insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
+insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
+insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
+insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
+insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
+insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
+insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
+insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
+insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
+insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
+insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
+insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
+insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
+insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
+insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
+insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
+insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
+insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
+insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
+insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
+insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
+insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
+insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
+insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
+insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
+insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
+insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
+insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
+insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
+insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
+insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
+insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
+insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
+insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
+insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
+insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
+insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
+insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
+insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
+insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
+insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
+insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
+insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
+insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
+insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
+insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
+insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
+insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
+insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
+insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
+insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
+insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
+insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
+insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
+insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
+insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
+insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
+insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
+insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
+insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
+insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
+insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
+insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
+insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
+insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
+insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
+insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
+insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
+insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
+insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
+insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
+insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
+insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
+insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
+insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
+insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
+insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
+insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
+insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
+insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
+insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
+insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
+insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
+insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
+insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
+insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
+insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
+insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
+insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
+insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
+insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
+insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
+insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
+insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
+insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
+insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
+insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
+insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
+insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
+insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
+insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
+insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
+insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
+insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
+insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
+insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
+insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
+insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
+insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
+insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
+insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
+insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
+insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
+insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
+insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
+insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
+insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
+insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
+insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
+insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
+insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
+insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
+insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
+insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
+insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
+insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
+insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
+insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
+insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
+insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
+insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
+insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
+insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
+insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
+insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
+insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
+insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+350
+connection node_2;
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call p1(100);;
+connection node_3;
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call p1(100);;
+connection node_4;
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+call p1(100);;
+connection node_1;
+SET SESSION wsrep_OSU_method='RSU';
+SELECT @@wsrep_OSU_method;
+@@wsrep_OSU_method
+RSU
+SET SESSION sql_log_bin = 0;
+ALTER TABLE t1 DROP PARTITION rx2009xx;
+ALTER TABLE t1 DROP PARTITION rx201004;
+ALTER TABLE t1 DROP PARTITION rx201008;
+SET SESSION wsrep_OSU_METHOD='TOI';
+SELECT @@wsrep_OSU_method;
+@@wsrep_OSU_method
+TOI
+connection node_2;
+connection node_3;
+connection node_4;
+connection node_1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
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..2df08c3e4ff 100644
--- a/mysql-test/suite/galera/r/galera_rsu_add_pk.result
+++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
@@ -9,19 +9,19 @@ SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";
INSERT INTO t1 (f1) SELECT 200000 + (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;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
connection node_1;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";
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..a8b623cc37f 100644
--- a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
+++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
@@ -1,5 +1,5 @@
connection node_1;
-CREATE TABLE ten (f1 INTEGER);
+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 PRIMARY KEY) 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;
@@ -9,19 +9,19 @@ SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 DROP PRIMARY KEY;
SET SESSION wsrep_OSU_method = "TOI";
INSERT INTO t1 (f1) SELECT 200000 + (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;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) as expect_300000 FROM t1;
+expect_300000
+300000
+SELECT MAX(f1) as expect_299999 FROM t1;
+expect_299999
+299999
connection node_1;
-SELECT COUNT(*) = 300000 FROM t1;
-COUNT(*) = 300000
-1
-SELECT MAX(f1) = 299999 FROM t1;
-MAX(f1) = 299999
-1
+SELECT COUNT(*) as expect_300000 FROM t1;
+expect_300000
+300000
+SELECT MAX(f1) as expect_299999 FROM t1;
+expect_299999
+299999
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 DROP PRIMARY KEY;
SET SESSION wsrep_OSU_method = "TOI";
@@ -29,20 +29,20 @@ connection node_2;
INSERT INTO t1 (f1) VALUES (1);
INSERT INTO t1 (f1) VALUES (10);
connection node_1;
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1;
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10;
-COUNT(*) = 2
-1
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1;
+expect_2
+2
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 10;
+expect_2
+2
INSERT INTO t1 (f1) VALUES (100);
INSERT INTO t1 (f1) VALUES (1000);
connection node_2;
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100;
-COUNT(*) = 2
-1
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000;
-COUNT(*) = 2
-1
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 100;
+expect_2
+2
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1000;
+expect_2
+2
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result
new file mode 100644
index 00000000000..760617be5f7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_slave_replay.result
@@ -0,0 +1,95 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_1;
+RESET MASTER;
+connection node_2a;
+START SLAVE;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+set binlog_format=STATEMENT;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 a
+3 a
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+INSERT INTO test.t1 VALUES (2, 'b');
+connection node_1;
+COMMIT;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+3 c
+connection node_2a;
+set session wsrep_sync_wait=15;
+set session wsrep_sync_wait=0;
+wsrep_local_replays
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+SET DEBUG_SYNC = "RESET";
+#
+# test phase with real abort
+#
+connection node_1;
+set binlog_format=ROW;
+insert into t1 values (4, 'd');
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_3;
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+connection node_1;
+COMMIT;
+connection node_2a;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync';
+SET DEBUG_SYNC = "RESET";
+connection node_2a;
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+COUNT(*) = 1
+1
+set session wsrep_sync_wait=0;
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+connection node_1;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_sp_bf_abort.result b/mysql-test/suite/galera/r/galera_sp_bf_abort.result
new file mode 100644
index 00000000000..918a8a8bf1c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sp_bf_abort.result
@@ -0,0 +1,360 @@
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+CREATE PROCEDURE proc_update_insert()
+BEGIN
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction()
+BEGIN
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert_transaction;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Warnings:
+Error 1317 Query execution was interrupted
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert_transaction_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Warnings:
+Error 1317 Query execution was interrupted
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_update_insert_transaction_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Warnings:
+Error 1317 Query execution was interrupted
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict()
+BEGIN
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_insert_insert_conflict;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Got one of the listed errors
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT "Conflict exit handler";
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_insert_insert_conflict_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Conflict exit handler
+Conflict exit handler
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT "Conflict continue handler";
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+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;
+CALL proc_insert_insert_conflict_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Conflict continue handler
+Conflict continue handler
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+DROP PROCEDURE proc_update_insert;
+DROP PROCEDURE proc_update_insert_with_continue_handler;
+DROP PROCEDURE proc_update_insert_with_exit_handler;
+DROP PROCEDURE proc_update_insert_transaction;
+DROP PROCEDURE proc_update_insert_transaction_with_continue_handler;
+DROP PROCEDURE proc_update_insert_transaction_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict;
+DROP PROCEDURE proc_insert_insert_conflict_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict_with_continue_handler;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result
new file mode 100644
index 00000000000..b2a2005748f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result
@@ -0,0 +1,37 @@
+connection node_1;
+connection node_2;
+connection node_2;
+Shutting down server ...
+connection node_1;
+CREATE DATABASE `lost+found`;
+USE `lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `lost+found`.t1;
+id
+1
+2
+CREATE DATABASE `#mysql50#not_lost+found`;
+USE `#mysql50#not_lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+id
+1
+2
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+SELECT * FROM `lost+found`.t1;
+id
+1
+2
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+id
+1
+2
+connection node_1;
+DROP DATABASE `lost+found`;
+DROP DATABASE `#mysql50#not_lost+found`;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result
index 73285d723c1..c92da869a02 100644
--- a/mysql-test/suite/galera/r/galera_toi_truncate.result
+++ b/mysql-test/suite/galera/r/galera_toi_truncate.result
@@ -1,24 +1,22 @@
connection node_1;
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
-INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2;
-set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
-INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
-connection node_1;
-TRUNCATE TABLE t1;;
+INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
connection node_1;
+TRUNCATE TABLE t1;
connection node_2;
ERROR 40001: Deadlock: wsrep aborted transaction
-connection node_2;
-SELECT COUNT(*) = 0 FROM t1;
-COUNT(*) = 0
-1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
connection node_1;
-SELECT COUNT(*) = 0 FROM t1;
-COUNT(*) = 0
-1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_trigger.result b/mysql-test/suite/galera/r/galera_trigger.result
new file mode 100644
index 00000000000..112d3f39aa0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_trigger.result
@@ -0,0 +1,32 @@
+CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 100;
+END|
+INSERT INTO t1 VALUES (1);
+SELECT * from t1;
+id
+100
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 200;
+END|
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+SELECT * FROM t1;
+id
+100
+INSERT INTO t1 values (2);
+SELECT * FROM t1;
+id
+100
+200
+connection node_1;
+SELECT * FROM t1;
+id
+100
+200
+DROP TRIGGER tr1;
+DROP TABLE t1;
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 020efb7b8f1..50938d61a4b 100644
--- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result
+++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
connection node_1;
connection node_2;
connection node_2;
@@ -16,9 +17,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SELECT 1 FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1;
i
@@ -31,7 +32,7 @@ i variable_name variable_value
1 WSREP_DIRTY_READS ON
SET @@session.wsrep_dirty_reads=OFF;
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SELECT 1;
1
1
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..8750651612d 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,23 +1,28 @@
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SET GLOBAL innodb_disallow_writes=ON;
-INSERT INTO t1 VALUES (1);;
+INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_2;
+INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
connection node_1a;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-0
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-0
SET GLOBAL innodb_disallow_writes=OFF;
connection node_1;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_2;
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_1;
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
DROP TABLE t1;
+DROP TABLE ten;
+disconnect node_1a;
diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
index 3f0dd57aa3b..823407fbba7 100644
--- a/mysql-test/suite/galera/r/galera_var_notify_cmd.result
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -1,10 +1,11 @@
connection node_1;
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-COUNT(DISTINCT uuid) = 2
-1
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-MAX(size) = 2
-1
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
-COUNT(DISTINCT idx) = 2
-1
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+EXPECT_2
+2
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+DROP SCHEMA mtr_wsrep_notify;
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 caf98566595..22e2e6d764a 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,4 @@
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
CREATE TABLE t1 (f1 INTEGER);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
@@ -5,14 +6,14 @@ SET SESSION wsrep_reject_queries = ALL;
ERROR HY000: Variable 'wsrep_reject_queries' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_reject_queries = ALL;
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SET GLOBAL wsrep_reject_queries = ALL_KILL;
connection node_1a;
SELECT * FROM t1;
Got one of the listed errors
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
connection node_2;
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_wan_restart_ist.result b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
index 8a2a7d0818e..58ed9f057da 100644
--- a/mysql-test/suite/galera/r/galera_wan_restart_ist.result
+++ b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
@@ -4,11 +4,11 @@ connection node_1;
connection node_2;
connection node_3;
connection node_4;
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-VARIABLE_VALUE = 4
-1
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
connection node_1;
-CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
connection node_2;
INSERT INTO t1 VALUES (2);
@@ -20,60 +20,78 @@ connection node_3;
INSERT INTO t1 VALUES (13);
Shutting down server ...
connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
INSERT INTO t1 VALUES (11);
connection node_2;
INSERT INTO t1 VALUES (12);
connection node_4;
INSERT INTO t1 VALUES (14);
connection node_3;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
INSERT INTO t1 VALUES (131);
connection node_2;
INSERT INTO t1 VALUES (22);
Shutting down server ...
connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
INSERT INTO t1 VALUES (21);
connection node_3;
INSERT INTO t1 VALUES (23);
connection node_4;
INSERT INTO t1 VALUES (24);
connection node_2;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
INSERT INTO t1 VALUES (221);
connection node_4;
INSERT INTO t1 VALUES (34);
Shutting down server ...
connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
INSERT INTO t1 VALUES (31);
connection node_2;
INSERT INTO t1 VALUES (32);
connection node_3;
INSERT INTO t1 VALUES (33);
connection node_4;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
INSERT INTO t1 VALUES (341);
connection node_1;
-SELECT COUNT(*) = 19 FROM t1;
-COUNT(*) = 19
-1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
connection node_2;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
-SELECT COUNT(*) = 19 FROM t1;
-COUNT(*) = 19
-1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
connection node_3;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
-SELECT COUNT(*) = 19 FROM t1;
-COUNT(*) = 19
-1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
connection node_4;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
-SELECT COUNT(*) = 19 FROM t1;
-COUNT(*) = 19
-1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
connection node_1;
DROP TABLE t1;
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");
@@ -84,5 +102,6 @@ CALL mtr.add_suppression("There are no nodes in the same segment that will ever
CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
connection node_4;
CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
-disconnect node_2;
-disconnect node_1;
+connection node_1;
+disconnect node_3;
+disconnect node_4;
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..3ba34e8ea79 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -1,37 +1,38 @@
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
-VARIABLE_VALUE = 'ON'
-1
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
-VARIABLE_VALUE = 0
-1
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
-VARIABLE_VALUE = 'ON'
-1
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
-VARIABLE_VALUE = 4
-1
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
+connection node_1;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE
+Primary
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE
+ON
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+(VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 )
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE
+ON
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE
+4
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE
+Synced
connection node_2;
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-VARIABLE_VALUE = 'Primary'
-1
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
-VARIABLE_VALUE = 'ON'
-1
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
-VARIABLE_VALUE = 0
-1
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
-VARIABLE_VALUE = 'ON'
-1
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
-VARIABLE_VALUE = 4
-1
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-VARIABLE_VALUE = 'Synced'
-1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE
+Primary
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE
+ON
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+(VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 )
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE
+ON
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE
+4
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE
+Synced
diff --git a/mysql-test/suite/galera/r/mdev-22543.result b/mysql-test/suite/galera/r/mdev-22543.result
new file mode 100644
index 00000000000..02f2b632b32
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-22543.result
@@ -0,0 +1,17 @@
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 1);
+SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
+UPDATE t1 SET f2 = 2 WHERE f1 = 1;
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
+connection node_2;
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
+connection node_1;
+SET DEBUG_SYNC = "RESET";
+connection node_2;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm
index f3c04979705..8ef5965834f 100644
--- a/mysql-test/suite/galera/suite.pm
+++ b/mysql-test/suite/galera/suite.pm
@@ -65,6 +65,8 @@ push @::global_suppressions,
qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
qr(WSREP: Failed to remove page file .*),
qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
+ qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|,
+ qr|WSREP: Trying to continue unpaused monitor|,
);
bless { };
diff --git a/mysql-test/suite/galera/t/MDEV-20225.test b/mysql-test/suite/galera/t/MDEV-20225.test
new file mode 100644
index 00000000000..38efb0d6647
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-20225.test
@@ -0,0 +1,52 @@
+#
+# MDEV-20225 - Verify that DROP TRIGGER gets keys assigned corresponding
+# to all affected tables.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, f2 INT) ENGINE=InnoDB;
+
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.f1);
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL debug_dbug = 'd,sync.mdev_20225';
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+DROP TRIGGER tr1;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'
+--source include/wait_condition.inc
+
+
+--connection node_1
+INSERT INTO t1 VALUES (NULL);
+# We must rely on sleep here. If the bug is fixed, the second applier
+# is not allowed to go past apply monitor which would trigger the bug,
+# so there is no sync point or condition to wait.
+--sleep 1
+
+--connection node_2
+SET GLOBAL debug_dbug = 'RESET';
+SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue';
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL wsrep_slave_threads = 1;
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
+--source include/wait_condition.inc
+
+# Trigger should now be dropped on node_2.
+SHOW TRIGGERS;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/MDEV-22021.combinations b/mysql-test/suite/galera/t/MDEV-22021.combinations
new file mode 100644
index 00000000000..1eeb8fb4614
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-22021.combinations
@@ -0,0 +1,4 @@
+[binlogoff]
+
+[binlogon]
+log-bin
diff --git a/mysql-test/suite/galera/t/MDEV-22021.test b/mysql-test/suite/galera/t/MDEV-22021.test
new file mode 100644
index 00000000000..1f0433117c6
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-22021.test
@@ -0,0 +1,60 @@
+#
+# SAVEPOINT ROLLBACK can introduce incosistency in cluster.
+#
+
+--source include/galera_cluster.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_1
+DELETE FROM t1;
+
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp2;
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+
+SELECT COUNT(*) = 0 FROM t1;
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+DELETE FROM t1;
+
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (5);
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO t1 VALUES (8);
+COMMIT;
+
+SELECT COUNT(*) = 1 FROM t1;
+
+--connection node_2
+SELECT COUNT(*) = 1 FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MDEV-22707.test b/mysql-test/suite/galera/t/MDEV-22707.test
new file mode 100644
index 00000000000..feb44e5e44f
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-22707.test
@@ -0,0 +1,52 @@
+#
+# MDEV-22707 galera got stuck after flush tables
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+CREATE TABLE t1(f2 INT) ENGINE=InnoDB;
+
+--connect node_1_applier_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--send INSERT INTO t1 (f2) VALUES (2)
+
+--connection node_1_applier_thd
+# Wait for `sync.wsrep_apply_cb_reached` signal
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC = 'wsrep_before_replication SIGNAL wsrep_before_replication_reached WAIT_FOR continue';
+--send INSERT INTO t1 (f2) VALUES (1)
+
+--connect node_1_flush_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET DEBUG_SYNC="now WAIT_FOR wsrep_before_replication_reached";
+SET GLOBAL debug_dbug = "+d,sync.wsrep_before_mdl_wait";
+--send FLUSH TABLES
+
+--connect node_1_sync_release_thd, 127.0.0.1, root, , test, $NODE_MYPORT_1
+# First clear all DBUG points
+SET GLOBAL debug_dbug = "";
+# Now signal threads to continue execution
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET DEBUG_SYNC = "now SIGNAL continue";
+SET DEBUG_SYNC = "RESET";
+
+--connection node_1
+--reap
+
+--connection node_1_flush_thd
+--reap
+
+--connection node_2
+--reap
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test
index 5e17baa1bdb..568826db5b0 100644
--- a/mysql-test/suite/galera/t/MW-284.test
+++ b/mysql-test/suite/galera/t/MW-284.test
@@ -2,10 +2,13 @@
# MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR
#
+--source include/have_log_bin.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*");
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1;
--enable_query_log
@@ -18,11 +21,14 @@ 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
SET SESSION wsrep_on = ON;
+
#wsrep_sync_wait is set to zero because when slave tries to connect it it ask for queries like SELECT UNIX_TIMESTAMP() on node 1 which will fail, causing
#a warning in slave error log.
SET global wsrep_sync_wait=0;
--connection node_3
+SELECT @@wsrep_on;
+--sleep 1
START SLAVE;
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Connecting
@@ -50,8 +56,8 @@ INSERT INTO t1 VALUES (1);
--connection node_1
DROP TABLE t1;
-
--eval SET global wsrep_sync_wait=$wsrep_sync_wait_state
+
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
@@ -60,11 +66,5 @@ STOP SLAVE;
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
-RESET MASTER;
-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'); \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/MW-313-master.opt b/mysql-test/suite/galera/t/MW-313-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-313-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-313.cnf b/mysql-test/suite/galera/t/MW-313.cnf
new file mode 100644
index 00000000000..184900c58fd
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-313.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
+
+
diff --git a/mysql-test/suite/galera/t/MW-328A.cnf b/mysql-test/suite/galera/t/MW-328A.cnf
new file mode 100644
index 00000000000..a10ea88bdf2
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328A.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-debug=ON
+
+[mysqld.2]
+wsrep-debug=ON
diff --git a/mysql-test/suite/galera/t/MW-328A.test b/mysql-test/suite/galera/t/MW-328A.test
index dd692a292b8..a547823ced0 100644
--- a/mysql-test/suite/galera/t/MW-328A.test
+++ b/mysql-test/suite/galera/t/MW-328A.test
@@ -13,7 +13,7 @@
#
--source include/galera_cluster.inc
---source include/big_test.inc
+--source include/force_restart.inc
--source suite/galera/t/MW-328-header.inc
--connection node_2
diff --git a/mysql-test/suite/galera/t/MW-328B.cnf b/mysql-test/suite/galera/t/MW-328B.cnf
new file mode 100644
index 00000000000..a10ea88bdf2
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328B.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-debug=ON
+
+[mysqld.2]
+wsrep-debug=ON
diff --git a/mysql-test/suite/galera/t/MW-328B.test b/mysql-test/suite/galera/t/MW-328B.test
index 04503ce31e3..41581d9c239 100644
--- a/mysql-test/suite/galera/t/MW-328B.test
+++ b/mysql-test/suite/galera/t/MW-328B.test
@@ -8,7 +8,7 @@
#
--source include/galera_cluster.inc
---source include/big_test.inc
+--source include/force_restart.inc
--source suite/galera/t/MW-328-header.inc
--connection node_2
diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test
deleted file mode 100644
index 1594547d0de..00000000000
--- a/mysql-test/suite/galera/t/MW-328C.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# MW-328 Fix unnecessary/silent BF aborts
-#
-
-#
-# Make sure that a high value of wsrep_retry_autocommit
-# masks all deadlock errors
-#
-
---source include/galera_cluster.inc
---source include/big_test.inc
---source suite/galera/t/MW-328-header.inc
-
---connection node_2
---let $count = 100
-
-SET SESSION wsrep_retry_autocommit = 10000;
-
---disable_query_log
-
-while ($count)
-{
- --error 0
- INSERT IGNORE INTO t2 SELECT f2 FROM t1;
-
- --disable_result_log
- --error 0
- SELECT 1 FROM DUAL;
- --enable_result_log
-
- --dec $count
-}
-
---enable_query_log
-
---source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/MW-329-master.opt b/mysql-test/suite/galera/t/MW-329-master.opt
deleted file mode 100644
index 6565a6af3c4..00000000000
--- a/mysql-test/suite/galera/t/MW-329-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-retry-autocommit=0
diff --git a/mysql-test/suite/galera/t/MW-329.cnf b/mysql-test/suite/galera/t/MW-329.cnf
new file mode 100644
index 00000000000..10870a81547
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-329.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-retry-autocommit=0
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/MW-336.test b/mysql-test/suite/galera/t/MW-336.test
index 0e92094da6c..83943c7d8ea 100644
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@ -17,20 +17,31 @@ SET GLOBAL wsrep_slave_threads = 10;
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
SET GLOBAL wsrep_slave_threads = 1;
--connection node_2
INSERT INTO t1 VALUES (1);
--connection node_1
+--echo # Wait until one of the appliers has exited
+--let $wait_condition = SELECT VARIABLE_VALUE = 9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+--let $wait_condition_on_error_output = SELECT COUNT(*), 9 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
+--source include/wait_condition_with_debug.inc
+
+SELECT VARIABLE_VALUE AS EXPECT_9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
SET GLOBAL wsrep_slave_threads = 10;
# Note that above insert could be handled by one of the slave threads
--echo # Set slave threads to 10 step 2
---let $wait_condition = SELECT VARIABLE_VALUE >= 9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
---let $wait_condition_on_error_output = SELECT COUNT(*), 9 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
+--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
SET GLOBAL wsrep_slave_threads = 20;
--echo # Set slave threads to 20
@@ -38,6 +49,8 @@ SET GLOBAL wsrep_slave_threads = 20;
--let $wait_condition_on_error_output = SELECT COUNT(*), 20 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
+SELECT VARIABLE_VALUE AS EXPECT_20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
SET GLOBAL wsrep_slave_threads = 1;
--connection node_2
@@ -51,30 +64,57 @@ INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10);
-
---connection node_1
-SET GLOBAL wsrep_slave_threads = 10;
-SELECT COUNT(*) FROM t1;
---echo # Set slave threads to 10 step 3
---let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
---let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
---source include/wait_condition_with_debug.inc
-
---connection node_2
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);
INSERT INTO t1 VALUES (16);
INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
+
+--connection node_1
+--echo # Wait until 19 of the appliers has exited
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+--let $wait_condition_on_error_output = SELECT COUNT(*), 1 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
+--source include/wait_condition_with_debug.inc
+
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
+SELECT COUNT(*) FROM t1;
+
+SET GLOBAL wsrep_slave_threads = 10;
+--echo # Set slave threads to 10 step 3
+--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
+--source include/wait_condition_with_debug.inc
+
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
+--connection node_1
+SET GLOBAL wsrep_slave_threads = 1;
+
+--connection node_2
INSERT INTO t1 VALUES (21);
INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+INSERT INTO t1 VALUES (25);
+INSERT INTO t1 VALUES (26);
+INSERT INTO t1 VALUES (27);
+INSERT INTO t1 VALUES (28);
+INSERT INTO t1 VALUES (29);
+INSERT INTO t1 VALUES (30);
--connection node_1
+--echo # Wait until slave threads back to 1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+--let $wait_condition_on_error_output = SELECT COUNT(*), 1 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
+--source include/wait_condition_with_debug.inc
+
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+
SELECT COUNT(*) FROM t1;
-SET GLOBAL wsrep_slave_threads = 1;
+
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test
index fafdde092bf..670674bbae5 100644
--- a/mysql-test/suite/galera/t/MW-388.test
+++ b/mysql-test/suite/galera/t/MW-388.test
@@ -1,5 +1,7 @@
--source include/galera_cluster.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
@@ -31,6 +33,8 @@ DELIMITER ;|
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
+
--connection node_2
--send INSERT INTO t1 VALUES (1, 'node 2');
@@ -40,14 +44,14 @@ 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';
--send CALL insert_proc ();
--connection node_1a
-SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
+SET SESSION wsrep_sync_wait = 0;
+--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 wsrep_after_replication_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_2
diff --git a/mysql-test/suite/galera/t/MW-44-master.opt b/mysql-test/suite/galera/t/MW-44-master.opt
index 9b086195e8a..a15aa0a99d9 100644
--- a/mysql-test/suite/galera/t/MW-44-master.opt
+++ b/mysql-test/suite/galera/t/MW-44-master.opt
@@ -1,2 +1 @@
--log-output=TABLE
---general-log=OFF
diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test
index 8730631edc6..a2acfc57f6c 100644
--- a/mysql-test/suite/galera/t/MW-44.test
+++ b/mysql-test/suite/galera/t/MW-44.test
@@ -3,40 +3,30 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connection node_1
TRUNCATE TABLE mysql.general_log;
---sleep 1
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
---source include/wait_condition.inc
-TRUNCATE TABLE mysql.general_log;
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE '%mysql.general_log%'
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
---sleep 1
--connection node_1
---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
---source include/wait_condition.inc
-SELECT Argument FROM mysql.general_log;
-
-SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET SESSION wsrep_osu_method=TOI;
---let $wait_condition = SELECT COUNT(argument) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
---source include/wait_condition.inc
-
-SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
+--let $wait_condition = SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%"
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
--connection node_2
-SELECT Argument FROM mysql.general_log;
-DROP TABLE t1;
-SET GLOBAL general_log='OFF';
---connection node_1
-SET GLOBAL general_log='OFF';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%"
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-86-wait1-master.opt b/mysql-test/suite/galera/t/MW-86-wait1-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-86-wait1-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-86-wait1.test b/mysql-test/suite/galera/t/MW-86-wait1.test
index 40a7882829b..c5b78be64e5 100644
--- a/mysql-test/suite/galera/t/MW-86-wait1.test
+++ b/mysql-test/suite/galera/t/MW-86-wait1.test
@@ -5,7 +5,9 @@
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connection node_2
# Make sure no signals have been leftover from previous tests to surprise us.
diff --git a/mysql-test/suite/galera/t/MW-86-wait8-master.opt b/mysql-test/suite/galera/t/MW-86-wait8-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-86-wait8-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-86-wait8.cnf b/mysql-test/suite/galera/t/MW-86-wait8.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-86-wait8.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/MW-86-wait8.test b/mysql-test/suite/galera/t/MW-86-wait8.test
index 551b0f67b7c..a648924b9d8 100644
--- a/mysql-test/suite/galera/t/MW-86-wait8.test
+++ b/mysql-test/suite/galera/t/MW-86-wait8.test
@@ -3,7 +3,9 @@
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connection node_2
# Make sure no signals have been leftover from previous tests to surprise us.
diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.cnf b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf
new file mode 100644
index 00000000000..b14fce85b36
--- /dev/null
+++ b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+enforce_storage_engine=innodb
+sql_mode=''
+
+[mysqld.2]
+enforce_storage_engine=innodb
+sql_mode=''
+
+
+
+
diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.opt b/mysql-test/suite/galera/t/enforce_storage_engine2.opt
deleted file mode 100644
index 03f7dc5e527..00000000000
--- a/mysql-test/suite/galera/t/enforce_storage_engine2.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---enforce_storage_engine=innodb --sql_mode=''
-
diff --git a/mysql-test/suite/galera/t/galera_account_management.test b/mysql-test/suite/galera/t/galera_account_management.test
deleted file mode 100644
index 6dea0fcfa9e..00000000000
--- a/mysql-test/suite/galera/t/galera_account_management.test
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Test the account management statements - GRANT, REVOKE, etc.
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
-
-#
-# CREATE USER
-#
---connection node_1
-CREATE USER user1, user2 IDENTIFIED BY 'password';
-
---connection node_2
-SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
-
-#
-# ALTER USER
-#
-
---connection node_1
-ALTER USER user1 PASSWORD EXPIRE;
-SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
-
---connection node_2
-SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
-
-#
-# RENAME USER
-#
-
---connection node_1
-RENAME USER user2 TO user3;
-
---connection node_2
-SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';
-SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user3';
-
-#
-# SET PASSWORD
-#
-
---connection node_1
-SET PASSWORD FOR user3 = PASSWORD('foo');
-
---connection node_1
-SELECT password != '' FROM mysql.user WHERE user = 'user3';
-
-#
-# DROP USER
-#
---connection node_1
-DROP USER user1, user3;
-
---connection node_2
-SELECT COUNT(*) = 0 FROM mysql.user WHERE user IN ('user1', 'user2');
-
-#
-# GRANT
-#
-
---connection node_1
-GRANT ALL ON *.* TO user4 IDENTIFIED BY 'password';
-
---connection node_2
-SELECT COUNT(*) = 1 FROM mysql.user WHERE user = 'user4';
-SELECT Select_priv = 'Y' FROM mysql.user WHERE user = 'user4';
-
-#
-# GRANT PROXY ON
-#
---connection node_1
-CREATE USER user5;
-GRANT PROXY ON user4 TO user5;
-
---connection node_2
-SELECT COUNT(*) = 1 FROM mysql.proxies_priv WHERE user = 'user5';
-
-#
-# REVOKE
-#
-
---connection node_1
-REVOKE ALL PRIVILEGES ON *.* FROM user4;
-
---connection node_2
-SELECT Select_priv = 'N' FROM mysql.user WHERE user = 'user4';
-
-#
-# REVOKE PROXY
-#
-
---connection node_1
-REVOKE PROXY ON user4 FROM user5;
-
---connection node_2
-SELECT COUNT(*) = 0 FROM mysql.proxies_priv WHERE user = 'user5';
-
-DROP USER user4, user5;
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
deleted file mode 100644
index d8ecaacaa4c..00000000000
--- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=5
diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf
new file mode 100644
index 00000000000..4d93a1b2509
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf
@@ -0,0 +1,14 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+lock_wait_timeout=5
+innodb_lock_wait_timeout=5
+wait_timeout=5
+
+[mysqld.2]
+lock_wait_timeout=5
+innodb_lock_wait_timeout=5
+wait_timeout=5
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
deleted file mode 100644
index 19517556331..00000000000
--- a/mysql-test/suite/galera/t/galera_as_master_gtid.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!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
deleted file mode 100644
index 9db104b7cab..00000000000
--- a/mysql-test/suite/galera/t/galera_as_master_gtid.test
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Test Galera as a master to a MySQL slave with GTID
-#
-# The galera/galera_2node_master.cnf describes the setup of the nodes
-#
-# We check that all transactions originating from within Galera use a UUID that is
-# different from the server_uuid of either node
-#
-#
-
---source include/have_innodb.inc
---source include/have_log_bin.inc
---source include/galera_cluster.inc
-
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
---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 TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1);
-
---let $effective_uuid = `SELECT LEFT(@@global.gtid_executed, 36)`
---disable_query_log
---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);
-
---disable_query_log
---eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
---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
-
---let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
---source include/wait_condition.inc
-
---disable_query_log
---eval SELECT '$effective_uuid' != @@global.server_uuid AS uuids_do_not_match;
---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;
-
---connection node_3
---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_master_gtid_change_master.cnf b/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
deleted file mode 100644
index 19517556331..00000000000
--- a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!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
deleted file mode 100644
index 23606d7ac4c..00000000000
--- a/mysql-test/suite/galera/t/galera_as_master_gtid_change_master.test
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Test that a MySQL slave can use CHANGE MASTER MASTER_AUTO_POSITION to begin replicating
-# from another Galera node
-#
-# The galera/galera_2node_master.cnf describes the setup of the nodes
-#
-#
-
---source include/have_innodb.inc
---source include/have_log_bin.inc
---source include/galera_cluster.inc
-
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
---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 TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1);
-
---connection node_2
-INSERT INTO t1 VALUES(2);
-
---connection node_3
-STOP SLAVE;
---disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_AUTO_POSITION=1;
---enable_query_log
-START SLAVE USER='root';
-
---connection node_1
-INSERT INTO t1 VALUES(3);
-
---connection node_2
-INSERT INTO t1 VALUES(4);
-
---connection node_3
---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
-
---connection node_1
-DROP TABLE t1;
-
---connection node_3
---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_ctas.cnf b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf
new file mode 100644
index 00000000000..eab2a6de90d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf
@@ -0,0 +1,5 @@
+!include ../galera_2nodes_as_slave.cnf
+
+# make sure master server uses ROW format for replication
+[mysqld]
+binlog-format=row
diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test
new file mode 100644
index 00000000000..1a5e023b981
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test
@@ -0,0 +1,75 @@
+#
+# Test Galera as a slave to a MySQL master
+#
+# The galera/galera_2node_slave.cnf describes the setup of the nodes
+# also, for this test, master server must have binlog_format=ROW
+#
+
+--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
+
+--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;
+--enable_query_log
+START SLAVE;
+
+
+# make sure master server has binlog_format=ROW
+--connection node_1
+SHOW VARIABLES LIKE 'binlog_format';
+
+#
+# test phase one, issue CTAS with empty source table
+#
+--connection node_1
+CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE target AS SELECT * FROM source;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+#
+# test phase two, issue CTAS with populated source table
+#
+--connection node_1
+DROP TABLE target;
+INSERT INTO source VALUES(1);
+
+CREATE TABLE target AS SELECT * FROM source;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
+--source include/wait_condition.inc
+
+--connection node_1
+DROP TABLE source;
+DROP TABLE target;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+
+--connection node_1
+RESET MASTER;
+
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid.inc b/mysql-test/suite/galera/t/galera_as_slave_gtid.inc
new file mode 100644
index 00000000000..461e7833a94
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid.inc
@@ -0,0 +1,93 @@
+#
+# Test Galera as a slave to a MariaDB master using GTIDs
+#
+# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
+# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
+#
+# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
+#
+
+--source include/have_innodb.inc
+--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_3;
+--enable_query_log
+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;
+--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
+
+--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(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+--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(*) = 1 FROM t1;
+--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
+
+--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_3
+DROP TABLE t1;
+
+#
+# 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_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;
+
+--echo #cleanup
+--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_3
+reset master;
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
new file mode 100644
index 00000000000..01d2eb12630
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld]
+log-bin=mysqld-bin
+log-slave-updates
+binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
new file mode 100644
index 00000000000..940c9c0667d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
@@ -0,0 +1,77 @@
+#
+# Test Galera as a slave to a MariaDB master using GTIDs
+#
+# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
+# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
+#
+# This test will replicate writes to MyISAM table and check that slave node is able
+# to apply them.
+# mysql.gtid_slave_pos table should be defined as innodb engine, original problem
+# by writes to mysql.gtid_slave_pos, whereas the replicated transaction contained
+# no innodb writes
+#
+
+--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
+SELECT @@WSREP_ON;
+
+--connection node_2
+# make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that
+ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
+
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
+
+--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(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--echo #cleanup
+--sleep 1
+
+--connection node_1
+DROP TABLE t1;
+
+--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
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--connection node_1
+reset master;
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+reset master;
+
+--connection node_3
+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
deleted file mode 100644
index 6f221f83b3a..00000000000
--- a/mysql-test/suite/galera/t/galera_as_slave_preordered.test
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# Test Galera as a slave to a MySQL master with --wsrep-preordered=TRUE
-#
-# The galera/galera_2node_slave.cnf describes the setup of the nodes
-#
-
---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
-
---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';
-
-#
-# Issue many large-ish transaction on the async master
-#
-
---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 INTEGER) ENGINE=InnoDB;
-
---disable_query_log
---let $count = 100
-while ($count)
-{
- --eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
- --dec $count
-}
---enable_query_log
-
-#
-# While the async transactions are being applied, issue another set of transactions
-# on the Galera node.
-#
-
---connection node_2
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
-
---let $count = 100
---disable_query_log
-while ($count)
-{
- --eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
- --dec $count
-}
---enable_query_log
-
-#
-# Confirm that all transactions successfully committed
-#
-
---let $wait_condition = SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
---source include/wait_condition.inc
-
-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
-SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
-SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
-
-#
-# Cleanup
-#
-
---connection node_1
-DROP TABLE t1;
-DROP TABLE ten;
-
---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_autoinc_sst_mariabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test
index c8e053dc2b6..845bd736e21 100644
--- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test
+++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test
@@ -2,90 +2,61 @@
# Test that autoincrement works correctly while the cluster membership
# is changing and SST takes place.
#
-
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
--source include/have_mariabackup.inc
+--source include/force_restart.inc
--connection node_1
---let $connection_id = `SELECT CONNECTION_ID()`
-
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
-# Issue an endless stream of autoincrement inserts
-
-DELIMITER |;
-CREATE PROCEDURE p1 ()
-BEGIN
- DECLARE x INT DEFAULT 1;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
-
- WHILE 1 DO
- INSERT INTO t1 VALUES (DEFAULT);
- COMMIT;
- END WHILE;
-END|
-DELIMITER ;|
-
---send CALL p1();
---sleep 1
-
---connection node_2
---send CALL p1();
---sleep 1
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
# Kill and restart node #2
-
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
--source include/kill_galera.inc
---source include/start_mysqld.inc
-
-INSERT INTO t1 VALUES (DEFAULT);
-
-# Terminate the stored procedure
-
---connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
---connection node_1a
---disable_query_log
---eval KILL CONNECTION $connection_id
---enable_query_log
-
-INSERT INTO t1 VALUES (DEFAULT);
-
--connection node_1
-# CR_SERVER_LOST
---error 2013,2006
---reap
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
---connection node_2
-# CR_SERVER_LOST
---error 2013,2006
---reap
-
-# Confirm that the count is correct and that the cluster is intact
+--connection node_2a
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
---let $count = `SELECT COUNT(*) FROM t1`
+SELECT COUNT(*) FROM t1;
--connection node_2a
---disable_query_log
---eval SELECT COUNT(*) = $count AS count_equal FROM t1
---enable_query_log
+SELECT COUNT(*) FROM t1;
-CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
-
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-
---connection node_1a
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-
-DROP PROCEDURE p1;
+--connection node_1
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");
+
+--disconnect node_1a
+--disconnect node_2a
diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf
new file mode 100644
index 00000000000..4101b4073ec
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb_stats_persistent=ON
+
+[mysqld.2]
+innodb_stats_persistent=ON
+
+
diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt b/mysql-test/suite/galera/t/galera_bf_background_statistics.opt
deleted file mode 100644
index f9b1414a974..00000000000
--- a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_stats_persistent=ON
diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
index e3a9077a888..c8a31506ffa 100644
--- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test
+++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
@@ -1,34 +1,47 @@
--source include/galera_cluster.inc
--source include/big_test.inc
-
+
+--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);
DELIMITER |;
-CREATE PROCEDURE p1()
+CREATE PROCEDURE p1(repeat_count INT)
BEGIN
+ DECLARE current_num int;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
- WHILE 1 DO
+ SET current_num = 0;
+
+ WHILE current_num < repeat_count DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
+ SET current_num = current_num + 1;
END WHILE;
END|
DELIMITER ;|
-
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_NAME = 'p1'
+--source include/wait_condition.inc
+
--connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
-connection default;
+connection node_1;
let $counter=10;
let $sleep_period=10;
@@ -46,7 +59,26 @@ while($counter > 0)
exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
dec $counter;
}
-
+
+--connection node_1_p1
+--error 0,1213
+--reap
+--connection node_1_p2
+--error 0,1213
+--reap
+--connection node_2_p1
+--error 0,1213
+--reap
+--connection node_2_p2
+--error 0,1213
+--reap
+
+--connection node_1
drop table t1;
drop procedure p1;
+--disconnect node_1_p1
+--disconnect node_1_p2
+--disconnect node_2_p1
+--disconnect node_2_p2
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
deleted file mode 100644
index c8e53f07fc2..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-checksum=CRC32 --master-verify-checksum=1 --slave-sql-verify-checksum=1
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf
new file mode 100644
index 00000000000..bd61ee67406
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-checksum=CRC32
+master-verify-checksum=1
+slave-sql-verify-checksum=1
+
+[mysqld.2]
+binlog-checksum=CRC32
+master-verify-checksum=1
+slave-sql-verify-checksum=1
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
deleted file mode 100644
index a36d21315a6..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-row-event-max-size=4294967295
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf
new file mode 100644
index 00000000000..7d87a0d0078
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-row-event-max-size=4294967295
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
deleted file mode 100644
index 22174756652..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-row-event-max-size=256
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf
new file mode 100644
index 00000000000..798435d8e54
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-row-event-max-size=256
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test b/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test
deleted file mode 100644
index 95bc85c4cab..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_rows_query_log_events.test
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Test that Galera continues to run even with binlog-rows-query-log-events=TRUE
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
-
---let $binlog_rows_query_log_events_orig = `SELECT @@binlog_rows_query_log_events`
-
-SET GLOBAL binlog_rows_query_log_events=TRUE;
-
-CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (1);
-
---connection node_2
-SELECT COUNT(*) = 1 FROM t1;
-
---connection node_1
-UPDATE t1 SET f1 = 2 WHERE f1 = 1;
-
---connection node_2
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
-
---connection node_1
---eval SET GLOBAL binlog_rows_query_log_events = $binlog_rows_query_log_events_orig
-
-DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test
index 12d9efea2f9..8dc73c1ce38 100644
--- a/mysql-test/suite/galera/t/galera_drop_database.test
+++ b/mysql-test/suite/galera/t/galera_drop_database.test
@@ -23,6 +23,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';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
# Restart the second node:
--connection node_2
@@ -34,6 +38,14 @@ UPDATE fts_t2 SET f2 = 'efjh';
--connection node_2
--source include/wait_until_ready.inc
+--let $wait_condition = SELECT COUNT(*) = 1000 FROM fts_t1 where f2 = 'abcd';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1000 FROM fts_t2 where f2 = 'efjh';
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
# Drop the tables and database after nodes restarted:
--connection node_1
@@ -43,5 +55,13 @@ DROP TABLE fts_t2;
SHOW TABLES;
DROP DATABASE fts;
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t2';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'fts';
+--source include/wait_condition.inc
+
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_events2.test b/mysql-test/suite/galera/t/galera_events2.test
index 54b90386851..3dfbe406fc4 100644
--- a/mysql-test/suite/galera/t/galera_events2.test
+++ b/mysql-test/suite/galera/t/galera_events2.test
@@ -23,6 +23,7 @@ DO
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
--connection node_2
+set global wsrep_sync_wait=15;
--echo # node_2 event should be there
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
@@ -66,6 +67,9 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+--source include/wait_condition.inc
+
use events_test;
--echo "The definer should be ev_test@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
index 9b79b4c30b6..6f0de0a1f4a 100644
--- a/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
+++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete.test
@@ -3,7 +3,13 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
+
+--echo #
+--echo # test phase with cascading foreign key through 3 tables
+--echo #
+
+--connection node_1
+set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
@@ -30,11 +36,17 @@ INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
--connection node_2
+set wsrep_sync_wait=0;
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
+--source include/wait_condition.inc
DELETE FROM grandparent WHERE id = 1;
--connection node_1
-SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
-SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
+--source include/wait_condition.inc
+SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
+SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
DROP TABLE child;
DROP TABLE parent;
diff --git a/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test
new file mode 100644
index 00000000000..f38c028b7d6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_fk_cascade_delete_debug.test
@@ -0,0 +1,98 @@
+--source include/galera_cluster.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--echo #
+--echo # test phase with foreign key of varchar type
+--echo #
+--connection node_1
+ CREATE TABLE parent (
+ `id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+
+ CREATE TABLE child (
+ `id` int NOT NULL,
+ `parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `parent_id` (`parent_id`),
+ CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+
+INSERT INTO parent VALUES ('row one'), ('row two');
+INSERT INTO child VALUES (1,'row one'), (2,'row two');
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
+--source include/wait_condition.inc
+DELETE FROM parent;
+
+--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
+--source include/wait_condition.inc
+
+SELECT COUNT(*), COUNT(*) = 0 FROM parent;
+SELECT COUNT(*), COUNT(*) = 0 FROM child;
+
+DROP TABLE child;
+DROP TABLE parent;
+
+--echo #
+--echo # test phase with MM conflict in FK cascade
+--echo #
+
+--connection node_1
+set wsrep_retry_autocommit=0;
+CREATE TABLE parent (
+ id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+
+CREATE TABLE child (
+ id INT NOT NULL PRIMARY KEY,
+ j int default 0,
+ parent_id INT,
+ FOREIGN KEY (parent_id)
+ REFERENCES parent(id)
+ ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO parent VALUES (1);
+INSERT INTO child VALUES (1,0,1);
+
+# block applier before applying
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
+--source include/wait_condition.inc
+DELETE FROM parent;
+
+--connection node_1a
+# wait until applier has reached the sync point
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+
+
+--connection node_1
+# issue conflicting write to child table, it should fail in certification
+--error ER_LOCK_DEADLOCK
+--send update child set j=2;
+
+--connection node_1a
+# release the applier
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "RESET";
+
+--connection node_1
+--reap
+
+--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
+--source include/wait_condition.inc
+SELECT COUNT(*), COUNT(*) = 0 FROM parent;
+SELECT COUNT(*), COUNT(*) = 0 FROM child;
+
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/t/galera_flush-master.opt b/mysql-test/suite/galera/t/galera_flush-master.opt
deleted file mode 100644
index 5a1fb6748d9..00000000000
--- a/mysql-test/suite/galera/t/galera_flush-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1000000
diff --git a/mysql-test/suite/galera/t/galera_flush.test b/mysql-test/suite/galera/t/galera_flush.test
deleted file mode 100644
index 77e95f62fda..00000000000
--- a/mysql-test/suite/galera/t/galera_flush.test
+++ /dev/null
@@ -1,273 +0,0 @@
-#
-# Test that various FLUSH commands are replicated. Whenever possible, check the slave for the effects.
-#
-
---source include/galera_cluster.inc
---source include/have_innodb.inc
---source include/have_perfschema.inc
---source include/have_query_cache.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-#
-# The following FLUSH statements should be replicated
-#
-
---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
-FLUSH DES_KEY_FILE;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH HOSTS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---connection node_1
-SET GLOBAL wsrep_replicate_myisam = TRUE;
-INSERT INTO mysql.user VALUES('localhost','user1',PASSWORD('pass1'), '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,'mysql_native_password','','N','N','',0);
-FLUSH PRIVILEGES;
---connect node_2a, 127.0.0.1, user1, pass1, test, $NODE_MYPORT_2
---connection node_1
-DELETE FROM mysql.user WHERE user = 'user1';
-SET GLOBAL wsrep_replicate_myisam = FALSE;
-FLUSH PRIVILEGES;
-
-
---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
-FLUSH QUERY CACHE;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH STATUS;
-
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH USER_RESOURCES;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH TABLES;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---connection node_1
-CREATE TABLE t2 (f1 INTEGER);
-
---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
-FLUSH TABLES t2;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH ERROR LOGS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH SLOW LOGS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---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
-FLUSH GENERAL LOGS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---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
-FLUSH ENGINE LOGS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---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
-FLUSH RELAY LOGS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
---connection node_1
-SET @userstat_old= @@userstat;
-SET GLOBAL userstat=ON;
-
---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
-FLUSH CLIENT_STATISTICS;
-FLUSH INDEX_STATISTICS;
-FLUSH TABLE_STATISTICS;
-FLUSH USER_STATISTICS;
---connection node_2
---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 + 4 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---connection node_1
-SET @old_thread_statistics= @@global.thread_statistics;
-SET GLOBAL thread_statistics= ON;
-
---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
-FLUSH THREAD_STATISTICS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-FLUSH CHANGED_PAGE_BITMAPS;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
-#
-# The following statements should not be replicated: FLUSH LOGS, FLUSH TABLES WITH LOCKS
-#
-
-
---connection node_1
-CREATE TABLE t1 (f1 INTEGER);
-
---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
-FLUSH LOGS;
-FLUSH TABLES WITH READ LOCK;
-UNLOCK TABLES;
-FLUSH TABLES t1 WITH READ LOCK;
-UNLOCK TABLES;
-FLUSH TABLES t1 FOR EXPORT;
-UNLOCK TABLES;
-
---connection node_2
---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
-
-
-## Test LOCK TABLES with FLUSH TABLES
-## LOCK TABLES t1 write followed by flush tables t1 should succeed due to MDL upgrade.
-## LOCK tables t2 read followed by flush tables t2 should fail with ER_TABLE_NOT_LOCKED_FOR_WRITE
-
-
---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
-LOCK TABLES t1 WRITE;
-FLUSH TABLES t1;
-UNLOCK TABLES;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
---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
-LOCK TABLES t1 READ;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-FLUSH TABLES t1;
-UNLOCK TABLES;
---connection node_2
---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
---connection node_1
-FLUSH TABLES t1;
---connection node_2
---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 + 1 AS wsrep_last_committed_diff;
---enable_query_log
-
-
-
---connection node_1
-DROP TABLE t1;
-DROP TABLE t2;
-SET GLOBAL userstat= @userstat_old;
-SET GLOBAL thread_statistics= @old_thread_statistics;
diff --git a/mysql-test/suite/galera/t/galera_flush_local.cnf b/mysql-test/suite/galera/t/galera_flush_local.cnf
new file mode 100644
index 00000000000..c92cb58f484
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_flush_local.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1000000
+wsrep_replicate_myisam=ON
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1000000
+wsrep_replicate_myisam=ON
+
diff --git a/mysql-test/suite/galera/t/galera_flush_local.opt b/mysql-test/suite/galera/t/galera_flush_local.opt
deleted file mode 100644
index a084db15c5d..00000000000
--- a/mysql-test/suite/galera/t/galera_flush_local.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---query_cache_type=1
---query_cache_size=1000000
---wsrep_replicate_myisam=ON
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..5da70abd255 100644
--- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test
+++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test
@@ -7,14 +7,20 @@
--source include/galera_cluster.inc
--connection node_1
+SET SESSION wsrep_on=OFF;
RESET MASTER;
+SET SESSION wsrep_on=ON;
+--disable_warnings
SET SESSION binlog_format = 'STATEMENT';
+--enable_warnings
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
+--disable_warnings
SET SESSION binlog_format = 'MIXED';
+--enable_warnings
INSERT INTO t1 VALUES (2);
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..0d8994f7d7b 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
@@ -38,6 +38,12 @@ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
--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(*) FROM t1;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+
--let $diff_servers = 1 2
--source include/diff_servers.inc
@@ -48,8 +54,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 = not found from cache, falling back to SST
+--let $assert_select = 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_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/galera_gtid-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_gtid.cnf b/mysql-test/suite/galera/t/galera_gtid.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/galera_gtid.test b/mysql-test/suite/galera/t/galera_gtid.test
index e8369be62e6..560a320255f 100644
--- a/mysql-test/suite/galera/t/galera_gtid.test
+++ b/mysql-test/suite/galera/t/galera_gtid.test
@@ -11,14 +11,18 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
--connection node_2
-SELECT COUNT(*) = 1 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1
+--source include/wait_condition.inc
UPDATE t1 SET f1 = 2;
--let $gtid_binlog_state_node2 = `SELECT @@global.gtid_binlog_state;`
--connection node_1
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+SET SESSION wsrep_sync_wait = 15;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2
+--source include/wait_condition.inc
+SELECT * from t1;
--disable_query_log
--eval SELECT '$gtid_binlog_state_node2' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
diff --git a/mysql-test/suite/galera/t/galera_load_data.test b/mysql-test/suite/galera/t/galera_load_data.test
index d4e09582a55..183095492fa 100644
--- a/mysql-test/suite/galera/t/galera_load_data.test
+++ b/mysql-test/suite/galera/t/galera_load_data.test
@@ -5,7 +5,7 @@
create database cardtest02;
use cardtest02;
-CREATE TABLE `cardtest_tbl` (
+CREATE TABLE cardtest_tbl (
`id` bigint(18) NOT NULL AUTO_INCREMENT,
`course` bigint(18) NOT NULL,
`name` varchar(200) DEFAULT NULL,
@@ -27,21 +27,26 @@ CREATE TABLE `cardtest_tbl` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1324 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;
-LOCK TABLES `cardtest_tbl` WRITE;
-ALTER TABLE `cardtest_tbl` DISABLE KEYS;
+LOCK TABLES cardtest_tbl WRITE;
+ALTER TABLE cardtest_tbl DISABLE KEYS;
-INSERT INTO `cardtest_tbl` VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL);
+INSERT INTO cardtest_tbl VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL);
-ALTER TABLE `cardtest_tbl` ENABLE KEYS;
+ALTER TABLE cardtest_tbl ENABLE KEYS;
UNLOCK TABLES;
use cardtest02;
--let $wait_timeout=600
+--let $wait_condition = SELECT COUNT(*) = 301 from cardtest_tbl;
+--source include/wait_condition.inc
+
+ANALYZE TABLE cardtest_tbl;
+
--let $wait_condition = SELECT table_rows = 301 from information_schema.tables WHERE TABLE_NAME = 'cardtest_tbl';
--source include/wait_condition.inc
-select count(*) from cardtest_tbl;
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
let $cardinality1 = `SELECT cardinality from information_schema.statistics WHERE TABLE_NAME = 'cardtest_tbl'`;
let $table_rows1 = `SELECT table_rows from information_schema.tables WHERE TABLE_NAME = 'cardtest_tbl'`;
@@ -49,14 +54,21 @@ let $avg_row_length1 = `SELECT avg_row_length from information_schema.tables WHE
let $data_length1 = `SELECT data_length from information_schema.tables WHERE TABLE_NAME = 'cardtest_tbl'`;
--connection node_2
-set session wsrep_sync_wait=15;
use cardtest02;
--let $wait_timeout=600
+--let $wait_condition = SELECT COUNT(*) = 301 from cardtest_tbl;
+--source include/wait_condition.inc
+
+ANALYZE TABLE cardtest_tbl;
+
+--source include/wait_condition.inc
--let $wait_condition = SELECT table_rows = 301 from information_schema.tables WHERE TABLE_NAME = 'cardtest_tbl';
--source include/wait_condition.inc
+--let $wait_condition = SELECT cardinality = 301 from information_schema.statistics WHERE TABLE_NAME = 'cardtest_tbl';
+--source include/wait_condition.inc
-select count(*) from cardtest_tbl;
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
if (`SELECT cardinality <> $cardinality1 from information_schema.statistics WHERE TABLE_NAME = 'cardtest_tbl'`)
{
diff --git a/mysql-test/suite/galera/t/galera_log_bin-master.opt b/mysql-test/suite/galera/t/galera_log_bin-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/galera_log_bin-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_log_bin.cnf b/mysql-test/suite/galera/t/galera_log_bin.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
index c3d94d15194..f1d2a12b9de 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.test
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -1,5 +1,5 @@
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/force_restart.inc
--connection node_1
reset master;
@@ -39,5 +39,4 @@ DROP TABLE t2;
--echo #cleanup
--connection node_1
RESET MASTER;
---connection node_2
-reset master;
+
diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.cnf b/mysql-test/suite/galera/t/galera_mdev_13787.cnf
new file mode 100644
index 00000000000..ada78e1db2a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_mdev_13787.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb-stats-persistent=1
+
+[mysqld.2]
+innodb-stats-persistent=1
+
+
diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.opt b/mysql-test/suite/galera/t/galera_mdev_13787.opt
deleted file mode 100644
index 27ec1e3f00e..00000000000
--- a/mysql-test/suite/galera/t/galera_mdev_13787.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-stats-persistent=1
diff --git a/mysql-test/suite/galera/t/galera_migrate.cnf b/mysql-test/suite/galera/t/galera_migrate.cnf
deleted file mode 100644
index ed48f208e52..00000000000
--- a/mysql-test/suite/galera/t/galera_migrate.cnf
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# This .cnf file starts 4 servers without enabling Galera.
-# The galera_migrate.test will set wsrep_provider and the other settings as needed.
-#
-
-!include include/default_mysqld.cnf
-
-[mysqld]
-binlog-format=row
-innodb_autoinc_lock_mode=2
-innodb_flush_log_at_trx_commit=2
-log-bin=mysqld-bin
-
-wsrep_node_address=127.0.0.1
-wsrep_causal_reads=ON
-wsrep_sync_wait = 15
-
-[mysqld.1]
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-
-[mysqld.2]
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-
-[mysqld.3]
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-
-[mysqld.4]
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-
-[ENV]
-NODE_MYPORT_1= @mysqld.1.port
-NODE_MYSOCK_1= @mysqld.1.socket
-
-NODE_MYPORT_2= @mysqld.2.port
-NODE_MYSOCK_2= @mysqld.2.socket
-
-NODE_MYPORT_3= @mysqld.3.port
-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/t/galera_migrate.test b/mysql-test/suite/galera/t/galera_migrate.test
deleted file mode 100644
index 84897b66c6d..00000000000
--- a/mysql-test/suite/galera/t/galera_migrate.test
+++ /dev/null
@@ -1,204 +0,0 @@
-#
-# Execute a migration from MariaDB replication to Galera replication.
-# The test starts with 4 stand-alone servers defined by galera_migrate.cnf and then
-# performs the following steps:
-#
-# 1. Begin with a single MySQL server
-# 2. Establish traditional MySQL master-slave replication
-# 3. Attach a new sever to serve as a MySQL replication slave
-# 4. Enable Galera on the new slave and create a single-node Galera cluster
-# 5. Attach a second Galera node
-# 6. Turn off the traditional replication parts of the system
-# 7. Continue replicating within Galera only
-#
-
---source include/big_test.inc
---source include/have_innodb.inc
---source include/have_log_bin.inc
-
-#
-# Step #1 Begin with a single server
-#
-
---connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
-
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
-#
-# Step #2. Establish traditional MySQL replication
-#
-
---connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
---disable_query_log
---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT = $NODE_MYPORT_1;
---enable_query_log
-START SLAVE;
-
---connection node_1
-INSERT INTO t1 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 t1;
---source include/wait_condition.inc
-
-#
-# Step #3. Attach a second slave, later to be converted to Galera
-#
-
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
---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
-INSERT INTO t1 VALUES (3);
-
---connection node_3
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
-
---let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
---source include/wait_condition.inc
-
-#
-# Step #4. Convert this MySQL slave into a Galera node
-#
-
---connection node_1
-INSERT INTO t1 VALUES (4);
-
---connection node_3
---disable_query_log
---eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
---eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_3'
---enable_query_log
-SET GLOBAL wsrep_cluster_address='gcomm://';
-
---connection node_1
-INSERT INTO t1 VALUES (5);
-
---connection node_3
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
---let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
---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
-
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
-SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-
---connection node_1
-INSERT INTO t1 VALUES (6);
-
-#
-# Step #5. Attach a second Galera node using mysqldump SST
-#
-
---connection node_3
-# We need a user with a password for mysqldump SST
-GRANT ALL PRIVILEGES ON *.* TO 'sst';
-SET GLOBAL wsrep_sst_auth = 'sst:';
-
---connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
-GRANT ALL PRIVILEGES ON *.* TO 'sst';
-
---disable_query_log
---eval SET GLOBAL wsrep_sst_method = 'mysqldump';
---eval SET GLOBAL wsrep_provider='$WSREP_PROVIDER'
---eval SET GLOBAL wsrep_provider_options='base_port=$NODE_GALERAPORT_4'
---eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_4';
---eval SET GLOBAL wsrep_cluster_address='gcomm://127.0.0.1:$NODE_GALERAPORT_3'
---enable_query_log
-
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
---source include/wait_condition.inc
-
---let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
---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
-
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-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';
-
-
-#
-# Step #6. Turn off traditional replication
-#
-
---connection node_2
-STOP SLAVE;
-RESET SLAVE ALL;
-
---connection node_3
-STOP SLAVE;
-RESET SLAVE ALL;
-
-#
-# Step #7. Continue replicating within Galera only
-#
-
-# We need fresh connections due to galera#191
-
---connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3
-INSERT INTO t1 VALUES (7);
-
---connect node_4a, 127.0.0.1, root, , test, $NODE_MYPORT_4
-INSERT INTO t1 VALUES (8);
-
---connection node_4a
-SELECT COUNT(*) = 8 FROM t1;
-
---let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
---source include/wait_condition.inc
-
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-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';
-
---connection node_3a
-SELECT COUNT(*) = 8 FROM t1;
-
---let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
---source include/wait_condition.inc
-
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
-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';
-
-#
-# Teardown
-#
-
---connection node_1
-DROP TABLE t1;
-
---connection node_2
-DROP TABLE t1;
-
---connection node_3
-SET GLOBAL wsrep_provider = 'none';
-SET GLOBAL wsrep_sst_auth = '';
-SET GLOBAL wsrep_provider_options = '';
-DROP TABLE t1;
-DROP USER sst;
-
---connection node_4
-SET GLOBAL wsrep_provider = 'none';
-SET GLOBAL wsrep_sst_method = 'rsync';
-SET GLOBAL wsrep_provider_options = '';
-SET GLOBAL wsrep_sst_receive_address = 'AUTO';
-DROP TABLE t1;
-DROP USER sst;
-
-CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
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 9e1f47b1ac4..adabb4def00 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@ -44,8 +44,12 @@ SET GLOBAL wsrep_slave_threads = 4;
--connection node_2
--reap
--disconnect node_1a
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(DISTINCT f1) FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 30000 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_30000 FROM t1;
+SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
--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 b82a160657d..587fbe10fe4 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test
@@ -57,6 +57,8 @@ send call p1(1000);
--connection node_2
--disable_query_log
+--let $wait_condition = select count(*)=1 from information_schema.routines WHERE routine_name='p1';
+--source include/wait_condition.inc
send call p1(1000);
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_partition.cnf b/mysql-test/suite/galera/t/galera_partition.cnf
new file mode 100644
index 00000000000..e6cb13ef523
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_partition.cnf
@@ -0,0 +1,18 @@
+!include ../galera_4nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1'
+wsrep_slave_threads=10
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1'
+wsrep_slave_threads=10
+
+[mysqld.3]
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2'
+wsrep_slave_threads=10
+
+[mysqld.4]
+wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3'
+wsrep_slave_threads=10
+
diff --git a/mysql-test/suite/galera/t/galera_partition.test b/mysql-test/suite/galera/t/galera_partition.test
new file mode 100644
index 00000000000..66b2a5c10f6
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_partition.test
@@ -0,0 +1,450 @@
+--source include/galera_cluster.inc
+--source include/have_partition.inc
+
+--connection node_1
+
+call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+
+--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
+
+CREATE TABLE t1(
+ id bigint unsigned NOT NULL AUTO_INCREMENT,
+ dt datetime NOT NULL,
+ PRIMARY KEY (id,dt),
+ KEY dt_idx (dt)
+) ENGINE=InnoDB
+PARTITION BY RANGE( TO_DAYS(dt) ) (
+PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
+PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
+PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
+PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
+PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
+PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
+PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
+PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
+PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
+PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
+PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
+PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
+PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
+PARTITION rx2011 VALUES LESS THAN MAXVALUE);
+
+DELIMITER |;
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+ DECLARE current_num int;
+ SET current_num = 0;
+ WHILE current_num < repeat_count do
+ INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+ INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
+ COMMIT;
+ SET current_num = current_num + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+
+insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
+insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
+insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
+insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
+insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
+insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
+insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
+insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
+insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
+insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
+insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
+insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
+insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
+insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
+insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
+insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
+insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
+insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
+insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
+insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
+insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
+insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
+insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
+insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
+insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
+insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
+insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
+insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
+insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
+insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
+insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
+insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
+insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
+insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
+insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
+insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
+insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
+insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
+insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
+insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
+insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
+insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
+insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
+insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
+insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
+insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
+insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
+insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
+insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
+insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
+insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
+insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
+insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
+insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
+insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
+insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
+insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
+insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
+insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
+insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
+insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
+insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
+insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
+insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
+insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
+insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
+insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
+insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
+insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
+insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
+insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
+insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
+insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
+insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
+insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
+insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
+insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
+insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
+insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
+insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
+insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
+insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
+insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
+insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
+insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
+insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
+insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
+insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
+insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
+insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
+insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
+insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
+insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
+insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
+insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
+insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
+insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
+insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
+insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
+insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
+insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
+insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
+insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
+insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
+insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
+insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
+insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
+insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
+insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
+insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
+insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
+insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
+insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
+insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
+insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
+insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
+insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
+insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
+insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
+insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
+insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
+insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
+insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
+insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
+insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
+insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
+insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
+insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
+insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
+insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
+insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
+insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
+insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
+insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
+insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
+insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
+insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
+insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
+insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
+insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
+insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
+insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
+insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
+insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
+insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
+insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
+insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
+insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
+insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
+insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
+insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
+insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
+insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
+insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
+insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
+insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
+insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
+insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
+insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
+insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
+insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
+insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
+insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
+insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
+insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
+insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
+insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
+insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
+insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
+insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
+insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
+insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
+insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
+insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
+insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
+insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
+insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
+insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
+insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
+insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
+insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
+insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
+insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
+insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
+insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
+insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
+insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
+insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
+insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
+insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
+insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
+insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
+insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
+insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
+insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
+insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
+insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
+insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
+insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
+insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
+insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
+insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
+insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
+insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
+insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
+insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
+insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
+insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
+insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
+insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
+insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
+insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
+insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
+insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
+insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
+insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
+insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
+insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
+insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
+insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
+insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
+insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
+insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
+insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
+insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
+insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
+insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
+insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
+insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
+insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
+insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
+insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
+insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
+insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
+insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
+insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
+insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
+insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
+insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
+insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
+insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
+insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
+insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
+insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
+insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
+insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
+insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
+insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
+insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
+insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
+insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
+insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
+insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
+insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
+insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
+insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
+insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
+insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
+insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
+insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
+insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
+insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
+insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
+insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
+insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
+insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
+insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
+insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
+insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
+insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
+insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
+insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
+insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
+insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
+insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
+insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
+insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
+insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
+insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
+insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
+insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
+insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
+insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
+insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
+insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
+insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
+insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
+insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
+insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
+insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
+insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
+insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
+insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
+insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
+insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
+insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
+insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
+insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
+insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
+insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
+insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
+insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
+insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
+insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
+insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
+insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
+insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
+insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
+insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
+insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
+insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
+insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
+insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
+insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
+insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
+insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
+insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
+insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
+insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
+insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
+insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
+insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
+insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
+insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
+insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
+insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
+insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
+insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
+insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
+insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
+insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
+insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
+insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
+insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
+insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
+insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
+insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
+insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
+insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
+insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
+insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
+insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
+insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
+insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
+insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
+insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
+insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
+insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
+insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
+insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
+
+SELECT COUNT(*) FROM t1;
+
+--connection node_2
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+--send call p1(100);
+
+--connection node_3
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+--send call p1(100);
+
+--connection node_4
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+--send call p1(100);
+
+--connection node_1
+SET SESSION wsrep_OSU_method='RSU';
+SELECT @@wsrep_OSU_method;
+SET SESSION sql_log_bin = 0;
+
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx2009xx;
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx201004;
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx201008;
+
+SET SESSION wsrep_OSU_METHOD='TOI';
+SELECT @@wsrep_OSU_method;
+
+--connection node_2
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_3
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_4
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_1
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
diff --git a/mysql-test/suite/galera/t/galera_query_cache-master.opt b/mysql-test/suite/galera/t/galera_query_cache-master.opt
deleted file mode 100644
index 915a36c0937..00000000000
--- a/mysql-test/suite/galera/t/galera_query_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1355776
diff --git a/mysql-test/suite/galera/t/galera_query_cache.cnf b/mysql-test/suite/galera/t/galera_query_cache.cnf
new file mode 100644
index 00000000000..80f40b0997e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1355776
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1355776
+
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt b/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt
deleted file mode 100644
index 915a36c0937..00000000000
--- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1355776
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf
new file mode 100644
index 00000000000..80f40b0997e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1355776
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1355776
+
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
index e13e7f1f748..6d1e21fd94d 100644
--- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
+++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
@@ -1,6 +1,8 @@
--source include/galera_cluster.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_query_cache.inc
+--source include/galera_have_debug_sync.inc
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/t/galera_rsu_add_pk.test b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
index 7db990d7be1..094048f6caa 100644
--- a/mysql-test/suite/galera/t/galera_rsu_add_pk.test
+++ b/mysql-test/suite/galera/t/galera_rsu_add_pk.test
@@ -26,14 +26,20 @@ SET SESSION wsrep_OSU_method = "TOI";
# Insert values after the ALTER
INSERT INTO t1 (f1) SELECT 200000 + (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;
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
--connection node_1
--reap
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
diff --git a/mysql-test/suite/galera/t/galera_rsu_drop_pk.test b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test
index e64259494d1..97bdbcfdb84 100644
--- a/mysql-test/suite/galera/t/galera_rsu_drop_pk.test
+++ b/mysql-test/suite/galera/t/galera_rsu_drop_pk.test
@@ -4,10 +4,9 @@
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connection node_1
-CREATE TABLE ten (f1 INTEGER);
+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 PRIMARY KEY) Engine=InnoDB;
@@ -26,13 +25,18 @@ SET SESSION wsrep_OSU_method = "TOI";
# Insert even more data after the ALTER has completed
INSERT INTO t1 (f1) SELECT 200000 + (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;
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) as expect_300000 FROM t1;
+SELECT MAX(f1) as expect_299999 FROM t1;
--connection node_1
--reap
-SELECT COUNT(*) = 300000 FROM t1;
-SELECT MAX(f1) = 299999 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) as expect_300000 FROM t1;
+SELECT MAX(f1) as expect_299999 FROM t1;
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 DROP PRIMARY KEY;
@@ -44,15 +48,19 @@ INSERT INTO t1 (f1) VALUES (1);
INSERT INTO t1 (f1) VALUES (10);
--connection node_1
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1;
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 10;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1 where f1 = 10;
+--source include/wait_condition.inc
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1;
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 10;
INSERT INTO t1 (f1) VALUES (100);
INSERT INTO t1 (f1) VALUES (1000);
--connection node_2
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 100;
-SELECT COUNT(*) = 2 FROM t1 WHERE f1 = 1000;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1 where f1 = 1000;
+--source include/wait_condition.inc
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 100;
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1000;
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
deleted file mode 100644
index beae84b3862..00000000000
--- a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog.cnf b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf
new file mode 100644
index 00000000000..9dbd81f758d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+
+[mysqld.2]
+log-bin
diff --git a/mysql-test/suite/galera/t/galera_as_slave_preordered.cnf b/mysql-test/suite/galera/t/galera_slave_replay.cnf
index d1a0fb15ff3..9449ec9cf40 100644
--- a/mysql-test/suite/galera/t/galera_as_slave_preordered.cnf
+++ b/mysql-test/suite/galera/t/galera_slave_replay.cnf
@@ -1,3 +1 @@
!include ../galera_2nodes_as_slave.cnf
-[mysqld]
-wsrep-preordered=TRUE
diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test
new file mode 100644
index 00000000000..b3bdaeaa532
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_slave_replay.test
@@ -0,0 +1,199 @@
+#
+# This test tests the operation of transaction replay for async replication slave.
+# If a potentially conflicting galera transaction arrives at
+# just the right time during the commit and has lock conflict with async replication transaction
+# applied by slave SQL thread, then the async replication transaction should either abort
+# or rollback and replay (depending on the nature of lock conflict).
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--connection node_2a
+--source include/galera_cluster.inc
+
+#
+# node 1 is native MariaDB server operating as async replication master
+#
+--connection node_1
+RESET MASTER;
+
+--connection node_2a
+#
+# count the number of wsrep replay's done in the node
+#
+--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+
+
+#
+# nodes 2 and 3 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 1
+#
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+
+#
+# use statement format replication to cause a false positive conflict with async replication transaction
+# and galera replication. The conflict will be on GAP lock, and slave SQL thread should rollback
+# and replay
+#
+set binlog_format=STATEMENT;
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+SELECT * FROM t1 FOR UPDATE;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+
+--connection node_2a
+# wait for create table and inserts to be replicated from master
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+# wait for create table and inserts to be replicated in cluster
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+SET SESSION wsrep_sync_wait = 0;
+--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
+--source include/wait_condition.inc
+
+--connection node_2a
+# Block the future commit of async replication
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block also the applier before applying begins
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+#
+# now inject a conflicting insert from node 3, it will replicate with
+# earlier seqno (than async transaction) and pause before applying in node 2
+#
+--connection node_3
+INSERT INTO test.t1 VALUES (2, 'b');
+
+#
+# send the update from master, this will succeed here, beceuase of async replication.
+# async replication will apply this in node 2 and pause before commit phase,
+--connection node_1
+--error 0
+COMMIT;
+
+# Wait until async slave commit is blocked in node_2
+--connection node_2a
+--source include/galera_wait_sync_point.inc
+
+#
+# release the applier
+# note: have to clear wsrep_apply_cb sync point first, as async replication will go for replay
+# and as this sync point, after BF applier is released to progress
+#
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--connection node_1
+
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+SELECT * FROM t1;
+
+--connection node_2a
+
+# wsrep_local_replays has increased by 1
+set session wsrep_sync_wait=15;
+--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+set session wsrep_sync_wait=0;
+
+--disable_query_log
+--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
+--enable_query_log
+
+#
+# replaying of async transaction should be effective, and row 3 having 'c' in f2
+#
+SELECT * FROM t1;
+SET DEBUG_SYNC = "RESET";
+
+#********************************************************************************
+# test phase 2
+#********************************************************************************
+
+--echo #
+--echo # test phase with real abort
+--echo #
+
+--connection node_1
+
+set binlog_format=ROW;
+
+insert into t1 values (4, 'd');
+
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+
+--connection node_2a
+# wait for the last insert to be replicated from master
+--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
+--source include/wait_condition.inc
+
+# Block the commit
+--let $galera_sync_point = commit_monitor_enter_sync
+--source include/galera_set_sync_point.inc
+
+# block applier
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+
+# Inject a conflicting update from node 3
+--connection node_3
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+
+# send the update from master
+--connection node_1
+--error 0
+COMMIT;
+
+--connection node_2a
+
+# release the applier
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+
+
+# Unblock the async slave commit
+--connection node_2a
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+SET DEBUG_SYNC = "RESET";
+
+--connection node_2a
+
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+set session wsrep_sync_wait=0;
+
+STOP SLAVE;
+RESET SLAVE;
+
+DROP TABLE t1;
+
+--connection node_1
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_sp_bf_abort.inc b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc
new file mode 100644
index 00000000000..7ca8ecf20a9
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc
@@ -0,0 +1,36 @@
+#
+# Issue an INSERT for gap between 1 and 3 to node_2 and wait until it hits
+# apply monitor sync point on node_1
+#
+
+--connection node_1a
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_2
+--eval $galera_sp_bf_abort_conflict
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+# Send a procedure to node_1 which should take a gap lock between
+# rows 1 and 3. It does not conflict with INSERT from node_2 in
+# certification. Park the UPDATE after replicate and let INSERT to
+# continue applying, generating a BF abort.
+
+--let $galera_sync_point = after_replicate_sync
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+--send_eval CALL $galera_sp_bf_abort_proc
+
+--connection node_1a
+--let $galera_sync_point = after_replicate_sync apply_monitor_slave_enter_sync
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--let $galera_sync_point = apply_monitor_slave_enter_sync
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = after_replicate_sync
+--source include/galera_signal_sync_point.inc
diff --git a/mysql-test/suite/galera/t/galera_sp_bf_abort.test b/mysql-test/suite/galera/t/galera_sp_bf_abort.test
new file mode 100644
index 00000000000..b5f28c23b05
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sp_bf_abort.test
@@ -0,0 +1,350 @@
+#
+# Test cases for stored procedure BF aborts.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--connection node_1
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+
+# Control connection for Galera sync point management
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_1
+#
+# Case 1a: Procedure does and UPDATE which will suffer BF abort
+# but there is no actual conflict and non-conflicting INSERT.
+# The expected outcome is that both UPDATE and INSERT will succedd
+# and no errors are reported to the client, wsrep_local_replays is
+# incremented by one.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert()
+BEGIN
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+#
+# Case 1b: Procedure does and UPDATE which will suffer BF abort
+# but there is no actual conflict and non-conflicting INSERT.
+# An EXIT HANDLER is declared for the procedure.
+# The expected outcome is that both UPDATE and INSERT will succedd
+# and no errors are reported to the client, wsrep_local_replays is
+# incremented by one.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert_with_exit_handler()
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert_with_exit_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+#
+# Case 1c: Procedure does and UPDATE which will suffer BF abort
+# but there is no actual conflict and non-conflicting INSERT.
+# A CONTINUE HANDLER is declared for the procedure.
+# The expected outcome is that both UPDATE and INSERT will succedd
+# and no errors are reported to the client, wsrep_local_replays is
+# incremented by one.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert_with_continue_handler()
+BEGIN
+
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert_with_continue_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+#
+# Case 2a: UPDATE and INSERT are run inside a transaction and the transaction
+# will be BF aborted on COMMIT. The expected outcome is that the transaction
+# succeeds and no errors are reported to the client, wsrep_local_replays
+# is incremented by one.
+#
+
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert_transaction()
+BEGIN
+ START TRANSACTION;
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+ COMMIT;
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert_transaction
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+#
+# Case 2b: UPDATE and INSERT are run inside a transaction and the transaction
+# will be BF aborted on COMMIT. A CONTINUE HANDLER is declared for the
+# procedure. The expected outcome is that the transaction
+# succeeds and no errors are reported to the client, wsrep_local_replays
+# is incremented by one.
+#
+
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert_transaction_with_continue_handler()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ START TRANSACTION;
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+ COMMIT;
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert_transaction_with_continue_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+#
+# Case 2c: UPDATE and INSERT are run inside a transaction and the transaction
+# will be BF aborted on COMMIT. An EXIT HANDLE is declared for the procedure.
+# The expected outcome is that the transaction succeeds and no errors are
+# reported to the client, wsrep_local_replays is incremented by one.
+#
+
+DELIMITER |;
+CREATE PROCEDURE proc_update_insert_transaction_with_exit_handler()
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+ START TRANSACTION;
+ UPDATE t1 SET f2 = 'b';
+ INSERT INTO t1 VALUES (4, 'd');
+ COMMIT;
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_update_insert_transaction_with_exit_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 1 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+
+#
+# Case 3a: Two INSERTs are run inside stored procedure, this time
+# the first INSERT will have a BF abort and real conflict. The expected outcome
+# is that the INSERT fails and an error is reported to the client.
+# wsrep_local_replays is not incremented.
+#
+# Notice that the resulting error code may be both
+# ER_DUP_ENTRY (procedure will exit with cert failure conflict state and
+# will be) or ER_LOCK_DEADLOCK depending on timing.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_insert_insert_conflict()
+BEGIN
+ INSERT INTO t1 VALUES (2, 'd');
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_insert_insert_conflict
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--error ER_DUP_ENTRY,ER_LOCK_DEADLOCK, ER_ERROR_DURING_COMMIT
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 0 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+
+#
+# Case 3b: Two INSERTs are run inside stored procedure, this time
+# the first INSERT will have a BF abort and real conflict.
+# An EXIT HANDLER is declared for the procedure. The expected outcome
+# is that the INSERT fails and an error is reported to the client.
+# wsrep_local_replays is not incremented.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_insert_insert_conflict_with_exit_handler()
+BEGIN
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT "Conflict exit handler";
+ INSERT INTO t1 VALUES (2, 'd');
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_insert_insert_conflict_with_exit_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 0 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+--connection node_1
+
+#
+# Case 3c: Two INSERTs are run inside stored procedure, this time
+# the first INSERT will have a BF abort and real conflict.
+# A CONTINUE HANDLER is declared for the procedure. The expected outcome
+# is that the the first INSERT fails but the second is executed without
+# errors. wsrep_local_replays is not incremented.
+#
+DELIMITER |;
+CREATE PROCEDURE proc_insert_insert_conflict_with_continue_handler()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT "Conflict continue handler";
+ INSERT INTO t1 VALUES (2, 'd');
+ INSERT INTO t1 VALUES (4, 'd');
+END|
+DELIMITER ;|
+
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+--let $wsrep_local_replays_orig = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--let $galera_sp_bf_abort_proc = proc_insert_insert_conflict_with_continue_handler
+--let $galera_sp_bf_abort_conflict = INSERT INTO t1 VALUES (2, 'c')
+SET SESSION wsrep_sync_wait = 0;
+--source galera_sp_bf_abort.inc
+--connection node_1
+--reap
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+--let $wsrep_local_replays_curr = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_replays'`
+--disable_query_log
+--eval SELECT $wsrep_local_replays_curr - $wsrep_local_replays_orig = 0 AS wsrep_local_replays;
+--enable_query_log
+
+DELETE FROM t1;
+
+
+DROP PROCEDURE proc_update_insert;
+DROP PROCEDURE proc_update_insert_with_continue_handler;
+DROP PROCEDURE proc_update_insert_with_exit_handler;
+DROP PROCEDURE proc_update_insert_transaction;
+DROP PROCEDURE proc_update_insert_transaction_with_continue_handler;
+DROP PROCEDURE proc_update_insert_transaction_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict;
+DROP PROCEDURE proc_insert_insert_conflict_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict_with_continue_handler;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf
new file mode 100644
index 00000000000..a09efd2e011
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+[mysqld]
+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'
+
+[mysqld.2]
+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_mariabackup_lost_found.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test
new file mode 100644
index 00000000000..d1c30656139
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.test
@@ -0,0 +1,71 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.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
+
+--connection node_2
+
+#--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 = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+CREATE DATABASE `lost+found`;
+USE `lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `lost+found`.t1;
+
+CREATE DATABASE `#mysql50#not_lost+found`;
+USE `#mysql50#not_lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+
+#
+# Force SST
+#
+--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
+
+--connection node_2
+
+--echo Starting server ...
+let $restart_noprint=2;
+--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
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+SELECT * FROM `lost+found`.t1;
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+
+--connection node_1
+
+DROP DATABASE `lost+found`;
+DROP DATABASE `#mysql50#not_lost+found`;
+
+# rmdir $MYSQLD_DATADIR/lost+found;
+# rmdir $MYSQLD_DATADIR/not_lost+found;
+
+# 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_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
index 336296e9bfe..5e6913d4d2b 100644
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
@@ -4,6 +4,8 @@
wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_debug=ON
+innodb-file-format='Barracuda'
+innodb-file-per-table=ON
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt
deleted file mode 100644
index ae3fb580433..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb-file-format='Barracuda'
---innodb-file-per-table=ON
diff --git a/mysql-test/suite/galera/t/galera_toi_truncate.test b/mysql-test/suite/galera/t/galera_toi_truncate.test
index 0c1d0e45e41..5b23a8c3f3e 100644
--- a/mysql-test/suite/galera/t/galera_toi_truncate.test
+++ b/mysql-test/suite/galera/t/galera_toi_truncate.test
@@ -4,50 +4,43 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--source include/have_debug_sync.inc
---source include/not_embedded.inc
+--source include/have_debug.inc
#
# INSERT and TRUNCATE on different nodes
#
--connection node_1
-CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-# Insert 1m rows
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 10 FROM ten;
--source include/wait_condition.inc
# Prevent autocommit retring from masking the deadlock error we expect to get
SET SESSION wsrep_retry_autocommit = 0;
-INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2;
+--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8
-set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
---send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
-
---connection node_1
-# Wait for a above insert to start
---let $wait_condition = SELECT COUNT(*) >= 100 from t1;
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Sending data%' AND INFO LIKE 'INSERT INTO t1 (f1)%';
--source include/wait_condition.inc
---send TRUNCATE TABLE t1;
-
--connection node_1
---reap
+TRUNCATE TABLE t1;
--connection node_2
--error ER_LOCK_DEADLOCK
--reap
---connection node_2
-SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
--connection node_1
-SELECT COUNT(*) = 0 FROM t1;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+
DROP TABLE t1;
DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_trigger.test b/mysql-test/suite/galera/t/galera_trigger.test
new file mode 100644
index 00000000000..54508583f4b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_trigger.test
@@ -0,0 +1,36 @@
+--source include/galera_cluster.inc
+#
+# MDEV-21578 CREATE OR REPLACE TRIGGER in Galera cluster not replicating
+#
+CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
+--delimiter |
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 100;
+END|
+--delimiter ;
+
+INSERT INTO t1 VALUES (1);
+SELECT * from t1;
+
+--delimiter |
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 200;
+END|
+--delimiter ;
+
+--connection node_2
+SET SESSION wsrep_sync_wait=15;
+SELECT * FROM t1;
+INSERT INTO t1 values (2);
+SELECT * FROM t1;
+
+--connection node_1
+SELECT * FROM t1;
+
+DROP TRIGGER tr1;
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/t/galera_udf-master.opt b/mysql-test/suite/galera/t/galera_udf-master.opt
deleted file mode 100644
index 14dfe3e20bc..00000000000
--- a/mysql-test/suite/galera/t/galera_udf-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
-$UDF_EXAMPLE_LIB_OPT
---query_cache_type=1
diff --git a/mysql-test/suite/galera/t/galera_udf.cnf b/mysql-test/suite/galera/t/galera_udf.cnf
new file mode 100644
index 00000000000..69d5acd65f3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_udf.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+$UDF_EXAMPLE_LIB_OPT
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
deleted file mode 100644
index dc82542128e..00000000000
--- a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin-use-v1-row-events=1
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.cnf b/mysql-test/suite/galera/t/galera_v1_row_events.cnf
new file mode 100644
index 00000000000..b95e321ad4f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_v1_row_events.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin-use-v1-row-events=1
+
+[mysqld.2]
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf
new file mode 100644
index 00000000000..523bae68763
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-auto-increment-control=ON
+
+[mysqld.2]
+wsrep-auto-increment-control=ON
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
deleted file mode 100644
index 0a03610888c..00000000000
--- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-auto-increment-control=ON
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 3e2108868af..f18069929f9 100644
--- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test
+++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test
@@ -3,9 +3,10 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--source include/have_perfschema.inc
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
@@ -30,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready';
# Must return 'Non-primary'
SHOW STATUS LIKE 'wsrep_cluster_status';
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON;
@@ -45,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
SET @@session.wsrep_dirty_reads=OFF;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
SELECT 1;
diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
index a1154ebce22..0d2a6effd92 100644
--- a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
+++ b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
@@ -1,10 +1,21 @@
#
# This test checks that innodb_disallow_writes works as expected
#
+# Note that we need to enable binlog for this test: If the commit
+# to InnoDB is done in one phase, the transaction is committed in
+# memory before it is persisted to disk. This means that the
+# innodb_disallow_writes=ON may not prevent transaction to
+# become visible to other readers. On the other hand, if the
+# commit is two phase (as it is with binlog), the transaction
+# will be blocked in prepare phase.
+#
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--let $datadir= `SELECT @@datadir`
+
+
# Open a separate connection to be used to run SHOW PROCESSLIST
--let $galera_connection_name = node_1a
--let $galera_server_number = 1
@@ -13,23 +24,48 @@
SET SESSION wsrep_sync_wait = 0;
--connection node_1
-CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
SET GLOBAL innodb_disallow_writes=ON;
---send INSERT INTO t1 VALUES (1);
+--exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_before
+
+#
+# This insert has no effect before innodb_disallow_writes is OFF
+#
+--send INSERT INTO t1 (f2) SELECT 'abcde ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_2
+INSERT INTO t1 (f2) SELECT 'fghij ' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1a
-SELECT COUNT(*) = 1 FROM t1;
-let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)' AND State = 'query end';
---source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+--sleep 5
+
+--exec find $datadir -type f-exec md5sum {} \; | md5sum >$MYSQLTEST_VARDIR/tmp/innodb_after
SET GLOBAL innodb_disallow_writes=OFF;
--connection node_1
--reap
-SELECT COUNT(*) = 1 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+
+--connection node_1
+--diff_files $MYSQLTEST_VARDIR/tmp/innodb_before $MYSQLTEST_VARDIR/tmp/innodb_after
--connection node_2
-SELECT COUNT(*) = 1 FROM t1;
DROP TABLE t1;
+DROP TABLE ten;
+
+--disconnect node_1a
+
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
index b261f878ced..fda61bf2914 100644
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd.test
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
@@ -3,10 +3,16 @@
# notifications into a table.
#
---source include/have_innodb.inc
--source include/galera_cluster.inc
+--source include/force_restart.inc
--connection node_1
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
+--let $wait_condition = SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
+--source include/wait_condition.inc
+
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+
+# CLEANUP
+DROP SCHEMA mtr_wsrep_notify;
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 8b80c04e3be..aa31b94d6e0 100644
--- a/mysql-test/suite/galera/t/galera_var_reject_queries.test
+++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test
@@ -5,6 +5,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
CREATE TABLE t1 (f1 INTEGER);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
@@ -15,7 +17,7 @@ SET SESSION wsrep_reject_queries = ALL;
SET GLOBAL wsrep_reject_queries = ALL;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
#
@@ -30,7 +32,7 @@ SET GLOBAL wsrep_reject_queries = ALL_KILL;
SELECT * FROM t1;
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
# Confirm that replication continues
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..d12ae7936cb 100644
--- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -4,7 +4,9 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.cnf b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf
new file mode 100644
index 00000000000..ff29db2306b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_sst_auth=root:
+
+[mysqld.2]
+wsrep_sst_auth=root:
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.opt b/mysql-test/suite/galera/t/galera_var_sst_auth.opt
deleted file mode 100644
index 67babbb1ae7..00000000000
--- a/mysql-test/suite/galera/t/galera_var_sst_auth.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep_sst_auth=root:
diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.test b/mysql-test/suite/galera/t/galera_wan_restart_ist.test
index 1cf5d4c7f74..8a011d60851 100644
--- a/mysql-test/suite/galera/t/galera_wan_restart_ist.test
+++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.test
@@ -10,7 +10,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/force_restart.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
@@ -22,10 +22,13 @@
--let $node_4=node_4
--source include/auto_increment_offset_save.inc
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
-CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -46,9 +49,13 @@ INSERT INTO t1 VALUES (13);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
---sleep 5
+
--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
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (11);
--connection node_2
@@ -59,9 +66,12 @@ INSERT INTO t1 VALUES (14);
--connection node_3
--source include/start_mysqld.inc
---sleep 5
--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (131);
#
@@ -73,9 +83,12 @@ INSERT INTO t1 VALUES (22);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
---sleep 5
--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
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (21);
--connection node_3
@@ -86,9 +99,12 @@ INSERT INTO t1 VALUES (24);
--connection node_2
--source include/start_mysqld.inc
---sleep 5
--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (221);
#
@@ -100,9 +116,12 @@ INSERT INTO t1 VALUES (34);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
---sleep 5
--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
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (31);
--connection node_2
@@ -113,9 +132,12 @@ INSERT INTO t1 VALUES (33);
--connection node_4
--source include/start_mysqld.inc
---sleep 5
--source include/wait_until_connected_again.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
INSERT INTO t1 VALUES (341);
@@ -124,22 +146,44 @@ INSERT INTO t1 VALUES (341);
#
--connection node_1
---let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
--source include/wait_condition.inc
-SELECT COUNT(*) = 19 FROM t1;
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT COUNT(*) = 19 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+
--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT COUNT(*) = 19 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_4
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-SELECT COUNT(*) = 19 FROM t1;
+
+--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
+--source include/wait_condition.inc
+
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+
--connection node_1
DROP TABLE t1;
@@ -158,4 +202,6 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
---source include/galera_end.inc
+--connection node_1
+--disconnect node_3
+--disconnect node_4
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt b/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
deleted file mode 100644
index 930c483bd64..00000000000
--- a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep_log_conflicts=ON
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf
new file mode 100644
index 00000000000..440c37bea81
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_log_conflicts=ON
+
+[mysqld.2]
+wsrep_log_conflicts=ON
+
+
+
+
+
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..422759ece59 100644
--- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test
@@ -7,18 +7,34 @@
--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';
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--connection node_1
+
+--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
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--connection node_2
-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';
-SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
-SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
-SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
-SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--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
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
diff --git a/mysql-test/suite/galera/t/lp1376747-4.test b/mysql-test/suite/galera/t/lp1376747-4.test
index 0c707d6d681..6ae89fe9df4 100644
--- a/mysql-test/suite/galera/t/lp1376747-4.test
+++ b/mysql-test/suite/galera/t/lp1376747-4.test
@@ -27,25 +27,24 @@ INSERT INTO t1 VALUES (2,3);
--connection node_2a
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
+
SHOW CREATE TABLE t1;
---sleep 1
--send FLUSH TABLES t1 WITH READ LOCK;
--connection node_2
-# let the flush table wait in pause state before we unlock
-# table otherwise there is window where-in flush table is
-# yet to wait in pause and unlock allows alter table to proceed.
-# this is because send in asynchronous.
---sleep 3
-# this will release existing lock but will not resume
-# the cluster as there is new FTRL that is still pausing it.
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
+--source include/wait_condition.inc
+
UNLOCK TABLES;
SHOW CREATE TABLE t1;
--connection node_2a
--reap
UNLOCK TABLES;
---sleep 2
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
SHOW CREATE TABLE t1;
SELECT * from t1;
diff --git a/mysql-test/suite/galera/t/mdev-22543.test b/mysql-test/suite/galera/t/mdev-22543.test
new file mode 100644
index 00000000000..1e7d3712639
--- /dev/null
+++ b/mysql-test/suite/galera/t/mdev-22543.test
@@ -0,0 +1,58 @@
+# The test verifies that the FLUSH TABLES WITH READ LOCK does not
+# time out if it needs to wait for another MDL lock for short duration
+# during SST donation.
+
+--source include/galera_cluster.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--let $node_1 = node_1
+--let $node_2 = node_2
+--source include/auto_increment_offset_save.inc
+
+--let $galera_connection_name = node_1_ctrl
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+#
+# Run UPDATE on node_1 and make it block before table locks are taken.
+# This should block FTWRL.
+#
+--connection node_1
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 1);
+SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
+--send UPDATE t1 SET f2 = 2 WHERE f1 = 1
+
+--connection node_1_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
+
+#
+# Restart node_2, force SST.
+#
+--connection node_2
+--source include/shutdown_mysqld.inc
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+# Restart without waiting. The UPDATE should block FTWRL on node_1,
+# so the SST cannot be completed and node_2 cannot join before
+# UPDATE connection is signalled to continue.
+--exec echo "restart:$start_mysqld_params" > $_expect_file_name
+# If the bug is present, FTWRL times out on node_1 in couple of
+# seconds and node_2 fails to join.
+--sleep 10
+
+--connection node_1_ctrl
+SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
+
+--connection node_1
+--reap
+SET DEBUG_SYNC = "RESET";
+
+--connection node_2
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--connection node_1
+DROP TABLE t1;
+
+--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt b/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt
deleted file mode 100644
index a00258bc48c..00000000000
--- a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf
new file mode 100644
index 00000000000..4a82e9fa037
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
diff --git a/mysql-test/suite/galera/t/query_cache.cnf b/mysql-test/suite/galera/t/query_cache.cnf
new file mode 100644
index 00000000000..4a82e9fa037
--- /dev/null
+++ b/mysql-test/suite/galera/t/query_cache.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
diff --git a/mysql-test/suite/galera/t/query_cache.opt b/mysql-test/suite/galera/t/query_cache.opt
deleted file mode 100644
index a00258bc48c..00000000000
--- a/mysql-test/suite/galera/t/query_cache.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index 1683485981b..0e2706f2dc3 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -1,2 +1,16 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : MDEV-<xxxx> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster
+galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(}
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 477789175fb..34ef09875ea 100644
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@ -28,6 +28,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#gale
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+wsrep-on=1
[mysqld.2]
#galera_port=@OPT.port
@@ -39,6 +40,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#gale
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-on=1
[mysqld.3]
#galera_port=@OPT.port
@@ -50,6 +52,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#gale
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
+wsrep-on=1
[mysqld.4]
@@ -64,6 +67,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#gale
wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
+wsrep-on=1
[mysqld.5]
wsrep_cluster_name=cluster2
@@ -76,6 +80,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#gale
wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port'
+wsrep-on=1
[mysqld.6]
wsrep_cluster_name=cluster2
@@ -88,6 +93,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#gale
wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port'
+wsrep-on=1
[ENV]
NODE_MYPORT_1= @mysqld.1.port
diff --git a/mysql-test/suite/galera_3nodes/r/GAL-501.result b/mysql-test/suite/galera_3nodes/r/GAL-501.result
index bcf74142144..4ddf3b2bce6 100644
--- a/mysql-test/suite/galera_3nodes/r/GAL-501.result
+++ b/mysql-test/suite/galera_3nodes/r/GAL-501.result
@@ -7,11 +7,11 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) 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
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result
index 35ca84119e7..43064cf6441 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result
@@ -1,27 +1,38 @@
+connection node_1;
cluster 1 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connection node_2;
cluster 1 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
cluster 1 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_4;
cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5;
+connection node_5;
cluster 2 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6;
+connection node_6;
cluster 2 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
+connection node_1;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
@@ -31,6 +42,7 @@ select @@gtid_binlog_state;
select @@gtid_slave_pos;
@@gtid_slave_pos
+connection node_4;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
@@ -41,15 +53,19 @@ select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
+connection node_1;
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 2 node 1
+connection node_4;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
@@ -62,31 +78,40 @@ cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 1 node 2
+connection node_2;
select @@gtid_binlog_state;
@@gtid_binlog_state
-1-11-2,2-21-1
+1-11-2
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 1 node 3
+connection node_3;
select @@gtid_binlog_state;
@@gtid_binlog_state
-1-11-2,1-12-3,2-21-1
+1-11-2,2-21-1
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 2 node 2
+connection node_5;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
@@ -95,9 +120,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
+connection node_4;
include/save_master_gtid.inc
+connection node_1;
include/sync_with_master_gtid.inc
cluster 2 node 3
+connection node_6;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
@@ -106,9 +134,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
+connection node_4;
include/save_master_gtid.inc
+connection node_1;
include/sync_with_master_gtid.inc
cluster 1 node 1
+connection node_1;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
@@ -119,15 +150,21 @@ change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
+connection node_4;
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
+connection node_2;
reset master;
+connection node_3;
reset master;
+connection node_5;
reset master;
+connection node_6;
reset master;
+connection node_1;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
@@ -137,6 +174,7 @@ select @@gtid_binlog_state;
select @@gtid_slave_pos;
@@gtid_slave_pos
+connection node_4;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
@@ -147,15 +185,19 @@ select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
-create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
+connection node_1;
+create table t1 (cluster_domain_id int not null,node_server_id int not null, seq_no int not null, primary key(cluster_domain_id, node_server_id,seq_no)) engine=innodb;
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 2 node 1
+connection node_4;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@gtid_binlog_state
@@ -165,9 +207,12 @@ cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 1 node 2
+connection node_2;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
@@ -176,9 +221,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 1 node 3
+connection node_3;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
@@ -187,9 +235,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
+connection node_1;
include/save_master_gtid.inc
+connection node_4;
include/sync_with_master_gtid.inc
cluster 2 node 2
+connection node_5;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
@@ -198,9 +249,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
+connection node_4;
include/save_master_gtid.inc
+connection node_1;
include/sync_with_master_gtid.inc
cluster 2 node 3
+connection node_6;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
@@ -209,9 +263,12 @@ select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
+connection node_4;
include/save_master_gtid.inc
+connection node_1;
include/sync_with_master_gtid.inc
cluster 1 node 1
+connection node_1;
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
@@ -221,11 +278,24 @@ change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
+connection node_4;
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
+connection node_2;
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
+connection node_3;
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
+connection node_5;
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
+connection node_6;
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
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 6ed7587303d..00000000000
--- a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result
+++ /dev/null
@@ -1,17 +0,0 @@
-connection node_1;
-connection node_2;
-connection node_3;
-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;
-COUNT(*) = 10
-1
-Killing server ...
-connection node_1;
-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_mariabackup.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result
index 5665ed5f46a..21403542ebe 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result
@@ -7,16 +7,16 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) 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
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_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 [, listening at: tcp://\[::1\]]
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result
index 53e35939a79..9a7a2eac18e 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result
@@ -4,15 +4,20 @@ VARIABLE_VALUE LIKE '%[::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';
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) 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
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_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\]:]
+connection node_2;
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 [, 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 3564dc8c5a1..512bb5c8c78 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result
@@ -12,12 +12,12 @@ SET GLOBAL wsrep_sst_method = 'mysqldump';
Shutting down server ...
connection node_1;
Cleaning var directory ...
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
Starting server ...
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
DROP TABLE t1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
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 bcf74142144..4ddf3b2bce6 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result
@@ -7,11 +7,11 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) 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
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result
index a2bf5f4d98c..4ddf3b2bce6 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result
@@ -4,11 +4,14 @@ VARIABLE_VALUE LIKE '%[::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';
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) 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
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
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_xtrabackup-v2.result
deleted file mode 100644
index 5665ed5f46a..00000000000
--- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result
+++ /dev/null
@@ -1,22 +0,0 @@
-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\]]
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result
new file mode 100644
index 00000000000..0461f1f1feb
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result
@@ -0,0 +1,40 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result
new file mode 100644
index 00000000000..d878f60ca6b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result
@@ -0,0 +1,50 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS process_primary_configuration
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result
new file mode 100644
index 00000000000..df0a924029c
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result
@@ -0,0 +1,55 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+4
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
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..4742fc1af9c 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
@@ -7,12 +7,18 @@ UPDATE t1 SET f1 = f1 + 10;;
connection node_2;
UPDATE t1 SET f1 = f1 + 100;;
connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
connection node_3;
-SELECT f1 = 111 FROM t1;
-f1 = 111
+SELECT COUNT(*) FROM t1;
+COUNT(*)
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_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
index 45b4d63fb4f..8b3211b2b26 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
@@ -2,7 +2,8 @@ connection node_1;
connection node_2;
connection node_3;
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (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']
@@ -48,6 +49,7 @@ CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` int(11) DEFAULT NULL
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP 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 77991a6d468..b4944fc87da 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
@@ -2,7 +2,7 @@ connection node_1;
connection node_2;
connection node_3;
connection node_1;
-CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index 4a861f3b9fa..350e4af98ff 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -22,7 +22,6 @@ push @::global_suppressions,
qr(WSREP:.*down context.*),
qr(WSREP: Failed to send state UUID:),
qr(WSREP: last inactive check more than .* skipping check),
- qr(WSREP: SQL statement was ineffective),
qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
qr(WSREP: Quorum: No node with complete state),
@@ -36,14 +35,38 @@ push @::global_suppressions,
qr(WSREP: user message in state LEAVING),
qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
- qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.),
+ qr(WSREP: Maximum writeset size exceeded by .*),
+ qr(WSREP: transaction size exceeded.*),
+ qr(WSREP: RBR event .*),
+ qr(WSREP: Ignoring error for TO isolated action: .*),
+ qr(WSREP: transaction size limit .*),
+ qr(WSREP: rbr write fail, .*),
+ qr(WSREP: .*Backend not supported: foo.*),
+ qr(WSREP: .*Failed to initialize backend using .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Socket type not supported),
+ qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*),
+ qr(WSREP: .*Failed to open backend connection: -110 .*),
+ qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
+ qr(WSREP: gcs connect failed: Connection timed out),
+ qr|WSREP: wsrep::connect\(.*\) failed: 7|,
+ qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
qr(WSREP: Could not find peer:),
+ qr(WSREP: TO isolation failed for: .*),
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: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|,
qr(WSREP: Action message in non-primary configuration from member [0-9]*),
+ qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*),
+ qr(WSREP: discarding established .*),
+ 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|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
+ qr(WSREP: Failed to remove page file .*),
+ qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*),
+ qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|,
+ qr|WSREP: Trying to continue unpaused monitor|,
);
bless { };
diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf
index 7002cb5bdfd..3b18a86093c 100644
--- a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf
+++ b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf
@@ -10,6 +10,7 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
+bind-address=::
[mysqld.2]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
@@ -17,6 +18,7 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
+bind-address=::
[mysqld.3]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
@@ -24,3 +26,4 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.3.port'
+bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.opt b/mysql-test/suite/galera_3nodes/t/GAL-501.opt
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/GAL-501.opt
+++ /dev/null
@@ -1 +0,0 @@
---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 a36f21630ac..39f514c07bc 100644
--- a/mysql-test/suite/galera_3nodes/t/GAL-501.test
+++ b/mysql-test/suite/galera_3nodes/t/GAL-501.test
@@ -6,6 +6,7 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
+--source include/force_restart.inc
# Confirm that initial handshake happened over ipv6
@@ -21,7 +22,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -33,6 +34,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test
index c679db1305d..2bb8d06462c 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test
@@ -10,7 +10,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/force_restart.inc
--connection node_1
--echo cluster 1 node 1
@@ -29,6 +29,7 @@ SHOW STATUS LIKE 'wsrep_cluster_size';
--connection node_4
--echo cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
+call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log.*");
--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5
--connection node_5
@@ -193,7 +194,7 @@ select @@gtid_slave_pos;
--echo cluster 1 node 1
--connection node_1
-create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
+create table t1 (cluster_domain_id int not null,node_server_id int not null, seq_no int not null, primary key(cluster_domain_id, node_server_id,seq_no)) engine=innodb;
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@ -283,10 +284,19 @@ reset master;
set global GTID_SLAVE_POS="";
--connection node_2
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
--connection node_3
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
--connection node_5
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
--connection node_6
+set session wsrep_on=off;
reset master;
+set session wsrep_on=on;
+
diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf
deleted file mode 100644
index 35ecb8b5937..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf
+++ /dev/null
@@ -1,4 +0,0 @@
-!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 8dfb4660f3e..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test
+++ /dev/null
@@ -1,80 +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
---source include/have_mariabackup.inc
-
---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 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 mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp $MYSQL_TMP_DIR/innobackupex_backup &> $MYSQL_TMP_DIR/innobackupex-backup.log
---exec mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp $MYSQL_TMP_DIR/innobackupex_backup &> $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 mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --copy-back --port=$NODE_MYPORT_2 --host=127.0.0.1 $MYSQL_TMP_DIR/innobackupex_backup &> $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
---let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
---source include/wait_condition.inc
-
-SELECT COUNT(*) = 20 FROM t1;
-
-DROP TABLE t1;
-
---sleep 10
-
---let $galera_connection_name = node_2a
---let $galera_server_number = 2
---source include/galera_connect.inc
---let $node_2=node_2a
-
-# 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_mariabackup.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf
index 5ac00fa056b..8432b1c368c 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf
@@ -10,18 +10,26 @@ 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
+bind-address=::
[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
+bind-address=::
[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
+bind-address=::
[SST]
transferfmt=@ENV.MTR_GALERA_TFMT
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt
+++ /dev/null
@@ -1 +0,0 @@
---bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
index 808dad0dbb2..dc3331d1be3 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
@@ -2,6 +2,7 @@
--source include/check_ipv6.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc
+--source include/force_restart.inc
# Confirm that initial handshake happened over ipv6
@@ -17,7 +18,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -29,7 +30,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
@@ -55,6 +56,8 @@ DROP TABLE t1;
--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 IST
+--let $assert_count = 1
+--let $assert_text = , listening at: tcp://\[::1\]
+--let $assert_select = , listening at: tcp://\[::1\]
--source include/assert_grep.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf
index dc294854056..aa3da690416 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf
@@ -3,35 +3,37 @@
# decoy value - should not be read by mysqld or sst scripts
[mysqld]
innodb-data-home-dir=/tmp
-
-[galera]
+bind-address=::
innodb-data-home-dir=
wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_node_address=::1
-[galera.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
+bind-address=::
-[galera.2]
+[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
+bind-address=::
-[galera.3]
+[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
+bind-address=::
[SST]
transferfmt=@ENV.MTR_GALERA_TFMT
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt
+++ /dev/null
@@ -1 +0,0 @@
---bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
index 72f4fde299b..c88ff99790c 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
@@ -2,6 +2,7 @@
--source include/check_ipv6.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc
+--source include/force_restart.inc
# Confirm that initial handshake happened over ipv6
@@ -17,7 +18,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -29,7 +30,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
@@ -63,8 +64,8 @@ DROP TABLE t1;
--let $assert_select = IST receiver addr using tcp://\[::1\]
--source include/assert_grep.inc
-# There will be only one Prepared IST and in Galera 3 segnos are not printed
---let $assert_count= 1
---let $assert_text = Prepared IST receiver, listening at: tcp://\[::1\]
---let $assert_select = Prepared IST receiver, listening at: tcp://\[::1\]
+# The receiver expects IST
+--let $assert_count = 1
+--let $assert_text = , listening at: tcp://\[::1\]
+--let $assert_select = , 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 80dd0c41cc3..5e77a45210b 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf
@@ -9,18 +9,21 @@ 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'
+bind-address=::
[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'
+bind-address=::
[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'
+bind-address=::
[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
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt
+++ /dev/null
@@ -1 +0,0 @@
---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 4a6de8abb9c..4904a49c73b 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
+--source include/force_restart.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");
@@ -53,7 +54,7 @@ SET GLOBAL wsrep_sst_method = 'mysqldump';
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -69,7 +70,7 @@ INSERT INTO t1 VALUES (1);
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
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 80dd0c41cc3..5e77a45210b 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf
@@ -9,18 +9,21 @@ 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'
+bind-address=::
[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'
+bind-address=::
[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'
+bind-address=::
[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
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt
+++ /dev/null
@@ -1 +0,0 @@
---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 1937eb43e13..448611e34e0 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,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
+--source include/force_restart.inc
# Confirm that initial handshake happened over ipv6
@@ -15,7 +16,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -27,6 +28,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf
index 7cac8e1451e..809b83bb782 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf
@@ -4,28 +4,31 @@
[mysqld]
innodb-data-home-dir=/tmp
-[mariadb]
+[mysqld]
innodb-data-home-dir=
wsrep_sst_method=rsync
wsrep_node_address=::1
-[mariadb.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'
+bind-address=::
-[mariadb.2]
+[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'
+bind-address=::
-[mariadb.3]
+[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'
+bind-address=::
[SST]
sockopt=",pf=ip6"
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt
deleted file mode 100644
index c2bb4d156af..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt
+++ /dev/null
@@ -1 +0,0 @@
---bind-address=::
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
index 1937eb43e13..448611e34e0 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
+--source include/force_restart.inc
# Confirm that initial handshake happened over ipv6
@@ -15,7 +16,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@@ -27,6 +28,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf
deleted file mode 100644
index 78fbd793aa0..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf
+++ /dev/null
@@ -1,29 +0,0 @@
-!include ../galera_3nodes.cnf
-
-[mysqld]
-wsrep_sst_method=xtrabackup-v2
-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'
-
-[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'
-
-[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'
-
-[SST]
-transferfmt=@ENV.MTR_GALERA_TFMT
-streamfmt=xbstream
-sockopt=",pf=ip6"
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt
deleted file mode 100644
index c195dd0f35b..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt
+++ /dev/null
@@ -1 +0,0 @@
---bind-address=:: --skip-innodb-safe-truncate
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test
deleted file mode 100644
index fd7e0c50887..00000000000
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test
+++ /dev/null
@@ -1,58 +0,0 @@
---source include/galera_cluster.inc
---source include/check_ipv6.inc
-
-# Confirm that initial handshake happened over ipv6
-
-SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';
-SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
-
-# Force IST
-
---connection node_2
-SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
-
---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
-
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
---connection node_2
-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 = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
---source include/wait_condition.inc
-
-SELECT COUNT(*) = 1 FROM t1;
-
-DROP TABLE t1;
-
-# Confirm that key messages around SST and IST reference IPv6
-
---connection node_1
---let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
---let $assert_only_after = CURRENT_TEST
-
---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
---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
-
---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\]
---source include/assert_grep.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test
new file mode 100644
index 00000000000..e181b6831af
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test
@@ -0,0 +1,262 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant A: sending of state transfer request delayed until two more
+# primary configuration changes happen
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.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
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+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
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+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
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 just before sending state transfer request
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It still is blocked before sending state transfer request in PC2.
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC4 and allow node_1
+# to send state transfer request to be delivered in PC4 (and thus get
+# updated to PC4 seqno in state transfer.
+# Note that node_1 still processes PC2.
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC4. node_1 is still processing PC2, waiting to send state trasfer
+# request
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_signal_sync_point.inc
+# sent STR from PC2 into PC4
+
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC3, but should have completed state transfer from
+# PC4 and thus must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC4, still must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--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("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test
new file mode 100644
index 00000000000..7618f5a112c
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test
@@ -0,0 +1,273 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant B: sending of state transfer request is immediate but completion
+# of IST delayed until two more primary configuration changes happen
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.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
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+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
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+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
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 right after progressing to JOINER state and
+# before IST happens.
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+# Here node_1 is processing PC2 just before sending state request
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+# Proceed to sending state transfer request and block right after
+--source include/galera_signal_sync_point.inc # before_send_state_request
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It is blocked right after shifting to JOINING state.
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC4 and allow node_1
+# to continue with IST.
+# Note that node_1 still processes PC2 and is joining.
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC4. node_1 is still processing PC2, waiting to send state trasfer
+# request
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+# continue with IST prepared for in PC2
+
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC3, and should have finished state transfer
+# State tranfer request was dilivered before PC3, so node_1 should have
+# received IST up to 4 rows in t1 (what was there before PC2) plus one more
+# INSERT while in PC2.
+#
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_wait_sync_point.inc
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+#
+# Now node_1 is processing PC4, still must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--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("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test
new file mode 100644
index 00000000000..68dea95854c
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test
@@ -0,0 +1,299 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant C: sending of state transfer request is scheduled while in non-PRIM
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source suite/galera/include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.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
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+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
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+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
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 right after progressing to JOINER state and
+# before IST happens.
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+# Here we are processing PC2 just before sending state request
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It still is blocked before sending state transfer request in PC2.
+#
+--connection node_1
+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
+
+--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
+
+# Proceed to sending state transfer request
+--connection node_1a
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_signal_sync_point.inc # before_send_state_request
+#
+# node_1 proceeds to sending state transfer request, it will be delivered only
+# in the next PC which is PC3. Only then the node will shift to JOINING
+#
+--echo 4
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+
+--connection node_3
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# node_1 is stiil processing PC2, it was let to send state transfer request
+# while in non-PRIM. Now it should be able to complete it and shift to
+# JOINING. Make it block on next PC(3) and continue to receive IST
+--connection node_1a
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc # won't need it any more
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+# continue with IST while still processing PC2
+
+#
+# Now disconnect and reconnect node_1 again to generate PC4.
+#
+--connection node_1
+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
+
+--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
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+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
+#
+# This is PC4. node_1 should complete IST, complete PC2, and continue
+# with the next item in queue
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+
+#
+# Now node_1 is blocked before processing PC3, and should have finished state
+# transfer started while in PC2.
+# State tranfer request was dilivered in PC3 to donor, so node_1 should have
+# received IST up to 6 rows in t1 (what was there before PC3).
+#
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+# continue with processing PC3
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+
+# wait for row that follows PC3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# wait till PC4
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC4, still must have 7 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# Continue with PC4
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--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("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
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..f1168e59193 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
@@ -24,14 +24,26 @@ SET GLOBAL wsrep_slave_threads = 2;
--send UPDATE t1 SET f1 = f1 + 100;
--connection node_1
+#
+# Note that test is not deterministic. We have following cases possible
+# (1) Both updates are certified locally and then executed by the applier
+# (2) Certification of update in node_1 fails because applier has started
+# update from node_2
+# (3) Certification of update in node_2 fails because applier has started
+# update from node_1
+#
+--error 0,ER_LOCK_DEADLOCK
--reap
+SELECT COUNT(*) FROM t1;
--connection node_2
+--error 0,ER_LOCK_DEADLOCK
--reap
+SELECT COUNT(*) FROM t1;
--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(*) FROM t1;
+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_safe_to_bootstrap.cnf b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf
new file mode 100644
index 00000000000..880a413f4b6
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.cnf
@@ -0,0 +1,10 @@
+!include ../galera_3nodes.cnf
+
+[mysqld.1]
+wsrep_debug=1
+
+[mysqld.2]
+wsrep_debug=1
+
+[mysqld.3]
+wsrep_debug=1
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 b7b6c66e5ad..e0b2e26927c 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
@@ -2,6 +2,7 @@
# Test the safe_to_bootstrap in grastate.dat
#
--source include/galera_cluster.inc
+--source include/force_restart.inc
--let $galera_connection_name = node_3
--let $galera_server_number = 3
@@ -14,7 +15,11 @@
--source ../galera/include/auto_increment_offset_save.inc
--connection node_1
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
#
# At start, all grastate.dat files have safe_to_boostrap: 0
@@ -151,10 +156,18 @@ SET SESSION wsrep_on = OFF;
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
+--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
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--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
+
+
--connection node_3
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--source include/start_mysqld.inc
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 e3f94a012b8..63eff486ba3 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
@@ -16,10 +16,13 @@
--source ../galera/include/auto_increment_offset_save.inc
--connection node_1
-CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--connection node_1
@@ -28,7 +31,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--connection node_2
SET SESSION wsrep_sync_wait = 0;
-
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
@@ -111,6 +113,7 @@ SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST;
# Restore cluster
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';
diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc
index 97c9e41b5e8..475ab96e56f 100644
--- a/mysql-test/suite/gcol/inc/gcol_keys.inc
+++ b/mysql-test/suite/gcol/inc/gcol_keys.inc
@@ -747,4 +747,66 @@ ANALYZE TABLE t1, t2;
--eval $query
DROP TABLE t1, t2;
+if($support_virtual_index)
+{
+--echo #
+--echo # MDEV-20618 Assertion `btr_validate_index(index, 0, false)' failed
+--echo # in row_upd_sec_index_entry
+--echo #
+CREATE TABLE t1 (A BIT(15), VA BIT(10) GENERATED ALWAYS AS (A),PK INT,
+ PRIMARY KEY (PK), UNIQUE KEY (VA));
+
+INSERT IGNORE INTO t1 VALUES ( '\r1','a',1);
+--error ER_DATA_TOO_LONG
+REPLACE INTO t1 (PK) VALUES (1);
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17890 Record in index was not found on update, server crash in
+--echo # row_upd_build_difference_binary or
+--echo # Assertion `0' failed in row_upd_sec_index_entry
+--echo #
+CREATE TABLE t1 (
+ pk BIGINT AUTO_INCREMENT,
+ b BIT(15),
+ v BIT(10) AS (b) VIRTUAL,
+ PRIMARY KEY(pk),
+ UNIQUE(v)
+);
+
+INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
+SELECT pk, b INTO OUTFILE 'load.data' FROM t1;
+--error ER_DATA_TOO_LONG
+LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);
+
+--let $datadir= `SELECT @@datadir`
+--remove_file $datadir/test/load.data
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17834 Server crashes in row_upd_build_difference_binary
+--echo # on LOAD DATA into table with indexed virtual column
--echo #
+CREATE TABLE t1 (
+ pk INT,
+ i TINYINT,
+ ts TIMESTAMP NULL,
+ vi TINYINT AS (i+1) PERSISTENT,
+ vts TIMESTAMP(5) AS (ts) VIRTUAL,
+ PRIMARY KEY(pk),
+ UNIQUE(vts)
+);
+
+INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+
+--write_file $MYSQLTEST_VARDIR/tmp/load.data
+1 4 2019-01-01 00:00:00
+EOF
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--error ER_WARN_DATA_OUT_OF_RANGE
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (pk,i,ts);
+
+--remove_file $MYSQLTEST_VARDIR/tmp/load.data
+DROP TABLE t1;
+}
diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result
index 9aff30aabc9..8eb7a9372b5 100644
--- a/mysql-test/suite/gcol/r/gcol_bugfixes.result
+++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result
@@ -603,3 +603,69 @@ test gcol_t1 sidea NEVER NULL
test gcol_t1 sideb NEVER NULL
test gcol_t1 sidec VIRTUAL GENERATED ALWAYS sqrt(`sidea` * `sidea` + `sideb` * `sideb`)
DROP TABLE gcol_t1;
+#
+# MDEV-16039 Crash when selecting virtual columns
+# generated using functions with DAYNAME()
+#
+CREATE TABLE t1 (
+suppliersenttoday INT NOT NULL,
+suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
+) COLLATE utf8_bin;
+INSERT INTO t1 (suppliersenttoday) VALUES (0);
+INSERT INTO t1 (suppliersenttoday) VALUES (0);
+SELECT * FROM t1;
+suppliersenttoday suppliercaptoday
+0 Wednesday
+0 Wednesday
+PREPARE STMT FROM 'INSERT INTO t1 (suppliersenttoday) VALUES (1)';
+CREATE OR REPLACE TABLE t1 (
+suppliersenttoday INT NOT NULL,
+suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
+) COLLATE utf8_bin;
+EXECUTE STMT;
+EXECUTE STMT;
+SELECT * FROM t1;
+suppliersenttoday suppliercaptoday
+1 Wednesday
+1 Wednesday
+DROP TABLE t1;
+# (duplicate) MDEV-20380 Server crash during update
+CREATE TABLE gafld (
+nuigafld INTEGER NOT NULL,
+ucrgafld VARCHAR(30) COLLATE UTF8_BIN NOT NULL
+DEFAULT SUBSTRING_INDEX(USER(),'@',1)
+);
+EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gafld ALL NULL NULL NULL NULL 1 Using where
+EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gafld ALL NULL NULL NULL NULL 1 Using where
+DROP TABLE gafld;
+# (duplicate) MDEV-17653 replace into generated columns is unstable
+# Some columns are snipped from the MDEV test
+CREATE TABLE t (
+c0 TIMESTAMP NOT NULL DEFAULT current_timestamp()
+ON UPDATE current_timestamp(),
+c1 DECIMAL(27,25) GENERATED ALWAYS AS (DAYOFMONTH('2020-02-05')),
+c4 TIME NOT NULL,
+c8 SMALLINT(6) GENERATED ALWAYS AS
+(CONCAT_WS(CONVERT(C1 USING CP932),
+'900') <> (c4 = 1)),
+PRIMARY KEY (c4)
+) DEFAULT CHARSET=latin1;
+REPLACE INTO t SET c0 = '2018-06-03 10:31:43', c4 = '02:58:55';
+REPLACE INTO t SET c0 = '2018-06-03 10:31:44', c4 = '02:58:55';
+REPLACE INTO t SET c0 = '2018-06-03 10:31:45', c4 = '02:58:55';
+DROP TABLE t;
+# (duplicate) MDEV-17986 crash when I insert on a table
+CREATE OR REPLACE TABLE t2 (
+number BIGINT(20) NOT NULL,
+lrn BIGINT(20) NOT NULL DEFAULT 0,
+source VARCHAR(15) NOT NULL
+DEFAULT (REVERSE(SUBSTRING_INDEX(REVERSE(user()), '@', 1))),
+PRIMARY KEY (number)
+);
+REPLACE t2(number) VALUES('1');
+REPLACE t2(number) VALUES('1');
+DROP TABLE t2;
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index 04ba512aad9..ae2843dd2ec 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -825,6 +825,56 @@ a1 a2 b
0 NULL 1
DROP TABLE t1, t2;
#
+# MDEV-20618 Assertion `btr_validate_index(index, 0, false)' failed
+# in row_upd_sec_index_entry
+#
+CREATE TABLE t1 (A BIT(15), VA BIT(10) GENERATED ALWAYS AS (A),PK INT,
+PRIMARY KEY (PK), UNIQUE KEY (VA));
+INSERT IGNORE INTO t1 VALUES ( '\r1','a',1);
+Warnings:
+Warning 1906 The value specified for generated column 'VA' in table 't1' has been ignored
+Warning 1264 Out of range value for column 'VA' at row 1
+REPLACE INTO t1 (PK) VALUES (1);
+ERROR 22001: Data too long for column 'VA' at row 1
+DROP TABLE t1;
+#
+# MDEV-17890 Record in index was not found on update, server crash in
+# row_upd_build_difference_binary or
+# Assertion `0' failed in row_upd_sec_index_entry
+#
+CREATE TABLE t1 (
+pk BIGINT AUTO_INCREMENT,
+b BIT(15),
+v BIT(10) AS (b) VIRTUAL,
+PRIMARY KEY(pk),
+UNIQUE(v)
+);
+INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
+Warnings:
+Warning 1264 Out of range value for column 'v' at row 1
+SELECT pk, b INTO OUTFILE 'load.data' FROM t1;
+LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);
+ERROR 22001: Data too long for column 'v' at row 1
+DROP TABLE t1;
+#
+# MDEV-17834 Server crashes in row_upd_build_difference_binary
+# on LOAD DATA into table with indexed virtual column
+#
+CREATE TABLE t1 (
+pk INT,
+i TINYINT,
+ts TIMESTAMP NULL,
+vi TINYINT AS (i+1) PERSISTENT,
+vts TIMESTAMP(5) AS (ts) VIRTUAL,
+PRIMARY KEY(pk),
+UNIQUE(vts)
+);
+INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+Warnings:
+Warning 1264 Out of range value for column 'vi' at row 1
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (pk,i,ts);
+ERROR 22003: Out of range value for column 'vi' at row 1
+DROP TABLE t1;
#
# BUG#21365158 WL8149:ASSERTION `!TABLE || (!TABLE->WRITE_SET
#
diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result
index dcbba1f70c1..a91a77aedf3 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result
@@ -827,6 +827,56 @@ a1 a2 b
0 NULL 1
DROP TABLE t1, t2;
#
+# MDEV-20618 Assertion `btr_validate_index(index, 0, false)' failed
+# in row_upd_sec_index_entry
+#
+CREATE TABLE t1 (A BIT(15), VA BIT(10) GENERATED ALWAYS AS (A),PK INT,
+PRIMARY KEY (PK), UNIQUE KEY (VA));
+INSERT IGNORE INTO t1 VALUES ( '\r1','a',1);
+Warnings:
+Warning 1906 The value specified for generated column 'VA' in table 't1' has been ignored
+Warning 1264 Out of range value for column 'VA' at row 1
+REPLACE INTO t1 (PK) VALUES (1);
+ERROR 22001: Data too long for column 'VA' at row 1
+DROP TABLE t1;
+#
+# MDEV-17890 Record in index was not found on update, server crash in
+# row_upd_build_difference_binary or
+# Assertion `0' failed in row_upd_sec_index_entry
+#
+CREATE TABLE t1 (
+pk BIGINT AUTO_INCREMENT,
+b BIT(15),
+v BIT(10) AS (b) VIRTUAL,
+PRIMARY KEY(pk),
+UNIQUE(v)
+);
+INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
+Warnings:
+Warning 1264 Out of range value for column 'v' at row 1
+SELECT pk, b INTO OUTFILE 'load.data' FROM t1;
+LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);
+ERROR 22001: Data too long for column 'v' at row 1
+DROP TABLE t1;
+#
+# MDEV-17834 Server crashes in row_upd_build_difference_binary
+# on LOAD DATA into table with indexed virtual column
+#
+CREATE TABLE t1 (
+pk INT,
+i TINYINT,
+ts TIMESTAMP NULL,
+vi TINYINT AS (i+1) PERSISTENT,
+vts TIMESTAMP(5) AS (ts) VIRTUAL,
+PRIMARY KEY(pk),
+UNIQUE(vts)
+);
+INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+Warnings:
+Warning 1264 Out of range value for column 'vi' at row 1
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/load.data' REPLACE INTO TABLE t1 (pk,i,ts);
+ERROR 22003: Out of range value for column 'vi' at row 1
+DROP TABLE t1;
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2,t3;
DROP PROCEDURE IF EXISTS p1;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result
index 0309f084e5d..c9d95dae579 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_debug_purge.result
@@ -12,7 +12,7 @@ CREATE TABLE `t` (
INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug;
@@ -27,7 +27,7 @@ i INT
INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug;
@@ -48,7 +48,7 @@ insert into t1 values(3, 4, default);
insert into t1 values(3, 12, default);
insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x);
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1;
InnoDB 0 transactions not purged
SET global debug_dbug=@old_dbug;
@@ -138,7 +138,7 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
-set global debug_dbug="+d,ib_purge_virtual_index_callback";
+set global debug_dbug="d,ib_purge_virtual_index_callback";
connect prevent_purge, localhost, root;
start transaction with consistent snapshot;
connection default;
@@ -181,7 +181,7 @@ CREATE TABLE t1 (y YEAR, vy YEAR AS (y) VIRTUAL UNIQUE, pk INT PRIMARY KEY)
ENGINE=InnoDB;
INSERT INTO t1 (pk,y) VALUES (1,2022);
CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
-SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback';
+SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback';
BEGIN;
INSERT INTO t2(f1) VALUES(1);
connection prevent_purge;
@@ -208,8 +208,8 @@ DROP TABLE t1, t2;
# MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf
# on table with virtual columns and indexes
#
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
primary key(pk), index (vb(64)))
@@ -218,7 +218,7 @@ insert ignore into t1 (b) values ('foo');
select * into outfile 'load.data' from t1;
load data infile 'load.data' replace into table t1;
set debug_sync= "now WAIT_FOR latch_released TIMEOUT 1";
-set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
+set global debug_dbug= @saved_dbug;
drop table t1;
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table TIMEOUT 1";
create table t1 (
@@ -233,48 +233,3 @@ set global debug_dbug= @saved_dbug;
drop table t1;
set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
-#
-# MDEV-18546 ASAN heap-use-after-free
-# in innobase_get_computed_value / row_purge
-#
-CREATE TABLE t1 (
-pk INT AUTO_INCREMENT,
-b BIT(15),
-v BIT(15) AS (b) VIRTUAL,
-PRIMARY KEY(pk),
-UNIQUE(v)
-) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 (b) VALUES
-(NULL),(b'011'),(b'000110100'),
-(b'01101101010'),(b'01111001001011'),(NULL);
-SET GLOBAL innodb_debug_sync = "ib_clust_v_col_before_row_allocated "
- "SIGNAL before_row_allocated "
- "WAIT_FOR flush_unlock";
-SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
- "SIGNAL purge_open "
- "WAIT_FOR select_open";
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_index_callback";
-connect purge_waiter,localhost,root;
-SET debug_sync= "now WAIT_FOR before_row_allocated";
-connection default;
-REPLACE INTO t1 (pk, b) SELECT pk, b FROM t1;
-connection purge_waiter;
-connection default;
-disconnect purge_waiter;
-FLUSH TABLES;
-SET GLOBAL innodb_debug_sync = reset;
-SET debug_sync= "now SIGNAL flush_unlock WAIT_FOR purge_open";
-SET GLOBAL innodb_debug_sync = reset;
-SET debug_sync= "ib_open_after_dict_open SIGNAL select_open";
-SELECT * FROM t1;
-pk b v
-1 NULL NULL
-2
-3
-4 j j
-5 K K
-6 NULL NULL
-DROP TABLE t1;
-SET debug_sync= reset;
-set global debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
index d5b4755e3c5..50685e04a69 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
@@ -740,3 +740,53 @@ t1 CREATE TABLE `t1` (
KEY `v4` (`v4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
+#
+# MDEV-20396 Server crashes after DELETE with SEL NULL Foreign key and a
+# virtual column in index
+#
+CREATE TABLE parent
+(
+ID int unsigned NOT NULL,
+PRIMARY KEY (ID)
+);
+CREATE TABLE child
+(
+ID int unsigned NOT NULL,
+ParentID int unsigned NULL,
+Value int unsigned NOT NULL DEFAULT 0,
+Flag int unsigned AS (Value) VIRTUAL,
+PRIMARY KEY (ID),
+KEY (ParentID, Flag),
+FOREIGN KEY (ParentID) REFERENCES parent (ID) ON DELETE SET NULL
+ON UPDATE CASCADE
+);
+INSERT INTO parent (ID) VALUES (100);
+INSERT INTO child (ID,ParentID,Value) VALUES (123123,100,1);
+DELETE FROM parent WHERE ID=100;
+select * from child;
+ID ParentID Value Flag
+123123 NULL 1 1
+INSERT INTO parent (ID) VALUES (100);
+UPDATE child SET ParentID=100 WHERE ID=123123;
+DROP TABLE child, parent;
+#
+# MDEV-23387 dict_load_foreign() fails to load the table during alter
+#
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+f3 INT AS (f1) VIRTUAL,
+INDEX(f1), INDEX(f2))ENGINE=InnoDB;
+ALTER TABLE t1 ADD CONSTRAINT r FOREIGN KEY(f2) REFERENCES t1(f1), LOCK=NONE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ `f3` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL,
+ KEY `f1` (`f1`),
+ KEY `f2` (`f2`),
+ CONSTRAINT `r` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP INDEX f1;
+ALTER TABLE t1 DROP f3;
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result
index cd079544ed0..20311a21136 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_index.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result
@@ -259,6 +259,9 @@ ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row
SELECT * FROM t1;
a b vb
ROLLBACK;
+SELECT * FROM t1;
+a b vb
+1 20190132 0000-00-00
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test
index 5563347a02a..033c430853d 100644
--- a/mysql-test/suite/gcol/t/gcol_bugfixes.test
+++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test
@@ -564,3 +564,73 @@ SELECT table_schema,table_name,column_name,extra,is_generated,generation_express
FROM information_schema.columns WHERE table_name='gcol_t1';
DROP TABLE gcol_t1;
+
+--echo #
+--echo # MDEV-16039 Crash when selecting virtual columns
+--echo # generated using functions with DAYNAME()
+--echo #
+
+CREATE TABLE t1 (
+ suppliersenttoday INT NOT NULL,
+ suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
+) COLLATE utf8_bin;
+
+INSERT INTO t1 (suppliersenttoday) VALUES (0);
+INSERT INTO t1 (suppliersenttoday) VALUES (0);
+SELECT * FROM t1;
+
+PREPARE STMT FROM 'INSERT INTO t1 (suppliersenttoday) VALUES (1)';
+
+CREATE OR REPLACE TABLE t1 (
+ suppliersenttoday INT NOT NULL,
+ suppliercaptoday CHAR(10) AS (CONCAT('',DAYNAME('2020-02-05')))
+) COLLATE utf8_bin;
+
+EXECUTE STMT;
+EXECUTE STMT;
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+--echo # (duplicate) MDEV-20380 Server crash during update
+CREATE TABLE gafld (
+ nuigafld INTEGER NOT NULL,
+ ucrgafld VARCHAR(30) COLLATE UTF8_BIN NOT NULL
+ DEFAULT SUBSTRING_INDEX(USER(),'@',1)
+);
+EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
+EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10;
+DROP TABLE gafld;
+
+--echo # (duplicate) MDEV-17653 replace into generated columns is unstable
+--echo # Some columns are snipped from the MDEV test
+CREATE TABLE t (
+ c0 TIMESTAMP NOT NULL DEFAULT current_timestamp()
+ ON UPDATE current_timestamp(),
+ c1 DECIMAL(27,25) GENERATED ALWAYS AS (DAYOFMONTH('2020-02-05')),
+ c4 TIME NOT NULL,
+ c8 SMALLINT(6) GENERATED ALWAYS AS
+ (CONCAT_WS(CONVERT(C1 USING CP932),
+ '900') <> (c4 = 1)),
+ PRIMARY KEY (c4)
+) DEFAULT CHARSET=latin1;
+
+REPLACE INTO t SET c0 = '2018-06-03 10:31:43', c4 = '02:58:55';
+REPLACE INTO t SET c0 = '2018-06-03 10:31:44', c4 = '02:58:55';
+REPLACE INTO t SET c0 = '2018-06-03 10:31:45', c4 = '02:58:55';
+
+DROP TABLE t;
+
+--echo # (duplicate) MDEV-17986 crash when I insert on a table
+CREATE OR REPLACE TABLE t2 (
+ number BIGINT(20) NOT NULL,
+ lrn BIGINT(20) NOT NULL DEFAULT 0,
+ source VARCHAR(15) NOT NULL
+ DEFAULT (REVERSE(SUBSTRING_INDEX(REVERSE(user()), '@', 1))),
+ PRIMARY KEY (number)
+);
+
+REPLACE t2(number) VALUES('1');
+REPLACE t2(number) VALUES('1');
+
+DROP TABLE t2;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
index 4ea3c9fd34b..238a4937e9f 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test
@@ -22,7 +22,7 @@ INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%";
--source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug;
@@ -41,7 +41,7 @@ INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);
CREATE INDEX idx ON t(c(100));
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%";
--source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug;
@@ -68,7 +68,7 @@ insert into t1 values(4, 18, default);
CREATE INDEX idx ON t1(x);
-SET global debug_dbug="+d,ib_purge_virtual_index_callback";
+SET global debug_dbug="d,ib_purge_virtual_index_callback";
UPDATE t1 SET id = 10 WHERE id = 1;
--source ../../innodb/include/wait_all_purged.inc
SET global debug_dbug=@old_dbug;
@@ -179,7 +179,7 @@ DROP TABLE t0, t1;
create table t (a blob, b blob, c blob as (concat(a,b)), h varchar(10), index (c(100)));
insert t(a,b,h) values (repeat('g', 16000), repeat('x', 16000), "kk");
insert t(a,b,h) values (repeat('a', 16000), repeat('b', 16000), "mm");
-set global debug_dbug="+d,ib_purge_virtual_index_callback";
+set global debug_dbug="d,ib_purge_virtual_index_callback";
connect(prevent_purge, localhost, root);
start transaction with consistent snapshot;
connection default;
@@ -228,7 +228,7 @@ ENGINE=InnoDB;
INSERT INTO t1 (pk,y) VALUES (1,2022);
CREATE TABLE t2(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
-SET GLOBAL debug_dbug = '+d,ib_purge_virtual_index_callback';
+SET GLOBAL debug_dbug = 'd,ib_purge_virtual_index_callback';
BEGIN;
INSERT INTO t2(f1) VALUES(1);
@@ -265,8 +265,8 @@ DROP TABLE t1, t2;
--echo #
--let $datadir= `select @@datadir`
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set global debug_dbug= "d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
create table t1 (
pk serial, vb tinyblob as (b) virtual, b tinyblob,
@@ -288,7 +288,7 @@ load data infile 'load.data' replace into table t1;
--disable_warnings
set debug_sync= "now WAIT_FOR latch_released TIMEOUT 1";
--enable_warnings
-set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
+set global debug_dbug= @saved_dbug;
drop table t1;
--remove_file $datadir/test/load.data
@@ -323,67 +323,3 @@ drop table t1;
--source include/wait_until_count_sessions.inc
set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
-
---echo #
---echo # MDEV-18546 ASAN heap-use-after-free
---echo # in innobase_get_computed_value / row_purge
---echo #
-
-CREATE TABLE t1 (
- pk INT AUTO_INCREMENT,
- b BIT(15),
- v BIT(15) AS (b) VIRTUAL,
- PRIMARY KEY(pk),
- UNIQUE(v)
-) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 (b) VALUES
- (NULL),(b'011'),(b'000110100'),
- (b'01101101010'),(b'01111001001011'),(NULL);
-
-SET GLOBAL innodb_debug_sync = "ib_clust_v_col_before_row_allocated "
- "SIGNAL before_row_allocated "
- "WAIT_FOR flush_unlock";
-SET GLOBAL innodb_debug_sync = "ib_open_after_dict_open "
- "SIGNAL purge_open "
- "WAIT_FOR select_open";
-
-# In 10.2 trx_undo_roll_ptr_is_insert(t_roll_ptr) condition never pass in purge,
-# so this condition is forced to pass in row_vers_old_has_index_entry
-set @saved_dbug= @@global.debug_dbug;
-set global debug_dbug= "+d,ib_purge_virtual_index_callback";
-
-# The purge starts from REPLACE command. To avoid possible race, separate
-# connection is used.
---connect(purge_waiter,localhost,root)
---send
-SET debug_sync= "now WAIT_FOR before_row_allocated";
-
---connection default
-REPLACE INTO t1 (pk, b) SELECT pk, b FROM t1;
-
---connection purge_waiter
-# Now we will definitely catch ib_clust_v_col_before_row_allocated
---reap
---connection default
---disconnect purge_waiter
-
-# purge hangs on the sync point. table is purged, ref_count is set to 0
-FLUSH TABLES;
-
-# Avoid hang on repeating purge.
-# Reset Will be applied after first record is purged
-SET GLOBAL innodb_debug_sync = reset;
-
-SET debug_sync= "now SIGNAL flush_unlock WAIT_FOR purge_open";
-
-# Avoid hang on repeating purge
-SET GLOBAL innodb_debug_sync = reset;
-
-# select unblocks purge thread
-SET debug_sync= "ib_open_after_dict_open SIGNAL select_open";
-SELECT * FROM t1;
-
-# Cleanup
-DROP TABLE t1;
-SET debug_sync= reset;
-set global debug_dbug= @saved_dbug; \ No newline at end of file
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
index c484bb5dc0c..23d3ee97290 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
@@ -605,3 +605,47 @@ ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
SHOW CREATE TABLE t1;
# Cleanup
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20396 Server crashes after DELETE with SEL NULL Foreign key and a
+--echo # virtual column in index
+--echo #
+CREATE TABLE parent
+(
+ ID int unsigned NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE child
+(
+ ID int unsigned NOT NULL,
+ ParentID int unsigned NULL,
+ Value int unsigned NOT NULL DEFAULT 0,
+ Flag int unsigned AS (Value) VIRTUAL,
+ PRIMARY KEY (ID),
+ KEY (ParentID, Flag),
+ FOREIGN KEY (ParentID) REFERENCES parent (ID) ON DELETE SET NULL
+ ON UPDATE CASCADE
+);
+
+INSERT INTO parent (ID) VALUES (100);
+INSERT INTO child (ID,ParentID,Value) VALUES (123123,100,1);
+DELETE FROM parent WHERE ID=100;
+select * from child;
+INSERT INTO parent (ID) VALUES (100);
+UPDATE child SET ParentID=100 WHERE ID=123123;
+
+# Cleanup
+DROP TABLE child, parent;
+--echo #
+--echo # MDEV-23387 dict_load_foreign() fails to load the table during alter
+--echo #
+SET FOREIGN_KEY_CHECKS=0;
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+ f3 INT AS (f1) VIRTUAL,
+ INDEX(f1), INDEX(f2))ENGINE=InnoDB;
+ALTER TABLE t1 ADD CONSTRAINT r FOREIGN KEY(f2) REFERENCES t1(f1), LOCK=NONE;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP INDEX f1;
+ALTER TABLE t1 DROP f3;
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test
index c2f9cd78fe2..353841840dc 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_index.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test
@@ -278,7 +278,6 @@ DELETE FROM t1;
INSERT INTO t1 (a,b) VALUES(1,20190123);
SELECT * FROM t1;
ROLLBACK;
-# MDEV-18366 FIXME: fix the crash and enable this
-# SELECT * FROM t1;
+SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result
index 9e97d5a17fb..bab4b925972 100644
--- a/mysql-test/suite/heap/heap.result
+++ b/mysql-test/suite/heap/heap.result
@@ -700,7 +700,7 @@ ERROR 42000: Incorrect table definition; there can be only one auto column and i
create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
+ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi...' for key 'PRIMARY'
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
diff --git a/mysql-test/suite/innodb/include/alter_table_pk_no_sort.inc b/mysql-test/suite/innodb/include/alter_table_pk_no_sort.inc
index 6a2fcd15be0..61e304a7626 100644
--- a/mysql-test/suite/innodb/include/alter_table_pk_no_sort.inc
+++ b/mysql-test/suite/innodb/include/alter_table_pk_no_sort.inc
@@ -263,3 +263,10 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
+
+# pk(o1,o2) to pk(o1,o2,autoinc) must not sort
+create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
+insert into t1 values(1,1),(2,1);
+alter table t1 drop primary key, add column a int unique auto_increment,
+add primary key(o1,o2,a), algorithm=inplace;
+drop table t1;
diff --git a/mysql-test/suite/innodb/include/wait_all_purged.inc b/mysql-test/suite/innodb/include/wait_all_purged.inc
index 992e14f0843..e3a506c7622 100644
--- a/mysql-test/suite/innodb/include/wait_all_purged.inc
+++ b/mysql-test/suite/innodb/include/wait_all_purged.inc
@@ -1,25 +1,17 @@
# Wait for everything to be purged.
# The user should have set innodb_purge_rseg_truncate_frequency=1.
+--disable_query_log
if (!$wait_all_purged)
{
- let $wait_all_purged= 0;
+ SET GLOBAL innodb_max_purge_lag_wait= 0;
}
-let $remaining_expect= `select concat('InnoDB ',$wait_all_purged)`;
-
-let $wait_counter= 600;
-while ($wait_counter)
+if ($wait_all_purged)
{
- --replace_regex /.*History list length ([0-9]+).*/\1/
- let $remaining= `SHOW ENGINE INNODB STATUS`;
- if ($remaining == $remaining_expect)
- {
- let $wait_counter= 0;
- }
- if ($wait_counter)
- {
- real_sleep 0.1;
- dec $wait_counter;
- }
+ eval SET GLOBAL innodb_max_purge_lag_wait= $wait_all_purged;
}
+--enable_query_log
+
+--replace_regex /.*History list length ([0-9]+).*/\1/
+let $remaining= `SHOW ENGINE INNODB STATUS`;
echo $remaining transactions not purged;
diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result
index f9db353af3c..95415dd4e03 100644
--- a/mysql-test/suite/innodb/r/alter_missing_tablespace.result
+++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result
@@ -35,7 +35,9 @@ ALTER TABLE t DISCARD TABLESPACE;
Warnings:
Warning 1812 Tablespace is missing for table 'test/t'
Warning 1812 Tablespace is missing for table 'test/t'
-DROP TABLE t;
+RENAME TABLE t TO u;
+RENAME TABLE u TO v;
+DROP TABLE v;
SELECT * FROM `x..d`;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
DROP TABLE `x..d`;
diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result
index e47bfb90152..fc08f29e515 100644
--- a/mysql-test/suite/innodb/r/alter_table.result
+++ b/mysql-test/suite/innodb/r/alter_table.result
@@ -53,3 +53,20 @@ ALTER TABLE t1 DROP a;
ERROR HY000: Cannot drop index 'a': needed in a foreign key constraint
ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx;
+#
+# MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
+#
+CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 SELECT * FROM seq_1_to_128;
+ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
+DROP TABLE t1;
+#
+# MDEV-22939 Server crashes in row_make_new_pathname()
+#
+CREATE TABLE t (a INT) ENGINE=INNODB;
+ALTER TABLE t DISCARD TABLESPACE;
+ALTER TABLE t ENGINE INNODB;
+ERROR HY000: Tablespace has been discarded for table `t`
+ALTER TABLE t FORCE;
+ERROR HY000: Tablespace has been discarded for table `t`
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/analyze_table.result b/mysql-test/suite/innodb/r/analyze_table.result
index a5c25289ad1..830130821da 100644
--- a/mysql-test/suite/innodb/r/analyze_table.result
+++ b/mysql-test/suite/innodb/r/analyze_table.result
@@ -1,25 +1,16 @@
-CREATE PROCEDURE populate_t1()
-BEGIN
-DECLARE i int DEFAULT 1;
-START TRANSACTION;
-WHILE (i <= 1000000) DO
-INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
-SET i = i + 1;
-END WHILE;
-COMMIT;
-END|
+set use_stat_tables='preferably';
CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB;
+insert into t1 select seq, seq, concat('a', seq) from seq_1_to_500;
SELECT COUNT(*) FROM t1;
COUNT(*)
-1000000
-SET GLOBAL innodb_stats_persistent_sample_pages=2000;
+500
+set @@max_heap_table_size=16384;
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;
-SET GLOBAL innodb_stats_persistent_sample_pages=default;
diff --git a/mysql-test/suite/innodb/r/blob-update-debug.result b/mysql-test/suite/innodb/r/blob-update-debug.result
index 1360745b7e6..813a469dd2b 100644
--- a/mysql-test/suite/innodb/r/blob-update-debug.result
+++ b/mysql-test/suite/innodb/r/blob-update-debug.result
@@ -7,9 +7,11 @@ insert into t1 values (1, repeat('*', 50000));
select f1, substring(f2, 1, 40) from t1;
f1 substring(f2, 1, 40)
1 ****************************************
-set debug_dbug = 'd,row_ins_index_entry_timeout';
+set @saved_debug = @@session.debug_dbug;
+SET debug_dbug = 'd,row_ins_index_entry_timeout';
update t1 set f1 = 3;
select f1, substring(f2, 1, 40) from t1;
f1 substring(f2, 1, 40)
3 ****************************************
drop table t1;
+SET debug_dbug= @saved_debug;
diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result
new file mode 100644
index 00000000000..588be562ce4
--- /dev/null
+++ b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result
@@ -0,0 +1,8 @@
+#
+# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL
+# ONLINE WITH MEMORY FULL CONDITION
+#
+call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array");
+SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF;
+SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null';
+SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576;
diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
index ee4db08fc85..951233ced3c 100644
--- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
@@ -17,3 +17,19 @@ CHECK TABLE t2;
Table Op Msg_type Msg_text
test.t2 check status OK
DROP TABLE t1, t2;
+CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+connect con1,localhost,root,,;
+BEGIN;
+DELETE FROM t1 WHERE pk=1;
+connection default;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+DELETE FROM t1 WHERE pk=3;
+# Kill the server
+disconnect con1;
+# Corrupt the pages
+SELECT * FROM t1;
+pk
+1
+2
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result
index 5cbbb5298de..05e68b0c3db 100644
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ b/mysql-test/suite/innodb/r/foreign-keys.result
@@ -220,3 +220,19 @@ drop table t1,t2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
drop table t1,t2;
ERROR 42S02: Unknown table 'test.t2'
+#
+# MDEV-23470 InnoDB: Failing assertion: cmp < 0 in
+# row_ins_check_foreign_constraint
+#
+CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL)ENGINE=InnoDB;
+CREATE TABLE t2(f1 VARCHAR(100), f2 INT NOT NULL,
+INDEX(f2))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(99, 2);
+ALTER TABLE t2 ADD FOREIGN KEY(f2) REFERENCES t1(f1);
+SET FOREIGN_KEY_CHECKS=0;
+DROP INDEX f2 ON t2;
+SET FOREIGN_KEY_CHECKS=1;
+INSERT INTO t2 VALUES('G', 3);
+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`))
+DROP TABLE t2, t1;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 5eb0658bf48..8101ae6bea2 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -167,7 +167,6 @@ PRIMARY KEY (store_id),
UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB;
-SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
@@ -209,6 +208,7 @@ ERROR 70100: Query execution was interrupted
connection con1;
ROLLBACK;
connection default;
+disconnect con1;
DROP TABLE t3,t1;
#
# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
@@ -274,6 +274,187 @@ CREATE TABLE t2 (f INT, KEY(f)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t2 (f);
ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1);
DROP TABLE t1, t2;
+CREATE TABLE t1 (a INT, b INT, KEY idx(a)) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x);
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 CHANGE a c INT;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
+ALTER TABLE t1 ADD COLUMN f INT;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (f1);
+SET FOREIGN_KEY_CHECKS= ON;
+ALTER TABLE t1 DROP f3;
+ALTER TABLE t1 CHANGE f f3 INT;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+#
+# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
+# ADD FOREIGN KEY
+#
+CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
+PRIMARY KEY (`department_id`)) engine=innodb;
+CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
+`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
+CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
+ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
+`people` (`people_id`);
+ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
+(`people_id`);
+ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
+(`people_id`);
+drop table title, department, people;
+create table t1 (a int primary key, b int) engine=innodb;
+create table t2 (c int primary key, d int,
+foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock;
+connect con1,localhost,root;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+update t1 set a=10 where a=1;
+connection default;
+unlock tables;
+connection con1;
+connection default;
+lock table t2 write;
+connection con1;
+delete from t1 where a=2;
+connection default;
+unlock tables;
+connection con1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+connection default;
+unlock tables;
+disconnect con1;
+create user foo;
+grant select,update on test.t1 to foo;
+connect foo,localhost,foo;
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+c d
+5 2
+4 10
+6 30
+drop table t2, t1;
+drop user foo;
+#
+# MDEV-17595 - Server crashes in copy_data_between_tables or
+# Assertion `thd->transaction.stmt.is_empty() ||
+# (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
+# fails in close_tables_for_reopen upon concurrent
+# ALTER TABLE and FLUSH
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
+DROP TABLE t2, t1;
+create table t1 (pk int primary key, data int) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+create table t2 (t1_pk int, foreign key (t1_pk) references t1 (pk)) engine=innodb;
+insert t2 values (1),(2);
+insert t2 values (10);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_pk`) REFERENCES `t1` (`pk`))
+flush tables;
+flush status;
+update t1 set data=10 where pk+1>10;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 1
+Opened_tables 1
+flush tables;
+flush status;
+update t2 set t1_pk=11 where t1_pk+1>10;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 1
+Opened_tables 1
+flush tables;
+flush status;
+lock tables t1 write;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+insert t1 values (4,4);
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+unlock tables;
+create function foo() returns int
+begin
+insert t1 values (5,5);
+return 5;
+end|
+flush tables;
+flush status;
+select foo();
+foo()
+5
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+drop function foo;
+drop table t2, t1;
+CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
+XA START 'xid';
+INSERT INTO t1 VALUES (1,2);
+CREATE TABLE x AS SELECT * FROM t1;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+connect con1,localhost,root,,test;
+SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
+ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+disconnect con1;
+connection default;
+XA END 'xid';
+XA ROLLBACK 'xid';
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT PRIMARY KEY,
+f1 VARCHAR(10), f2 VARCHAR(10),
+f3 VARCHAR(10), f4 VARCHAR(10),
+f5 VARCHAR(10), f6 VARCHAR(10),
+f7 VARCHAR(10), f8 VARCHAR(10),
+INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
+INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+(3, 'innodb', 'innodb', 'innodb', 'innodb',
+'innodb', 'innodb', 'innodb', 'innodb');
+ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
+START TRANSACTION;
+DELETE FROM t1 where f1='mariadb';
+SELECT * FROM t1;
+pk f1 f2 f3 f4 f5 f6 f7 f8
+2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb
+3 innodb innodb innodb innodb innodb innodb innodb innodb
+ROLLBACK;
+ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
+START TRANSACTION;
+DELETE FROM t1 where f3='mariadb';
+SELECT * FROM t1;
+pk f1 f2 f3 f4 f5 f6 f7 f8
+3 innodb innodb innodb innodb innodb innodb innodb innodb
+ROLLBACK;
+ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
+UPDATE t1 SET f6='update';
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
+ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
+UPDATE t1 SET f6='cascade';
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
+DROP TABLE t1;
# Start of 10.2 tests
#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
@@ -311,6 +492,7 @@ INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
BEGIN;
UPDATE users SET name = 'qux' WHERE id = 1;
+connect con1,localhost,root;
connection con1;
SET innodb_lock_wait_timeout= 1;
DELETE FROM matchmaking_groups WHERE id = 10;
@@ -521,4 +703,101 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+#
+# MDEV-17187 table doesn't exist in engine after ALTER other tables
+# with CONSTRAINTs
+#
+call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
+set foreign_key_checks=on;
+create table t1 (id int not null primary key) engine=innodb;
+create table t2 (id int not null primary key, fid int not null,
+CONSTRAINT fk_fid FOREIGN KEY (fid) REFERENCES t1 (id))engine=innodb;
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 2);
+set foreign_key_checks=off;
+alter table t2 drop index fk_fid;
+set foreign_key_checks=on;
+delete from t1 where id=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`))
+insert into t2 values(4, 99);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`))
+select * from t1;
+id
+1
+2
+3
+select * from t2;
+id fid
+1 1
+2 1
+3 2
+set foreign_key_checks=off;
+delete from t1 where id=2;
+insert into t2 values(4, 99);
+set foreign_key_checks=on;
+select * from t1;
+id
+1
+3
+select * from t2;
+id fid
+1 1
+2 1
+3 2
+4 99
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `fid` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_fid` FOREIGN KEY (`fid`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1,t2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+drop table t1,t2;
+ERROR 42S02: Unknown table 'test.t2'
+#
+# MDEV-22934 Table disappear after two alter table command
+#
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
+f2 INT NOT NULL,
+PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT NOT NULL,
+f2 INT NOT NULL, f3 INT NOT NULL,
+PRIMARY KEY(f1, f2), UNIQUE KEY(f2),
+CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE,
+CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE
+) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS=0;
+ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE;
+ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ `f3` int(11) NOT NULL,
+ PRIMARY KEY (`f3`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB;
+ERROR 42S01: Table 't2' already exists
+DROP TABLE t2, t1;
+#
+# MDEV-23685 SIGSEGV on ADD FOREIGN KEY after failed attempt
+# to create unique key on virtual column
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT AS (a)) ENGINE=InnODB;
+INSERT INTO t1 (pk,a) VALUES (1,10),(2,10);
+ALTER TABLE t1 ADD UNIQUE INDEX ind9 (b), LOCK=SHARED;
+ERROR 23000: Duplicate entry '10' for key 'ind9'
+SET FOREIGN_KEY_CHECKS= 0;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk);
+DROP TABLE t1;
# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/foreign_key_debug.result b/mysql-test/suite/innodb/r/foreign_key_debug.result
new file mode 100644
index 00000000000..741200b62b2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/foreign_key_debug.result
@@ -0,0 +1,60 @@
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f2 int primary key) engine=innodb;
+create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t2 values (1),(2),(3),(4),(5);
+insert into t3 values (1),(2),(3),(4),(5);
+connect con1,localhost,root;
+set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+connection default;
+set debug_sync='before_execute_sql_command wait_for g1';
+update t1 set f1 = f1 + 100000 limit 2;
+connect con2,localhost,root;
+kill query UPDATE;
+disconnect con2;
+connection default;
+ERROR 70100: Query execution was interrupted
+set debug_sync='now signal g2';
+connection con1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f2`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+disconnect con1;
+connection default;
+select * from t2 where f2 not in (select f1 from t1);
+f2
+select * from t3 where f3 not in (select f2 from t2);
+f3
+drop table t3;
+drop table t2;
+drop table t1;
+set debug_sync='reset';
+#
+# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+#
+CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+FLUSH TABLES;
+SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+connect con1, localhost, root;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1;
+UPDATE t2 SET pk=10 WHERE pk=1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+DEALLOCATE PREPARE stmt;
+FLUSH TABLE t2;
+SET debug_sync='now SIGNAL go';
+connection default;
+disconnect con1;
+connection default;
+SET debug_sync='reset';
+SHOW OPEN TABLES FROM test;
+Database Table In_use Name_locked
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result
index 6ef1ce170cd..04550bfa114 100644
--- a/mysql-test/suite/innodb/r/information_schema_grants.result
+++ b/mysql-test/suite/innodb/r/information_schema_grants.result
@@ -278,9 +278,9 @@ select count(*) > -1 from d_sys_virtual;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
-ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from i_tablespaces_encryption;
-ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from d_tablespaces_encryption;
count(*) > -1
1
diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result
index 6c6b7c7fd35..bb46704198d 100644
--- a/mysql-test/suite/innodb/r/innodb-32k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result
index 7ed271a14dd..e7998fddf29 100644
--- a/mysql-test/suite/innodb/r/innodb-64k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/r/innodb-64k.result b/mysql-test/suite/innodb/r/innodb-64k.result
index 379235c510c..92d2a03d8da 100644
--- a/mysql-test/suite/innodb/r/innodb-64k.result
+++ b/mysql-test/suite/innodb/r/innodb-64k.result
@@ -1080,3 +1080,10 @@ update t2 set col145=@b;
COMMIT;
drop table t2;
DROP TABLE t1;
+#
+# MDEV-19526 heap number overflow
+#
+CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
+ENGINE=InnoDB;
+INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index 53861b3503a..80cf14c1725 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -198,11 +198,11 @@ t3 CREATE TABLE `t3` (
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
-ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
+ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
-ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
+ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
@@ -210,7 +210,7 @@ ALTER TABLE t3 CHANGE
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä`
c3 INT;
ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT;
-ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\x83'
+ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\...'
ALTER TABLE t3 CHANGE c3 😲 INT;
ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2'
ALTER TABLE t3 RENAME TO t2;
@@ -1055,3 +1055,20 @@ SELECT * FROM t1;
a b
10 10:20:30
DROP TABLE t1;
+#
+# MDEV-18042 Server crashes in mysql_alter_table upon adding a non-null
+# date column under NO_ZERO_DATE with ALGORITHM=INPLACE
+#
+SET @OLD_SQL_MODE= @@SQL_MODE;
+SET @@SQL_MODE= 'NO_ZERO_DATE';
+CREATE OR REPLACE TABLE t1 (i INT) ENGINE=MyISAM;
+ALTER TABLE t1 ADD COLUMN d DATE NOT NULL, ALGORITHM=INPLACE;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB;
+ALTER TABLE t1 ADD d DATETIME NOT NULL CHECK (f <= 0), ALGORITHM=COPY;
+ERROR 42S22: Unknown column 'f' in 'CHECK'
+CREATE OR REPLACE TABLE t1 (a int) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
+# Cleanup
+SET @@SQL_MODE= @OLD_SQL_MODE;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result
index c2b46661e31..8a6327216d0 100644
--- a/mysql-test/suite/innodb/r/innodb-blob.result
+++ b/mysql-test/suite/innodb/r/innodb-blob.result
@@ -153,3 +153,9 @@ a
SELECT * FROM t2;
a
DROP TABLE t1,t2,t3;
+CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT)ENGINE=InnoDB
+ROW_FORMAT=REDUNDANT;
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1 ;
+INSERT INTO t1 VALUES(1, REPEAT(2, @fill_amount));
+UPDATE t1 SET f1 = 2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-index-debug.result b/mysql-test/suite/innodb/r/innodb-index-debug.result
index b1f8c9ad3cc..bf2abce989c 100644
--- a/mysql-test/suite/innodb/r/innodb-index-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-index-debug.result
@@ -323,4 +323,9 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
+create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
+insert into t1 values(1,1),(2,1);
+alter table t1 drop primary key, add column a int unique auto_increment,
+add primary key(o1,o2,a), algorithm=inplace;
+drop table t1;
SET DEBUG_DBUG = @saved_debug_dbug;
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index bdc16ad7692..5e91efb7062 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -1903,6 +1903,11 @@ create table t1(o1 int, o2 int, o3 int, primary key(o1,o2,o3)) engine = innodb;
insert into t1 values(1,1,2),(2,2,1);
alter table t1 drop primary key, add primary key(o1), lock=none;
drop table t1;
+create table t1(o1 int, o2 int, primary key(o1,o2)) engine = innodb;
+insert into t1 values(1,1),(2,1);
+alter table t1 drop primary key, add column a int unique auto_increment,
+add primary key(o1,o2,a), algorithm=inplace;
+drop table t1;
#
# MDEV-15325 Incomplete validation of missing tablespace during recovery
#
diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
index 55b4d3462b0..bb3531e3f90 100644
--- a/mysql-test/suite/innodb/r/innodb-mdev-7513.result
+++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
call mtr.add_suppression("Row size too large (> 8126)*");
CREATE TABLE t1 ( text1 TEXT,
text2 TEXT,
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 423a658283f..5297f1eb4f1 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(1 1)' 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-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result
index 989fb055cbc..03e22b774e4 100644
--- a/mysql-test/suite/innodb/r/innodb-replace-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result
@@ -5,10 +5,10 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @old_dbug= @@session.debug_dbug;
-set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
+SET debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
f1 f2 f3
14 25 34
drop table t1;
-set debug_dbug = @old_dbug;
+SET debug_dbug = @old_dbug;
diff --git a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result
index ef2d3182b92..06bb708b82c 100644
--- a/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result
+++ b/mysql-test/suite/innodb/r/innodb-stats-initialize-failure.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: Warning: Index.*");
+SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized';
create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb;
create procedure innodb_insert_proc (repeat_count int)
@@ -27,6 +28,6 @@ count(1)
select count(1) from t1 where c between 7 and 787;
count(1)
781
-set DEBUG_DBUG=NULL;
drop procedure innodb_insert_proc;
drop table t1;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
index de97d933ad9..20cd55bd7b0 100644
--- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result
+++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
@@ -30,7 +30,7 @@ grad_degree CREATE TABLE `grad_degree` (
`plan` varchar(10) NOT NULL,
`admit_term` char(4) NOT NULL,
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
- `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
+ `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
@@ -136,14 +136,14 @@ grad_degree CREATE TABLE `grad_degree` (
`plan` varchar(10) NOT NULL,
`admit_term` char(4) NOT NULL,
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
- `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
- `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
- `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
- `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
- `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
- `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
- `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
- `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
+ `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
+ `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
+ `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
+ `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
+ `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
+ `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
+ `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
+ `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
@@ -193,14 +193,14 @@ grad_degree CREATE TABLE `grad_degree` (
`plan` varchar(10) NOT NULL,
`admit_term` char(4) NOT NULL,
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
- `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
- `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
- `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
- `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
- `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
- `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
- `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
- `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
+ `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
+ `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
+ `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
+ `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
+ `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
+ `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
+ `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
+ `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
PRIMARY KEY (`student_id`,`plan`,`admit_term`),
KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`)
@@ -270,14 +270,14 @@ grad_degree CREATE TABLE `grad_degree` (
`plan` varchar(10) NOT NULL,
`admit_term` char(4) NOT NULL,
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
- `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
- `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
- `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
- `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
- `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
- `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
- `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
- `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
+ `ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
+ `ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
+ `ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
+ `ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
+ `ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
+ `ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
+ `ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
+ `ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-1.result b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
index b2a5f49a9ad..55557a8fb99 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-1.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-1.result
@@ -389,7 +389,7 @@ CREATE TABLE testdb_wl5522.t1 ( i bigint) ENGINE = Innodb;
ALTER TABLE testdb_wl5522.t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE testdb_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Column i precise type mismatch.)
+ERROR HY000: Schema mismatch (Column i precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE testdb_wl5522.t1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index 99e9c49eee9..da064b83be6 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -10,62 +10,59 @@ call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
FLUSH TABLES;
SET GLOBAL innodb_file_per_table = 1;
-CREATE DATABASE test_wl5522;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
-INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
+CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1),(2),(3);
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
-INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
+CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1),(2),(3);
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
unlink: t1.ibd
unlink: t1.cfg
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
+SET @file_per_table= @@innodb_file_per_table;
SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
Table Op Msg_type Msg_text
-test_wl5522.t1 check status OK
-SELECT COUNT(*) FROM test_wl5522.t1;
+test.t1 check status OK
+SELECT COUNT(*) FROM t1;
COUNT(*)
4
-INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
-SELECT * FROM test_wl5522.t1;
+INSERT INTO t1 VALUES(400), (500), (600);
+SELECT * FROM t1;
c1
1
2
@@ -74,419 +71,419 @@ c1
400
500
600
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_export_io_write_failure_1";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_2";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_3";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_4";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_5";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_6";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_7";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_8";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_9";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_10";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_11";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_12";
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed
Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (100), (200), (300);
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (100), (200), (300);
+SELECT COUNT(*) FROM t1;
COUNT(*)
3
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_1";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index fields.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_2";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_3";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading number of indexes.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_4";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading table column meta-data.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_5";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data export hostname length.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_6";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data table name length.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_7";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading autoinc value.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_8";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data header.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_io_read_error_9";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while reading meta-data version.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_string_read_error";
restore: t1 .cfg file
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: IO Read error: while parsing export hostname.
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_1";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_2";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_4";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_5";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_6";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_7";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_8";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_9";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_OOM_10";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_internal_error";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: While updating the <space, root page number> of index GEN_CLUST_INDEX - Generic error
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Too many concurrent transactions
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug=@saved_debug_dbug;
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 44 'Tablespace not found' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_cluster_root_adjust_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_cluster_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_sec_root_adjust_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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;
+ALTER TABLE 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 (
+DROP TABLE t1;
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -500,35 +497,29 @@ connection default;
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
-INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
-(1, REPEAT('a', 2048), REPEAT('a', 2048)),
-(2, REPEAT('b', 2048), REPEAT('b', 2048)),
-(3, REPEAT('c', 2048), REPEAT('c', 2048)),
-(4, REPEAT('d', 2048), REPEAT('d', 2048));
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-DELETE FROM test_wl5522.t1 WHERE c2 = 1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
-UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
-SHOW CREATE TABLE test_wl5522.t1;
+INSERT INTO t1
+SELECT 1 + seq, 1 + (seq MOD 4),
+REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048),
+REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048)
+FROM seq_0_to_127;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c3 = REPEAT("c2", 1024);
+UPDATE t1 SET c4 = REPEAT("c4", 1024);
+SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -539,116 +530,148 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
-) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1
-SELECT c1, c2 FROM test_wl5522.t1;
+) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1
+SELECT c1, c2 FROM t1;
c1 c2
+1 16
2 32
3 48
4 64
+5 76
6 92
7 108
8 124
-13 197
-14 213
-15 229
-17 257
-18 273
-19 289
-28 422
-29 438
-30 454
-32 482
-33 498
-34 514
-36 542
-37 558
-38 574
-40 602
-41 618
-42 634
-59 887
-60 903
-61 919
-63 947
-64 963
-65 979
-67 1007
-68 1023
-69 1039
-71 1067
-72 1083
-73 1099
-75 1127
-76 1143
-77 1159
-79 1187
-80 1203
-81 1219
-83 1247
-84 1263
-85 1279
-87 1307
-88 1323
-89 1339
+9 136
+10 152
+11 168
+12 184
+13 196
+14 212
+15 228
+16 244
+17 256
+18 272
+19 288
+20 304
+21 316
+22 332
+23 348
+24 364
+25 376
+26 392
+27 408
+28 424
+29 436
+30 452
+31 468
+32 484
+33 496
+34 512
+35 528
+36 544
+37 556
+38 572
+39 588
+40 604
+41 616
+42 632
+43 648
+44 664
+45 676
+46 692
+47 708
+48 724
+49 736
+50 752
+51 768
+52 784
+53 796
+54 812
+55 828
+56 844
+57 856
+58 872
+59 888
+60 904
+61 916
+62 932
+63 948
+64 964
+65 976
+66 992
+67 1008
+68 1024
+69 1036
+70 1052
+71 1068
+72 1084
+73 1096
+74 1112
+75 1128
+76 1144
+77 1156
+78 1172
+79 1188
+80 1204
+81 1216
+82 1232
+83 1248
+84 1264
+85 1276
+86 1292
+87 1308
+88 1324
+89 1336
+90 1352
+91 1368
+92 1384
+93 1396
+94 1412
+95 1428
+96 1444
+97 1456
+98 1472
+99 1488
+100 1504
+101 1516
+102 1532
+103 1548
+104 1564
+105 1576
+106 1592
+107 1608
+108 1624
+109 1636
+110 1652
+111 1668
+112 1684
+113 1696
+114 1712
+115 1728
+116 1744
+117 1756
+118 1772
+119 1788
+120 1804
+121 1816
122 1832
123 1848
124 1864
+125 1876
126 1892
127 1908
128 1924
-130 1952
-131 1968
-132 1984
-134 2012
-135 2028
-136 2044
-138 2072
-139 2088
-140 2104
-142 2132
-143 2148
-144 2164
-146 2192
-147 2208
-148 2224
-150 2252
-151 2268
-152 2284
-154 2312
-155 2328
-156 2344
-158 2372
-159 2388
-160 2404
-162 2432
-163 2448
-164 2464
-166 2492
-167 2508
-168 2524
-170 2552
-171 2568
-172 2584
-174 2612
-175 2628
-176 2644
-178 2672
-179 2688
-180 2704
-182 2732
-183 2748
-184 2764
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
COUNT(*)
-96
-SELECT SUM(c2) FROM test_wl5522.t1;
+128
+SELECT SUM(c2) FROM t1;
SUM(c2)
-145278
+124160
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
name
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
SELECT name
@@ -665,8 +688,8 @@ connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (
+DROP TABLE t1;
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -674,119 +697,151 @@ c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB;
-SELECT c1, c2 FROM test_wl5522.t1;
+SELECT c1, c2 FROM t1;
c1 c2
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
Table Op Msg_type Msg_text
-test_wl5522.t1 check status OK
-SELECT c1,c2 FROM test_wl5522.t1;
+test.t1 check status OK
+SELECT c1,c2 FROM t1;
c1 c2
+1 16
2 32
3 48
4 64
+5 76
6 92
7 108
8 124
-13 197
-14 213
-15 229
-17 257
-18 273
-19 289
-28 422
-29 438
-30 454
-32 482
-33 498
-34 514
-36 542
-37 558
-38 574
-40 602
-41 618
-42 634
-59 887
-60 903
-61 919
-63 947
-64 963
-65 979
-67 1007
-68 1023
-69 1039
-71 1067
-72 1083
-73 1099
-75 1127
-76 1143
-77 1159
-79 1187
-80 1203
-81 1219
-83 1247
-84 1263
-85 1279
-87 1307
-88 1323
-89 1339
+9 136
+10 152
+11 168
+12 184
+13 196
+14 212
+15 228
+16 244
+17 256
+18 272
+19 288
+20 304
+21 316
+22 332
+23 348
+24 364
+25 376
+26 392
+27 408
+28 424
+29 436
+30 452
+31 468
+32 484
+33 496
+34 512
+35 528
+36 544
+37 556
+38 572
+39 588
+40 604
+41 616
+42 632
+43 648
+44 664
+45 676
+46 692
+47 708
+48 724
+49 736
+50 752
+51 768
+52 784
+53 796
+54 812
+55 828
+56 844
+57 856
+58 872
+59 888
+60 904
+61 916
+62 932
+63 948
+64 964
+65 976
+66 992
+67 1008
+68 1024
+69 1036
+70 1052
+71 1068
+72 1084
+73 1096
+74 1112
+75 1128
+76 1144
+77 1156
+78 1172
+79 1188
+80 1204
+81 1216
+82 1232
+83 1248
+84 1264
+85 1276
+86 1292
+87 1308
+88 1324
+89 1336
+90 1352
+91 1368
+92 1384
+93 1396
+94 1412
+95 1428
+96 1444
+97 1456
+98 1472
+99 1488
+100 1504
+101 1516
+102 1532
+103 1548
+104 1564
+105 1576
+106 1592
+107 1608
+108 1624
+109 1636
+110 1652
+111 1668
+112 1684
+113 1696
+114 1712
+115 1728
+116 1744
+117 1756
+118 1772
+119 1788
+120 1804
+121 1816
122 1832
123 1848
124 1864
+125 1876
126 1892
127 1908
128 1924
-130 1952
-131 1968
-132 1984
-134 2012
-135 2028
-136 2044
-138 2072
-139 2088
-140 2104
-142 2132
-143 2148
-144 2164
-146 2192
-147 2208
-148 2224
-150 2252
-151 2268
-152 2284
-154 2312
-155 2328
-156 2344
-158 2372
-159 2388
-160 2404
-162 2432
-163 2448
-164 2464
-166 2492
-167 2508
-168 2524
-170 2552
-171 2568
-172 2584
-174 2612
-175 2628
-176 2644
-178 2672
-179 2688
-180 2704
-182 2732
-183 2748
-184 2764
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
COUNT(*)
-96
-SELECT SUM(c2) FROM test_wl5522.t1;
+128
+SELECT SUM(c2) FROM t1;
SUM(c2)
-145278
-SHOW CREATE TABLE test_wl5522.t1;
+124160
+SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -797,129 +852,120 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
-) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-INSERT IGNORE INTO test_wl5522.t1 VALUES
+) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+INSERT IGNORE INTO t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-COUNT(*)
-256
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+INSERT INTO t1
+SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200)
+FROM seq_1_to_256;
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
-ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
+ALTER TABLE t1 ADD INDEX idx(c1);
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fil_space_create_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 11 'Generic error' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 39 'Data structure corruption' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
set global innodb_monitor_enable = default;
set global innodb_monitor_disable = default;
set global innodb_monitor_reset = default;
set global innodb_monitor_reset_all = default;
-SET GLOBAL INNODB_FILE_PER_TABLE=1;
+SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index 62f03292baa..27a93922fbf 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
+call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
FLUSH TABLES;
CREATE TABLE t1
@@ -7,29 +7,26 @@ b char(22),
c varchar(255),
KEY (b))
ENGINE = InnoDB;
-insert into t1 (b, c) values ('Apa', 'Filler........'),
+CREATE TEMPORARY TABLE t (b char(22),c varchar(255));
+INSERT INTO t VALUES
+('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
+INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128;
+DROP TEMPORARY TABLE t;
SELECT COUNT(*) FROM t1;
COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
db.opt
t1.frm
@@ -52,14 +49,14 @@ COUNT(*)
1280
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-1459 Apa Filler........
-1454 Apa Filler........
-1449 Apa Filler........
+1276 Apa Filler........
+1271 Apa Filler........
+1266 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-1463 Evolution lsjndofiabsoibeg
-1462 Devotion asdfuihknaskdf
-1461 Cavalry ..asdasdfaeraf
+1280 Evolution lsjndofiabsoibeg
+1279 Devotion asdfuihknaskdf
+1278 Cavalry ..asdasdfaeraf
# Restarting server
# Done restarting server
# List before t1 DISCARD
@@ -81,14 +78,14 @@ COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
db.opt
t1.cfg
t1.frm
@@ -100,14 +97,14 @@ COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
DROP TABLE t1;
ALTER TABLE t2 ROW_FORMAT=DYNAMIC;
ALTER TABLE t2 DISCARD TABLESPACE;
@@ -136,18 +133,11 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
backup: t1
db.opt
t1.cfg
@@ -177,18 +167,11 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
backup: t1
db.opt
t1.cfg
@@ -198,8 +181,6 @@ UNLOCK TABLES;
db.opt
t1.frm
t1.ibd
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -223,23 +204,14 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
-COUNT(*)
-16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -259,19 +231,10 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
-COUNT(*)
-16
backup: t1
UNLOCK TABLES;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -299,39 +262,32 @@ c1 c2
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
unlink: t1.cfg
DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 0;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
-) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1809 Table `test`.`t1` in system tablespace
@@ -341,12 +297,7 @@ SET GLOBAL innodb_file_per_table = 1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -354,41 +305,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -426,7 +343,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Column c2 precise type mismatch.)
+ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -449,51 +366,30 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -501,41 +397,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -559,41 +421,25 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -647,51 +493,30 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -699,41 +524,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -757,41 +548,25 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -848,51 +623,30 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -900,41 +654,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -958,41 +678,25 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -1049,51 +753,30 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -1101,41 +784,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -1159,41 +808,25 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -1263,43 +896,26 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
-call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
+call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
-FLUSH TABLES;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result
index aa79383dde2..936809cb63a 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result
@@ -323,11 +323,11 @@ t3 CREATE TABLE `t3` (
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT;
-ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
+ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT;
-ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠' is too long
+ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借...' is too long
ALTER TABLE t3 CHANGE
`1234567890123456789012345678901234567890123456789012345678901234`
`倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT;
@@ -369,7 +369,7 @@ t3.isl
t1c.ibd
t3.ibd
ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT;
-ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\x83'
+ERROR HY000: Invalid utf8mb4 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\...'
ALTER TABLE t3 CHANGE c3 😲 INT;
ERROR HY000: Invalid utf8mb4 character string: '\xF0\x9F\x98\xB2'
ALTER TABLE t3 RENAME TO t2;
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index 0d92968b095..921f9880d47 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -2598,7 +2598,6 @@ set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb;
alter table t1 modify column a int;
-Got one of the listed errors
set foreign_key_checks=1;
drop table t2,t1;
set foreign_key_checks=0;
@@ -2607,6 +2606,7 @@ create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin
alter table t1 convert to character set utf8;
set foreign_key_checks=1;
drop table t2,t1;
+call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result
new file mode 100644
index 00000000000..14ea44550e0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result
@@ -0,0 +1,50 @@
+SET GLOBAL innodb_buffer_pool_dump_pct=100;
+CREATE TABLE ib_bp_test
+(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128)))
+ENGINE=INNODB;
+SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+PAGE_NUMBER
+3
+4
+SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3;
+INSERT INTO ib_bp_test
+SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382;
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+COUNT(*)
+596
+SET GLOBAL innodb_buffer_pool_dump_now = ON;
+SET GLOBAL innodb_fast_shutdown=0;
+SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+PAGE_NUMBER
+select count(*) from ib_bp_test LIMIT 0;
+count(*)
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+SELECT variable_value
+FROM information_schema.global_status
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+variable_value
+Buffer pool(s) load completed at TIMESTAMP_NOW
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+COUNT(*)
+596
+call mtr.add_suppression("InnoDB: Error parsing");
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+# Re-write some valid pages to the dump file, make sure the space
+# should be valid but all the page no should be out of bound of the file
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+SELECT variable_value
+FROM information_schema.global_status
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+variable_value
+Buffer pool(s) load completed at TIMESTAMP_NOW
+DROP TABLE ib_bp_test;
+SET GLOBAL innodb_buffer_pool_dump_pct=default;
+#
+# Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS
+#
+SET GLOBAL innodb_buffer_pool_load_now = ON;
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
new file mode 100644
index 00000000000..2b2ea233069
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_debug.result
@@ -0,0 +1,109 @@
+set global innodb_file_per_table=ON;
+set global innodb_thread_concurrency=20;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,root,,;
+connect con4,localhost,root,,;
+connect con5,localhost,root,,;
+connect con6,localhost,root,,;
+connect con7,localhost,root,,;
+connect con8,localhost,root,,;
+create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t2 (c1, c2) values (1, 1);
+create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t3 (c1, c2) values (1, 1);
+create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t4 (c1, c2) values (1, 1);
+create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t5 (c1, c2) values (1, 1);
+create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t6 (c1, c2) values (1, 1);
+create database test2;
+create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into test2.t7 (c1, c2) values (1, 1);
+drop table test2.t7;
+connection con1;
+set @save_dbug=@@global.debug_dbug;
+set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize";
+set global innodb_buffer_pool_size = 12*1024*1024;
+set global innodb_buffer_pool_size = 8*1024*1024;
+ERROR HY000: Another buffer pool resize is already in progress.
+select @@global.innodb_buffer_pool_size;
+@@global.innodb_buffer_pool_size
+8388608
+select @@global.innodb_adaptive_hash_index;
+@@global.innodb_adaptive_hash_index
+0
+set global innodb_adaptive_hash_index = ON;
+select @@global.innodb_adaptive_hash_index;
+@@global.innodb_adaptive_hash_index
+0
+set global innodb_adaptive_hash_index = OFF;
+select @@global.innodb_adaptive_hash_index;
+@@global.innodb_adaptive_hash_index
+0
+create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+connection con2;
+analyze table t2;
+connection con3;
+alter table t3 algorithm=inplace, add index idx (c1);
+connection con4;
+alter table t4 rename to t0;
+connection con5;
+drop table t5;
+connection con6;
+alter table t6 discard tablespace;
+connection con7;
+drop database test2;
+connection con8;
+select count(*) > 0 from information_schema.innodb_buffer_page;
+connection default;
+set global debug_dbug=@save_dbug;
+connection con1;
+connection con2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+connection con3;
+connection con4;
+connection con5;
+connection con6;
+connection con7;
+connection con8;
+count(*) > 0
+1
+connection default;
+disconnect con3;
+disconnect con4;
+disconnect con5;
+disconnect con6;
+disconnect con7;
+disconnect con8;
+disconnect con1;
+disconnect con2;
+call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory.");
+connection default;
+set global debug_dbug="+d,ib_buf_chunk_init_fails";
+set global innodb_buffer_pool_size = 16*1024*1024;
+set global debug_dbug=@save_dbug;
+create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t8 (c1, c2) values (1, 1);
+drop table t8;
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t0;
+drop table t6;
+#
+# BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK
+#
+SET @save_disable = @@GLOBAL.innodb_disable_background_merge;
+SET GLOBAL innodb_disable_background_merge = ON;
+set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
+set global innodb_disable_resize_buffer_pool_debug = OFF;
+set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2;
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
+SET GLOBAL innodb_disable_background_merge = @save_disable;
diff --git a/mysql-test/suite/innodb/r/innodb_bug11754376.result b/mysql-test/suite/innodb/r/innodb_bug11754376.result
index b9f2a169a73..650dfbb35c2 100644
--- a/mysql-test/suite/innodb/r/innodb_bug11754376.result
+++ b/mysql-test/suite/innodb/r/innodb_bug11754376.result
@@ -1,3 +1,5 @@
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low';
DROP TABLE bug11754376;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/r/innodb_bug30113362.result b/mysql-test/suite/innodb/r/innodb_bug30113362.result
new file mode 100644
index 00000000000..57dff622211
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug30113362.result
@@ -0,0 +1,119 @@
+SET GLOBAL innodb_adaptive_hash_index = false;
+SET GLOBAL innodb_stats_persistent = false;
+connect purge_control,localhost,root,,;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connect con2,localhost,root,,;
+CREATE TABLE t1 (
+a00 CHAR(255) NOT NULL DEFAULT 'a',
+a01 CHAR(255) NOT NULL DEFAULT 'a',
+a02 CHAR(255) NOT NULL DEFAULT 'a',
+b INT NOT NULL DEFAULT 0,
+CONSTRAINT pkey PRIMARY KEY(a00, a01, a02)
+) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45';
+SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
+CREATE PROCEDURE data_load_t1()
+BEGIN
+DECLARE c1 INT DEFAULT 97;
+DECLARE c2 INT DEFAULT 97;
+DECLARE c3 INT DEFAULT 97;
+WHILE c1 < 102 DO
+WHILE c2 < 123 DO
+WHILE c3 < 123 DO
+INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3));
+SET c3 = c3 + 1;
+END WHILE;
+SET c3 = 97;
+SET c2 = c2 + 1;
+END WHILE;
+SET c2 = 97;
+SET c1 = c1 + 1;
+END WHILE;
+END |
+call data_load_t1();
+DROP PROCEDURE data_load_t1;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+1856
+connection con2;
+DELETE FROM t1 WHERE a00 = 'cnm';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'cnm';
+connection purge_control;
+COMMIT;
+connection con2;
+SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
+ROLLBACK;
+# Test start
+connection purge_control;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+DELETE FROM t1 WHERE a00 = 'bii';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'bii';
+SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
+SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume';
+ROLLBACK;
+connection purge_control;
+SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
+COMMIT;
+SET DEBUG_SYNC = 'now SIGNAL roll2';
+connect con1,localhost,root,,;
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+SELECT a00 FROM t1 WHERE a00 = 'bii';
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL resume';
+connection con1;
+a00
+connection con2;
+connection default;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+1856
+DELETE FROM t1 WHERE a00 = 'dpn';
+COMMIT;
+INSERT INTO t1 SET a00 = 'dpn';
+ROLLBACK;
+ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35';
+connection purge_control;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+DELETE FROM t1 WHERE a00 = 'cnd';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'cnd';
+SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
+SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2';
+ROLLBACK;
+connection purge_control;
+SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SET DEBUG_SYNC = 'now SIGNAL roll2';
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL resume';
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+disconnect purge_control;
+connection default;
+SET DEBUG_SYNC = 'now SIGNAL resume';
+disconnect con1;
+connection con2;
+disconnect con2;
+connection default;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+1856
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug34053.result b/mysql-test/suite/innodb/r/innodb_bug34053.result
deleted file mode 100644
index 23c5b0cc2f7..00000000000
--- a/mysql-test/suite/innodb/r/innodb_bug34053.result
+++ /dev/null
@@ -1 +0,0 @@
-SET default_storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result
index 4248013b088..aa922776f7b 100644
--- a/mysql-test/suite/innodb/r/innodb_bug56947.result
+++ b/mysql-test/suite/innodb/r/innodb_bug56947.result
@@ -1,5 +1,6 @@
SET GLOBAL innodb_file_per_table=0;
create table bug56947(a int not null) engine = innodb;
+SET @saved_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
alter table bug56947 add unique index (a);
ERROR HY000: Got error 11 "xxx" from storage engine InnoDB
@@ -8,3 +9,4 @@ Table Op Msg_type Msg_text
test.bug56947 check status OK
drop table bug56947;
SET @@global.innodb_file_per_table=DEFAULT;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result
index 2000db03efa..daf0345e8ca 100644
--- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result
+++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result
@@ -24,7 +24,7 @@ test.corrupt_bit_test_ā check Warning InnoDB: Index idx is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index idxā is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index idxē is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index idx is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
diff --git a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
index d10727b95b4..07c96e76213 100644
--- a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
+++ b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
@@ -1,7 +1,7 @@
-DROP TABLE if exists t1;
-select @@global.innodb_stats_persistent;
-@@global.innodb_stats_persistent
-0
+SET @n_pages= @@GLOBAL.innodb_defragment_n_pages;
+SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy;
+SET @sp= @@GLOBAL.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
set global innodb_defragment_stats_accuracy = 80;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
b VARCHAR(256),
@@ -18,6 +18,14 @@ connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con4,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection default;
SET @@global.innodb_defragment_n_pages = 20;
+CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO tt SELECT 0 FROM seq_1_to_180;
+INSERT INTO tt SELECT 5 FROM seq_1_to_160;
+INSERT INTO tt SELECT 1 FROM seq_1_to_1000;
+OPTIMIZE TABLE tt;
+Table Op Msg_type Msg_text
+test.tt optimize note Table does not support optimize, doing recreate + analyze instead
+test.tt optimize status OK
select count(*) from t1;
count(*)
20000
@@ -89,3 +97,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like
count(stat_value) > 0
1
drop table t1;
+SET GLOBAL innodb_defragment_n_pages = @n_pages;
+SET GLOBAL innodb_defragment_stats_accuracy = @accuracy;
+SET GLOBAL innodb_stats_persistent = @sp;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result
new file mode 100644
index 00000000000..42cf8adfc13
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result
@@ -0,0 +1,17 @@
+FLUSH TABLES;
+#
+# MDEV-21217 innodb_force_recovery=2 may wrongly abort the rollback
+# of recovered transactions
+#
+connect con0,localhost,root;
+CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t0 SELECT * FROM seq_1_to_1000;
+connection default;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+disconnect con0;
+connection default;
+SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
+a
+DROP TABLE t0,t1;
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 7eb9a172754..8e3d670e4fe 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
SELECT @@innodb_page_size;
@@innodb_page_size
32768
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 c889e00107b..50d0971bc63 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
SELECT @@innodb_page_size;
@@innodb_page_size
65536
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..1567ac6cb0a 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
@@ -47,3 +47,5 @@ innodb_stats_drop_locked
innodb_stats_drop_locked
innodb_stats_drop_locked
innodb_stats_drop_locked
+DELETE FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
+DELETE FROM mysql.innodb_table_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
diff --git a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result
index 5f14ad9b0d7..65d0a0bde43 100644
--- a/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result
+++ b/mysql-test/suite/innodb/r/innodb_sys_semaphore_waits.result
@@ -4,6 +4,7 @@ drop table if exists t1;
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
+SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,fatal-semaphore-timeout';
set autocommit=0;
# Sending query on con1,
@@ -21,6 +22,6 @@ connection default;
# Waitting for reconnect after mysqld restarts
# Reconnected after mysqld was successfully restarted
# Cleaning up before exit
-set DEBUG_DBUG=NULL;
+SET debug_dbug = @saved_dbug;
drop table if exists t1;
# Clean exit
diff --git a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
new file mode 100644
index 00000000000..32d87b4668a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
@@ -0,0 +1,73 @@
+#
+# Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED
+#
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+create table user_stopword_1(value varchar(30)) engine = innodb;
+create table user_stopword_2(value varchar(30)) engine = innodb;
+set @blah = 'test/user_stopword_1';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/user_stopword_1
+set @blah = 'test/user_stopword_2';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/user_stopword_2
+SET GLOBAL innodb_ft_server_stopword_table= NULL;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+SET GLOBAL innodb_ft_server_stopword_table= default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+drop table user_stopword_1, user_stopword_2;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+ib_buffer_pool
+set @blah='hello';
+set global innodb_buffer_pool_filename = @blah;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+hello
+set global innodb_buffer_pool_filename="bye";
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+bye
+set global innodb_buffer_pool_filename=NULL;
+ERROR 42000: Variable 'innodb_buffer_pool_filename' can't be set to the value of 'NULL'
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+bye
+set global innodb_buffer_pool_filename=default;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+ib_buffer_pool
+CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+CREATE TABLE t2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+set @blah = 'test/t1';
+SET GLOBAL innodb_ft_aux_table = @blah;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+test/t1
+set @blah = 'test/t2';
+SET GLOBAL innodb_ft_aux_table = @blah;
+SET GLOBAL innodb_ft_aux_table = NULL;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+SET GLOBAL innodb_ft_aux_table =default;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+drop table t1,t2;
diff --git a/mysql-test/suite/innodb/r/innodb_wl6326.result b/mysql-test/suite/innodb/r/innodb_wl6326.result
new file mode 100644
index 00000000000..fa093581e56
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_wl6326.result
@@ -0,0 +1,371 @@
+SET GLOBAL innodb_adaptive_hash_index = false;
+SET GLOBAL innodb_stats_persistent = false;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connect con3,localhost,root,,;
+CREATE TABLE t1 (
+a00 CHAR(255) NOT NULL DEFAULT 'a',
+a01 CHAR(255) NOT NULL DEFAULT 'a',
+a02 CHAR(255) NOT NULL DEFAULT 'a',
+a03 CHAR(255) NOT NULL DEFAULT 'a',
+a04 CHAR(255) NOT NULL DEFAULT 'a',
+a05 CHAR(255) NOT NULL DEFAULT 'a',
+a06 CHAR(255) NOT NULL DEFAULT 'a',
+b INT NOT NULL DEFAULT 0
+) ENGINE = InnoDB;
+ALTER TABLE t1 ADD CONSTRAINT pkey PRIMARY KEY(
+a00,
+a01,
+a02,
+a03,
+a04,
+a05,
+a06
+);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+1
+SET GLOBAL innodb_limit_optimistic_insert_debug = 7;
+INSERT INTO t1 (a00) VALUES ('aa');
+INSERT INTO t1 (a00) VALUES ('ab');
+INSERT INTO t1 (a00) VALUES ('ac');
+INSERT INTO t1 (a00) VALUES ('ad');
+INSERT INTO t1 (a00) VALUES ('ae');
+INSERT INTO t1 (a00) VALUES ('af');
+INSERT INTO t1 (a00) VALUES ('ag');
+INSERT INTO t1 (a00) VALUES ('ah');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+3
+INSERT INTO t1 (a00) VALUES ('ai');
+INSERT INTO t1 (a00) VALUES ('aj');
+INSERT INTO t1 (a00) VALUES ('ak');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+4
+INSERT INTO t1 (a00) VALUES ('al');
+INSERT INTO t1 (a00) VALUES ('am');
+INSERT INTO t1 (a00) VALUES ('an');
+INSERT INTO t1 (a00) VALUES ('ao');
+INSERT INTO t1 (a00) VALUES ('ap');
+INSERT INTO t1 (a00) VALUES ('aq');
+INSERT INTO t1 (a00) VALUES ('ar');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+5
+INSERT INTO t1 (a00) VALUES ('as');
+INSERT INTO t1 (a00) VALUES ('at');
+INSERT INTO t1 (a00) VALUES ('au');
+INSERT INTO t1 (a00) VALUES ('av');
+INSERT INTO t1 (a00) VALUES ('aw');
+INSERT INTO t1 (a00) VALUES ('ax');
+INSERT INTO t1 (a00) VALUES ('ay');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+6
+INSERT INTO t1 (a00) VALUES ('az');
+INSERT INTO t1 (a00) VALUES ('ba');
+INSERT INTO t1 (a00) VALUES ('bb');
+INSERT INTO t1 (a00) VALUES ('bc');
+INSERT INTO t1 (a00) VALUES ('bd');
+INSERT INTO t1 (a00) VALUES ('be');
+INSERT INTO t1 (a00) VALUES ('bf');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+7
+INSERT INTO t1 (a00) VALUES ('bg');
+INSERT INTO t1 (a00) VALUES ('bh');
+INSERT INTO t1 (a00) VALUES ('bi');
+INSERT INTO t1 (a00) VALUES ('bj');
+INSERT INTO t1 (a00) VALUES ('bk');
+INSERT INTO t1 (a00) VALUES ('bl');
+INSERT INTO t1 (a00) VALUES ('bm');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+8
+INSERT INTO t1 (a00) VALUES ('bn');
+INSERT INTO t1 (a00) VALUES ('bo');
+INSERT INTO t1 (a00) VALUES ('bp');
+INSERT INTO t1 (a00) VALUES ('bq');
+INSERT INTO t1 (a00) VALUES ('br');
+INSERT INTO t1 (a00) VALUES ('bs');
+INSERT INTO t1 (a00) VALUES ('bt');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+11
+INSERT INTO t1 (a00) VALUES ('bu');
+INSERT INTO t1 (a00) VALUES ('bv');
+INSERT INTO t1 (a00) VALUES ('bw');
+INSERT INTO t1 (a00) VALUES ('bx');
+INSERT INTO t1 (a00) VALUES ('by');
+INSERT INTO t1 (a00) VALUES ('bz');
+INSERT INTO t1 (a00) VALUES ('ca');
+INSERT INTO t1 (a00) VALUES ('cb');
+INSERT INTO t1 (a00) VALUES ('cc');
+INSERT INTO t1 (a00) VALUES ('cd');
+INSERT INTO t1 (a00) VALUES ('ce');
+INSERT INTO t1 (a00) VALUES ('cf');
+INSERT INTO t1 (a00) VALUES ('cg');
+INSERT INTO t1 (a00) VALUES ('ch');
+INSERT INTO t1 (a00) VALUES ('ci');
+INSERT INTO t1 (a00) VALUES ('cj');
+INSERT INTO t1 (a00) VALUES ('ck');
+INSERT INTO t1 (a00) VALUES ('cl');
+INSERT INTO t1 (a00) VALUES ('cm');
+INSERT INTO t1 (a00) VALUES ('cn');
+INSERT INTO t1 (a00) VALUES ('co');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+15
+INSERT INTO t1 (a00) VALUES ('cp');
+INSERT INTO t1 (a00) VALUES ('cq');
+INSERT INTO t1 (a00) VALUES ('cr');
+INSERT INTO t1 (a00) VALUES ('cs');
+INSERT INTO t1 (a00) VALUES ('ct');
+INSERT INTO t1 (a00) VALUES ('cu');
+INSERT INTO t1 (a00) VALUES ('cv');
+INSERT INTO t1 (a00) VALUES ('cw');
+INSERT INTO t1 (a00) VALUES ('cx');
+INSERT INTO t1 (a00) VALUES ('cy');
+INSERT INTO t1 (a00) VALUES ('cz');
+INSERT INTO t1 (a00) VALUES ('da');
+INSERT INTO t1 (a00) VALUES ('db');
+INSERT INTO t1 (a00) VALUES ('dc');
+INSERT INTO t1 (a00) VALUES ('dd');
+INSERT INTO t1 (a00) VALUES ('de');
+INSERT INTO t1 (a00) VALUES ('df');
+INSERT INTO t1 (a00) VALUES ('dg');
+INSERT INTO t1 (a00) VALUES ('dh');
+INSERT INTO t1 (a00) VALUES ('di');
+INSERT INTO t1 (a00) VALUES ('dj');
+INSERT INTO t1 (a00) VALUES ('dk');
+INSERT INTO t1 (a00) VALUES ('dl');
+INSERT INTO t1 (a00) VALUES ('dm');
+INSERT INTO t1 (a00) VALUES ('dn');
+INSERT INTO t1 (a00) VALUES ('do');
+INSERT INTO t1 (a00) VALUES ('dp');
+INSERT INTO t1 (a00) VALUES ('dq');
+INSERT INTO t1 (a00) VALUES ('dr');
+INSERT INTO t1 (a00) VALUES ('ds');
+INSERT INTO t1 (a00) VALUES ('dt');
+INSERT INTO t1 (a00) VALUES ('du');
+INSERT INTO t1 (a00) VALUES ('dv');
+INSERT INTO t1 (a00) VALUES ('dw');
+INSERT INTO t1 (a00) VALUES ('dx');
+INSERT INTO t1 (a00) VALUES ('dy');
+INSERT INTO t1 (a00) VALUES ('dz');
+INSERT INTO t1 (a00) VALUES ('ea');
+INSERT INTO t1 (a00) VALUES ('eb');
+INSERT INTO t1 (a00) VALUES ('ec');
+INSERT INTO t1 (a00) VALUES ('ed');
+INSERT INTO t1 (a00) VALUES ('ee');
+INSERT INTO t1 (a00) VALUES ('ef');
+INSERT INTO t1 (a00) VALUES ('eg');
+INSERT INTO t1 (a00) VALUES ('eh');
+INSERT INTO t1 (a00) VALUES ('ei');
+INSERT INTO t1 (a00) VALUES ('ej');
+INSERT INTO t1 (a00) VALUES ('ek');
+INSERT INTO t1 (a00) VALUES ('el');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+23
+INSERT INTO t1 (a00) VALUES ('em');
+INSERT INTO t1 (a00) VALUES ('en');
+INSERT INTO t1 (a00) VALUES ('eo');
+INSERT INTO t1 (a00) VALUES ('ep');
+INSERT INTO t1 (a00) VALUES ('eq');
+INSERT INTO t1 (a00) VALUES ('er');
+INSERT INTO t1 (a00) VALUES ('es');
+INSERT INTO t1 (a00) VALUES ('et');
+INSERT INTO t1 (a00) VALUES ('eu');
+INSERT INTO t1 (a00) VALUES ('ev');
+INSERT INTO t1 (a00) VALUES ('ew');
+INSERT INTO t1 (a00) VALUES ('ex');
+INSERT INTO t1 (a00) VALUES ('ey');
+INSERT INTO t1 (a00) VALUES ('ez');
+INSERT INTO t1 (a00) VALUES ('fa');
+INSERT INTO t1 (a00) VALUES ('fb');
+INSERT INTO t1 (a00) VALUES ('fc');
+INSERT INTO t1 (a00) VALUES ('fd');
+INSERT INTO t1 (a00) VALUES ('fe');
+INSERT INTO t1 (a00) VALUES ('ff');
+INSERT INTO t1 (a00) VALUES ('fg');
+INSERT INTO t1 (a00) VALUES ('fh');
+INSERT INTO t1 (a00) VALUES ('fi');
+INSERT INTO t1 (a00) VALUES ('fj');
+INSERT INTO t1 (a00) VALUES ('fk');
+INSERT INTO t1 (a00) VALUES ('fl');
+INSERT INTO t1 (a00) VALUES ('fm');
+INSERT INTO t1 (a00) VALUES ('fn');
+INSERT INTO t1 (a00) VALUES ('fo');
+INSERT INTO t1 (a00) VALUES ('fp');
+INSERT INTO t1 (a00) VALUES ('fq');
+INSERT INTO t1 (a00) VALUES ('fr');
+INSERT INTO t1 (a00) VALUES ('fs');
+INSERT INTO t1 (a00) VALUES ('ft');
+INSERT INTO t1 (a00) VALUES ('fu');
+INSERT INTO t1 (a00) VALUES ('fv');
+INSERT INTO t1 (a00) VALUES ('fw');
+INSERT INTO t1 (a00) VALUES ('fx');
+INSERT INTO t1 (a00) VALUES ('fy');
+INSERT INTO t1 (a00) VALUES ('fz');
+INSERT INTO t1 (a00) VALUES ('ga');
+INSERT INTO t1 (a00) VALUES ('gb');
+INSERT INTO t1 (a00) VALUES ('gc');
+INSERT INTO t1 (a00) VALUES ('gd');
+INSERT INTO t1 (a00) VALUES ('ge');
+INSERT INTO t1 (a00) VALUES ('gf');
+INSERT INTO t1 (a00) VALUES ('gg');
+INSERT INTO t1 (a00) VALUES ('gh');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+29
+SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
+# Test start
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 (a00) VALUES ('bfa');
+connection con1;
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+INSERT INTO t1 (a00) VALUES ('bfb');
+connection con2;
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+a00 a01
+aa a
+SELECT a00,a01 FROM t1 WHERE a00 = 'aq';
+a00 a01
+aq a
+SELECT a00,a01 FROM t1 WHERE a00 = 'cp';
+a00 a01
+cp a
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+a00 a01
+el a
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+SELECT a00,a01 FROM t1 WHERE a00 = 'ar';
+connection con3;
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+SELECT a00,a01 FROM t1 WHERE a00 = 'cn';
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+connection con1;
+connection con2;
+a00 a01
+ar a
+connection con3;
+a00 a01
+cn a
+connection default;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+30
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 (a00) VALUES ('coa');
+connection con1;
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+INSERT INTO t1 (a00) VALUES ('cob');
+connection con2;
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+connection con3;
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+connection con1;
+connection con2;
+a00 a01
+aa a
+connection con3;
+a00 a01
+el a
+connection default;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+31
+SET DEBUG_SYNC = 'RESET';
+INSERT INTO t1 (a00) VALUES ('gba');
+connection con1;
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+INSERT INTO t1 (a00) VALUES ('gbb');
+connection con2;
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+a00 a01
+aa a
+SELECT a00,a01 FROM t1 WHERE a00 = 'ek';
+a00 a01
+ek a
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+connection con3;
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+SELECT a00,a01 FROM t1 WHERE a00 = 'gb';
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL continue';
+connection con1;
+connection con2;
+a00 a01
+el a
+connection con3;
+a00 a01
+gb a
+connection default;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+CLUST_INDEX_SIZE
+32
+SET DEBUG_SYNC = 'RESET';
+connection default;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_wl6326_big.result b/mysql-test/suite/innodb/r/innodb_wl6326_big.result
new file mode 100644
index 00000000000..3ff6d0d0b5c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_wl6326_big.result
@@ -0,0 +1,449 @@
+CREATE SCHEMA my_schema;
+USE my_schema;
+CREATE FUNCTION f_thread_id (i INT) RETURNS CHAR(4) DETERMINISTIC
+RETURN CONCAT(LPAD(CAST(i AS CHAR),3,'_'),'_') ;
+SELECT CONCAT('->', f_thread_id( 1), '<-');
+CONCAT('->', f_thread_id( 1), '<-')
+->__1_<-
+SELECT CONCAT('->', f_thread_id(12), '<-');
+CONCAT('->', f_thread_id(12), '<-')
+->_12_<-
+SET @extra_int = 1;
+SET @extra_string = f_thread_id(@extra_int);
+SELECT @extra_int , @extra_string;
+@extra_int @extra_string
+1 __1_
+CREATE FUNCTION f_col_int1 (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN i * 1000 + @extra_int ;
+SELECT f_col_int1(my_col) AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+1001
+12001
+123001
+1234001
+12345001
+CREATE FUNCTION f_col_int2 (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN @extra_int * 10000000 + i ;
+SELECT f_col_int2(my_col) AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+10000001
+10000012
+10000123
+10001234
+10012345
+CREATE FUNCTION f_col_int3 (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN @extra_int ;
+SELECT f_col_int3(my_col) AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+1
+1
+1
+1
+1
+CREATE FUNCTION f_col_blob (i INT) RETURNS BLOB DETERMINISTIC
+RETURN RPAD(@extra_string,(@@innodb_page_size / 2 ) + 1,'a');
+SELECT CONCAT('->', SUBSTR(f_col_blob(my_col) FROM 1 FOR 10),
+'<-.....->', SUBSTR(f_col_blob(my_col) FROM -10 FOR 10), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+->__1_aaaaaa<-.....->aaaaaaaaaa<-
+->__1_aaaaaa<-.....->aaaaaaaaaa<-
+->__1_aaaaaa<-.....->aaaaaaaaaa<-
+->__1_aaaaaa<-.....->aaaaaaaaaa<-
+->__1_aaaaaa<-.....->aaaaaaaaaa<-
+CREATE FUNCTION f_col_char0 (i INT) RETURNS CHAR(255) DETERMINISTIC
+RETURN LPAD(CAST(i AS CHAR),255,' ');
+SELECT CONCAT('->', f_col_char0(my_col), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+-> 1<-
+-> 12<-
+-> 123<-
+-> 1234<-
+-> 12345<-
+CREATE FUNCTION f_col_char1 (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',
+LPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
+@extra_string,
+RPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
+'E') ;
+SELECT CONCAT('->', f_col_char1(my_col), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+->B __1_1 E<-
+->B 1__1_2 E<-
+->B 1__1_23 E<-
+->B 12__1_34 E<-
+->B 12__1_345 E<-
+CREATE FUNCTION f_col_char2 (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',
+RPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
+@extra_string,
+LPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
+'E');
+SELECT CONCAT('->', f_col_char2(my_col), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+->B __1_ 1E<-
+->B1 __1_ 2E<-
+->B1 __1_ 23E<-
+->B12 __1_ 34E<-
+->B12 __1_ 345E<-
+CREATE FUNCTION f_col_char3 (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',@extra_string,LPAD(CAST(i AS CHAR),20,' '),'E');
+SELECT CONCAT('->', f_col_char3(my_col), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+->B__1_ 1E<-
+->B__1_ 12E<-
+->B__1_ 123E<-
+->B__1_ 1234E<-
+->B__1_ 12345E<-
+CREATE FUNCTION f_col_char4 (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',RPAD(CAST(i AS CHAR),20,' '),@extra_string,'E');
+SELECT CONCAT('->', f_col_char4(my_col), '<-') AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+my_result
+->B1 __1_E<-
+->B12 __1_E<-
+->B123 __1_E<-
+->B1234 __1_E<-
+->B12345 __1_E<-
+CREATE TABLE my_metrics LIKE information_schema.innodb_metrics;
+ALTER TABLE my_metrics ADD COLUMN phase ENUM('after', 'before'),
+DROP COLUMN SUBSYSTEM, DROP COLUMN TYPE, DROP COLUMN COMMENT,
+ADD PRIMARY KEY (NAME,phase);
+CREATE TABLE t1 (
+col_int0 BIGINT,
+col_int1 BIGINT,
+col_int2 BIGINT,
+col_int3 BIGINT,
+col_blob BLOB,
+col_char0 VARCHAR(255),
+col_char1 VARCHAR(30),
+col_char2 VARCHAR(30),
+col_char3 VARCHAR(30),
+col_char4 VARCHAR(30)
+) ENGINE = InnoDB;
+ALTER TABLE t1 ADD UNIQUE KEY uidx_col_int0 (col_int0),
+ADD UNIQUE KEY uidx1 (col_int1, col_char0),
+ADD UNIQUE KEY uidx2 (col_int2, col_char0, col_int1),
+ADD UNIQUE KEY uidx3 (col_int3, col_int2, col_char0),
+ADD UNIQUE KEY uidx4 (col_char1, col_char0),
+ADD UNIQUE KEY uidx5 (col_char2, col_char0, col_char1),
+ADD UNIQUE KEY uidx6 (col_char3, col_char2, col_char0),
+ADD UNIQUE KEY uidx7 (col_int1, col_int2, col_int3, col_char4,
+col_char1, col_char2, col_char3, col_char0),
+ADD KEY idx8 (col_blob(10), col_char4);
+CREATE PROCEDURE proc_fill_t1 (max_row_count INT, load_unit INT)
+BEGIN
+DECLARE my_count INTEGER DEFAULT 0;
+DECLARE max_load_count INTEGER DEFAULT 0;
+DROP TABLE IF EXISTS t0;
+CREATE TEMPORARY TABLE t0 (col_int0 BIGINT, PRIMARY KEY(col_int0));
+WHILE (my_count < load_unit ) DO
+SET my_count = my_count + 1;
+INSERT INTO t0 SET col_int0 = my_count;
+END WHILE;
+SET max_load_count = (SELECT (max_row_count DIV load_unit) + 1 );
+SELECT COUNT(col_int0) INTO @val FROM t1;
+SET my_count = 0;
+REPEAT
+INSERT INTO t1 (col_int0, col_int1, col_int2, col_int3, col_blob,
+col_char0, col_char1, col_char2,col_char3,col_char4)
+SELECT col_int0 + @val,
+f_col_int1(col_int0 + @val),
+f_col_int2(col_int0 + @val),
+f_col_int3(col_int0 + @val),
+f_col_blob(col_int0 + @val),
+f_col_char0(col_int0 + @val),
+f_col_char1(col_int0 + @val),
+f_col_char2(col_int0 + @val),
+f_col_char3(col_int0 + @val),
+f_col_char4(col_int0 + @val)
+FROM t0;
+COMMIT;
+SELECT MAX(col_int0) INTO @val FROM t1;
+SET my_count = my_count + 1;
+UNTIL( my_count > max_load_count OR @val >= max_row_count )
+END REPEAT;
+DROP TEMPORARY TABLE t0;
+END|
+CREATE PROCEDURE proc_dml (max_duration INT, t1_stripe_half INT)
+BEGIN
+DECLARE aux INTEGER DEFAULT 0;
+DECLARE start_time INT;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN END;
+SET @extra_int = CONNECTION_ID();
+SET @extra_string = f_thread_id(@extra_int);
+SELECT ROUND(MAX(col_int0) / 2 ) INTO @t1_half FROM t1;
+# The user lock 'Blocker' should be already set by some other session S1.
+# S1 starts the race by releasing that lock.
+# Wait till the lock is released and the lock can be obtained.
+# In order to prevent endless waiting in case of non foreseen problems
+# limit the timespan to 30 seconds.
+SELECT GET_LOCK('Blocker', 30) INTO @aux;
+# Release the lock immediate so that the other "runner" sessions start too.
+SELECT RELEASE_LOCK('Blocker') INTO @aux;
+SET start_time = UNIX_TIMESTAMP();
+WHILE (UNIX_TIMESTAMP() - start_time < max_duration) DO
+SET @aux = @t1_half - t1_stripe_half + ROUND(RAND() * t1_stripe_half * 2);
+UPDATE t1 SET
+col_int1 = f_col_int1(col_int0),
+col_int2 = f_col_int2(col_int0),
+col_int3 = f_col_int3(col_int0),
+col_blob = f_col_blob(col_int0),
+col_char0 = f_col_char0(col_int0),
+col_char1 = f_col_char1(col_int0),
+col_char2 = f_col_char2(col_int0),
+col_char3 = f_col_char3(col_int0),
+col_char4 = f_col_char4(col_int0)
+WHERE col_int0 = @aux;
+COMMIT;
+END WHILE;
+END|
+SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
+SET @pre_reset_ts = NOW();
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+SET @pre_enable_ts = NOW();
+SET GLOBAL innodb_monitor_enable = "innodb_rwlock_sx_%";
+SET @pre_collect_ts = NOW();
+DELETE FROM my_metrics;
+INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'before'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+# TC-01 There are exact three entries "innodb_rwlock_sx_%" with the
+# with the name which follow in innodb_metrics.
+# pass
+SELECT COUNT(*) INTO @sx_count FROM my_metrics;
+# TC-02 Counting is now enabled. ALL = @sx_count entries show that.
+# pass
+# TC-03 @pre_reset_ts < TIME_RESET. ALL = @sx_count entries show that.
+# pass
+# TC-04 @pre_enable_ts < TIME_ENABLED. ALL = @sx_count entries show that.
+# pass
+# TC-05 TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts
+# AND TIME_ELAPSED > 0. ALL = @sx_count entries show that.
+# pass
+# TC-06 COUNT_RESET = MAX_COUNT_RESET. ALL = @sx_count entries show that.
+# pass
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+SHOW ENGINE INNODB STATUS;
+DELETE FROM my_metrics;
+INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'before'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+SET @extra_string = '__0_';
+SET @extra_int = 0;
+# TC-07 One session inserts some significant amount of rows into t1.
+# The system MUST survive that.
+SET @max_row_count = <max_row_count>;
+SET @load_unit = <load_unit>;
+SET @start_time = UNIX_TIMESTAMP();
+SET AUTOCOMMIT = OFF;
+CALL proc_fill_t1 (@max_row_count, @load_unit);
+# pass
+SET AUTOCOMMIT = ON;
+SELECT col_int0 INTO @t1_half FROM t1
+WHERE col_int0 >= (@val DIV 2) ORDER BY col_int0 LIMIT 1;
+SHOW ENGINE INNODB STATUS;
+SELECT col_int0, col_int1, col_int2, col_int3,
+CONCAT('->', SUBSTR(col_blob FROM 1 FOR 10),
+'<-.....->', SUBSTR(col_blob FROM -10 FOR 10), '<-') AS col_blobx,
+CONCAT('->',col_char0,'<-') AS col_char0x,
+CONCAT('->',col_char1,'<-') AS col_char1x,
+CONCAT('->',col_char2,'<-') AS col_char2x,
+CONCAT('->',col_char3,'<-') AS col_char3x,
+CONCAT('->',col_char4,'<-') AS col_char4x
+FROM t1 WHERE col_int0 between 98 AND 102;
+col_int0 98
+col_int1 98000
+col_int2 98
+col_int3 0
+col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
+col_char0x -> 98<-
+col_char1x ->B 9__0_8 E<-
+col_char2x ->B9 __0_ 8E<-
+col_char3x ->B__0_ 98E<-
+col_char4x ->B98 __0_E<-
+col_int0 99
+col_int1 99000
+col_int2 99
+col_int3 0
+col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
+col_char0x -> 99<-
+col_char1x ->B 9__0_9 E<-
+col_char2x ->B9 __0_ 9E<-
+col_char3x ->B__0_ 99E<-
+col_char4x ->B99 __0_E<-
+col_int0 100
+col_int1 100000
+col_int2 100
+col_int3 0
+col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
+col_char0x -> 100<-
+col_char1x ->B 1__0_00 E<-
+col_char2x ->B1 __0_ 00E<-
+col_char3x ->B__0_ 100E<-
+col_char4x ->B100 __0_E<-
+col_int0 101
+col_int1 101000
+col_int2 101
+col_int3 0
+col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
+col_char0x -> 101<-
+col_char1x ->B 1__0_01 E<-
+col_char2x ->B1 __0_ 01E<-
+col_char3x ->B__0_ 101E<-
+col_char4x ->B101 __0_E<-
+col_int0 102
+col_int1 102000
+col_int2 102
+col_int3 0
+col_blobx ->__0_aaaaaa<-.....->aaaaaaaaaa<-
+col_char0x -> 102<-
+col_char1x ->B 1__0_02 E<-
+col_char2x ->B1 __0_ 02E<-
+col_char3x ->B__0_ 102E<-
+col_char4x ->B102 __0_E<-
+# TC-11 Several concurrent sessions perform updates in t1 like mad.
+# The system MUST survive this.
+# Printing of statements is partially suppressed.
+SET @start_time = UNIX_TIMESTAMP();
+SELECT 1 FROM t1 WHERE col_int0 = @t1_half FOR UPDATE;
+1
+1
+SELECT GET_LOCK('Blocker', 1000) ;
+GET_LOCK('Blocker', 1000)
+1
+RELEASE_LOCK('Blocker')
+1
+# pass
+SHOW ENGINE INNODB STATUS;
+# TC-13 One session performs ALTER TABLE t1 ADD KEY ... on the fat table t1.
+# The system MUST survive this.
+SET @start_time = UNIX_TIMESTAMP();
+ALTER TABLE t1 ADD KEY idx_col_char4_col_char0 (col_char4,col_char0);
+SHOW ENGINE INNODB STATUS;
+# pass
+# TC-15 One session performs a fat update on the fat table t1.
+# The system MUST survive this.
+SET @start_time = UNIX_TIMESTAMP();
+SET @extra_int = 13;
+SET @extra_string = f_thread_id(@extra_int);
+UPDATE t1 SET
+col_int1 = f_col_int1(col_int0), col_int2 = f_col_int2(col_int0),
+col_int3 = f_col_int3(col_int0), col_blob = f_col_blob(col_int0),
+col_char0 = f_col_char0(col_int0), col_char1 = f_col_char1(col_int0),
+col_char2 = f_col_char2(col_int0), col_char3 = f_col_char3(col_int0),
+col_char4 = f_col_char4(col_int0)
+WHERE col_int0 BETWEEN @t1_half - 2500 AND @t1_half + 2500;
+COMMIT;
+SHOW ENGINE INNODB STATUS;
+# pass
+INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'after'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+# TC-16 The following activities happend after reset in innodb_metrics
+# - Insert some significant amount of rows into t1.
+# - Several concurrent users perform excessive updates in t1.
+# - ALTER TABLE ... ADD KEY <sufficient big enough structure>
+# - One UPDATE statement modifying a huge slice of t1.
+# Any of them causes heavy use of SX lock and therefore COUNT_RESET
+# must have grown for ALL = @sx_count entries.
+# pass
+# TC-09 Heavy activity after reset.
+# COUNT_RESET = MAX_COUNT_RESET for ALL = @sx_count entries
+# needs to stay valid though he counters will have grown.
+# pass
+DELETE FROM my_metrics;
+INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'before'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'after'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+# TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL
+# = @sx_count entries.
+# pass
+# TC-17 We had heavy activity causing big counters and after that a reset.
+# Reset causes COUNT > COUNT_RESET AND MAX_COUNT > MAX_COUNT_RESET
+# for ALL @sx_count entries.
+# pass
+# TC-18 We had some reset but this must not decrease COUNT or MAX_COUNT
+# after.COUNT >= before.COUNT AND
+# after.MAX_COUNT >= before.MAX_COUNT for ALL @sx_count entries.
+# pass
+# TC-19 We had some reset after heavy activity and this must cause
+# after.COUNT_RESET < before.COUNT_RESET
+# AND after.MAX_COUNT_RESET < before.MAX_COUNT_RESET AND
+# for ALL @sx_count entries.
+# pass
+connection con10;
+disconnect con10;
+connection con9;
+disconnect con9;
+connection con8;
+disconnect con8;
+connection con7;
+disconnect con7;
+connection con6;
+disconnect con6;
+connection con5;
+disconnect con5;
+connection con4;
+disconnect con4;
+connection con3;
+disconnect con3;
+connection con2;
+disconnect con2;
+connection con1;
+disconnect con1;
+connection default;
+USE test;
+DROP SCHEMA my_schema;
+SET GLOBAL innodb_monitor_disable = all;
+SET GLOBAL innodb_monitor_reset_all = all;
+SET GLOBAL innodb_monitor_enable = default;
+SET GLOBAL innodb_monitor_disable = default;
+SET GLOBAL innodb_monitor_reset = default;
+SET GLOBAL innodb_monitor_reset_all = default;
+SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
diff --git a/mysql-test/suite/innodb/r/innodb_xtradb_compat.result b/mysql-test/suite/innodb/r/innodb_xtradb_compat.result
index 20b6ac4c892..5722120356a 100644
--- a/mysql-test/suite/innodb/r/innodb_xtradb_compat.result
+++ b/mysql-test/suite/innodb/r/innodb_xtradb_compat.result
@@ -148,7 +148,7 @@ Warnings:
Warning 1287 Using innodb_log_checksum_algorithm is deprecated and the parameter may be removed in future releases. Ignoning the parameter.
select @@innodb_log_checksum_algorithm, @@innodb_log_checksums;
@@innodb_log_checksum_algorithm @@innodb_log_checksums
-NONE 0
+STRICT_INNODB 1
set global innodb_log_checksum_algorithm=STRICT_INNODB;
Warnings:
Warning 1287 Using innodb_log_checksum_algorithm is deprecated and the parameter may be removed in future releases. Ignoning the parameter.
diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result
index ae7ce48fe5e..3fe78c91802 100644
--- a/mysql-test/suite/innodb/r/log_file_name_debug.result
+++ b/mysql-test/suite/innodb/r/log_file_name_debug.result
@@ -10,5 +10,5 @@ ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either/ in mysqld.1.err
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err
+FOUND 1 /ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/mvcc.result b/mysql-test/suite/innodb/r/mvcc.result
index 6826978d6a7..b0b834c91a4 100644
--- a/mysql-test/suite/innodb/r/mvcc.result
+++ b/mysql-test/suite/innodb/r/mvcc.result
@@ -28,4 +28,18 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-23198 Crash in REPLACE
+#
+BEGIN NOT ATOMIC
+DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(id INT PRIMARY KEY, c',
+GROUP_CONCAT(seq SEPARATOR ' INT, c'),
+' INT NOT NULL UNIQUE) ENGINE=InnoDB')
+FROM seq_1_to_294);
+EXECUTE IMMEDIATE c;
+END;
+$$
+INSERT INTO t1 SET id=1,c294=1;
+REPLACE t1 SET id=1,c294=1;
+DROP TABLE t1;
SET GLOBAL innodb_file_per_table= @save_per_table;
diff --git a/mysql-test/suite/innodb/r/read_only_recover_committed.result b/mysql-test/suite/innodb/r/read_only_recover_committed.result
index 34b33f60f1b..4c1235761e6 100644
--- a/mysql-test/suite/innodb/r/read_only_recover_committed.result
+++ b/mysql-test/suite/innodb/r/read_only_recover_committed.result
@@ -30,6 +30,7 @@ SELECT * FROM t;
a
1
UPDATE t SET a=3 WHERE a=1;
+SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version
# (empty table)!
diff --git a/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result
index efe48682a6f..3915b07f12e 100644
--- a/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result
+++ b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result
@@ -4,8 +4,8 @@ SET GLOBAL innodb_master_thread_disabled_debug = 1;
SET GLOBAL innodb_log_checkpoint_now = 1;
CREATE DATABASE very_long_database_name;
USE very_long_database_name;
-set debug_dbug = '+d,increase_mtr_checkpoint_size';
-set debug_dbug = '+d,crash_after_checkpoint';
+SET debug_dbug = '+d,increase_mtr_checkpoint_size';
+SET debug_dbug = '+d,crash_after_checkpoint';
set global innodb_log_checkpoint_now = 1;
ERROR HY000: Lost connection to MySQL server during query
# Skip MLOG_FILE_NAME redo records during recovery
@@ -18,7 +18,7 @@ SET GLOBAL innodb_log_checkpoint_now = 1;
# exceeds LOG_CHECKPOINT_FREE_PER_THREAD size during checkpoint.
CREATE DATABASE very_long_database_name;
USE very_long_database_name;
-set debug_dbug = '+d,crash_after_checkpoint';
+SET debug_dbug = '+d,crash_after_checkpoint';
set global innodb_log_checkpoint_now = 1;
ERROR HY000: Lost connection to MySQL server during query
# Skip MLOG_FILE_NAME redo records during recovery
diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result
index 1a291a0e59f..6b5cd1b5ad0 100644
--- a/mysql-test/suite/innodb/r/row_format_redundant.result
+++ b/mysql-test/suite/innodb/r/row_format_redundant.result
@@ -5,8 +5,7 @@ SET GLOBAL innodb_file_per_table=1;
#
SET GLOBAL innodb_file_per_table=ON;
create table t1 (a int not null, d varchar(15) not null, b
-varchar(198) not null, c char(156),
-fulltext ftsic(c)) engine=InnoDB
+varchar(198) not null, c char(156)) engine=InnoDB
row_format=redundant;
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
@@ -72,7 +71,7 @@ DROP TABLE t1;
Warnings:
Warning 1932 Table 'test.t1' doesn't exist in engine
DROP TABLE t2,t3;
-FOUND 50 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b/ in mysqld.1.err
+FOUND 6 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b/ in mysqld.1.err
ib_buffer_pool
ib_logfile0
ib_logfile1
diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result
new file mode 100644
index 00000000000..fba209dd2b5
--- /dev/null
+++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result
@@ -0,0 +1,45 @@
+call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
+SET innodb_strict_mode = 0;
+SET @@global.log_warnings = 3;
+CREATE TABLE t1 (
+col_1 TEXT
+,col_2 TEXT
+,col_3 TEXT
+,col_4 TEXT
+,col_5 TEXT
+,col_6 TEXT
+,col_7 TEXT
+,col_8 TEXT
+,col_9 TEXT
+,col_10 TEXT
+,col_11 TEXT
+) ENGINE=INNODB ROW_FORMAT=COMPACT;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+TRUNCATE TABLE t1;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ALTER TABLE t1 FORCE;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+SET innodb_strict_mode = ON;
+TRUNCATE TABLE t1;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ALTER TABLE t1 FORCE;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+DROP TABLE t1;
+SET @@global.log_warnings = 2;
diff --git a/mysql-test/suite/innodb/r/stats_persistent.result b/mysql-test/suite/innodb/r/stats_persistent.result
new file mode 100644
index 00000000000..c96afb41af2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/stats_persistent.result
@@ -0,0 +1,18 @@
+#
+# MDEV-23991 dict_table_stats_lock() has unnecessarily long scope
+#
+CREATE TABLE t1(a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go';
+ANALYZE TABLE t1;
+connect con1, localhost, root;
+SET DEBUG_SYNC='now WAIT_FOR stop';
+SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB';
+ENGINE SUM(DATA_LENGTH+INDEX_LENGTH) COUNT(ENGINE) SUM(DATA_LENGTH) SUM(INDEX_LENGTH)
+InnoDB 49152 3 49152 0
+SET DEBUG_SYNC='now SIGNAL go';
+disconnect con1;
+connection default;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result
index 5e9fd60d4fe..571aa2da1c5 100644
--- a/mysql-test/suite/innodb/r/truncate.result
+++ b/mysql-test/suite/innodb/r/truncate.result
@@ -39,3 +39,14 @@ TRUNCATE t1;
SELECT * FROM t1;
a
DROP TEMPORARY TABLE t1;
+#
+# MDEV-23705 Assertion 'table->data_dir_path || !space'
+#
+CREATE TABLE t(c INT) ENGINE=InnoDB;
+ALTER TABLE t DISCARD TABLESPACE;
+RENAME TABLE t TO u;
+TRUNCATE u;
+Warnings:
+Warning 1814 Tablespace has been discarded for table `u`
+TRUNCATE u;
+DROP TABLE u;
diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result
index bcf5b16aa83..fc09b74d62f 100644
--- a/mysql-test/suite/innodb/r/truncate_foreign.result
+++ b/mysql-test/suite/innodb/r/truncate_foreign.result
@@ -29,6 +29,7 @@ SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go';
DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
+SET lock_wait_timeout=1;
TRUNCATE TABLE child;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC='now SIGNAL go';
diff --git a/mysql-test/suite/innodb/r/truncate_inject.result b/mysql-test/suite/innodb/r/truncate_inject.result
index 5ec532a0f83..f69013172cd 100644
--- a/mysql-test/suite/innodb/r/truncate_inject.result
+++ b/mysql-test/suite/innodb/r/truncate_inject.result
@@ -7,10 +7,10 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
-SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -20,10 +20,10 @@ i f c
2 2.2 b
3 3.3 c
# 2. Error while preparing for truncate
-SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -33,10 +33,10 @@ i f c
2 2.2 b
3 3.3 c
# 3. Error while dropping/creating indexes
-SET debug_dbug = '+d,ib_err_trunc_drop_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_drop_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
@@ -50,10 +50,10 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
-SET debug_dbug = '+d,ib_err_trunc_create_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_create_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
@@ -67,9 +67,9 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -85,9 +85,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'),
check table t;
Table Op Msg_type Msg_text
test.t check status OK
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
@@ -103,9 +103,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'),
check table t;
Table Op Msg_type Msg_text
test.t check status OK
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
diff --git a/mysql-test/suite/innodb/r/undo_log.result b/mysql-test/suite/innodb/r/undo_log.result
index 7892e26d896..cda3b190ede 100644
--- a/mysql-test/suite/innodb/r/undo_log.result
+++ b/mysql-test/suite/innodb/r/undo_log.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is");
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result
index a93afcb07f8..a618154804c 100644
--- a/mysql-test/suite/innodb/r/xa_recovery.result
+++ b/mysql-test/suite/innodb/r/xa_recovery.result
@@ -5,11 +5,19 @@ XA START 'x';
UPDATE t1 set a=2;
XA END 'x';
XA PREPARE 'x';
+connect con2,localhost,root;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+XA START 'y';
+INSERT INTO t2 VALUES (1);
+XA END 'y';
+XA PREPARE 'y';
connection default;
disconnect con1;
+disconnect con2;
connect con1,localhost,root;
SELECT * FROM t1 LOCK IN SHARE MODE;
connection default;
+DROP TABLE t2;
disconnect con1;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
@@ -20,3 +28,5 @@ SELECT * FROM t1;
a
1
DROP TABLE t1;
+SET GLOBAL innodb_fast_shutdown=0;
+XA ROLLBACK 'y';
diff --git a/mysql-test/suite/innodb/r/xa_recovery_debug.result b/mysql-test/suite/innodb/r/xa_recovery_debug.result
new file mode 100644
index 00000000000..0a035937b9c
--- /dev/null
+++ b/mysql-test/suite/innodb/r/xa_recovery_debug.result
@@ -0,0 +1,26 @@
+#
+# Bug#20872655 XA ROLLBACK IS NOT CRASH-SAFE
+#
+CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=INNODB;
+INSERT INTO t SET a=0;
+connect con1,localhost,root;
+XA START 'zombie';
+INSERT INTO t SET a=1;
+UPDATE t SET b=1 WHERE a=1;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+2
+XA END 'zombie';
+XA PREPARE 'zombie';
+SET DEBUG_SYNC='trx_after_rollback_row SIGNAL s1 WAIT_FOR s2';
+XA ROLLBACK 'zombie';
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR s1';
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+DELETE FROM t LIMIT 1;
+disconnect con1;
+XA COMMIT 'zombie';
+ERROR XAE04: XAER_NOTA: Unknown XID
+SELECT * FROM t;
+a b
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
index 0094db520ae..1051b79bddb 100644
--- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test
+++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
@@ -58,7 +58,9 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
--error ER_PARSE_ERROR
ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
ALTER TABLE t DISCARD TABLESPACE;
-DROP TABLE t;
+RENAME TABLE t TO u;
+RENAME TABLE u TO v;
+DROP TABLE v;
--error ER_GET_ERRNO
SELECT * FROM `x..d`;
DROP TABLE `x..d`;
diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test
index d0943e7d407..5050abdc087 100644
--- a/mysql-test/suite/innodb/t/alter_table.test
+++ b/mysql-test/suite/innodb/t/alter_table.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/have_sequence.inc
#
# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error
#
@@ -59,3 +60,22 @@ ALTER TABLE t1 ADD b INT;
ALTER TABLE t1 DROP a;
ALTER TABLE t1 ADD c INT;
DROP TABLE t1, tx;
+
+--echo #
+--echo # MDEV-14119 Assertion cmp_rec_rec() on ALTER TABLE
+--echo #
+CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 SELECT * FROM seq_1_to_128;
+ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22939 Server crashes in row_make_new_pathname()
+--echo #
+CREATE TABLE t (a INT) ENGINE=INNODB;
+ALTER TABLE t DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+ALTER TABLE t ENGINE INNODB;
+--error ER_TABLESPACE_DISCARDED
+ALTER TABLE t FORCE;
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/analyze_table.test b/mysql-test/suite/innodb/t/analyze_table.test
index e9db3668f02..538eed04ba4 100644
--- a/mysql-test/suite/innodb/t/analyze_table.test
+++ b/mysql-test/suite/innodb/t/analyze_table.test
@@ -1,23 +1,11 @@
-#
-# BUG#22385442 - INNODB: DIFFICULT TO FIND FREE BLOCKS IN THE BUFFER POOL
-#
-
--source include/have_innodb.inc
---source include/big_test.inc
+--source include/have_sequence.inc
-DELIMITER |;
-CREATE PROCEDURE populate_t1()
-BEGIN
- DECLARE i int DEFAULT 1;
+#
+# MDEV-22073 MSAN use-of-uninitialized-value in collect_statistics_for_table()
+#
- START TRANSACTION;
- WHILE (i <= 1000000) DO
- INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
- SET i = i + 1;
- END WHILE;
- COMMIT;
-END|
-DELIMITER ;|
+set use_stat_tables='preferably';
CREATE TABLE t1(
class INT,
@@ -25,18 +13,11 @@ CREATE TABLE t1(
title VARCHAR(100)
) ENGINE=InnoDB;
--- disable_query_log
-CALL populate_t1();
--- enable_query_log
+insert into t1 select seq, seq, concat('a', seq) from seq_1_to_500;
SELECT COUNT(*) FROM t1;
-SET GLOBAL innodb_stats_persistent_sample_pages=2000;
-
+set @@max_heap_table_size=16384;
ANALYZE TABLE t1;
DROP TABLE t1;
-
-DROP PROCEDURE populate_t1;
-
-SET GLOBAL innodb_stats_persistent_sample_pages=default;
diff --git a/mysql-test/suite/innodb/t/blob-update-debug.test b/mysql-test/suite/innodb/t/blob-update-debug.test
index 948cd749148..8d35dbfc70e 100644
--- a/mysql-test/suite/innodb/t/blob-update-debug.test
+++ b/mysql-test/suite/innodb/t/blob-update-debug.test
@@ -11,7 +11,9 @@
create table t1 (f1 int primary key, f2 blob) engine = innodb;
insert into t1 values (1, repeat('*', 50000));
select f1, substring(f2, 1, 40) from t1;
-set debug_dbug = 'd,row_ins_index_entry_timeout';
+set @saved_debug = @@session.debug_dbug;
+SET debug_dbug = 'd,row_ins_index_entry_timeout';
update t1 set f1 = 3;
select f1, substring(f2, 1, 40) from t1;
drop table t1;
+SET debug_dbug= @saved_debug;
diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt
new file mode 100644
index 00000000000..09fd8bd8e35
--- /dev/null
+++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m
diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test
new file mode 100644
index 00000000000..b0aa20b566f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test
@@ -0,0 +1,28 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+--echo #
+--echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL
+--echo # ONLINE WITH MEMORY FULL CONDITION
+--echo #
+
+call mtr.add_suppression("InnoDB: .* failed to allocate the chunk array");
+
+SET GLOBAL innodb_disable_resize_buffer_pool_debug=OFF;
+SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null';
+
+--disable_warnings
+SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576;
+--enable_warnings
+
+let $wait_timeout = 60;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+
+--source include/wait_condition.inc
+# Restart the server, because the buffer pool would not necessarily be
+# shrunk afterwards even if we request it.
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
index dad08645085..67f2f2dde40 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
@@ -62,3 +62,31 @@ SELECT * FROM t2;
CHECK TABLE t2;
DROP TABLE t1, t2;
+
+# MDEV-21572 buf_page_get_gen() should apply buffered page
+# initialized redo log during recovery
+--source ../include/no_checkpoint_start.inc
+CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+connect (con1,localhost,root,,);
+BEGIN;
+DELETE FROM t1 WHERE pk=1;
+connection default;
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+DELETE FROM t1 WHERE pk=3;
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
+--source ../include/no_checkpoint_end.inc
+disconnect con1;
+
+--echo # Corrupt the pages
+perl;
+my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
+open(FILE, "+<$file") || die "Unable to open $file";
+binmode FILE;
+seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek";
+print FILE "junk";
+close FILE or die "close";
+EOF
+--source include/start_mysqld.inc
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test
index 58a71d11a6a..53fbe8d00dc 100644
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@ -250,3 +250,22 @@ show create table t2;
drop table t1,t2;
--error ER_BAD_TABLE_ERROR
drop table t1,t2;
+
+--echo #
+--echo # MDEV-23470 InnoDB: Failing assertion: cmp < 0 in
+--echo # row_ins_check_foreign_constraint
+--echo #
+CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL)ENGINE=InnoDB;
+CREATE TABLE t2(f1 VARCHAR(100), f2 INT NOT NULL,
+ INDEX(f2))ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES(99, 2);
+ALTER TABLE t2 ADD FOREIGN KEY(f2) REFERENCES t1(f1);
+
+SET FOREIGN_KEY_CHECKS=0;
+DROP INDEX f2 ON t2;
+SET FOREIGN_KEY_CHECKS=1;
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES('G', 3);
+DROP TABLE t2, t1;
+SET FOREIGN_KEY_CHECKS=DEFAULT;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 06cab983656..380d4520d87 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -136,7 +136,6 @@ CREATE TABLE store (
UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB;
-SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
@@ -195,6 +194,7 @@ reap;
connection con1;
ROLLBACK;
connection default;
+disconnect con1;
DROP TABLE t3,t1;
@@ -257,6 +257,209 @@ ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t2 (f);
ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1);
DROP TABLE t1, t2;
+# MDEV-19092 Server crash when renaming the column when
+# FOREIGN_KEY_CHECKS is disabled
+CREATE TABLE t1 (a INT, b INT, KEY idx(a)) ENGINE=InnoDB;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x);
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 CHANGE a c INT;
+# Cleanup
+DROP TABLE t1;
+
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
+ALTER TABLE t1 ADD COLUMN f INT;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (f1);
+SET FOREIGN_KEY_CHECKS= ON;
+ALTER TABLE t1 DROP f3;
+ALTER TABLE t1 CHANGE f f3 INT;
+# Cleanup
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS=1;
+
+--echo #
+--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
+--echo # ADD FOREIGN KEY
+--echo #
+
+CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
+PRIMARY KEY (`department_id`)) engine=innodb;
+
+CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
+`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
+
+CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
+
+ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
+`people` (`people_id`);
+
+ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
+(`people_id`);
+
+ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
+(`people_id`);
+
+drop table title, department, people;
+
+#
+# FK and prelocking:
+# child table accesses (reads and writes) wait for locks.
+#
+create table t1 (a int primary key, b int) engine=innodb;
+create table t2 (c int primary key, d int,
+ foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+connect (con1,localhost,root);
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where a=2;
+send update t1 set a=10 where a=1;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+reap;
+connection default;
+lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+connection con1;
+send delete from t1 where a=2;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+--error ER_ROW_IS_REFERENCED_2
+reap;
+connection default;
+unlock tables;
+disconnect con1;
+
+# but privileges should not be checked
+create user foo;
+grant select,update on test.t1 to foo;
+connect(foo,localhost,foo);
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+drop table t2, t1;
+drop user foo;
+
+--echo #
+--echo # MDEV-17595 - Server crashes in copy_data_between_tables or
+--echo # Assertion `thd->transaction.stmt.is_empty() ||
+--echo # (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
+--echo # fails in close_tables_for_reopen upon concurrent
+--echo # ALTER TABLE and FLUSH
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
+DROP TABLE t2, t1;
+
+#
+# MDEV-22180 Planner opens unnecessary tables when updated table is referenced by foreign keys
+#
+
+create table t1 (pk int primary key, data int) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+create table t2 (t1_pk int, foreign key (t1_pk) references t1 (pk)) engine=innodb;
+insert t2 values (1),(2);
+error ER_NO_REFERENCED_ROW_2;
+insert t2 values (10);
+flush tables;
+flush status;
+# with ON UPDATE RESTRICT child tables are not opened
+update t1 set data=10 where pk+1>10;
+show status like '%opened_tab%';
+flush tables;
+flush status;
+# neither are parent tables
+update t2 set t1_pk=11 where t1_pk+1>10;
+show status like '%opened_tab%';
+# under LOCK TABLES
+flush tables;
+flush status;
+lock tables t1 write;
+show status like '%opened_tab%';
+insert t1 values (4,4);
+show status like '%opened_tab%';
+unlock tables;
+delimiter |;
+create function foo() returns int
+begin
+ insert t1 values (5,5);
+ return 5;
+end|
+delimiter ;|
+flush tables;
+flush status;
+select foo();
+show status like '%opened_tab%';
+drop function foo;
+drop table t2, t1;
+
+CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
+XA START 'xid';
+INSERT INTO t1 VALUES (1,2);
+--error ER_XAER_RMFAIL
+CREATE TABLE x AS SELECT * FROM t1;
+--connect (con1,localhost,root,,test)
+SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanup
+--disconnect con1
+--connection default
+XA END 'xid';
+XA ROLLBACK 'xid';
+DROP TABLE t1;
+
+CREATE TABLE t1 (pk INT PRIMARY KEY,
+ f1 VARCHAR(10), f2 VARCHAR(10),
+ f3 VARCHAR(10), f4 VARCHAR(10),
+ f5 VARCHAR(10), f6 VARCHAR(10),
+ f7 VARCHAR(10), f8 VARCHAR(10),
+ INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
+ INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+ 'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+ (2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+ 'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+ (3, 'innodb', 'innodb', 'innodb', 'innodb',
+ 'innodb', 'innodb', 'innodb', 'innodb');
+ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
+START TRANSACTION;
+DELETE FROM t1 where f1='mariadb';
+SELECT * FROM t1;
+ROLLBACK;
+
+ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
+
+START TRANSACTION;
+DELETE FROM t1 where f3='mariadb';
+SELECT * FROM t1;
+ROLLBACK;
+
+ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
+--error ER_ROW_IS_REFERENCED_2
+UPDATE t1 SET f6='update';
+
+ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
+--error ER_ROW_IS_REFERENCED_2
+UPDATE t1 SET f6='cascade';
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
+
--echo # Start of 10.2 tests
--echo #
@@ -302,6 +505,7 @@ INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
BEGIN;
UPDATE users SET name = 'qux' WHERE id = 1;
+connect (con1,localhost,root);
--connection con1
SET innodb_lock_wait_timeout= 1;
DELETE FROM matchmaking_groups WHERE id = 10;
@@ -496,6 +700,88 @@ CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+--echo #
+--echo # MDEV-17187 table doesn't exist in engine after ALTER other tables
+--echo # with CONSTRAINTs
+--echo #
+
+call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
+
+set foreign_key_checks=on;
+create table t1 (id int not null primary key) engine=innodb;
+create table t2 (id int not null primary key, fid int not null,
+CONSTRAINT fk_fid FOREIGN KEY (fid) REFERENCES t1 (id))engine=innodb;
+
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 2);
+
+set foreign_key_checks=off;
+alter table t2 drop index fk_fid;
+set foreign_key_checks=on;
+
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where id=2;
+--error ER_NO_REFERENCED_ROW_2
+insert into t2 values(4, 99);
+
+select * from t1;
+select * from t2;
+
+set foreign_key_checks=off;
+delete from t1 where id=2;
+insert into t2 values(4, 99);
+set foreign_key_checks=on;
+
+select * from t1;
+select * from t2;
+
+show create table t1;
+show create table t2;
+
+# Optional: test DROP TABLE without any prior ha_innobase::open().
+# This was tested manually, but it would cause --embedded to skip the test,
+# and the restart would significantly increase the running time.
+# --source include/restart_mysqld.inc
+
+--error ER_ROW_IS_REFERENCED_2
+drop table t1,t2;
+--error ER_BAD_TABLE_ERROR
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-22934 Table disappear after two alter table command
+--echo #
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
+ f2 INT NOT NULL,
+ PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB;
+CREATE TABLE t2(f1 INT NOT NULL,
+ f2 INT NOT NULL, f3 INT NOT NULL,
+ PRIMARY KEY(f1, f2), UNIQUE KEY(f2),
+CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE,
+CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS=0;
+ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE;
+ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY;
+SHOW CREATE TABLE t2;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB;
+DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-23685 SIGSEGV on ADD FOREIGN KEY after failed attempt
+--echo # to create unique key on virtual column
+--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT AS (a)) ENGINE=InnODB;
+
+INSERT INTO t1 (pk,a) VALUES (1,10),(2,10);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX ind9 (b), LOCK=SHARED;
+SET FOREIGN_KEY_CHECKS= 0;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (pk);
+DROP TABLE t1;
+
--echo # End of 10.2 tests
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/foreign_key_debug.test b/mysql-test/suite/innodb/t/foreign_key_debug.test
new file mode 100644
index 00000000000..75d05801b5f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/foreign_key_debug.test
@@ -0,0 +1,78 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--enable_connect_log
+
+#
+# MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
+#
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f2 int primary key) engine=innodb;
+create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t2 values (1),(2),(3),(4),(5);
+insert into t3 values (1),(2),(3),(4),(5);
+connect con1,localhost,root;
+set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+connection default;
+let $conn=`select connection_id()`;
+set debug_sync='before_execute_sql_command wait_for g1';
+send update t1 set f1 = f1 + 100000 limit 2;
+connect con2,localhost,root;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
+source include/wait_condition.inc;
+--replace_result $conn UPDATE
+eval kill query $conn;
+disconnect con2;
+connection default;
+error ER_QUERY_INTERRUPTED;
+reap;
+set debug_sync='now signal g2';
+connection con1;
+reap;
+show create table t2;
+disconnect con1;
+connection default;
+select * from t2 where f2 not in (select f1 from t1);
+select * from t3 where f3 not in (select f2 from t2);
+drop table t3;
+drop table t2;
+drop table t1;
+set debug_sync='reset';
+
+--echo #
+--echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+--echo #
+CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+FLUSH TABLES;
+
+SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+
+connect con1, localhost, root;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1; # change to 0 in 10.3
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t2 SET pk=10 WHERE pk=1;
+PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+DEALLOCATE PREPARE stmt;
+FLUSH TABLE t2;
+SET debug_sync='now SIGNAL go';
+
+connection default;
+reap;
+
+# Cleanup
+disconnect con1;
+
+connection default;
+SET debug_sync='reset';
+SHOW OPEN TABLES FROM test;
+DROP TABLE t1, t2;
+
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test
index da6d91f351e..178b32d54c9 100644
--- a/mysql-test/suite/innodb/t/innodb-32k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test
@@ -5,8 +5,6 @@
let $MYSQLD_DATADIR= `select @@datadir`;
-call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is");
-
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test
index cbec1a452c7..93f6f79edf3 100644
--- a/mysql-test/suite/innodb/t/innodb-64k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test
@@ -5,8 +5,6 @@
let $MYSQLD_DATADIR= `select @@datadir`;
-call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is");
-
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/t/innodb-64k.test b/mysql-test/suite/innodb/t/innodb-64k.test
index b091eee6d57..62d7b929ba1 100644
--- a/mysql-test/suite/innodb/t/innodb-64k.test
+++ b/mysql-test/suite/innodb/t/innodb-64k.test
@@ -2,6 +2,7 @@
# Tests for setting innodb-page-size=64k;
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
+--source include/have_sequence.inc
call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
@@ -638,3 +639,11 @@ COMMIT;
drop table t2;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-19526 heap number overflow
+--echo #
+CREATE TABLE t1(a SMALLINT NOT NULL UNIQUE AUTO_INCREMENT, KEY(a))
+ENGINE=InnoDB;
+INSERT INTO t1 (a) SELECT seq FROM seq_1_to_8191;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index 9bfc1262a1b..aae3f3960a2 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -646,6 +646,28 @@ ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18042 Server crashes in mysql_alter_table upon adding a non-null
+--echo # date column under NO_ZERO_DATE with ALGORITHM=INPLACE
+--echo #
+
+SET @OLD_SQL_MODE= @@SQL_MODE;
+SET @@SQL_MODE= 'NO_ZERO_DATE';
+CREATE OR REPLACE TABLE t1 (i INT) ENGINE=MyISAM;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+ALTER TABLE t1 ADD COLUMN d DATE NOT NULL, ALGORITHM=INPLACE;
+
+CREATE OR REPLACE TABLE t1 (i INT) ENGINE=InnoDB;
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t1 ADD d DATETIME NOT NULL CHECK (f <= 0), ALGORITHM=COPY;
+
+CREATE OR REPLACE TABLE t1 (a int) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
+
+--echo # Cleanup
+SET @@SQL_MODE= @OLD_SQL_MODE;
+DROP TABLE t1;
+
#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test
index fbf0641880b..301966fb41d 100644
--- a/mysql-test/suite/innodb/t/innodb-blob.test
+++ b/mysql-test/suite/innodb/t/innodb-blob.test
@@ -206,3 +206,10 @@ SELECT a FROM t3;
SELECT * FROM t2;
DROP TABLE t1,t2,t3;
+
+CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT)ENGINE=InnoDB
+ ROW_FORMAT=REDUNDANT;
+SET @fill_amount = (@@innodb_page_size / 2 ) + 1 ;
+INSERT INTO t1 VALUES(1, REPEAT(2, @fill_amount));
+UPDATE t1 SET f1 = 2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-corrupted-table.test b/mysql-test/suite/innodb/t/innodb-corrupted-table.test
index a7f4ad4afd4..a81235a9dd4 100644
--- a/mysql-test/suite/innodb/t/innodb-corrupted-table.test
+++ b/mysql-test/suite/innodb/t/innodb-corrupted-table.test
@@ -24,7 +24,7 @@ alter table t1 add primary key (pk);
--echo # Stop the server, replace the frm with the old one and restart the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
--remove_file $datadir/test/t1.frm
diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7513.test b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
index 88f941ef70d..b929ea14781 100644
--- a/mysql-test/suite/innodb/t/innodb-mdev-7513.test
+++ b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
@@ -3,7 +3,6 @@
# MDEV-7513: ib_warn_row_too_big dereferences null thd
-call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
call mtr.add_suppression("Row size too large (> 8126)*");
--disable_warnings
diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test
index 7e710ae154c..823712a01f1 100644
--- a/mysql-test/suite/innodb/t/innodb-replace-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test
@@ -9,8 +9,8 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @old_dbug= @@session.debug_dbug;
-set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
+SET debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
drop table t1;
-set debug_dbug = @old_dbug;
+SET debug_dbug = @old_dbug;
diff --git a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test
index e480f0caf07..d5d04190b8a 100644
--- a/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test
+++ b/mysql-test/suite/innodb/t/innodb-stats-initialize-failure.test
@@ -6,6 +6,7 @@
call mtr.add_suppression("InnoDB: Warning: Index.*");
# This caused crash earlier
+SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,ib_ha_innodb_stat_not_initialized';
create table t1(a int not null primary key, b int, c int, key(b), key(c)) engine=innodb;
@@ -32,8 +33,8 @@ select count(1) from t1 where a between 5 and 100;
select count(1) from t1 where b between 5 and 256;
select count(1) from t1 where c between 7 and 787;
-set DEBUG_DBUG=NULL;
+
drop procedure innodb_insert_proc;
drop table t1;
-
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index b443c92aff9..b2809aa0669 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -15,6 +15,7 @@
--source include/have_innodb.inc
--source include/default_charset.inc
+--source include/have_sequence.inc
call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation.");
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
@@ -29,16 +30,11 @@ call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
FLUSH TABLES;
let MYSQLD_DATADIR =`SELECT @@datadir`;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
let $strerrfix=/ (\(.+\))//;
-
SET GLOBAL innodb_file_per_table = 1;
-CREATE DATABASE test_wl5522;
-
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
-INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
+CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1),(2),(3);
--let $_server_id= `SELECT @@server_id`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
@@ -46,574 +42,574 @@ INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
--exec echo wait > $_expect_file_name
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
--error 2013
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--source include/start_mysqld.inc
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB;
-INSERT INTO test_wl5522.t1 VALUES(1),(2),(3);
+CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES(1),(2),(3);
--exec echo wait > $_expect_file_name
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
--error 2013
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--source include/start_mysqld.inc
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 1;
# Create the table that we will use for crash recovery (during IMPORT)
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1), (2), (3), (4);
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLESPACE_DISCARDED
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
--exec echo wait > $_expect_file_name
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
--error 2013
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
--source include/start_mysqld.inc
# Check that the DD is consistent after recovery
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
--exec echo wait > $_expect_file_name
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
--error 2013
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
# After the above test the results are non-deterministic,
# delete the old tablespace files and drop the table,
# recreate the table and do a proper import.
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
--source include/start_mysqld.inc
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
+SET @file_per_table= @@innodb_file_per_table;
SET GLOBAL innodb_file_per_table = 1;
-SELECT @@innodb_file_per_table;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
-INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
+INSERT INTO t1 VALUES(400), (500), (600);
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test IO Write error(s), flush tables doesn't return an error message
# so we have to make do with the error/warning pushed by the server
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_export_io_write_failure_1";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_2";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_3";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_4";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_5";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_6";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_7";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_8";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_9";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_10";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_11";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
SET SESSION debug_dbug="+d,ib_export_io_write_failure_12";
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Create a table and save the tablespace and .cfg file
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (100), (200), (300);
-SELECT COUNT(*) FROM test_wl5522.t1;
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (100), (200), (300);
+SELECT COUNT(*) FROM t1;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test IO Read error(s)
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_1";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_2";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_3";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_4";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_5";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_6";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_7";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_8";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_io_read_error_9";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test string read failure
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_string_read_error";
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_cfg_files("test_wl5522", "t1");
+ib_restore_cfg_files("test", "t1");
EOF
--replace_regex $strerrfix
--error ER_IO_READ_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test OOM error during import
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_1";
@@ -621,31 +617,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_1";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_2";
@@ -653,31 +649,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_2";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_4";
@@ -685,31 +681,31 @@ SET SESSION debug_dbug="+d,ib_import_OOM_4";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_5";
@@ -717,30 +713,30 @@ SET SESSION debug_dbug="+d,ib_import_OOM_5";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_6";
@@ -748,29 +744,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_6";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_7";
@@ -778,29 +774,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_7";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_8";
@@ -808,29 +804,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_8";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_9";
@@ -838,29 +834,29 @@ SET SESSION debug_dbug="+d,ib_import_OOM_9";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
-INSERT INTO test_wl5522.t1 VALUES (1);
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_OOM_10";
@@ -868,30 +864,30 @@ SET SESSION debug_dbug="+d,ib_import_OOM_10";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
####
# Test handling of internal failure error
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
@@ -900,33 +896,33 @@ SET SESSION debug_dbug="+d,ib_import_internal_error";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test failure after reset of space id and LSN in the tablespace
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
@@ -935,12 +931,12 @@ SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug=@saved_debug_dbug;
@@ -948,17 +944,16 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Test failure after attempting a tablespace open
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
---replace_regex /file: '.*t1.ibd'/'t1.ibd'/
-
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after ibuf check
@@ -966,73 +961,73 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
# Need proper mapping of error codes :-(
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after adjusting the cluster index root page
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after importing the secondary index(es)
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "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;
+ALTER TABLE 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");
+ib_unlink_tablespace("test", "t1");
EOF
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
--disable_query_log
# Enable metrics for the counters we are going to use
@@ -1046,7 +1041,7 @@ set global innodb_monitor_enable = ibuf_merges_insert;
# Create a large table with delete marked records, disable purge during
# the update so that we can test the IMPORT purge code.
#
-CREATE TABLE test_wl5522.t1 (
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -1066,53 +1061,45 @@ SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
-INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
- (1, REPEAT('a', 2048), REPEAT('a', 2048)),
- (2, REPEAT('b', 2048), REPEAT('b', 2048)),
- (3, REPEAT('c', 2048), REPEAT('c', 2048)),
- (4, REPEAT('d', 2048), REPEAT('d', 2048));
-
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-
-DELETE FROM test_wl5522.t1 WHERE c2 = 1;
-
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
-UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
-
-SHOW CREATE TABLE test_wl5522.t1;
-
-SELECT c1, c2 FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-SELECT SUM(c2) FROM test_wl5522.t1;
+INSERT INTO t1
+SELECT 1 + seq, 1 + (seq MOD 4),
+ REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048),
+ REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048)
+FROM seq_0_to_127;
+
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c3 = REPEAT("c2", 1024);
+UPDATE t1 SET c4 = REPEAT("c4", 1024);
+
+SHOW CREATE TABLE t1;
+
+SELECT c1, c2 FROM t1;
+SELECT COUNT(*) FROM t1;
+SELECT SUM(c2) FROM t1;
SELECT name
FROM information_schema.innodb_metrics
WHERE name = 'ibuf_merges_insert' AND count = 0;
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
@@ -1133,9 +1120,9 @@ COMMIT;
disconnect purge_control;
connection default;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -1144,65 +1131,59 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB;
-SELECT c1, c2 FROM test_wl5522.t1;
+SELECT c1, c2 FROM t1;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
-SELECT c1,c2 FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-SELECT SUM(c2) FROM test_wl5522.t1;
+SELECT c1,c2 FROM t1;
+SELECT COUNT(*) FROM t1;
+SELECT SUM(c2) FROM t1;
-SHOW CREATE TABLE test_wl5522.t1;
+SHOW CREATE TABLE t1;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
####
# Create a table and save the tablespace and .cfg file, we need to create
# a Btree that has several levels
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-INSERT IGNORE INTO test_wl5522.t1 VALUES
+INSERT IGNORE INTO t1 VALUES
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+INSERT INTO t1
+SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200)
+FROM seq_1_to_256;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
@@ -1210,30 +1191,30 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
@@ -1241,172 +1222,166 @@ SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
---replace_regex $pathfix
-
--error ER_INNODB_INDEX_CORRUPT
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
---replace_regex $pathfix
-
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
-ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
+ALTER TABLE t1 ADD INDEX idx(c1);
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,fil_space_create_failure";
---replace_regex $pathfix
-
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
---replace_regex $pathfix
-
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
@@ -1414,20 +1389,17 @@ SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-
-DROP DATABASE test_wl5522;
-
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
@@ -1451,12 +1423,10 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl
call mtr.add_suppression(".*There was an error writing to the meta data file.*");
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
call mtr.add_suppression("Unsupported tablespace format");
-call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\"");
call mtr.add_suppression("Page is marked as free");
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted");
call mtr.add_suppression("but tablespace with that id or name does not exist");
-call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache");
-call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'");
+call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'");
call mtr.add_suppression("while reading index meta-data, expected to read 44 bytes but read only 0 bytes");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
--enable_query_log
@@ -1465,4 +1435,4 @@ call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
+SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test
index 0f5910245ed..906246ebf07 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522.test
@@ -2,8 +2,9 @@
--source include/not_embedded.inc
-- source include/have_innodb.inc
+-- source include/have_sequence.inc
-call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
+call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
FLUSH TABLES;
@@ -17,17 +18,14 @@ CREATE TABLE t1
KEY (b))
ENGINE = InnoDB;
-insert into t1 (b, c) values ('Apa', 'Filler........'),
+CREATE TEMPORARY TABLE t (b char(22),c varchar(255));
+INSERT INTO t VALUES
+('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
+INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128;
+DROP TEMPORARY TABLE t;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
@@ -107,16 +105,11 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -158,15 +151,10 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -177,9 +165,6 @@ UNLOCK TABLES;
--list_files $MYSQLD_DATADIR/test
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
CREATE TABLE t1(
@@ -212,14 +197,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -228,9 +208,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
CREATE TABLE t1(
@@ -263,14 +240,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -278,9 +250,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
CREATE TABLE t1(
@@ -330,14 +299,7 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
-SELECT COUNT(*) FROM t1;
-
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
# This should fail, InnoDB should return a warning
@@ -357,15 +319,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -492,15 +448,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -645,15 +595,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -799,15 +743,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -953,15 +891,9 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -1126,9 +1058,8 @@ SELECT * FROM t1;
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
-call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
+call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
-FLUSH TABLES;
# cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
index 661d7dff129..7aa146d7d99 100644
--- a/mysql-test/suite/innodb/t/innodb.test
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -1662,7 +1662,6 @@ drop table t1;
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
create table t1(a varchar(10) primary key) engine = innodb;
--- error 1025,1025
alter table t1 modify column a int;
set foreign_key_checks=1;
drop table t2,t1;
@@ -1678,6 +1677,7 @@ drop table t2,t1;
# test that RENAME does not allow invalid charsets when f_k_c is 0
+call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition.");
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt
new file mode 100644
index 00000000000..948d874d23d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.opt
@@ -0,0 +1,3 @@
+--innodb-buffer-pool-size=64M
+--skip-innodb-buffer-pool-load-at-startup
+--skip-innodb-buffer-pool-dump-at-shutdown
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test
new file mode 100644
index 00000000000..baced6e9e11
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test
@@ -0,0 +1,190 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+#
+# Test for the functionality of InnoDB Buffer Pool dump/load.
+#
+
+# This case checks buffer pool dump/load works as expected
+# with innodb_buffer_pool_dump_now=ON
+# and innodb_buffer_pool_load_now=ON
+
+--source include/have_innodb.inc
+# include/restart_mysqld.inc does not work in embedded mode
+--source include/not_embedded.inc
+--source include/have_sequence.inc
+
+--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
+
+--error 0,1
+--remove_file $file
+
+# Dump the whole buffer pool because if only a portion of it is dumped, we
+# cannot be sure how many of the ib_bp_test's pages will end up in the dump.
+SET GLOBAL innodb_buffer_pool_dump_pct=100;
+
+# Create a table and populate it with some data
+CREATE TABLE ib_bp_test
+(a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128)))
+ENGINE=INNODB;
+
+SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+
+SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3;
+
+let SPACE=`SELECT @space`;
+
+INSERT INTO ib_bp_test
+SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382;
+
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+
+# Dump
+SET GLOBAL innodb_buffer_pool_dump_now = ON;
+
+# Wait for the dump to complete
+--disable_warnings
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
+--enable_warnings
+--source include/wait_condition.inc
+
+# Confirm the file has been created
+--file_exists $file
+
+# Add some garbage records to the dump file
+--let IBDUMPFILE = $file
+perl;
+my $fn = $ENV{'IBDUMPFILE'};
+open(my $fh, '>>', $fn) || die "perl open($fn): $!";
+print $fh "123456,0\n";
+print $fh "0,123456\n";
+print $fh "123456,123456\n";
+close($fh);
+EOF
+
+--move_file $file $file.now
+
+# Complete purge (and change buffer merge).
+SET GLOBAL innodb_fast_shutdown=0;
+--source include/shutdown_mysqld.inc
+
+# Make sure no dump after shutdown
+--error 1
+--file_exists $file
+
+--source include/start_mysqld.inc
+
+--move_file $file.now $file
+
+# See that we have no pages in the LRU
+SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+
+# Load the table so that entries in the I_S table do not appear as NULL
+select count(*) from ib_bp_test LIMIT 0;
+
+# Load
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+
+# Wait for the load to complete
+--disable_warnings
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+--source include/wait_condition.inc
+
+# Show the status, interesting if the above timed out
+--disable_warnings
+--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
+SELECT variable_value
+FROM information_schema.global_status
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+
+SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru
+WHERE table_name = '`test`.`ib_bp_test`';
+
+# Add some total garbage to the dump file
+--let IBDUMPFILE = $file
+perl;
+my $fn = $ENV{'IBDUMPFILE'};
+open(my $fh, '>>', $fn) || die "perl open($fn): $!";
+print $fh "abcdefg\n";
+close($fh);
+EOF
+
+call mtr.add_suppression("InnoDB: Error parsing");
+
+# Load
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+
+# Wait for the load to fail
+--disable_warnings
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 13) = 'Error parsing'
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+--source include/wait_condition.inc
+
+--echo # Re-write some valid pages to the dump file, make sure the space
+--echo # should be valid but all the page no should be out of bound of the file
+--let IBDUMPFILE = $file
+perl;
+my $fn = $ENV{'IBDUMPFILE'};
+my $space = $ENV{'SPACE'};
+open(my $fh, '>', $fn) || die "perl open($fn): $!";
+print $fh "$space,10000\n";
+print $fh "$space,10001\n";
+print $fh "$space,10002\n";
+close($fh);
+EOF
+
+# We force the restart so that the table would be closed
+--source include/restart_mysqld.inc
+
+# Load directly, without accessing the table first
+SET GLOBAL innodb_buffer_pool_load_now = ON;
+
+# Wait for the load to complete
+--disable_warnings
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
+ FROM information_schema.global_status
+ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+--source include/wait_condition.inc
+
+# Show the status, interesting if the above timed out
+--disable_warnings
+--replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
+SELECT variable_value
+FROM information_schema.global_status
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
+--enable_warnings
+
+DROP TABLE ib_bp_test;
+SET GLOBAL innodb_buffer_pool_dump_pct=default;
+
+--echo #
+--echo # Bug#21371070 [ERROR] INNODB: CANNOT ALLOCATE 0 BYTES: SUCCESS
+--echo #
+
+--let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
+
+# Remove the buffer pool file that exists already
+--error 0,1
+--remove_file $file
+
+# Create an empty buffer pool file
+write_file $file;
+EOF
+
+SET GLOBAL innodb_buffer_pool_load_now = ON;
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt
new file mode 100644
index 00000000000..dca040ea893
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt
@@ -0,0 +1 @@
+--innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M
diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test
new file mode 100644
index 00000000000..d1e17c7622a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.test
@@ -0,0 +1,241 @@
+#
+# WL6117 : Resize the InnoDB Buffer Pool Online
+# (concurrent sql; allocation fail;)
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+--disable_query_log
+set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
+set @old_innodb_file_per_table = @@innodb_file_per_table;
+set @old_innodb_thread_concurrency = @@innodb_thread_concurrency;
+set @old_innodb_thread_sleep_delay = @@innodb_thread_sleep_delay;
+set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
+set global innodb_disable_resize_buffer_pool_debug = OFF;
+--enable_query_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+let $wait_timeout = 180;
+
+set global innodb_file_per_table=ON;
+set global innodb_thread_concurrency=20;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connect (con3,localhost,root,,);
+connect (con4,localhost,root,,);
+connect (con5,localhost,root,,);
+connect (con6,localhost,root,,);
+connect (con7,localhost,root,,);
+connect (con8,localhost,root,,);
+
+create table t2 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t2 (c1, c2) values (1, 1);
+
+create table t3 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t3 (c1, c2) values (1, 1);
+
+create table t4 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t4 (c1, c2) values (1, 1);
+
+create table t5 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t5 (c1, c2) values (1, 1);
+
+create table t6 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t6 (c1, c2) values (1, 1);
+
+create database test2;
+create table test2.t7 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into test2.t7 (c1, c2) values (1, 1);
+drop table test2.t7;
+
+connection con1;
+set @save_dbug=@@global.debug_dbug;
+set global debug_dbug="+d,ib_buf_pool_resize_wait_before_resize";
+set global innodb_buffer_pool_size = 12*1024*1024;
+
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 30) = 'Latching whole of buffer pool.'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+# trying to update innodb_buffer_pool_size
+--error ER_WRONG_ARGUMENTS
+set global innodb_buffer_pool_size = 8*1024*1024;
+select @@global.innodb_buffer_pool_size;
+
+# trying to control adaptive hash index
+select @@global.innodb_adaptive_hash_index;
+set global innodb_adaptive_hash_index = ON;
+select @@global.innodb_adaptive_hash_index;
+set global innodb_adaptive_hash_index = OFF;
+select @@global.innodb_adaptive_hash_index;
+
+# - create table
+--send create table t1 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB
+
+connection con2;
+# - analyze table
+--send analyze table t2
+
+connection con3;
+# - alter table ... algorithm=inplace
+--send alter table t3 algorithm=inplace, add index idx (c1)
+
+connection con4;
+# - alter table ... rename to
+--send alter table t4 rename to t0
+
+connection con5;
+# - drop table
+--send drop table t5
+
+connection con6;
+# - alter table ... discard tablespace
+--send alter table t6 discard tablespace
+
+connection con7;
+# - drop database
+--send drop database test2
+
+connection con8;
+# information schema INNODB_BUFFER_PAGE
+--send select count(*) > 0 from information_schema.innodb_buffer_page
+
+connection default;
+set global debug_dbug=@save_dbug;
+
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+connection con1;
+--reap
+
+connection con2;
+--reap
+
+connection con3;
+--reap
+
+connection con4;
+--reap
+
+connection con5;
+--reap
+
+connection con6;
+--reap
+
+connection con7;
+--reap
+
+connection con8;
+--reap
+
+connection default;
+
+disconnect con3;
+disconnect con4;
+disconnect con5;
+disconnect con6;
+disconnect con7;
+disconnect con8;
+disconnect con1;
+disconnect con2;
+
+# fails to allocate new chunks
+call mtr.add_suppression("\\[ERROR\\] InnoDB: buffer pool 0 : failed to allocate new memory.");
+connection default;
+set global debug_dbug="+d,ib_buf_chunk_init_fails";
+set global innodb_buffer_pool_size = 16*1024*1024;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+set global debug_dbug=@save_dbug;
+
+# can be used as usual, even if failed to allocate
+create table t8 (c1 int not null primary key, c2 int not null default 0) engine=InnoDB;
+insert into t8 (c1, c2) values (1, 1);
+drop table t8;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t0;
+drop table t6;
+
+--disable_query_log
+set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
+set global innodb_file_per_table = @old_innodb_file_per_table;
+set global innodb_thread_concurrency = @old_innodb_thread_concurrency;
+set global innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
+set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
+--enable_query_log
+
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at '
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+# Wait till all disconnects are completed]
+--source include/wait_until_count_sessions.inc
+
+--echo #
+--echo # BUG#23590280 NO WARNING WHEN REDUCING INNODB_BUFFER_POOL_SIZE INSIZE THE FIRST CHUNK
+--echo #
+
+SET @save_disable = @@GLOBAL.innodb_disable_background_merge;
+SET GLOBAL innodb_disable_background_merge = ON;
+
+set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
+set global innodb_disable_resize_buffer_pool_debug = OFF;
+set @before_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
+
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+
+let $wait_timeout = 60;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change'
+ FROM information_schema.global_status
+ WHERE VARIABLE_NAME = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size * 2;
+
+let $wait_timeout = 60;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 9) = 'Completed'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+
+let $wait_timeout = 60;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 9) = 'Completed'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+set global innodb_buffer_pool_size=@before_innodb_buffer_pool_size;
+
+let $wait_timeout = 60;
+let $wait_condition =
+ SELECT SUBSTR(variable_value, 1, 19) = 'Size did not change'
+ FROM information_schema.global_status
+ WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS';
+--source include/wait_condition.inc
+
+SET GLOBAL innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
+SET GLOBAL innodb_disable_background_merge = @save_disable;
diff --git a/mysql-test/suite/innodb/t/innodb_bug11754376.test b/mysql-test/suite/innodb/t/innodb_bug11754376.test
index a7f35c1a960..64547d409b3 100644
--- a/mysql-test/suite/innodb/t/innodb_bug11754376.test
+++ b/mysql-test/suite/innodb/t/innodb_bug11754376.test
@@ -8,7 +8,8 @@
CREATE TABLE bug11754376 (c INT) ENGINE=INNODB;
# This will invoke test_normalize_table_name_low() in debug builds
-
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION DEBUG_DBUG='+d,test_normalize_table_name_low';
DROP TABLE bug11754376;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/t/innodb_bug30113362.opt b/mysql-test/suite/innodb/t/innodb_bug30113362.opt
new file mode 100644
index 00000000000..99bf0e5a28b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug30113362.opt
@@ -0,0 +1 @@
+--innodb-sys-tablestats
diff --git a/mysql-test/suite/innodb/t/innodb_bug30113362.test b/mysql-test/suite/innodb/t/innodb_bug30113362.test
new file mode 100644
index 00000000000..2291574f9ec
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug30113362.test
@@ -0,0 +1,242 @@
+#
+# Test for Bug#30113362 : BTR_CUR_WILL_MODIFY_TREE() IS INSUFFICIENT FOR HIGHER TREE LEVEL
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_innodb_16k.inc
+
+--disable_query_log
+SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
+SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index;
+SET @old_innodb_stats_persistent = @@innodb_stats_persistent;
+--enable_query_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+SET GLOBAL innodb_adaptive_hash_index = false;
+SET GLOBAL innodb_stats_persistent = false;
+
+connect (purge_control,localhost,root,,);
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+--connect (con2,localhost,root,,)
+
+CREATE TABLE t1 (
+ a00 CHAR(255) NOT NULL DEFAULT 'a',
+ a01 CHAR(255) NOT NULL DEFAULT 'a',
+ a02 CHAR(255) NOT NULL DEFAULT 'a',
+ b INT NOT NULL DEFAULT 0,
+ CONSTRAINT pkey PRIMARY KEY(a00, a01, a02)
+) charset latin1 ENGINE = InnoDB COMMENT='MERGE_THRESHOLD=45';
+
+#
+# Prepare primary key index tree to be used for this test.
+#
+
+SET GLOBAL innodb_limit_optimistic_insert_debug = 3;
+
+delimiter |;
+CREATE PROCEDURE data_load_t1()
+BEGIN
+ DECLARE c1 INT DEFAULT 97;
+ DECLARE c2 INT DEFAULT 97;
+ DECLARE c3 INT DEFAULT 97;
+
+ WHILE c1 < 102 DO
+ WHILE c2 < 123 DO
+ WHILE c3 < 123 DO
+ INSERT INTO t1 (a00) VALUES (CHAR(c1,c2,c3));
+ SET c3 = c3 + 1;
+ END WHILE;
+ SET c3 = 97;
+ SET c2 = c2 + 1;
+ END WHILE;
+ SET c2 = 97;
+ SET c1 = c1 + 1;
+ END WHILE;
+END |
+delimiter ;|
+call data_load_t1();
+DROP PROCEDURE data_load_t1;
+
+# all node pages are sparse (max 3 node_ptrs)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+connection con2;
+DELETE FROM t1 WHERE a00 = 'cnm';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'cnm';
+# causes "domino falling" merges to upper level
+connection purge_control;
+COMMIT;
+connection con2;
+SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
+ROLLBACK;
+
+# at this moment, in the tree,
+# ...
+# level 4: ...(ast,avw,ayz)(bcc,bff,bii,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)...
+# ...
+
+--echo # Test start
+
+# (1) Similar case to the first reported corefile at bug#30113362
+# - Deleting 'bii' causes "domino falling" merges and the node_ptr becomes left_most of level 4.
+# So, the operation needs upper level pages' X-latch, though doesn't cause merge more.
+
+connection purge_control;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection con2;
+DELETE FROM t1 WHERE a00 = 'bii';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'bii';
+SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
+SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume';
+send ROLLBACK;
+
+connection purge_control;
+SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
+COMMIT;
+SET DEBUG_SYNC = 'now SIGNAL roll2';
+
+connect (con1,localhost,root,,);
+# FIXME: This occasionally times out!
+--disable_warnings
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+--enable_warnings
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+send SELECT a00 FROM t1 WHERE a00 = 'bii';
+
+connection default;
+# FIXME: This occasionally times out!
+--disable_warnings
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+--enable_warnings
+# bug#30113362 caused deadlock
+SET DEBUG_SYNC = 'now SIGNAL resume';
+
+connection con1;
+reap;
+connection con2;
+reap;
+connection default;
+
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+# (2) Confirm blocking domain caused by DELETE modify_tree for tall index tree
+
+# at this moment, in the tree,
+# ...
+# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx,cba,ced,cqp,cts)(cwv,czy,ddb)(dge,djh,dmk)(dpn,dsq,dvt)(dyw,ebz,efc)...
+# ...
+
+# makes >17 records in level4 [(2^(4-1))*2 + 1]. (causes never left_most records)
+DELETE FROM t1 WHERE a00 = 'dpn';
+COMMIT;
+INSERT INTO t1 SET a00 = 'dpn';
+ROLLBACK;
+
+# at this moment, in the tree,
+# (* before "]" and after "[" records are treated as left_most possible records)
+# ...
+# level 4: ...(ajk,amn,apq)(ast,avw,ayz,bll,boo,brr,buu,bxx],cba,ced,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt)(dyw,ebz,efc)...
+# level 3: ...(cba,ccb,cdc)(ced,cfe,cgf,chg],cih,cji,[ckj,clk,con,cpo)(cqp,crq,csr)...
+# level 2: ...(ckj,cks,clb)(clk,clt],cmc,cml,cmu,cnd,[cnv,coe)(con,cow,cpf)...
+# level 1: ...(cmu,cmx,cna)(cnd],cng,cnj,cnp,[cns)(cnv,cny,cob)...
+# level 0: ...(cnd,cne,cnf)(cng,cnh,cni)(cnj,cnk,cnl,cnn,cno)(cnp,cnq,cnr)...
+
+# deletes just 'ced' node_ptr only from level 4. doesn't cause merge and never left_most.
+# adjusts MERGE_THRESHOLD to do so.
+ALTER TABLE t1 COMMENT='MERGE_THRESHOLD=35';
+
+connection purge_control;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection con2;
+DELETE FROM t1 WHERE a00 = 'cnd';
+COMMIT;
+BEGIN;
+INSERT INTO t1 SET a00 = 'cnd';
+SET DEBUG_SYNC = 'rollback_undo_pk SIGNAL roll1_wait WAIT_FOR roll2';
+SET DEBUG_SYNC = 'rollback_purge_clust SIGNAL rollback_waiting WAIT_FOR resume EXECUTE 2';
+send ROLLBACK;
+
+connection purge_control;
+SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait';
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SET DEBUG_SYNC = 'now SIGNAL roll2';
+
+connection con1;
+# FIXME: For some reason, we will not always receive these signals!
+--disable_warnings
+# An optimistic row_undo_mod_remove_clust_low() will fail.
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+SET DEBUG_SYNC = 'now SIGNAL resume';
+# Wait for the pessimistic row_undo_mod_remove_clust_low() attempt.
+SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1';
+--enable_warnings
+disconnect purge_control;
+
+# The expectation should be...
+# level 0: (#cnd#,cne,cnf): causes merge
+# level 1: (#cnd#],cng,cnj,cnp,[cns): left_most
+# level 2: (clk,clt],cmc,cml,cmu,#cnd#,[cnv,coe): causes merge
+# level 3: (ced,cfe,cgf,chg],cih,cji,[ckj,#clk#,con,cpo): left_most possible (not cause merge)
+# level 4: (ast,avw,ayz,bll,boo,brr,buu,bxx],cba,#ced#,[cqp,cts,cwv,czy,ddb,dge,dsq,dvt): no merge, not left_most possible
+# So, the top X-latch page is at level4. (ast~dvt)
+
+# blocking domain based on whether its ancestor is latched or not.
+# (*[]: ancestor is X-latched)
+# level 0: ...(asq,asr,ass) [(ast,asu,asv)...(dyt,dyu,dyv)] (dyw,dyx,dyy)...
+
+# Not blocked searches
+## In MariaDB, both these will block, because we use different DEBUG_SYNC
+## instrumentation (in rollback, not purge) and the root page (number 3)
+## is being latched in row_undo_mod_remove_clust_low().
+## SELECT a00 FROM t1 WHERE a00 = 'ass';
+## SELECT a00 FROM t1 WHERE a00 = 'dyx';
+
+## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+## send SELECT a00 FROM t1 WHERE a00 = 'ast';
+
+## connection con2;
+## SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+## send SELECT a00 FROM t1 WHERE a00 = 'dyw';
+
+connection default;
+## SET DEBUG_SYNC = 'now WAIT_FOR lockwait1';
+## SET DEBUG_SYNC = 'now WAIT_FOR lockwait2';
+SET DEBUG_SYNC = 'now SIGNAL resume';
+
+## connection con1;
+## reap;
+disconnect con1;
+
+connection con2;
+reap;
+disconnect con2;
+
+connection default;
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+# Cleanup
+SET DEBUG_SYNC = 'RESET';
+
+DROP TABLE t1;
+
+--disable_query_log
+SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
+SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
+SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent;
+--enable_query_log
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bug34053.test b/mysql-test/suite/innodb/t/innodb_bug34053.test
deleted file mode 100644
index d93d5100d81..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug34053.test
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/34053 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-SET default_storage_engine=InnoDB;
-
-# we do not really care about what gets printed, we are only
-# interested in getting success or failure according to our
-# expectations
--- disable_query_log
--- disable_result_log
-
-GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
-FLUSH PRIVILEGES;
-
--- connect (con1,localhost,shane,12345,)
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET GLOBAL innodb_status_output=ON;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET GLOBAL innodb_status_output_locks=ON;
-
-CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monitor;
-CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-DROP TABLE innodb_mem_validate;
-CREATE TABLE innodb_sql (a INT) ENGINE=INNODB;
-DROP TABLE innodb_sql;
-CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monitorx;
-CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
-DROP TABLE innodb_monito;
-CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE xinnodb_monitor;
-CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
-DROP TABLE nnodb_monitor;
-
--- connection default
-SET GLOBAL innodb_status_output=ON;
-SET GLOBAL innodb_status_output_locks=ON;
-
--- connection con1
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET GLOBAL innodb_status_output=OFF;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET GLOBAL innodb_status_output_locks=OFF;
-
--- connection default
-SET GLOBAL innodb_status_output=OFF;
-SET GLOBAL innodb_status_output_locks=OFF;
-DROP USER 'shane'@'localhost';
-
--- disconnect con1
diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test
index 84c5e70e1b5..ce64f1a8322 100644
--- a/mysql-test/suite/innodb/t/innodb_bug56947.test
+++ b/mysql-test/suite/innodb/t/innodb_bug56947.test
@@ -7,6 +7,7 @@
SET GLOBAL innodb_file_per_table=0;
create table bug56947(a int not null) engine = innodb;
+SET @saved_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
--replace_regex /"[^"]*"/"xxx"/
--error ER_GET_ERRNO
@@ -15,3 +16,4 @@ check table bug56947;
drop table bug56947;
SET @@global.innodb_file_per_table=DEFAULT;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test
index e479b8d6b82..7f1f5c40585 100644
--- a/mysql-test/suite/innodb/t/innodb_bug60196.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60196.test
@@ -50,7 +50,7 @@ SELECT * FROM bug_60196;
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Send a shutdown request to the server
--- shutdown_server 10
+-- shutdown_server
# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc
@@ -124,7 +124,7 @@ SELECT * FROM Bug_60309;
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Send a shutdown request to the server
--- shutdown_server 10
+-- shutdown_server
# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
index 1d723c0bbc3..f1fd7f3c56a 100644
--- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
+++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test
@@ -36,7 +36,7 @@ select count(*) from corrupt_bit_test_ā;
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,dict_set_index_corrupted';
check table corrupt_bit_test_ā;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
# Cannot create new indexes while corrupted indexes exist
--error ER_INDEX_CORRUPT
diff --git a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
index bbcd72f1a3a..1e4e14eb7c6 100644
--- a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
+++ b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
@@ -2,17 +2,13 @@
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
+--source include/have_sequence.inc
---disable_warnings
-DROP TABLE if exists t1;
---enable_warnings
+SET @n_pages= @@GLOBAL.innodb_defragment_n_pages;
+SET @accuracy= @@GLOBAL.innodb_defragment_stats_accuracy;
+SET @sp= @@GLOBAL.innodb_stats_persistent;
---disable_query_log
-let $innodb_defragment_n_pages_orig=`select @@innodb_defragment_n_pages`;
-let $innodb_defragment_stats_accuracy_orig=`select @@innodb_defragment_stats_accuracy`;
---enable_query_log
-
-select @@global.innodb_stats_persistent;
+SET GLOBAL innodb_stats_persistent = 0;
set global innodb_defragment_stats_accuracy = 80;
# Create table.
@@ -46,6 +42,12 @@ connection default;
SET @@global.innodb_defragment_n_pages = 20;
+CREATE TEMPORARY TABLE tt (a INT, KEY(a)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO tt SELECT 0 FROM seq_1_to_180;
+INSERT INTO tt SELECT 5 FROM seq_1_to_160;
+INSERT INTO tt SELECT 1 FROM seq_1_to_1000;
+OPTIMIZE TABLE tt;
+
let $data_size = 20000;
let $delete_size = 2000;
@@ -60,7 +62,7 @@ while ($i)
}
--enable_query_log
-select count(*) from t1;
+select count(*) from t1;
select count(*) from t1 force index (second);
select count(*) from t1 force index (third);
@@ -75,7 +77,7 @@ while ($size)
}
--enable_query_log
-select count(*) from t1;
+select count(*) from t1;
select count(*) from t1 force index (second);
select count(*) from t1 force index (third);
@@ -136,7 +138,6 @@ select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like
drop table t1;
# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig;
-EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig;
---enable_query_log
+SET GLOBAL innodb_defragment_n_pages = @n_pages;
+SET GLOBAL innodb_defragment_stats_accuracy = @accuracy;
+SET GLOBAL innodb_stats_persistent = @sp;
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test
new file mode 100644
index 00000000000..f1d14c45aaf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test
@@ -0,0 +1,35 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+
+# We will kill and restart the server.
+--source include/not_embedded.inc
+FLUSH TABLES;
+
+--echo #
+--echo # MDEV-21217 innodb_force_recovery=2 may wrongly abort the rollback
+--echo # of recovered transactions
+--echo #
+
+connect (con0,localhost,root);
+CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
+# Create enough undo log so that the rollback may take enough time.
+BEGIN;
+INSERT INTO t0 SELECT * FROM seq_1_to_1000;
+
+connection default;
+# Persist the above incomplete transaction.
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+
+--let $restart_parameters= --innodb-force-recovery=2
+--let $shutdown_timeout=0
+--source include/restart_mysqld.inc
+--let $restart_parameters=
+--let $shutdown_timeout=
+
+disconnect con0;
+connection default;
+# If the rollback was aborted, we would end up in a lock wait here.
+# The LIMIT 0 works around MDEV-22889 InnoDB occasionally breaks ACID
+SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE;
+DROP TABLE t0,t1;
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
index 5041612bec1..89bace5d9b1 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
@@ -1,8 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_32k.inc
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
-
# Check page size 32k
SELECT @@innodb_page_size;
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
index 5b06b57d4b4..4b4faf16f58 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
@@ -1,8 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
-
# Check page size 64k
SELECT @@innodb_page_size;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
index 26367b8e6ae..07c77299451 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
@@ -56,6 +56,8 @@ WHERE table_name='innodb_stats_drop_locked';
SELECT table_name FROM mysql.innodb_index_stats
WHERE table_name='innodb_stats_drop_locked';
+DELETE FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
+DELETE FROM mysql.innodb_table_stats WHERE database_name='test' AND table_name='innodb_stats_drop_locked';
--disable_query_log
call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test
index e7acb98b0d0..ccd9e3d70f4 100644
--- a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test
+++ b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits.test
@@ -17,6 +17,7 @@ eval create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
# Enable the debug injection.
+SET @saved_dbug = @@SESSION.debug_dbug;
set DEBUG_DBUG='+d,fatal-semaphore-timeout';
set autocommit=0;
@@ -107,7 +108,7 @@ source include/wait_until_connected_again.inc;
--echo # Cleaning up before exit
--disable_warnings
-set DEBUG_DBUG=NULL;
+SET debug_dbug = @saved_dbug;
drop table if exists t1;
--enable_warnings
diff --git a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
new file mode 100644
index 00000000000..2e1391355b9
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
@@ -0,0 +1,70 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED
+--echo #
+
+#Test innodb_ft_server_stopword_table (global variable)
+select @@innodb_ft_server_stopword_table;
+create table user_stopword_1(value varchar(30)) engine = innodb;
+create table user_stopword_2(value varchar(30)) engine = innodb;
+
+set @blah = 'test/user_stopword_1';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+
+set @blah = 'test/user_stopword_2';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+
+SET GLOBAL innodb_ft_server_stopword_table= NULL;
+select @@innodb_ft_server_stopword_table;
+
+SET GLOBAL innodb_ft_server_stopword_table= default;
+select @@innodb_ft_server_stopword_table;
+
+drop table user_stopword_1, user_stopword_2;
+
+#Test innodb_buffer_pool_filename (global variable)
+
+select @@innodb_buffer_pool_filename;
+
+set @blah='hello';
+set global innodb_buffer_pool_filename = @blah;
+select @@innodb_buffer_pool_filename;
+
+set global innodb_buffer_pool_filename="bye";
+select @@innodb_buffer_pool_filename;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buffer_pool_filename=NULL;
+select @@innodb_buffer_pool_filename;
+
+set global innodb_buffer_pool_filename=default;
+select @@innodb_buffer_pool_filename;
+
+#Test innodb_ft_aux_table (global variable)
+CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+
+CREATE TABLE t2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+
+select @@innodb_ft_aux_table;
+
+set @blah = 'test/t1';
+SET GLOBAL innodb_ft_aux_table = @blah;
+select @@innodb_ft_aux_table;
+
+set @blah = 'test/t2';
+SET GLOBAL innodb_ft_aux_table = @blah;
+
+SET GLOBAL innodb_ft_aux_table = NULL;
+select @@innodb_ft_aux_table;
+
+SET GLOBAL innodb_ft_aux_table =default;
+select @@innodb_ft_aux_table;
+
+drop table t1,t2;
diff --git a/mysql-test/suite/innodb/t/innodb_trx_weight.opt b/mysql-test/suite/innodb/t/innodb_trx_weight.opt
deleted file mode 100644
index bac39c99a74..00000000000
--- a/mysql-test/suite/innodb/t/innodb_trx_weight.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-lock-schedule-algorithm=FCFS
diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.opt b/mysql-test/suite/innodb/t/innodb_wl6326.opt
new file mode 100644
index 00000000000..99bf0e5a28b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_wl6326.opt
@@ -0,0 +1 @@
+--innodb-sys-tablestats
diff --git a/mysql-test/suite/innodb/t/innodb_wl6326.test b/mysql-test/suite/innodb/t/innodb_wl6326.test
new file mode 100644
index 00000000000..74fa931edf1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_wl6326.test
@@ -0,0 +1,506 @@
+#
+# WL#6326: InnoDB: fix index->lock contention
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_innodb_16k.inc
+
+--disable_query_log
+SET @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
+SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index;
+SET @old_innodb_stats_persistent = @@innodb_stats_persistent;
+--enable_query_log
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+SET GLOBAL innodb_adaptive_hash_index = false;
+SET GLOBAL innodb_stats_persistent = false;
+
+--connect (con1,localhost,root,,)
+--connect (con2,localhost,root,,)
+--connect (con3,localhost,root,,)
+
+CREATE TABLE t1 (
+ a00 CHAR(255) NOT NULL DEFAULT 'a',
+ a01 CHAR(255) NOT NULL DEFAULT 'a',
+ a02 CHAR(255) NOT NULL DEFAULT 'a',
+ a03 CHAR(255) NOT NULL DEFAULT 'a',
+ a04 CHAR(255) NOT NULL DEFAULT 'a',
+ a05 CHAR(255) NOT NULL DEFAULT 'a',
+ a06 CHAR(255) NOT NULL DEFAULT 'a',
+ b INT NOT NULL DEFAULT 0
+) ENGINE = InnoDB;
+
+ALTER TABLE t1 ADD CONSTRAINT pkey PRIMARY KEY(
+ a00,
+ a01,
+ a02,
+ a03,
+ a04,
+ a05,
+ a06
+);
+
+#
+# Prepare primary key index tree to be used for this test.
+#
+
+# Only root (1)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+# Make the first records sparse artificially,
+# not to cause modify_tree by single node_ptr insert operation.
+# * (7 - 2) records should be larger than a half of the page size
+# * (7 + 2) records should be fit to the page
+# (above t1 definition is already adjusted)
+SET GLOBAL innodb_limit_optimistic_insert_debug = 7;
+
+INSERT INTO t1 (a00) VALUES ('aa');
+INSERT INTO t1 (a00) VALUES ('ab');
+INSERT INTO t1 (a00) VALUES ('ac');
+INSERT INTO t1 (a00) VALUES ('ad');
+INSERT INTO t1 (a00) VALUES ('ae');
+INSERT INTO t1 (a00) VALUES ('af');
+INSERT INTO t1 (a00) VALUES ('ag');
+INSERT INTO t1 (a00) VALUES ('ah');
+# Raise root (1-2)
+# (aa,ad)
+# (aa,ab,ac)(ad,ae,af,ag,ah)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('ai');
+INSERT INTO t1 (a00) VALUES ('aj');
+INSERT INTO t1 (a00) VALUES ('ak');
+# Split leaf (1-3)
+# (aa,ad,ak)
+# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('al');
+INSERT INTO t1 (a00) VALUES ('am');
+INSERT INTO t1 (a00) VALUES ('an');
+INSERT INTO t1 (a00) VALUES ('ao');
+INSERT INTO t1 (a00) VALUES ('ap');
+INSERT INTO t1 (a00) VALUES ('aq');
+INSERT INTO t1 (a00) VALUES ('ar');
+# Split leaf (1-4)
+# (aa,ad,ak,ar)
+# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('as');
+INSERT INTO t1 (a00) VALUES ('at');
+INSERT INTO t1 (a00) VALUES ('au');
+INSERT INTO t1 (a00) VALUES ('av');
+INSERT INTO t1 (a00) VALUES ('aw');
+INSERT INTO t1 (a00) VALUES ('ax');
+INSERT INTO t1 (a00) VALUES ('ay');
+# Split leaf (1-5)
+# (aa,ad,ak,ar,ay)
+# (aa,ab,ac)(ad,ae,af,ag,ah,ai,aj)(ak,al,am,an,ao,ap,aq)(ar,as,at,au,av,aw,ax)(ay)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('az');
+INSERT INTO t1 (a00) VALUES ('ba');
+INSERT INTO t1 (a00) VALUES ('bb');
+INSERT INTO t1 (a00) VALUES ('bc');
+INSERT INTO t1 (a00) VALUES ('bd');
+INSERT INTO t1 (a00) VALUES ('be');
+INSERT INTO t1 (a00) VALUES ('bf');
+# Split leaf (1-6)
+# (aa,ad,ak,ar,ay,bf)
+# (aa,ab,ac)(ad..)(ak..)(ar,as,at,au,av,aw,ax)(ay,az,ba,bb,bc,bd,be)(bf)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+INSERT INTO t1 (a00) VALUES ('bg');
+INSERT INTO t1 (a00) VALUES ('bh');
+INSERT INTO t1 (a00) VALUES ('bi');
+INSERT INTO t1 (a00) VALUES ('bj');
+INSERT INTO t1 (a00) VALUES ('bk');
+INSERT INTO t1 (a00) VALUES ('bl');
+INSERT INTO t1 (a00) VALUES ('bm');
+# Split leaf (1-7)
+# (aa,ad,ak,ar,ay,bf,bm)
+# (aa,ab,ac)(ad..)(ak..)(ar..)(ay,az,ba,bb,bc,bd,be)(bf,bg,bh,bi,bj,bk,bl)(bm)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('bn');
+INSERT INTO t1 (a00) VALUES ('bo');
+INSERT INTO t1 (a00) VALUES ('bp');
+INSERT INTO t1 (a00) VALUES ('bq');
+INSERT INTO t1 (a00) VALUES ('br');
+INSERT INTO t1 (a00) VALUES ('bs');
+INSERT INTO t1 (a00) VALUES ('bt');
+# Raise root (1-2-8)
+# (aa,ar)
+# (aa,ad,ak) (ar,ay,bf,bm,bt)
+# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+INSERT INTO t1 (a00) VALUES ('bu');
+INSERT INTO t1 (a00) VALUES ('bv');
+INSERT INTO t1 (a00) VALUES ('bw');
+INSERT INTO t1 (a00) VALUES ('bx');
+INSERT INTO t1 (a00) VALUES ('by');
+INSERT INTO t1 (a00) VALUES ('bz');
+INSERT INTO t1 (a00) VALUES ('ca');
+
+INSERT INTO t1 (a00) VALUES ('cb');
+INSERT INTO t1 (a00) VALUES ('cc');
+INSERT INTO t1 (a00) VALUES ('cd');
+INSERT INTO t1 (a00) VALUES ('ce');
+INSERT INTO t1 (a00) VALUES ('cf');
+INSERT INTO t1 (a00) VALUES ('cg');
+INSERT INTO t1 (a00) VALUES ('ch');
+
+INSERT INTO t1 (a00) VALUES ('ci');
+INSERT INTO t1 (a00) VALUES ('cj');
+INSERT INTO t1 (a00) VALUES ('ck');
+INSERT INTO t1 (a00) VALUES ('cl');
+INSERT INTO t1 (a00) VALUES ('cm');
+INSERT INTO t1 (a00) VALUES ('cn');
+INSERT INTO t1 (a00) VALUES ('co');
+# Split also at level 1 (1-3-11)
+# (aa,ar,co)
+# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co)
+# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+INSERT INTO t1 (a00) VALUES ('cp');
+INSERT INTO t1 (a00) VALUES ('cq');
+INSERT INTO t1 (a00) VALUES ('cr');
+INSERT INTO t1 (a00) VALUES ('cs');
+INSERT INTO t1 (a00) VALUES ('ct');
+INSERT INTO t1 (a00) VALUES ('cu');
+INSERT INTO t1 (a00) VALUES ('cv');
+
+INSERT INTO t1 (a00) VALUES ('cw');
+INSERT INTO t1 (a00) VALUES ('cx');
+INSERT INTO t1 (a00) VALUES ('cy');
+INSERT INTO t1 (a00) VALUES ('cz');
+INSERT INTO t1 (a00) VALUES ('da');
+INSERT INTO t1 (a00) VALUES ('db');
+INSERT INTO t1 (a00) VALUES ('dc');
+
+INSERT INTO t1 (a00) VALUES ('dd');
+INSERT INTO t1 (a00) VALUES ('de');
+INSERT INTO t1 (a00) VALUES ('df');
+INSERT INTO t1 (a00) VALUES ('dg');
+INSERT INTO t1 (a00) VALUES ('dh');
+INSERT INTO t1 (a00) VALUES ('di');
+INSERT INTO t1 (a00) VALUES ('dj');
+
+INSERT INTO t1 (a00) VALUES ('dk');
+INSERT INTO t1 (a00) VALUES ('dl');
+INSERT INTO t1 (a00) VALUES ('dm');
+INSERT INTO t1 (a00) VALUES ('dn');
+INSERT INTO t1 (a00) VALUES ('do');
+INSERT INTO t1 (a00) VALUES ('dp');
+INSERT INTO t1 (a00) VALUES ('dq');
+
+INSERT INTO t1 (a00) VALUES ('dr');
+INSERT INTO t1 (a00) VALUES ('ds');
+INSERT INTO t1 (a00) VALUES ('dt');
+INSERT INTO t1 (a00) VALUES ('du');
+INSERT INTO t1 (a00) VALUES ('dv');
+INSERT INTO t1 (a00) VALUES ('dw');
+INSERT INTO t1 (a00) VALUES ('dx');
+
+INSERT INTO t1 (a00) VALUES ('dy');
+INSERT INTO t1 (a00) VALUES ('dz');
+INSERT INTO t1 (a00) VALUES ('ea');
+INSERT INTO t1 (a00) VALUES ('eb');
+INSERT INTO t1 (a00) VALUES ('ec');
+INSERT INTO t1 (a00) VALUES ('ed');
+INSERT INTO t1 (a00) VALUES ('ee');
+
+INSERT INTO t1 (a00) VALUES ('ef');
+INSERT INTO t1 (a00) VALUES ('eg');
+INSERT INTO t1 (a00) VALUES ('eh');
+INSERT INTO t1 (a00) VALUES ('ei');
+INSERT INTO t1 (a00) VALUES ('ej');
+INSERT INTO t1 (a00) VALUES ('ek');
+INSERT INTO t1 (a00) VALUES ('el');
+# Split also at level 1 (1-4-18)
+# (aa,ar,co,el)
+# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el)
+# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+INSERT INTO t1 (a00) VALUES ('em');
+INSERT INTO t1 (a00) VALUES ('en');
+INSERT INTO t1 (a00) VALUES ('eo');
+INSERT INTO t1 (a00) VALUES ('ep');
+INSERT INTO t1 (a00) VALUES ('eq');
+INSERT INTO t1 (a00) VALUES ('er');
+INSERT INTO t1 (a00) VALUES ('es');
+
+INSERT INTO t1 (a00) VALUES ('et');
+INSERT INTO t1 (a00) VALUES ('eu');
+INSERT INTO t1 (a00) VALUES ('ev');
+INSERT INTO t1 (a00) VALUES ('ew');
+INSERT INTO t1 (a00) VALUES ('ex');
+INSERT INTO t1 (a00) VALUES ('ey');
+INSERT INTO t1 (a00) VALUES ('ez');
+
+INSERT INTO t1 (a00) VALUES ('fa');
+INSERT INTO t1 (a00) VALUES ('fb');
+INSERT INTO t1 (a00) VALUES ('fc');
+INSERT INTO t1 (a00) VALUES ('fd');
+INSERT INTO t1 (a00) VALUES ('fe');
+INSERT INTO t1 (a00) VALUES ('ff');
+INSERT INTO t1 (a00) VALUES ('fg');
+
+INSERT INTO t1 (a00) VALUES ('fh');
+INSERT INTO t1 (a00) VALUES ('fi');
+INSERT INTO t1 (a00) VALUES ('fj');
+INSERT INTO t1 (a00) VALUES ('fk');
+INSERT INTO t1 (a00) VALUES ('fl');
+INSERT INTO t1 (a00) VALUES ('fm');
+INSERT INTO t1 (a00) VALUES ('fn');
+
+INSERT INTO t1 (a00) VALUES ('fo');
+INSERT INTO t1 (a00) VALUES ('fp');
+INSERT INTO t1 (a00) VALUES ('fq');
+INSERT INTO t1 (a00) VALUES ('fr');
+INSERT INTO t1 (a00) VALUES ('fs');
+INSERT INTO t1 (a00) VALUES ('ft');
+INSERT INTO t1 (a00) VALUES ('fu');
+
+INSERT INTO t1 (a00) VALUES ('fv');
+INSERT INTO t1 (a00) VALUES ('fw');
+INSERT INTO t1 (a00) VALUES ('fx');
+INSERT INTO t1 (a00) VALUES ('fy');
+INSERT INTO t1 (a00) VALUES ('fz');
+INSERT INTO t1 (a00) VALUES ('ga');
+INSERT INTO t1 (a00) VALUES ('gb');
+
+INSERT INTO t1 (a00) VALUES ('gc');
+INSERT INTO t1 (a00) VALUES ('gd');
+INSERT INTO t1 (a00) VALUES ('ge');
+INSERT INTO t1 (a00) VALUES ('gf');
+INSERT INTO t1 (a00) VALUES ('gg');
+INSERT INTO t1 (a00) VALUES ('gh');
+
+
+# Current tree form (1-4-24)
+# (aa,ar,co,el)
+# (aa,ad,ak) (ar,ay,bf,bm,bt,ca,ch) (co,cv,dc,dj,dq,dx,ee) (el..,gb)
+# (aa,ab,ac)(ad..)(ak..)(ar..)(ay..)(bf..)(bm..)(bt..)(ca..)(ch..)(co..)(cv..)(dc..)(dj..)(dq..)(dx..)(ee..)(el..)..(gb..)
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+
+# Insert the rest of records normally
+SET GLOBAL innodb_limit_optimistic_insert_debug = 0;
+
+
+--echo # Test start
+
+# (1) Insert records to leaf page (bf..) and cause modify_page.
+# - root page is not X latched
+# - latched from level 1 page (ar,ay,bf,bm,bt,ca,ch)
+
+SET DEBUG_SYNC = 'RESET';
+
+# Filling leaf page (bf..)
+INSERT INTO t1 (a00) VALUES ('bfa');
+
+--connection con1
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+# Cause modify_tree
+--send
+INSERT INTO t1 (a00) VALUES ('bfb');
+
+--connection con2
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+# Not blocked searches
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+SELECT a00,a01 FROM t1 WHERE a00 = 'aq';
+# "where a00 = 'co'" is blocked because searching from smaller ('co','a','a',..).
+SELECT a00,a01 FROM t1 WHERE a00 = 'cp';
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'ar';
+
+--connection con3
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'cn';
+
+--connection default
+# FIXME: These occasionally time out!
+--disable_warnings
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+--enable_warnings
+SET DEBUG_SYNC = 'now SIGNAL continue';
+
+--connection con1
+--reap
+
+--connection con2
+--reap
+
+--connection con3
+--reap
+
+--connection default
+
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+
+# (2) Insert records to leaf page (co..) and cause modify_page
+# - root page is X latched, because node_ptr for 'co'
+# is 1st record for (co,cv,dc,dj,dq,dx,ee)
+#
+# * ordinary pessimitic insert might be done by pessistic update
+# and we should consider possibility node_ptr to be deleted.
+
+SET DEBUG_SYNC = 'RESET';
+
+# Filling leaf page (co..)
+INSERT INTO t1 (a00) VALUES ('coa');
+
+--connection con1
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+# Cause modify_tree
+--send
+INSERT INTO t1 (a00) VALUES ('cob');
+
+--connection con2
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+# All searches are blocked because root page is X latched
+
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+
+--connection con3
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+
+--connection default
+# FIXME: These occasionally time out!
+--disable_warnings
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+--enable_warnings
+SET DEBUG_SYNC = 'now SIGNAL continue';
+
+--connection con1
+--reap
+
+--connection con2
+--reap
+
+--connection con3
+--reap
+
+--connection default
+
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+
+# (3) Insert records to rightmost leaf page (gb..) and cause modify_page
+# - root page is not X latched, because node_ptr for 'gb' is the last record
+# of the level 1 though it is last record in the page.
+# - lathed from level 1 page (el..,gb)
+
+SET DEBUG_SYNC = 'RESET';
+
+# Filling leaf page (gb..)
+INSERT INTO t1 (a00) VALUES ('gba');
+
+--connection con1
+SET DEBUG_SYNC = 'before_insert_pessimitic_row_ins_clust SIGNAL reached WAIT_FOR continue';
+# Cause modify_tree
+--send
+INSERT INTO t1 (a00) VALUES ('gbb');
+
+--connection con2
+SET DEBUG_SYNC = 'now WAIT_FOR reached';
+# Not blocked searches
+SELECT a00,a01 FROM t1 WHERE a00 = 'aa';
+SELECT a00,a01 FROM t1 WHERE a00 = 'ek';
+
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'el';
+
+--connection con3
+SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait2';
+# Blocked
+--send
+SELECT a00,a01 FROM t1 WHERE a00 = 'gb';
+
+--connection default
+# FIXME: These occasionally time out!
+--disable_warnings
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1';
+SET DEBUG_SYNC = 'now WAIT_FOR lockwait2 TIMEOUT 1';
+--enable_warnings
+SET DEBUG_SYNC = 'now SIGNAL continue';
+
+--connection con1
+--reap
+
+--connection con2
+--reap
+
+--connection con3
+--reap
+
+--connection default
+ANALYZE TABLE t1;
+SELECT CLUST_INDEX_SIZE FROM information_schema.INNODB_SYS_TABLESTATS WHERE NAME = 'test/t1';
+
+
+
+# Cleanup
+SET DEBUG_SYNC = 'RESET';
+
+--connection default
+--disconnect con1
+--disconnect con2
+--disconnect con3
+
+DROP TABLE t1;
+
+--disable_query_log
+SET GLOBAL innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
+SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
+SET GLOBAL innodb_stats_persistent = @old_innodb_stats_persistent;
+--enable_query_log
+
+# Wait till all disconnects are completed.
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb_wl6326_big.test b/mysql-test/suite/innodb/t/innodb_wl6326_big.test
new file mode 100644
index 00000000000..6d4b07e7cb6
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_wl6326_big.test
@@ -0,0 +1,716 @@
+# This is a script for MTR with hybrid use.
+# a) As regression test
+# Mostly some brute force attempt to stress the internal sx locks of
+# InnoDB which were introduced by WL#6326+WL#6363.
+# The file with expected results fits to this variant.
+# The impact on code coverage is quite good.
+# b) As testbed for attempts to extend or improve the RQG test wl6326_sql.yy.
+# The MTR based test uses
+# - a table t1 with the same layout
+# - the same stored functions
+# - the same stored procedure proc_fill_t1 for inserting a configurable
+# amount of records into t1
+# like the RQG test wl6326_sql.yy.
+# Feel free to modify parameters like $max_row_count, $max_con,
+# $high_load_duration or switch debugging on (let $test_debug= 1).
+# But please be aware that MTR will most probably report that the test
+# failed because it got a difference to expected results.
+# Reasons:
+# - In general: The file with expected results fits to a) only.
+# - The actual results might dependend on $max_row_count.
+# - Additional result sets might be printed.
+#
+
+# WL#6326 is about the sx locks (InnoDB feature only).
+--source include/have_innodb.inc
+# Runtime properties:
+# Notebook i5 dual core with HT, MySQL binaries compiled with debug,
+# max_row_count=10000 rows
+# vardir on tmpfs : ~ 375
+# vardir on disk : ~ 546
+--source include/big_test.inc
+# We go with "--send" and "--reap" and that fails with the embedded server.
+--source include/not_embedded.inc
+# Its intentional to not take the risk that a run with valgrind times out.
+--source include/not_valgrind.inc
+
+# FIXME:
+# Increase the code coverage provided by the current test by
+# trying "InnoDB Tablespace Monitor" as soon as some bug is fixed
+# or wait till the deprecated "InnoDB Tablespace Monitor" is
+# removed.
+
+# Setup of some parameters
+# ------------------------
+# Number of records within every chunk to be added to t1.
+let $load_unit= 10000;
+#
+# Rough number of records in t1 to achieve.
+# We add chunks of $load_unit rows till the actual number
+# of rows in the table t1 exceeds $max_row_count.
+# let $max_row_count= 1000000;
+# let $max_row_count= 300000;
+# let $max_row_count= 100000;
+# let $max_row_count= 30000;
+ let $max_row_count= 10000; # ~ 322s on tmpfs (NB)
+#
+# Determine which variant to run.
+let $test_debug= 0;
+#
+# Number of concurrent sessions to be used in the high load test.
+let $max_con= 10;
+# Duration of the high load test in seconds.
+let $high_load_duration= 60;
+
+# Putting all objects into the SCHEMA my_schema makes the final cleanup easier.
+# We simply run than DROP SCHEMA my_schema.
+CREATE SCHEMA my_schema;
+USE my_schema;
+CREATE FUNCTION f_thread_id (i INT) RETURNS CHAR(4) DETERMINISTIC
+RETURN CONCAT(LPAD(CAST(i AS CHAR),3,'_'),'_') ;
+SELECT CONCAT('->', f_thread_id( 1), '<-');
+SELECT CONCAT('->', f_thread_id(12), '<-');
+
+# Definition of parameters used in functions.
+# We use here a "1" in order to make the impact on the results of the functions
+# good visible.
+SET @extra_int = 1;
+SET @extra_string = f_thread_id(@extra_int);
+SELECT @extra_int , @extra_string;
+
+# The different functions are used later when filling t1 and also during
+# RQG testing. They serve to generate the difference between column values
+# in different rows in different areas of the column.
+# Fictional example:
+# row 1 col_int0=1 colx='1abcdefgh' coly='abcd1efgh' colz='abcdefgh1'
+# row 2 col_int0=2 colx='2abcdefgh' coly='abcd2efgh' colz='abcdefgh2'
+# The function f_<pattern> is for the column with the name <pattern>.
+# There is a function
+# - for every column except col_int0
+# - even if the SQL for generating the value is simple.
+# The reason for this is the architecture of the RQG test.
+
+let $part= AS my_result
+FROM (SELECT 1 AS my_col UNION SELECT 12 UNION SELECT 123
+UNION SELECT 1234 UNION SELECT 12345) AS tx;
+
+let $function_name= f_col_int1;
+eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN i * 1000 + @extra_int ;
+eval SELECT $function_name(my_col) $part;
+
+let $function_name= f_col_int2;
+eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN @extra_int * 10000000 + i ;
+eval SELECT $function_name(my_col) $part;
+
+let $function_name= f_col_int3;
+eval CREATE FUNCTION $function_name (i INT) RETURNS INT(20) DETERMINISTIC
+RETURN @extra_int ;
+eval SELECT $function_name(my_col) $part;
+
+let $function_name= f_col_blob;
+eval CREATE FUNCTION $function_name (i INT) RETURNS BLOB DETERMINISTIC
+RETURN RPAD(@extra_string,(@@innodb_page_size / 2 ) + 1,'a');
+eval SELECT CONCAT('->', SUBSTR($function_name(my_col) FROM 1 FOR 10),
+ '<-.....->', SUBSTR($function_name(my_col) FROM -10 FOR 10), '<-') $part;
+
+let $function_name= f_col_char0;
+eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(255) DETERMINISTIC
+RETURN LPAD(CAST(i AS CHAR),255,' ');
+eval SELECT CONCAT('->', $function_name(my_col), '<-') $part;
+
+let $function_name= f_col_char1;
+eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',
+ LPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
+ @extra_string,
+ RPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
+ 'E') ;
+eval SELECT CONCAT('->', $function_name(my_col), '<-') $part;
+
+let $function_name= f_col_char2;
+eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',
+ RPAD(SUBSTR(CAST(i AS CHAR),1,(LENGTH(CAST(i AS CHAR)) DIV 2)),10,' '),
+ @extra_string,
+ LPAD(SUBSTR(CAST(i AS CHAR), -((LENGTH(CAST(i AS CHAR)) + 1) DIV 2)),10,' '),
+ 'E');
+eval SELECT CONCAT('->', $function_name(my_col), '<-') $part;
+
+let $function_name= f_col_char3;
+eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',@extra_string,LPAD(CAST(i AS CHAR),20,' '),'E');
+eval SELECT CONCAT('->', $function_name(my_col), '<-') $part;
+
+let $function_name= f_col_char4;
+eval CREATE FUNCTION $function_name (i INT) RETURNS CHAR(26) DETERMINISTIC
+RETURN
+CONCAT('B',RPAD(CAST(i AS CHAR),20,' '),@extra_string,'E');
+eval SELECT CONCAT('->', $function_name(my_col), '<-') $part;
+
+# Auxiliary table for figuring out the impact of scenarios on
+# information_schema.innodb_metrics content.
+CREATE TABLE my_metrics LIKE information_schema.innodb_metrics;
+ALTER TABLE my_metrics ADD COLUMN phase ENUM('after', 'before'),
+DROP COLUMN SUBSYSTEM, DROP COLUMN TYPE, DROP COLUMN COMMENT,
+ADD PRIMARY KEY (NAME,phase);
+let $empty_my_metrics= DELETE FROM my_metrics;
+let $before_my_metrics= INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'before'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+let $after_my_metrics= INSERT INTO my_metrics
+SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
+STATUS, 'after'
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%';
+let $print_metrics= SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
+COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
+TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, STATUS
+FROM information_schema.innodb_metrics
+WHERE NAME LIKE 'innodb_rwlock_sx_%'
+ORDER BY NAME;
+
+# The main table for testing.
+CREATE TABLE t1 (
+ col_int0 BIGINT,
+ col_int1 BIGINT,
+ col_int2 BIGINT,
+ col_int3 BIGINT,
+ col_blob BLOB,
+ col_char0 VARCHAR(255),
+ col_char1 VARCHAR(30),
+ col_char2 VARCHAR(30),
+ col_char3 VARCHAR(30),
+ col_char4 VARCHAR(30)
+) ENGINE = InnoDB;
+
+# Use many indexes with mostly significant size in order to cause
+# some heavy use of sx locks during data generation.
+ALTER TABLE t1 ADD UNIQUE KEY uidx_col_int0 (col_int0),
+ADD UNIQUE KEY uidx1 (col_int1, col_char0),
+ADD UNIQUE KEY uidx2 (col_int2, col_char0, col_int1),
+ADD UNIQUE KEY uidx3 (col_int3, col_int2, col_char0),
+ADD UNIQUE KEY uidx4 (col_char1, col_char0),
+ADD UNIQUE KEY uidx5 (col_char2, col_char0, col_char1),
+ADD UNIQUE KEY uidx6 (col_char3, col_char2, col_char0),
+ADD UNIQUE KEY uidx7 (col_int1, col_int2, col_int3, col_char4,
+ col_char1, col_char2, col_char3, col_char0),
+ADD KEY idx8 (col_blob(10), col_char4);
+
+delimiter |;
+CREATE PROCEDURE proc_fill_t1 (max_row_count INT, load_unit INT)
+BEGIN
+ DECLARE my_count INTEGER DEFAULT 0;
+ DECLARE max_load_count INTEGER DEFAULT 0;
+ DROP TABLE IF EXISTS t0;
+ CREATE TEMPORARY TABLE t0 (col_int0 BIGINT, PRIMARY KEY(col_int0));
+ WHILE (my_count < load_unit ) DO
+ SET my_count = my_count + 1;
+ INSERT INTO t0 SET col_int0 = my_count;
+ END WHILE;
+ SET max_load_count = (SELECT (max_row_count DIV load_unit) + 1 );
+ SELECT COUNT(col_int0) INTO @val FROM t1;
+ SET my_count = 0;
+ REPEAT
+ INSERT INTO t1 (col_int0, col_int1, col_int2, col_int3, col_blob,
+ col_char0, col_char1, col_char2,col_char3,col_char4)
+ SELECT col_int0 + @val,
+ f_col_int1(col_int0 + @val),
+ f_col_int2(col_int0 + @val),
+ f_col_int3(col_int0 + @val),
+ f_col_blob(col_int0 + @val),
+ f_col_char0(col_int0 + @val),
+ f_col_char1(col_int0 + @val),
+ f_col_char2(col_int0 + @val),
+ f_col_char3(col_int0 + @val),
+ f_col_char4(col_int0 + @val)
+ FROM t0;
+ COMMIT;
+ SELECT MAX(col_int0) INTO @val FROM t1;
+ SET my_count = my_count + 1;
+ UNTIL( my_count > max_load_count OR @val >= max_row_count )
+ END REPEAT;
+ DROP TEMPORARY TABLE t0;
+END|
+delimiter ;|
+
+delimiter |;
+CREATE PROCEDURE proc_dml (max_duration INT, t1_stripe_half INT)
+BEGIN
+ DECLARE aux INTEGER DEFAULT 0;
+ DECLARE start_time INT;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN END;
+
+ SET @extra_int = CONNECTION_ID();
+ SET @extra_string = f_thread_id(@extra_int);
+ SELECT ROUND(MAX(col_int0) / 2 ) INTO @t1_half FROM t1;
+ # The user lock 'Blocker' should be already set by some other session S1.
+ # S1 starts the race by releasing that lock.
+ # Wait till the lock is released and the lock can be obtained.
+ # In order to prevent endless waiting in case of non foreseen problems
+ # limit the timespan to 30 seconds.
+ SELECT GET_LOCK('Blocker', 30) INTO @aux;
+ # Release the lock immediate so that the other "runner" sessions start too.
+ SELECT RELEASE_LOCK('Blocker') INTO @aux;
+ SET start_time = UNIX_TIMESTAMP();
+
+ WHILE (UNIX_TIMESTAMP() - start_time < max_duration) DO
+ SET @aux = @t1_half - t1_stripe_half + ROUND(RAND() * t1_stripe_half * 2);
+ UPDATE t1 SET
+ col_int1 = f_col_int1(col_int0),
+ col_int2 = f_col_int2(col_int0),
+ col_int3 = f_col_int3(col_int0),
+ col_blob = f_col_blob(col_int0),
+ col_char0 = f_col_char0(col_int0),
+ col_char1 = f_col_char1(col_int0),
+ col_char2 = f_col_char2(col_int0),
+ col_char3 = f_col_char3(col_int0),
+ col_char4 = f_col_char4(col_int0)
+ WHERE col_int0 = @aux;
+ COMMIT;
+ END WHILE;
+END|
+delimiter ;|
+
+SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
+SET @pre_reset_ts = NOW();
+--sleep 1.1
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+SET @pre_enable_ts = NOW();
+--sleep 1.1
+SET GLOBAL innodb_monitor_enable = "innodb_rwlock_sx_%";
+--sleep 1.1
+SET @pre_collect_ts = NOW();
+eval $empty_my_metrics;
+eval $before_my_metrics;
+--echo # TC-01 There are exact three entries "innodb_rwlock_sx_%" with the
+--echo # with the name which follow in innodb_metrics.
+let $check_statement=
+SELECT COUNT(*) <> 3 FROM my_metrics
+WHERE NAME IN ('innodb_rwlock_sx_spin_waits',
+ 'innodb_rwlock_sx_spin_rounds',
+ 'innodb_rwlock_sx_os_waits');
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+SELECT COUNT(*) INTO @sx_count FROM my_metrics;
+
+--echo # TC-02 Counting is now enabled. ALL = @sx_count entries show that.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE STATUS = 'enabled';
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME, STATUS FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+--echo # TC-03 @pre_reset_ts < TIME_RESET. ALL = @sx_count entries show that.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE @pre_reset_ts < TIME_RESET;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME, @pre_reset_ts, TIME_RESET FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+--echo # TC-04 @pre_enable_ts < TIME_ENABLED. ALL = @sx_count entries show that.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE @pre_enable_ts < TIME_ENABLED;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME, @pre_enable_ts, TIME_ENABLED FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+--echo # TC-05 TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts
+--echo # AND TIME_ELAPSED > 0. ALL = @sx_count entries show that.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE TIME_RESET < TIME_ENABLED AND TIME_ENABLED < @pre_collect_ts
+ AND TIME_ELAPSED > 0;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME, @pre_collect_ts, TIME_RESET, TIME_ENABLED, TIME_ELAPSED
+ FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+--echo # TC-06 COUNT_RESET = MAX_COUNT_RESET. ALL = @sx_count entries show that.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE COUNT_RESET = MAX_COUNT_RESET;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT NAME, COUNT_RESET, MAX_COUNT_RESET FROM my_metrics
+ ORDER BY NAME;
+ exit;
+}
+--echo # pass
+
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+--disable_result_log
+if($test_debug)
+{
+ --enable_result_log
+ eval $print_metrics;
+}
+SHOW ENGINE INNODB STATUS;
+--enable_result_log
+
+eval $empty_my_metrics;
+eval $before_my_metrics;
+# These values (the "0") help to identify later if some record is in its
+# initial state or already modified.
+SET @extra_string = '__0_';
+SET @extra_int = 0;
+
+--echo # TC-07 One session inserts some significant amount of rows into t1.
+--echo # The system MUST survive that.
+--replace_result $max_row_count <max_row_count>
+eval SET @max_row_count = $max_row_count;
+--replace_result $load_unit <load_unit>
+eval SET @load_unit = $load_unit;
+SET @start_time = UNIX_TIMESTAMP();
+SET AUTOCOMMIT = OFF;
+CALL proc_fill_t1 (@max_row_count, @load_unit);
+--echo # pass
+SET AUTOCOMMIT = ON;
+SELECT col_int0 INTO @t1_half FROM t1
+WHERE col_int0 >= (@val DIV 2) ORDER BY col_int0 LIMIT 1;
+
+--disable_result_log
+if($test_debug)
+{
+ --enable_result_log
+ SELECT COUNT(*) AS table_row_count,
+ UNIX_TIMESTAMP() - @start_time AS fill_run_time
+ FROM t1;
+ eval $print_metrics;
+}
+SHOW ENGINE INNODB STATUS;
+--enable_result_log
+
+# Show that the value distribution is according to the plan.
+--vertical_results
+SELECT col_int0, col_int1, col_int2, col_int3,
+ CONCAT('->', SUBSTR(col_blob FROM 1 FOR 10),
+ '<-.....->', SUBSTR(col_blob FROM -10 FOR 10), '<-') AS col_blobx,
+ CONCAT('->',col_char0,'<-') AS col_char0x,
+ CONCAT('->',col_char1,'<-') AS col_char1x,
+ CONCAT('->',col_char2,'<-') AS col_char2x,
+ CONCAT('->',col_char3,'<-') AS col_char3x,
+ CONCAT('->',col_char4,'<-') AS col_char4x
+FROM t1 WHERE col_int0 between 98 AND 102;
+--horizontal_results
+
+# For experiments/interest only. Please do not remove that.
+if (0)
+{
+ ANALYZE TABLE t1;
+ SELECT n_rows, clustered_index_size, sum_of_other_index_sizes
+ FROM mysql.innodb_table_stats;
+
+ # SELECT * FROM mysql.innodb_index_stats;
+ # idx_col_int3_int0 n_diff_pfx01 1 col_int3
+ # idx_col_int3_int0 n_diff_pfx02 10000 col_int3,col_int0
+ # idx_col_int3_int0 n_diff_pfx03 10000 col_int3,col_int0,DB_ROW_ID
+ # idx_col_int3_int0 n_leaf_pages 19 Number of leaf pages in the index
+ # idx_col_int3_int0 size 20 Number of pages in the index
+
+ --vertical_results
+ SELECT t1.index_name, t1.stat_value AS idx_pages, t2.stat_value AS idx_leaf_pages,
+ (t1.stat_value - t2.stat_value - 1) / t1.stat_value AS sx_page_ratio
+ FROM mysql.innodb_index_stats t1, mysql.innodb_index_stats t2
+ WHERE t1.index_name = t2.index_name
+ AND t1.stat_name = 'size' AND t2.stat_name = 'n_leaf_pages'
+ ORDER BY t1.index_name;
+ --horizontal_results
+}
+
+--echo # TC-11 Several concurrent sessions perform updates in t1 like mad.
+--echo # The system MUST survive this.
+--echo # Printing of statements is partially suppressed.
+SET @start_time = UNIX_TIMESTAMP();
+SELECT 1 FROM t1 WHERE col_int0 = @t1_half FOR UPDATE;
+SELECT GET_LOCK('Blocker', 1000) ;
+--disable_query_log
+let $num= $max_con;
+while ($num)
+{
+ --connect (con$num,localhost,root,,)
+ USE my_schema;
+ # The second parameter of the procedure is size of the affected stripe / 2.
+ # A smaller stripe causes some smaller counter growth but most probably
+ # also more stress around locking in general.
+ # Example # (nnnn) = half stripe size
+ # NAME | COUNT_RESET (5000) | COUNT_RESET (100)
+ # -----------------------------+--------------------+----------------
+ # innodb_rwlock_sx_os_waits | 1412 | 486
+ # innodb_rwlock_sx_spin_rounds | 44061 | 17031
+ # innodb_rwlock_sx_spin_waits | 996 | 515
+ --send
+ eval CALL proc_dml($high_load_duration,@t1_half);
+ dec $num;
+}
+--connection default
+SELECT RELEASE_LOCK('Blocker') ;
+--sleep 3
+COMMIT;
+let $num= $max_con;
+while ($num)
+{
+ --connection con$num
+ --reap
+ dec $num;
+}
+--echo # pass
+--connection default
+--enable_query_log
+
+# let $wait_timeout= 181;
+# --source include/wait_condition.inc
+# eval $after_my_metrics;
+--disable_result_log
+if($test_debug)
+{
+ --enable_result_log
+ SELECT UNIX_TIMESTAMP() - @start_time AS update_battle_run_time;
+ eval $print_metrics;
+}
+SHOW ENGINE INNODB STATUS;
+--enable_result_log
+
+--echo # TC-13 One session performs ALTER TABLE t1 ADD KEY ... on the fat table t1.
+--echo # The system MUST survive this.
+SET @start_time = UNIX_TIMESTAMP();
+ALTER TABLE t1 ADD KEY idx_col_char4_col_char0 (col_char4,col_char0);
+--disable_result_log
+if($test_debug)
+{
+ --enable_result_log
+ SELECT UNIX_TIMESTAMP() - @start_time AS add_key_run_time;
+ eval $print_metrics;
+}
+SHOW ENGINE INNODB STATUS;
+--enable_result_log
+--echo # pass
+
+--echo # TC-15 One session performs a fat update on the fat table t1.
+--echo # The system MUST survive this.
+SET @start_time = UNIX_TIMESTAMP();
+SET @extra_int = 13;
+SET @extra_string = f_thread_id(@extra_int);
+eval UPDATE t1 SET
+ col_int1 = f_col_int1(col_int0), col_int2 = f_col_int2(col_int0),
+ col_int3 = f_col_int3(col_int0), col_blob = f_col_blob(col_int0),
+ col_char0 = f_col_char0(col_int0), col_char1 = f_col_char1(col_int0),
+ col_char2 = f_col_char2(col_int0), col_char3 = f_col_char3(col_int0),
+ col_char4 = f_col_char4(col_int0)
+WHERE col_int0 BETWEEN @t1_half - 2500 AND @t1_half + 2500;
+COMMIT;
+--disable_result_log
+if($test_debug)
+{
+ --enable_result_log
+ SELECT UNIX_TIMESTAMP() - @start_time AS total_update_run_time;
+ eval $print_metrics;
+}
+SHOW ENGINE INNODB STATUS;
+--enable_result_log
+--echo # pass
+
+# Basically every of the big activities causes some counter growth.
+# But caused by
+# - the architecture of InnoDB (certain things happen asynchronous)
+# - the actual test configuration (server/InnoDB options)
+# - conditions like parallel (./mtr --parallel=auto?) load on the testing box
+# this might be not fulfilled per single big activity every time except
+# we go with huge waits or similar.
+# Observation:
+# - non debug binaries: expectation frequent not fulfilled
+# - debug binaries: expectation rare not fulfilled
+#
+let $wait_timeout= 121;
+let $wait_condition=
+SELECT COUNT(*) = @sx_count
+FROM information_schema.innodb_metrics t_after
+JOIN my_metrics t_before
+ON t_after.COUNT_RESET > t_before.COUNT_RESET AND t_after.NAME = t_before.NAME;
+--source include/wait_condition.inc
+eval $after_my_metrics;
+
+--echo # TC-16 The following activities happend after reset in innodb_metrics
+--echo # - Insert some significant amount of rows into t1.
+--echo # - Several concurrent users perform excessive updates in t1.
+--echo # - ALTER TABLE ... ADD KEY <sufficient big enough structure>
+--echo # - One UPDATE statement modifying a huge slice of t1.
+--echo # Any of them causes heavy use of SX lock and therefore COUNT_RESET
+--echo # must have grown for ALL = @sx_count entries.
+# The former testcases TC-10 and TC12 had to be made a part of this testcase
+# because their results were unstable.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before
+ON t_after.COUNT_RESET > t_before.COUNT_RESET AND t_after.NAME = t_before.NAME
+WHERE t_after.phase = 'after' AND t_before.phase = 'before';
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+--echo # TC-09 Heavy activity after reset.
+--echo # COUNT_RESET = MAX_COUNT_RESET for ALL = @sx_count entries
+--echo # needs to stay valid though he counters will have grown.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE phase = 'after' AND COUNT_RESET = MAX_COUNT_RESET;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+eval $empty_my_metrics;
+eval $before_my_metrics;
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+eval $after_my_metrics;
+--echo # TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL
+--echo # = @sx_count entries.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE phase = 'before' AND COUNT_RESET = MAX_COUNT_RESET;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+--echo # TC-17 We had heavy activity causing big counters and after that a reset.
+--echo # Reset causes COUNT > COUNT_RESET AND MAX_COUNT > MAX_COUNT_RESET
+--echo # for ALL @sx_count entries.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics
+WHERE phase = 'after'
+ AND COUNT > COUNT_RESET
+ AND MAX_COUNT > MAX_COUNT_RESET;
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+--echo # TC-18 We had some reset but this must not decrease COUNT or MAX_COUNT
+--echo # after.COUNT >= before.COUNT AND
+--echo # after.MAX_COUNT >= before.MAX_COUNT for ALL @sx_count entries.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before
+ON t_after.COUNT >= t_before.COUNT AND t_after.MAX_COUNT >= t_before.MAX_COUNT
+ AND t_after.NAME = t_before.NAME
+WHERE t_after.phase = 'after' AND t_before.phase = 'before';
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+--echo # TC-19 We had some reset after heavy activity and this must cause
+--echo # after.COUNT_RESET < before.COUNT_RESET
+--echo # AND after.MAX_COUNT_RESET < before.MAX_COUNT_RESET AND
+--echo # for ALL @sx_count entries.
+let $check_statement=
+SELECT COUNT(*) <> @sx_count FROM my_metrics t_after JOIN my_metrics t_before
+ON t_after.COUNT_RESET < t_before.COUNT_RESET
+ AND t_after.MAX_COUNT_RESET < t_before.MAX_COUNT_RESET
+ AND t_after.NAME = t_before.NAME
+WHERE t_after.phase = 'after' AND t_before.phase = 'before';
+if(`$check_statement`)
+{
+ --echo # fail
+ eval $check_statement;
+ SELECT * FROM my_metrics
+ ORDER BY NAME, phase;
+ exit;
+}
+--echo # pass
+
+# Cleanup
+let $num= $max_con;
+while ($num)
+{
+ --connection con$num
+ --disconnect con$num
+ --source include/wait_until_disconnected.inc
+ dec $num;
+}
+--connection default
+USE test;
+DROP SCHEMA my_schema;
+SET GLOBAL innodb_monitor_disable = all;
+SET GLOBAL innodb_monitor_reset_all = all;
+--disable_warnings
+SET GLOBAL innodb_monitor_enable = default;
+SET GLOBAL innodb_monitor_disable = default;
+SET GLOBAL innodb_monitor_reset = default;
+SET GLOBAL innodb_monitor_reset_all = default;
+--enable_warnings
+SET GLOBAL innodb_monitor_disable = "innodb_rwlock_sx_%";
+SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
+
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 d85fbf08194..584d3dc1d5d 100644
--- a/mysql-test/suite/innodb/t/log_file_name_debug.test
+++ b/mysql-test/suite/innodb/t/log_file_name_debug.test
@@ -39,7 +39,7 @@ SELECT * FROM t1;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
---let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written
+--let SEARCH_PATTERN= ib_log: MLOG_CHECKPOINT.* written
--source include/search_pattern_in_file.inc
--let $restart_parameters=
diff --git a/mysql-test/suite/innodb/t/mvcc.test b/mysql-test/suite/innodb/t/mvcc.test
index bf76a5de798..7c37718c28a 100644
--- a/mysql-test/suite/innodb/t/mvcc.test
+++ b/mysql-test/suite/innodb/t/mvcc.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/have_sequence.inc
SET @save_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
@@ -49,4 +50,23 @@ SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-23198 Crash in REPLACE
+--echo #
+
+DELIMITER $$;
+BEGIN NOT ATOMIC
+ DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(id INT PRIMARY KEY, c',
+ GROUP_CONCAT(seq SEPARATOR ' INT, c'),
+ ' INT NOT NULL UNIQUE) ENGINE=InnoDB')
+ FROM seq_1_to_294);
+ EXECUTE IMMEDIATE c;
+END;
+$$
+DELIMITER ;$$
+
+INSERT INTO t1 SET id=1,c294=1;
+REPLACE t1 SET id=1,c294=1;
+DROP TABLE t1;
+
SET GLOBAL innodb_file_per_table= @save_per_table;
diff --git a/mysql-test/suite/innodb/t/read_only_recover_committed.test b/mysql-test/suite/innodb/t/read_only_recover_committed.test
index c75b91d05db..5fd11f01356 100644
--- a/mysql-test/suite/innodb/t/read_only_recover_committed.test
+++ b/mysql-test/suite/innodb/t/read_only_recover_committed.test
@@ -52,6 +52,7 @@ SELECT * FROM t;
UPDATE t SET a=3 WHERE a=1;
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
+SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
--echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
--echo # In earlier versions, this would return the last committed version
--echo # (empty table)!
diff --git a/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test
index 9ff01739f60..f1d1537237e 100644
--- a/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test
+++ b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test
@@ -33,8 +33,8 @@ while ($i)
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--exec echo "wait" > $_expect_file_name
-set debug_dbug = '+d,increase_mtr_checkpoint_size';
-set debug_dbug = '+d,crash_after_checkpoint';
+SET debug_dbug = '+d,increase_mtr_checkpoint_size';
+SET debug_dbug = '+d,crash_after_checkpoint';
--error 2013
set global innodb_log_checkpoint_now = 1;
@@ -64,7 +64,7 @@ while ($i)
--enable_query_log
--exec echo "wait" > $_expect_file_name
-set debug_dbug = '+d,crash_after_checkpoint';
+SET debug_dbug = '+d,crash_after_checkpoint';
--error 2013
set global innodb_log_checkpoint_now = 1;
diff --git a/mysql-test/suite/innodb/t/row_format_redundant.test b/mysql-test/suite/innodb/t/row_format_redundant.test
index af3fe3b52cf..089339a0713 100644
--- a/mysql-test/suite/innodb/t/row_format_redundant.test
+++ b/mysql-test/suite/innodb/t/row_format_redundant.test
@@ -32,8 +32,7 @@ SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_file_per_table=ON;
create table t1 (a int not null, d varchar(15) not null, b
-varchar(198) not null, c char(156),
-fulltext ftsic(c)) engine=InnoDB
+varchar(198) not null, c char(156)) engine=InnoDB
row_format=redundant;
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
new file mode 100644
index 00000000000..af6c15e0e6b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+
+call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
+
+SET innodb_strict_mode = 0;
+SET @@global.log_warnings = 3;
+
+CREATE TABLE t1 (
+ col_1 TEXT
+ ,col_2 TEXT
+ ,col_3 TEXT
+ ,col_4 TEXT
+ ,col_5 TEXT
+ ,col_6 TEXT
+ ,col_7 TEXT
+ ,col_8 TEXT
+ ,col_9 TEXT
+ ,col_10 TEXT
+ ,col_11 TEXT
+) ENGINE=INNODB ROW_FORMAT=COMPACT;
+--enable_warnings
+TRUNCATE TABLE t1;
+OPTIMIZE TABLE t1;
+ALTER TABLE t1 FORCE;
+SET innodb_strict_mode = ON;
+TRUNCATE TABLE t1;
+OPTIMIZE TABLE t1;
+ALTER TABLE t1 FORCE;
+DROP TABLE t1;
+--disable_warnings
+
+SET @@global.log_warnings = 2;
diff --git a/mysql-test/suite/innodb/t/stats_persistent.test b/mysql-test/suite/innodb/t/stats_persistent.test
new file mode 100644
index 00000000000..ac412d56d0d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/stats_persistent.test
@@ -0,0 +1,27 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
+
+--echo #
+--echo # MDEV-23991 dict_table_stats_lock() has unnecessarily long scope
+--echo #
+CREATE TABLE t1(a INT) ENGINE=INNODB STATS_PERSISTENT=1;
+
+SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go';
+--send ANALYZE TABLE t1
+
+--connect(con1, localhost, root)
+SET DEBUG_SYNC='now WAIT_FOR stop';
+
+SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB';
+
+SET DEBUG_SYNC='now SIGNAL go';
+--disconnect con1
+
+--connection default
+--reap
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test
index cd1d827e157..ca9ccb677e9 100644
--- a/mysql-test/suite/innodb/t/truncate.test
+++ b/mysql-test/suite/innodb/t/truncate.test
@@ -50,3 +50,13 @@ INSERT INTO t1 VALUES(1);
TRUNCATE t1;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
+
+--echo #
+--echo # MDEV-23705 Assertion 'table->data_dir_path || !space'
+--echo #
+CREATE TABLE t(c INT) ENGINE=InnoDB;
+ALTER TABLE t DISCARD TABLESPACE;
+RENAME TABLE t TO u;
+TRUNCATE u;
+TRUNCATE u;
+DROP TABLE u;
diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test
index 2c00c0641e9..d9d647e69f0 100644
--- a/mysql-test/suite/innodb/t/truncate_foreign.test
+++ b/mysql-test/suite/innodb/t/truncate_foreign.test
@@ -37,6 +37,7 @@ send DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
+SET lock_wait_timeout=1;
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE child;
SET DEBUG_SYNC='now SIGNAL go';
diff --git a/mysql-test/suite/innodb/t/truncate_inject.test b/mysql-test/suite/innodb/t/truncate_inject.test
index 35e516324bb..25002bd2f7b 100644
--- a/mysql-test/suite/innodb/t/truncate_inject.test
+++ b/mysql-test/suite/innodb/t/truncate_inject.test
@@ -14,26 +14,26 @@ ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
#
-SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
--error ER_GET_ERRNO
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 2. Error while preparing for truncate
-SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
--error ER_GET_ERRNO
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 3. Error while dropping/creating indexes
-SET debug_dbug = '+d,ib_err_trunc_drop_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_drop_index';
--error ER_GET_ERRNO
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
@@ -44,10 +44,10 @@ ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
-SET debug_dbug = '+d,ib_err_trunc_create_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_create_index';
--error ER_GET_ERRNO
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
@@ -58,9 +58,9 @@ ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
@@ -73,9 +73,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
@@ -88,9 +88,9 @@ insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
-SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
+SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t order by i;
diff --git a/mysql-test/suite/innodb/t/undo_log.test b/mysql-test/suite/innodb/t/undo_log.test
index 94322868b06..150d50c2e75 100644
--- a/mysql-test/suite/innodb/t/undo_log.test
+++ b/mysql-test/suite/innodb/t/undo_log.test
@@ -1,7 +1,5 @@
--source include/have_innodb.inc
-call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is");
-
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
diff --git a/mysql-test/suite/innodb/t/update-cascade.combinations b/mysql-test/suite/innodb/t/update-cascade.combinations
new file mode 100644
index 00000000000..8fb4862675b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/update-cascade.combinations
@@ -0,0 +1,5 @@
+[FCFS]
+--innodb-lock-schedule-algorithm=FCFS
+
+[VATS]
+--innodb-lock-schedule-algorithm=VATS
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
index 20bb52c22f2..bb8e3316860 100644
--- a/mysql-test/suite/innodb/t/xa_recovery.test
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -5,7 +5,7 @@
# MDEV-8841 - close tables opened by previous tests,
# so they don't get marked crashed when the server gets crashed
--disable_query_log
-call mtr.add_suppression("Found 1 prepared XA transactions");
+call mtr.add_suppression("Found [12] prepared XA transactions");
FLUSH TABLES;
--enable_query_log
@@ -13,6 +13,9 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connect (con1,localhost,root);
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
+connect (con2,localhost,root);
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
+XA START 'y'; INSERT INTO t2 VALUES (1); XA END 'y'; XA PREPARE 'y';
connection default;
# innodb_force_recovery=2 prevents the purge and tests that the fix of
@@ -25,6 +28,7 @@ connection default;
--let $shutdown_timeout=
disconnect con1;
+disconnect con2;
connect (con1,localhost,root);
--send SELECT * FROM t1 LOCK IN SHARE MODE
@@ -35,6 +39,8 @@ let $wait_condition=
info = 'SELECT * FROM t1 LOCK IN SHARE MODE';
--source include/wait_condition.inc
+DROP TABLE t2;
+
--source include/restart_mysqld.inc
disconnect con1;
@@ -45,3 +51,8 @@ XA ROLLBACK 'x';
SELECT * FROM t1;
DROP TABLE t1;
+
+SET GLOBAL innodb_fast_shutdown=0;
+--source include/restart_mysqld.inc
+
+XA ROLLBACK 'y';
diff --git a/mysql-test/suite/innodb/t/xa_recovery_debug.test b/mysql-test/suite/innodb/t/xa_recovery_debug.test
new file mode 100644
index 00000000000..ada2940ed9c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/xa_recovery_debug.test
@@ -0,0 +1,43 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+# Embedded server does not support restarting
+--source include/not_embedded.inc
+
+--disable_query_log
+FLUSH TABLES;
+--enable_query_log
+
+--echo #
+--echo # Bug#20872655 XA ROLLBACK IS NOT CRASH-SAFE
+--echo #
+
+CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=INNODB;
+INSERT INTO t SET a=0;
+connect (con1,localhost,root);
+XA START 'zombie';
+INSERT INTO t SET a=1;
+UPDATE t SET b=1 WHERE a=1;
+SELECT COUNT(*) FROM t;
+XA END 'zombie';
+XA PREPARE 'zombie';
+SET DEBUG_SYNC='trx_after_rollback_row SIGNAL s1 WAIT_FOR s2';
+--send XA ROLLBACK 'zombie'
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR s1';
+# Ensure that the state change from XA PREPARE to ACTIVE gets flushed
+# to the redo log. Without this, it could be that we will recover to
+# a state that precedes the start of the XA ROLLBACK.
+SET GLOBAL innodb_flush_log_at_trx_commit=1;
+DELETE FROM t LIMIT 1;
+let $shutdown_timeout=0;
+--source include/restart_mysqld.inc
+disconnect con1;
+# If the trx_undo_set_state_at_prepare() is omitted at the start of
+# XA ROLLBACK, then the XA COMMIT would succeed and the table would
+# incorrectly show the result of the INSERT but not the UPDATE,
+# because we would commit a partially rolled back transaction.
+--error ER_XAER_NOTA
+XA COMMIT 'zombie';
+SELECT * FROM t;
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb_fts/r/basic.result b/mysql-test/suite/innodb_fts/r/basic.result
index d96127fbc34..b3fd94509c3 100644
--- a/mysql-test/suite/innodb_fts/r/basic.result
+++ b/mysql-test/suite/innodb_fts/r/basic.result
@@ -132,6 +132,27 @@ id title body
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
id title body
diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result
index 9871d43119a..e91ea02b1de 100644
--- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result
+++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result
@@ -17,6 +17,7 @@ INSERT INTO t1 VALUES('test');
CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES('mariadb');
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
@@ -28,7 +29,7 @@ ALTER TABLE t2 drop index idx1;
connection default;
set DEBUG_SYNC= 'now SIGNAL fts_drop_index';
connection con1;
-SET global DEBUG_DBUG=RESET;
drop table t1, t2;
connection default;
set DEBUG_SYNC=RESET;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
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 983f254cf90..f23813aed48 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
@@ -227,3 +227,10 @@ id title body
1 MySQL Tutorial DBMS stands for DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
DROP TABLE articles;
+#
+# MDEV-22811 DDL fails to drop and re-create FTS index
+#
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
+f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
+ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
index 8c3c3b5be68..8074260952a 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
@@ -740,6 +740,11 @@ FULLTEXT(f2),
FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB;
INSERT INTO mdev20987_1 VALUES(1);
INSERT INTO mdev20987_2 VALUES(1, 'mariadb');
+CREATE TABLE mdev22358 (a INT, b TEXT, FULLTEXT KEY ftidx (b)) ENGINE=InnoDB;
+ALTER TABLE mdev22358 DROP KEY ftidx;
+INSERT INTO mdev22358 (a) VALUES (2),(2);
+ALTER TABLE mdev22358 ADD UNIQUE KEY uidx (a), ADD FULLTEXT KEY ftidx (b);
+ERROR 23000: Duplicate entry '2' for key 'uidx'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -747,7 +752,7 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`FTS_DOC_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
-DROP TABLE t1, t2, mdev20987_2, mdev20987_1;
+DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358;
"----------Test28---------"
create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
set session autocommit=0;
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 b76784d4ffd..e039b7e77d9 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
@@ -919,4 +919,46 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+#
+# InnoDB: Failing assertion: result != FTS_INVALID in
+# fts_trx_row_get_new_state
+#
+SET FOREIGN_KEY_CHECKS=1;
+CREATE TABLE t1 (pk INT PRIMARY KEY,
+f1 VARCHAR(10), f2 VARCHAR(10),
+f3 VARCHAR(10), f4 VARCHAR(10),
+f5 VARCHAR(10), f6 VARCHAR(10),
+f7 VARCHAR(10), f8 VARCHAR(10),
+FULLTEXT(f1), FULLTEXT(f2), FULLTEXT(f3), FULLTEXT(f4),
+FULLTEXT(f5), FULLTEXT(f6), FULLTEXT(f7), FULLTEXT(f8),
+INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
+INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+(3, 'innodb', 'innodb', 'innodb', 'innodb',
+'innodb', 'innodb', 'innodb', 'innodb');
+ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
+START TRANSACTION;
+DELETE FROM t1 where f1='mariadb';
+SELECT * FROM t1;
+pk f1 f2 f3 f4 f5 f6 f7 f8
+2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb
+3 innodb innodb innodb innodb innodb innodb innodb innodb
+ROLLBACK;
+ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
+START TRANSACTION;
+DELETE FROM t1 where f3='mariadb';
+SELECT * FROM t1;
+pk f1 f2 f3 f4 f5 f6 f7 f8
+3 innodb innodb innodb innodb innodb innodb innodb innodb
+ROLLBACK;
+ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
+UPDATE t1 SET f6='update';
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
+ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
+UPDATE t1 SET f6='cascade';
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL)
+DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result
index 1fcc89b165b..8ef2ac425fc 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug.result
@@ -17,3 +17,12 @@ ALTER TABLE t ADD FULLTEXT INDEX (b(64));
ERROR HY000: Unknown error
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t;
+CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk),
+FULLTEXT KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB;
+DROP TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+SET DEBUG_DBUG="+d,fts_instrument_sync";
+INSERT INTO t1 VALUES(1, "mariadb");
+ALTER TABLE t1 FORCE;
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result
new file mode 100644
index 00000000000..b3bc12f92cc
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result
@@ -0,0 +1,7 @@
+call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
+CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
+set debug_dbug="+d,fts_instrument_sync_request";
+INSERT INTO mdev21563 VALUES('This is a test');
+ALTER TABLE mdev21563 DISCARD TABLESPACE;
+DROP TABLE mdev21563;
diff --git a/mysql-test/suite/innodb_fts/r/stopword.result b/mysql-test/suite/innodb_fts/r/stopword.result
new file mode 100644
index 00000000000..82679cb71c4
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/stopword.result
@@ -0,0 +1,744 @@
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+select * from information_schema.innodb_ft_default_stopword;
+value
+a
+about
+an
+are
+as
+at
+be
+by
+com
+de
+en
+for
+from
+how
+i
+in
+is
+it
+la
+of
+on
+or
+that
+the
+this
+to
+was
+what
+when
+where
+who
+will
+with
+und
+the
+www
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
+SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
+SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
+set global innodb_ft_server_stopword_table = "not_defined";
+ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
+set global innodb_ft_server_stopword_table = NULL;
+create table user_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+drop index title on articles;
+create fulltext index idx on articles(title, body);
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+CREATE TABLE articles_2 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_2 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for stopwords this is it...
+insert into user_stopword values("this");
+CREATE TABLE articles_3 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_3 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+create table user_stopword_session(value varchar(30)) engine = innodb;
+insert into user_stopword_session values("session");
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+CREATE TABLE articles_4 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_4 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id title body
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for session stopwords this should also be excluded...
+connect con1,localhost,root,,;
+CREATE TABLE articles_5 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_5 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for session stopwords this should also be excluded...
+connection default;
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+id title body
+7 update the record to see will is indexed or not
+DELETE FROM articles WHERE id = 7;
+SET global innodb_ft_server_stopword_table = NULL;
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SET global innodb_ft_user_stopword_table = NULL;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+SELECT * FROM articles WHERE id = 8;
+id title body
+8 update the record to see will is indexed or not
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+id title body
+8 update the record to see will is indexed or not
+DELETE FROM articles WHERE id = 8;
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+ANALYZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles analyze status OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+1 MySQL from Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+2 when To Use MySQL Well After that you went through a ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+3 where will Optimizing MySQL In what tutorial we will show ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+9 the record will not index the , will words
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+9 the record will not index the , will words
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT COUNT(*),max(id) FROM articles;
+COUNT(*) max(id)
+7 9
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+9 update the record to see will is indexed or not
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+9 update the record to see will is indexed or not
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+id title body
+DROP TABLE articles;
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+insert into server_stopword values("what"),("where");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+DELETE FROM user_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+set session innodb_ft_user_stopword_table = default;
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+6 MySQL Security When configured properly, MySQL ...
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+"In connection 1"
+connection con1;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ANALYZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles analyze status OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+1 MySQL from Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+2 when To Use MySQL Well After that you went through a ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+3 where will Optimizing MySQL In what tutorial we will show ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+"In connection default"
+connection default;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+"In connection 1"
+connection con1;
+SET SESSION innodb_ft_enable_stopword = 1;
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+"In connection default"
+connection default;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+create table user_stopword_1(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id title body
+"In connection 1"
+connection con1;
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+create table server_stopword(value varchar(30)) engine = innodb;
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+insert into server_stopword values("when"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id title body
+disconnect con1;
+"In connection default"
+connection default;
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
diff --git a/mysql-test/suite/innodb_fts/r/sync.result b/mysql-test/suite/innodb_fts/r/sync.result
index 82959cfea96..4d28866ec82 100644
--- a/mysql-test/suite/innodb_fts/r/sync.result
+++ b/mysql-test/suite/innodb_fts/r/sync.result
@@ -99,17 +99,17 @@ SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash';
INSERT INTO t1(title) VALUES('mysql');
ERROR HY000: Lost connection to MySQL server during query
After restart
-SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
-FTS_DOC_ID title
-1 database
+SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
+title
+database
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
-SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
-FTS_DOC_ID title
-1 database
-2 mysql
+SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
+title
+database
+mysql
DROP TABLE t1;
# Case 4: Test sync commit & rollback in background
CREATE TABLE t1(
diff --git a/mysql-test/suite/innodb_fts/r/sync_block.result b/mysql-test/suite/innodb_fts/r/sync_block.result
index f9f695c42f4..65bee127e80 100644
--- a/mysql-test/suite/innodb_fts/r/sync_block.result
+++ b/mysql-test/suite/innodb_fts/r/sync_block.result
@@ -39,7 +39,7 @@ SLEEP(2)
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
sql_text
INSERT INTO t1(title) VALUES('mysql database')
-SET GLOBAL debug_dbug = @old_debug_dbug;
+SET GLOBAL debug_dbug = @old_debug;
TRUNCATE TABLE mysql.slow_log;
DROP TABLE t1;
# Case 2: Sync blocks DML(insert) on other tables.
@@ -71,7 +71,7 @@ SLEEP(2)
# slow log results should be empty here.
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
sql_text
-SET GLOBAL debug_dbug = @old_debug_dbug;
+SET GLOBAL debug_dbug = @old_debug;
TRUNCATE TABLE mysql.slow_log;
DROP TABLE t1,t2;
disconnect con1;
diff --git a/mysql-test/suite/innodb_fts/t/basic.test b/mysql-test/suite/innodb_fts/t/basic.test
index 0c0920c5f16..7a5c83ffb06 100644
--- a/mysql-test/suite/innodb_fts/t/basic.test
+++ b/mysql-test/suite/innodb_fts/t/basic.test
@@ -107,6 +107,26 @@ SELECT * FROM articles WHERE MATCH (title,body)
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+--error 128
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+
+--error ER_PARSE_ERROR
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+
# Test sub-expression boolean search. Find rows contain
# "MySQL" and "Well" or "MySQL" and "stands". But rank the
# doc with "Well" higher, and doc with "stands" lower.
diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test
index 77097d44dc5..35debd87cea 100644
--- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test
+++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test
@@ -29,6 +29,7 @@ CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES('mariadb');
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
SET DEBUG_SYNC= 'fts_instrument_sync_request
SIGNAL drop_index_start WAIT_FOR sync_op';
@@ -45,7 +46,7 @@ set DEBUG_SYNC= 'now SIGNAL fts_drop_index';
connection con1;
reap;
-SET global DEBUG_DBUG=RESET;
drop table t1, t2;
connection default;
set DEBUG_SYNC=RESET;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
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 10dc1462c98..cd292803fb3 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
@@ -270,3 +270,11 @@ SELECT * FROM articles WHERE MATCH (title, body)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
DROP TABLE articles;
+
+--echo #
+--echo # MDEV-22811 DDL fails to drop and re-create FTS index
+--echo #
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
+ f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
+ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
index 5b11a418dab..d1c6063d524 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
@@ -672,10 +672,16 @@ CREATE TABLE mdev20987_2(f1 INT NOT NULL, f2 CHAR(100),
FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB;
INSERT INTO mdev20987_1 VALUES(1);
INSERT INTO mdev20987_2 VALUES(1, 'mariadb');
+
+CREATE TABLE mdev22358 (a INT, b TEXT, FULLTEXT KEY ftidx (b)) ENGINE=InnoDB;
+ALTER TABLE mdev22358 DROP KEY ftidx;
+INSERT INTO mdev22358 (a) VALUES (2),(2);
+--error ER_DUP_ENTRY
+ALTER TABLE mdev22358 ADD UNIQUE KEY uidx (a), ADD FULLTEXT KEY ftidx (b);
--source include/restart_mysqld.inc
SHOW CREATE TABLE t2;
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
-DROP TABLE t1, t2, mdev20987_2, mdev20987_1;
+DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358;
--echo "----------Test28---------"
create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test
index 3c794ec6440..46b65590298 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test
@@ -889,4 +889,46 @@ DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+--echo #
+--echo # InnoDB: Failing assertion: result != FTS_INVALID in
+--echo # fts_trx_row_get_new_state
+--echo #
+SET FOREIGN_KEY_CHECKS=1;
+CREATE TABLE t1 (pk INT PRIMARY KEY,
+ f1 VARCHAR(10), f2 VARCHAR(10),
+ f3 VARCHAR(10), f4 VARCHAR(10),
+ f5 VARCHAR(10), f6 VARCHAR(10),
+ f7 VARCHAR(10), f8 VARCHAR(10),
+ FULLTEXT(f1), FULLTEXT(f2), FULLTEXT(f3), FULLTEXT(f4),
+ FULLTEXT(f5), FULLTEXT(f6), FULLTEXT(f7), FULLTEXT(f8),
+ INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4),
+ INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+ 'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+ (2, 'mariadb', 'mariadb', 'mariadb', 'mariadb',
+ 'mariadb', 'mariadb', 'mariadb', 'mariadb'),
+ (3, 'innodb', 'innodb', 'innodb', 'innodb',
+ 'innodb', 'innodb', 'innodb', 'innodb');
+ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL;
+START TRANSACTION;
+DELETE FROM t1 where f1='mariadb';
+SELECT * FROM t1;
+ROLLBACK;
+
+ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE;
+
+START TRANSACTION;
+DELETE FROM t1 where f3='mariadb';
+SELECT * FROM t1;
+ROLLBACK;
+
+ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL;
+--error ER_ROW_IS_REFERENCED_2
+UPDATE t1 SET f6='update';
+
+ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE;
+--error ER_ROW_IS_REFERENCED_2
+UPDATE t1 SET f6='cascade';
+DROP TABLE t1;
+
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test
index 4b32afb848c..aaf628abe6d 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug.test
@@ -39,3 +39,16 @@ ALTER TABLE t ADD FULLTEXT INDEX (b(64));
SET SESSION debug_dbug=@saved_debug_dbug;
DROP TABLE t;
+
+# MDEV-21550 Assertion `!table->fts->in_queue' failed in
+# fts_optimize_remove_table
+CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk),
+ FULLTEXT KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB;
+--error ER_ROW_IS_REFERENCED_2
+DROP TABLE t1;
+SET DEBUG_DBUG="+d,fts_instrument_sync";
+INSERT INTO t1 VALUES(1, "mariadb");
+ALTER TABLE t1 FORCE;
+# Cleanup
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test
new file mode 100644
index 00000000000..0a9e137dd80
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test
@@ -0,0 +1,12 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/not_embedded.inc
+call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
+
+CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
+set debug_dbug="+d,fts_instrument_sync_request";
+INSERT INTO mdev21563 VALUES('This is a test');
+ALTER TABLE mdev21563 DISCARD TABLESPACE;
+--source include/restart_mysqld.inc
+DROP TABLE mdev21563;
diff --git a/mysql-test/suite/innodb_fts/t/stopword.opt b/mysql-test/suite/innodb_fts/t/stopword.opt
new file mode 100644
index 00000000000..d6938c3b1ea
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/stopword.opt
@@ -0,0 +1 @@
+--innodb-ft-default-stopword
diff --git a/mysql-test/suite/innodb_fts/t/stopword.test b/mysql-test/suite/innodb_fts/t/stopword.test
new file mode 100644
index 00000000000..5105a6d2fec
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/stopword.test
@@ -0,0 +1,657 @@
+# This is the basic function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+
+select * from information_schema.innodb_ft_default_stopword;
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# "the" is in the default stopword, it would not be selected
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
+SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
+SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
+
+# Provide user defined stopword table, if not (correctly) defined,
+# it will be rejected
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_server_stopword_table = "not_defined";
+set global innodb_ft_server_stopword_table = NULL;
+
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+
+drop index title on articles;
+
+create fulltext index idx on articles(title, body);
+
+# Now we should be able to find "the"
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+# Nothing inserted into the default stopword, so essentially
+# nothing get screened. The new stopword could only be
+# effective for table created thereafter
+CREATE TABLE articles_2 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_2 (title, body)
+ VALUES ('test for stopwords','this is it...');
+
+# Now we can find record with "this"
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Ok, let's instantiate some value into user supplied stop word
+# table
+insert into user_stopword values("this");
+
+# Ok, let's repeat with the new table again.
+CREATE TABLE articles_3 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_3 (title, body)
+ VALUES ('test for stopwords','this is it...');
+
+# Now we should NOT find record with "this"
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Test session level stopword control "innodb_user_stopword_table"
+create table user_stopword_session(value varchar(30)) engine = innodb;
+
+insert into user_stopword_session values("session");
+
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+
+CREATE TABLE articles_4 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_4 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" is excluded
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+ AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+# But we can find record with "this"
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+--connect (con1,localhost,root,,)
+CREATE TABLE articles_5 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_5 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" should be found since the stopword table is session specific
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+ AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+--connection default
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+
+SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+# Behavior :
+# The stopword is loaded into memory at
+# 1) create fulltext index time,
+# 2) boot server,
+# 3) first time FTs is used
+# So if you already created a FTS index, and then turn off stopword
+# or change stopword table content it won't affect the FTS
+# that already created since the stopword list are already loaded.
+# It will only affect the new FTS index created after you changed
+# the settings.
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# Case : server_stopword=default
+# Try to Search default stopword from innodb, "where", "will", "what"
+# and "when" are all stopwords
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+# boolean No result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+# no result expected
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+# no result expected
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+DELETE FROM articles WHERE id = 7;
+
+
+
+# Case : Turn OFF stopword list variable and search stopword on OLD index.
+# disable stopword list
+SET global innodb_ft_server_stopword_table = NULL;
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+SET global innodb_ft_user_stopword_table = NULL;
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# No records expected even though we turned OFF stopwod filtering
+# (refer Behavior (at the top of the test) for explanation )
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+SELECT * FROM articles WHERE id = 8;
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+DELETE FROM articles WHERE id = 8;
+
+# Case : Turn OFF stopword list variable and search stopword on NEW index.
+# Drop index
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+
+# Create the FTS index Using Alter Table.
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+ANALYZE TABLE articles;
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# All records expected as stopwod filtering is OFF and we created
+# new FTS index.
+# (refer Behavior (at the top of the test) for explanation )
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Update will succeed.
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+
+SELECT COUNT(*),max(id) FROM articles;
+# Update the record - uncommet on fix
+#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+#WHERE id = 9;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will succeed.
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+
+
+DROP TABLE articles;
+
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into server supplied stop word table
+insert into server_stopword values("what"),("where");
+# Follwoing should return result as server stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Delete stopword from user list
+DELETE FROM user_stopword;
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# Follwoing should return result even though to server stopword list
+# conatin these words. Session level stopword list takes priority
+# Here user_stopword is set using innodb_ft_user_stopword_table
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Follwoing should return result as user stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Session level stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Make user stopword list deafult so as to server stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Defaults
+SET innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+
+# Drop existing index and create the FTS index Using Alter Table.
+# user stopword list will take effect.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = default;
+# Define a correct formated user stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# user stopword list take effect as its session level
+# Result expected for select
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+# set user stopword list
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+# user stopword list take affect as its session level
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Values
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+
+#------------------------------------------------------------------------------
+# FTS stopword list test - check varaibles across sessions
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+
+--echo "In connection 1"
+--connection con1
+select @@innodb_ft_enable_stopword;
+
+ANALYZE TABLE articles;
+
+# result expected as index created before setting innodb_ft_enable_stopword varaible off
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected turned innodb_ft_enable_stopword is ON
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+
+--echo "In connection default"
+--connection default
+select @@innodb_ft_enable_stopword;
+# no result expected as word not indexed from connection 1
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected as innodb_ft_user_stopword_table filter it
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+--echo "In connection default"
+--connection default
+# no result expected as innodb_ft_user_stopword_table filter it from connection1
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+select @@innodb_ft_user_stopword_table;
+# Define a correct formated user stopword table
+create table user_stopword_1(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+select @@innodb_ft_server_stopword_table;
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+insert into server_stopword values("when"),("the");
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo "In connection default"
+--connection default
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+
+
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+
+# Restore Values
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test
index 2ad5423d73b..6929dce31b8 100644
--- a/mysql-test/suite/innodb_fts/t/sync.test
+++ b/mysql-test/suite/innodb_fts/t/sync.test
@@ -123,7 +123,9 @@ INSERT INTO t1(title) VALUES('mysql');
--source include/start_mysqld.inc
-- echo After restart
-SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
+# PAGE_ROOT_AUTO_INC could contain last failed autoinc value. Avoid
+# doing show the result of auto increment field
+SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
SET @old_dbug = @@SESSION.debug_dbug;
@@ -133,7 +135,7 @@ INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
-SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
+SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/sync_block.test b/mysql-test/suite/innodb_fts/t/sync_block.test
index 1dd3c2bc38e..895d2ba8a59 100644
--- a/mysql-test/suite/innodb_fts/t/sync_block.test
+++ b/mysql-test/suite/innodb_fts/t/sync_block.test
@@ -61,7 +61,7 @@ SELECT SLEEP(2);
-- echo # slow log results should only contain INSERT INTO t1.
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
-SET GLOBAL debug_dbug = @old_debug_dbug;
+SET GLOBAL debug_dbug = @old_debug;
TRUNCATE TABLE mysql.slow_log;
DROP TABLE t1;
@@ -107,7 +107,7 @@ SELECT SLEEP(2);
-- echo # slow log results should be empty here.
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
-SET GLOBAL debug_dbug = @old_debug_dbug;
+SET GLOBAL debug_dbug = @old_debug;
TRUNCATE TABLE mysql.slow_log;
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb_gis/disabled.def b/mysql-test/suite/innodb_gis/disabled.def
index e486a70a0c6..8cae44a3607 100644
--- a/mysql-test/suite/innodb_gis/disabled.def
+++ b/mysql-test/suite/innodb_gis/disabled.def
@@ -10,9 +10,3 @@
#
##############################################################################
-gis_split_inf : MDEV-14057 InnoDB GIS tests fail
-rtree_multi_pk : MDEV-14057 InnoDB GIS tests fail
-point_big : MDEV-14057 InnoDB GIS tests fail
-geometry : MDEV-14057 InnoDB GIS tests fail
-bug16236208 : MDEV-14057 InnoDB GIS tests fail
-bug16266012 : MDEV-14057 InnoDB GIS tests fail
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index 05662d254e0..67ce2de26b2 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -998,7 +998,7 @@ ST_GEOMFROMTEXT(
SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
1
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\...'
DROP TABLE t1;
#
# Bug #49250 : spatial btree index corruption and crash
@@ -1038,9 +1038,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 `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' 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 `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' 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 e101c6142db..bef144e6072 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -269,7 +269,7 @@ c1 ST_Astext(c2) ST_Astext(c4)
9 POINT(120 120) POLYGON((4010 4010,4020 4020,4030 4030,4040 4030,4020 4010,4010 4010))
UPDATE tab SET c2 = ST_GeomFromText('POINT(4000 4000)')
WHERE MBRIntersects(tab.c4, @g1);
-ERROR 23000: Duplicate entry '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00@\xAF@\x' for key 'PRIMARY'
+ERROR 23000: Duplicate entry '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00@\xAF...' for key 'PRIMARY'
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c2) ST_Astext(c4)
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
diff --git a/mysql-test/suite/innodb_gis/r/bug16236208.result b/mysql-test/suite/innodb_gis/r/bug16236208.result
index a2b81e612a9..c7d4f3280bf 100644
--- a/mysql-test/suite/innodb_gis/r/bug16236208.result
+++ b/mysql-test/suite/innodb_gis/r/bug16236208.result
@@ -39,5 +39,5 @@ ST_WITHIN( ST_GeomFromText('POLYGON( ( 4135 3009 , 4914 3087 , 4236 3194 , 4091
ST_GeomFromText('MULTILINESTRING( ( 4147 2871 , 4072 3042 , 4081 3099 , 3796
3021 , 4007 3463 ) , ( 4042 2808 , 4109 2816 , 3730 3673 ) )') ,
linestring_key ) AND ST_Length( linestring_nokey ) > 1;
-ERROR 22023: Invalid GIS data provided to function st_within.
+ST_AsText(linestring_nokey)
DROP TABLE linestring;
diff --git a/mysql-test/suite/innodb_gis/r/bug16266012.result b/mysql-test/suite/innodb_gis/r/bug16266012.result
index 9e62563f752..99de5db5e12 100644
--- a/mysql-test/suite/innodb_gis/r/bug16266012.result
+++ b/mysql-test/suite/innodb_gis/r/bug16266012.result
@@ -6,4 +6,9 @@ MULTIPOLYGON( ( ( 0 0 , 7 1 , 6 8 , 0 0 ) ) , ( ( 9 9 , 4 0 , 4 7 , 9 9) ) )
') ) , ST_SYMDIFFERENCE( POLYGONFROMTEXT(' POLYGON( ( 9 9 , 6 5 , 2 3 , 9 9
) ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( ( 2 2 , 5 2 , 5 2 , 2 6 , 2
2 ) ) , ( ( 7 7 , 3 7 , 2 9 , 7 1 , 7 7 ) ) ) ') ) ) );
-ERROR HY000: Geometry overlay calculation error: geometry data is invalid in function st_union.
+ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
+4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
+POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
+MULTIPOLYGONFROMTEXT('
+MULTIPOLYGON( ( ( 0 0 , 7 1 , 6
+0
diff --git a/mysql-test/suite/innodb_gis/r/geometry.result b/mysql-test/suite/innodb_gis/r/geometry.result
index 780efc11bce..a54d41dc30a 100644
--- a/mysql-test/suite/innodb_gis/r/geometry.result
+++ b/mysql-test/suite/innodb_gis/r/geometry.result
@@ -99,9 +99,9 @@ fid ST_AsText(g)
110 POLYGON((0 0,30 0,30 30,0 0))
SELECT fid, ST_AsText(g) FROM gis_multi_point;
fid ST_AsText(g)
-111 MULTIPOINT((0 0),(10 10),(10 20),(20 20))
-112 MULTIPOINT((1 1),(11 11),(11 21),(21 21))
-113 MULTIPOINT((3 6),(4 10))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
SELECT fid, ST_AsText(g) FROM gis_multi_line;
fid ST_AsText(g)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
@@ -129,9 +129,9 @@ fid ST_AsText(g)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
-111 MULTIPOINT((0 0),(10 10),(10 20),(20 20))
-112 MULTIPOINT((1 1),(11 11),(11 21),(21 21))
-113 MULTIPOINT((3 6),(4 10))
+111 MULTIPOINT(0 0,10 10,10 20,20 20)
+112 MULTIPOINT(1 1,11 11,11 21,21 21)
+113 MULTIPOINT(3 6,4 10)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
@@ -178,62 +178,40 @@ CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ;
#check equality predicate on the index columns
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = <cache>(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx1 idx1 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx3 idx3 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab`.`c8`) AS `ST_AsText(c8)` from `test`.`tab` where (`test`.`tab`.`c3` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab ref idx3 idx3 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab const idx2 idx2 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
-#check range predicate on the index columns
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-ERROR HY000: Incorrect arguments to >=
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab const idx2 idx2 8 const 1 #
#check index with DELETE operation
EXPLAIN DELETE FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 DELETE tab NULL range idx2 idx2 8 const # 100.00 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab range idx2 idx2 8 NULL 1 #
#check the spatial values
SELECT ST_AsText(c1) FROM tab;
ST_AsText(c1)
@@ -246,7 +224,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -290,7 +268,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -334,7 +312,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -353,7 +331,7 @@ ALTER TABLE tab MODIFY COLUMN c1 BLOB;
SHOW CREATE TABLE tab;
Table Create Table
tab CREATE TABLE `tab` (
- `c1` blob,
+ `c1` blob DEFAULT NULL,
`c2` linestring DEFAULT NULL,
`c3` polygon DEFAULT NULL,
`c4` multipoint DEFAULT NULL,
@@ -441,7 +419,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -516,7 +494,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab2;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab2;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -556,6 +534,8 @@ LINESTRING(10 10,20 20,30 30) LINESTRING(10 10,20 20,30 30)
#check DELETE stmt with Where clause and a constant predicate
DELETE FROM tab
Where c8=c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x07\x00\x00\x00\x02\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00...'
#check the data, should 0
SELECT COUNT(*) FROM tab;
COUNT(*)
@@ -596,16 +576,29 @@ COUNT(ST_AsText(g))
SELECT SUM(ST_AsText(g)) FROM gis_point;
SUM(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)'
SELECT SUM(ST_AsText(g)) FROM gis_line;
SUM(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)'
SELECT AVG(ST_AsText(g)) FROM gis_polygon;
AVG(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))'
#here it show some string value no meaning
SELECT MAX(ST_AsText(g)) FROM gis_multi_point;
MAX(ST_AsText(g))
-MULTIPOINT((3 6),(4 10))
+MULTIPOINT(3 6,4 10)
#here it show some string value no meaning
SELECT MIN(ST_AsText(g)) FROM gis_multi_line;
MIN(ST_AsText(g))
@@ -613,12 +606,39 @@ MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
SELECT STD(ST_AsText(g)) FROM gis_multi_polygon;
STD(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))'
SELECT COUNT(ST_AsText(g)) FROM gis_geometrycollection;
COUNT(ST_AsText(g))
3
SELECT AVG(ST_AsText(g)) FROM gis_geometry;
AVG(ST_AsText(g))
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POINT(10 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(0 0,0 10,10 0)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,20 10,20 20,10 20,10 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'LINESTRING(10 10,40 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'POLYGON((0 0,30 0,30 30,0 0))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(0 0,10 10,10 20,20 20)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(1 1,11 11,11 21,21 21)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOINT(3 6,4 10)'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((10 48,10 21,10 0))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'MULTIPOLYGON(((0 3,3 3,3 0,0 3)))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(10 10),LINESTRING(10 10,20 20))'
+Warning 1292 Truncated incorrect DOUBLE value: 'GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))'
#check Datatypes with compression tables
CREATE TABLE tab3(c1 POINT,c2 LINESTRING,c3 POLYGON,C4 MULTIPOINT,c5 MULTILINESTRING ,
c6 MULTIPOLYGON,c7 GEOMETRYCOLLECTION ,c8 GEOMETRY) ENGINE=InnoDB
@@ -684,62 +704,40 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ;
#check equality predicate on the index columns
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 const idx2 idx2 8 const 1 #
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 NULL
-Warnings:
-Note 1003 /* select#1 */ select st_astext('
-#check range predicate on the index columns
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-ERROR HY000: Incorrect arguments to >=
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
-ERROR HY000: Incorrect arguments to >=
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 const idx2 idx2 8 const 1 #
#check index with DELETE operation
EXPLAIN DELETE FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 DELETE tab3 NULL range idx2 idx2 8 const # 100.00 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 range idx2 idx2 8 NULL 1 #
#check the spatial values
SELECT ST_AsText(c1) FROM tab3;
ST_AsText(c1)
@@ -752,7 +750,7 @@ ST_AsText(c3)
POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))
SELECT ST_AsText(c4) FROM tab3;
ST_AsText(c4)
-MULTIPOINT((0 0),(5 5),(10 10),(20 20))
+MULTIPOINT(0 0,5 5,10 10,20 20)
SELECT ST_AsText(c5) FROM tab3;
ST_AsText(c5)
MULTILINESTRING((1 1,2 2,3 3),(10 10,20 20,30 30))
@@ -786,17 +784,13 @@ tab3 CREATE TABLE `tab3` (
#check index with WKB function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)')));
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c2` = <cache>(st_geometryfromwkb(st_aswkb(st_geometryfromtext('LINESTRING(10 10,20 20,30 30)')))))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx1 idx1 8 const 1 #
#check index with WKT function
EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`tab3`.`c1`) AS `ST_ASText(c1)`,st_astext(`test`.`tab3`.`c2`) AS `ST_AsText(c2)`,st_astext(`test`.`tab3`.`c8`) AS `ST_AsText(c8)` from `test`.`tab3` where (`test`.`tab3`.`c3` = <cache>(st_geometryfromtext('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))')))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE tab3 ref idx3 idx3 8 const 1 #
#check the Geometry property functions
SELECT fid, ST_Dimension(g) FROM gis_geometry;
fid ST_Dimension(g)
@@ -872,13 +866,13 @@ fid ST_IsEmpty(g)
122 0
SELECT fid, ST_AsText(ST_Envelope(g)) FROM gis_geometry;
fid ST_AsText(ST_Envelope(g))
-101 POINT(10 10)
-102 POINT(20 10)
-103 POINT(20 20)
-104 POINT(10 20)
+101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+104 POLYGON((10 20,10 20,10 20,10 20,10 20))
105 POLYGON((0 0,10 0,10 10,0 10,0 0))
106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-107 LINESTRING(10 10,40 10)
+107 POLYGON((10 10,40 10,40 10,10 10,10 10))
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0))
110 POLYGON((0 0,30 0,30 30,0 30,0 0))
@@ -886,7 +880,7 @@ fid ST_AsText(ST_Envelope(g))
112 POLYGON((1 1,21 1,21 21,1 21,1 1))
113 POLYGON((3 6,4 6,4 10,3 10,3 6))
114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-115 LINESTRING(10 0,10 48)
+115 POLYGON((10 0,10 0,10 48,10 48,10 0))
116 POLYGON((1 2,21 2,21 8,1 8,1 2))
117 POLYGON((28 0,84 0,84 42,28 42,28 0))
118 POLYGON((28 0,84 0,84 42,28 42,28 0))
@@ -895,11 +889,10 @@ fid ST_AsText(ST_Envelope(g))
121 POLYGON((10 10,20 10,20 20,10 20,10 10))
122 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select ST_Dimension(g), ST_GeometryType(g), ST_IsEmpty(g), ST_AsText(ST_Envelope(g)) from gis_geometry;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_geometry NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 22 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
+Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `ST_Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `ST_GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `ST_IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `ST_AsText(ST_Envelope(g))` from `test`.`gis_geometry`
#check Geometry point functions
SELECT fid, ST_X(g) FROM gis_point;
fid ST_X(g)
@@ -914,11 +907,10 @@ fid ST_Y(g)
103 20
104 20
explain extended select ST_X(g),ST_Y(g) FROM gis_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
+Note 1003 select st_x(`test`.`gis_point`.`g`) AS `ST_X(g)`,st_y(`test`.`gis_point`.`g`) AS `ST_Y(g)` from `test`.`gis_point`
SELECT fid, ST_AsText(ST_StartPoint(g)) FROM gis_line;
fid ST_AsText(ST_StartPoint(g))
105 POINT(0 0)
@@ -951,11 +943,10 @@ fid ST_IsClosed(g)
107 0
explain extended select ST_AsText(ST_StartPoint(g)),ST_AsText(ST_EndPoint(g)),
ST_Length(g),ST_NumPoints(g),ST_AsText(ST_PointN(g, 2)),ST_IsClosed(g) FROM gis_line;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_line NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
+Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `ST_AsText(ST_EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `ST_Length(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `ST_NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `ST_AsText(ST_PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `ST_IsClosed(g)` from `test`.`gis_line`
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_polygon;
fid ST_AsText(ST_Centroid(g))
108 POINT(15 15)
@@ -983,11 +974,10 @@ fid ST_AsText(ST_InteriorRingN(g, 1))
110 NULL
explain extended select ST_AsText(ST_Centroid(g)),ST_Area(g),ST_AsText(ST_ExteriorRing(g)),
ST_NumInteriorRings(g),ST_AsText(ST_InteriorRingN(g, 1)) FROM gis_polygon;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_polygon NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
+Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `ST_Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `ST_AsText(ST_ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `ST_NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `ST_AsText(ST_InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, ST_IsClosed(g) FROM gis_multi_line;
fid ST_IsClosed(g)
114 0
@@ -995,8 +985,8 @@ fid ST_IsClosed(g)
116 0
SELECT fid, ST_AsText(ST_Centroid(g)) FROM gis_multi_polygon;
fid ST_AsText(ST_Centroid(g))
-117 POINT(57.98031067576927 17.854754130800437)
-118 POINT(57.98031067576927 17.854754130800437)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, ST_Area(g) FROM gis_multi_polygon;
fid ST_Area(g)
@@ -1024,11 +1014,10 @@ fid ST_NumGeometries(g)
121 2
122 2
explain extended SELECT fid, ST_NumGeometries(g) from gis_multi_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `ST_NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
fid ST_AsText(ST_GeometryN(g, 2))
111 POINT(10 10)
@@ -1055,11 +1044,10 @@ fid ST_AsText(ST_GeometryN(g, 1))
121 POINT(10 10)
122 POINT(44 6)
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL # 100.00 NULL
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 #
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
+Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `ST_AsText(ST_GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
@@ -1067,9 +1055,9 @@ MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 1 1 0
+120 121 0 0 0 0 0 1 1 1
120 122 0 0 1 0 0 0 1 0
-121 120 0 0 0 0 0 1 1 0
+121 120 0 0 0 0 0 1 1 1
121 121 1 1 0 1 0 0 1 0
121 122 0 0 0 0 1 0 0 0
122 120 0 0 1 0 0 0 1 0
@@ -1080,12 +1068,11 @@ MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE g1 NULL ALL NULL NULL NULL NULL # 100.00 Using temporary; Using filesort
-1 SIMPLE g2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (Block Nested Loop)
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE g1 ALL NULL NULL NULL NULL 3 # Using temporary; Using filesort
+1 SIMPLE g2 ALL NULL NULL NULL NULL 3 # Using join buffer (flat, BNL join)
Warnings:
-Warning 1681 'EXTENDED' is deprecated and will be removed in a future release.
-Note 1003 /* select#1 */ select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `first`,`second`
+Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,mbrwithin(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,mbrcontains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,mbrequals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
# check support of Foreign Key constraint
CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB;
CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY,
@@ -1093,7 +1080,7 @@ INDEX par_ind (parent_id(10)),
FOREIGN KEY (parent_id(10)) REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=INNODB;
-ERROR HY000: Cannot add foreign key constraint
+ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
#check partition table support
CREATE TABLE emp2(
id GEOMETRY NOT NULL,
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index a0729cd1150..33e0c1c0410 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -994,7 +994,7 @@ ST_GEOMFROMTEXT(
SELECT 1 FROM t1 WHERE a <> (SELECT ST_GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
1
Warnings:
-Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x06\x00\x00\x00\x01\x00\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\...'
DROP TABLE t1;
#
# Bug #49250 : spatial btree index corruption and crash
@@ -1034,9 +1034,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 `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' 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 `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' 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/gis_split_inf.result b/mysql-test/suite/innodb_gis/r/gis_split_inf.result
index 624c982b553..9e7bf69c0d0 100644
--- a/mysql-test/suite/innodb_gis/r/gis_split_inf.result
+++ b/mysql-test/suite/innodb_gis/r/gis_split_inf.result
@@ -1,18 +1,16 @@
create table t1(a geometrycollection not null,spatial key(a))engine=innodb;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-14,98), point(-14,98)), linestring(point(-97,64), point(-70,99), point(-97,64)), linestring(point(143851215403059150000000000000000000000.000000,13040009882500140000000000000000000000.000000), point(-73,85), point(-88,-29)))), multipolygon(polygon(linestring(point(41,95), point(4294967298,2050)), linestring(point(-61,85), point(-75,93), point(14,-2), point(1,84), point(-61,85)), linestring(point(-62,52), point(39,5), point(-18,12), point(-62,52))), polygon(linestring(point(-77,1), point(66,61), point(-77,1)), linestring(point(18446744073709551615,1125899906842622), point(-72,49), point(24,-66), point(82,73), point(68,22))), polygon(linestring(point(1048576,17179869181), point(-18,95), point(-90,-3), point(-33,82), point(20,-85)), linestring(point(-43,-97), point(-7,-3), point(39,-82), point(-65,-58), point(-43,-97)), linestring(point(44,-34), point(-69,58), point(44,-34)), linestring(point(57,-13), point(-17,74), point(57,-13)), linestring(point(3,71), point(-58,81), point(3,71)), linestring(point(9,25), point(77,-71), point(8388607,67108864), point(46,46), point(9,25)), linestring(point(98,-82), point(98,-82))))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(39,-60), point(-62,-11), point(-24,35), point(54,1)), linestring(point(-4,69), point(-22,-64), point(1.694824e+308,5.688896e+307), point(-33,-58), point(-64,-80), point(-15,-44), point(40,54)), linestring(point(-86,-54), point(11,41), point(-46,-38), point(-21,-8), point(10,70), point(-81,22), point(-46,-100)), linestring(point(-30,-48), point(50,58), point(-53,92), point(10,41), point(-46,-8)), linestring(point(-65,34), point(-92,93), point(-33,-74), point(75,-28)), linestring(point(25,-55), point(22,-10), point(-42,0), point(-86,-59), point(2,-37), point(63,-44), point(-55,-22)), linestring(point(28,0), point(-94,99), point(-32,-86)), linestring(point(9,-12), point(16,9), point(80,-73)), linestring(point(6,-55), point(83,-4)), linestring(point(-15,21), point(144115188075855876,16777212), point(-85,-31), point(-90,-50)), linestring(point(-33,33), point(21,90), point(-89,32)), linestring(point(16,24), point(73,-13), point(25,-48), point(71,52), point(-54,-78), point(-84,59), point(53,29)), linestring(point(-15,-81), point(83,43), point(-71,33), point(-8,0), point(84,-54), point(-35,38), point(-10,-50)), linestring(point(38,-50), point(20,-2), point(-57,-92)), linestring(point(5,-93), point(231601833467477080000000000000000000000.000000,51914987457169239000000000000000000000.000000), point(-94,62))), point(2,0)) ) ;
insert into t1(a) values( geometrycollection(multilinestring(linestring(point(80,-15), point(65,-57), point(-59,16), point(22,-67)), linestring(point(20,-55), point(-38,-64), point(19,-53), point(-63,-36), point(56,-37)), linestring(point(27,-8), point(-85,-75), point(4398046511106,2251799813685245)), linestring(point(45,32), point(-79,46))), multilinestring(linestring(point(8,-4), point(40,-38), point(100,95), point(5,-80), point(82,88)), linestring(point(-14,30), point(-94,51), point(-16,-29), point(37,-97), point(-26,92)), linestring(point(32,34), point(83,-23), point(-55,57), point(-15,90), point(32,-50), point(-20,-73), point(77,28)), linestring(point(4,88), point(87,74), point(-67,-58)), linestring(point(5.660747e+307,6.385657e+307), point(-58,-15), point(1.172095e+308,1.448533e+308)), linestring(point(-21,-37), point(-52,79), point(-16,-76), point(-65,-94), point(36,7), point(37,74), point(100,-57)), linestring(point(-23,-82), point(-73,23), point(18,-34)), linestring(point(20,-51), point(93,62), point(-65,84)), linestring(point(-48,31), point(-69,-96)), linestring(point(-5,78), point(10,-99), point(36,-33)), linestring(point(-84,55), point(96,1), point(-98,-29), point(-15,81), point(-27,-6), point(58,-32), point(54,-16)), linestring(point(2,5), point(2199023255553,8192)), linestring(point(12,-78), point(-97,-83)), linestring(point(-74,79), point(35,-56), point(50,95)), linestring(point(28,16), point(-39,-40), point(48,-3)), linestring(point(2199023255550,-65539), point(62,-25), point(94,-62)), linestring(point(-74,83), point(-18,75), point(91,17), point(-11,-48), point(30,100)), linestring(point(57,-13), point(88,-45)), linestring(point(20,-64), point(-37,13), point(20,35))), point(-3,-4)) ) ;
insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(point(-34,19), point(-25,92), point(61921390294166805000000000000000000000.000000,319674749161701840000000000000000000000.000000), point(56,50), point(-34,19)), linestring(point(-26,-58), point(99,-50), point(34,-20), point(-26,-58)), linestring(point(-42,45), point(-63,-7), point(5,-89), point(-97,36), point(-42,45)), linestring(point(94,11), point(-71,4), point(94,11)), linestring(point(16,25), point(4,-33), point(-45,-33), point(-64,-77), point(16,25)), linestring(point(19,45), point(36,45), point(-83,-96), point(19,45)), linestring(point(85,-31), point(-87,52), point(85,-31))), polygon(linestring(point(55,-88), point(63,-12), point(55,-88)), linestring(point(-49,10), point(-49,10)), linestring(point(-51,-32), point(-51,-32)))), multipolygon(polygon(linestring(point(-21,-8), point(66,-58), point(100,-27), point(-21,-8)), linestring(point(-29,-13), point(-29,-13))), polygon(linestring(point(91307574660224730000000000000000000000.000000,101214152547755520000000000000000000000.000000), point(89,64), point(77,87), point(66,29), point(-71,-53)), linestring(point(38,-78), point(-43,-90), point(37,20), point(81,65), point(38,-78))), polygon(linestring(point(51,0), point(-62,8), point(-11,22), point(51,0)), linestring(point(-4,-44), point(6,82), point(-19,-90), point(131,32)))), point(-4,-7)) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
-insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ;
insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ;
-ERROR 22023: Invalid GIS data provided to function polygon.
+Got one of the listed errors
insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(99,-87), point(38,-79), point(33,-39), point(-91,-8), point(46,-87))) ) ;
insert into t1 select * from t1;
insert into t1 select * from 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 2450da8a811..82e7cb84275 100644
--- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
+++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result
@@ -1576,13 +1576,13 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
COUNT(*)
1
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
COUNT(*)
1
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result
index 093b63e5b02..ac9deef2cfd 100644
--- a/mysql-test/suite/innodb_gis/r/point_basic.result
+++ b/mysql-test/suite/innodb_gis/r/point_basic.result
@@ -144,7 +144,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
# Drop spatial keys on the table
ALTER TABLE t1 DROP KEY p, DROP KEY p1;
@@ -170,7 +169,6 @@ POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 20)
POINT(0 0) POINT(10 20)
TRUNCATE t1;
ALTER TABLE t1 DROP COLUMN p, DROP COLUMN p1;
@@ -203,10 +201,8 @@ SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('
ST_AsText(p) ST_AsText(p1)
POINT(0 1) POINT(10 19)
POINT(1 1) POINT(10 20)
-POINT(1 0) POINT(10 21)
SELECT ST_AsText(p), ST_AsText(p1) FROM t1 WHERE MBRWithin(p, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))'));
ST_AsText(p) ST_AsText(p1)
-POINT(1 0) POINT(10 21)
POINT(0 0) POINT(10 22)
ALTER TABLE t1 DROP COLUMN p1, ADD COLUMN p1 POINT, CHANGE COLUMN p pp POINT AFTER p1;
SELECT name, mtype, prtype, len FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE name = 'pp' OR name = 'g' OR name = 'p1';
@@ -234,14 +230,9 @@ SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE p1 = ST_PointFromText('POINT(1
ST_AsText(pp) ST_AsText(p1)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(p1, ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
-POINT(0 0) POINT(5 5)
-POINT(0 1) POINT(5 5)
-POINT(1 0) POINT(5 5)
-POINT(1 1) POINT(5 5)
SELECT ST_AsText(pp), ST_AsText(p1) FROM t1 WHERE MBRWithin(pp, ST_GeomFromText('POLYGON((-1 0.5, -1 -0.5, 1 -0.5, 1 0.5, -1 0.5))')) ORDER BY pp;
ST_AsText(pp) ST_AsText(p1)
POINT(0 0) POINT(5 5)
-POINT(1 0) POINT(5 5)
DROP TABLE t1;
#
# Test when the POINT is on B-TREE
@@ -477,10 +468,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point1 WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
@@ -509,6 +498,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
+POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
@@ -558,10 +548,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -684,10 +672,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point1 WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -769,10 +755,8 @@ ST_AsText(p1)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2);
ST_AsText(p2)
POINT(-1 -3)
@@ -801,6 +785,7 @@ POINT(10 21)
POINT(20.5 41)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly);
ST_AsText(p1)
+POINT(3 6)
# Check functions that use MBR, with line type data
SELECT ST_AsText(p1) FROM gis_point WHERE MBRIntersects(p1, @ls1);
ST_AsText(p1)
@@ -850,10 +835,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -976,10 +959,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -1091,10 +1072,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
@@ -1217,10 +1196,8 @@ POINT(4 8)
POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE MBRWithin(p1, @poly1);
ST_AsText(p1)
-POINT(2 4)
POINT(3 6)
POINT(4 8)
-POINT(5 10)
SELECT ST_AsText(p1) FROM gis_point WHERE ST_Touches(p1, @poly1);
ST_AsText(p1)
POINT(2 4)
diff --git a/mysql-test/suite/innodb_gis/r/point_big.result b/mysql-test/suite/innodb_gis/r/point_big.result
index de3632994a0..c471ab6adb2 100644
--- a/mysql-test/suite/innodb_gis/r/point_big.result
+++ b/mysql-test/suite/innodb_gis/r/point_big.result
@@ -259,10 +259,8 @@ INSERT INTO gis_point VALUES
(ST_PointFromText('POINT(32.1234 64.2468)'), ST_PointFromText('POINT(-1 -1)'));
'The ORDER BY for spatial index will use filesort'
EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # 100.00 Using filesort
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`gis_point`.`p1`) AS `ST_AsText(p1)`,st_astext(`test`.`gis_point`.`p2`) AS `ST_AsText(p2)` from `test`.`gis_point` order by `test`.`gis_point`.`p1`,`test`.`gis_point`.`p2`
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE gis_point ALL NULL NULL NULL NULL 13 #
SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2;
ST_AsText(p1) ST_AsText(p2)
POINT(2 4) POINT(-2 -6)
@@ -354,9 +352,11 @@ COUNT(*) ST_AsText(p1)
1024 POINT(4 8)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2;
COUNT(*) ST_AsText(p2)
+1024 POINT(0 0)
1024 POINT(-2 -6)
1024 POINT(-3 -9)
1024 POINT(-4 -12)
+1024 POINT(-5 -15)
1024 POINT(-1 -3)
1024 POINT(-1 -1)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2;
@@ -368,13 +368,17 @@ COUNT(*) ST_AsText(p1)
1024 POINT(32.1234 64.2468)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
+1024 POINT(3 6) POINT(-3 -9)
1024 POINT(4 8) POINT(-4 -12)
1024 POINT(5 10) POINT(-5 -15)
1024 POINT(6 12) POINT(-6 -18)
1024 POINT(7 14) POINT(-7 -21)
+1024 POINT(8 16) POINT(0 0)
+1024 POINT(10 21) POINT(-6 3)
1024 POINT(20.5 41) POINT(-8 4)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
+1024 POINT(3 6) POINT(-3 -9)
======================================================================
Build another new table with the same schema, will insert data from this table to the orignal one
======================================================================
@@ -522,9 +526,11 @@ COUNT(*) ST_AsText(p1)
1024 POINT(4 8)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@poly2, p2) GROUP BY p2;
COUNT(*) ST_AsText(p2)
+2 POINT(0 0)
1024 POINT(-2 -6)
1024 POINT(-3 -9)
1024 POINT(-4 -12)
+1024 POINT(-5 -15)
1024 POINT(-1 -3)
1024 POINT(-1 -1)
SELECT COUNT(*), ST_AsText(p2) FROM gis_point WHERE ST_Equals(p2, @p1) GROUP BY p2;
@@ -536,13 +542,17 @@ COUNT(*) ST_AsText(p1)
1024 POINT(32.1234 64.2468)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
+1024 POINT(3 6) POINT(-3 -9)
1024 POINT(4 8) POINT(-4 -12)
1024 POINT(5 10) POINT(-5 -15)
1024 POINT(6 12) POINT(-6 -18)
1024 POINT(7 14) POINT(-7 -21)
+2 POINT(8 16) POINT(0 0)
+1024 POINT(10 21) POINT(-6 3)
1024 POINT(20.5 41) POINT(-8 4)
SELECT COUNT(*), ST_AsText(p1), ST_AsText(p2) FROM gis_point WHERE ST_Contains(@mpoly, p1) AND NOT MBRWithin(p1, @mpoly) GROUP BY p1, p2;
COUNT(*) ST_AsText(p1) ST_AsText(p2)
+1024 POINT(3 6) POINT(-3 -9)
CHECK TABLE gis_point;
Table Op Msg_type Msg_text
test.gis_point check status OK
diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result
index d6604314909..de9067b428b 100644
--- a/mysql-test/suite/innodb_gis/r/rtree.result
+++ b/mysql-test/suite/innodb_gis/r/rtree.result
@@ -15,7 +15,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
-POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -23,6 +22,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -32,6 +32,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
@@ -159,7 +160,6 @@ select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
POINT(1.5 1.5)
-POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -167,6 +167,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -176,6 +177,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
+POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result b/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result
index 9c5db3e06aa..f5a337ecd03 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_concurrent_srch.result
@@ -234,7 +234,7 @@ start transaction;
set @g1 = ST_GeomFromText('Polygon((800 800, 800 1000, 1000 1000, 1000 800, 800 800))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);
count(*)
-201
+199
connection b;
CALL insert_t1(1001, 2000);
set session transaction isolation level serializable;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_debug.result b/mysql-test/suite/innodb_gis/r/rtree_debug.result
index 11e2cd40e25..e8d2418af57 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_debug.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_debug.result
@@ -42,7 +42,7 @@ SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,row_merge_ins_spatial_fail';
create spatial index idx2 on t1(c2);
ERROR HY000: Got error 1000 "Unknown error 1000" from storage engine InnoDB
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
index 11cf8ad91c1..83fd0c3e849 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result
@@ -9,10 +9,8 @@ Table Op Msg_type Msg_text
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);
-id select_type table partitions type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where
-Warnings:
-Note 1003 /* select#1 */ select st_astext(`test`.`t1`.`g`) AS `ST_astext(t1.g)` from `test`.`t1` where mbrwithin(`test`.`t1`.`g`,(@`g1`))
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
POINT(1 1)
@@ -97,18 +95,6 @@ left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
name ST_AsText(square)
big POLYGON((0 0,0 3,3 3,3 0,0 0))
-SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
-SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
-ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
MBRoverlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
@@ -140,7 +126,7 @@ alter table t1 drop primary key;
create spatial index idx on t1(g) algorithm=inplace;
create spatial index idx2 on t1(g);
Warnings:
-Warning 1831 Duplicate index 'idx2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
+Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
alter table t1 add primary key(i), algorithm=inplace;
show create table t1;
Table Create Table
diff --git a/mysql-test/suite/innodb_gis/r/rtree_search.result b/mysql-test/suite/innodb_gis/r/rtree_search.result
index d186986156e..d8a8d209cd3 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_search.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_search.result
@@ -14,19 +14,19 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((0 0,0 1000,1000 1000,1000 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-1000
+999
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-100
+99
set @g1 = ST_GeomFromText('Polygon((10 10,10 800,800 800,800 10,10 10))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-791
+789
set @g1 = ST_GeomFromText('Polygon((100 100,100 800,800 800,800 100,100 100))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-701
+699
set @g1 = ST_GeomFromText('Point(1 1)');
select count(*) from t1 where MBRequals(t1.c2, @g1);
count(*)
diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result
index 65a9ff3499f..df88960ba3d 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_split.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_split.result
@@ -1,52 +1,24 @@
create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb;
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-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;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET @saved_dbug = @@SESSION.debug_dbug;
-SET debug_dbug = '+d, rtr_page_need_second_split';
-insert into t1 select * from t1;
+SET debug_dbug = '+d,rtr_page_need_second_split';
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET debug_dbug = @saved_dbug;
-delete from t1;
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-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;
-start transaction;
-insert into t1 select * from t1;
+rollback;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
rollback;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-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 @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_71424;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -79,7 +51,7 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-65536
+57344
set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
@@ -87,5 +59,5 @@ count(*)
set @g1 = ST_GeomFromText('Polygon((2 2,2 800,800 800,800 2,2 2))');
select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
-65536
+57344
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/t/bug16236208.test b/mysql-test/suite/innodb_gis/t/bug16236208.test
index ef2da6f2ab1..b55ab1d0fd3 100644
--- a/mysql-test/suite/innodb_gis/t/bug16236208.test
+++ b/mysql-test/suite/innodb_gis/t/bug16236208.test
@@ -47,7 +47,7 @@ ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'));
CREATE INDEX linestring_index ON linestring(linestring_nokey(5));
ALTER TABLE linestring ADD KEY (linestring_key(5));
---error ER_GIS_INVALID_DATA
+# --error ER_GIS_INVALID_DATA
SELECT ST_AsText(linestring_nokey) FROM linestring FORCE KEY (
linestring_key ) WHERE ST_CONTAINS( ST_GeomFromText('POLYGON( ( 3923 2815 , 4246
2122 , 4028 2971 , 4017 3019 , 3923 2815 ) )') , linestring_key ) AND
diff --git a/mysql-test/suite/innodb_gis/t/bug16266012.test b/mysql-test/suite/innodb_gis/t/bug16266012.test
index 17986998fc9..6d72e4733c0 100644
--- a/mysql-test/suite/innodb_gis/t/bug16266012.test
+++ b/mysql-test/suite/innodb_gis/t/bug16266012.test
@@ -6,7 +6,7 @@
--source include/have_geometry.inc
--source include/not_embedded.inc
--source include/have_debug.inc
---error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
+# --error ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
SELECT ST_WITHIN( LINESTRINGFROMTEXT(' LINESTRING( 5 9 , 3 4 , 4 1 , 4
4 , 4 9 ) ') , ST_SYMDIFFERENCE( ST_UNION( ST_ENVELOPE( POLYGONFROMTEXT('
POLYGON( ( 3 2 , 0 6 , 2 3 , 8 0 , 4 6 , 7 2 , 3 2 ) ) ') ) ,
diff --git a/mysql-test/suite/innodb_gis/t/geometry.test b/mysql-test/suite/innodb_gis/t/geometry.test
index 2d030f90dc9..8325cc5a27c 100644
--- a/mysql-test/suite/innodb_gis/t/geometry.test
+++ b/mysql-test/suite/innodb_gis/t/geometry.test
@@ -10,6 +10,7 @@
#********************************************************
--source include/have_geometry.inc
--source include/have_innodb.inc
+--source include/have_partition.inc
SET default_storage_engine=InnoDB;
SET innodb_strict_mode=OFF;
@@ -162,21 +163,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
---echo #check range predicate on the index columns
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
+#--echo #check range predicate on the index columns
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
+#
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
+#
+#--replace_column 10 #
+#--error ER_WRONG_ARGUMENTS
+#EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab
+#WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation
--replace_column 10 #
@@ -518,21 +519,21 @@ EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8)
FROM tab3
WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))')));
---echo #check range predicate on the index columns
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
-
---replace_column 10 #
---error ER_WRONG_ARGUMENTS
-EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
-WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
+# --echo #check range predicate on the index columns
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c2>=ST_LineFromText('LINESTRING(10 10,20 20,30 30)');
+#
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c3>=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))');
+
+# --replace_column 10 #
+# --error ER_WRONG_ARGUMENTS
+# EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3
+# WHERE c8>=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))');
--echo #check index with DELETE operation
--replace_column 10 #
@@ -638,7 +639,7 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
--echo # check support of Foreign Key constraint
CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB;
---error 1215
+--error ER_CANT_CREATE_TABLE
CREATE TABLE child (id GEOMETRY, parent_id GEOMETRY,
INDEX par_ind (parent_id(10)),
FOREIGN KEY (parent_id(10)) REFERENCES parent(id)
@@ -675,7 +676,7 @@ SELECT COUNT(*) FROM tab3;
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point;
DROP TABLE gis_multi_line, gis_multi_polygon;
DROP TABLE gis_geometrycollection, gis_geometry;
-DROP TABLE tab,tab2,tab3,parent,emp2;
+DROP TABLE tab,tab2,tab3,parent;
DROP PROCEDURE geominout;
DROP PROCEDURE geom_insert;
DROP PROCEDURE geom_cursor;
diff --git a/mysql-test/suite/innodb_gis/t/gis_split_inf.test b/mysql-test/suite/innodb_gis/t/gis_split_inf.test
index e1b2d4e5947..addd2dbdbff 100644
--- a/mysql-test/suite/innodb_gis/t/gis_split_inf.test
+++ b/mysql-test/suite/innodb_gis/t/gis_split_inf.test
@@ -12,8 +12,6 @@ insert into t1(a) values( geometrycollection(multipolygon(polygon(linestring(
insert into t1(a) values( geometrycollection(point(10,9), linestring(point(2305843009213693955,-1125899906842621), point(78,15)), multipoint(point(-1,3), point(4,-6))) ) ;
--error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
insert into t1(a) values( geometrycollection(polygon(linestring(point(0,13), point(-12,5), point(0,13)), linestring(point(11,-2), point(6,6), point(20,-14), point(-3,-10), point(1.330588e+308,2.666476e+307)), linestring(point(16382,67), point(7,4)), linestring(point(2,7), point(-14,15), point(2,7)), linestring(point(-14,12), point(-8,-8), point(-17,-2), point(-14,12)), linestring(point(-20,-10), point(-8,-13), point(-19,-17), point(13,-3), point(-20,-10)), linestring(point(-5,13), point(7,-9), point(6,8), point(-5,13))), linestring(point(-87,19), point(-64,51), point(-16,12)), multipoint(point(-1,-10), point(2,-10), point(3.670354e+307,2.501459e+307))) ) ;
---error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
-insert into t1(a) values( geometrycollection(multipoint(point(-3,7), point(4,-3), point(-6,-2), point(-9,1)), polygon(linestring(point(-17,-5), point(2,-8), point(-6,9), point(-9,19), point(-17,-5)), linestring(point(10,-1), point(15,-7), point(-13,6), point(10,-1))), multipolygon(polygon(linestring(point(69,-69), point(-90,-64), point(-17,4), point(47,-73), point(69,-69)), linestring(point(-35,-77), point(-35,-77)), linestring(point(95,-76), point(1.636688e+308,1.828723e+307), point(68719476740,536870916), point(95,-76)), linestring(point(-26,-85), point(-26,-85)), linestring(point(-53,57), point(-53,57)), linestring(point(-98,-64), point(79,-57), point(-98,-64)), linestring(point(-91,59), point(16,0), point(73,97), point(-35,-70), point(-91,59))))) ) ;
insert into t1(a) values( geometrycollection(linestring(point(85,-29), point(15,84), point(39,-92), point(-99,19)), multilinestring(linestring(point(63,10), point(-47,95), point(10,-49), point(16,-65), point(-98,40), point(25,44), point(-55,-92)), linestring(point(5.266810e+307,6.648813e+307), point(47,33), point(-15,-13), point(-92,-58), point(36,73)), linestring(point(77,-56), point(-53,-10), point(-28,76), point(-51,6), point(51,-31), point(-95,81), point(92,26)), linestring(point(-91,7), point(58,53)), linestring(point(18,5), point(18,40), point(71,89), point(7.898707e+307,1.202585e+308), point(53,100)), linestring(point(-60,-18), point(-10,-31), point(-6,-25), point(-57,-95), point(16,77)))) ) ;
--error ER_GIS_INVALID_DATA,ER_BAD_NULL_ERROR
insert into t1(a) values( geometrycollection(polygon(linestring(point(-9,0), point(-17,-15), point(-9,0)), linestring(point(-11,1), point(18,12), point(15,3), point(7,0), point(-11,1)), linestring(point(19,5), point(19,5)), linestring(point(17,-11), point(8,4), point(17,-11)), linestring(point(14914539334033432000000000000000000000.000000,127247994336690690000000000000000000000.000000), point(-14,-7), point(13,-2))), point(-4,-7), polygon(linestring(point(-18,9), point(11,-1), point(-18,9)), linestring(point(9,-3), point(9,-3)), linestring(point(-7,-9), point(9,-11), point(11,14), point(1.663324e+308,1.572127e+308)), linestring(point(-15,4), point(18,12), point(7,2), point(-15,4)), linestring(point(-15,-18), point(-20,-15), point(1152921504606846972,34359738370))), polygon(linestring(point(-5,-19), point(-11,11), point(10,5), point(-7,13), point(-5,-19)), linestring(point(-8,-6), point(-4,16), point(-8,-6)), linestring(point(-6,-10), point(3,-12), point(-6,-10)), linestring(point(-16,1), point(20,-12), point(-16,1)), linestring(point(-8,5), point(-20,-4), point(4,1), point(-6,-6), point(-8,5)), linestring(point(-8,-11), point(-5,-14), point(-8,-11)), linestring(point(3,-16), point(-15,-13), point(1.166708e+308,1.901147e+307), point(-8,6), point(3,-16))), point(0,-5)) ) ;
@@ -22,5 +20,8 @@ insert into t1(a) values( geometrycollection(linestring(point(-33,99), point(
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;
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_debug.test b/mysql-test/suite/innodb_gis/t/rtree_debug.test
index 2f7c2806c68..580f3cf48a1 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_debug.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_debug.test
@@ -53,7 +53,7 @@ SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,row_merge_ins_spatial_fail';
--error ER_GET_ERRNO
create spatial index idx2 on t1(c2);
-SET debug_dbug = @save_dbug;
+SET @@SESSION.debug_dbug = @save_dbug;
show create table t1;
# Check table.
diff --git a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
index 928b1878e69..f606e569376 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_multi_pk.test
@@ -75,19 +75,6 @@ SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
# MBROverlaps needs a few more tests, with point and line dimensions
---error ER_GIS_INVALID_DATA
-SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
---error ER_GIS_INVALID_DATA
-SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
---error ER_GIS_INVALID_DATA
-SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
---error ER_GIS_INVALID_DATA
-SET @horiz3 = ST_GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
---error ER_GIS_INVALID_DATA
-SET @point1 = ST_GeomFromText('POLYGON ((0 0))');
---error ER_GIS_INVALID_DATA
-SET @point2 = ST_GeomFromText('POLYGON ((-2 0))');
-
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @vert1) GROUP BY a1.name;
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS MBRoverlaps FROM t1 a1 WHERE MBROverlaps(a1.square, @horiz1) GROUP BY a1.name;
SELECT MBROverlaps(@horiz1, @vert1) FROM DUAL;
diff --git a/mysql-test/suite/innodb_gis/t/rtree_rollback1.test b/mysql-test/suite/innodb_gis/t/rtree_rollback1.test
index 123bccf76a1..3dea75bc026 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_rollback1.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_rollback1.test
@@ -1,9 +1,6 @@
# WL#6745 InnoDB R-tree support
# This test case will test R-tree split.
-# Not supported in embedded
---source include/not_embedded.inc
-
--source include/have_innodb.inc
--source include/big_test.inc
--source include/not_valgrind.inc
diff --git a/mysql-test/suite/innodb_gis/t/rtree_rollback2.test b/mysql-test/suite/innodb_gis/t/rtree_rollback2.test
index cddbaf5592d..78b251bd696 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_rollback2.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_rollback2.test
@@ -1,9 +1,6 @@
# WL#6745 InnoDB R-tree support
# This test case will test R-tree split.
-# Not supported in embedded
---source include/not_embedded.inc
-
--source include/have_innodb.inc
--source include/big_test.inc
--source include/not_valgrind.inc
diff --git a/mysql-test/suite/innodb_gis/t/rtree_split.test b/mysql-test/suite/innodb_gis/t/rtree_split.test
index caf79becbd0..af626dba6b7 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_split.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_split.test
@@ -1,5 +1,5 @@
# WL#6745 InnoDB R-tree support
-# This test case will test R-tree split, mostly on duplciate records.
+# This test case will test R-tree split, mostly on duplicate records.
# Not supported in embedded
--source include/not_embedded.inc
@@ -8,65 +8,33 @@
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/have_debug.inc
+--source include/have_sequence.inc
# Create table with R-tree index.
create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb;
+begin;
# Insert enough values to let R-tree split.
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-
-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 @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
#Check second round spliting.
SET @saved_dbug = @@SESSION.debug_dbug;
-SET debug_dbug = '+d, rtr_page_need_second_split';
-insert into t1 select * from t1;
+SET debug_dbug = '+d,rtr_page_need_second_split';
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET debug_dbug = @saved_dbug;
+rollback;
-delete from t1;
-
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-
-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;
-start transaction;
-insert into t1 select * from t1;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
rollback;
check table 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 @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_71424;
check table t1;
select count(*) from t1;
diff --git a/mysql-test/suite/innodb_zip/r/cmp_per_index.result b/mysql-test/suite/innodb_zip/r/cmp_per_index.result
index cdb81e7be8a..b4e34040630 100644
--- a/mysql-test/suite/innodb_zip/r/cmp_per_index.result
+++ b/mysql-test/suite/innodb_zip/r/cmp_per_index.result
@@ -1,3 +1,4 @@
+SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SELECT * FROM information_schema.innodb_cmp_per_index;
CREATE TABLE t (
@@ -70,33 +71,5 @@ index_name PRIMARY
compress_ops 65
compress_ops_ok 65
uncompress_ops 0
-SHOW CREATE TABLE t;
-Table t
-Create Table CREATE TABLE `t` (
- `a` int(11) NOT NULL,
- `b` varchar(512) DEFAULT NULL,
- `c` varchar(16) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
-SET GLOBAL innodb_cmp_per_index_enabled=ON;
-SELECT COUNT(*) FROM t IGNORE INDEX(b);
-COUNT(*) 128
-SELECT
-database_name,
-table_name,
-index_name,
-compress_ops,
-compress_ops_ok,
-CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
-ELSE uncompress_ops END as uncompress_ops
-FROM information_schema.innodb_cmp_per_index
-ORDER BY 1, 2, 3;
-database_name test
-table_name t
-index_name PRIMARY
-compress_ops 0
-compress_ops_ok 0
-uncompress_ops 4
DROP TABLE t;
-SET GLOBAL innodb_cmp_per_index_enabled=default;
+SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
index 92a5cd51c8b..6cb0b09dee0 100644
--- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
+++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
@@ -1092,7 +1092,7 @@ col_1_varchar = REPEAT("c", 4000)
ALTER TABLE worklog5743 ADD PRIMARY KEY (col_1_varchar(3072));
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000));
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000));
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for key 'PRIMARY'
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' for key 'PRIMARY'
DELETE FROM worklog5743 WHERE col_1_varchar = REPEAT("b", 4000);
SELECT col_1_varchar = REPEAT("c", 4000) FROM worklog5743;
col_1_varchar = REPEAT("c", 4000)
@@ -1123,7 +1123,7 @@ ALTER TABLE worklog5743 ADD PRIMARY KEY (col_1_varchar(3072));
CREATE INDEX prefix_idx ON worklog5743(col_1_varchar (3072));
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000));
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000),REPEAT("o", 4000));
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for key 'PRIMARY'
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' for key 'PRIMARY'
DELETE FROM worklog5743 WHERE col_1_varchar = REPEAT("b", 4000);
SELECT col_1_varchar = REPEAT("c", 4000) FROM worklog5743;
col_1_varchar = REPEAT("c", 4000)
@@ -1387,7 +1387,7 @@ REPEAT("o", 4000));
INSERT INTO worklog5743
VALUES(concat(REPEAT("a", 2000),REPEAT("b", 2000)), REPEAT("o", 4000));
ALTER TABLE worklog5743 ADD PRIMARY KEY `pk_idx` (col_1_varchar(3000));
-ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for key 'PRIMARY'
+ERROR 23000: Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' for key 'PRIMARY'
DROP TABLE worklog5743;
set global innodb_large_prefix=0;
Warnings:
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..4036640d3d3 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result
@@ -1,53 +1,52 @@
-call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
-call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
-call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded\\.");
+call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue\\.");
+call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file");
call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x");
FLUSH TABLES;
SET SESSION innodb_strict_mode=1;
-CREATE DATABASE test_wl5522;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-INSERT INTO test_wl5522.t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Lost connection to MySQL server during query
unlink: t1.ibd
unlink: t1.cfg
# Restart and reconnect to the server
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET SESSION innodb_strict_mode=1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
Table Op Msg_type Msg_text
-test_wl5522.t1 check status OK
-SELECT COUNT(*) FROM test_wl5522.t1;
+test.t1 check status OK
+SELECT COUNT(*) FROM t1;
COUNT(*)
4
-INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
-SELECT * FROM test_wl5522.t1;
+INSERT INTO t1 VALUES(400), (500), (600);
+SELECT * FROM t1;
c1
1
2
@@ -56,65 +55,65 @@ c1
400
500
600
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_import_internal_error";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Internal error: While updating the <space, root page number> of index GEN_CLUST_INDEX - Generic error
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+ALTER TABLE t1 IMPORT TABLESPACE;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Too many concurrent transactions
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Too many concurrent transactions
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug=@saved_debug_dbug;
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 44 't1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 44 'Tablespace not found' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_cluster_root_adjust_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_cluster_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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_sec_root_adjust_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE 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;
+ALTER TABLE 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 (
+DROP TABLE t1;
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -129,35 +128,30 @@ connection default;
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
-INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
-(1, REPEAT('a', 2048), REPEAT('a', 2048)),
-(2, REPEAT('b', 2048), REPEAT('b', 2048)),
-(3, REPEAT('c', 2048), REPEAT('c', 2048)),
-(4, REPEAT('d', 2048), REPEAT('d', 2048));
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-DELETE FROM test_wl5522.t1 WHERE c2 = 1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
-UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
-SHOW CREATE TABLE test_wl5522.t1;
+INSERT INTO t1
+SELECT 1 + seq, 1 + (seq MOD 4),
+REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048),
+REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048)
+FROM seq_0_to_127;
+DELETE FROM t1 WHERE c2 = 1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c3 = REPEAT("c2", 1024);
+UPDATE t1 SET c4 = REPEAT("c4", 1024);
+SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -168,134 +162,22 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
-) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
-SELECT c1, c2 FROM test_wl5522.t1;
-c1 c2
-2 32
-3 48
-4 64
-6 92
-7 108
-8 124
-13 197
-14 213
-15 229
-17 257
-18 273
-19 289
-28 422
-29 438
-30 454
-32 482
-33 498
-34 514
-36 542
-37 558
-38 574
-40 602
-41 618
-42 634
-59 887
-60 903
-61 919
-63 947
-64 963
-65 979
-67 1007
-68 1023
-69 1039
-71 1067
-72 1083
-73 1099
-75 1127
-76 1143
-77 1159
-79 1187
-80 1203
-81 1219
-83 1247
-84 1263
-85 1279
-87 1307
-88 1323
-89 1339
-122 1832
-123 1848
-124 1864
-126 1892
-127 1908
-128 1924
-130 1952
-131 1968
-132 1984
-134 2012
-135 2028
-136 2044
-138 2072
-139 2088
-140 2104
-142 2132
-143 2148
-144 2164
-146 2192
-147 2208
-148 2224
-150 2252
-151 2268
-152 2284
-154 2312
-155 2328
-156 2344
-158 2372
-159 2388
-160 2404
-162 2432
-163 2448
-164 2464
-166 2492
-167 2508
-168 2524
-170 2552
-171 2568
-172 2584
-174 2612
-175 2628
-176 2644
-178 2672
-179 2688
-180 2704
-182 2732
-183 2748
-184 2764
-SELECT COUNT(*) FROM test_wl5522.t1;
-COUNT(*)
-96
-SELECT SUM(c2) FROM test_wl5522.t1;
-SUM(c2)
-145278
-SELECT name
-FROM information_schema.innodb_metrics
-WHERE name = 'ibuf_merges_insert' AND count = 0;
-name
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-SELECT name
-FROM information_schema.innodb_metrics
-WHERE name = 'ibuf_merges' AND count > 0;
+SELECT name FROM information_schema.innodb_metrics
+WHERE name IN ('ibuf_merges','ibuf_merges_insert') AND count>0 ORDER BY name;
name
ibuf_merges
-SELECT name
-FROM information_schema.innodb_metrics
-WHERE name = 'ibuf_merges_inserts' AND count > 0;
-name
+ibuf_merges_insert
SET GLOBAL innodb_disable_background_merge=OFF;
connection purge_control;
COMMIT;
disconnect purge_control;
connection default;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (
+DROP TABLE t1;
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -304,15 +186,15 @@ INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED;
-SELECT c1, c2 FROM test_wl5522.t1;
+SELECT c1, c2 FROM t1;
c1 c2
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
Table Op Msg_type Msg_text
-test_wl5522.t1 check status OK
-SELECT c1,c2 FROM test_wl5522.t1;
+test.t1 check status OK
+SELECT c1,c2 FROM t1;
c1 c2
2 32
3 48
@@ -320,103 +202,97 @@ c1 c2
6 92
7 108
8 124
-13 197
-14 213
-15 229
-17 257
-18 273
-19 289
-28 422
-29 438
-30 454
-32 482
-33 498
-34 514
-36 542
-37 558
-38 574
-40 602
-41 618
-42 634
-59 887
-60 903
-61 919
-63 947
-64 963
-65 979
-67 1007
-68 1023
-69 1039
-71 1067
-72 1083
-73 1099
-75 1127
-76 1143
-77 1159
-79 1187
-80 1203
-81 1219
-83 1247
-84 1263
-85 1279
-87 1307
-88 1323
-89 1339
+10 152
+11 168
+12 184
+14 212
+15 228
+16 244
+18 272
+19 288
+20 304
+22 332
+23 348
+24 364
+26 392
+27 408
+28 424
+30 452
+31 468
+32 484
+34 512
+35 528
+36 544
+38 572
+39 588
+40 604
+42 632
+43 648
+44 664
+46 692
+47 708
+48 724
+50 752
+51 768
+52 784
+54 812
+55 828
+56 844
+58 872
+59 888
+60 904
+62 932
+63 948
+64 964
+66 992
+67 1008
+68 1024
+70 1052
+71 1068
+72 1084
+74 1112
+75 1128
+76 1144
+78 1172
+79 1188
+80 1204
+82 1232
+83 1248
+84 1264
+86 1292
+87 1308
+88 1324
+90 1352
+91 1368
+92 1384
+94 1412
+95 1428
+96 1444
+98 1472
+99 1488
+100 1504
+102 1532
+103 1548
+104 1564
+106 1592
+107 1608
+108 1624
+110 1652
+111 1668
+112 1684
+114 1712
+115 1728
+116 1744
+118 1772
+119 1788
+120 1804
122 1832
123 1848
124 1864
126 1892
127 1908
128 1924
-130 1952
-131 1968
-132 1984
-134 2012
-135 2028
-136 2044
-138 2072
-139 2088
-140 2104
-142 2132
-143 2148
-144 2164
-146 2192
-147 2208
-148 2224
-150 2252
-151 2268
-152 2284
-154 2312
-155 2328
-156 2344
-158 2372
-159 2388
-160 2404
-162 2432
-163 2448
-164 2464
-166 2492
-167 2508
-168 2524
-170 2552
-171 2568
-172 2584
-174 2612
-175 2628
-176 2644
-178 2672
-179 2688
-180 2704
-182 2732
-183 2748
-184 2764
-SELECT COUNT(*) FROM test_wl5522.t1;
-COUNT(*)
-96
-SELECT SUM(c2) FROM test_wl5522.t1;
-SUM(c2)
-145278
-SHOW CREATE TABLE test_wl5522.t1;
+SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -427,134 +303,121 @@ t1 CREATE TABLE `t1` (
KEY `idx1` (`c2`),
KEY `idx2` (`c3`(512)),
KEY `idx3` (`c4`(512))
-) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-INSERT IGNORE INTO test_wl5522.t1 VALUES
-(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
-Warnings:
-Warning 1265 Data truncated for column 'c2' at row 1
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-COUNT(*)
-256
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+INSERT INTO t1
+SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200)
+FROM seq_1_to_256;
+FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index GEN_CLUST_INDEX
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Index for table 't1' is corrupt; try to repair it
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
-ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
+ALTER TABLE t1 ADD INDEX idx(c1);
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fil_space_create_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 11 't1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 11 'Generic error' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Got error 39 't1.ibd
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Got error 39 'Data structure corruption' from ./test/t1.ibd
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
-SELECT COUNT(*) FROM test_wl5522.t1;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-ERROR HY000: Internal error: Cannot reset LSNs in table `test_wl5522`.`t1` : Data structure corruption
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Data structure corruption
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
unlink: t1.ibd
unlink: t1.cfg
-DROP DATABASE test_wl5522;
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
set global innodb_monitor_enable = default;
diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
index f57e2191d9f..40b357e1b7f 100644
--- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result
+++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
+call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
SET SESSION innodb_strict_mode=1;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
@@ -6,29 +6,26 @@ b char(22),
c varchar(255),
KEY (b))
ENGINE = InnoDB ROW_FORMAT=COMPRESSED ;
-insert into t1 (b, c) values ('Apa', 'Filler........'),
+CREATE TEMPORARY TABLE t (b char(22),c varchar(255));
+INSERT INTO t VALUES
+('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
+INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128;
+DROP TEMPORARY TABLE t;
SELECT COUNT(*) FROM t1;
COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
db.opt
t1.frm
t1.ibd
@@ -47,14 +44,14 @@ COUNT(*)
1280
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-1459 Apa Filler........
-1454 Apa Filler........
-1449 Apa Filler........
+1276 Apa Filler........
+1271 Apa Filler........
+1266 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-1463 Evolution lsjndofiabsoibeg
-1462 Devotion asdfuihknaskdf
-1461 Cavalry ..asdasdfaeraf
+1280 Evolution lsjndofiabsoibeg
+1279 Devotion asdfuihknaskdf
+1278 Cavalry ..asdasdfaeraf
# Restarting server
# Done restarting server
# List before t1 DISCARD
@@ -72,14 +69,14 @@ COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
db.opt
t1.cfg
t1.frm
@@ -89,14 +86,14 @@ COUNT(*)
640
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
a b c
-819 Apa Filler........
-814 Apa Filler........
-809 Apa Filler........
+636 Apa Filler........
+631 Apa Filler........
+626 Apa Filler........
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
a b c
-823 Evolution lsjndofiabsoibeg
-822 Devotion asdfuihknaskdf
-821 Cavalry ..asdasdfaeraf
+640 Evolution lsjndofiabsoibeg
+639 Devotion asdfuihknaskdf
+638 Cavalry ..asdasdfaeraf
DROP TABLE t1;
SET SESSION innodb_strict_mode=1;
CREATE TABLE t1(
@@ -112,18 +109,11 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
db.opt
t1.frm
t1.ibd
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
backup: t1
db.opt
t1.cfg
@@ -153,11 +143,7 @@ DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
db.opt
t1.frm
t1.ibd
@@ -174,8 +160,6 @@ UNLOCK TABLES;
db.opt
t1.frm
t1.ibd
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -200,23 +184,14 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
-COUNT(*)
-16
backup: t1
db.opt
t1.cfg
t1.frm
t1.ibd
UNLOCK TABLES;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -238,19 +213,10 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
-COUNT(*)
-16
backup: t1
UNLOCK TABLES;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -279,39 +245,32 @@ c1 c2
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
unlink: t1.cfg
DROP TABLE t1;
SET GLOBAL innodb_file_per_table = 0;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
-) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1
FLUSH TABLES t1 FOR EXPORT;
Warnings:
Warning 1809 Table `test`.`t1` in system tablespace
@@ -322,12 +281,7 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -335,41 +289,7 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
-SELECT * FROM t1;
-c1 c2
-1 1
-2 1
-3 1
-4 1
-6 1
-7 1
-8 1
-9 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
@@ -410,7 +330,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Column c2 precise type mismatch.)
+ERROR HY000: Schema mismatch (Column c2 precise type mismatch, it's 0X408 in the table and 0X403 in the tablespace meta file)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -447,42 +367,26 @@ t1 CREATE TABLE `t1` (
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
-) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
+5 1
6 1
7 1
8 1
9 1
+10 1
+11 1
+12 1
13 1
14 1
15 1
16 1
-17 1
-18 1
-19 1
-20 1
-28 1
-29 1
-30 1
-31 1
-32 1
-33 1
-34 1
-35 1
-36 1
-37 1
-38 1
-39 1
-40 1
-41 1
-42 1
-43 1
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
-call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
+call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
diff --git a/mysql-test/suite/innodb_zip/t/cmp_per_index.test b/mysql-test/suite/innodb_zip/t/cmp_per_index.test
index 8d66277a1bd..74ed17b1213 100644
--- a/mysql-test/suite/innodb_zip/t/cmp_per_index.test
+++ b/mysql-test/suite/innodb_zip/t/cmp_per_index.test
@@ -21,6 +21,7 @@ if (`SELECT @@innodb_log_compressed_pages = 0`)
-- vertical_results
+SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
SET GLOBAL innodb_cmp_per_index_enabled=ON;
# reset any leftover stats from previous tests
@@ -92,29 +93,6 @@ ELSE compress_ops_ok END as compress_ops_ok,
uncompress_ops
FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
-
-# restart mysqld and see that uncompress ops also gets increased when
-# selecting from the table again
-
--- source include/restart_mysqld.inc
-
-SHOW CREATE TABLE t;
-
-SET GLOBAL innodb_cmp_per_index_enabled=ON;
-
-SELECT COUNT(*) FROM t IGNORE INDEX(b);
-
-SELECT
-database_name,
-table_name,
-index_name,
-compress_ops,
-compress_ops_ok,
-CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
-ELSE uncompress_ops END as uncompress_ops
-FROM information_schema.innodb_cmp_per_index
-ORDER BY 1, 2, 3;
-
DROP TABLE t;
-SET GLOBAL innodb_cmp_per_index_enabled=default;
+SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
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 5485fec3e7d..411d47118f6 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
@@ -12,70 +12,66 @@
--source include/innodb_page_size_small.inc
--source include/default_charset.inc
+--source include/have_sequence.inc
-call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
-call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
-call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*");
+call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded\\.");
+call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue\\.");
+call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file");
call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x");
FLUSH TABLES;
let MYSQLD_DATADIR =`SELECT @@datadir`;
-let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/;
SET SESSION innodb_strict_mode=1;
-CREATE DATABASE test_wl5522;
-
# Create the table that we will use for crash recovery (during IMPORT)
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
-
---replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
+INSERT INTO t1 VALUES (1), (2), (3), (4);
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-INSERT INTO test_wl5522.t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_discard_tablespaces("test_wl5522", "t1");
+ib_discard_tablespaces("test", "t1");
EOF
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
##### Before commit crash
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
--error ER_TABLESPACE_DISCARDED
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -89,14 +85,14 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Don't start up the server right away.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
# After the above test the results are non-deterministic,
# delete the old tablespace files and drop the table,
@@ -104,7 +100,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-- source include/wait_until_disconnected.inc
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
--echo # Restart and reconnect to the server
@@ -118,95 +114,91 @@ EOF
# After the above test the results are non-deterministic, recreate the table
# and do a proper import.
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
SET SESSION innodb_strict_mode=1;
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
-INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
+INSERT INTO t1 VALUES(400), (500), (600);
-SELECT * FROM test_wl5522.t1;
+SELECT * FROM t1;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test handling of internal failure error
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,ib_import_internal_error";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
# Test failure after reset of space id and LSN in the tablespace
-CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT) ENGINE = Innodb
ROW_FORMAT=COMPRESSED;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after reset of space id and LSN in the tablespace
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug=@saved_debug_dbug;
@@ -214,16 +206,16 @@ SET SESSION debug_dbug=@saved_debug_dbug;
# Test failure after attempting a tablespace open
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
---replace_regex /'.*[\/\\]/'/
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after ibuf check
@@ -231,73 +223,73 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
# Need proper mapping of error codes :-(
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after adjusting the cluster index root page
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after importing the cluster index
SET SESSION debug_dbug="+d,ib_import_cluster_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
# Test failure after importing the secondary index(es)
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure";
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "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;
+ALTER TABLE 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");
+ib_unlink_tablespace("test", "t1");
EOF
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
--disable_query_log
# Enable metrics for the counters we are going to use
@@ -311,7 +303,7 @@ set global innodb_monitor_enable = ibuf_merges_insert;
# Create a large table with delete marked records, disable purge during
# the update so that we can test the IMPORT purge code.
#
-CREATE TABLE test_wl5522.t1 (
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -332,64 +324,45 @@ SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_monitor_reset = ibuf_merges;
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
-INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
- (1, REPEAT('a', 2048), REPEAT('a', 2048)),
- (2, REPEAT('b', 2048), REPEAT('b', 2048)),
- (3, REPEAT('c', 2048), REPEAT('c', 2048)),
- (4, REPEAT('d', 2048), REPEAT('d', 2048));
+INSERT INTO t1
+SELECT 1 + seq, 1 + (seq MOD 4),
+ REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048),
+ REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048)
+FROM seq_0_to_127;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
+DELETE FROM t1 WHERE c2 = 1;
-DELETE FROM test_wl5522.t1 WHERE c2 = 1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c2 = c2 + c1;
+UPDATE t1 SET c3 = REPEAT("c2", 1024);
+UPDATE t1 SET c4 = REPEAT("c4", 1024);
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c2 = c2 + c1;
-UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
-UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
+SHOW CREATE TABLE t1;
-SHOW CREATE TABLE test_wl5522.t1;
-
-SELECT c1, c2 FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-SELECT SUM(c2) FROM test_wl5522.t1;
-
-SELECT name
- FROM information_schema.innodb_metrics
- WHERE name = 'ibuf_merges_insert' AND count = 0;
-
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-SELECT name
- FROM information_schema.innodb_metrics
- WHERE name = 'ibuf_merges' AND count > 0;
-
-SELECT name
- FROM information_schema.innodb_metrics
- WHERE name = 'ibuf_merges_inserts' AND count > 0;
+SELECT name FROM information_schema.innodb_metrics
+WHERE name IN ('ibuf_merges','ibuf_merges_insert') AND count>0 ORDER BY name;
SET GLOBAL innodb_disable_background_merge=OFF;
@@ -399,9 +372,9 @@ COMMIT;
disconnect purge_control;
connection default;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (
+CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
@@ -411,296 +384,272 @@ CREATE TABLE test_wl5522.t1 (
INDEX idx3(c4(512))) Engine=InnoDB
ROW_FORMAT=COMPRESSED;
-SELECT c1, c2 FROM test_wl5522.t1;
+SELECT c1, c2 FROM t1;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
-CHECK TABLE test_wl5522.t1;
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
-SELECT c1,c2 FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-SELECT SUM(c2) FROM test_wl5522.t1;
+SELECT c1,c2 FROM t1;
-SHOW CREATE TABLE test_wl5522.t1;
+SHOW CREATE TABLE t1;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
####
# Create a table and save the tablespace and .cfg file, we need to create
# a Btree that has several levels
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-INSERT IGNORE INTO test_wl5522.t1 VALUES
- (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
-
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
-SELECT COUNT(*) FROM test_wl5522.t1;
-FLUSH TABLES test_wl5522.t1 FOR EXPORT;
+INSERT INTO t1
+SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200)
+FROM seq_1_to_256;
+FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_backup_tablespaces("test_wl5522", "t1");
+ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
# Following alter is failing
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2";
---replace_regex $pathfix
-
--error ER_INNODB_INDEX_CORRUPT
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
--error ER_NOT_KEYFILE
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1";
-ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
+ALTER TABLE t1 ADD INDEX idx(c1);
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,fil_space_create_failure";
---replace_regex /'.*[\/\\]/'/
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
---replace_regex /'.*[\/\\]/'/
+--replace_result \\ /
--error ER_GET_ERRMSG
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
#
-CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
+ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
-SELECT COUNT(*) FROM test_wl5522.t1;
+SELECT COUNT(*) FROM t1;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_restore_tablespaces("test_wl5522", "t1");
+ib_restore_tablespaces("test", "t1");
EOF
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure";
---replace_regex /'.*t1.cfg'/'t1.cfg'/
-
--error ER_INTERNAL_ERROR
-ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
+ALTER TABLE t1 IMPORT TABLESPACE;
SET SESSION debug_dbug=@saved_debug_dbug;
-DROP TABLE test_wl5522.t1;
+DROP TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
-ib_unlink_tablespace("test_wl5522", "t1");
+ib_unlink_tablespace("test", "t1");
EOF
-
-DROP DATABASE test_wl5522;
-
set global innodb_monitor_disable = all;
set global innodb_monitor_reset_all = all;
@@ -717,18 +666,16 @@ call mtr.add_suppression("Monitor ibuf_merges is already enabled");
call mtr.add_suppression("Monitor ibuf_merges_insert is already enabled");
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
-call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache.*");
+call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache");
call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
-call mtr.add_suppression(".*There was an error writing to the meta data file.*");
+call mtr.add_suppression("There was an error writing to the meta data file");
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
call mtr.add_suppression("Unsupported tablespace format");
-call mtr.add_suppression("Error in page .* of index \"GEN_CLUST_INDEX\" of table \"test_wl5522\".\"t1\"");
call mtr.add_suppression("Page is marked as free");
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted");
call mtr.add_suppression("but tablespace with that id or name does not exist");
-call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache");
-call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'");
+call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
--enable_query_log
diff --git a/mysql-test/suite/innodb_zip/t/wl5522_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_zip.test
index d92093262ac..d5e6bc6e725 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_zip.test
@@ -2,8 +2,9 @@
--source include/not_embedded.inc
-- source include/innodb_page_size_small.inc
+-- source include/have_sequence.inc
-call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
+call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
SET SESSION innodb_strict_mode=1;
@@ -17,17 +18,14 @@ CREATE TABLE t1
KEY (b))
ENGINE = InnoDB ROW_FORMAT=COMPRESSED ;
-insert into t1 (b, c) values ('Apa', 'Filler........'),
+CREATE TEMPORARY TABLE t (b char(22),c varchar(255));
+INSERT INTO t VALUES
+('Apa', 'Filler........'),
('Banan', 'Filler........'), ('Cavalry', '..asdasdfaeraf'),
('Devotion', 'asdfuihknaskdf'), ('Evolution', 'lsjndofiabsoibeg');
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
-INSERT INTO t1 (b, c) SELECT b,c FROM t1 ORDER BY a;
+INSERT INTO t1 (b,c) SELECT b,c FROM t,seq_1_to_128;
+DROP TEMPORARY TABLE t;
SELECT COUNT(*) FROM t1;
SELECT * FROM t1 ORDER BY b,a DESC LIMIT 3;
SELECT * FROM t1 ORDER BY a DESC LIMIT 3;
@@ -89,16 +87,11 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -140,11 +133,7 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1 FOR EXPORT;
@@ -159,9 +148,6 @@ UNLOCK TABLES;
--list_files $MYSQLD_DATADIR/test
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
CREATE TABLE t1(
@@ -195,14 +181,9 @@ CREATE TABLE t1(
c2 INT, INDEX(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -211,9 +192,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
CREATE TABLE t1(
@@ -250,14 +228,9 @@ eval CREATE TABLE t1(
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED $KEY_BLOCK_SIZE;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
FLUSH TABLES t1 FOR EXPORT;
-SELECT COUNT(*) FROM t1 WHERE c2 = 1;
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
@@ -265,9 +238,6 @@ EOF
UNLOCK TABLES;
# Move the LSN forward
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
DROP TABLE t1;
--replace_result $KEY_BLOCK_SIZE KEY_BLOCK_SIZE=16
@@ -319,14 +289,7 @@ CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT) ENGINE=InnoDB;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-
-SELECT COUNT(*) FROM t1;
-
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
# This should fail, InnoDB should return a warning
@@ -347,15 +310,9 @@ CREATE TABLE t1(
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED;
-INSERT INTO t1(c2) VALUES(1);
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
-INSERT INTO t1(c2) SELECT c2 FROM t1;
+INSERT INTO t1 SELECT seq,1 FROM seq_1_to_16;
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
@@ -511,7 +468,7 @@ SELECT * FROM t1;
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
-call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
+call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
# cleanup
diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.result b/mysql-test/suite/maria/aria_pack_mdev14183.result
new file mode 100644
index 00000000000..b20f60c5b8a
--- /dev/null
+++ b/mysql-test/suite/maria/aria_pack_mdev14183.result
@@ -0,0 +1,22 @@
+CREATE TABLE `t` (
+`col_1` varchar(255) NOT NULL DEFAULT '',
+`col_2` varchar(255) NOT NULL,
+`col_3` int(11) NOT NULL DEFAULT '0',
+`col_4` int(11) NOT NULL DEFAULT '0'
+) ENGINE=Aria TRANSACTIONAL=0 PAGE_CHECKSUM=0;
+insert into t values
+('foobar','qux',0,0),('abcdef','qux',0,0);
+Compressing test/t.MAD: (2 records)
+- Calculating statistics
+
+normal: 0 empty-space: 0 empty-zero: 0 empty-fill: 0
+pre-space: 0 end-space: 0 intervall-fields: 0 zero: 2
+Original trees: 4 After join: 1
+- Compressing file
+Min record length: 5 Max length: 5 Mean total length: 35
+99.57%
+SELECT * FROM t;
+col_1 col_2 col_3 col_4
+foobar qux 0 0
+abcdef qux 0 0
+DROP TABLE t;
diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.test b/mysql-test/suite/maria/aria_pack_mdev14183.test
new file mode 100644
index 00000000000..5386ae774a0
--- /dev/null
+++ b/mysql-test/suite/maria/aria_pack_mdev14183.test
@@ -0,0 +1,23 @@
+--source include/have_aria.inc
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+CREATE TABLE `t` (
+ `col_1` varchar(255) NOT NULL DEFAULT '',
+ `col_2` varchar(255) NOT NULL,
+ `col_3` int(11) NOT NULL DEFAULT '0',
+ `col_4` int(11) NOT NULL DEFAULT '0'
+) ENGINE=Aria TRANSACTIONAL=0 PAGE_CHECKSUM=0;
+
+insert into t values
+ ('foobar','qux',0,0),('abcdef','qux',0,0);
+
+--let $datadir= `SELECT @@datadir`
+--source include/shutdown_mysqld.inc
+# maria_pack crashes by assert() if the bug is not fixed
+--exec cd $datadir && $MARIA_PACK -t test/t
+
+--source include/start_mysqld.inc
+SELECT * FROM t;
+
+DROP TABLE t;
diff --git a/mysql-test/suite/maria/bulk_insert_crash.opt b/mysql-test/suite/maria/bulk_insert_crash.opt
new file mode 100644
index 00000000000..f85a8d9c973
--- /dev/null
+++ b/mysql-test/suite/maria/bulk_insert_crash.opt
@@ -0,0 +1,2 @@
+--skip-stack-trace --skip-core-file
+--default-storage-engine=Aria
diff --git a/mysql-test/suite/maria/bulk_insert_crash.result b/mysql-test/suite/maria/bulk_insert_crash.result
new file mode 100644
index 00000000000..fc28bf325ba
--- /dev/null
+++ b/mysql-test/suite/maria/bulk_insert_crash.result
@@ -0,0 +1,13 @@
+create table t1 (a int primary key, b int, c int, unique key(b), key(c)) engine=aria transactional=1;
+insert into t1 values (1000,1000,1000);
+insert into t1 select seq,seq+100, seq+200 from seq_1_to_10;
+SET GLOBAL debug_dbug="+d,crash_end_bulk_insert";
+REPLACE into t1 select seq+20,seq+95, seq + 300 from seq_1_to_10;
+ERROR HY000: Lost connection to MySQL server during query
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+select sum(a),sum(b),sum(c) from t1;
+sum(a) sum(b) sum(c)
+1055 2055 3055
+drop table t1;
diff --git a/mysql-test/suite/maria/bulk_insert_crash.test b/mysql-test/suite/maria/bulk_insert_crash.test
new file mode 100644
index 00000000000..d9167c3f0d7
--- /dev/null
+++ b/mysql-test/suite/maria/bulk_insert_crash.test
@@ -0,0 +1,36 @@
+--source include/not_embedded.inc
+--source include/not_valgrind.inc
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+# Binary must be compiled with debug for crash to occur
+--source include/have_debug.inc
+--source include/have_sequence.inc
+
+#
+# MDEV-20578 Got error 126 when executing undo undo_key_delete upon Aria crash
+# recovery
+#
+
+# Write file to make mysql-test-run.pl expect crash and restart
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+create table t1 (a int primary key, b int, c int, unique key(b), key(c)) engine=aria transactional=1;
+insert into t1 values (1000,1000,1000);
+insert into t1 select seq,seq+100, seq+200 from seq_1_to_10;
+
+# Insert into t1 with batch insert where we get a rows replaced after
+# a few sucessful inserts
+
+SET GLOBAL debug_dbug="+d,crash_end_bulk_insert";
+
+--error 2013
+REPLACE into t1 select seq+20,seq+95, seq + 300 from seq_1_to_10;
+
+# Wait until restarted
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+check table t1;
+select sum(a),sum(b),sum(c) from t1;
+drop table t1;
diff --git a/mysql-test/suite/maria/encrypt-no-key.result b/mysql-test/suite/maria/encrypt-no-key.result
new file mode 100644
index 00000000000..6745670dfac
--- /dev/null
+++ b/mysql-test/suite/maria/encrypt-no-key.result
@@ -0,0 +1,15 @@
+call mtr.add_suppression('Unknown key id 1. Can''t continue');
+set global aria_encrypt_tables= 1;
+create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
+alter table t1 disable keys;
+insert into t1 values (1,1);
+alter table t1 enable keys;
+ERROR HY000: Unknown key id 1. Can't continue!
+repair table t1 use_frm;
+Table Op Msg_type Msg_text
+test.t1 repair warning Number of rows changed from 0 to 1
+test.t1 repair Error Unknown key id 1. Can't continue!
+test.t1 repair Error Unknown key id 1. Can't continue!
+test.t1 repair status OK
+drop table t1;
+set global aria_encrypt_tables= default;
diff --git a/mysql-test/suite/maria/encrypt-no-key.test b/mysql-test/suite/maria/encrypt-no-key.test
new file mode 100644
index 00000000000..2d586c50695
--- /dev/null
+++ b/mysql-test/suite/maria/encrypt-no-key.test
@@ -0,0 +1,14 @@
+#
+# MDEV-18496 Crash when Aria encryption is enabled but plugin not available
+#
+call mtr.add_suppression('Unknown key id 1. Can''t continue');
+
+set global aria_encrypt_tables= 1;
+create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1;
+alter table t1 disable keys;
+insert into t1 values (1,1);
+error 192;
+alter table t1 enable keys;
+repair table t1 use_frm;
+drop table t1;
+set global aria_encrypt_tables= default;
diff --git a/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result
new file mode 100644
index 00000000000..9806bc29b47
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result
@@ -0,0 +1,11 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+connect con1,localhost,root,,;
+BEGIN;
+LOCK TABLES t WRITE;
+connection default;
+# xtrabackup backup
+connection con1;
+COMMIT;
+connection default;
+disconnect con1;
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test
new file mode 100644
index 00000000000..e0f43910ef6
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test
@@ -0,0 +1,28 @@
+--source include/have_innodb.inc
+--source include/count_sessions.inc
+
+CREATE TABLE t(i INT) ENGINE INNODB;
+
+connect (con1,localhost,root,,);
+BEGIN;
+LOCK TABLES t WRITE;
+
+--connection default
+
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=1 --target-dir=$targetdir;
+--enable_result_log
+
+--connection con1
+COMMIT;
+
+--connection default
+--disconnect con1
+
+DROP TABLE t;
+rmdir $targetdir;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/mariabackup/ddl_incremental_encrypted.opt b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.opt
new file mode 100644
index 00000000000..1de4aa13350
--- /dev/null
+++ b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.opt
@@ -0,0 +1,7 @@
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--innodb-file-per-table
+--innodb-encryption-threads=4
+--innodb-encrypt-tables
+--innodb-encrypt-log
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
diff --git a/mysql-test/suite/mariabackup/ddl_incremental_encrypted.result b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.result
new file mode 100644
index 00000000000..9349457ffbb
--- /dev/null
+++ b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.result
@@ -0,0 +1,26 @@
+SET @old_innodb_log_optimize_ddl=@@global.innodb_log_optimize_ddl;
+SET GLOBAL innodb_log_optimize_ddl=ON;
+SET @old_debug_dbug=@@global.debug_dbug;
+SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
+SET @old_innodb_page_cleaner_disabled_debug=@@global.innodb_page_cleaner_disabled_debug;
+SET GLOBAL innodb_page_cleaner_disabled_debug=ON;
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+# backup
+SET GLOBAL debug_dbug="+d,ib_do_not_log_crypt_data";
+INSERT INTO t1 VALUES (2);
+# incremental backup
+# prepare
+# incremental prepare
+SET GLOBAL innodb_log_optimize_ddl=@old_innodb_log_optimize_ddl;
+SET GLOBAL innodb_page_cleaner_disabled_debug=@old_innodb_page_cleaner_disabled_debug;
+SET GLOBAL debug_dbug=@old_debug_dbug;
+# Restore and check results
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT count(*) FROM t1;
+count(*)
+2
+DROP TABLE t1;
diff --git a/mysql-test/suite/mariabackup/ddl_incremental_encrypted.test b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.test
new file mode 100644
index 00000000000..196201f61c7
--- /dev/null
+++ b/mysql-test/suite/mariabackup/ddl_incremental_encrypted.test
@@ -0,0 +1,66 @@
+#
+# If MDEV-20755 bug is no fixed, incremental prepare will fail.
+#
+--source include/have_debug.inc
+--source include/have_file_key_management.inc
+
+--let $base_dir=$MYSQLTEST_VARDIR/tmp/backup
+--let $inc_dir=$MYSQLTEST_VARDIR/tmp/backup_inc
+
+SET @old_innodb_log_optimize_ddl=@@global.innodb_log_optimize_ddl;
+SET GLOBAL innodb_log_optimize_ddl=ON;
+
+# Disable pages flushing to allow redo log records to be executed on --prepare.
+SET @old_debug_dbug=@@global.debug_dbug;
+SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid";
+SET @old_innodb_page_cleaner_disabled_debug=@@global.innodb_page_cleaner_disabled_debug;
+SET GLOBAL innodb_page_cleaner_disabled_debug=ON;
+
+CREATE TABLE t1 (c INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--echo # backup
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$base_dir
+--enable_result_log
+
+# Do not log crypt data to avoid it's execution on --prepare.
+SET GLOBAL debug_dbug="+d,ib_do_not_log_crypt_data";
+INSERT INTO t1 VALUES (2);
+
+--disable_result_log
+
+# Execute OPTIMIZE TABLE after the table is copied to execute optimized ddl
+# callback during backup, which, in turns, will create t1.new file in backup
+# directory.
+--let after_copy_test_t1=OPTIMIZE TABLE test.t1;
+
+--echo # incremental backup
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$inc_dir --incremental-basedir=$base_dir --dbug=+d,mariabackup_events
+
+--echo # prepare
+--exec $XTRABACKUP --prepare --target-dir=$base_dir
+
+# If the tablespace is created during delta tablespace open procedure, then
+# crypt data will be not written, and page corruption test will not pass
+# when some redo log event is executed, and --prepare will fail.
+--echo # incremental prepare
+--exec $XTRABACKUP --prepare --target-dir=$base_dir --incremental-dir=$inc_dir
+
+--enable_result_log
+
+SET GLOBAL innodb_log_optimize_ddl=@old_innodb_log_optimize_ddl;
+SET GLOBAL innodb_page_cleaner_disabled_debug=@old_innodb_page_cleaner_disabled_debug;
+SET GLOBAL debug_dbug=@old_debug_dbug;
+
+--echo # Restore and check results
+--let $targetdir=$base_dir
+--source include/restart_and_restore.inc
+--enable_result_log
+
+SELECT count(*) FROM t1;
+
+# Cleanup
+DROP TABLE t1;
+--rmdir $base_dir
+--rmdir $inc_dir
diff --git a/mysql-test/suite/mariabackup/huge_lsn.result b/mysql-test/suite/mariabackup/huge_lsn.result
index e7c4cc9471d..61ca3400721 100644
--- a/mysql-test/suite/mariabackup/huge_lsn.result
+++ b/mysql-test/suite/mariabackup/huge_lsn.result
@@ -16,3 +16,7 @@ SELECT * FROM t;
i
1
DROP TABLE t;
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
diff --git a/mysql-test/suite/mariabackup/huge_lsn.test b/mysql-test/suite/mariabackup/huge_lsn.test
index 9e72f0ad8d0..22e4e59a1d5 100644
--- a/mysql-test/suite/mariabackup/huge_lsn.test
+++ b/mysql-test/suite/mariabackup/huge_lsn.test
@@ -8,6 +8,10 @@
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;
+let $targetdir_old=$MYSQLTEST_VARDIR/tmp/backup_1;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir_old;
+--enable_result_log
--source include/shutdown_mysqld.inc
perl;
@@ -50,3 +54,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
+let $targetdir= $targetdir_old;
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+--source include/restart_and_restore.inc
+rmdir $targetdir_old;
diff --git a/mysql-test/suite/mariabackup/incremental_backup.result b/mysql-test/suite/mariabackup/incremental_backup.result
index cc7277bdde9..70cc2cf8c4a 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_backup.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: New log files created");
+CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
BEGIN;
INSERT INTO t VALUES(2);
@@ -11,11 +12,13 @@ INSERT INTO t VALUES(0);
DELETE FROM t WHERE i=0;
connection default;
COMMIT;
+# Generate enough aria log records to increase area log file size
SELECT * FROM t;
i
1
2
# Prepare full backup, apply incremental one
+# Aria log file was updated during applying incremental backup
disconnect con1;
# Restore and check results
# shutdown server
@@ -27,3 +30,4 @@ i
1
2
DROP TABLE t;
+DROP TABLE t_aria;
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index 8fbfa701999..88e277fd95a 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -1,10 +1,17 @@
+--source include/have_aria.inc
--source include/innodb_page_size.inc
+# see suite.pm "check for exact values, in case the default changes to be small everywhere"
+if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) {
+ skip skipped on 32bit; # tries to allocate 1GB of memory
+ }
+
call mtr.add_suppression("InnoDB: New log files created");
-let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
-let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+let basedir=$MYSQLTEST_VARDIR/tmp/backup;
+let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
BEGIN;
INSERT INTO t VALUES(2);
@@ -14,21 +21,73 @@ INSERT INTO t VALUES(1);
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir;
--enable_result_log
BEGIN;
INSERT INTO t VALUES(0);
DELETE FROM t WHERE i=0;
connection default;
COMMIT;
+
+--echo # Generate enough aria log records to increase area log file size
+--disable_query_log
+--disable_result_log
+INSERT INTO t_aria VALUES
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+--let $i = 4
+while ($i) {
+INSERT INTO t_aria SELECT * FROM seq_1_to_2000;
+--dec $i
+}
+--enable_query_log
+--enable_result_log
+
SELECT * FROM t;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir;
+# wf_incremental_init() allocates (page_size/4)*page_size bytes with mmap()
+# in each data file copy thread, what can fail on 32-bit platforms if threads
+# are too much, that's why don't set too big --parallel option value.
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir;
--disable_result_log
echo # Prepare full backup, apply incremental one;
exec $XTRABACKUP --prepare --target-dir=$basedir;
exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
+let perl_result_file=$MYSQLTEST_VARDIR/tmp/check_file_size_result.inc;
+
+--perl END_OF_FILE
+ use strict;
+ use warnings;
+
+ my $dst_file = "$ENV{'basedir'}/aria_log.00000001";
+ my $src_file = "$ENV{'incremental_dir'}/aria_log.00000001";
+ my $out_file = $ENV{'perl_result_file'};
+
+ my $dst_size = -s $dst_file;
+ my $src_size = -s $src_file;
+
+ open (my $output, '>', $out_file) or die $!;
+ if ($dst_size >= $src_size) {
+ print $output '--echo # Aria log file was updated during applying incremental backup'."\n";
+ }
+ else {
+ print $output '--echo # Aria log file was NOT updated during applying incremental backup'."\n";
+ }
+ close $output;
+END_OF_FILE
+
+--source $perl_result_file
+--remove_file $perl_result_file
+
disconnect con1;
echo # Restore and check results;
let $targetdir=$basedir;
@@ -37,6 +96,7 @@ let $targetdir=$basedir;
SELECT * FROM t;
DROP TABLE t;
+DROP TABLE t_aria;
# Cleanup
rmdir $basedir;
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
index ffca1ef0e1f..e9746083178 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.result
@@ -2,6 +2,7 @@ call mtr.add_suppression("InnoDB: New log files created");
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t3(i INT) ENGINE INNODB;
+CREATE TABLE t10(i INT PRIMARY KEY) ENGINE INNODB;
# Create full backup , modify table, then create incremental/differential backup
INSERT into t1 values(1);
# Prepare full backup, apply incremental one
diff --git a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
index 60780b13920..49e952eefea 100644
--- a/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_ddl_during_backup.test
@@ -8,6 +8,7 @@ let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
CREATE TABLE t3(i INT) ENGINE INNODB;
+CREATE TABLE t10(i INT PRIMARY KEY) ENGINE INNODB;
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
@@ -20,8 +21,11 @@ INSERT into t1 values(1);
--let after_copy_test_t1=RENAME TABLE test.t1 TO test.t1_renamed
--let after_copy_test_t2=DROP TABLE test.t2
--let after_copy_test_t3=CREATE INDEX a_i ON test.t3(i);
+--let before_copy_test_t10=DROP TABLE test.t10
+--let wait_innodb_redo_before_copy=test/t10
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events;
+# mariabackup should crash with assertion if MDEV-24026 is not fixed
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code;
--let after_load_tablespaces=
--disable_result_log
echo # Prepare full backup, apply incremental one;
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
new file mode 100644
index 00000000000..7111d384b40
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
@@ -0,0 +1 @@
+--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
new file mode 100644
index 00000000000..29abe038afe
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
@@ -0,0 +1,2 @@
+CREATE TABLE t(i INT) ENGINE=INNODB;
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test
new file mode 100644
index 00000000000..22165ff29be
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test
@@ -0,0 +1,20 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_sequence.inc
+
+CREATE TABLE t(i INT) ENGINE=INNODB;
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+
+# Generate enough redo log records to make at least one loop in log group
+--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * from test.seq_1_to_102400
+
+--disable_result_log
+# mariabackup must exit with error instead of hanging
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
+--enable_result_log
+
+DROP TABLE t;
+--rmdir $targetdir
+
diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt
new file mode 100644
index 00000000000..7111d384b40
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt
@@ -0,0 +1 @@
+--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2
diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result
new file mode 100644
index 00000000000..571bfd35c70
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result
@@ -0,0 +1,28 @@
+CREATE TABLE t(i INT) ENGINE=INNODB;
+INSERT INTO t VALUES
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+(0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+# Generate enough data to overwrite innodb redo log
+# on the next "INSERT INTO t SELECT * FROM t" execution.
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+INSERT INTO t SELECT * FROM t;
+# xtrabackup backup
+FOUND 1 /failed: redo log block is overwritten/ in backup.log
+FOUND 1 /failed: redo log block checksum does not match/ in backup.log
+FOUND 1 /failed: unknown reason/ in backup.log
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test
new file mode 100644
index 00000000000..55e754f18d7
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test
@@ -0,0 +1,70 @@
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t(i INT) ENGINE=INNODB;
+
+INSERT INTO t VALUES
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+--echo # Generate enough data to overwrite innodb redo log
+--echo # on the next "INSERT INTO t SELECT * FROM t" execution.
+--let $i = 0
+while ($i < 9) {
+INSERT INTO t SELECT * FROM t;
+--inc $i
+}
+
+--echo # xtrabackup backup
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log
+
+--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * FROM test.t
+
+--disable_result_log
+--error 1
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events > $backuplog
+--enable_result_log
+
+--let SEARCH_PATTERN=failed: redo log block is overwritten
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--remove_file $backuplog
+--rmdir $targetdir
+
+--let before_innodb_log_copy_thread_started=INSERT INTO test.t VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)
+
+--disable_result_log
+--error 1
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events,log_checksum_mismatch > $backuplog
+--enable_result_log
+
+--let SEARCH_PATTERN=failed: redo log block checksum does not match
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--remove_file $backuplog
+--rmdir $targetdir
+
+--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * FROM test.t LIMIT 50000
+
+--disable_result_log
+--error 1
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --innodb-log-checksums=0 --dbug=+d,mariabackup_events > $backuplog
+--enable_result_log
+
+--let SEARCH_PATTERN=failed: unknown reason
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+--remove_file $backuplog
+--rmdir $targetdir
+
+--let before_innodb_log_copy_thread_started=
+
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/innodb_xa_rollback.result b/mysql-test/suite/mariabackup/innodb_xa_rollback.result
new file mode 100644
index 00000000000..cd5e2cd39a9
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_xa_rollback.result
@@ -0,0 +1,45 @@
+CALL mtr.add_suppression("Found 1 prepared XA transactions");
+RESET MASTER;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+XA START 'test1';
+INSERT t1 VALUES (10);
+XA END 'test1';
+XA PREPARE 'test1';
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 5 0 test1
+# xtrabackup backup
+XA ROLLBACK 'test1';
+# xtrabackup prepare and rollback prepared XA
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+XA RECOVER;
+formatID gtrid_length bqual_length data
+# xtrabackup prepare and DO NOT rollback prepared XA
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 5 0 test1
+XA ROLLBACK 'test1';
+# xtrabackup prepare for export and rollback prepared XA
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+XA RECOVER;
+formatID gtrid_length bqual_length data
+# xtrabackup prepare for export and DO NOT rollback prepared XA
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+XA RECOVER;
+formatID gtrid_length bqual_length data
+1 5 0 test1
+XA ROLLBACK 'test1';
+DROP TABLE t1;
diff --git a/mysql-test/suite/mariabackup/innodb_xa_rollback.test b/mysql-test/suite/mariabackup/innodb_xa_rollback.test
new file mode 100644
index 00000000000..f8ba5ea8cfa
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_xa_rollback.test
@@ -0,0 +1,77 @@
+#
+# Optionally rollback prepared XA when backup is prepared
+#
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed.inc
+
+CALL mtr.add_suppression("Found 1 prepared XA transactions");
+
+RESET MASTER;
+
+let targetdir1=$MYSQLTEST_VARDIR/tmp/backup1;
+let targetdir2=$MYSQLTEST_VARDIR/tmp/backup2;
+let targetdir3=$MYSQLTEST_VARDIR/tmp/backup3;
+let targetdir4=$MYSQLTEST_VARDIR/tmp/backup4;
+
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+XA START 'test1';
+INSERT t1 VALUES (10);
+XA END 'test1';
+XA PREPARE 'test1';
+XA RECOVER;
+
+--echo # xtrabackup backup
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir1;
+--enable_result_log
+
+perl;
+use lib "lib";
+use My::Handles { suppress_init_messages => 1 };
+use My::File::Path;
+copytree($ENV{'targetdir1'}, $ENV{'targetdir2'});
+copytree($ENV{'targetdir1'}, $ENV{'targetdir3'});
+copytree($ENV{'targetdir1'}, $ENV{'targetdir4'});
+EOF
+
+XA ROLLBACK 'test1';
+
+--echo # xtrabackup prepare and rollback prepared XA
+--disable_result_log
+exec $XTRABACKUP --prepare --rollback_xa --target-dir=$targetdir1;
+--let $targetdir = $targetdir1
+--source include/restart_and_restore.inc
+--enable_result_log
+XA RECOVER;
+
+--echo # xtrabackup prepare and DO NOT rollback prepared XA
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir2;
+--let $targetdir = $targetdir2
+--source include/restart_and_restore.inc
+--enable_result_log
+XA RECOVER;
+XA ROLLBACK 'test1';
+
+--echo # xtrabackup prepare for export and rollback prepared XA
+--disable_result_log
+exec $XTRABACKUP --prepare --rollback_xa --export --target-dir=$targetdir3;
+--let $targetdir = $targetdir3
+--source include/restart_and_restore.inc
+--enable_result_log
+XA RECOVER;
+
+--echo # xtrabackup prepare for export and DO NOT rollback prepared XA
+--disable_result_log
+exec $XTRABACKUP --prepare --export --target-dir=$targetdir4;
+--let $targetdir = $targetdir4
+--source include/restart_and_restore.inc
+--enable_result_log
+XA RECOVER;
+XA ROLLBACK 'test1';
+
+DROP TABLE t1;
+rmdir $targetdir1;
+rmdir $targetdir2;
+rmdir $targetdir3;
+rmdir $targetdir4;
diff --git a/mysql-test/suite/mariabackup/mlog_index_load.result b/mysql-test/suite/mariabackup/mlog_index_load.result
index bc83981106e..8925e897399 100644
--- a/mysql-test/suite/mariabackup/mlog_index_load.result
+++ b/mysql-test/suite/mariabackup/mlog_index_load.result
@@ -1,5 +1,6 @@
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
+SET GLOBAL innodb_log_optimize_ddl=ON;
# xtrabackup backup
t1.frm
t1.ibd
diff --git a/mysql-test/suite/mariabackup/mlog_index_load.test b/mysql-test/suite/mariabackup/mlog_index_load.test
index fb29041fd3c..b9fd6f8ca32 100644
--- a/mysql-test/suite/mariabackup/mlog_index_load.test
+++ b/mysql-test/suite/mariabackup/mlog_index_load.test
@@ -2,6 +2,7 @@
CREATE TABLE t1(i INT PRIMARY KEY auto_increment, a int) ENGINE INNODB;
INSERT INTO t1(a) SELECT * from seq_1_to_10000;
+SET GLOBAL innodb_log_optimize_ddl=ON;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
diff --git a/mysql-test/suite/mariabackup/partial_exclude.opt b/mysql-test/suite/mariabackup/partial_exclude.opt
new file mode 100644
index 00000000000..872335edb71
--- /dev/null
+++ b/mysql-test/suite/mariabackup/partial_exclude.opt
@@ -0,0 +1,2 @@
+--ignore-db-dirs=db3
+--ignore-db-dirs=db4
diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result
index 0da9b547caa..628613040e0 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.result
+++ b/mysql-test/suite/mariabackup/partial_exclude.result
@@ -1,3 +1,6 @@
+select @@ignore_db_dirs;
+@@ignore_db_dirs
+db3,db4
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(i int) ENGINE INNODB;
diff --git a/mysql-test/suite/mariabackup/partial_exclude.test b/mysql-test/suite/mariabackup/partial_exclude.test
index cd21ecff29b..99d14e58231 100644
--- a/mysql-test/suite/mariabackup/partial_exclude.test
+++ b/mysql-test/suite/mariabackup/partial_exclude.test
@@ -1,6 +1,13 @@
#--source include/innodb_page_size.inc
# Test --databases-exclude and --tables-exclude feature of xtrabackup 2.3.8
+select @@ignore_db_dirs;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+mkdir $MYSQLD_DATADIR/db3;
+mkdir $MYSQLD_DATADIR/db4;
+mkdir $MYSQLD_DATADIR/db5;
CREATE TABLE t1(i INT) ENGINE INNODB;
INSERT INTO t1 VALUES(1);
@@ -24,8 +31,19 @@ list_files $targetdir/test *.ibd;
# check that db2 database is not in the backup (excluded)
--error 1
list_files $targetdir/db2 *.ibd;
+# check that db3 database is not in the backup (excluded)
+--error 1
+list_files $targetdir/db3 *.ibd;
+# check that db4 database is not in the backup (excluded)
+--error 1
+list_files $targetdir/db4 *.ibd;
+# check that db5 database is in the backup
+list_files $targetdir/db5 *.ibd;
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db2;
+rmdir $MYSQLD_DATADIR/db3;
+rmdir $MYSQLD_DATADIR/db4;
+rmdir $MYSQLD_DATADIR/db5;
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.result b/mysql-test/suite/mariabackup/rpl_slave_info.result
new file mode 100644
index 00000000000..13044fd6c39
--- /dev/null
+++ b/mysql-test/suite/mariabackup/rpl_slave_info.result
@@ -0,0 +1,37 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+###############
+# If Using_Gtid != 'No', backup gtid_slave_pos
+########################
+include/stop_slave.inc
+change master to master_use_gtid=slave_pos;
+include/start_slave.inc
+connection master;
+CREATE TABLE t(i INT);
+connection slave;
+"using_gtid: Slave_Pos"
+FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info
+NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info
+###############
+# If Using_Gtid != 'No' and !gtid_slave_pos, backup master position
+########################
+include/stop_slave.inc
+SET GLOBAL gtid_slave_pos="";
+NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
+FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
+###############
+# If Using_Gtid == 'No', backup Exec_Master_Log_Pos
+########################
+change master to master_use_gtid=no;
+include/start_slave.inc
+connection master;
+INSERT INTO t VALUES(1);
+connection slave;
+"using_gtid: No"
+NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
+FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
+connection master;
+DROP TABLE t;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.test b/mysql-test/suite/mariabackup/rpl_slave_info.test
new file mode 100644
index 00000000000..ca7682d8af9
--- /dev/null
+++ b/mysql-test/suite/mariabackup/rpl_slave_info.test
@@ -0,0 +1,84 @@
+--source include/master-slave.inc
+
+--connection slave
+
+--echo ###############
+--echo # If Using_Gtid != 'No', backup gtid_slave_pos
+--echo ########################
+
+--source include/stop_slave.inc
+change master to master_use_gtid=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+CREATE TABLE t(i INT);
+--sync_slave_with_master
+
+--let $using_gtid=query_get_value(SHOW SLAVE STATUS,Using_Gtid,1)
+--echo "using_gtid: $using_gtid"
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
+--enable_result_log
+
+--let SEARCH_FILE=$targetdir/xtrabackup_slave_info
+--let SEARCH_PATTERN=gtid_slave_pos
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=MASTER_LOG_FILE
+--source include/search_pattern_in_file.inc
+
+rmdir $targetdir;
+
+--echo ###############
+--echo # If Using_Gtid != 'No' and !gtid_slave_pos, backup master position
+--echo ########################
+
+--source include/stop_slave.inc
+SET GLOBAL gtid_slave_pos="";
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
+--enable_result_log
+
+--let SEARCH_FILE=$targetdir/xtrabackup_slave_info
+--let SEARCH_PATTERN=gtid_slave_pos
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=MASTER_LOG_FILE
+--source include/search_pattern_in_file.inc
+
+rmdir $targetdir;
+
+--echo ###############
+--echo # If Using_Gtid == 'No', backup Exec_Master_Log_Pos
+--echo ########################
+
+change master to master_use_gtid=no;
+--source include/start_slave.inc
+
+--connection master
+INSERT INTO t VALUES(1);
+--sync_slave_with_master
+
+--let $using_gtid=query_get_value(SHOW SLAVE STATUS,Using_Gtid,1)
+--echo "using_gtid: $using_gtid"
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir;
+--enable_result_log
+
+--let SEARCH_FILE=$targetdir/xtrabackup_slave_info
+--let SEARCH_PATTERN=gtid_slave_pos
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=MASTER_LOG_FILE
+--source include/search_pattern_in_file.inc
+
+rmdir $targetdir;
+
+# Cleanup
+--connection master
+DROP TABLE t;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/multi_source/info_logs.test b/mysql-test/suite/multi_source/info_logs.test
index ef504e06a2f..234e317e5ce 100644
--- a/mysql-test/suite/multi_source/info_logs.test
+++ b/mysql-test/suite/multi_source/info_logs.test
@@ -150,7 +150,7 @@ show all slaves status;
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
restart
EOF
---shutdown_server 60
+--shutdown_server
--source include/wait_until_connected_again.inc
--source include/wait_for_slave_to_start.inc
set default_master_connection = 'MASTER 2.2';
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
index 760d7342752..a0be9e23818 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
@@ -1,3 +1,4 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
create table `t1` (`c1` char(1) default null,`c2` char(10) default null,
key (`c1`))
@@ -7,3 +8,4 @@ select * from `t1` where `c1`='3' for update;
c1 c2
3 NULL
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
index 5e53649c538..59ab7607a40 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
@@ -1,6 +1,7 @@
#
# Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on
#
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t (
dummy INT PRIMARY KEY,
@@ -13,3 +14,4 @@ dummy a b
3 3 3
5 5 5
DROP TABLE t;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
index 31e39d4421d..acc18b06ea0 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
@@ -1,3 +1,4 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
drop table if exists `t1`;
Warnings:
@@ -6,3 +7,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb;
insert into `t1` values(2,2);
delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ;
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
index e4fdf0d03a7..f5554563a18 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
@@ -1,3 +1,4 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@@ -252,3 +253,4 @@ Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
drop table `table5`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
index 0cd801280c8..f6f5cd7c6fd 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
@@ -1,3 +1,4 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
KEY(c1), UNIQUE INDEX(c2)) engine=innodb;
@@ -9,3 +10,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
c1 c2 c3
08:29:45 NULL 2009-02-01
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
index 899bf04e635..7e838906114 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
@@ -1,6 +1,7 @@
#
# Bug#43360 - Server crash with a simple multi-table update
#
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t1 (
a CHAR(2) NOT NULL PRIMARY KEY,
@@ -42,3 +43,4 @@ AB Sweden
MS United States of Ame
JA USA
DROP TABLE t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result
index a8f56923386..9b7a2c459c3 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result
@@ -1,6 +1,7 @@
#
# Bug#43448 - Server crashes on multi table delete with Innodb
#
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t1 (
id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -28,3 +29,4 @@ DELETE t1, t2, t3
FROM t1, t2, t3
WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5;
DROP TABLE t1, t2, t3;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
index 0d88ff3d2cb..11f915aaf8e 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
@@ -1,6 +1,7 @@
set storage_engine=innodb;
set @save_time_zone= @@time_zone;
set time_zone='+03:00';
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
@@ -100,3 +101,4 @@ c1 c2 c3 c4
2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
DROP TABLE t1;
set time_zone= @save_time_zone;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
index da9de306b09..5c316c0a4d6 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
@@ -4,6 +4,7 @@
--source include/have_innodb.inc
# crash requires this
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
create table `t1` (`c1` char(1) default null,`c2` char(10) default null,
@@ -12,3 +13,4 @@ engine=innodb default charset=latin1;
insert into `t1` values ('3',null);
select * from `t1` where `c1`='3' for update;
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
index b16f55aa951..41d38445095 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
@@ -5,6 +5,7 @@
--source include/have_debug.inc
--source include/have_innodb.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
# Crash requires that we enable Index Condition Pushdown in InnoDB
set session debug_dbug="+d,optimizer_innodb_icp";
@@ -19,3 +20,4 @@ INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5);
SELECT * FROM t WHERE a > 2 FOR UPDATE;
DROP TABLE t;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
index 7d6237fa536..0eb7e34a9dd 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
@@ -5,6 +5,7 @@
--source include/have_innodb.inc
# crash requires this
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
drop table if exists `t1`;
@@ -12,3 +13,4 @@ create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb;
insert into `t1` values(2,2);
delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ;
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
index 2b5864a3e69..d59e9e1fbeb 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
@@ -6,6 +6,7 @@
--source include/have_innodb.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
# Valgrind errors happen only with this:
set session debug_dbug="+d,optimizer_innodb_icp";
@@ -246,3 +247,4 @@ UNLOCK TABLES;
select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ;
drop table `table5`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
index 6275038a650..c647b777059 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
@@ -4,6 +4,7 @@
--source include/have_debug.inc
--source include/have_innodb.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
@@ -15,3 +16,4 @@ SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
index 9bfff0ccdb7..0896caa7712 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
@@ -6,6 +6,7 @@
--source include/have_debug.inc
--source include/have_innodb.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
# crash requires this
set session debug_dbug="+d,optimizer_innodb_icp";
@@ -42,3 +43,4 @@ SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test
index f7f40a6d3bf..4e1df63b45b 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test
@@ -5,6 +5,7 @@
--source include/have_debug.inc
--source include/have_innodb.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
# crash requires ICP support in InnoDB
set session debug_dbug="+d,optimizer_innodb_icp";
@@ -58,3 +59,4 @@ FROM t1, t2, t3
WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5;
DROP TABLE t1, t2, t3;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
index 2b5b5fd96dd..02d0ab6d566 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
@@ -6,6 +6,7 @@
set storage_engine=innodb;
set @save_time_zone= @@time_zone;
set time_zone='+03:00';
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,optimizer_innodb_icp";
######## Running INSERT tests for TIMESTAMP ########
@@ -83,4 +84,4 @@ SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER
DROP TABLE t1;
set time_zone= @save_time_zone;
-
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc
index 199c8680864..4392d04db8a 100644
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc
@@ -861,6 +861,17 @@ SELECT * FROM t1;
DROP TABLE t1;
}
+if (!$skip_update)
+{
+--echo #
+--echo # MDEV-19622 Assertion failures in
+--echo # ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+--echo #
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
+}
--echo ##############################################################################
}
diff --git a/mysql-test/suite/parts/r/longname.result b/mysql-test/suite/parts/r/longname.result
index c95e666625e..2ca0871bc8d 100644
--- a/mysql-test/suite/parts/r/longname.result
+++ b/mysql-test/suite/parts/r/longname.result
@@ -24,5 +24,39 @@ SUBPARTITION BY HASH ( id2 )
SUBPARTITIONS 2 (
PARTITION çççççççççççççççççççççççççççççççççççççççççççççççççççççççççççç VALUES LESS THAN (1000) ENGINE = InnoDB,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
-ERROR HY000: The path specified for @0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@ is too long
+ERROR HY000: The path specified for @0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@... is too long
+SET @file_per_table=@@GLOBAL.innodb_file_per_table;
+SET GLOBAL innodb_file_per_table=0;
+CREATE TABLE mysqltest1.t1 (a INT) ENGINE=INNODB
+PARTITION BY RANGE (a) SUBPARTITION BY HASH(a)
+(PARTITION `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$`
+ VALUES LESS THAN (10)
+(SUBPARTITION
+`--------------------------abcdef0123456789abcdef0123456789abcdef`,
+SUBPARTITION
+`0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`)
+);
+SET GLOBAL innodb_file_per_table=@file_per_table;
+SHOW CREATE TABLE mysqltest1.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`a`)
+SUBPARTITION BY HASH (`a`)
+(PARTITION `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$` VALUES LESS THAN (10)
+ (SUBPARTITION `--------------------------abcdef0123456789abcdef0123456789abcdef` ENGINE = InnoDB,
+ SUBPARTITION `0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef` ENGINE = InnoDB))
+INSERT INTO mysqltest1.t1 VALUES(1);
+DROP TABLE mysqltest1.`#mysql50#t1#P#@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024#SP#0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`;
+ERROR 42000: Incorrect table name '#mysql50#t1#P#@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@'
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
+WHERE NAME LIKE 'mysqltest1%';
+NAME
+mysqltest1/t1#P#@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024#SP#0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
+mysqltest1/t1#P#@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024#SP#@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002d@002dabcdef0123456789abcdef0123456789abcdef
+mysqltest1/test_jfg_table_name_with_64_chars_123456789012345678901234567890#P#pmax#SP#pmaxsp0
+mysqltest1/test_jfg_table_name_with_64_chars_123456789012345678901234567890#P#pmax#SP#pmaxsp1
+mysqltest1/test_jfg_table_name_with_64_chars_123456789012345678901234567890#P#test_jfg_partition_name_with_60_chars_1234567890123456789012#SP#test_jfg_partition_name_with_60_chars_1234567890123456789012sp0
+mysqltest1/test_jfg_table_name_with_64_chars_123456789012345678901234567890#P#test_jfg_partition_name_with_60_chars_1234567890123456789012#SP#test_jfg_partition_name_with_60_chars_1234567890123456789012sp1
drop database mysqltest1;
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
index 6250f28eb00..76f1ddfceae 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
@@ -1101,4 +1101,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-19622 Assertion failures in
+# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+#
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_maria.result b/mysql-test/suite/parts/r/partition_auto_increment_maria.result
index 5acce3e9492..5a3902475a9 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_maria.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_maria.result
@@ -1148,4 +1148,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-19622 Assertion failures in
+# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+#
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_memory.result b/mysql-test/suite/parts/r/partition_auto_increment_memory.result
index e622ddaa259..c395f8ed0c9 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result
@@ -1129,4 +1129,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-19622 Assertion failures in
+# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+#
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
index 4e67094b327..792423096b5 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result
@@ -1148,4 +1148,12 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-19622 Assertion failures in
+# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+#
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
##############################################################################
diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result
index 7460fe8dd74..96ed9b010b7 100644
--- a/mysql-test/suite/parts/r/partition_debug.result
+++ b/mysql-test/suite/parts/r/partition_debug.result
@@ -1,3 +1,4 @@
+FLUSH TABLES;
#
# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
@@ -6,11 +7,11 @@ CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
PARTITION BY HASH (a) PARTITIONS 3;
INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
(6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
-SET @save_dbug=@@debug_dbug;
+SET @saved_dbug=@@debug_dbug;
SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
SELECT * FROM t1 WHERE b = "Seven";
ERROR HY000: Table has no partition for value 0
-SET SESSION debug_dbug=@save_dbug;
+SET SESSION debug_dbug=@saved_dbug;
SELECT * FROM t1 WHERE b = "Seven";
a b
7 Seven
diff --git a/mysql-test/suite/parts/r/partition_syntax_innodb.result b/mysql-test/suite/parts/r/partition_syntax_innodb.result
index ff1ca17bd5d..596ecc7b717 100644
--- a/mysql-test/suite/parts/r/partition_syntax_innodb.result
+++ b/mysql-test/suite/parts/r/partition_syntax_innodb.result
@@ -770,7 +770,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -779,7 +779,7 @@ f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -797,7 +797,7 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31 , SUBPART' at line 7
+(SUBPARTITION subpart31 , SUBP...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -987,7 +987,7 @@ SUBPARTITIONS -1
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1032,7 +1032,7 @@ SUBPARTITIONS 2.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1055,7 +1055,7 @@ SUBPARTITIONS -2.0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1078,7 +1078,7 @@ SUBPARTITIONS 0.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1101,7 +1101,7 @@ SUBPARTITIONS 1.6
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1.6
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1123,7 +1123,7 @@ SUBPARTITIONS 999999999999999999999999999999.999999999999999999999999999999
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999
-(PARTITION part1 V' at line 9
+(PARTITION part...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1146,7 +1146,7 @@ SUBPARTITIONS 0.000000000000000000000000000001
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.000000000000000000000000000001
(PARTITION part1 VALUES LESS THAN (10),
-PARTITI' at line 9
+PART...' at line 9
# 4.2.3 partition/subpartition numbers FLOAT notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1170,7 +1170,7 @@ SUBPARTITIONS 2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1193,7 +1193,7 @@ SUBPARTITIONS 0.2E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.2E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1216,7 +1216,7 @@ SUBPARTITIONS -2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1239,7 +1239,7 @@ SUBPARTITIONS 0.16E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.16E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1262,7 +1262,7 @@ SUBPARTITIONS 0.0E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1285,7 +1285,7 @@ SUBPARTITIONS 1E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1308,7 +1308,7 @@ SUBPARTITIONS 1E-300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E-300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
# 4.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1332,7 +1332,7 @@ SUBPARTITIONS '2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1355,7 +1355,7 @@ SUBPARTITIONS '2.0'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2.0'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (' at line 9
+PARTITION part2 VALUES LESS THA...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1378,7 +1378,7 @@ SUBPARTITIONS '0.2E+1'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''0.2E+1'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1401,7 +1401,7 @@ SUBPARTITIONS '2A'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2A'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1424,7 +1424,7 @@ SUBPARTITIONS 'A2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''A2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1447,7 +1447,7 @@ SUBPARTITIONS ''
PARTITION part2 VALUES LESS THAN (2147483646));
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 '''
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1470,7 +1470,7 @@ SUBPARTITIONS 'GARBAGE'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''GARBAGE'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.5 partition/subpartition numbers other notations
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1494,7 +1494,7 @@ SUBPARTITIONS 2A
PARTITION part2 VALUES LESS THAN (2147483646));
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 '2A
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1517,7 +1517,7 @@ SUBPARTITIONS A2
PARTITION part2 VALUES LESS THAN (2147483646));
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 'A2
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1540,7 +1540,7 @@ SUBPARTITIONS GARBAGE
PARTITION part2 VALUES LESS THAN (2147483646));
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 'GARBAGE
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1563,7 +1563,7 @@ SUBPARTITIONS "2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1586,7 +1586,7 @@ SUBPARTITIONS "2A"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2A"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1609,7 +1609,7 @@ SUBPARTITIONS "A2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"A2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1632,7 +1632,7 @@ SUBPARTITIONS "GARBAGE"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"GARBAGE"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.6 (negative) partition/subpartition numbers per @variables
SET @aux = 5;
CREATE TABLE t1 (
@@ -1657,7 +1657,7 @@ SUBPARTITIONS @aux = 5
PARTITION part2 VALUES LESS THAN (2147483646));
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 '@aux = 5
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
#------------------------------------------------------------------------
# 4.3 Mixups of assigned partition/subpartition numbers and names
#------------------------------------------------------------------------
@@ -1750,7 +1750,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1769,7 +1769,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31, SUBPAR' at line 13
+(SUBPARTITION subpart31, SUB...' at line 13
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1812,7 +1812,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1831,7 +1831,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2000)
-(SUBPARTITION subpart21 ' at line 11
+(SUBPARTITION subpart21 ...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1848,7 +1848,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
#========================================================================
# 5. Checks of logical partition/subpartition name
diff --git a/mysql-test/suite/parts/r/partition_syntax_myisam.result b/mysql-test/suite/parts/r/partition_syntax_myisam.result
index b54591fe538..aaa11001cbd 100644
--- a/mysql-test/suite/parts/r/partition_syntax_myisam.result
+++ b/mysql-test/suite/parts/r/partition_syntax_myisam.result
@@ -802,7 +802,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -811,7 +811,7 @@ f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -829,7 +829,7 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31 , SUBPART' at line 7
+(SUBPARTITION subpart31 , SUBP...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -1069,7 +1069,7 @@ SUBPARTITIONS -1
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1114,7 +1114,7 @@ SUBPARTITIONS 2.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1137,7 +1137,7 @@ SUBPARTITIONS -2.0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1160,7 +1160,7 @@ SUBPARTITIONS 0.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1183,7 +1183,7 @@ SUBPARTITIONS 1.6
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1.6
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1205,7 +1205,7 @@ SUBPARTITIONS 999999999999999999999999999999.999999999999999999999999999999
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999
-(PARTITION part1 V' at line 9
+(PARTITION part...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1228,7 +1228,7 @@ SUBPARTITIONS 0.000000000000000000000000000001
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.000000000000000000000000000001
(PARTITION part1 VALUES LESS THAN (10),
-PARTITI' at line 9
+PART...' at line 9
# 4.2.3 partition/subpartition numbers FLOAT notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1252,7 +1252,7 @@ SUBPARTITIONS 2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1275,7 +1275,7 @@ SUBPARTITIONS 0.2E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.2E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1298,7 +1298,7 @@ SUBPARTITIONS -2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1321,7 +1321,7 @@ SUBPARTITIONS 0.16E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.16E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1344,7 +1344,7 @@ SUBPARTITIONS 0.0E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1367,7 +1367,7 @@ SUBPARTITIONS 1E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1390,7 +1390,7 @@ SUBPARTITIONS 1E-300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E-300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
# 4.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1414,7 +1414,7 @@ SUBPARTITIONS '2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1437,7 +1437,7 @@ SUBPARTITIONS '2.0'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2.0'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (' at line 9
+PARTITION part2 VALUES LESS THA...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1460,7 +1460,7 @@ SUBPARTITIONS '0.2E+1'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''0.2E+1'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1483,7 +1483,7 @@ SUBPARTITIONS '2A'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2A'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1506,7 +1506,7 @@ SUBPARTITIONS 'A2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''A2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1529,7 +1529,7 @@ SUBPARTITIONS ''
PARTITION part2 VALUES LESS THAN (2147483646));
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 '''
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1552,7 +1552,7 @@ SUBPARTITIONS 'GARBAGE'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''GARBAGE'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.5 partition/subpartition numbers other notations
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1576,7 +1576,7 @@ SUBPARTITIONS 2A
PARTITION part2 VALUES LESS THAN (2147483646));
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 '2A
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1599,7 +1599,7 @@ SUBPARTITIONS A2
PARTITION part2 VALUES LESS THAN (2147483646));
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 'A2
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1622,7 +1622,7 @@ SUBPARTITIONS GARBAGE
PARTITION part2 VALUES LESS THAN (2147483646));
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 'GARBAGE
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1645,7 +1645,7 @@ SUBPARTITIONS "2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1668,7 +1668,7 @@ SUBPARTITIONS "2A"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2A"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1691,7 +1691,7 @@ SUBPARTITIONS "A2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"A2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1714,7 +1714,7 @@ SUBPARTITIONS "GARBAGE"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"GARBAGE"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.6 (negative) partition/subpartition numbers per @variables
SET @aux = 5;
CREATE TABLE t1 (
@@ -1739,7 +1739,7 @@ SUBPARTITIONS @aux = 5
PARTITION part2 VALUES LESS THAN (2147483646));
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 '@aux = 5
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
#------------------------------------------------------------------------
# 4.3 Mixups of assigned partition/subpartition numbers and names
#------------------------------------------------------------------------
@@ -1852,7 +1852,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1871,7 +1871,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31, SUBPAR' at line 13
+(SUBPARTITION subpart31, SUB...' at line 13
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1914,7 +1914,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1933,7 +1933,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2000)
-(SUBPARTITION subpart21 ' at line 11
+(SUBPARTITION subpart21 ...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1950,7 +1950,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
#========================================================================
# 5. Checks of logical partition/subpartition name
diff --git a/mysql-test/suite/parts/t/longname.test b/mysql-test/suite/parts/t/longname.test
index 0f7378ef8e3..0fe45d0d5ff 100644
--- a/mysql-test/suite/parts/t/longname.test
+++ b/mysql-test/suite/parts/t/longname.test
@@ -1,5 +1,7 @@
source include/have_innodb.inc;
source include/have_partition.inc;
+# The absolute path names in the embedded server hit the limit earlier.
+source include/not_embedded.inc;
set names utf8;
create database mysqltest1;
@@ -29,4 +31,28 @@ PARTITION BY RANGE ( id )
PARTITION çççççççççççççççççççççççççççççççççççççççççççççççççççççççççççç VALUES LESS THAN (1000) ENGINE = InnoDB,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
+SET @file_per_table=@@GLOBAL.innodb_file_per_table;
+SET GLOBAL innodb_file_per_table=0;
+
+CREATE TABLE mysqltest1.t1 (a INT) ENGINE=INNODB
+PARTITION BY RANGE (a) SUBPARTITION BY HASH(a)
+(PARTITION `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$`
+ VALUES LESS THAN (10)
+ (SUBPARTITION
+ `--------------------------abcdef0123456789abcdef0123456789abcdef`,
+ SUBPARTITION
+ `0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`)
+);
+
+SET GLOBAL innodb_file_per_table=@file_per_table;
+
+SHOW CREATE TABLE mysqltest1.t1;
+INSERT INTO mysqltest1.t1 VALUES(1);
+
+--error ER_WRONG_TABLE_NAME
+DROP TABLE mysqltest1.`#mysql50#t1#P#@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024@0024#SP#0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`;
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
+WHERE NAME LIKE 'mysqltest1%';
+
drop database mysqltest1;
diff --git a/mysql-test/suite/parts/t/partition_debug.test b/mysql-test/suite/parts/t/partition_debug.test
index ef12ee99948..6d7cf3ae8b3 100644
--- a/mysql-test/suite/parts/t/partition_debug.test
+++ b/mysql-test/suite/parts/t/partition_debug.test
@@ -8,6 +8,10 @@
# Crash tests don't work with embedded
--source include/not_embedded.inc
+# Make sure system tables are not open, as the test will kill the server
+# and it will cause corruption errors in the log
+FLUSH TABLES;
+
# Partitioning test that require debug features
--echo #
@@ -18,11 +22,11 @@ CREATE TABLE t1 (a INT, b VARCHAR(64), KEY(b,a))
PARTITION BY HASH (a) PARTITIONS 3;
INSERT INTO t1 VALUES (1, "1"), (2, "2"), (3, "3"), (4, "Four"), (5, "Five"),
(6, "Six"), (7, "Seven"), (8, "Eight"), (9, "Nine");
-SET @save_dbug=@@debug_dbug;
+SET @saved_dbug=@@debug_dbug;
SET SESSION debug_dbug="+d,ha_partition_fail_index_init";
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
SELECT * FROM t1 WHERE b = "Seven";
-SET SESSION debug_dbug=@save_dbug;
+SET SESSION debug_dbug=@saved_dbug;
SELECT * FROM t1 WHERE b = "Seven";
DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/partition_debug_innodb.test b/mysql-test/suite/parts/t/partition_debug_innodb.test
index c3fa85ba5ba..0d065d0e3f2 100644
--- a/mysql-test/suite/parts/t/partition_debug_innodb.test
+++ b/mysql-test/suite/parts/t/partition_debug_innodb.test
@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES (6, 'X 6 row'), (7, 'Seventh row'), (8, 'Last row');
ALTER TABLE t1 ADD INDEX new_b_index (b);
ALTER TABLE t1 DROP INDEX new_b_index;
-SET @save_dbug=@@debug_dbug;
+SET @saved_dbug=@@debug_dbug;
SET SESSION debug_dbug = "+d,ha_partition_fail_final_add_index";
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
@@ -46,7 +46,7 @@ SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
-SET SESSION debug_dbug = @save_dbug;
+SET SESSION debug_dbug = @saved_dbug;
SHOW CREATE TABLE t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test
index b0a6c98870c..43af0460118 100644
--- a/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test
+++ b/mysql-test/suite/percona/slow_extended.patch/percona_slow_extended-slave_innodb_stats.test
@@ -23,7 +23,7 @@ STOP SLAVE;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
index 27243b52422..86cab03c4c6 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result
index 7879919b09d..f824c319afa 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
index 1d5923483c9..33948013822 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result
index 87fc75817df..096c5c3dbd5 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_bad_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
index 949fa8f9c3e..f36e4604a7c 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN null
LAST_ERROR_SEEN null
revoke select on test.* from 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result
index b2e0fb60811..d84ffe2e9df 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_good_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
ERROR HY000: Host 'santa.claus.ipv4.example.com' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
index bfc7fde5be8..ff2a93efec4 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_allow.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -103,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com';
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result
index 41eb9636e31..c300d6a50af 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_noname_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result
index 22dd7e7632c..1c34faa9457 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
uninstall plugin test_plugin_server;
ERROR HY000: Plugin 'test_plugin_server' is not loaded
@@ -194,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com'
FROM 'plug'@'santa.claus.ipv4.example.com';
DROP USER 'plug'@'santa.claus.ipv4.example.com';
DROP USER 'plug_dest'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
delete from mysql.plugin where name='test_plugin_server';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
index f301df94ce6..2751dbd7edb 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_blocked.result
@@ -25,6 +25,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply";
ERROR 08S01: Bad handshake
connection default;
@@ -427,4 +428,4 @@ drop user 'root'@'santa.claus.ipv4.example.com';
revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com';
drop user 'quota'@'santa.claus.ipv4.example.com';
set global max_connect_errors = @saved_max_connect_errors;
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result
index 14a6ace09e4..18e437559e4 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_format.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
index 6cca75f9775..3d41f013ba9 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
@@ -25,6 +25,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
connect con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
select "Con2a is alive";
@@ -702,4 +703,4 @@ disconnect tmp_con7;
set global max_connections = @saved_max_connections;
set global max_user_connections = @saved_max_user_connections;
drop user 'quota'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
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 5aa80d90d84..7bafd9e636f 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
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -178,4 +179,4 @@ revoke select on test.* from 'root'@'192.0.2.4';
revoke select on test.* from 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'192.0.2.4';
drop user 'root'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result
index abe9a606bc4..3896ed086ba 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_again_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -142,4 +143,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
index 18986674491..236bc12d9bf 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname";
connect con2,"127.0.0.1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result
index 88ac817ce17..5479393c29b 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_nameinfo_noname_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname";
ERROR HY000: Host '192.0.2.4' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result
index a5f70873ed9..4c2a9d48a63 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_passwd.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv4.example.com' (using password: YES)
connection default;
@@ -207,4 +208,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
drop user 'user_with'@'santa.claus.ipv4.example.com';
drop user 'user_without'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result
index 86e7bf5780b..267f346836d 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_ssl.result
@@ -28,6 +28,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv4.example.com' (using password: NO)
connection default;
@@ -151,4 +152,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
drop user 'user_ssl'@'santa.claus.ipv4.example.com';
drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
index 42d86e858fb..4325cfec6dc 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result
index 87e97ba2138..12435dd54f5 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again";
ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
index bcd47243d03..57e14dfe913 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result
index 5c24a86248a..654ed7759b1 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6";
ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
index 68ea9a1d826..f68d90978e7 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN null
LAST_ERROR_SEEN null
revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result
index 5b1f546b30e..e63c84bf352 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_good_deny.result
@@ -19,6 +19,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
ERROR HY000: Host 'santa.claus.ipv6.example.com' is not allowed to connect to this MariaDB server
connection default;
@@ -80,4 +81,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
index 0a3a3329c1e..50297797f6a 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -103,4 +104,4 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result
index 493ada909b7..549e83369df 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname";
ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result
index a36d1442ee6..5312958bd91 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
uninstall plugin test_plugin_server;
ERROR HY000: Plugin 'test_plugin_server' is not loaded
@@ -194,5 +195,5 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com'
FROM 'plug'@'santa.claus.ipv6.example.com';
DROP USER 'plug'@'santa.claus.ipv6.example.com';
DROP USER 'plug_dest'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
delete from mysql.plugin where name='test_plugin_server';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
index 7cfb6f87277..757285b1033 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_blocked.result
@@ -25,6 +25,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply";
ERROR 08S01: Bad handshake
connection default;
@@ -427,4 +428,4 @@ drop user 'root'@'santa.claus.ipv6.example.com';
revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com';
drop user 'quota'@'santa.claus.ipv6.example.com';
set global max_connect_errors = @saved_max_connect_errors;
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
index f9d2b556804..f2e25ab6ca1 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
@@ -25,6 +25,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
connect con2a,"::1",quota,,test,$MASTER_MYPORT,;
select "Con2a is alive";
@@ -702,4 +703,4 @@ disconnect tmp_con7;
set global max_connections = @saved_max_connections;
set global max_user_connections = @saved_max_user_connections;
drop user 'quota'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
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 6140f655e7c..2bb23e99203 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
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -178,4 +179,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6';
revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'2001:db8::6:6';
drop user 'root'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result
index 22ce0c3e809..5befbd98087 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again";
ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server
connection default;
@@ -142,4 +143,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
index a78ba09513c..f899cb935e9 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
@@ -22,6 +22,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname";
connect con2,"::1",root,,test,$MASTER_MYPORT,;
select "Con2 is alive";
@@ -99,4 +100,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result
index da1570f1b37..6d50530ffa0 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_deny.result
@@ -20,6 +20,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname";
ERROR HY000: Host '2001:db8::6:6' is not allowed to connect to this MariaDB server
connection default;
@@ -81,4 +82,4 @@ COUNT_LOCAL_ERRORS 0
COUNT_UNKNOWN_ERRORS 0
FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result
index a4cc3eeb0d0..670a3713d91 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_passwd.result
@@ -24,6 +24,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
ERROR 28000: Access denied for user 'user_without'@'santa.claus.ipv6.example.com' (using password: YES)
connection default;
@@ -207,4 +208,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
drop user 'user_with'@'santa.claus.ipv6.example.com';
drop user 'user_without'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result
index 75f8e5391cf..9ec33df2fee 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_ssl.result
@@ -28,6 +28,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
ERROR 28000: Access denied for user 'user_ssl'@'santa.claus.ipv6.example.com' (using password: NO)
connection default;
@@ -151,4 +152,4 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
drop user 'user_ssl'@'santa.claus.ipv6.example.com';
drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result
index ddb44157f44..6d15f2f5b25 100644
--- a/mysql-test/suite/perfschema/r/hostcache_peer_addr.result
+++ b/mysql-test/suite/perfschema/r/hostcache_peer_addr.result
@@ -27,6 +27,7 @@ current_user()
root@localhost
disconnect con1;
connection default;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_error";
ERROR HY000: Can't get hostname for your address
connection default;
@@ -50,7 +51,7 @@ Connection_errors_peer_address 2
Connection_errors_select 0
Connection_errors_tcpwrap 0
"Dumping performance_schema.host_cache"
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
flush status;
show global status like "connection_errors_%";
Variable_name Value
diff --git a/mysql-test/suite/perfschema/t/ddl_esms_by_digest.test b/mysql-test/suite/perfschema/t/ddl_esms_by_digest.test
index cea7ea27299..9cf1775c8e5 100644
--- a/mysql-test/suite/perfschema/t/ddl_esms_by_digest.test
+++ b/mysql-test/suite/perfschema/t/ddl_esms_by_digest.test
@@ -1,13 +1,20 @@
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+# it under the terms of the GNU General Public License, version 2.0,
+# as published by the Free Software Foundation.
+#
+# This program is also distributed with certain software (including
+# but not limited to OpenSSL) that is licensed under separate terms,
+# as designated in a particular file or component or in included license
+# documentation. The authors of MySQL hereby grant you an additional
+# permission to link the program and your derivative works with the
+# separately licensed software that they have included with MySQL.
#
# 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.
+# GNU General Public License, version 2.0, 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,
diff --git a/mysql-test/suite/perfschema/t/dml_esms_by_digest.test b/mysql-test/suite/perfschema/t/dml_esms_by_digest.test
index 88729e6a7a8..b71c6f2815b 100644
--- a/mysql-test/suite/perfschema/t/dml_esms_by_digest.test
+++ b/mysql-test/suite/perfschema/t/dml_esms_by_digest.test
@@ -1,13 +1,20 @@
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. 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.
+# it under the terms of the GNU General Public License, version 2.0,
+# as published by the Free Software Foundation.
+#
+# This program is also distributed with certain software (including
+# but not limited to OpenSSL) that is licensed under separate terms,
+# as designated in a particular file or component or in included license
+# documentation. The authors of MySQL hereby grant you an additional
+# permission to link the program and your derivative works with the
+# separately licensed software that they have included with MySQL.
#
# 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.
+# GNU General Public License, version 2.0, 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,
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
index 6bed01e50bf..c96c8ea37c8 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
@@ -27,6 +27,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -48,5 +49,5 @@ disconnect con3;
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test
index 3c72de8a05e..00f5d218e17 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_deny.test
@@ -25,6 +25,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_again";
--disable_query_log
@@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
index 5cbe4c30530..d2dff92834e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_allow.test
@@ -30,6 +30,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -51,5 +52,5 @@ disconnect con3;
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test
index c0639cd6b86..f37e1ed3b90 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_bad_deny.test
@@ -27,6 +27,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_bad_ipv4";
--disable_query_log
@@ -45,5 +46,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
index 3b69e0731a0..d2b5352d3a6 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_allow.test
@@ -28,6 +28,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -49,5 +50,5 @@ disconnect con3;
revoke select on test.* from 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test
index e6478c13951..55afb6f0c4f 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_good_deny.test
@@ -25,6 +25,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
--disable_query_log
@@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
index b4b11526af6..a6bd4c751e2 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_allow.test
@@ -30,6 +30,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -53,5 +54,5 @@ revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test
index 06f0f7d29ee..41b8b25efc4 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_noname_deny.test
@@ -25,6 +25,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_error_noname";
--disable_query_log
@@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test
index 325460e66ba..6e149b838ef 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test
@@ -30,6 +30,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
uninstall plugin test_plugin_server;
@@ -86,6 +87,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv4.example.com'
DROP USER 'plug'@'santa.claus.ipv4.example.com';
DROP USER 'plug_dest'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
delete from mysql.plugin where name='test_plugin_server';
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
index 6990a4e7118..d304cc5a1b8 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test
@@ -33,6 +33,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4,native_password_bad_reply";
--disable_query_log
@@ -156,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv4.example.com';
drop user 'quota'@'santa.claus.ipv4.example.com';
set global max_connect_errors = @saved_max_connect_errors;
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test
index b37bfc79ada..989c82ef0ad 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_format.test
@@ -24,6 +24,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_format_ipv4";
--disable_query_log
@@ -42,5 +43,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
index c0349184506..6420b8b5300 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
connect (con2a,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
@@ -259,5 +260,5 @@ set global max_user_connections = @saved_max_user_connections;
# revoke all privileges on test.* from 'quota'@'santa.claus.ipv4.example.com';
drop user 'quota'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
index 187879985c9..5a2caf5849e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_allow.test
@@ -30,6 +30,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -71,5 +72,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv4.example.com';
drop user 'root'@'192.0.2.4';
drop user 'root'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test
index a78c0dab4eb..6cd2664a04f 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_again_deny.test
@@ -25,6 +25,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_again";
--disable_query_log
@@ -61,5 +62,5 @@ connect (con5,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
index 23ecd51eb4f..19a3ebe9892 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_allow.test
@@ -28,6 +28,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname";
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,);
@@ -49,5 +50,5 @@ disconnect con3;
revoke select on test.* from 'root'@'192.0.2.4';
drop user 'root'@'192.0.2.4';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test
index 4b6c91c3df3..28e5615d273 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_nameinfo_noname_deny.test
@@ -25,6 +25,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_error_noname";
--disable_query_log
@@ -43,5 +44,5 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test
index ea331647b48..c6ff89f0902 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_passwd.test
@@ -29,6 +29,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
--disable_query_log
@@ -82,5 +83,5 @@ connect (con2f,"127.0.0.1",user_with,wrong_password,test,$MASTER_MYPORT,);
drop user 'user_with'@'santa.claus.ipv4.example.com';
drop user 'user_without'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test
index 2b949098bad..bd8d48984e4 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_ssl.test
@@ -30,6 +30,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4";
--disable_query_log
@@ -67,5 +68,5 @@ connect (con2d,"127.0.0.1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL)
drop user 'user_ssl'@'santa.claus.ipv4.example.com';
drop user 'user_ssl_x509'@'santa.claus.ipv4.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
index 11c45724f70..100fdffa377 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
@@ -29,6 +29,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -50,5 +51,5 @@ disconnect con3;
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
index bdbc0e3c025..8aafff745c4 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_deny.test
@@ -26,6 +26,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_again";
--disable_query_log
@@ -44,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
index 1eb0d3ec41f..eaf46a5c57e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -52,5 +53,5 @@ disconnect con3;
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
index f8a3cc23c00..6c4ede9da8e 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_deny.test
@@ -28,6 +28,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_bad_ipv6";
--disable_query_log
@@ -46,5 +47,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
index 6493bb61a1a..e290a5f8ab4 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_allow.test
@@ -29,6 +29,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -50,5 +51,5 @@ disconnect con3;
revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
index 065ae02dd49..4feb0ffb7c8 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_good_deny.test
@@ -22,6 +22,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
--disable_query_log
@@ -40,5 +41,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
index 9ebafc9627d..6b422a19dbd 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -54,5 +55,4 @@ revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
index 136b3c7a24f..c81b799edd1 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_deny.test
@@ -26,6 +26,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_error_noname";
--disable_query_log
@@ -44,5 +45,4 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
index 3a822bfacb3..d2e4ed69d79 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
uninstall plugin test_plugin_server;
@@ -87,6 +88,6 @@ REVOKE PROXY ON 'plug_dest'@'santa.claus.ipv6.example.com'
DROP USER 'plug'@'santa.claus.ipv6.example.com';
DROP USER 'plug_dest'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
delete from mysql.plugin where name='test_plugin_server';
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
index 0a04ec306cf..6da99e02444 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test
@@ -33,6 +33,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6,native_password_bad_reply";
--disable_query_log
@@ -156,5 +157,5 @@ revoke select on test.* from 'quota'@'santa.claus.ipv6.example.com';
drop user 'quota'@'santa.claus.ipv6.example.com';
set global max_connect_errors = @saved_max_connect_errors;
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
index b14fff1cc72..6f83221c496 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
@@ -32,6 +32,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
connect (con2a,"::1",quota,,test,$MASTER_MYPORT,);
@@ -241,5 +242,5 @@ set global max_user_connections = @saved_max_user_connections;
# revoke all privileges on test.* from 'quota'@'santa.claus.ipv6.example.com';
drop user 'quota'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
index b44b58eb0d5..896b9bb4886 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -72,5 +73,5 @@ revoke select on test.* from 'root'@'santa.claus.ipv6.example.com';
drop user 'root'@'2001:db8::6:6';
drop user 'root'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
index 073451c7e75..17cc1ffa528 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_deny.test
@@ -26,6 +26,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_again";
--disable_query_log
@@ -62,5 +63,5 @@ connect (con5,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
index a7b1a961f09..8e31420b6f1 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
@@ -29,6 +29,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname";
connect (con2,"::1",root,,test,$MASTER_MYPORT,);
@@ -50,5 +51,5 @@ disconnect con3;
revoke select on test.* from 'root'@'2001:db8::6:6';
drop user 'root'@'2001:db8::6:6';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
index 5c3d643b166..ddffc820a2b 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_deny.test
@@ -26,6 +26,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_error_noname";
--disable_query_log
@@ -44,5 +45,5 @@ connect (con3,"::1",root,,test,$MASTER_MYPORT,);
--connection default
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
index 7dcfbb922e5..7281a8b36ec 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_passwd.test
@@ -27,6 +27,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
--disable_query_log
@@ -80,5 +81,5 @@ connect (con2f,"::1",user_with,wrong_password,test,$MASTER_MYPORT,);
drop user 'user_with'@'santa.claus.ipv6.example.com';
drop user 'user_without'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
index 3ea4451c7aa..d822d9f9bed 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_ssl.test
@@ -31,6 +31,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv6,getnameinfo_fake_ipv6,getaddrinfo_fake_good_ipv6";
--disable_query_log
@@ -68,5 +69,5 @@ connect (con2d,"::1",user_ssl_x509,good_password,test,$MASTER_MYPORT,,SSL);
drop user 'user_ssl'@'santa.claus.ipv6.example.com';
drop user 'user_ssl_x509'@'santa.claus.ipv6.example.com';
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
diff --git a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test
index 65f33ce73a8..827421312dc 100644
--- a/mysql-test/suite/perfschema/t/hostcache_peer_addr.test
+++ b/mysql-test/suite/perfschema/t/hostcache_peer_addr.test
@@ -22,6 +22,7 @@ select current_user();
disconnect con1;
--connection default
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_error";
--disable_query_log
@@ -42,7 +43,7 @@ connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,);
show global status like "connection_errors_%";
--source ../include/hostcache_dump.inc
-set global debug_dbug= default;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
flush status;
show global status like "connection_errors_%";
diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result
index 9d5c7c4a02c..e70de36a2ec 100644
--- a/mysql-test/suite/plugins/r/audit_null_debug.result
+++ b/mysql-test/suite/plugins/r/audit_null_debug.result
@@ -11,5 +11,6 @@ uninstall plugin audit_null;
ERROR HY000: Index for table './mysql/plugin.MYI' is corrupt; try to repair it
SET debug_dbug=@old_dbug;
uninstall plugin audit_null;
+uninstall plugin audit_null;
ERROR 42000: PLUGIN audit_null does not exist
delete from mysql.plugin where name='audit_null';
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 4088b36d440..7c287b369b1 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -22,17 +22,16 @@ set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_logging=on;
set global server_audit_incl_users= repeat("'root',", 10000);
-ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
+ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','...'
show variables like 'server_audit_incl_users';
Variable_name Value
server_audit_incl_users
set global server_audit_excl_users= repeat("'root',", 10000);
-ERROR 42000: Variable 'server_audit_excl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
+ERROR 42000: Variable 'server_audit_excl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','...'
show variables like 'server_audit_excl_users';
Variable_name Value
server_audit_excl_users
connect con1,localhost,root,,mysql;
-connection default;
disconnect con1;
connect(localhost,no_such_user,,mysql,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,no_such_user,,mysql;
@@ -99,7 +98,6 @@ set global server_audit_mode=1;
set global server_audit_events='';
create database sa_db;
connect con1,localhost,root,,test;
-connection con1;
create table t1 (id2 int);
insert into t1 values (1), (2);
select * from t1;
@@ -112,8 +110,8 @@ create table sa_t1(id int);
insert into sa_t1 values (1), (2);
drop table sa_t1;
drop database sa_db;
-connection default;
disconnect con1;
+connection default;
create database sa_db;
use sa_db;
CREATE USER u1 IDENTIFIED BY 'pwd-123';
@@ -212,9 +210,38 @@ select 2;
2
2
drop table t1;
+set global server_audit_events='table';
+set global server_audit_incl_users='user1';
+create user user1@localhost;
+grant all on sa_db.* to user1@localhost;
+connect cn1,localhost,user1,,sa_db;
+connection cn1;
+create table t1(id int) engine=myisam;
+insert delayed into t1 values (1);
+connection default;
+# Waiting until INSERT DELAYED thread does the insert.
+drop table t1;
set global server_audit_logging= off;
+set global server_audit_incl_users='root';
set global server_audit_logging= on;
+disconnect cn1;
+drop user user1@localhost;
set global server_audit_events='';
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK);
+connect plug_con,localhost,plug,plug_dest;
+ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES)
+GRANT PROXY ON plug_dest TO plug;
+connect plug_con,localhost,plug,plug_dest;
+connection plug_con;
+select USER(),CURRENT_USER();
+USER() CURRENT_USER()
+plug@localhost plug_dest@%
+connection default;
+disconnect plug_con;
+DROP USER plug;
+DROP USER plug_dest;
set global server_audit_query_log_limit= 15;
select (1), (2), (3), (4);
1 2 3 4
@@ -250,7 +277,7 @@ server_audit_file_path
server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
-server_audit_incl_users odin, root, dva, tri
+server_audit_incl_users root
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
@@ -381,9 +408,57 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,user1,localhost,ID,ID,CREATE,sa_db,t1,
+TIME,HOSTNAME,user1,localhost,ID,ID,WRITE,sa_db,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= on',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,QUERY,sa_db,'set global server_audit_events=\'\'',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,QUERY,sa_db,'CREATE USER plug IDENTIFIED WITH \'test_plugin_server\' AS \'plug_dest\'',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,QUERY,sa_db,'CREATE USER plug_dest IDENTIFIED BY *****',0
+TIME,HOSTNAME,plug,localhost,ID,0,FAILED_CONNECT,,,ID
+TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0
+TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0
+TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0
+TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,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,QUERY,sa_db,'DROP USER plug',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,QUERY,sa_db,'DROP USER plug_dest',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select \'A\', ',0
diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test
index 0534108b107..f3c88d24c0c 100644
--- a/mysql-test/suite/plugins/t/audit_null_debug.test
+++ b/mysql-test/suite/plugins/t/audit_null_debug.test
@@ -26,7 +26,8 @@ SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
uninstall plugin audit_null;
SET debug_dbug=@old_dbug;
---error 1305
+uninstall plugin audit_null;
+--error ER_SP_DOES_NOT_EXIST
uninstall plugin audit_null;
delete from mysql.plugin where name='audit_null';
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index f19c8f53b61..397dd554962 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -1,10 +1,17 @@
-
+--source include/have_plugin_auth.inc
--source include/not_embedded.inc
if (!$SERVER_AUDIT_SO) {
skip No SERVER_AUDIT plugin;
}
+# An unfortunate wait for check-testcase.test to complete disconnect.
+let count_sessions= 1;
+source include/wait_until_count_sessions.inc;
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+let SEARCH_FILE= $MYSQLD_DATADIR/server_audit.log;
+
install plugin server_audit soname 'server_audit';
show variables like 'server_audit%';
@@ -20,18 +27,21 @@ show variables like 'server_audit_incl_users';
--error ER_WRONG_VALUE_FOR_VAR
set global server_audit_excl_users= repeat("'root',", 10000);
show variables like 'server_audit_excl_users';
+let SEARCH_COUNT= 5;
+source include/wait_for_line_count_in_file.inc;
---sleep 2
connect (con1,localhost,root,,mysql);
-connection default;
disconnect con1;
---sleep 2
---sleep 2
+let SEARCH_COUNT= 7;
+source include/wait_for_line_count_in_file.inc;
+
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR
connect (con1,localhost,no_such_user,,mysql);
+let SEARCH_COUNT= 9;
+source include/wait_for_line_count_in_file.inc;
+
connection default;
---sleep 2
set global server_audit_incl_users='odin, dva, tri';
create table t1 (id int);
set global server_audit_incl_users='odin, root, dva, tri';
@@ -61,11 +71,10 @@ show variables like 'server_audit%';
set global server_audit_mode=1;
set global server_audit_events='';
create database sa_db;
---sleep 2
+let SEARCH_COUNT= 41;
+source include/wait_for_line_count_in_file.inc;
+
connect (con1,localhost,root,,test);
-connection con1;
---sleep 2
---sleep 2
create table t1 (id2 int);
insert into t1 values (1), (2);
select * from t1;
@@ -75,10 +84,11 @@ create table sa_t1(id int);
insert into sa_t1 values (1), (2);
drop table sa_t1;
drop database sa_db;
-connection default;
disconnect con1;
---sleep 2
---sleep 2
+let SEARCH_COUNT= 68;
+source include/wait_for_line_count_in_file.inc;
+
+connection default;
create database sa_db;
use sa_db;
CREATE USER u1 IDENTIFIED BY 'pwd-123';
@@ -136,11 +146,53 @@ select * from t1;
select 2;
drop table t1;
+set global server_audit_events='table';
+set global server_audit_incl_users='user1';
+
+create user user1@localhost;
+grant all on sa_db.* to user1@localhost;
+
+connect (cn1,localhost,user1,,sa_db);
+connection cn1;
+
+create table t1(id int) engine=myisam;
+insert delayed into t1 values (1);
+connection default;
+--echo # Waiting until INSERT DELAYED thread does the insert.
+let $wait_condition= SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+drop table t1;
+
set global server_audit_logging= off;
+set global server_audit_incl_users='root';
set global server_audit_logging= on;
+disconnect cn1;
+let $count_sessions=1;
+source include/wait_until_count_sessions.inc;
+
+drop user user1@localhost;
set global server_audit_events='';
+CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
+CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
+--sleep 2
+--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
+--error ER_ACCESS_DENIED_ERROR : this should fail : no grant
+connect(plug_con,localhost,plug,plug_dest);
+--sleep 2
+GRANT PROXY ON plug_dest TO plug;
+--sleep 2
+connect(plug_con,localhost,plug,plug_dest);
+connection plug_con;
+select USER(),CURRENT_USER();
+connection default;
+disconnect plug_con;
+--sleep 2
+--sleep 2
+DROP USER plug;
+DROP USER plug_dest;
+
set global server_audit_query_log_limit= 15;
select (1), (2), (3), (4);
select 'A', 'B', 'C', 'D';
@@ -159,7 +211,6 @@ show status like 'server_audit_current_log';
show variables like 'server_audit%';
uninstall plugin server_audit;
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
# replace the timestamp and the hostname with constant values
--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/
cat_file $MYSQLD_DATADIR/server_audit.log;
diff --git a/mysql-test/suite/roles/acl_load_mutex-5170.test b/mysql-test/suite/roles/acl_load_mutex-5170.test
index 22b9dffb5fd..76d817be055 100644
--- a/mysql-test/suite/roles/acl_load_mutex-5170.test
+++ b/mysql-test/suite/roles/acl_load_mutex-5170.test
@@ -10,7 +10,7 @@ flush tables;
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
---shutdown_server 60
+--shutdown_server
--source include/wait_until_disconnected.inc
--enable_reconnect
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
diff --git a/mysql-test/suite/roles/drop_current_role.result b/mysql-test/suite/roles/drop_current_role.result
new file mode 100644
index 00000000000..b6de0304d44
--- /dev/null
+++ b/mysql-test/suite/roles/drop_current_role.result
@@ -0,0 +1,5 @@
+create role r;
+set role r;
+drop role r;
+revoke all on *.* from current_role;
+ERROR OP000: Invalid role specification `r`
diff --git a/mysql-test/suite/roles/drop_current_role.test b/mysql-test/suite/roles/drop_current_role.test
new file mode 100644
index 00000000000..c8d6fc5d9df
--- /dev/null
+++ b/mysql-test/suite/roles/drop_current_role.test
@@ -0,0 +1,9 @@
+--source include/not_embedded.inc
+#
+# MDEV-22521 Server crashes in traverse_role_graph_up or Assertion `user' fails in traverse_role_graph_impl
+#
+create role r;
+set role r;
+drop role r;
+error ER_INVALID_ROLE;
+revoke all on *.* from current_role;
diff --git a/mysql-test/suite/roles/set_default_role_clear.result b/mysql-test/suite/roles/set_default_role_clear.result
index 7f54b5eabcc..3cb13f55b4b 100644
--- a/mysql-test/suite/roles/set_default_role_clear.result
+++ b/mysql-test/suite/roles/set_default_role_clear.result
@@ -17,6 +17,7 @@ Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
+SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
select user, host, default_role from mysql.user where user='test_user';
user host default_role
test_user localhost test_role
diff --git a/mysql-test/suite/roles/set_default_role_for.result b/mysql-test/suite/roles/set_default_role_for.result
index 9880671ba09..62c31373486 100644
--- a/mysql-test/suite/roles/set_default_role_for.result
+++ b/mysql-test/suite/roles/set_default_role_for.result
@@ -14,13 +14,14 @@ set default role role_a for user_a@localhost;
set default role invalid_role for user_a@localhost;
ERROR OP000: Invalid role specification `invalid_role`
set default role role_b for user_a@localhost;
-ERROR OP000: Invalid role specification `role_b`
+ERROR OP000: User `user_a@localhost` has not been granted role `role_b`
set default role role_b for user_b@localhost;
show grants;
Grants for user_a@localhost
GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT SELECT ON *.* TO 'role_a'
+SET DEFAULT ROLE role_a FOR 'user_a'@'localhost'
select user, host, default_role from mysql.user where user like 'user_%';
user host default_role
user_a localhost role_a
@@ -36,12 +37,13 @@ user host default_role
user_a localhost role_a
user_b localhost role_b
set default role role_b for current_user;
-ERROR OP000: Invalid role specification `role_b`
+ERROR OP000: User `user_a@localhost` has not been granted role `role_b`
show grants;
Grants for user_b@localhost
GRANT role_b TO 'user_b'@'localhost'
GRANT USAGE ON *.* TO 'user_b'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
+SET DEFAULT ROLE role_b FOR 'user_b'@'localhost'
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');
diff --git a/mysql-test/suite/roles/set_default_role_invalid.result b/mysql-test/suite/roles/set_default_role_invalid.result
index 5bcaa9acb86..53ee464e2c1 100644
--- a/mysql-test/suite/roles/set_default_role_invalid.result
+++ b/mysql-test/suite/roles/set_default_role_invalid.result
@@ -24,6 +24,7 @@ Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
+SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
select user, host, default_role from mysql.user where user='test_user';
user host default_role
test_user localhost test_role
@@ -38,3 +39,92 @@ ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'us
drop role test_role;
drop role not_granted_role;
drop user test_user@localhost;
+#
+# MDEV-22312: Bad error message for SET DEFAULT ROLE when user account
+# is not granted the role
+#
+CREATE USER a;
+CREATE USER b;
+CREATE ROLE r1;
+CREATE ROLE r2;
+SET DEFAULT ROLE r1 FOR a;
+ERROR OP000: User `a@%` has not been granted role `r1`
+GRANT r1 TO b;
+GRANT r2 TO b;
+SET DEFAULT ROLE r1 FOR b;
+# Change user b
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+r1
+SET ROLE r2;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+r2
+SET DEFAULT ROLE r1 FOR a;
+ERROR 42000: Access denied for user 'b'@'%' to database 'mysql'
+SET DEFAULT ROLE r2;
+# Change user root (session 1: select_priv to b)
+GRANT SELECT ON mysql.* TO b;
+# Change user b (session 1: select_priv)
+SHOW GRANTS FOR b;
+Grants for b@%
+GRANT r1 TO 'b'@'%'
+GRANT r2 TO 'b'@'%'
+GRANT USAGE ON *.* TO 'b'@'%'
+GRANT SELECT ON `mysql`.* TO 'b'@'%'
+SET DEFAULT ROLE r2 FOR 'b'@'%'
+SET DEFAULT ROLE r1 FOR a;
+ERROR 42000: Access denied for user 'b'@'%' to database 'mysql'
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+r2
+SET DEFAULT ROLE NONE;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+r2
+SET DEFAULT ROLE current_role FOR current_user;
+SET DEFAULT ROLE invalid_role;
+ERROR OP000: Invalid role specification `invalid_role`
+SET DEFAULT ROLE invalid_role FOR a;
+ERROR 42000: Access denied for user 'b'@'%' to database 'mysql'
+SET DEFAULT ROLE none FOR a;
+ERROR 42000: Access denied for user 'b'@'%' to database 'mysql'
+# Change user root (session 2: adding update_priv to user b)
+GRANT UPDATE ON mysql.* TO b;
+# Change user b
+SHOW GRANTS FOR b;
+Grants for b@%
+GRANT r1 TO 'b'@'%'
+GRANT r2 TO 'b'@'%'
+GRANT USAGE ON *.* TO 'b'@'%'
+GRANT SELECT, UPDATE ON `mysql`.* TO 'b'@'%'
+SET DEFAULT ROLE r2 FOR 'b'@'%'
+SET DEFAULT ROLE r1 FOR a;
+ERROR OP000: User `a@%` has not been granted role `r1`
+SET DEFAULT ROLE invalid_role;
+ERROR OP000: Invalid role specification `invalid_role`
+SET DEFAULT ROLE invalid_role FOR a;
+ERROR OP000: Invalid role specification `invalid_role`
+SET DEFAULT ROLE none FOR a;
+# Change user root (session 3: Grant role to user a)
+GRANT r1 TO a;
+SET DEFAULT ROLE r1 FOR a;
+# Change user a (verify session 3)
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+r1
+SET DEFAULT ROLE None;
+# Change user b (session 3: role granted to user a)
+SET DEFAULT ROLE r1 FOR a;
+SET DEFAULT ROLE r2 FOR a;
+ERROR OP000: User `a@%` has not been granted role `r2`
+SET DEFAULT ROLE invalid_role;
+ERROR OP000: Invalid role specification `invalid_role`
+SET DEFAULT ROLE invalid_role FOR a;
+ERROR OP000: Invalid role specification `invalid_role`
+SELECT user, host, default_role FROM mysql.user where user='a' or user='b';
+user host default_role
+a % r1
+b % r2
+DROP ROLE r1, r2;
+DROP USER a, b;
diff --git a/mysql-test/suite/roles/set_default_role_invalid.test b/mysql-test/suite/roles/set_default_role_invalid.test
index 8e72e316d4b..02fca1107e2 100644
--- a/mysql-test/suite/roles/set_default_role_invalid.test
+++ b/mysql-test/suite/roles/set_default_role_invalid.test
@@ -60,3 +60,110 @@ change_user 'root';
drop role test_role;
drop role not_granted_role;
drop user test_user@localhost;
+
+--echo #
+--echo # MDEV-22312: Bad error message for SET DEFAULT ROLE when user account
+--echo # is not granted the role
+--echo #
+
+CREATE USER a;
+CREATE USER b;
+CREATE ROLE r1;
+CREATE ROLE r2;
+# Role has not been granted to user a, but the role is visible to current_user
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE r1 FOR a;
+# Granting roles to user b
+GRANT r1 TO b;
+GRANT r2 TO b;
+# After granting the role, role can be set as default
+SET DEFAULT ROLE r1 FOR b;
+
+--echo # Change user b
+change_user b;
+SELECT CURRENT_ROLE;
+SET ROLE r2;
+SELECT CURRENT_ROLE;
+# User b has no UPDATE_PRIV for mysql.user
+--error ER_DBACCESS_DENIED_ERROR
+SET DEFAULT ROLE r1 FOR a;
+SET DEFAULT ROLE r2;
+
+--echo # Change user root (session 1: select_priv to b)
+change_user root;
+# Let's grant select_priv to user b
+GRANT SELECT ON mysql.* TO b;
+
+--echo # Change user b (session 1: select_priv)
+change_user b;
+SHOW GRANTS FOR b;
+# User must have update_priv before setting the role
+--error ER_DBACCESS_DENIED_ERROR
+SET DEFAULT ROLE r1 FOR a;
+# Testing the `CURRENT_ROLE` as a special case
+SELECT CURRENT_ROLE;
+SET DEFAULT ROLE NONE;
+SELECT CURRENT_ROLE;
+SET DEFAULT ROLE current_role FOR current_user;
+# Testing of non-existing role
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE invalid_role;
+# Testing of non-existing role for different user
+--error ER_DBACCESS_DENIED_ERROR
+SET DEFAULT ROLE invalid_role FOR a;
+# Testing the `None` role for different user
+-- error ER_DBACCESS_DENIED_ERROR
+SET DEFAULT ROLE none FOR a;
+
+--echo # Change user root (session 2: adding update_priv to user b)
+change_user root;
+# update_priv are enough
+GRANT UPDATE ON mysql.* TO b;
+
+--echo # Change user b
+change_user b;
+SHOW GRANTS FOR b;
+# In all tests in session user a has not been granted the role
+# Testing setting role for different user, should fail with new error
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE r1 FOR a;
+# Testing of non-existing role
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE invalid_role;
+# Testing of non-existing role for different user with update_priv
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE invalid_role FOR a;
+# Testing the `None` role for different user with update_priv
+SET DEFAULT ROLE none FOR a;
+
+--echo # Change user root (session 3: Grant role to user a)
+change_user root;
+# After granting the privilege for a, user b can set default role
+GRANT r1 TO a;
+SET DEFAULT ROLE r1 FOR a;
+
+--echo # Change user a (verify session 3)
+change_user a;
+SELECT CURRENT_ROLE;
+SET DEFAULT ROLE None;
+
+--echo # Change user b (session 3: role granted to user a)
+change_user b;
+# This should set role because b has update_priv
+SET DEFAULT ROLE r1 FOR a;
+# Testing non-granted role r2 still should fail
+-- error ER_INVALID_ROLE
+SET DEFAULT ROLE r2 FOR a;
+# Testing of non-existing role
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE invalid_role;
+# Testing of non-existing role for different user
+--error ER_INVALID_ROLE
+SET DEFAULT ROLE invalid_role FOR a;
+
+# Clear the workspace
+change_user root;
+--sorted_result
+SELECT user, host, default_role FROM mysql.user where user='a' or user='b';
+DROP ROLE r1, r2;
+DROP USER a, b;
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..75e4075ff9e 100644
--- a/mysql-test/suite/roles/set_default_role_new_connection.result
+++ b/mysql-test/suite/roles/set_default_role_new_connection.result
@@ -23,6 +23,7 @@ Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
+SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
select user, host, default_role from mysql.user where user = 'test_user';
user host default_role
test_user localhost test_role
@@ -51,6 +52,7 @@ Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
+SET DEFAULT ROLE test_role FOR 'test_user'@'localhost'
select user, host, default_role from mysql.user where user = 'test_user';
user host default_role
test_user localhost test_role
diff --git a/mysql-test/suite/roles/set_role-recursive.result b/mysql-test/suite/roles/set_role-recursive.result
index 53b28a25261..b0d79377183 100644
--- a/mysql-test/suite/roles/set_role-recursive.result
+++ b/mysql-test/suite/roles/set_role-recursive.result
@@ -66,7 +66,7 @@ Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
set role test_role2;
-ERROR OP000: Invalid role specification `test_role2`
+ERROR OP000: User `test_user@localhost` has not been granted role `test_role2`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index bdefb1660bd..2bf2a69bd62 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -11,8 +11,7 @@
##############################################################################
rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
-rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
+#rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666
-rpl_slave_grp_exec: MDEV-10514
diff --git a/mysql-test/suite/rpl/extension/checksum.pl b/mysql-test/suite/rpl/extension/checksum.pl
index f94341446cd..8369d1bbdce 100755
--- a/mysql-test/suite/rpl/extension/checksum.pl
+++ b/mysql-test/suite/rpl/extension/checksum.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
index 25da12f30a3..7a6a758a508 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
@@ -47,7 +47,7 @@
--source include/stop_slave.inc
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL slave_parallel_mode='optimistic';
SET GLOBAL slave_parallel_threads= 3;
CHANGE MASTER TO master_use_gtid=slave_pos;
diff --git a/mysql-test/suite/rpl/r/circular_serverid0.result b/mysql-test/suite/rpl/r/circular_serverid0.result
index 112f9359ac4..19c800cf01b 100644
--- a/mysql-test/suite/rpl/r/circular_serverid0.result
+++ b/mysql-test/suite/rpl/r/circular_serverid0.result
@@ -1,10 +1,10 @@
include/rpl_init.inc [topology=1->2->1]
include/rpl_connect.inc [creating M4]
include/rpl_connect.inc [creating M2]
-SET @old_debug= @@global.debug;
connection M2;
STOP SLAVE;
-SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging";
+SET @old_debug= @@global.debug_dbug;
+SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging";
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
connection M2;
diff --git a/mysql-test/suite/rpl/r/kill_race_condition.result b/mysql-test/suite/rpl/r/kill_race_condition.result
index 1181eb0b0b1..8e8645cdb58 100644
--- a/mysql-test/suite/rpl/r/kill_race_condition.result
+++ b/mysql-test/suite/rpl/r/kill_race_condition.result
@@ -4,6 +4,7 @@ connection master;
create table t1 (a int);
connection slave;
connection slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug='d,rows_log_event_before_open_table';
connection master;
insert t1 values (1),(2),(3);
@@ -13,7 +14,7 @@ kill slave_sql_thread;
set debug_sync='now SIGNAL go_ahead_sql';
include/wait_for_slave_sql_error.inc [errno=1927]
Last_SQL_Error = Error executing row event: 'Connection was killed'
-set global debug_dbug='';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
set debug_sync='RESET';
connection master;
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
new file mode 100644
index 00000000000..98688df7273
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
@@ -0,0 +1,47 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET GLOBAL LOG_WARNINGS=2;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=current_pos;
+include/start_slave.inc
+connection master;
+"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+include/start_slave.inc
+connection master;
+"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
+CREATE TABLE t (f INT) ENGINE=INNODB;
+INSERT INTO t VALUES(10);
+connection slave;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+include/start_slave.inc
+connection master;
+"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
+SET @@SESSION.gtid_domain_id=10;
+INSERT INTO t VALUES(20);
+connection slave;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+include/start_slave.inc
+connection master;
+"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
+"===== Clean up ====="
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+include/start_slave.inc
+connection master;
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
index 06be72d523b..eb4e45ad28e 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
@@ -9,6 +9,7 @@ connection master;
call mtr.add_suppression("Can't generate a unique log-filename");
call mtr.add_suppression("Writing one row to the row-based binary log failed.*");
call mtr.add_suppression("Error writing file .*");
+call mtr.add_suppression("Could not use master-bin for logging");
SET @old_debug= @@global.debug_dbug;
SELECT repeat('x',8192) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data';
SELECT repeat('x',10) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data';
@@ -22,7 +23,7 @@ master-bin.000001 #
master-bin.000002 #
###################### TEST #2
RESET MASTER;
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
FLUSH LOGS;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@@ -30,7 +31,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
show binary logs;
Log_name File_size
master-bin.000001 #
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
###################### TEST #3
CREATE TABLE t1 (a INT);
@@ -44,11 +45,11 @@ show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #4
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
@@ -56,21 +57,21 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999)
SELECT count(*) FROM t2;
count(*)
1
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #5
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166-2.data' INTO TABLE t2;
# assert: must show one entry
SELECT count(*) FROM t2;
count(*)
1
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #6
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES ('muse');
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2;
@@ -83,11 +84,11 @@ SELECT count(*) FROM t2;
count(*)
3
SET AUTOCOMMIT= 1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
DELETE FROM t2;
RESET MASTER;
###################### TEST #7
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET @@binlog_annotate_row_events= 0;
SELECT count(*) FROM t4;
count(*)
@@ -100,14 +101,14 @@ SELECT count(*) FROM t4;
count(*)
1
### check that the incident event is written to the current log
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Incident # # #1 (LOST_EVENTS)
DELETE FROM t4;
RESET MASTER;
###################### TEST #8
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
# must show 0 entries
SELECT count(*) FROM t4;
count(*)
@@ -147,9 +148,9 @@ count(*)
SELECT count(*) FROM t2;
count(*)
0
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
###################### TEST #9
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
SET SQL_LOG_BIN=0;
INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'), ('ddd');
INSERT INTO t4 VALUES ('eee'), ('fff'), ('ggg'), ('hhh');
@@ -170,17 +171,17 @@ SELECT count(*) FROM t4;
count(*)
0
SET SQL_LOG_BIN=1;
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
###################### TEST #10
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not open .*");
RESET MASTER;
SHOW WARNINGS;
Level Code Message
-SET GLOBAL debug_dbug="+d,fault_injection_registering_index";
+SET @@global.debug_dbug="d,fault_injection_registering_index";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.000002' (errno: 1 "Operation not permitted")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
SHOW BINARY LOGS;
ERROR HY000: You are not using binary logging
CREATE TABLE t5 (a INT);
@@ -192,10 +193,10 @@ DROP TABLE t5;
flush tables;
###################### TEST #11
include/rpl_restart_server.inc [server_number=1]
-SET GLOBAL debug_dbug="+d,fault_injection_openning_index";
+SET @@global.debug_dbug="d,fault_injection_openning_index";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin.index' (errno: 1 "Operation not permitted")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT);
@@ -207,10 +208,10 @@ DROP TABLE t5;
flush tables;
include/rpl_restart_server.inc [server_number=1]
###################### TEST #12
-SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event";
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
FLUSH LOGS;
ERROR HY000: Can't open file: 'master-bin' (errno: 2 "No such file or directory")
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@old_debug;
RESET MASTER;
ERROR HY000: Binlog closed, cannot RESET MASTER
CREATE TABLE t5 (a INT);
@@ -237,44 +238,40 @@ call mtr.add_suppression("Could not open .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,error_unique_log_filename";
+SET @@global.debug_dbug="d,error_unique_log_filename";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,error_unique_log_filename";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #14
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_new_file_rotate_event";
+SET @@global.debug_dbug="d,fault_injection_new_file_rotate_event";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_new_file_rotate_event";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #15
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_registering_index";
+SET @@global.debug_dbug="d,fault_injection_registering_index";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_registering_index";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
###################### TEST #16
-SET @old_debug=@@global.debug;
+SET @saved_debug=@@global.debug_dbug;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,fault_injection_openning_index";
+SET @@global.debug_dbug="d,fault_injection_openning_index";
START SLAVE io_thread;
include/wait_for_slave_io_error.inc [errno=1595]
Last_IO_Error = 'Relay log write failure: could not queue event from master'
-SET GLOBAL debug_dbug="-d,fault_injection_openning_index";
-SET GLOBAL debug_dbug=@old_debug;
+SET @@global.debug_dbug=@saved_debug;
include/rpl_restart_server.inc [server_number=2]
include/stop_slave_sql.inc
Warnings:
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_index.result b/mysql-test/suite/rpl/r/rpl_binlog_index.result
index 4257dbde57a..78665ba1a7b 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_index.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_index.result
@@ -7,13 +7,20 @@ CREATE TABLE t1 (a INT);
FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (1);
connection slave;
+include/stop_slave.inc
connection master;
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
# Move the master binlog files and the index file to a new place
# Restart master with log-bin option set to the new path
# Master has restarted successfully
+connection slave;
+include/start_slave.inc
+connection master;
# Create the master-bin.index file with the old format
+connection slave;
+include/stop_slave.inc
+connection master;
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
# Move back the master binlog files
@@ -21,6 +28,9 @@ include/rpl_stop_server.inc [server_number=1]
# Restart master with log-bin option set to default
# Master has restarted successfully
connection slave;
+include/start_slave.inc
+connection master;
+connection slave;
# stop slave
include/stop_slave.inc
include/rpl_stop_server.inc [server_number=2]
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result
new file mode 100644
index 00000000000..a677cbfecf6
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_rollback_cleanup.result
@@ -0,0 +1,9 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET GLOBAL max_binlog_cache_size = 65536;
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB;
+ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
+SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index 74ba945b027..bdf2c707e9b 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -5,10 +5,11 @@ call mtr.add_suppression("Failed during slave I/O thread initialization");
call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.* 1593");
include/stop_slave.inc
reset slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Failed during slave thread initialization'
-SET GLOBAL debug_dbug="";
+SET @@GLOBAL.debug_dbug = @saved_dbug;
RESET SLAVE;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_bug41902.result b/mysql-test/suite/rpl/r/rpl_bug41902.result
index 8667795bd77..7d676ea73e3 100644
--- a/mysql-test/suite/rpl/r/rpl_bug41902.result
+++ b/mysql-test/suite/rpl/r/rpl_bug41902.result
@@ -2,6 +2,7 @@ include/master-slave.inc
[connection master]
connection slave;
stop slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@debug_dbug="d,simulate_find_log_pos_error";
reset slave;
ERROR HY000: Target log not found in binlog index
@@ -19,6 +20,7 @@ SET @@debug_dbug="";
reset slave;
change master to master_host='dummy';
connection master;
+SET @saved_dbug_m = @@global.debug_dbug;
SET @@debug_dbug="d,simulate_find_log_pos_error";
reset master;
ERROR HY000: Target log not found in binlog index
@@ -29,6 +31,7 @@ purge binary logs to 'master-bin.000001';
ERROR HY000: Target log not found in binlog index
SET @@debug_dbug="";
purge binary logs to 'master-bin.000001';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
==== clean up ====
CHANGE MASTER TO MASTER_HOST = '127.0.0.1';
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index a74b688d722..21d8ca22feb 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -76,6 +76,7 @@ connection master;
set @@global.binlog_checksum = CRC32;
insert into t1 values (1) /* will not be applied on slave due to simulation */;
connection slave;
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
@@ -83,15 +84,16 @@ Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary
select count(*) as zero from t1;
zero
0
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
connection slave;
include/start_slave.inc
connection master;
set @@global.master_verify_checksum = 1;
+set @save_dbug = @@session.debug_dbug;
set @@session.debug_dbug='d,simulate_checksum_test_failure';
show binlog events;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
-set @@session.debug_dbug='';
+SET debug_dbug= @save_dbug;
set @@global.master_verify_checksum = default;
connection slave;
connection slave;
@@ -99,10 +101,11 @@ include/stop_slave.inc
connection master;
create table t2 (a int);
connection slave;
+set @saved_dbug = @@global.debug_dbug;
set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave io_thread;
include/wait_for_slave_io_error.inc [errno=1595,1913]
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
start slave io_thread;
include/wait_for_slave_param.inc [Read_Master_Log_Pos]
set @@global.slave_sql_verify_checksum = 1;
@@ -110,7 +113,7 @@ set @@global.debug_dbug='d,simulate_checksum_test_failure';
start slave sql_thread;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4'
-set @@global.debug_dbug='';
+set @@global.debug_dbug = @saved_dbug;
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
index 044f31427be..036824d60aa 100644
--- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
@@ -71,5 +71,22 @@ include/diff_tables.inc [master:t1,slave:t1]
connection master;
SELECT c1 FROM /*!999999 t1 WHEREN;
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 '/*!999999 t1 WHEREN' at line 1
+insert t1 values (/*!50505 1 /* foo */ */ + 2);
+insert t1 values (/*!999999 10 /* foo */ */ + 20);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert t1 values (/*!50505 1 /* foo */ */ + 2)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert t1 values (/* 999999 10 (* foo *) */ + 20)
+master-bin.000001 # Query # # COMMIT
+connection slave;
+select * from t1;
+c1
+62
+3
+20
+connection master;
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result
index 25a82fd60cd..73bb373d6be 100644
--- a/mysql-test/suite/rpl/r/rpl_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result
@@ -13,40 +13,40 @@ connection master;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c VARCHAR(100));
include/stop_slave.inc
# 2. Corruption in master binlog and SHOW BINLOG EVENTS
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @saved_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
+SET @@global.debug_dbug=@saved_dbug;
# 3. Master read a corrupted event from binlog and send the error to slave
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1236]
connection master;
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug=@saved_dbug;
# 4. Master read a corrupted event from binlog and send it to slave
connection master;
SET GLOBAL master_verify_checksum=0;
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set";
+SET @@global.debug_dbug="d,corrupt_read_log_event2_set";
connection slave;
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743]
connection master;
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug;
SET GLOBAL master_verify_checksum=1;
# 5. Slave. Corruption in network
connection slave;
-SET GLOBAL debug_dbug="+d,corrupt_queue_event";
+SET @saved_dbug_slave = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,corrupt_queue_event";
START SLAVE IO_THREAD;
include/wait_for_slave_io_error.inc [errno=1595,1743]
-SET GLOBAL debug_dbug="-d,corrupt_queue_event";
+SET @@global.debug_dbug=@saved_dbug_slave;
# 6. Slave. Corruption in relay log
-SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char";
+SET @@global.debug_dbug="d,corrupt_read_log_event_char";
START SLAVE SQL_THREAD;
include/wait_for_slave_sql_error.inc [errno=1593]
-SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char";
-SET GLOBAL debug_dbug= "";
+SET @@global.debug_dbug=@saved_dbug_slave;
# 7. Seek diff for tables on master and slave
connection slave;
include/start_slave.inc
@@ -55,9 +55,8 @@ connection slave;
include/diff_tables.inc [master:test.t1, slave:test.t1]
# 8. Clean up
connection master;
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
SET GLOBAL master_verify_checksum = @old_master_verify_checksum;
DROP TABLE t1;
connection slave;
-SET GLOBAL debug_dbug= "";
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result
index efb036023e9..bddd25405e8 100644
--- a/mysql-test/suite/rpl/r/rpl_current_user.result
+++ b/mysql-test/suite/rpl/r/rpl_current_user.result
@@ -15,7 +15,7 @@ GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
# Test the max lengths of user and host names
# the user name is too long
GRANT CREATE USER ON *.* TO '012345678901234567890123456789012345678901234567890123456789012345678901234567890'@'fakehost';
-ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890123456789' is too long for user name (should be no longer than 80)
+ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890123456...' is too long for user name (should be no longer than 80)
# the host name is too long
GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60)
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
index a2b1d03c4fd..feef82a57fc 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result
@@ -26,7 +26,8 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) :
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES(2);
@@ -42,7 +43,7 @@ include/wait_for_slave_io_error.inc [errno=1595]
SELECT * FROM t1;
i
1
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread;
include/wait_for_slave_io_to_start.inc
SELECT * FROM t1;
@@ -60,7 +61,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES(4);
@@ -80,7 +81,7 @@ i
1
2
3
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread;
include/wait_for_slave_io_to_start.inc
SELECT * FROM t1;
@@ -98,7 +99,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) :
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
START TRANSACTION;
INSERT INTO t1 VALUES(6);
@@ -133,7 +134,7 @@ i
1
2
3
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
@@ -158,7 +159,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
SET @@session.gtid_domain_id= 1;
START TRANSACTION;
@@ -202,7 +203,7 @@ i
3
10
11
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
@@ -231,7 +232,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(1), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) : 1
-SET @@global.debug_dbug="+d,kill_slave_io_after_2_events";
+SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master;
SET @@session.gtid_domain_id= 1;
START TRANSACTION;
@@ -285,7 +286,7 @@ i
15
16
17
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) : 1
@@ -318,7 +319,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
DO_DOMAIN_IDS (AFTER) :
IGNORE_DOMAIN_IDS (AFTER) :
-SET @@global.debug_dbug="+d,kill_slave_io_after_2_events";
+SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master;
SET @@session.gtid_domain_id= 1;
START TRANSACTION;
@@ -382,7 +383,7 @@ i
21
22
23
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
include/stop_slave.inc
DO_DOMAIN_IDS (BEFORE) :
IGNORE_DOMAIN_IDS (BEFORE) :
@@ -414,4 +415,5 @@ connection slave;
include/stop_slave.inc
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
include/start_slave.inc
+SET @@GLOBAL.debug_dbug = @saved_dbug;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
index 457947cabe0..0a414cb3b1f 100644
--- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result
@@ -37,7 +37,6 @@ IGNORE_DOMAIN_IDS (AFTER) : 1
connection master;
include/rpl_start_server.inc [server_number=1]
# Master has restarted successfully
-set @@global.debug_dbug="-d";
connection slave;
include/stop_slave.inc
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result b/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result
new file mode 100644
index 00000000000..3a80d5b5f31
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_dump_request_retry_warning.result
@@ -0,0 +1,22 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES(1);
+connection slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug= 'd,simulate_error_on_packet_write';
+START SLAVE;
+SET DEBUG_SYNC= 'now WAIT_FOR parked';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SET DEBUG_SYNC= 'RESET';
+include/wait_for_slave_io_to_start.inc
+include/wait_for_slave_sql_to_start.inc
+connection master;
+include/sync_slave_sql_with_master.inc
+SELECT * FROM t1;
+a
+1
+connection master;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_fail_register.result b/mysql-test/suite/rpl/r/rpl_fail_register.result
new file mode 100644
index 00000000000..2cddc796314
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_fail_register.result
@@ -0,0 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='d,fail_com_register_slave';
+stop slave;
+reset slave;
+include/wait_for_slave_to_stop.inc
+start slave;
+stop slave;
+include/wait_for_slave_to_stop.inc
+set global debug_dbug=@old_dbug;
+connection master;
+kill DUMP_THREAD;
+show slave hosts;
+Server_id Host Port Master_id
+connection slave;
+start slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_failed_drop_tbl_binlog.result b/mysql-test/suite/rpl/r/rpl_failed_drop_tbl_binlog.result
deleted file mode 100644
index df36fa82e0f..00000000000
--- a/mysql-test/suite/rpl/r/rpl_failed_drop_tbl_binlog.result
+++ /dev/null
@@ -1,32 +0,0 @@
-include/master-slave.inc
-[connection master]
-create table t1 (a int) engine=innodb;
-create table t2 (b longblob) engine=innodb;
-create table t3 (c int) engine=innodb;
-insert into t2 values (repeat('b',1024*1024));
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-set debug_sync='rm_table_no_locks_before_delete_table SIGNAL nogo WAIT_FOR go EXECUTE 2';
-drop table t1, t2, t3;
-connect foo,localhost,root;
-set debug_sync='now SIGNAL go';
-kill query CONNECTION_ID;
-connection master;
-ERROR 70100: Query execution was interrupted
-"Tables t2 and t3 should be listed"
-SHOW TABLES;
-Tables_in_test
-t2
-t3
-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 `t1` /* generated by server */
-connection slave;
-drop table t2, t3;
-connection master;
-set debug_sync='RESET';
-drop table t2, t3;
-include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
index b6c82e3754c..9ef2f4a89db 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result
@@ -7,6 +7,8 @@ SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
connection slave;
include/stop_slave.inc
+SET @@GLOBAL.replicate_do_table="";
+SET @@GLOBAL.replicate_ignore_table="";
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
index 47cd362a549..fe0b283fc7c 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result
@@ -7,6 +7,8 @@ SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
connection slave;
include/stop_slave.inc
+SET @@GLOBAL.replicate_wild_do_table="";
+SET @@GLOBAL.replicate_wild_ignore_table="";
SET @@GLOBAL.replicate_wild_do_table="test.a%";
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
index e7f4e566566..deea7caa12a 100644
--- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
+++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
@@ -1,33 +1,42 @@
include/master-slave.inc
[connection master]
+connection slave;
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*");
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
call mtr.add_suppression("Slave I/O thread .* register on master");
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+connection slave;
include/stop_slave.inc
-SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'";
+SET @old_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug= "d,'debug_lock.before_get_UNIX_TIMESTAMP'";
include/start_slave.inc
slave is going to hang in get_master_version_and_clock
include/rpl_stop_server.inc [server_number=1]
slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp';
+connection slave;
Check network error happened here
include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013]
-set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'";
+set @@global.debug_dbug= @old_dbug;
include/rpl_start_server.inc [server_number=1]
include/wait_for_slave_param.inc [Slave_IO_Running]
+connection slave;
+connection slave;
include/stop_slave.inc
-SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'";
+SET @old_dbug = @@global.debug_dbug;
+SET @@global.debug_dbug= "d,'debug_lock.before_get_SERVER_ID'";
include/start_slave.inc
slave is going to hang in get_master_version_and_clock
include/rpl_stop_server.inc [server_number=1]
slave is unblocked
SET DEBUG_SYNC='now SIGNAL signal.get_server_id';
+connection slave;
Check network error happened here
include/wait_for_slave_io_error.inc [errno=1053, 2002, 2003, 2006, 2013]
-set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'";
+set @@global.debug_dbug= @old_dbug;
include/rpl_start_server.inc [server_number=1]
include/wait_for_slave_param.inc [Slave_IO_Running]
-set global debug= '';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'RESET';
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
index 7b6e95bf718..cb7ac8c0094 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
@@ -9,6 +9,9 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0);
connection server_2;
+SET sql_log_bin=0;
+call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
+SET sql_log_bin=1;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
index d5037f8cf94..4f50d7c6d85 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
@@ -27,7 +27,7 @@ a
connection server_1;
include/kill_binlog_dump_threads.inc
INSERT INTO t1 VALUES (10);
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output";
SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100";
connection server_2;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_strict.result b/mysql-test/suite/rpl/r/rpl_gtid_strict.result
index 528c4c5b5c1..27e7d105125 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_strict.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_strict.result
@@ -27,16 +27,17 @@ master-bin.000001 # Xid # # COMMIT /* XID */
SET server_id= 3;
SET gtid_seq_no= 3;
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET @old_dbug = @@session.debug_dbug;
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 3;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
INSERT INTO t1 VALUES (2);
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET gtid_seq_no= 2;
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 2;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
INSERT INTO t1 VALUES (3);
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled
SET server_id= 1;
@@ -62,9 +63,9 @@ master-bin.000001 # Xid # # COMMIT /* XID */
SET server_id= 3;
SET gtid_seq_no= 1;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled
SET sql_log_bin= 0;
@@ -73,9 +74,9 @@ SET sql_log_bin= 1;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
SET gtid_seq_no= 1;
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
INSERT INTO t2 VALUES (1);
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled
SET server_id= 1;
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result
index cf26c3bf04a..dc45c0b9ab3 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_debug.result
@@ -7,7 +7,7 @@ set @@global.slave_net_timeout= 10;
show status like 'Slave_heartbeat_period';;
Variable_name Slave_heartbeat_period
Value 60.000
-SET @save_dbug= @@GLOBAL.debug_dbug;
+SET @saved_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
@@ -25,7 +25,7 @@ connection master;
drop table t1;
connection slave;
include/stop_slave.inc
-SET GLOBAL debug_dbug=@save_dbug;
+SET GLOBAL debug_dbug=@saved_dbug;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result
index 8fb4aa907cc..6dbe4417c5a 100644
--- a/mysql-test/suite/rpl/r/rpl_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_incident.result
@@ -14,6 +14,7 @@ a
1
2
3
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= '+d,incident_database_resync_on_replace,*';
REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
@@ -22,6 +23,7 @@ a
2
3
4
+set @@global.debug_dbug = @saved_dbug;
connection slave;
call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590");
include/wait_for_slave_sql_error.inc [errno=1590]
diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result
index 91742814b4c..fc23734c645 100644
--- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result
@@ -4,12 +4,13 @@ connection slave;
stop slave;
reset slave;
connection slave;
+set @saved_dbug = @@global.debug_dbug;
SET GLOBAL debug_dbug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
include/wait_for_slave_sql_error.inc [errno=1593]
Last_SQL_Error = 'Failed during slave thread initialization'
call mtr.add_suppression("Failed during slave.* thread initialization");
-SET GLOBAL debug_dbug= "";
+set @@global.debug_dbug = @saved_dbug;
connection slave;
reset slave;
SET GLOBAL init_slave= "garbage";
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
index b96153a226a..d384422f88a 100644
--- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -2,10 +2,10 @@ include/master-slave.inc
[connection master]
connection master;
set @old_master_binlog_checksum= @@global.binlog_checksum;
-set @old_slave_dbug= @@global.debug_dbug;
connection slave;
include/stop_slave.inc
# Test slave with no capability gets dummy event, which is ignored.
+set @old_dbug= @@global.debug_dbug;
SET @@global.debug_dbug='+d,simulate_slave_capability_none';
include/start_slave.inc
connection master;
@@ -50,7 +50,7 @@ slave-relay-bin.000005 # Annotate_rows # # INSERT INTO t1 /* A comment just to m
slave-relay-bin.000005 # Table_map # # table_id: # (test.t1)
slave-relay-bin.000005 # Write_rows_v1 # # table_id: # flags: STMT_END_F
slave-relay-bin.000005 # Query # # COMMIT
-set @@global.debug_dbug= @old_slave_dbug;
+set @@global.debug_dbug= @old_dbug;
# Test dummy event is checksummed correctly.
connection master;
set @@global.binlog_checksum = CRC32;
@@ -148,10 +148,10 @@ select @@global.log_slave_updates;
select @@global.replicate_annotate_row_events;
@@global.replicate_annotate_row_events
1
-set @@global.debug_dbug= @old_slave_dbug;
Clean up.
connection master;
set @@global.binlog_checksum = @old_master_binlog_checksum;
DROP TABLE t1, t2;
connection slave;
+set @@global.debug_dbug= @old_dbug;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
index 1f352e68bc7..35e5de7b15a 100644
--- a/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
+++ b/mysql-test/suite/rpl/r/rpl_mysql_upgrade.result
@@ -3,20 +3,66 @@ include/master-slave.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("table or database name 'mysqltest-1'");
connection master;
-DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
-CREATE DATABASE `#mysql50#mysqltest-1`;
+CREATE DATABASE `mysqltest-1`;
connection slave;
connection master;
connection slave;
connection master;
Master position is not changed
connection slave;
-STOP SLAVE SQL_THREAD;
-include/wait_for_slave_sql_to_stop.inc
+SET @old_general_log_state = @@global.general_log;
+SET @old_slow_log_state = @@global.slow_query_log;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL general_log = 'ON';
+SET GLOBAL slow_query_log = 'ON';
+SET GLOBAL log_output = 'FILE';
+connection master;
+ALTER TABLE mysql.slow_log DROP COLUMN thread_id, DROP COLUMN rows_affected;
+DROP DATABASE `mysqltest-1`;
+connection slave;
+connection slave;
+SHOW CREATE TABLE mysql.slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
connection master;
connection master;
Master position has been changed
-DROP DATABASE `mysqltest-1`;
connection slave;
-DROP DATABASE `#mysql50#mysqltest-1`;
+connection slave;
+SHOW CREATE TABLE mysql.slow_log;
+Table Create Table
+slow_log CREATE TABLE `slow_log` (
+ `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6),
+ `user_host` mediumtext NOT NULL,
+ `query_time` time(6) NOT NULL,
+ `lock_time` time(6) NOT NULL,
+ `rows_sent` int(11) NOT NULL,
+ `rows_examined` int(11) NOT NULL,
+ `db` varchar(512) NOT NULL,
+ `last_insert_id` int(11) NOT NULL,
+ `insert_id` int(11) NOT NULL,
+ `server_id` int(10) unsigned NOT NULL,
+ `sql_text` mediumtext NOT NULL,
+ `thread_id` bigint(21) unsigned NOT NULL,
+ `rows_affected` int(11) NOT NULL
+) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
+SET GLOBAL general_log = 'OFF';
+SET GLOBAL slow_query_log = 'OFF';
+truncate mysql.slow_log;
+truncate mysql.general_log;
+SET GLOBAL general_log = @old_general_log_state;
+SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL log_output = @old_log_output;
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..657b3ba7448 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -1512,7 +1512,7 @@ SET GLOBAL slave_parallel_threads=10;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10000;
ANALYZE TABLE t2;
@@ -1521,7 +1521,7 @@ test.t2 analyze status OK
INSERT INTO t3 VALUES (120, 0);
SET @commit_id= 10001;
INSERT INTO t3 VALUES (121, 0);
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 120 ORDER BY a;
a b
120 0
@@ -1543,7 +1543,7 @@ include/stop_slave.inc
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @old_server_id= @@SESSION.server_id;
SET SESSION server_id= 100;
@@ -1553,7 +1553,7 @@ SET SESSION server_id= @old_server_id;
INSERT INTO t3 VALUES (130, 0);
SET @commit_id= 10011;
INSERT INTO t3 VALUES (131, 0);
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a >= 130 ORDER BY a;
a b
130 0
@@ -1579,7 +1579,7 @@ include/stop_slave.inc
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_mdev8031';
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10200;
INSERT INTO t3 VALUES (203, 1);
@@ -1600,7 +1600,7 @@ UPDATE t3 SET b=b+1 WHERE a=204;
UPDATE t3 SET b=b+1 WHERE a=203;
UPDATE t3 SET b=b+1 WHERE a=205;
UPDATE t3 SET b=b+1 WHERE a=205;
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
a b
201 3
@@ -1630,11 +1630,11 @@ SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill';
SET @old_max= @@GLOBAL.max_relay_log_size;
SET GLOBAL max_relay_log_size= 4096;
connection server_1;
-SET @old_dbug= @@SESSION.debug_dbug;
+SET @old_dbug_slave= @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,binlog_force_commit_id";
SET @commit_id= 10210;
Omit long queries that cause relaylog rotations and transaction retries...
-SET SESSION debug_dbug=@old_dbug;
+SET SESSION debug_dbug=@old_dbug_slave;
SELECT * FROM t3 WHERE a>=200 ORDER BY a;
a b
201 6
@@ -1654,7 +1654,7 @@ a b
204 7
205 5
include/stop_slave.inc
-SET GLOBAL debug_dbug= @old_debg;
+SET GLOBAL debug_dbug= @old_dbug;
SET GLOBAL max_relay_log_size= @old_max;
include/start_slave.inc
*** MDEV-8725: Assertion on ROLLBACK statement in the binary log ***
diff --git a/mysql-test/suite/rpl/r/rpl_parallel2.result b/mysql-test/suite/rpl/r/rpl_parallel2.result
index 42270916e4f..559c56271b8 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel2.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel2.result
@@ -2,8 +2,10 @@ include/rpl_init.inc [topology=1->2]
*** MDEV-5509: Incorrect value for Seconds_Behind_Master if parallel replication ***
connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
+set global slave_parallel_mode= optimistic;
include/start_slave.inc
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
@@ -157,6 +159,7 @@ UNLOCK TABLES;
connection server_2;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+set global slave_parallel_mode= @old_parallel_mode;
include/start_slave.inc
connection server_1;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
index 570d2534ed7..3dd5a3ea83c 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
@@ -4,7 +4,7 @@ connection server_2;
include/stop_slave.inc
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL slave_parallel_mode='optimistic';
SET GLOBAL slave_parallel_threads= 3;
CHANGE MASTER TO master_use_gtid=slave_pos;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
index 5d514d23101..862851c7a49 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
@@ -352,7 +352,7 @@ include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
include/stop_slave.inc
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
connection server_1;
ALTER TABLE t2 COMMENT "123abc";
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic_until.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_until.result
new file mode 100644
index 00000000000..a83a9b61b9f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic_until.result
@@ -0,0 +1,291 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+RESET MASTER;
+RESET SLAVE;
+connection master;
+RESET MASTER;
+CREATE TABLE t1 (a int primary key, b text) ENGINE=InnoDB;
+INSERT INTO t1 SET a=25, b='trx0';
+connection slave;
+include/start_slave.inc
+connection master;
+connection slave;
+include/stop_slave.inc
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET GLOBAL slave_parallel_threads=2;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_mode='optimistic';
+connection slave;
+SET @old_max_relay_log_size = @@global.max_relay_log_size;
+SET @@global.max_relay_log_size=4096;
+connection master;
+BEGIN;
+INSERT INTO t1 SET a=1, b='trx1';
+INSERT INTO t1 SET a=2, b='trx1';
+INSERT INTO t1 SET a=3, b='trx1';
+INSERT INTO t1 SET a=4, b='trx1';
+INSERT INTO t1 SET a=5, b='trx1';
+INSERT INTO t1 SET a=6, b='trx1';
+INSERT INTO t1 SET a=7, b='trx1';
+INSERT INTO t1 SET a=8, b='trx1';
+INSERT INTO t1 SET a=9, b='trx1';
+INSERT INTO t1 SET a=10, b='trx1';
+INSERT INTO t1 SET a=11, b='trx1';
+INSERT INTO t1 SET a=12, b='trx1';
+INSERT INTO t1 SET a=13, b='trx1';
+INSERT INTO t1 SET a=14, b='trx1';
+INSERT INTO t1 SET a=15, b='trx1';
+INSERT INTO t1 SET a=16, b='trx1';
+INSERT INTO t1 SET a=17, b='trx1';
+INSERT INTO t1 SET a=18, b='trx1';
+INSERT INTO t1 SET a=19, b='trx1';
+INSERT INTO t1 SET a=20, b='trx1';
+INSERT INTO t1 SET a=21, b='trx1';
+INSERT INTO t1 SET a=22, b='trx1';
+INSERT INTO t1 SET a=23, b='trx1';
+INSERT INTO t1 SET a=24, b='trx1';
+COMMIT;
+FLUSH LOGS;
+BEGIN;
+UPDATE t1 SET b='trx2_0' WHERE a = 25;
+UPDATE t1 SET b='trx2' WHERE a = 25;
+COMMIT;
+INSERT INTO t1 SET a=26,b='trx3';
+*** case 1 UNTIL inside trx2
+connection slave1;
+BEGIN;
+INSERT INTO t1 SET a= 1;
+connection slave;
+SELECT <pos_0> <= <pos_until> AND <pos_until> < <pos_trx2> as "pos_until < trx0 and is within trx2";
+pos_until < trx0 and is within trx2
+1
+CHANGE MASTER TO MASTER_USE_GTID=no;
+START SLAVE UNTIL MASTER_LOG_FILE = 'file_2', MASTER_LOG_POS = <pos_until>;
+connection slave1;
+ROLLBACK;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2';
+trx2 is committed
+1
+SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3';
+trx3 is not committed
+1
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+*** case 2 UNTIL inside trx2
+connection slave;
+DELETE FROM t1 WHERE a <> 25;
+UPDATE t1 SET b='trx0' WHERE a = 25;
+connection slave1;
+BEGIN;
+INSERT INTO t1 SET a= 1;
+connection slave;
+include/stop_slave.inc
+SELECT <pos_0> <= <pos_until> AND <pos_until> < <pos_trx2> as "pos_until >= trx0 and is within trx2";
+pos_until >= trx0 and is within trx2
+1
+CHANGE MASTER TO MASTER_LOG_FILE = 'file_1', MASTER_LOG_POS = <pos_trx0>, MASTER_USE_GTID=no;
+START SLAVE UNTIL MASTER_LOG_FILE = 'file_2', MASTER_LOG_POS = <pos_until>;
+connection slave1;
+ROLLBACK;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2';
+trx2 is committed
+1
+SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3';
+trx3 is not committed
+1
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+*** case 3 UNTIL inside trx1
+connection slave;
+DELETE FROM t1 WHERE a <> 25;
+UPDATE t1 SET b='trx0' WHERE a = 25;
+connection slave1;
+BEGIN;
+INSERT INTO t1 SET a= 1; # block trx1;
+connection slave;
+include/stop_slave.inc
+SELECT <pos_until> < <pos_0> as "pos_until before trx2 start position";
+pos_until before trx2 start position
+1
+CHANGE MASTER TO MASTER_LOG_FILE = 'file_1', MASTER_LOG_POS = <pos_trx0>, MASTER_USE_GTID=no;
+START SLAVE UNTIL MASTER_LOG_FILE = 'file_2', MASTER_LOG_POS = <pos_until>;
+connection slave1;
+ROLLBACK;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+SELECT count(*) = 25-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1';
+trx1 is committed
+1
+SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2';
+trx2 is not committed
+1
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+*** case 4 Relay-log UNTIL inside trx1
+connection slave;
+DELETE FROM t1 WHERE a <> 25;
+UPDATE t1 SET b='trx0' WHERE a = 25;
+connection slave1;
+BEGIN;
+INSERT INTO t1 SET a= 1; # block trx1;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_LOG_FILE = 'file_1', MASTER_LOG_POS = <pos_trx0>, MASTER_USE_GTID=no;
+START SLAVE IO_THREAD;
+include/wait_for_slave_io_to_start.inc
+START SLAVE UNTIL RELAY_LOG_FILE = 'file_2', RELAY_LOG_POS = <pos_until>;
+connection slave1;
+ROLLBACK;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+SELECT count(*) = 25-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1';
+trx1 is committed
+1
+SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2';
+trx2 is not committed
+1
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+*** case 5 Relay-log UNTIL inside a "big" trx that spawns few relay logs
+connection master;
+CREATE TABLE t2 (a TEXT) ENGINE=InnoDB;
+FLUSH LOGS;
+connection slave;
+connection slave;
+include/stop_slave.inc
+connection master;
+BEGIN;
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+INSERT INTO t2 SET a=repeat('a',1024);
+COMMIT;
+INSERT INTO t2 SET a='a';
+connection slave;
+START SLAVE IO_THREAD;
+include/wait_for_slave_io_to_start.inc
+START SLAVE UNTIL RELAY_LOG_FILE = 'file_2', RELAY_LOG_POS = <pos_until>;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+include/diff_tables.inc [master:t2,slave:t2]
+*** case 6 Relay-log UNTIL inside a small trx inside a sequence of relay logs
+connection slave;
+include/stop_slave.inc
+connection master;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+BEGIN;
+DELETE FROM t2 LIMIT 1;
+COMMIT;
+COMMIT;
+connection slave;
+START SLAVE IO_THREAD;
+include/wait_for_slave_io_to_start.inc
+connection master;
+include/sync_slave_io_with_master.inc
+connection slave;
+START SLAVE UNTIL RELAY_LOG_FILE = 'file_2', RELAY_LOG_POS = <pos_until>;
+Proof 1: Correct stop
+connection slave;
+include/wait_for_slave_sql_to_stop.inc
+Proof 2: Resume works out
+include/start_slave.inc
+connection master;
+connection slave;
+include/diff_tables.inc [master:t2,slave:t2]
+connection slave;
+include/stop_slave.inc
+SET GLOBAL max_relay_log_size=@old_max_relay_log_size;
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+include/start_slave.inc
+connection master;
+DROP TABLE t1, t2;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_password_boundaries.result b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
index eeee4c9ad58..8370213ad0e 100644
--- a/mysql-test/suite/rpl/r/rpl_password_boundaries.result
+++ b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
@@ -24,11 +24,11 @@ set sql_log_bin=1;
connection slave;
include/stop_slave.inc
change master to master_user='rpl33',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef!';
-ERROR HY000: String '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345' is too long for MASTER_PASSWORD (should be no longer than 96)
+ERROR HY000: String '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012...' is too long for MASTER_PASSWORD (should be no longer than 96)
change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
-ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long for MASTER_USER (should be no longer than 128)
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' is too long for MASTER_USER (should be no longer than 128)
change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
-ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbb' is too long for MASTER_HOST (should be no longer than 60)
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb...' is too long for MASTER_HOST (should be no longer than 60)
connection master;
set sql_log_bin=0;
grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль';
@@ -50,7 +50,7 @@ set sql_log_bin=1;
connection slave;
include/stop_slave.inc
change master to master_user='rpl17mix',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль!';
-ERROR HY000: String 'воттакойужпарольвоттакойужпарольвот' is too long for MASTER_PASSWORD (should be no longer than 96)
+ERROR HY000: String 'воттакойужпарольвоттакойужпарольв...' is too long for MASTER_PASSWORD (should be no longer than 96)
connection master;
set sql_log_bin=0;
drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1;
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
index 6fece52dda3..9a7a97e3d00 100644
--- a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
+++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result
@@ -2,6 +2,7 @@ include/master-slave.inc
[connection master]
connection master;
include/rpl_restart_server.inc [server_number=1]
+SET @saved_dbug = @@SESSION.debug_dbug;
SET @@debug_dbug="d,simulate_big_table_id";
CREATE TABLE t (a int);
INSERT INTO t SET a= 0;
@@ -42,5 +43,6 @@ master-bin.000002 # Query 1 # COMMIT
connection slave;
connection master;
DROP TABLE t;
+SET debug_dbug= @saved_dbug;
connection slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_corruption.result b/mysql-test/suite/rpl/r/rpl_row_corruption.result
index b5bdc32200a..24535460418 100644
--- a/mysql-test/suite/rpl/r/rpl_row_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_row_corruption.result
@@ -7,15 +7,15 @@ INSERT INTO t2_11753004 VALUES (2);
connection slave;
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
include/stop_slave.inc
-SET @save_debug= @@global.debug;
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @saved_debug= @@global.debug_dbug;
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc
connection master;
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1593 ]
include/stop_slave.inc
-SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug=@saved_debug;
include/start_slave.inc
connection master;
include/rpl_reset.inc
@@ -23,7 +23,7 @@ DROP TABLE t1_11753004, t2_11753004;
connection slave;
connection slave;
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc
include/rpl_reset.inc
connection master;
@@ -41,7 +41,7 @@ BINLOG '
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
'/*!*/;
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
@@ -51,10 +51,10 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings.
DROP TABLE t1,t2;
connection slave;
-SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug=@saved_debug;
connection master;
DROP TABLE t1_11753004;
DROP TABLE t2_11753004_ign;
connection slave;
-SET GLOBAL debug_dbug= @save_debug;
+SET @@global.debug_dbug= @save_debug;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_select.result b/mysql-test/suite/rpl/r/rpl_row_create_select.result
index b064d42982f..cbe84f20786 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_select.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_select.result
@@ -10,7 +10,7 @@ connection master;
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t1 AS SELECT REPEAT('A', 1000) DIV 1 AS a;
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -19,7 +19,7 @@ t1 CREATE TABLE `t1` (
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a;
Warnings:
-Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result
index 491fb68615c..650f6eeee51 100644
--- a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result
+++ b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result
@@ -2,6 +2,7 @@ include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL log_warnings = 2;
SET GLOBAL debug_dbug="d,inject_long_find_row_note";
include/start_slave.inc
@@ -17,7 +18,7 @@ connection slave;
# Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log
Occurrences: update=1, delete=1
include/stop_slave.inc
-SET GLOBAL debug_dbug = '';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
SET GLOBAL log_warnings = 2;
include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_virt.result b/mysql-test/suite/rpl/r/rpl_row_virt.result
new file mode 100644
index 00000000000..b670c63d9f1
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_virt.result
@@ -0,0 +1,20 @@
+include/master-slave.inc
+[connection master]
+connection master;
+create table t1 (
+id int auto_increment,
+data varchar(32),
+virt tinyint as (1),
+primary key (id),
+key virt (virt)
+) engine=innodb default charset=utf8mb4;
+insert into t1 (data) values ('broken');
+update t1 set data='more broken';
+connection slave;
+select * from t1;
+id data virt
+1 more broken 1
+connection master;
+drop table t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
index ec9607148d4..d517d53c6da 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
@@ -11,6 +11,7 @@ SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
connection master;
CREATE TABLE t1 (a INT) ENGINE=innodb;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
@@ -20,7 +21,7 @@ SET @@GLOBAL.debug_dbug="";
FLUSH LOGS;
connection slave;
connection master;
-SET @@GLOBAL.debug_dbug=@@GLOBAL.debug_dbug;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
SET @@GLOBAL.rpl_semi_sync_master_timeout = 10000;
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result
index 729c718390a..353ff379776 100644
--- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result
+++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result
@@ -3,6 +3,7 @@ include/master-slave.inc
connection slave;
SET DEBUG_SYNC= 'RESET';
include/stop_slave.inc
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= 'd,dbug.before_get_running_status_yes';
Slave_running, Slave_IO_Running, Slave_SQL_Running, must be OFF, NO, NO in three following queries
SHOW STATUS LIKE 'Slave_running';
@@ -34,7 +35,7 @@ Slave_running ON
Slave_IO_Running= Yes
Slave_SQL_Running= Yes
connection slave;
-set global debug_dbug= '';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'RESET';
End of tests
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
index be2a17ea2b7..8f855813554 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
connection slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write';
connection master;
create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb;
@@ -21,5 +22,5 @@ call mtr.add_suppression("Slave: Can't get stat of .*");
call mtr.add_suppression("Slave SQL: Error .Can.t get stat of.* error.* 13");
call mtr.add_suppression("Slave: File.* not found.*");
call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29");
-SET @@global.debug_dbug= '';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result
index c0140962a56..e0272b71192 100644
--- a/mysql-test/suite/rpl/r/rpl_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_start_stop_slave.result
@@ -5,10 +5,12 @@ set @time_before_kill := (select CURRENT_TIMESTAMP);
[Time before the query]
[Connection ID of the slave I/O thread found]
kill <connection_id>;
+include/wait_for_slave_io_to_stop.inc
set @time_after_kill := (select CURRENT_TIMESTAMP);
[Time after the query]
[Killing of the slave IO thread was successful]
START SLAVE IO_THREAD;
+include/wait_for_slave_io_to_start.inc
connection master;
create table t1 (a int primary key);
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
index 4d666c6e8bf..99e7a184e1f 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
@@ -11,7 +11,7 @@ drop table t1;
connection slave;
include/wait_for_slave_sql_to_stop.inc
call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.* error code=1062.*Error on slave:.* error.* 0");
-Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
+Error: "Query caused different errors on master and slave. Error on master: message (format)='Duplicate entry '%-.192T' for key %d' error code=1062 ; Error on slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
Errno: "0" (expected 0)
drop table t1;
include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
index f08f50f2467..0afe1992fb9 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
@@ -6,7 +6,8 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
create table tm (a int auto_increment primary key) engine=myisam;
create table ti (a int auto_increment primary key) engine=innodb;
connection slave;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+set @@global.debug_dbug="d,stop_slave_middle_group";
connection master;
begin;
insert into ti set a=null;
@@ -27,14 +28,13 @@ one
select count(*) as one from ti;
one
1
-set @@global.debug_dbug="-d";
+set @@global.debug_dbug=@saved_dbug;
include/start_slave.inc
connection master;
truncate table tm;
truncate table ti;
connection slave;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
-set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
+set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
connection master;
begin;
insert into ti set a=null;
@@ -53,14 +53,13 @@ one
select count(*) as zero from ti;
zero
0
-set @@global.debug_dbug="-d";
+set @@global.debug_dbug=@saved_dbug;
stop slave;
truncate table tm;
include/start_slave.inc
connection master;
connection slave;
-set @@global.debug_dbug="+d,stop_slave_middle_group";
-set @@global.debug_dbug="+d,incomplete_group_in_relay_log";
+set @@global.debug_dbug="d,stop_slave_middle_group,incomplete_group_in_relay_log";
connection master;
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
connection slave;
@@ -74,7 +73,7 @@ two
select max(a) as one from ti;
one
1
-set @@global.debug_dbug="-d";
+SET @@GLOBAL.debug_dbug = @saved_dbug;
include/rpl_reset.inc
connection master;
drop table tm, ti;
diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result
index 2417c5abda8..597df34c302 100644
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result
@@ -15,6 +15,7 @@ include/stop_slave.inc
# Suspend the INSERT statement in current transaction on SQL thread.
# It guarantees that SQL thread is applying the transaction when
# STOP SLAVE command launchs.
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,after_mysql_insert,*';
include/start_slave.inc
@@ -74,6 +75,7 @@ connection master;
connection slave;
# Test end
+SET @@GLOBAL.debug_dbug = @saved_dbug;
include/restart_slave.inc
connection slave;
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
@@ -98,6 +100,7 @@ connection slave;
include/stop_slave.inc
connection master;
include/stop_dump_threads.inc
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
connection slave;
include/start_slave.inc
@@ -120,6 +123,7 @@ connection slave;
include/wait_for_slave_to_stop.inc
connection slave1;
connection master;
+SET @@GLOBAL.debug_dbug = @saved_dbug;
include/stop_dump_threads.inc
connection slave1;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_view_debug.result b/mysql-test/suite/rpl/r/rpl_view_debug.result
index 22032c3fb90..e23f33c035f 100644
--- a/mysql-test/suite/rpl/r/rpl_view_debug.result
+++ b/mysql-test/suite/rpl/r/rpl_view_debug.result
@@ -21,6 +21,7 @@ Tables_in_test
t1
v1
connection master;
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug="d,simulate_register_view_failure";
CREATE VIEW v2 as SELECT * FROM t1;
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
@@ -36,4 +37,5 @@ v1
connection master;
DROP VIEW IF EXISTS v1;
DROP TABLE t1;
+SET debug_dbug= @saved_dbug;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/circular_serverid0.test b/mysql-test/suite/rpl/t/circular_serverid0.test
index 20ad58e2c52..64cf231c2c2 100644
--- a/mysql-test/suite/rpl/t/circular_serverid0.test
+++ b/mysql-test/suite/rpl/t/circular_serverid0.test
@@ -22,11 +22,10 @@
# The parameter reflects binlog-row-event-max-size @cnf.
--let $row_size=1024
-SET @old_debug= @@global.debug;
-
--connection M2
STOP SLAVE;
-SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging";
+SET @old_debug= @@global.debug_dbug;
+SET GLOBAL debug_dbug= "d,dbug.rows_events_to_delay_relay_logging";
START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc
diff --git a/mysql-test/suite/rpl/t/kill_race_condition.test b/mysql-test/suite/rpl/t/kill_race_condition.test
index 0f3b44864fe..25a7b18bac2 100644
--- a/mysql-test/suite/rpl/t/kill_race_condition.test
+++ b/mysql-test/suite/rpl/t/kill_race_condition.test
@@ -7,6 +7,7 @@ create table t1 (a int);
--sync_slave_with_master
connection slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug='d,rows_log_event_before_open_table';
connection master;
@@ -22,7 +23,7 @@ set debug_sync='now SIGNAL go_ahead_sql';
--source include/wait_for_slave_sql_error.inc
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $error
-set global debug_dbug='';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
set debug_sync='RESET';
connection master;
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
new file mode 100644
index 00000000000..f26e9565671
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
@@ -0,0 +1,121 @@
+# ==== Purpose ====
+#
+# Test verifies that Start binlog_dump message will report GTID position
+# requested by slave when log_warnings > 1.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Have LOG_WARNINGS=2
+# 1 - On a fresh slave server which has not replicated any GTIDs execute
+# "CHANGE MASTER TO MASTER_USE_GTID=current_pos;" command. Start the
+# slave.
+# 2 - In Master error log verify that pattern "using_gtid(1), gtid('')" is
+# present.
+# 3 - On slave server do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=no;" command. Start the slave threads.
+# 4 - In Master error log verify that pattern "using_gtid(0), gtid('')" is
+# present.
+# 5- Execute a DDL and DML on master server. This will generated two GTIDs
+# on the master server ('0-1-2'). Sync the slave server with master.
+# 6 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=slave_pos;" command. Start slave threads.
+# 7 - In Master error verify that pattern "using_gtid(1), gtid('0-1-2')" is
+# present.
+# 8 - On Master change domain ID to 10 and execute a DML operation. It will
+# generate a GTID 10-1-1.
+# 9 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=slave_pos;" command. Start slave threads.
+# 10 -In Master error verify that pattern "using_gtid(1),
+# gtid('0-1-2,10-1-1')" is present.
+#
+# ==== References ====
+#
+# MDEV-20428: "Start binlog_dump" message doesn't indicate GTID position
+#
+
+--source include/have_binlog_format_mixed.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection master
+SET GLOBAL LOG_WARNINGS=2;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=current_pos;
+--source include/start_slave.inc
+
+--connection master
+# Check error log for correct messages.
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!$log_error_)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+--echo "Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
+--source include/search_pattern_in_file.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
+--source include/search_pattern_in_file.inc
+CREATE TABLE t (f INT) ENGINE=INNODB;
+INSERT INTO t VALUES(10);
+save_master_pos;
+
+--connection slave
+sync_with_master;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
+--source include/search_pattern_in_file.inc
+SET @@SESSION.gtid_domain_id=10;
+INSERT INTO t VALUES(20);
+save_master_pos;
+
+--connection slave
+sync_with_master;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
+--source include/search_pattern_in_file.inc
+
+--echo "===== Clean up ====="
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--source include/start_slave.inc
+
+--connection master
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_index.test b/mysql-test/suite/rpl/t/rpl_binlog_index.test
index 8586b1d7489..95c49c3d574 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_index.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_index.test
@@ -43,7 +43,7 @@ FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (1);
sync_slave_with_master;
-
+--source include/stop_slave.inc
#
# Test on master
#
@@ -58,13 +58,15 @@ source include/rpl_stop_server.inc;
--move_file $master_datadir/master-bin.index $tmpdir/master-bin.index
--echo # Restart master with log-bin option set to the new path
---let $rpl_server_parameters=--log-bin=$tmpdir/master-bin
+--let $rpl_server_parameters=--log-bin=$tmpdir/master-bin --log-bin-index=$tmpdir/master-bin
--let $keep_include_silent=1
source include/rpl_start_server.inc;
--let $keep_include_silent=0
--echo # Master has restarted successfully
-
+--connection slave
+--source include/start_slave.inc
+--connection master
#
# Test master can handle old format with directory path in index file
#
@@ -85,7 +87,10 @@ if (!$is_windows)
--disable_query_log
source include/write_var_to_file.inc;
--enable_query_log
+--sync_slave_with_master
+--source include/stop_slave.inc
+--connection master
--echo # Shutdown master
--let $rpl_server_number=1
source include/rpl_stop_server.inc;
@@ -99,14 +104,17 @@ source include/rpl_stop_server.inc;
--remove_file $tmpdir/master-bin.index
--echo # Restart master with log-bin option set to default
---let $rpl_server_parameters=--log-bin=$master_datadir/master-bin
+--let $rpl_server_parameters=--log-bin=$master_datadir/master-bin --log-bin-index=$master_datadir/master-bin
--let $keep_include_silent=1
source include/rpl_start_server.inc;
--let $keep_include_silent=0
--echo # Master has restarted successfully
+--connection slave
+--source include/start_slave.inc
-connection slave;
+--connection master
+--sync_slave_with_master
--echo # stop slave
--source include/stop_slave.inc
--let $rpl_server_number= 2
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test b/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test
new file mode 100644
index 00000000000..ed4d713f626
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_rollback_cleanup.test
@@ -0,0 +1,46 @@
+# ==== Purpose ====
+#
+# Test verifies that when flushing an event to binary log fails the transaction
+# is successfully rolled back and following COMMIT command doesn't report any
+# assert.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - SET max_binlog_cache_size=64K
+# 1 - Create an Innodb table and insert required amount of data. Execute an
+# UPDATE operation which generates a big update event whose size exceeds
+# max_binlog_cache_size.
+# 2 - Wait for error 1197. Execute COMMIT command.
+# 3 - COMMIT should be successful.
+#
+# ==== References ====
+#
+# MDEV-18514: Assertion `!writer.checksum_len || writer.remains == 0' failed
+#
+--source include/have_innodb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--connection master
+let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
+SET GLOBAL max_binlog_cache_size = 65536;
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=INNODB;
+let $data = `select concat('"', repeat('a',6000), '"')`;
+let $data1 = `select concat('"', repeat('b',6000), '"')`;
+--disable_query_log
+eval INSERT INTO t1 (a, data) VALUES (1, CONCAT($data, $data));
+eval INSERT INTO t1 (a, data) VALUES (2, CONCAT($data, $data));
+eval INSERT INTO t1 (a, data) VALUES (3, CONCAT($data, $data));
+eval INSERT INTO t1 (a, data) VALUES (4, CONCAT($data, $data));
+eval INSERT INTO t1 (a, data) VALUES (5, CONCAT($data, $data));
+START TRANSACTION;
+--error ER_TRANS_CACHE_FULL
+eval UPDATE t1 SET data=$data1;
+COMMIT;
+--enable_query_log
+
+--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 2273219a821..0b2cbb6365c 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -15,6 +15,7 @@ call mtr.add_suppression("Slave SQL.*Failed during slave thread initialization.*
reset slave;
# Set debug flags on slave to force errors to occur
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
--disable_query_log
@@ -39,7 +40,7 @@ start slave;
#
# Cleanup
#
-SET GLOBAL debug_dbug="";
+SET @@GLOBAL.debug_dbug = @saved_dbug;
# Clear Last_SQL_Error
RESET SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt b/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt
deleted file mode 100644
index 37fc56036fb..00000000000
--- a/mysql-test/suite/rpl/t/rpl_bug41902-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=-d,simulate_find_log_pos_error
diff --git a/mysql-test/suite/rpl/t/rpl_bug41902.test b/mysql-test/suite/rpl/t/rpl_bug41902.test
index fe9452b0eda..bb6c572580f 100644
--- a/mysql-test/suite/rpl/t/rpl_bug41902.test
+++ b/mysql-test/suite/rpl/t/rpl_bug41902.test
@@ -15,7 +15,7 @@ source include/master-slave.inc;
connection slave;
stop slave;
-
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@debug_dbug="d,simulate_find_log_pos_error";
--error ER_UNKNOWN_TARGET_BINLOG
@@ -36,6 +36,7 @@ reset slave;
change master to master_host='dummy';
connection master;
+SET @saved_dbug_m = @@global.debug_dbug;
SET @@debug_dbug="d,simulate_find_log_pos_error";
--error ER_UNKNOWN_TARGET_BINLOG
reset master;
@@ -53,10 +54,12 @@ purge binary logs to 'master-bin.000001';
--disable_query_log
call mtr.add_suppression("Failed to locate old binlog or relay log files");
call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ..master-bin.000001 not listed in the index");
+set @@global.debug_dbug = @saved_dbug_m;
connection slave;
call mtr.add_suppression("Failed to locate old binlog or relay log files");
call mtr.add_suppression("MYSQL_BIN_LOG::purge_logs was called with file ..master-bin.000001 not listed in the index");
--enable_query_log
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--echo ==== clean up ====
CHANGE MASTER TO MASTER_HOST = '127.0.0.1';
diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
index bcc964a92c7..6e4ec8745f4 100644
--- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test
+++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
@@ -68,7 +68,17 @@ sync_slave_with_master;
--echo # comments
--connection master
--error 1064
-SELECT c1 FROM /*!999999 t1 WHEREN;
+SELECT c1 FROM /*!999999 t1 WHEREN; #*/
+
+#
+# Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
+#
+insert t1 values (/*!50505 1 /* foo */ */ + 2);
+insert t1 values (/*!999999 10 /* foo */ */ + 20);
+source include/show_binlog_events.inc;
+sync_slave_with_master;
+select * from t1;
+connection master;
DROP TABLE t1;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
index 9088866d28b..a949da0cc25 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test
@@ -35,7 +35,8 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
@@ -50,7 +51,7 @@ connection slave;
--let $slave_io_errno= 1595
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread;
--source include/wait_for_slave_io_to_start.inc
@@ -76,7 +77,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
@@ -92,7 +93,7 @@ connection slave;
--let $slave_io_errno= 1595
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
START SLAVE io_thread;
--source include/wait_for_slave_io_to_start.inc
@@ -118,7 +119,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
@@ -147,7 +148,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@@ -185,7 +186,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_before_commit";
+SET @@global.debug_dbug="d,kill_slave_io_before_commit";
connection master;
@@ -215,7 +216,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@@ -253,7 +254,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_after_2_events";
+SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master;
@@ -283,7 +284,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@@ -321,7 +322,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor
--echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after
--echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after
-SET @@global.debug_dbug="+d,kill_slave_io_after_2_events";
+SET @@global.debug_dbug="d,kill_slave_io_after_2_events";
connection master;
@@ -351,7 +352,7 @@ connection slave;
--source include/wait_for_slave_io_error.inc
SELECT * FROM t1;
-SET @@global.debug_dbug="-d";
+SET @@global.debug_dbug=@saved_dbug;
--source include/stop_slave.inc
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
@@ -379,5 +380,5 @@ connection slave;
--source include/stop_slave.inc
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
--source include/start_slave.inc
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
index 3619ede2c01..6dafab192a0 100644
--- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test
@@ -64,7 +64,6 @@ connection master;
#--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # Master has restarted successfully
-set @@global.debug_dbug="-d";
save_master_pos;
--connection slave
diff --git a/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test
new file mode 100644
index 00000000000..d750d44ae71
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_dump_request_retry_warning.test
@@ -0,0 +1,60 @@
+# ==== Purpose ====
+#
+# Test verifies that, due to a temporary network error, if request dump
+# command specific packet write operation fails then the write error gets
+# handled appropriately. Further retry will be initiated with appropriate
+# slave registration on master. This will ensure that master has all the
+# details of slave and no warnings are reported on the master side.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Skip the slave start.
+# 1 - Enable debug simulation which will simulate packet write error during
+# dump request command execution.
+# 2 - Start the slave. Observe that slave is able to reconnect post
+# temporary network write error.
+#
+# ==== References ====
+#
+# MDEV-14203: rpl.rpl_extra_col_master_myisam,
+# rpl.rpl_slave_load_tmpdir_not_exist failed in buildbot with a
+# warning
+#
+# MDEV-13258: rpl.rpl_skip_replication, rpl.rpl_set_statement_default_master
+# failed in buildbot
+#
+
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--let $rpl_skip_start_slave=1
+--source include/master-slave.inc
+
+# Do an insert on master
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES(1);
+
+# Add a debug point and start the slave so that dump request fails.
+connection slave;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
+SET @@global.debug_dbug= 'd,simulate_error_on_packet_write';
+
+START SLAVE;
+SET DEBUG_SYNC= 'now WAIT_FOR parked';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SET DEBUG_SYNC= 'RESET';
+
+--source include/wait_for_slave_io_to_start.inc
+--source include/wait_for_slave_sql_to_start.inc
+
+# Sync the slave and verify that slave has caught up with the master.
+connection master;
+--source include/sync_slave_sql_with_master.inc
+SELECT * FROM t1;
+
+# Cleanup
+connection master;
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_fail_register.test b/mysql-test/suite/rpl/t/rpl_fail_register.test
new file mode 100644
index 00000000000..d95a5c5f1c3
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_fail_register.test
@@ -0,0 +1,33 @@
+source include/have_debug.inc;
+source include/have_binlog_format_mixed.inc;
+source include/master-slave.inc;
+
+connection slave;
+
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='d,fail_com_register_slave';
+
+stop slave;
+reset slave;
+source include/wait_for_slave_to_stop.inc;
+start slave;
+stop slave;
+source include/wait_for_slave_to_stop.inc;
+set global debug_dbug=@old_dbug;
+
+connection master;
+
+let $id=`SELECT id from information_schema.processlist where command='Binlog Dump'`;
+
+if ($id) {
+ replace_result $id DUMP_THREAD;
+ eval kill $id;
+ let $wait_condition= SELECT count(*)=0 from information_schema.processlist where command='Killed';
+ source include/wait_condition.inc;
+}
+
+show slave hosts;
+
+connection slave;
+start slave;
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_failed_drop_tbl_binlog.test b/mysql-test/suite/rpl/t/rpl_failed_drop_tbl_binlog.test
deleted file mode 100644
index 281e2a2ab47..00000000000
--- a/mysql-test/suite/rpl/t/rpl_failed_drop_tbl_binlog.test
+++ /dev/null
@@ -1,64 +0,0 @@
-# ==== Purpose ====
-#
-# Check that when the execution of a DROP TABLE command with single table
-# fails it should not be written to the binary log. Also test that when the
-# execution of DROP TABLE command with multiple tables fails the command
-# should be written into the binary log.
-#
-# ==== Implementation ====
-#
-# Steps:
-# 0 - Create tables named t1, t2, t3
-# 1 - Execute DROP TABLE t1,t2,t3 command.
-# 2 - Kill the DROP TABLE command while it is trying to drop table 't2'.
-# 3 - Verify that tables t2,t3 are present after the DROP command execution
-# was interrupted.
-# 4 - Check that table 't1' is present in binary log as part of DROP
-# command.
-#
-# ==== References ====
-#
-# MDEV-20348: DROP TABLE IF EXISTS killed on master but was replicated.
-#
-
---source include/have_innodb.inc
---source include/have_debug_sync.inc
---source include/have_binlog_format_statement.inc
---source include/master-slave.inc
-
-create table t1 (a int) engine=innodb;
-create table t2 (b longblob) engine=innodb;
-create table t3 (c int) engine=innodb;
-insert into t2 values (repeat('b',1024*1024));
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-let $id=`select connection_id()`;
-set debug_sync='rm_table_no_locks_before_delete_table SIGNAL nogo WAIT_FOR go EXECUTE 2';
-send drop table t1, t2, t3;
-
-connect foo,localhost,root;
-set debug_sync='now SIGNAL go';
-let $wait_condition=select 1 from information_schema.processlist where state like 'debug sync point:%';
-source include/wait_condition.inc;
---replace_result $id CONNECTION_ID
-eval kill query $id;
-
-connection master;
-error ER_QUERY_INTERRUPTED;
-reap;
-
---echo "Tables t2 and t3 should be listed"
-SHOW TABLES;
---source include/show_binlog_events.inc
---sync_slave_with_master
-drop table t2, t3;
-
-connection master;
-set debug_sync='RESET';
-drop table t2, t3;
-
-source include/rpl_end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test b/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
index d4a4faf8d67..529613b37b1 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_dynamic.test
@@ -51,6 +51,8 @@ SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
connection slave;
source include/stop_slave.inc;
+SET @@GLOBAL.replicate_do_table="";
+SET @@GLOBAL.replicate_ignore_table="";
SET @@GLOBAL.replicate_do_table="test.t1,test.t2,test.t3";
SET @@GLOBAL.replicate_ignore_table="test.t4,test.t5,test.t6";
source include/start_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test b/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
index 6db61927eec..657a95cec15 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_wild_tables_dynamic.test
@@ -13,6 +13,8 @@ SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
connection slave;
source include/stop_slave.inc;
+SET @@GLOBAL.replicate_wild_do_table="";
+SET @@GLOBAL.replicate_wild_ignore_table="";
SET @@GLOBAL.replicate_wild_do_table="test.a%";
SET @@GLOBAL.replicate_wild_ignore_table="test.b%";
source include/start_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
index dca32c30a94..a61c06a92e5 100644
--- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
+++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
@@ -26,7 +26,7 @@ call mtr.add_suppression("Fatal error: The slave I/O thread stops because master
call mtr.add_suppression("Slave I/O thread .* register on master");
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
-let $debug_saved= `select @@global.debug`;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
# set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock
let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP';
@@ -40,11 +40,9 @@ let $dbug_sync_point= 'debug_lock.before_get_SERVER_ID';
let $debug_sync_action= 'now SIGNAL signal.get_server_id';
source extra/rpl_tests/rpl_get_master_version_and_clock.test;
-eval set global debug_dbug= '$debug_saved';
-
# cleanup
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
# is not really necessary but avoids mtr post-run env check warnings
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index b81cbd38cd3..3a9b17543b6 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -21,6 +21,9 @@ INSERT INTO t1 VALUES (1, 0);
--connection server_2
--sync_with_master
+SET sql_log_bin=0;
+call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
+SET sql_log_bin=1;
--source include/stop_slave.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
@@ -624,7 +627,7 @@ SELECT * FROM t1 WHERE a >= 30 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
-shutdown_server 10;
+shutdown_server;
--source include/wait_until_disconnected.inc
--remove_file $datadir/master-bin.state
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
index 622e66c5263..0262998798a 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_delete_domain.test
@@ -55,8 +55,17 @@ FLUSH BINARY LOGS;
--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
--eval PURGE BINARY LOGS TO '$purge_to_binlog';
# with final removal of the extra domain
+###adding to debug info to catch the failure (1076):
+--error 0,1076
--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID=($extra_domain_id)
+
+if ($mysql_errno == 1076) {
+ --echo ### Failure "Could not delete gtid domain"
+ --source include/show_rpl_debug_info.inc
+ }
+
SELECT @@global.gtid_binlog_pos, @@global.gtid_binlog_state;
+
--connection slave
SELECT @@global.gtid_slave_pos;
# start the slave sucessfully
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test
index 22cf10afba3..bc28ebddf5e 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test
@@ -42,7 +42,7 @@ SELECT * FROM t1 ORDER BY a;
# interfere with our DBUG error injection.
--source include/kill_binlog_dump_threads.inc
INSERT INTO t1 VALUES (10);
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output";
SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100";
--save_master_pos
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
index 09b35011f1f..3d605f3f213 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
@@ -29,7 +29,7 @@ CHANGE MASTER TO master_use_gtid=current_pos;
wait
EOF
FLUSH LOGS;
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--connection server_1
@@ -70,7 +70,7 @@ SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -103,7 +103,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -148,7 +148,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -191,7 +191,7 @@ SET sql_log_bin= 1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -221,7 +221,7 @@ SELECT * FROM t1 ORDER BY a;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -259,7 +259,7 @@ SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -291,7 +291,7 @@ SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
# Let the slave mysqld server start again.
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_strict.test b/mysql-test/suite/rpl/t/rpl_gtid_strict.test
index afcb179da78..56ebba824c4 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_strict.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_strict.test
@@ -29,17 +29,18 @@ INSERT INTO t1 VALUES (1);
SET server_id= 3;
--error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 3;
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET @old_dbug = @@session.debug_dbug;
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 3;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t1 VALUES (2);
--error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 2;
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 2;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t1 VALUES (3);
SET server_id= 1;
@@ -52,9 +53,9 @@ SELECT * FROM t1 ORDER BY 1;
SET server_id= 3;
--error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
# The table is still created, DDL cannot be rolled back.
@@ -66,9 +67,9 @@ CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM;
--error ER_GTID_STRICT_OUT_OF_ORDER
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="+d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check";
SET gtid_seq_no= 1;
-SET SESSION debug_dbug="-d,ignore_set_gtid_seq_no_check";
+SET SESSION debug_dbug=@old_dbug;
--error ER_GTID_STRICT_OUT_OF_ORDER
INSERT INTO t2 VALUES (1);
# The value is still inserted, cannot be rolled back.
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test
index 6a426ed1e9f..bd66a249ada 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test
@@ -18,7 +18,7 @@ set @@global.slave_net_timeout= 10;
# default period slave_net_timeout/2
#
--query_vertical show status like 'Slave_heartbeat_period';
-SET @save_dbug= @@GLOBAL.debug_dbug;
+SET @saved_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,simulate_slave_heartbeat_network_error";
CALL mtr.add_suppression('SET @master_heartbeat_period to master failed with error');
CALL mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again');
@@ -44,7 +44,7 @@ drop table t1;
connection slave;
--source include/stop_slave.inc
--disable_warnings
-SET GLOBAL debug_dbug=@save_dbug;
+SET GLOBAL debug_dbug=@saved_dbug;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
--enable_warnings
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
index ed26e61d9b6..046a65f77db 100644
--- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -5,9 +5,7 @@
--source include/master-slave.inc
connection master;
-
set @old_master_binlog_checksum= @@global.binlog_checksum;
-set @old_slave_dbug= @@global.debug_dbug;
# MDEV-4475: Cannot replicate to old server when binlog contains
# empty Gtid_list event
@@ -16,6 +14,7 @@ set @old_slave_dbug= @@global.debug_dbug;
connection slave;
--source include/stop_slave.inc
--echo # Test slave with no capability gets dummy event, which is ignored.
+set @old_dbug= @@global.debug_dbug;
SET @@global.debug_dbug='+d,simulate_slave_capability_none';
--source include/start_slave.inc
@@ -52,7 +51,7 @@ let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
let $binlog_start= $relaylog_start;
let $binlog_limit=0,10;
--source include/show_relaylog_events.inc
-set @@global.debug_dbug= @old_slave_dbug;
+set @@global.debug_dbug= @old_dbug;
--echo # Test dummy event is checksummed correctly.
@@ -150,11 +149,10 @@ let $binlog_limit=0,5;
select @@global.log_slave_updates;
select @@global.replicate_annotate_row_events;
-set @@global.debug_dbug= @old_slave_dbug;
-
--echo Clean up.
connection master;
set @@global.binlog_checksum = @old_master_binlog_checksum;
DROP TABLE t1, t2;
sync_slave_with_master;
+set @@global.debug_dbug= @old_dbug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test
index cb67052b47d..606508ccde1 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev382.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev382.test
@@ -212,7 +212,7 @@ SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1;
wait-rpl_mdev382.test
EOF
---shutdown_server 30
+--shutdown_server
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart-rpl_mdev382.test
diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
index 1931e2eab2a..f44c883ef4e 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -14,8 +14,7 @@ call mtr.add_suppression("table or database name 'mysqltest-1'");
connection master;
--disable_warnings
-DROP DATABASE IF EXISTS `#mysql50#mysqltest-1`;
-CREATE DATABASE `#mysql50#mysqltest-1`;
+CREATE DATABASE `mysqltest-1`;
--enable_warnings
sync_slave_with_master;
@@ -34,13 +33,25 @@ if ($before_position == $after_position)
echo Master position is not changed;
}
-#Some log events of the mysql_upgrade's will cause errors on slave.
+# Some log events of the mysql_upgrade previously caused errors on slave,
+# however with MDEV-4851 this should be ok, so we test it:
connection slave;
-STOP SLAVE SQL_THREAD;
-source include/wait_for_slave_sql_to_stop.inc;
+SET @old_general_log_state = @@global.general_log;
+SET @old_slow_log_state = @@global.slow_query_log;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL general_log = 'ON';
+SET GLOBAL slow_query_log = 'ON';
+SET GLOBAL log_output = 'FILE';
connection master;
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
+ALTER TABLE mysql.slow_log DROP COLUMN thread_id, DROP COLUMN rows_affected;
+DROP DATABASE `mysqltest-1`;
+sync_slave_with_master;
+
+connection slave;
+SHOW CREATE TABLE mysql.slow_log;
+connection master;
--exec $MYSQL_UPGRADE --skip-verbose --write-binlog --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
let $datadir= `select @@datadir`;
@@ -55,8 +66,15 @@ if ($before_position != $after_position)
echo Master position has been changed;
}
-DROP DATABASE `mysqltest-1`;
+sync_slave_with_master;
connection slave;
-DROP DATABASE `#mysql50#mysqltest-1`;
---let $rpl_only_running_threads= 1
+SHOW CREATE TABLE mysql.slow_log;
+SET GLOBAL general_log = 'OFF';
+SET GLOBAL slow_query_log = 'OFF';
+truncate mysql.slow_log;
+truncate mysql.general_log;
+SET GLOBAL general_log = @old_general_log_state;
+SET GLOBAL slow_query_log = @old_slow_log_state;
+SET GLOBAL log_output = @old_log_output;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel2.test b/mysql-test/suite/rpl/t/rpl_parallel2.test
index 3a9c801175f..8934b15e546 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel2.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel2.test
@@ -8,8 +8,10 @@
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
+set global slave_parallel_mode= optimistic;
--source include/start_slave.inc
--connection server_1
@@ -219,6 +221,7 @@ UNLOCK TABLES;
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+set global slave_parallel_mode= @old_parallel_mode;
--source include/start_slave.inc
--connection server_1
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
index eef11be1f1b..ebf6eff2cc4 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
@@ -325,7 +325,7 @@ INSERT INTO t2 VALUES (1,1), (2,1), (3,1), (4,1), (5,1);
--connection server_2
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
-SET @old_dbug= @@GLOBAL.debug_dbug;
+SET @old_debug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep';
--connection server_1
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test
new file mode 100644
index 00000000000..508213c9075
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_until.test
@@ -0,0 +1,465 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/master-slave.inc
+# Format is restricted because the test expects a specific result of
+# relay-logging that splits a transaction into two different files.
+--source include/have_binlog_format_row.inc
+
+#
+# MDEV-15152 Optimistic parallel slave doesn't cope well with START SLAVE UNTIL
+#
+--connection slave
+--source include/stop_slave.inc
+RESET MASTER;
+RESET SLAVE;
+
+--connection master
+RESET MASTER;
+CREATE TABLE t1 (a int primary key, b text) ENGINE=InnoDB;
+--let $a0 = 25
+--eval INSERT INTO t1 SET a=$a0, b='trx0'
+# Memorize the position for replication restart from it
+--let $pos_trx0 = query_get_value(SHOW MASTER STATUS, Position, 1)
+
+--connection slave
+--source include/start_slave.inc
+
+--connection master
+# --connection slave
+--sync_slave_with_master
+--source include/stop_slave.inc
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET GLOBAL slave_parallel_threads=2;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_mode='optimistic';
+
+# Run the slave in the following modes one by one.
+#
+# 1. the until position is set in the middle of trx2
+# below $pos_trx0 of the last exec position in the first file
+# 2. and above $pos_trx0
+# In either case trx2 must commit before slave stops.
+# 3. the until postion is inside trx1
+# 4. RELAY log until inside trx1
+# 5. RELAY log until inside a "big" trx
+# 6. RELAY log until inside a trx within a sequence of relay logs
+#
+# Execution flaw for Until_Master_Pos cases follows as:
+# create the transaction trx1, trx2
+# logged at the beginning of two subsequent binlog files.
+# Set the until position to at the middle of the 2rd transaction.
+# Engage the optimistic scheduler while having trx1 execution blocked.
+# Lift the block after trx2 has reached waiting its order to commit.
+# *Proof 1*
+# Observe that the slave applier stops at a correct position.
+# In the bug condition it would stop prematurely having the stop position
+# in the first file, therefore trx2 not committed.
+# Specifically, an internal transaction position until makes the applier to run
+# beyond it to commit commit the current transaction.
+# *Proof 2*
+# Observe the following START SLAVE resumes OK.
+#
+# Auxiliary third trx3 on master is just for triggering the actual stop
+# (whihc is a legacy UNTIL's property).
+# trx0 is to produce a specific value of the last executed binlog file:pos
+# to emulate the bug condition.
+#
+# Intermediate checks via SELECT are supposed to succeed
+# with putting out value 1.
+#
+# NOTE: Relay log until tests have to use explicit log names and position
+# which may require to adjust with future changes to event formats etc.
+#
+
+--connection slave
+SET @old_max_relay_log_size = @@global.max_relay_log_size;
+SET @@global.max_relay_log_size=4096;
+
+--connection master
+# trx1
+--let $a=1
+BEGIN;
+while (`SELECT $a < $a0`)
+{
+ --eval INSERT INTO t1 SET a=$a, b='trx1'
+--inc $a
+}
+COMMIT;
+--let $fil_1 = query_get_value(SHOW MASTER STATUS, File, 1)
+--let $pos_trx1 = query_get_value(SHOW MASTER STATUS, Position, 1)
+
+FLUSH LOGS;
+
+# $pos_0 the offset of the first event of trx2 in new file
+--let $pos_0=query_get_value(SHOW MASTER STATUS, Position, 1)
+# trx2
+--let $a=$a0
+BEGIN;
+--eval UPDATE t1 SET b='trx2_0' WHERE a = $a
+--eval UPDATE t1 SET b='trx2' WHERE a = $a
+COMMIT;
+--let $fil_2=query_get_value(SHOW MASTER STATUS, File, 1)
+--let $pos_trx2=query_get_value(SHOW MASTER STATUS, Position, 1)
+
+# trx3
+--let $a=$a0
+--inc $a
+--eval INSERT INTO t1 SET a=$a,b='trx3'
+--let $pos_trx3=query_get_value(SHOW MASTER STATUS, Position, 1)
+--let $a=
+
+
+--echo *** case 1 UNTIL inside trx2
+
+--connection slave1
+# Blocker to hold off EXEC_MASTER_LOG_POS advance
+BEGIN;
+ --eval INSERT INTO t1 SET a= 1
+--connection slave
+--let $pos_until=`SELECT $pos_trx0 - 1`
+--replace_result $pos_0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2>
+--eval SELECT $pos_0 <= $pos_until AND $pos_until < $pos_trx2 as "pos_until < trx0 and is within trx2"
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--replace_result $fil_2 file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until
+
+--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+
+--connection slave1
+# unblock to see the slave applier stops at $until
+ROLLBACK;
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`)
+{
+ --echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until.
+ --die
+}
+--eval SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2'
+--eval SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3'
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+
+--echo *** case 2 UNTIL inside trx2
+
+--connection slave
+--eval DELETE FROM t1 WHERE a <> $a0
+--eval UPDATE t1 SET b='trx0' WHERE a = $a0
+
+--connection slave1
+# Blocker to hold off EXEC_MASTER_LOG_POS advance
+BEGIN;
+ --eval INSERT INTO t1 SET a= 1
+
+--connection slave
+--source include/stop_slave.inc
+
+--let $pos_until=`SELECT $pos_trx2 - 1`
+--replace_result $pos_trx0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2>
+--eval SELECT $pos_trx0 <= $pos_until AND $pos_until < $pos_trx2 as "pos_until >= trx0 and is within trx2"
+--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0>
+--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no
+--replace_result $fil_2 file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until
+
+--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"
+--source include/wait_condition.inc
+
+--connection slave1
+# unblock to see the slave applier stops at $until
+ROLLBACK;
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`)
+{
+ --echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until.
+ --die
+}
+--eval SELECT count(*) = 1 as 'trx2 is committed' FROM t1 WHERE b = 'trx2'
+--eval SELECT count(*) = 0 as 'trx3 is not committed' FROM t1 WHERE b = 'trx3'
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+
+--echo *** case 3 UNTIL inside trx1
+
+--connection slave
+--eval DELETE FROM t1 WHERE a <> $a0
+--eval UPDATE t1 SET b='trx0' WHERE a = $a0
+
+
+--connection slave1
+# Blocker to hold off EXEC_MASTER_LOG_POS advance
+BEGIN;
+ --eval INSERT INTO t1 SET a= 1; # block trx1
+
+--connection slave
+--source include/stop_slave.inc
+
+--let $pos_until=`SELECT $pos_0 - 1`
+--replace_result $pos_0 <pos_0> $pos_until <pos_until> $pos_trx2 <pos_trx2>
+--eval SELECT $pos_until < $pos_0 as "pos_until before trx2 start position"
+--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0>
+--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no
+--replace_result $fil_2 file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL MASTER_LOG_FILE = '$fil_2', MASTER_LOG_POS = $pos_until
+
+--connection slave1
+# unblock to see the slave applier stops at $until
+ROLLBACK;
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+if (`SELECT "$file_stop" != "$fil_2" OR $pos_stop < $pos_until`)
+{
+ --echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $fil_2:$pos_until.
+ --die
+}
+--eval SELECT count(*) = $a0-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1'
+--eval SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2'
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+
+--echo *** case 4 Relay-log UNTIL inside trx1
+
+--connection slave
+--eval DELETE FROM t1 WHERE a <> $a0
+--eval UPDATE t1 SET b='trx0' WHERE a = $a0
+
+--connection slave1
+# Blocker to hold off EXEC_MASTER_LOG_POS advance
+BEGIN;
+ --eval INSERT INTO t1 SET a= 1; # block trx1
+
+--connection slave
+--source include/stop_slave.inc
+--replace_result $fil_1 file_1 $pos_trx0 <pos_trx0>
+--eval CHANGE MASTER TO MASTER_LOG_FILE = '$fil_1', MASTER_LOG_POS = $pos_trx0, MASTER_USE_GTID=no
+START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
+
+# The following test sets the stop coordinate is set to inside the first event
+# of a relay log that holds events of a transaction started in an earlier log.
+# Peek the stop position in the middle of trx1, not even on a event boundary.
+--let $pos_until=255
+--let $file_rl=slave-relay-bin.000003
+--let $binlog_file=$file_rl
+
+--let $pos_xid=508
+--let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_xid LIMIT 1, Info, 1)
+
+if (`SELECT "$info" NOT LIKE "COMMIT /* xid=% */" OR $pos_xid < $pos_until`)
+{
+ --echo *** Unexpected offset. Refine it to point to the correct XID event!
+ --die
+}
+
+--replace_result $file_rl file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until
+
+--connection slave1
+# unblock to see the slave applier stops at $until
+ROLLBACK;
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1)
+if (`SELECT strcmp("$file_rl","$file_stop") > -1`)
+{
+ --echo *** ERROR: Slave stopped at $file_stop:$pos_stop which is not $file_rl:$pos_until.
+ --die
+}
+
+--eval SELECT count(*) = $a0-1 as 'trx1 is committed' FROM t1 WHERE b = 'trx1'
+--eval SELECT count(*) = 0 as 'trx2 is not committed' FROM t1 WHERE b = 'trx2'
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+
+
+--echo *** case 5 Relay-log UNTIL inside a "big" trx that spawns few relay logs
+
+--connection master
+CREATE TABLE t2 (a TEXT) ENGINE=InnoDB;
+FLUSH LOGS;
+
+--sync_slave_with_master
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1)
+--let $records=`SELECT floor(4*@@global.max_relay_log_size / 1024) + 1`
+
+--connection slave
+--source include/stop_slave.inc
+
+--connection master
+# trx4
+BEGIN;
+--let $i=$records
+while ($i)
+{
+ INSERT INTO t2 SET a=repeat('a',1024);
+
+--dec $i
+}
+COMMIT;
+
+# slave will stop there:
+--let $file_trx4 = query_get_value(SHOW MASTER STATUS, File, 1)
+--let $pos_trx4 = query_get_value(SHOW MASTER STATUS, Position, 1)
+
+# trx5
+INSERT INTO t2 SET a='a';
+--let $pos_trx5 = query_get_value(SHOW MASTER STATUS, Position, 1)
+
+--connection slave
+START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
+
+# Set position inside the transaction though the value
+# specified is beyond that relay log file.
+# The coordianate may point to in a different event in future changes
+# but should not move away from inside this big group of events.
+# So we don't test which event in the transaction it points to.
+--let $pos_until= 4500
+--let $file_rl= slave-relay-bin.000010
+
+--replace_result $file_rl file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+# It's showed the actual stop occurred before trx5
+if (`SELECT strcmp("$file_trx4", "$file_stop") <> 0 OR $pos_stop >= $pos_trx5 OR count(*) <> $records FROM t2`)
+{
+ --echo *** ERROR: Slave stopped at *binlog* $file_stop:$pos_stop which is not $file_trx4:$pos_trx4.
+ --die
+}
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+--let $diff_tables=master:t2,slave:t2
+--source include/diff_tables.inc
+
+
+
+--echo *** case 6 Relay-log UNTIL inside a small trx inside a sequence of relay logs
+
+--connection slave
+--source include/stop_slave.inc
+
+--connection master
+# trx6
+--let $records=`SELECT count(*) FROM t2`
+while ($records)
+{
+ BEGIN;
+ DELETE FROM t2 LIMIT 1;
+ COMMIT;
+--dec $records
+}
+COMMIT;
+
+--connection slave
+START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
+
+--connection master
+--source include/sync_slave_io_with_master.inc
+
+--connection slave
+# The relay-log coordinate is not at an event boundary and
+# also may change across the server version.
+# The test makes its best to check its coherance.
+--let $pos_until= 3130
+--let $file_rl= slave-relay-bin.000018
+
+--let $pos_gtid = 2987
+--let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_gtid LIMIT 1, Info, 1)
+
+if (`SELECT "$info" != "BEGIN GTID 0-1-23"`)
+{
+ --echo *** Unexpected offset. Refine it to point to the correct GTID!
+ --die
+}
+--let $pos_event = 3120
+--let $type= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_event LIMIT 1, Event_type, 1)
+if (`SELECT "$type" != "Delete_rows_v1"`)
+{
+ --echo *** Unexpected offset. Refine it to point to the expected event!
+ --die
+}
+
+--replace_result $file_rl file_2 $pos_until <pos_until>
+--eval START SLAVE UNTIL RELAY_LOG_FILE = '$file_rl', RELAY_LOG_POS = $pos_until
+
+--echo Proof 1: Correct stop
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+--let $file_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--let $pos_stop= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1)
+if (`SELECT strcmp("$file_stop", "$file_rl") = -1 OR
+ strcmp("$file_stop", "$file_rl") = 0 AND $pos_stop < $pos_until`)
+{
+ --echo *** ERROR: Slave stopped at *relay* $file_stop:$pos_stop which is not $file_rl:$pos_until.
+ --die
+}
+
+--echo Proof 2: Resume works out
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+--let $diff_tables=master:t2,slave:t2
+--source include/diff_tables.inc
+
+#
+# Clean up.
+#
+--connection slave
+--source include/stop_slave.inc
+SET GLOBAL max_relay_log_size=@old_max_relay_log_size;
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+--source include/start_slave.inc
+
+--connection master
+DROP TABLE t1, t2;
+
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_partition.test b/mysql-test/suite/rpl/t/rpl_parallel_partition.test
index 37dce9fef80..ea6c5dca6be 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_partition.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_partition.test
@@ -42,7 +42,7 @@ ALTER TABLE `E` REMOVE PARTITIONING;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
---shutdown_server 30
+--shutdown_server
--source include/wait_until_disconnected.inc
--connection default
--source include/wait_until_disconnected.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
index 0c6f9d5e862..abf22cc876e 100644
--- a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
+++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test
@@ -17,6 +17,7 @@
--let $rpl_server_number= 1
--source include/rpl_restart_server.inc
+SET @saved_dbug = @@SESSION.debug_dbug;
SET @@debug_dbug="d,simulate_big_table_id";
CREATE TABLE t (a int);
@@ -51,7 +52,7 @@ if (`SELECT sum(a) != 6 FROM t`)
--connection master
DROP TABLE t;
-
+SET debug_dbug= @saved_dbug;
--sync_slave_with_master
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_corruption.test b/mysql-test/suite/rpl/t/rpl_row_corruption.test
index acf3964f0c5..d78df905ccb 100644
--- a/mysql-test/suite/rpl/t/rpl_row_corruption.test
+++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test
@@ -27,8 +27,8 @@ call mtr.add_suppression(".*Found table map event mapping table id 0 which was a
# stop the slave and inject corruption
--source include/stop_slave.inc
-SET @save_debug= @@global.debug;
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @saved_debug= @@global.debug_dbug;
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc
--connection master
# both tables get mapped to 0 (in a way, simulating scenario
@@ -42,7 +42,7 @@ SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
--source include/stop_slave.inc
# clean up
-SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug=@saved_debug;
--source include/start_slave.inc
--connection master
--source include/rpl_reset.inc
@@ -55,7 +55,7 @@ SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
--connection slave
--source include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc
--source include/rpl_reset.inc
--connection master
@@ -92,7 +92,7 @@ AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
#110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
# at 855
#110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
-SET GLOBAL debug_dbug="+d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug="d,inject_tblmap_same_id_maps_diff_table";
--error ER_SLAVE_FATAL_ERROR
BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
@@ -105,11 +105,11 @@ SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
# clean up
DROP TABLE t1,t2;
--connection slave
-SET GLOBAL debug_dbug="-d,inject_tblmap_same_id_maps_diff_table";
+SET @@global.debug_dbug=@saved_debug;
--connection master
--eval DROP TABLE $t1
--eval DROP TABLE $t2_ign
--sync_slave_with_master
-SET GLOBAL debug_dbug= @save_debug;
+SET @@global.debug_dbug= @save_debug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test
index fb7491b0077..2753fd1f9e0 100644
--- a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test
+++ b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test
@@ -9,7 +9,7 @@
# - setup log_warnings and debug
--connection slave
--source include/stop_slave.inc
---let $debug_save= `SELECT @@GLOBAL.debug_dbug`
+SET @saved_dbug = @@GLOBAL.debug_dbug;
--let $log_warnings_save= `SELECT @@GLOBAL.log_warnings`
SET GLOBAL log_warnings = 2;
@@ -55,7 +55,7 @@ EOF
# cleanup
--source include/stop_slave.inc
---eval SET GLOBAL debug_dbug = '$debug_save'
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--eval SET GLOBAL log_warnings = $log_warnings_save
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test
index 0ad9b315d66..958fa2352c2 100644
--- a/mysql-test/suite/rpl/t/rpl_row_index_choice.test
+++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test
@@ -47,6 +47,7 @@ sync_slave_with_master;
connection slave;
ANALYZE TABLE t2;
--echo # Slave will crash if using the wrong or no index
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_wrong_index,slave_crash_if_table_scan";
connection master;
@@ -238,6 +239,5 @@ connection master;
DROP TABLE t1;
sync_slave_with_master;
connection slave;
-SET GLOBAL debug_dbug="";
-
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_row_virt.test b/mysql-test/suite/rpl/t/rpl_row_virt.test
new file mode 100644
index 00000000000..e79869cd8e4
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_virt.test
@@ -0,0 +1,27 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+connection master;
+
+create table t1 (
+ id int auto_increment,
+ data varchar(32),
+ virt tinyint as (1),
+ primary key (id),
+ key virt (virt)
+) engine=innodb default charset=utf8mb4;
+
+insert into t1 (data) values ('broken');
+
+update t1 set data='more broken';
+
+--sync_slave_with_master
+
+select * 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_semi_sync_skip_repl.test b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
index 8c00bae06cd..0d2739e1937 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
@@ -33,7 +33,7 @@ source include/start_slave.inc;
CREATE TABLE t1 (a INT) ENGINE=innodb;
# Make the following events as if they offset over 2GB from the beginning of binlog
---let $sav_debug_dbug=@@GLOBAL.debug_dbug
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
@@ -51,7 +51,7 @@ FLUSH LOGS;
# Clean up
#
--connection master
---eval SET @@GLOBAL.debug_dbug=$sav_debug_dbug
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled = $sav_enabled_master
diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test
index 2cb44fc6ac1..cb4a8819a5b 100644
--- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test
+++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test
@@ -11,7 +11,7 @@ connection slave;
SET DEBUG_SYNC= 'RESET';
source include/stop_slave.inc;
-let $debug_saved= `select @@global.debug`;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= 'd,dbug.before_get_running_status_yes'; # to block due-started IO
# Test 1. Slave is stopped
@@ -77,7 +77,7 @@ echo Slave_SQL_Running= $status;
connection slave;
-eval set global debug_dbug= '$debug_saved';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
SET DEBUG_SYNC= 'RESET';
--echo End of tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test
index 426c3c831b0..e69c28500ae 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test
@@ -100,6 +100,7 @@ TRUNCATE t3;
ALTER TABLE t1 ADD PRIMARY KEY (a);
ALTER TABLE t2 ADD PRIMARY KEY (a);
ALTER TABLE t3 ADD PRIMARY KEY (a);
+
--sync_slave_with_master
RENAME TABLE t3 TO t3_bak;
@@ -145,7 +146,7 @@ ALTER TABLE t1 ENGINE=InnoDB;
ALTER TABLE t2 ENGINE=InnoDB;
ALTER TABLE t3 ENGINE=InnoDB;
---connection slave
+--sync_slave_with_master
RENAME TABLE t3 TO t3_bak;
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
index 69319bad4a0..100514089d5 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
@@ -29,7 +29,7 @@
##########################################################################
connection slave;
---let $old_debug= `SELECT @@global.debug_dbug`
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@global.debug_dbug= '+d,remove_slave_load_file_before_write';
connection master;
@@ -74,7 +74,7 @@ call mtr.add_suppression("Slave: File.* not found.*");
call mtr.add_suppression("Slave SQL: Error .File.* not found.* error.* 29");
--let $rpl_only_running_threads= 1
-eval SET @@global.debug_dbug= '$old_debug';
+SET @@GLOBAL.debug_dbug = @saved_dbug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index a38ac8fc6a1..23b25b1bf85 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -38,8 +38,8 @@ set @time_before_kill := (select CURRENT_TIMESTAMP);
--replace_regex /kill [0-9]*/kill <connection_id>/
--eval kill $connection_id
-let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist where id=$connection_id;
---source include/wait_condition.inc
+--source include/wait_for_slave_io_to_stop.inc
+
set @time_after_kill := (select CURRENT_TIMESTAMP);
--echo [Time after the query]
@@ -52,6 +52,7 @@ if(`select TIMESTAMPDIFF(SECOND,@time_after_kill, @time_before_kill) > 60`)
--echo [Killing of the slave IO thread was successful]
START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
# Ensure that the slave io thread started properly
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
index 00df8e9d385..caaae06a8e9 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test
@@ -3,10 +3,10 @@
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
#
+-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
-- source include/have_innodb.inc
-- source include/not_windows.inc
--- source include/have_binlog_format_mixed_or_statement.inc
-- let $engine=InnoDB
-- source extra/rpl_tests/rpl_lower_case_table_names.test
diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
index 5071fd348fb..afe36334f18 100644
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -22,7 +22,7 @@ source include/stop_slave.inc;
--echo # Suspend the INSERT statement in current transaction on SQL thread.
--echo # It guarantees that SQL thread is applying the transaction when
--echo # STOP SLAVE command launchs.
-let $debug_save= `SELECT @@GLOBAL.debug`;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,after_mysql_insert,*';
source include/start_slave.inc;
@@ -44,9 +44,7 @@ source extra/rpl_tests/rpl_stop_slave.test;
--echo
--echo # Test end
---disable_query_log
-eval SET GLOBAL debug_dbug= '$debug_save';
---enable_query_log
+SET @@GLOBAL.debug_dbug = @saved_dbug;
source include/restart_slave_sql.inc;
connection slave;
@@ -79,7 +77,7 @@ connection master;
# make sure that there are no zombie threads
--source include/stop_dump_threads.inc
-let $debug_save= `SELECT @@GLOBAL.debug`;
+SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= '+d,dump_thread_wait_before_send_xid,*';
connection slave;
@@ -126,9 +124,7 @@ reap;
# sure that we disable the DBUG_EXECUTE_IF
# that would set the dump thread to wait
connection master;
---disable_query_log
-eval SET GLOBAL debug_dbug= '$debug_save';
---enable_query_log
+SET @@GLOBAL.debug_dbug = @saved_dbug;
# make sure that there are no zombie threads
--source include/stop_dump_threads.inc
diff --git a/mysql-test/suite/rpl/t/rpl_view_debug.test b/mysql-test/suite/rpl/t/rpl_view_debug.test
index a00b6733dea..0803692496e 100644
--- a/mysql-test/suite/rpl/t/rpl_view_debug.test
+++ b/mysql-test/suite/rpl/t/rpl_view_debug.test
@@ -18,6 +18,7 @@ sync_slave_with_master;
# view already has to be on slave
show tables;
connection master;
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug="d,simulate_register_view_failure";
--error ER_OUT_OF_RESOURCES
@@ -30,5 +31,5 @@ show tables;
connection master;
DROP VIEW IF EXISTS v1;
DROP TABLE t1;
-
+SET debug_dbug= @saved_dbug;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
index 88d7076b1e4..28c99740a53 100644
--- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
+++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test
@@ -10,7 +10,7 @@ call mtr.add_suppression("Master is configured to log replication events");
# If everything is okay, the test will end in several seconds; maybe a minute.
# If the problem shows up, it will hang until testcase timeout is exceeded.
---exec $MYSQL_SLAP --silent --socket=$SLAVE_MYSOCK -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test
+--exec $MYSQL_SLAP --silent --host=127.0.0.1 -P $SLAVE_MYPORT -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test
# All done.
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.test b/mysql-test/suite/storage_engine/alter_tablespace.test
index 3c4910069a0..1899da28320 100644
--- a/mysql-test/suite/storage_engine/alter_tablespace.test
+++ b/mysql-test/suite/storage_engine/alter_tablespace.test
@@ -46,7 +46,7 @@ wait
EOF
--enable_reconnect
- --shutdown_server 60
+ --shutdown_server
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test
index e17bb9d2ea4..f53640578cd 100644
--- a/mysql-test/suite/storage_engine/trx/xa_recovery.test
+++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test
@@ -12,7 +12,7 @@
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
---shutdown_server 60
+--shutdown_server
--source include/wait_until_connected_again.inc
diff --git a/mysql-test/suite/stress/r/misc.result b/mysql-test/suite/stress/r/misc.result
new file mode 100644
index 00000000000..6d0a3ea5050
--- /dev/null
+++ b/mysql-test/suite/stress/r/misc.result
@@ -0,0 +1,9 @@
+#
+# MDEV-22339 - Assertion `str_length < len' failed in
+# Binary_string::realloc_raw
+#
+CREATE TABLE t1(a INT) ENGINE=MyISAM;
+connect con1, localhost, root;
+disconnect con1;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/stress/t/misc.test b/mysql-test/suite/stress/t/misc.test
new file mode 100644
index 00000000000..e8255cb3a81
--- /dev/null
+++ b/mysql-test/suite/stress/t/misc.test
@@ -0,0 +1,32 @@
+--echo #
+--echo # MDEV-22339 - Assertion `str_length < len' failed in
+--echo # Binary_string::realloc_raw
+--echo #
+CREATE TABLE t1(a INT) ENGINE=MyISAM;
+connect con1, localhost, root;
+let $i=1000;
+disable_query_log;
+disable_result_log;
+while ($i)
+{
+ connection default;
+ HANDLER t1 OPEN;
+ send SELECT * FROM t1, t1 t1a1over8, t1 t1a2over8, t1 t1a3over8, t1 t1a4over8, t1 t1a5over8, t1 t1a6over8;
+
+ connection con1;
+ send REPAIR TABLE t1;
+
+ connection default;
+ reap;
+ HANDLER t1 CLOSE;
+
+ connection con1;
+ reap;
+ dec $i;
+}
+enable_query_log;
+enable_result_log;
+disconnect con1;
+
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/debug_dbug_func.result b/mysql-test/suite/sys_vars/r/debug_dbug_func.result
index 1c7ae4e2832..d0c002cf111 100644
--- a/mysql-test/suite/sys_vars/r/debug_dbug_func.result
+++ b/mysql-test/suite/sys_vars/r/debug_dbug_func.result
@@ -1,55 +1,55 @@
-SET @old_debug = @@GLOBAL.debug;
-set debug_dbug= 'T';
-select @@debug;
-@@debug
+SET @old_debug = @@GLOBAL.debug_dbug;
+SET debug_dbug= 'T';
+select @@debug_dbug;
+@@debug_dbug
T
-set debug_dbug= '+P';
-select @@debug;
-@@debug
+SET debug_dbug= '+P';
+select @@debug_dbug;
+@@debug_dbug
P:T
-set debug_dbug= '-P';
-select @@debug;
-@@debug
+SET debug_dbug= '-P';
+select @@debug_dbug;
+@@debug_dbug
T
-SELECT @@session.debug, @@global.debug;
-@@session.debug @@global.debug
+SELECT @@session.debug_dbug, @@global.debug_dbug;
+@@session.debug_dbug @@global.debug_dbug
T
SET SESSION debug_dbug= '';
-SELECT @@session.debug, @@global.debug;
-@@session.debug @@global.debug
+SELECT @@session.debug_dbug, @@global.debug_dbug;
+@@session.debug_dbug @@global.debug_dbug
#
# Bug #52629: memory leak from sys_var_thd_dbug in
# binlog.binlog_write_error
#
SET GLOBAL debug_dbug='d,injecting_fault_writing';
-SELECT @@global.debug;
-@@global.debug
+SELECT @@global.debug_dbug;
+@@global.debug_dbug
d,injecting_fault_writing
SET GLOBAL debug_dbug='';
-SELECT @@global.debug;
-@@global.debug
+SELECT @@global.debug_dbug;
+@@global.debug_dbug
SET GLOBAL debug_dbug=@old_debug;
#
# Bug #56709: Memory leaks at running the 5.1 test suite
#
-SET @old_local_debug = @@debug;
+SET @old_local_debug = @@debug_dbug;
SET @@debug_dbug='d,foo';
-SELECT @@debug;
-@@debug
+SELECT @@debug_dbug;
+@@debug_dbug
d,foo
SET @@debug_dbug='';
-SELECT @@debug;
-@@debug
+SELECT @@debug_dbug;
+@@debug_dbug
SET @@debug_dbug= @old_local_debug;
End of 5.1 tests
#
# Bug#46165 server crash in dbug
#
-SET @old_globaldebug = @@global.debug;
-SET @old_sessiondebug= @@session.debug;
+SET @old_globaldebug = @@global.debug_dbug;
+SET @old_sessiondebug= @@session.debug_dbug;
# Test 1 - Bug test case, single connection
SET GLOBAL debug_dbug= '+O,MYSQL_TMP_DIR/bug46165.1.trace';
SET SESSION debug_dbug= '-d:-t:-i';
diff --git a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
index 834d693edb8..0bf9d859d40 100644
--- a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
+++ b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result
@@ -7,7 +7,7 @@ SET @@session.foreign_key_checks = 1;
SET @@session.foreign_key_checks = DEFAULT;
SELECT @@session.foreign_key_checks;
@@session.foreign_key_checks
-0
+1
'#---------------------FN_DYNVARS_032_02-------------------------#'
SET foreign_key_checks = 1;
SELECT @@foreign_key_checks;
diff --git a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
index a0a849c1d7a..a9a683e017b 100644
--- a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
+++ b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
@@ -1,3 +1,3 @@
select @@global.host_cache_size;
@@global.host_cache_size
-632
+653
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
index e6210165436..e50890a341c 100644
--- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
@@ -50,5 +50,3 @@ COUNT(@@GLOBAL.innodb_buffer_pool_size)
1 Expected
SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
ERROR 42S22: Unknown column 'innodb_buffer_pool_size' in 'field list'
-Expected error 'Readonly variable'
-SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
diff --git a/mysql-test/suite/sys_vars/r/innodb_compression_failure_threshold_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_compression_failure_threshold_pct_basic.result
index ae556ceedb2..3a5eb46df68 100644
--- a/mysql-test/suite/sys_vars/r/innodb_compression_failure_threshold_pct_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_compression_failure_threshold_pct_basic.result
@@ -36,7 +36,7 @@ SELECT @@global.innodb_compression_failure_threshold_pct;
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_compression_failure_threshold_pct = -1;
Warnings:
-Warning 1292 Truncated incorrect innodb_compression_failure_thres value: '-1'
+Warning 1292 Truncated incorrect innodb_compression_failure_th... value: '-1'
SELECT @@global.innodb_compression_failure_threshold_pct;
@@global.innodb_compression_failure_threshold_pct
0
@@ -57,7 +57,7 @@ SELECT @@global.innodb_compression_failure_threshold_pct;
0
SET @@global.innodb_compression_failure_threshold_pct = 101;
Warnings:
-Warning 1292 Truncated incorrect innodb_compression_failure_thres value: '101'
+Warning 1292 Truncated incorrect innodb_compression_failure_th... value: '101'
SELECT @@global.innodb_compression_failure_threshold_pct;
@@global.innodb_compression_failure_threshold_pct
100
diff --git a/mysql-test/suite/sys_vars/r/innodb_defragment_fill_factor_n_recs_basic.result b/mysql-test/suite/sys_vars/r/innodb_defragment_fill_factor_n_recs_basic.result
index ffbeb39fe33..a8ca081d0f0 100644
--- a/mysql-test/suite/sys_vars/r/innodb_defragment_fill_factor_n_recs_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_defragment_fill_factor_n_recs_basic.result
@@ -19,13 +19,13 @@ SELECT @@global.innodb_defragment_fill_factor_n_recs;
1
SET @@global.innodb_defragment_fill_factor_n_recs = -1;
Warnings:
-Warning 1292 Truncated incorrect innodb_defragment_fill_factor_n_ value: '-1'
+Warning 1292 Truncated incorrect innodb_defragment_fill_factor... value: '-1'
SELECT @@global.innodb_defragment_fill_factor_n_recs;
@@global.innodb_defragment_fill_factor_n_recs
1
SET @@global.innodb_defragment_fill_factor_n_recs = 10000;
Warnings:
-Warning 1292 Truncated incorrect innodb_defragment_fill_factor_n_ value: '10000'
+Warning 1292 Truncated incorrect innodb_defragment_fill_factor... value: '10000'
SELECT @@global.innodb_defragment_fill_factor_n_recs;
@@global.innodb_defragment_fill_factor_n_recs
100
diff --git a/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result
index 3d4f401aad1..589de8fa5fc 100644
--- a/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result
@@ -49,7 +49,7 @@ set global innodb_limit_optimistic_insert_debug='foo';
ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug'
set global innodb_limit_optimistic_insert_debug=-2;
Warnings:
-Warning 1292 Truncated incorrect innodb_limit_optimistic_insert_d value: '-2'
+Warning 1292 Truncated incorrect innodb_limit_optimistic_inser... value: '-2'
set global innodb_limit_optimistic_insert_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug'
SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
index 6679ca87249..7724ef9c2ee 100644
--- a/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_log_checksums_basic.result
@@ -28,9 +28,11 @@ SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
1
SET GLOBAL innodb_log_checksums = OFF;
+Warnings:
+Warning 138 innodb_log_checksums is deprecated and has no effect outside recovery
SELECT @@global.innodb_log_checksums;
@@global.innodb_log_checksums
-0
+1
SET GLOBAL innodb_log_checksums = default;
SET GLOBAL innodb_log_checksums = ON;
SELECT @@global.innodb_log_checksums;
diff --git a/mysql-test/suite/sys_vars/r/innodb_merge_threshold_set_all_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_merge_threshold_set_all_debug_basic.result
index 6e325d0be38..c05432fe2b9 100644
--- a/mysql-test/suite/sys_vars/r/innodb_merge_threshold_set_all_debug_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_merge_threshold_set_all_debug_basic.result
@@ -10,13 +10,13 @@ SELECT @@global.innodb_merge_threshold_set_all_debug;
1
set global innodb_merge_threshold_set_all_debug = 51;
Warnings:
-Warning 1292 Truncated incorrect innodb_merge_threshold_set_all_d value: '51'
+Warning 1292 Truncated incorrect innodb_merge_threshold_set_al... value: '51'
SELECT @@global.innodb_merge_threshold_set_all_debug;
@@global.innodb_merge_threshold_set_all_debug
50
set global innodb_merge_threshold_set_all_debug = 0;
Warnings:
-Warning 1292 Truncated incorrect innodb_merge_threshold_set_all_d value: '0'
+Warning 1292 Truncated incorrect innodb_merge_threshold_set_al... value: '0'
SELECT @@global.innodb_merge_threshold_set_all_debug;
@@global.innodb_merge_threshold_set_all_debug
1
diff --git a/mysql-test/suite/sys_vars/r/innodb_purge_rseg_truncate_frequency_basic.result b/mysql-test/suite/sys_vars/r/innodb_purge_rseg_truncate_frequency_basic.result
index 79eb0743dfa..65387032dc6 100644
--- a/mysql-test/suite/sys_vars/r/innodb_purge_rseg_truncate_frequency_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_purge_rseg_truncate_frequency_basic.result
@@ -36,13 +36,13 @@ SELECT @@global.innodb_purge_rseg_truncate_frequency;
'#--------------------FN_DYNVARS_046_05-------------------------#'
SET @@global.innodb_purge_rseg_truncate_frequency = -1;
Warnings:
-Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_frequ value: '-1'
+Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_fr... value: '-1'
SELECT @@global.innodb_purge_rseg_truncate_frequency;
@@global.innodb_purge_rseg_truncate_frequency
1
SET @@global.innodb_purge_rseg_truncate_frequency = -1024;
Warnings:
-Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_frequ value: '-1024'
+Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_fr... value: '-1024'
SELECT @@global.innodb_purge_rseg_truncate_frequency;
@@global.innodb_purge_rseg_truncate_frequency
1
@@ -103,7 +103,7 @@ SELECT @@global.innodb_purge_rseg_truncate_frequency;
1
SET @@global.innodb_purge_rseg_truncate_frequency = FALSE;
Warnings:
-Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_frequ value: '0'
+Warning 1292 Truncated incorrect innodb_purge_rseg_truncate_fr... value: '0'
SELECT @@global.innodb_purge_rseg_truncate_frequency;
@@global.innodb_purge_rseg_truncate_frequency
1
diff --git a/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result b/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
index 88516a854fe..b76ba4933f2 100644
--- a/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
@@ -1,28 +1,28 @@
SET @start_global_value = @@global.innodb_spin_wait_delay;
SELECT @start_global_value;
@start_global_value
-6
+4
Valid values are zero or above
select @@global.innodb_spin_wait_delay >=0;
@@global.innodb_spin_wait_delay >=0
1
select @@global.innodb_spin_wait_delay;
@@global.innodb_spin_wait_delay
-6
+4
select @@session.innodb_spin_wait_delay;
ERROR HY000: Variable 'innodb_spin_wait_delay' is a GLOBAL variable
show global variables like 'innodb_spin_wait_delay';
Variable_name Value
-innodb_spin_wait_delay 6
+innodb_spin_wait_delay 4
show session variables like 'innodb_spin_wait_delay';
Variable_name Value
-innodb_spin_wait_delay 6
+innodb_spin_wait_delay 4
select * from information_schema.global_variables where variable_name='innodb_spin_wait_delay';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_SPIN_WAIT_DELAY 6
+INNODB_SPIN_WAIT_DELAY 4
select * from information_schema.session_variables where variable_name='innodb_spin_wait_delay';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_SPIN_WAIT_DELAY 6
+INNODB_SPIN_WAIT_DELAY 4
set global innodb_spin_wait_delay=10;
select @@global.innodb_spin_wait_delay;
@@global.innodb_spin_wait_delay
@@ -38,7 +38,7 @@ ERROR HY000: Variable 'innodb_spin_wait_delay' is a GLOBAL variable and should b
set global innodb_spin_wait_delay=DEFAULT;
select @@global.innodb_spin_wait_delay;
@@global.innodb_spin_wait_delay
-6
+4
set global innodb_spin_wait_delay=0;
select @@global.innodb_spin_wait_delay;
@@global.innodb_spin_wait_delay
@@ -111,4 +111,4 @@ INNODB_SPIN_WAIT_DELAY 0
SET @@global.innodb_spin_wait_delay = @start_global_value;
SELECT @@global.innodb_spin_wait_delay;
@@global.innodb_spin_wait_delay
-6
+4
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result
index ec211b693df..68ba8bbfb4a 100644
--- a/mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result
@@ -45,7 +45,7 @@ select @@global.innodb_stats_persistent_sample_pages;
20
SET global innodb_stats_persistent_sample_pages=0;
Warnings:
-Warning 1292 Truncated incorrect innodb_stats_persistent_sample_p value: '0'
+Warning 1292 Truncated incorrect innodb_stats_persistent_sampl... value: '0'
SELECT @@global.innodb_stats_persistent_sample_pages;
@@global.innodb_stats_persistent_sample_pages
1
@@ -71,7 +71,7 @@ SELECT @@global.innodb_stats_persistent_sample_pages;
10
SET global innodb_stats_persistent_sample_pages=-7;
Warnings:
-Warning 1292 Truncated incorrect innodb_stats_persistent_sample_p value: '-7'
+Warning 1292 Truncated incorrect innodb_stats_persistent_sampl... value: '-7'
SELECT @@global.innodb_stats_persistent_sample_pages;
@@global.innodb_stats_persistent_sample_pages
1
diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
index 1ea5ac3d3bc..4113b168f39 100644
--- a/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
@@ -53,7 +53,7 @@ SET global innodb_stats_transient_sample_pages=' ';
ERROR 42000: Incorrect argument type to variable 'innodb_stats_transient_sample_pages'
SET global innodb_stats_transient_sample_pages=-7;
Warnings:
-Warning 1292 Truncated incorrect innodb_stats_transient_sample_pa value: '-7'
+Warning 1292 Truncated incorrect innodb_stats_transient_sample... value: '-7'
SELECT @@global.innodb_stats_transient_sample_pages;
@@global.innodb_stats_transient_sample_pages
1
diff --git a/mysql-test/suite/sys_vars/r/innodb_tmpdir_basic.result b/mysql-test/suite/sys_vars/r/innodb_tmpdir_basic.result
index be10c93b56b..0eebc758cf6 100644
--- a/mysql-test/suite/sys_vars/r/innodb_tmpdir_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_tmpdir_basic.result
@@ -24,11 +24,11 @@ ERROR 42000: Incorrect argument type to variable 'innodb_tmpdir'
set global innodb_tmpdir=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_tmpdir'
set global innodb_tmpdir=repeat('a',1000);
-ERROR 42000: Variable 'innodb_tmpdir' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+ERROR 42000: Variable 'innodb_tmpdir' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...'
show warnings;
Level Code Message
Warning 1210 Path length should not exceed 512 bytes
-Error 1231 Variable 'innodb_tmpdir' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+Error 1231 Variable 'innodb_tmpdir' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...'
SET @@global.innodb_tmpdir = @start_global_value;
SELECT @@global.innodb_tmpdir;
@@global.innodb_tmpdir
diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result
index a8876b2c81e..b48b045897c 100644
--- a/mysql-test/suite/sys_vars/r/max_sort_length_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_sort_length_basic.result
@@ -27,14 +27,14 @@ SELECT @@session.max_sort_length = 1024;
@@session.max_sort_length = 1024
1
'#--------------------FN_DYNVARS_084_03-------------------------#'
-SET @@global.max_sort_length = 4;
+SET @@global.max_sort_length = 8;
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
-SET @@global.max_sort_length = 5;
+8
+SET @@global.max_sort_length = 9;
SELECT @@global.max_sort_length;
@@global.max_sort_length
-5
+9
SET @@global.max_sort_length = 8388608;
SELECT @@global.max_sort_length;
@@global.max_sort_length
@@ -48,14 +48,14 @@ SELECT @@global.max_sort_length;
@@global.max_sort_length
65536
'#--------------------FN_DYNVARS_084_04-------------------------#'
-SET @@session.max_sort_length = 4;
+SET @@session.max_sort_length = 8;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-4
-SET @@session.max_sort_length = 5;
+8
+SET @@session.max_sort_length = 9;
SELECT @@session.max_sort_length;
@@session.max_sort_length
-5
+9
SET @@session.max_sort_length = 8388608;
SELECT @@session.max_sort_length;
@@session.max_sort_length
@@ -74,13 +74,13 @@ Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '-1024'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@global.max_sort_length = 3;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '3'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@global.max_sort_length = 8388609;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '8388609'
@@ -92,17 +92,17 @@ Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '0'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@global.max_sort_length = 65530.34;
ERROR 42000: Incorrect argument type to variable 'max_sort_length'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@global.max_sort_length = test;
ERROR 42000: Incorrect argument type to variable 'max_sort_length'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@session.max_sort_length = 8388610;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '8388610'
@@ -114,19 +114,19 @@ Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '-1'
SELECT @@session.max_sort_length;
@@session.max_sort_length
-4
+8
SET @@session.max_sort_length = 3;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '3'
SELECT @@session.max_sort_length;
@@session.max_sort_length
-4
+8
SET @@session.max_sort_length = 0;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '0'
SELECT @@session.max_sort_length;
@@session.max_sort_length
-4
+8
SET @@session.max_sort_length = 65530.34;
ERROR 42000: Incorrect argument type to variable 'max_sort_length'
SET @@session.max_sort_length = 10737418241;
@@ -158,13 +158,13 @@ Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '1'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
SET @@global.max_sort_length = FALSE;
Warnings:
Warning 1292 Truncated incorrect max_sort_length value: '0'
SELECT @@global.max_sort_length;
@@global.max_sort_length
-4
+8
'#---------------------FN_DYNVARS_084_09----------------------#'
SET @@global.max_sort_length = 2048;
SELECT @@max_sort_length = @@global.max_sort_length;
diff --git a/mysql-test/suite/sys_vars/r/optimizer_selectivity_sampling_limit_basic.result b/mysql-test/suite/sys_vars/r/optimizer_selectivity_sampling_limit_basic.result
index 4df024b9cec..54d5e796267 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_selectivity_sampling_limit_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_selectivity_sampling_limit_basic.result
@@ -30,7 +30,7 @@ SELECT @@global.optimizer_selectivity_sampling_limit;
100
SET @@global.optimizer_selectivity_sampling_limit = 9;
Warnings:
-Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '9'
+Warning 1292 Truncated incorrect optimizer_selectivity_samplin... value: '9'
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
10
@@ -56,7 +56,7 @@ SELECT @@global.optimizer_selectivity_sampling_limit;
4294967295
SET @@global.optimizer_selectivity_sampling_limit = 4294967296;
Warnings:
-Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '4294967296'
+Warning 1292 Truncated incorrect optimizer_selectivity_samplin... value: '4294967296'
SELECT @@global.optimizer_selectivity_sampling_limit;
@@global.optimizer_selectivity_sampling_limit
4294967295
@@ -66,7 +66,7 @@ SELECT @@session.optimizer_selectivity_sampling_limit;
100
SET @@session.optimizer_selectivity_sampling_limit = 9;
Warnings:
-Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '9'
+Warning 1292 Truncated incorrect optimizer_selectivity_samplin... value: '9'
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
10
@@ -92,7 +92,7 @@ SELECT @@session.optimizer_selectivity_sampling_limit;
4294967295
SET @@session.optimizer_selectivity_sampling_limit = 4294967296;
Warnings:
-Warning 1292 Truncated incorrect optimizer_selectivity_sampling_l value: '4294967296'
+Warning 1292 Truncated incorrect optimizer_selectivity_samplin... value: '4294967296'
SELECT @@session.optimizer_selectivity_sampling_limit;
@@session.optimizer_selectivity_sampling_limit
4294967295
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
index c37c6785b9b..d813f515f83 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
@@ -17,38 +17,38 @@ OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,i
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
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
-set global optimizer_switch=10;
-set session optimizer_switch=5;
+set global optimizer_switch=4101;
+set session optimizer_switch=2058;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
set global optimizer_switch="index_merge_sort_union=on";
set session optimizer_switch="index_merge=off";
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,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=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,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=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,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=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
set session optimizer_switch="default";
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,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=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off
set optimizer_switch = replace(@@optimizer_switch, '=off', '=on');
Warnings:
Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
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 1e6d420a9d7..4b92a80be03 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
@@ -3,7 +3,7 @@ SET @start_session_value = @@session.optimizer_use_condition_selectivity;
'#--------------------FN_DYNVARS_115_03-------------------------#'
SET @@global.optimizer_use_condition_selectivity = 0;
Warnings:
-Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
+Warning 1292 Truncated incorrect optimizer_use_condition_selec... value: '0'
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
1
@@ -29,14 +29,14 @@ SELECT @@global.optimizer_use_condition_selectivity;
5
SET @@global.optimizer_use_condition_selectivity = 6;
Warnings:
-Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '6'
+Warning 1292 Truncated incorrect optimizer_use_condition_selec... value: '6'
SELECT @@global.optimizer_use_condition_selectivity;
@@global.optimizer_use_condition_selectivity
5
'#--------------------FN_DYNVARS_115_04-------------------------#'
SET @@session.optimizer_use_condition_selectivity = 0;
Warnings:
-Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '0'
+Warning 1292 Truncated incorrect optimizer_use_condition_selec... value: '0'
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
1
@@ -62,7 +62,7 @@ SELECT @@session.optimizer_use_condition_selectivity;
5
SET @@session.optimizer_use_condition_selectivity = 6;
Warnings:
-Warning 1292 Truncated incorrect optimizer_use_condition_selectiv value: '6'
+Warning 1292 Truncated incorrect optimizer_use_condition_selec... value: '6'
SELECT @@session.optimizer_use_condition_selectivity;
@@session.optimizer_use_condition_selectivity
5
diff --git a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
index a05b85a9bfd..54adf835962 100644
--- a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
@@ -37,5 +37,9 @@ SET @@GLOBAL.replicate_do_db=null;
SELECT @@GLOBAL.replicate_do_db;
@@GLOBAL.replicate_do_db
+SET @@GLOBAL.replicate_do_db=DEFAULT;
+SELECT @@GLOBAL.replicate_do_db;
+@@GLOBAL.replicate_do_db
+
# Cleanup.
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
diff --git a/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
index ec3b39124fe..249d745482a 100644
--- a/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
+++ b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result
@@ -1,6 +1,6 @@
include/master-slave.inc
[connection master]
-connection slave;
+include/sync_slave_sql_with_master.inc
SET @start_max_connections= @@global.max_connections;
SET @start_init_slave= @@global.init_slave;
SET NAMES utf8;
@@ -19,18 +19,12 @@ SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connec
1
Expect 1
include/assert.inc [@@global.max_connections = @start_max_connections]
-STOP SLAVE;
-RESET MASTER;
-RESET SLAVE;
-START SLAVE;
-include/wait_for_slave_to_start.inc
+include/restart_slave.inc
+connection master;
+include/sync_slave_sql_with_master.inc
include/assert.inc [@@global.max_connections = @start_max_connections + 1]
SET @@global.init_slave = "SET @a=5";
-STOP SLAVE;
-RESET MASTER;
-RESET SLAVE;
-START SLAVE;
-include/wait_for_slave_to_start.inc
+include/restart_slave.inc
SHOW VARIABLES LIKE 'init_slave';
Variable_name Value
init_slave SET @a=5
diff --git a/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
index 7162e40ef6b..c9e4a0f7dca 100644
--- a/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
+++ b/mysql-test/suite/sys_vars/r/session_track_system_variables_basic.result
@@ -159,6 +159,8 @@ SELECT @@session.session_track_system_variables;
@@session.session_track_system_variables
+# MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size.
+SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0;
# Restoring the original values.
SET @@global.session_track_system_variables = @global_saved_tmp;
# End of tests.
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
index ff3f5ba1d2c..802932602af 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
@@ -1214,8 +1214,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.45
-+GLOBAL_VALUE 5.6.45-86.1
+-GLOBAL_VALUE 5.6.50
++GLOBAL_VALUE 5.6.49-89.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
index 77e8fb638a1..12aeecc58b4 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
@@ -684,8 +684,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.45
-+GLOBAL_VALUE 5.6.45-86.1
+-GLOBAL_VALUE 5.6.50
++GLOBAL_VALUE 5.6.49-89.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 65d47347a15..89138c2fedd 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -515,7 +515,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE zlib
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
-VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2
+VARIABLE_COMMENT Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -613,7 +613,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT InnoDB system tablespace size to be set in recovery.
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 4294967295
+NUMERIC_MAX_VALUE 268435456
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -654,18 +654,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
-VARIABLE_NAME INNODB_DEBUG_SYNC
-SESSION_VALUE NULL
-DEFAULT_VALUE
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE VARCHAR
-VARIABLE_COMMENT debug_sync for innodb purge threads. Use it to set up sync points for all purge threads at once. The commands will be applied sequentially at the beginning of purging the next undo record.
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NULL
-READ_ONLY NO
-COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID
SESSION_VALUE 1
DEFAULT_VALUE 1
@@ -877,7 +865,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of threads performing background key rotation and scrubbing
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 4294967295
+NUMERIC_MAX_VALUE 255
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -1511,7 +1499,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Whether to compute and require checksums for InnoDB redo log blocks
+VARIABLE_COMMENT DEPRECATED. Whether to require checksums for InnoDB redo log blocks.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -1580,10 +1568,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOG_OPTIMIZE_DDL
SESSION_VALUE NULL
-DEFAULT_VALUE ON
+DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Reduce redo logging when natively creating indexes or rebuilding tables. Setting this OFF avoids delay due to page flushing and allows concurrent backup.
+VARIABLE_COMMENT DEPRECATED. Ignored in MariaDB 10.5. Reduce redo logging when natively creating indexes or rebuilding tables. Enabling this may slow down backup and cause delay due to page flushing.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
@@ -1698,6 +1686,18 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_MAX_PURGE_LAG_WAIT
+SESSION_VALUE NULL
+DEFAULT_VALUE 4294967295
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE INT UNSIGNED
+VARIABLE_COMMENT Wait until History list length is below the specified limit
+NUMERIC_MIN_VALUE 0
+NUMERIC_MAX_VALUE 4294967295
+NUMERIC_BLOCK_SIZE 0
+ENUM_VALUE_LIST NULL
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_MAX_UNDO_LOG_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 10485760
@@ -2228,10 +2228,10 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_SPIN_WAIT_DELAY
SESSION_VALUE NULL
-DEFAULT_VALUE 6
+DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
-VARIABLE_COMMENT Maximum delay between polling for a spin lock (6 by default)
+VARIABLE_COMMENT Maximum delay between polling for a spin lock (4 by default)
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6000
NUMERIC_BLOCK_SIZE 0
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 577b5a97baf..87795f802e2 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -1766,7 +1766,7 @@ VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
-NUMERIC_MIN_VALUE 4
+NUMERIC_MIN_VALUE 8
NUMERIC_MAX_VALUE 8388608
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -2137,7 +2137,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
-NUMERIC_MAX_VALUE 200
+NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
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 1dc95c59606..aaaf1afb8b7 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -1906,7 +1906,7 @@ VARIABLE_NAME MAX_SORT_LENGTH
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored)
-NUMERIC_MIN_VALUE 4
+NUMERIC_MIN_VALUE 8
NUMERIC_MAX_VALUE 8388608
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -2277,7 +2277,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT
VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing.
NUMERIC_MIN_VALUE -1
-NUMERIC_MAX_VALUE 200
+NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
diff --git a/mysql-test/suite/sys_vars/r/unique_checks_basic.result b/mysql-test/suite/sys_vars/r/unique_checks_basic.result
index 60cf2795309..83fb9edb4cd 100644
--- a/mysql-test/suite/sys_vars/r/unique_checks_basic.result
+++ b/mysql-test/suite/sys_vars/r/unique_checks_basic.result
@@ -7,7 +7,7 @@ SET @@session.unique_checks= 1;
SET @@session.unique_checks= DEFAULT;
SELECT @@session.unique_checks;
@@session.unique_checks
-0
+1
'#--------------------FN_DYNVARS_005_04-------------------------#'
SET @@session.unique_checks =1;
SELECT @@session.unique_checks;
diff --git a/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result b/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result
index 8497e220523..4e4893532fb 100644
--- a/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result
+++ b/mysql-test/suite/sys_vars/r/wsrep_cluster_address_basic.result
@@ -1,7 +1,6 @@
#
# wsrep_cluster_address
#
-call mtr.add_suppression("safe_mutex: Found wrong usage of mutex.*");
# save the initial value
SET @wsrep_cluster_address_global_saved = @@global.wsrep_cluster_address;
# default
diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_func.test b/mysql-test/suite/sys_vars/t/debug_dbug_func.test
index b4cd4aefd5e..a72636131ee 100644
--- a/mysql-test/suite/sys_vars/t/debug_dbug_func.test
+++ b/mysql-test/suite/sys_vars/t/debug_dbug_func.test
@@ -1,27 +1,27 @@
--source include/have_debug.inc
-SET @old_debug = @@GLOBAL.debug;
+SET @old_debug = @@GLOBAL.debug_dbug;
#
-# Bug#34678 @@debug variable's incremental mode
+# Bug#34678 @@debug_dbug variable's incremental mode
#
-set debug_dbug= 'T';
-select @@debug;
-set debug_dbug= '+P';
-select @@debug;
-set debug_dbug= '-P';
-select @@debug;
+SET debug_dbug= 'T';
+select @@debug_dbug;
+SET debug_dbug= '+P';
+select @@debug_dbug;
+SET debug_dbug= '-P';
+select @@debug_dbug;
#
-# Bug#38054: "SET SESSION debug" modifies @@global.debug variable
+# Bug#38054: "SET SESSION debug" modifies @@global.debug_dbug variable
#
-SELECT @@session.debug, @@global.debug;
+SELECT @@session.debug_dbug, @@global.debug_dbug;
SET SESSION debug_dbug= '';
-SELECT @@session.debug, @@global.debug;
+SELECT @@session.debug_dbug, @@global.debug_dbug;
--echo #
--echo # Bug #52629: memory leak from sys_var_thd_dbug in
@@ -29,9 +29,9 @@ SELECT @@session.debug, @@global.debug;
--echo #
SET GLOBAL debug_dbug='d,injecting_fault_writing';
-SELECT @@global.debug;
+SELECT @@global.debug_dbug;
SET GLOBAL debug_dbug='';
-SELECT @@global.debug;
+SELECT @@global.debug_dbug;
SET GLOBAL debug_dbug=@old_debug;
@@ -39,12 +39,12 @@ SET GLOBAL debug_dbug=@old_debug;
--echo # Bug #56709: Memory leaks at running the 5.1 test suite
--echo #
-SET @old_local_debug = @@debug;
+SET @old_local_debug = @@debug_dbug;
SET @@debug_dbug='d,foo';
-SELECT @@debug;
+SELECT @@debug_dbug;
SET @@debug_dbug='';
-SELECT @@debug;
+SELECT @@debug_dbug;
SET @@debug_dbug= @old_local_debug;
@@ -55,8 +55,8 @@ SET @@debug_dbug= @old_local_debug;
--echo # Bug#46165 server crash in dbug
--echo #
-SET @old_globaldebug = @@global.debug;
-SET @old_sessiondebug= @@session.debug;
+SET @old_globaldebug = @@global.debug_dbug;
+SET @old_sessiondebug= @@session.debug_dbug;
--echo # Test 1 - Bug test case, single connection
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
index c5b4c118da2..4dd4a3aba0a 100644
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
@@ -27,7 +27,6 @@
--disable_query_log
if (`select (version() like '%debug%') > 0`)
{
- set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
set global innodb_disable_resize_buffer_pool_debug = OFF;
}
--enable_query_log
@@ -116,15 +115,7 @@ SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
--Error ER_BAD_FIELD_ERROR
SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
---echo Expected error 'Readonly variable'
-SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
---source include/wait_condition.inc
-
---disable_query_log
-if (`select (version() like '%debug%') > 0`)
-{
- set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
-}
---enable_query_log
+# Restore the original buffer pool size.
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test
index 9c3b88d3c3c..fcd6db017f1 100644
--- a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test
+++ b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test
@@ -74,9 +74,9 @@ SELECT @@session.max_sort_length = 1024;
# Change the value of max_sort_length to a valid value for GLOBAL Scope #
#########################################################################
-SET @@global.max_sort_length = 4;
+SET @@global.max_sort_length = 8;
SELECT @@global.max_sort_length;
-SET @@global.max_sort_length = 5;
+SET @@global.max_sort_length = 9;
SELECT @@global.max_sort_length;
SET @@global.max_sort_length = 8388608;
SELECT @@global.max_sort_length;
@@ -90,10 +90,10 @@ SELECT @@global.max_sort_length;
# Change the value of max_sort_length to a valid value for SESSION Scope #
##########################################################################
-SET @@session.max_sort_length = 4;
+SET @@session.max_sort_length = 8;
SELECT @@session.max_sort_length;
-SET @@session.max_sort_length = 5;
+SET @@session.max_sort_length = 9;
SELECT @@session.max_sort_length;
SET @@session.max_sort_length = 8388608;
diff --git a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
index ef9d8f17832..ada22845f3e 100644
--- a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
+++ b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test
@@ -19,8 +19,8 @@ select * from information_schema.session_variables where variable_name='optimize
#
# show that it's writable
#
-set global optimizer_switch=10;
-set session optimizer_switch=5;
+set global optimizer_switch=4101;
+set session optimizer_switch=2058;
select @@global.optimizer_switch;
select @@session.optimizer_switch;
set global optimizer_switch="index_merge_sort_union=on";
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
index 59d0176add2..b7004d1938b 100644
--- a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
@@ -38,5 +38,8 @@ SELECT @@GLOBAL.replicate_do_db;
SET @@GLOBAL.replicate_do_db=null;
SELECT @@GLOBAL.replicate_do_db;
+SET @@GLOBAL.replicate_do_db=DEFAULT;
+SELECT @@GLOBAL.replicate_do_db;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
index f8cbc54fc70..0e5ff7a3f39 100644
--- a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
+++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test
@@ -29,7 +29,13 @@
###############################################################################
source include/master-slave.inc;
-connection slave;
+
+# Since a part of slave SQL thread initialisation happens after Slave_SQL_Running
+# has been set to Yes, there is a race condition between initialisation above and
+# init_slave setting given below. Synchronise slave applier with master to ensure
+# init_slave is complete and applier had processed few events like FD.
+--source include/sync_slave_sql_with_master.inc
+
--disable_query_log
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--enable_query_log
@@ -66,14 +72,15 @@ let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
--let $assert_text= @@global.max_connections = @start_max_connections
--let $assert_cond= @@global.max_connections = @start_max_connections
--source include/assert.inc
-#
-# reset of the server
-STOP SLAVE;
---wait_for_slave_to_stop
-RESET MASTER;
-RESET SLAVE;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+
+--source include/restart_slave_sql.inc
+
+# Upon slave start, sync the applier with master, to ensure slave has
+# completed init_slave command execution and processed FD event from the
+# master.
+--connection master
+--source include/sync_slave_sql_with_master.inc
+
#
# wait for the slave threads have set the global variable.
let $wait_timeout= 90;
@@ -87,12 +94,7 @@ let $wait_condition= SELECT @@global.max_connections = @start_max_connections +
# Setting a variable(which is local to a session) and must not be visible
SET @@global.init_slave = "SET @a=5";
#
-STOP SLAVE;
---wait_for_slave_to_stop
-RESET MASTER;
-RESET SLAVE;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+--source include/restart_slave_sql.inc
#
SHOW VARIABLES LIKE 'init_slave';
# expect NULL
diff --git a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
index 90e6052947c..13423f4404d 100644
--- a/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
+++ b/mysql-test/suite/sys_vars/t/session_track_system_variables_basic.test
@@ -122,6 +122,8 @@ SELECT @@global.session_track_system_variables;
SELECT @@session.session_track_system_variables;
--echo
+--echo # MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size.
+SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0;
--echo # Restoring the original values.
SET @@global.session_track_system_variables = @global_saved_tmp;
diff --git a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
index 136c0745e42..6e0767ce853 100644
--- a/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
+++ b/mysql-test/suite/sys_vars/t/wsrep_cluster_address_basic.test
@@ -4,8 +4,6 @@
--echo # wsrep_cluster_address
--echo #
-call mtr.add_suppression("safe_mutex: Found wrong usage of mutex.*");
-
--echo # save the initial value
SET @wsrep_cluster_address_global_saved = @@global.wsrep_cluster_address;
diff --git a/mysql-test/suite/sys_vars/t/wsrep_on_basic.opt b/mysql-test/suite/sys_vars/t/wsrep_on_basic.opt
deleted file mode 100644
index aa1fb6cb155..00000000000
--- a/mysql-test/suite/sys_vars/t/wsrep_on_basic.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-lock-schedule-algorithm=FCFS
diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
index b7086600ab1..dd6e4c414f0 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result
@@ -408,3 +408,12 @@ SELECT * FROM t1 WHERE d2 < d1;
i d1 d2 t
1 2023-03-16 2023-03-15 1
DROP TABLE t1;
+#
+# MDEV-20015 Assertion `!in_use->is_error()' failed in TABLE::update_virtual_field
+#
+create or replace table t1 (a int);
+insert into t1 (a) values (1), (1);
+create or replace table t2 (pk int, b int, c int as (b) virtual, primary key (pk), key(c));
+insert into t2 (pk) select a from t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+drop tables t1, t2;
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index d0fa2415b77..6c4975f2178 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -407,6 +407,26 @@ aaa
Warnings:
Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when converting to DOUBLE
#
+# MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column
+#
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 (
+a INT NOT NULL DEFAULT 10,
+b INT AS (a+1) VIRTUAL
+) ENGINE=MyISAM;
+INSERT INTO t1 (b) VALUES (10);
+ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored
+INSERT INTO t1 (b) VALUES (DEFAULT(a));
+ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored
+INSERT INTO t1 (b) VALUES (DEFAULT);
+INSERT INTO t1 VALUES (10,10);
+ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored
+INSERT INTO t1 VALUES (10,DEFAULT(a));
+ERROR HY000: The value specified for generated column 'b' in table 't1' has been ignored
+INSERT INTO t1 VALUES (10, DEFAULT);
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
# End of 10.1 tests
#
#
@@ -436,8 +456,7 @@ select pk, col_bit+0, vcol_bit+0 from t1;
pk col_bit+0 vcol_bit+0
99 10000 1023
REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99);
-Warnings:
-Warning 1264 Out of range value for column 'vcol_bit' at row 1
+ERROR 22001: Data too long for column 'vcol_bit' at row 1
drop table t1;
#
# MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status()
@@ -456,10 +475,41 @@ INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
Warnings:
Warning 1264 Out of range value for column 'vi' at row 1
REPLACE INTO t1 (pk,i) VALUES (1,2);
-Warnings:
-Warning 1264 Out of range value for column 'vi' at row 1
+ERROR 22003: Out of range value for column 'vi' at row 1
DROP TABLE t1;
SET @sql_mode=@old_sql_mode;
#
+# MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column
+# 10.2+ specific part
+#
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 (
+a INT NOT NULL DEFAULT 10,
+b INT AS (a+1) VIRTUAL
+) ENGINE=MyISAM;
+EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING DEFAULT;
+EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING IGNORE;
+INSERT INTO t1 (b) VALUES (DEFAULT);
+INSERT INTO t1 (b) VALUES (IGNORE);
+SELECT * FROM t1;
+a b
+10 11
+10 11
+10 11
+10 11
+DELETE FROM t1;
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(10,?)' USING DEFAULT;
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(11,?)' USING IGNORE;
+INSERT INTO t1 VALUES (12,DEFAULT);
+INSERT INTO t1 VALUES (13,IGNORE);
+SELECT * FROM t1;
+a b
+10 11
+11 12
+12 13
+13 14
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test
index 99b1c9a444b..24612f4d55f 100644
--- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test
+++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test
@@ -300,3 +300,14 @@ DROP TABLE t1;
# Cleanup
--let $datadir= `SELECT @@datadir`
--remove_file $datadir/test/load_t1
+
+
+--echo #
+--echo # MDEV-20015 Assertion `!in_use->is_error()' failed in TABLE::update_virtual_field
+--echo #
+create or replace table t1 (a int);
+insert into t1 (a) values (1), (1);
+create or replace table t2 (pk int, b int, c int as (b) virtual, primary key (pk), key(c));
+--error ER_DUP_ENTRY
+insert into t2 (pk) select a from t1;
+drop tables t1, t2;
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 1de2827efe6..07f96f4e0b8 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -368,6 +368,36 @@ SELECT COLUMN_GET(@aaa, 'price' AS DECIMAL) aaa;
SELECT COLUMN_GET(@aaa, 'price' AS INT) aaa;
SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa;
+
+--echo #
+--echo # MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 (
+ a INT NOT NULL DEFAULT 10,
+ b INT AS (a+1) VIRTUAL
+) ENGINE=MyISAM;
+
+# Testing with a column list
+
+--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
+INSERT INTO t1 (b) VALUES (10);
+--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
+INSERT INTO t1 (b) VALUES (DEFAULT(a));
+INSERT INTO t1 (b) VALUES (DEFAULT);
+
+# Testing without a column list
+--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
+INSERT INTO t1 VALUES (10,10);
+--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
+INSERT INTO t1 VALUES (10,DEFAULT(a));
+INSERT INTO t1 VALUES (10, DEFAULT);
+
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+
--echo #
--echo # End of 10.1 tests
--echo #
@@ -401,6 +431,7 @@ replace INTO `t1` (`pk`,col_bit) VALUES (99,1000);
select pk, col_bit+0, vcol_bit+0 from t1;
replace INTO `t1` (`pk`,col_bit) VALUES (99,10000);
select pk, col_bit+0, vcol_bit+0 from t1;
+--error ER_DATA_TOO_LONG
REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99);
drop table t1;
@@ -421,10 +452,42 @@ CREATE TABLE t1 (
INSERT INTO t1 (pk,i) VALUES (1,1);
TRUNCATE TABLE t1;
INSERT IGNORE INTO t1 (pk,i) VALUES (1,127);
+--error ER_WARN_DATA_OUT_OF_RANGE
REPLACE INTO t1 (pk,i) VALUES (1,2);
DROP TABLE t1;
SET @sql_mode=@old_sql_mode;
--echo #
+--echo # MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a virtual column
+--echo # 10.2+ specific part
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 (
+ a INT NOT NULL DEFAULT 10,
+ b INT AS (a+1) VIRTUAL
+) ENGINE=MyISAM;
+
+# Testing with column list
+
+EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING DEFAULT;
+EXECUTE IMMEDIATE 'INSERT INTO t1 (b) VALUES(?)' USING IGNORE;
+INSERT INTO t1 (b) VALUES (DEFAULT);
+INSERT INTO t1 (b) VALUES (IGNORE);
+SELECT * FROM t1;
+DELETE FROM t1;
+
+# Testing without column list
+
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(10,?)' USING DEFAULT;
+EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES(11,?)' USING IGNORE;
+INSERT INTO t1 VALUES (12,DEFAULT);
+INSERT INTO t1 VALUES (13,IGNORE);
+SELECT * FROM t1;
+
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index fcaf38a3d7b..11577bfe8b0 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -9,3 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+
diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf
index 7e51b0750a1..f65306ffca5 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=1
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
index 9a0abd4460a..bcd96b86516 100644
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
@@ -4,7 +4,7 @@
# Verbose run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -32,11 +33,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -46,7 +48,7 @@ END IF|
# Silent run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -71,11 +74,12 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -85,6 +89,15 @@ END IF|
#
# Testing with explicit timezonefile
#
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
@@ -93,7 +106,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
@@ -105,21 +118,30 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone_leap_second;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=MyISAM;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
index 4ce57c641b3..aff02cb413e 100644
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
+++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
@@ -2,13 +2,14 @@
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
#
# Verbose run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -26,16 +27,18 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# Silent run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
+START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
@@ -50,12 +53,13 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
+COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
#
# Testing with explicit timezonefile
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
@@ -67,7 +71,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
#
# Testing --leap
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone_leap_second;
diff --git a/mysql-test/suite/wsrep/r/trans.result b/mysql-test/suite/wsrep/r/trans.result
index bc225897103..e0c0c9f7c88 100644
--- a/mysql-test/suite/wsrep/r/trans.result
+++ b/mysql-test/suite/wsrep/r/trans.result
@@ -6,4 +6,5 @@
#
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SAVEPOINT A;
+ERROR HY000: Got error 1 "Operation not permitted" from storage engine binlog
End of test.
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index 99e30788488..c9c0c5af9c5 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP: Initial position was provided by configuration or SST, avoiding override");
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
@@ -38,6 +39,7 @@ wsrep_commit_oooe #
wsrep_commit_oool #
wsrep_commit_window #
wsrep_connected #
+wsrep_debug_sync_waiters #
wsrep_flow_control_paused #
wsrep_flow_control_paused_ns #
wsrep_flow_control_recv #
@@ -85,9 +87,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
@@ -111,6 +110,9 @@ SELECT @@global.wsrep_slave_threads;
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
Threads_connected 1
@@ -124,6 +126,9 @@ libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
Threads_connected 1
@@ -135,14 +140,15 @@ wsrep_thread_count 0
# applier/rollbacker threads.
SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier thread to get created 1.
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-VARIABLE_VALUE
+# Wait for applier thread to get created 2.
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+EXPECT_2
2
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
@@ -150,6 +156,9 @@ libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
gcomm://
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
Threads_connected 1
@@ -160,14 +169,14 @@ wsrep_thread_count 2
SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads;
SET GLOBAL wsrep_slave_threads= 10;
# Wait for 9 applier threads to get created.
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
10
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+EXPECT_11
11
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
@@ -199,8 +208,4 @@ SELECT @@global.wsrep_sst_auth;
@@global.wsrep_sst_auth
NULL
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
-SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-SET GLOBAL wsrep_provider= none;
-SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
-SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
# End of test.
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.cnf b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
new file mode 100644
index 00000000000..d8e27463cc1
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
@@ -0,0 +1,12 @@
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
+
+[mysqld.1]
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.opt b/mysql-test/suite/wsrep/t/alter_table_innodb.opt
deleted file mode 100644
index 1e84570d7f6..00000000000
--- a/mysql-test/suite/wsrep/t/alter_table_innodb.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-on=0
diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt
index e3f2470c6e5..6504506e267 100644
--- a/mysql-test/suite/wsrep/t/binlog_format.opt
+++ b/mysql-test/suite/wsrep/t/binlog_format.opt
@@ -1 +1 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm://
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1
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..284c887648e
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_10186.cnf
@@ -0,0 +1,15 @@
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
+
+[mysqld.1]
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
+innodb_autoinc_lock_mode=2
+wsrep-provider=$WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
index e2655959c62..864f7342cc7 100644
--- a/mysql-test/suite/wsrep/t/mdev_10186.opt
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
@@ -1 +1,3 @@
---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=0
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW
+
+
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
index 100e09d3afb..87554635666 100644
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
@@ -1,6 +1,7 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
+--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
new file mode 100644
index 00000000000..864f7342cc7
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
@@ -0,0 +1,3 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW
+
+
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
index bb3009bd432..ab1f94cc1cf 100644
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
@@ -1,6 +1,7 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
+--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt
index 814417e5b0f..e75bba669e8 100644
--- a/mysql-test/suite/wsrep/t/pool_of_threads.opt
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt
@@ -1 +1 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads --wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/trans.test b/mysql-test/suite/wsrep/t/trans.test
index d8c4a4722a0..a7f595366b2 100644
--- a/mysql-test/suite/wsrep/t/trans.test
+++ b/mysql-test/suite/wsrep/t/trans.test
@@ -9,6 +9,7 @@
--echo #
START TRANSACTION WITH CONSISTENT SNAPSHOT;
+--error 1030
SAVEPOINT A;
--echo End of test.
diff --git a/mysql-test/suite/wsrep/t/variables.cnf b/mysql-test/suite/wsrep/t/variables.cnf
new file mode 100644
index 00000000000..b1c96d2614d
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+binlog-format=ROW
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index e01ba3e3a8b..2556d8ede4f 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -1,5 +1,9 @@
--source include/have_wsrep.inc
--source include/force_restart.inc
+--source include/have_innodb.inc
+--source include/galera_have_debug_sync.inc
+
+call mtr.add_suppression("WSREP: Initial position was provided by configuration or SST, avoiding override");
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
@@ -50,15 +54,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 #
@@ -84,6 +84,7 @@ eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_slave_threads;
SELECT @@global.wsrep_cluster_address;
+SELECT @@global.wsrep_on;
SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
--echo
@@ -95,6 +96,7 @@ eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
+SELECT @@global.wsrep_on;
SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
--echo
@@ -107,14 +109,18 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://';
--let $wait_timeout=600
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--source include/wait_condition.inc
+--echo # Wait for applier thread to get created 2.
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+--source include/wait_condition.inc
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
+SELECT @@global.wsrep_on;
SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
--echo
@@ -126,9 +132,9 @@ SET GLOBAL wsrep_slave_threads= 10;
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--source include/wait_condition.inc
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
SHOW STATUS LIKE 'threads_connected';
@@ -137,6 +143,7 @@ SHOW STATUS LIKE 'threads_connected';
#
set wsrep_on=0;
set wsrep_on=1;
+--source include/wait_until_connected_again.inc
create user test@localhost;
connect con1,localhost,test;
set auto_increment_increment=10;
@@ -159,10 +166,14 @@ SELECT @@global.wsrep_sst_auth;
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
# Reset (for mtr internal checks)
+--disable_query_log
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-SET GLOBAL wsrep_provider= none;
+eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
+--enable_query_log
+
+--source include/galera_wait_ready.inc
--echo # End of test.
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 0f685c470ad..2f1a40cbacd 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -2031,5 +2031,19 @@ SHOW CREATE TABLE t2;
DROP TABLE t2, t1;
--echo #
+--echo # MDEV-18163: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
+--echo # m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion
+--echo # `table_list->table' failed in find_field_in_table_ref / ERROR 1901
+--echo # (on optimized builds)
+--echo #
+
+
+CREATE TABLE t1 (k1 varchar(10) DEFAULT 5);
+CREATE TABLE t2 (i1 int);
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+ALTER TABLE t1 ALTER COLUMN k1 SET DEFAULT (SELECT 1 FROM t2 limit 1);
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/alter_user.test b/mysql-test/t/alter_user.test
index ca444f70a70..3a1052a98f6 100644
--- a/mysql-test/t/alter_user.test
+++ b/mysql-test/t/alter_user.test
@@ -41,7 +41,7 @@ SET GLOBAL read_only = @start_read_only;
--error ER_CANNOT_USER
alter user boo;
--echo #--warning ER_CANNOT_USER
-alter if exists user boo;
+alter user if exists boo;
--echo # Test password related altering.
alter user foo identified by 'something';
diff --git a/mysql-test/t/aria_icp_debug.test b/mysql-test/t/aria_icp_debug.test
new file mode 100644
index 00000000000..bbdd59d6012
--- /dev/null
+++ b/mysql-test/t/aria_icp_debug.test
@@ -0,0 +1,5 @@
+
+set default_storage_engine=aria;
+--source include/icp_debug_kill.inc
+set default_storage_engine=default;
+
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
index 7f394e0f846..c80ceffef4c 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/t/blackhole.test
@@ -38,3 +38,19 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
DROP TABLE t1;
--echo End of 5.6 tests
+
+#
+# MDEV-24017 / bug 53588 test case.
+#
+# Create long enough index (between 1000 and 3500). 1000 is the old value,
+# 3500 is innodb value (see ha_innobase::max_supported_key_length()). Without
+# the fix the test will fail with "Specified key was too long" error.
+#
+CREATE TABLE `t` (
+ `a` varchar(3000) NOT NULL default '',
+ PRIMARY KEY (`a`)
+) ENGINE=BLACKHOLE;
+
+DROP TABLE `t`;
+
+--echo End of 10.1 tests
diff --git a/mysql-test/t/bootstrap_innodb.test b/mysql-test/t/bootstrap_innodb.test
new file mode 100644
index 00000000000..ddaefb32155
--- /dev/null
+++ b/mysql-test/t/bootstrap_innodb.test
@@ -0,0 +1,27 @@
+source include/have_static_innodb.inc;
+source include/not_embedded.inc;
+
+let $datadir= `select @@datadir`;
+
+create table t1(a int) engine=innodb;
+source include/shutdown_mysqld.inc;
+
+write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
+use test;
+insert t1 values (1);
+start transaction;
+insert t1 values (2);
+savepoint s1;
+insert t1 values (3);
+savepoint s2;
+insert t1 values (4);
+rollback to savepoint s1;
+insert t1 values (5);
+commit;
+EOF
+exec $MYSQLD_BOOTSTRAP_CMD --datadir=$datadir --innodb < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1;
+remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
+
+source include/start_mysqld.inc;
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test
index c62f3c3c506..1af683c617b 100644
--- a/mysql-test/t/cache_temporal_4265.test
+++ b/mysql-test/t/cache_temporal_4265.test
@@ -5,9 +5,9 @@
create table t1 (a date);
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
-set debug_dbug='d,str_to_datetime_warn';
-select * from t1 where a > date_add('2000-01-01', interval 5 day);
-set debug_dbug='';
+
+SET STATEMENT debug_dbug='d,str_to_datetime_warn' for
+ select * from t1 where a > date_add('2000-01-01', interval 5 day);
drop table t1;
#
diff --git a/mysql-test/t/comment_table.test b/mysql-test/t/comment_table.test
index 2a85fbac571..db8bdf54ba6 100644
--- a/mysql-test/t/comment_table.test
+++ b/mysql-test/t/comment_table.test
@@ -1,6 +1,3 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
#1024 bytes
create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
@@ -53,3 +50,11 @@ create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INT
) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
+
+#
+# MDEV-22558 wrong error for invalid utf8 table comment
+#
+set names utf8;
+--error ER_INVALID_CHARACTER_STRING
+create table t1 (x int comment 'a');
+set names latin1;
diff --git a/mysql-test/t/connect_debug.test b/mysql-test/t/connect_debug.test
index 300a2de0fbd..169ba6e9fff 100644
--- a/mysql-test/t/connect_debug.test
+++ b/mysql-test/t/connect_debug.test
@@ -22,3 +22,18 @@ create user 'bad' identified by 'worse';
--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse 2>&1
set global debug_dbug=@old_dbug;
drop user bad;
+
+#
+# Bug#29630767 - USE OF UNINITIALIZED VALUE IN LIBMYSQL (CLIENT.CC FUNCTION RUN_PLUGIN_AUTH)
+#
+set global debug_dbug='+d,increase_srv_handshake_scramble_len';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $MASTER_MYPORT MASTER_MYPORT
+--error 2027
+connect con1,localhost,root;
+set global debug_dbug=@old_dbug;
+
+set global debug_dbug='+d,poison_srv_handshake_scramble_len';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $MASTER_MYPORT MASTER_MYPORT
+--error 2027
+connect con2,localhost,root;
+set global debug_dbug=@old_dbug;
diff --git a/mysql-test/t/create_drop_function.test b/mysql-test/t/create_drop_function.test
index e4d3d684cd5..3c4770e25e3 100644
--- a/mysql-test/t/create_drop_function.test
+++ b/mysql-test/t/create_drop_function.test
@@ -1,3 +1,5 @@
+source include/have_log_bin.inc;
+
SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');
CREATE FUNCTION f1(str char(20))
@@ -39,3 +41,25 @@ DROP FUNCTION IF EXISTS f1;
SELECT body FROM mysql.proc WHERE name like 'f1';
DROP FUNCTION IF EXISTS f1;
+--echo #
+--echo # 10.1 Test
+--echo #
+--echo # MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
+--echo #
+
+SET GLOBAL log_bin_trust_function_creators=0;
+
+CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;
+
+--error ER_BINLOG_UNSAFE_ROUTINE
+CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;
+
+--error ER_TOO_LONG_IDENT
+CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;
+
+DROP FUNCTION IF EXISTS f;
+
+SET GLOBAL log_bin_trust_function_creators=1;
+
+--echo # End of 10.1 Test
diff --git a/mysql-test/t/create_or_replace2.test b/mysql-test/t/create_or_replace2.test
index 199e5523811..80c8b635d8d 100644
--- a/mysql-test/t/create_or_replace2.test
+++ b/mysql-test/t/create_or_replace2.test
@@ -19,9 +19,9 @@ SET @old_debug= @@session.debug;
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
-set debug_dbug='+d,send_kill_after_delete';
+SET debug_dbug='+d,send_kill_after_delete';
CREATE OR REPLACE TABLE t1 LIKE tmp;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
SHOW TABLES;
show create table t1;
--sync_slave_with_master
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index bd8af55071a..41a5b815bc7 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -1182,3 +1182,23 @@ with t as (select 1 as t) select * from t;
with columns as (select 1 as t) select * from columns;
use test;
+
+--echo #
+--echo # MDEV-18460: Server crashed in strmake / tdc_create_key /
+--echo # THD::create_tmp_table_def_key
+--echo #
+
+--connect con1,localhost,root,,
+--change_user root,,
+
+CREATE TEMPORARY TABLE test.t (a INT);
+WITH cte AS (SELECT 1) SELECT * FROM cte;
+WITH t AS (SELECT 1) SELECT * FROM t;
+--error ER_NO_DB_ERROR
+WITH cte AS (SELECT 1) SELECT * FROM t;
+DROP TABLE test.t;
+
+--connection default
+--disconnect con1
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index 2c20e095130..d1904586ffe 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -2390,6 +2390,30 @@ select * from cte1, cte2 where cte1.c1 = 3;
eval $q3;
+let $q4=
+with recursive
+rcte(a) as
+(select 1 union select cast(a+1 as unsigned) from rcte where a < 10),
+cte1 as
+(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3),
+cte2 as
+(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7)
+select * from cte2, cte1;
+
+eval $q4;
+eval explain extended $q4;
+eval prepare stmt from "$q4";
+execute stmt;
+execute stmt;
+
+drop procedure p;
+drop table t2;
+
+create table t2 (c1 int, c2 int);
+eval create procedure p() insert into t2 $q4;
+call p();
+select * from t2;
+
drop procedure p;
drop table t1,t2;
@@ -2536,3 +2560,86 @@ with recursive cte as
select * from t1 as t;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-22042: ANALYZE of query using stored function and recursive CTE
+--echo #
+
+create table t1 (a1 varchar(20),a2 varchar(20)) engine=myisam;
+insert into t1 values (1,1),(2,2),(3,3);
+
+create table t2 (
+a2 varchar(20) primary key, b1 varchar(20), key (b1)
+) engine=myisam;
+insert into t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
+insert into t2 values (11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17);
+
+delimiter $$;
+create function f1(id varchar(20)) returns varchar(50)
+begin
+ declare res varchar (50);
+ select a2 into res from t2 where a2=id and b1=1 limit 1;
+ return res;
+end$$
+delimiter ;$$
+
+let q=
+select fv
+from (select t1.a1, f1(t1.a2) fv from t1) dt
+where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2'
+ union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2)
+select a2 from cte);
+
+eval $q;
+eval explain $q;
+--source include/analyze-format.inc
+eval analyze format=json $q;
+
+drop function f1;
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-22748: two materialized CTEs using the same recursive CTE
+--echo # (see also test case for MDEV-17024)
+--echo #
+
+CREATE TABLE t1 (YEAR int(4), d1 date , d2 date) ;
+INSERT INTO t1 VALUES (2018,'2018-01-01','2018-09-20');
+CREATE TABLE t2 (id int, tm date);
+INSERT INTO t2 VALUES (1,'2018-08-30'),(2,'2018-08-30'),(3,'2018-08-30');
+CREATE TABLE t3 (id int, tm date);
+INSERT INTO t3 VALUES (1,'2018-08-30'),(2,'2018-08-30');
+
+let $q=
+WITH RECURSIVE
+cte AS
+ (SELECT YEAR(t1.d1) AS YEAR, t1.d1 AS st, t1.d1 + INTERVAL 1 MONTH AS fn
+ FROM t1
+ UNION ALL
+ SELECT YEAR(cte.st + INTERVAL 1 MONTH),
+ cte.st + INTERVAL 1 MONTH, t1.d2 + INTERVAL 1 DAY
+ FROM cte JOIN t1
+ WHERE cte.st + INTERVAL 1 MONTH < t1.d2 ),
+cte2 AS (SELECT YEAR, COUNT(*)
+ FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn),
+cte3 AS (SELECT YEAR, COUNT(*)
+ FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn)
+SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR);
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+eval PREPARE stmt FROM "$q";
+EXECUTE stmt;
+EXECUTE stmt;
+
+CREATE TABLE t4 (YEAR int(4), d1 date , d2 date);
+eval CREATE PROCEDURE p() INSERT INTO t4 $q;
+CALL p();
+SELECT * FROM t4;
+
+DROP PROCEDURE p;
+DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/ctype_binary.test b/mysql-test/t/ctype_binary.test
index 155d8548f77..b871a41309b 100644
--- a/mysql-test/t/ctype_binary.test
+++ b/mysql-test/t/ctype_binary.test
@@ -74,6 +74,107 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+--echo #
+
+CREATE TABLE t1(a ENUM(0x6100,0x6200,0x6300) CHARACTER SET 'Binary');
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT HEX(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+--echo 0x00 in the middle or in the end of a value
+
+CREATE TABLE t1 (a ENUM(0x6100));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM(0x610062));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+--echo 0x00 in the beginning of the first value:
+
+CREATE TABLE t1 (a ENUM(0x0061));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(1);
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM(0x0061), b ENUM('b'));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1,1);
+SELECT HEX(a), HEX(b) FROM t1;
+DROP TABLE t1;
+
+--echo # 0x00 in the beginning of the second (and following) value of the *last* ENUM/SET in the table:
+
+CREATE TABLE t1 (a ENUM('a',0x0061));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1),(2);
+SELECT HEX(a) FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a ENUM('a'), b ENUM('b',0x0061));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (1,2);
+SELECT HEX(a), HEX(b) FROM t1 ORDER BY a, b;
+DROP TABLE t1;
+
+--echo 0x00 in the beginning of a value of a non-last ENUM/SET causes an error:
+--replace_regex /'.*t1.frm'/'DIR\/t1.frm'/
+--error ER_NOT_FORM_FILE
+CREATE TABLE t1 (a ENUM('a',0x0061), b ENUM('b'));
+
+
--echo #
--echo # End of 10.1 tests
--echo #
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+--echo # 10.2 tests
+--echo #
+
+SET NAMES latin1;
+CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary', d JSON);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(
+ c ENUM(0x0061) CHARACTER SET 'Binary',
+ d INT DEFAULT NULL CHECK (d>0)
+);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1,1);
+SELECT HEX(c), d FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary' CHECK (c>0));
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1);
+SELECT HEX(c) FROM t1;
+DROP TABLE t1;
+
+
+
+
+
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index 0e497b7b7bd..67442594bb5 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -723,7 +723,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;
SET max_sort_length=DEFAULT;
diff --git a/mysql-test/t/ctype_utf16_uca.test b/mysql-test/t/ctype_utf16_uca.test
index 46d572fbe81..93807232bab 100644
--- a/mysql-test/t/ctype_utf16_uca.test
+++ b/mysql-test/t/ctype_utf16_uca.test
@@ -244,5 +244,30 @@ SET NAMES utf8;
--echo #
+--echo # MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+--echo # 10.2 tests
+--echo #
+
+SET NAMES utf8, COLLATION_CONNECTION=utf16_hungarian_ci;
+CREATE TABLE t1(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON); # ERROR 1064 (42000): You have an error in your SQL syntax
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaa') CHARACTER SET 'Binary',d JSON); # ERROR 1033 (HY000): Incorrect information in file: './test/t.frm'
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON); # Sig 11
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c) VALUES (1);
+SELECT HEX(c) FROM t1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test
index b8728b52db2..204df136274 100644
--- a/mysql-test/t/ctype_utf16le.test
+++ b/mysql-test/t/ctype_utf16le.test
@@ -685,7 +685,7 @@ CREATE TABLE t1 AS SELECT REPEAT('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;
SET max_sort_length=DEFAULT;
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
index 2e739ebfdbc..891fd14d15f 100644
--- a/mysql-test/t/ctype_utf32.test
+++ b/mysql-test/t/ctype_utf32.test
@@ -779,7 +779,7 @@ CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
+SET max_sort_length=8;
SELECT * FROM t1 ORDER BY s1;
DROP TABLE t1;
SET max_sort_length=DEFAULT;
@@ -1035,6 +1035,19 @@ let $coll='utf32_nopad_bin';
let $coll_pad='utf32_bin';
--source include/ctype_pad_all_engines.inc
+
+--echo #
+--echo # MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
+--echo # 10.2 tests
+--echo #
+
+SET NAMES utf8, COLLATION_CONNECTION=utf32_bin;
+CREATE TABLE t1(c1 ENUM('a','b','ac') CHARACTER SET 'Binary',c2 JSON,c3 INT);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c1) VALUES (1),(2),(3);
+SELECT HEX(c1) FROM t1 ORDER BY c1;
+DROP TABLE t1;
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 3e82f74a38a..9a64821db66 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1767,7 +1767,7 @@ set @@collation_connection=utf8_bin;
--echo #
--echo # Checking strnxfrm() with odd length
--echo #
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
create table t1 (a varchar(128) character set utf8 collate utf8_general_ci);
insert into t1 values ('a'),('b'),('c');
@@ -2051,6 +2051,18 @@ SELECT CONVERT(1, CHAR) IN ('100', 10, '101');
SELECT CONVERT(1, CHAR) IN ('100', 10, '1');
SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
+--echo #
+--echo # MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
+--echo #
+
+SET NAMES utf8;
+CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('2019-03-10 02:55:05');
+CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM;
+INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
+SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
+DROP TABLE t1, t2;
+
--echo #
--echo # End of 10.1 tests
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 88fb3d23b62..532729dafde 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -1520,7 +1520,7 @@ drop table t1;
--echo #
--echo # Check strnxfrm() with odd length
--echo #
-set max_sort_length=5;
+set max_sort_length=9;
select @@max_sort_length;
create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci);
insert into t1 values ('a'),('b'),('c');
diff --git a/mysql-test/t/default_session.test b/mysql-test/t/default_session.test
index 7796354ffd4..5e582bd5ca1 100644
--- a/mysql-test/t/default_session.test
+++ b/mysql-test/t/default_session.test
@@ -80,3 +80,27 @@ insert t1 () values ();
set sql_mode=default;
select * from t1;
drop table t1;
+
+#
+# MDEV-21249 MariaDB 10.3.10 When referring to bigint to generate timestamp data in the virtual generated column, the value of the generated column does not change when the time zone changes
+#
+set time_zone='+00:00';
+create table t1 (a int, b datetime default from_unixtime(a), c datetime);
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+set time_zone='+01:00';
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+flush tables;
+insert t1 (a, c) values (1569495327, from_unixtime(1569495327));
+select * from t1;
+drop table t1;
+
+# same with vcols
+set time_zone = "+00:00";
+create table t1 (a int, b timestamp as (from_unixtime(a)) virtual);
+insert into t1 (a) value (1569495327);
+select a, b, from_unixtime(a) from t1;
+set time_zone = "+01:00";
+select a, b, from_unixtime(a) from t1;
+flush tables;
+select a, b, from_unixtime(a) from t1;
+drop table t1;
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index c9c8fb21ac7..a7df65f2951 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -2140,4 +2140,48 @@ SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt;
DROP TABLE t1;
DROP VIEW v1;
+--echo #
+--echo # MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+--echo #
+
+CREATE TABLE t1 (a INT, b DATE, c INT);
+INSERT INTO t1 VALUES
+ (1,'2001-01-21',345),
+ (6,'2001-01-20',315),
+ (6,'2001-01-20',214);
+
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (2,19), (7,20);
+CREATE VIEW v1 AS SELECT a, b, max(c) AS max_c FROM t1
+ GROUP BY a,b HAVING max_c < 707;
+
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a);
+
+SET optimizer_switch='condition_pushdown_for_derived=off';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+
+SET optimizer_switch='condition_pushdown_for_derived=on';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
+SET optimizer_switch=DEFAULT;
+
+
+
+--echo #
+--echo # MDEV-17177: an attempt to push down IN predicate when one of
+--echo # the arguments is too complex to be cloned
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(8));
+INSERT INTO t1 VALUES ('abc'),('def');
+CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a;
+
+SELECT * FROM v1 WHERE IF( a REGEXP 'def', 'foo', a ) IN ('abc', 'foobar');
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo # End of 10.2 tests
diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test
index 6a3ac6ae00f..ebc732104d3 100644
--- a/mysql-test/t/drop_bad_db_type.test
+++ b/mysql-test/t/drop_bad_db_type.test
@@ -7,8 +7,8 @@ if (!$HA_ARCHIVE_SO) {
let $mysqld_datadir= `select @@datadir`;
-SET @save_dbug = @@debug_dbug;
-set debug_dbug='+d,unstable_db_type';
+SET @saved_dbug = @@debug_dbug;
+SET debug_dbug='+d,unstable_db_type';
install soname 'ha_archive';
create table t1 (a int) engine=archive;
@@ -28,4 +28,4 @@ drop table t1;
--list_files $mysqld_datadir/test
uninstall soname 'ha_archive';
-set debug_dbug=@save_dbug;
+SET debug_dbug=@saved_dbug;
diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test
index b15e9d82eb8..5c5140be2e0 100644
--- a/mysql-test/t/empty_server_name-8224.test
+++ b/mysql-test/t/empty_server_name-8224.test
@@ -4,7 +4,7 @@
--source include/not_embedded.inc
create server '' foreign data wrapper w2 options (host '127.0.0.1');
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
diff --git a/mysql-test/t/engine_error_in_alter-8453.test b/mysql-test/t/engine_error_in_alter-8453.test
index c4600ec07fe..78e6de2d645 100644
--- a/mysql-test/t/engine_error_in_alter-8453.test
+++ b/mysql-test/t/engine_error_in_alter-8453.test
@@ -4,8 +4,9 @@
--source include/have_debug.inc
create table t1 (a int, b int);
-set debug_dbug='+d,external_lock_failure';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,external_lock_failure';
--error ER_GET_ERRMSG
alter table t1 add column c int;
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
drop table t1;
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 1debed871c7..f713e2da6ba 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -21,6 +21,7 @@ set tmp_table_size=1024;
# Set debug flag so an error is returned when
# tmp table in query is converted from heap to myisam
+SET @saved_dbug = @@SESSION.debug_dbug;
set session debug_dbug="+d,raise_error";
--error ER_DUP_KEY
@@ -36,7 +37,7 @@ CREATE TABLE t1 (a INT(100) NOT NULL);
INSERT INTO t1 VALUES (1), (0), (2);
SET SESSION debug_dbug='+d,alter_table_only_index_change';
ALTER TABLE t1 ADD INDEX a(a);
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
@@ -51,7 +52,7 @@ SET SESSION debug_dbug="+d,bug42064_simulate_oom";
# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
--error ER_OUT_OF_RESOURCES, 5
INSERT INTO t1 VALUES("");
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
DROP TABLE t1;
@@ -84,7 +85,7 @@ EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
-SET SESSION debug_dbug= DEFAULT;
+SET debug_dbug= @saved_dbug;
SET optimizer_switch=@save_optimizer_switch;
@@ -101,7 +102,7 @@ INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error";
--error ER_QUERY_INTERRUPTED
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
-SET SESSION debug_dbug = DEFAULT;
+SET debug_dbug= @saved_dbug;
DROP TABLE t1,t2;
@@ -156,4 +157,4 @@ SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
--error ER_OUT_OF_RESOURCES, 5
SELECT f1(1);
DROP FUNCTION f1;
-SET SESSION debug_dbug=DEFAULT;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index 55461002fd4..72d432a2edc 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -203,6 +203,8 @@ drop table t1;
#
# errors caused by max_session_mem_used
#
+set @max_session_mem_used_save= @@max_session_mem_used;
+
--disable_result_log
set max_session_mem_used = 50000;
--error 0,ER_OPTION_PREVENTS_STATEMENT
@@ -213,3 +215,22 @@ select * from seq_1_to_1000;
--enable_result_log
# We may not be able to execute any more queries with this connection
# because of too little memory#
+
+set max_session_mem_used = @max_session_mem_used_save;
+
+--echo #
+--echo # MDEV-20604: Duplicate key value is silently truncated to 64
+--echo # characters in print_keydup_error
+--echo #
+
+create table t1 (a varchar(100), UNIQUE KEY akey (a));
+
+insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
+--echo # The value in the error message should show truncation with "..."
+--error ER_DUP_ENTRY
+insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
+
+drop table t1;
+
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index a0f3c5991ef..ab45446667e 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -1029,7 +1029,7 @@ SET GLOBAL READ_ONLY = 1;
--echo
--error ER_OPTION_PREVENTS_STATEMENT
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
+CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1;
--echo
@@ -1049,7 +1049,7 @@ DROP EVENT e1;
--echo
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
+CREATE EVENT e1 ON SCHEDULE AT '2038-01-01 00:00:00' DO SET @a = 1;
--echo
diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test
index ca674170e96..f56bd32b71d 100644
--- a/mysql-test/t/events_restart.test
+++ b/mysql-test/t/events_restart.test
@@ -141,3 +141,34 @@ SHOW EVENTS;
DROP EVENT e1;
--echo # end test for bug#11748899
+
+--echo #
+--echo # Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
+--echo #
+
+create event ev on schedule every 1 minute do set @a= 1;
+select name, originator, status from mysql.event;
+
+--let $server_id= `SELECT @@global.server_id`
+
+--echo #
+--echo # Restarting server with server_id=100
+--echo #
+--let $restart_parameters= --server-id=100
+--source include/restart_mysqld.inc
+
+select @@global.server_id;
+select name, originator, status from mysql.event;
+--eval set global server_id= $server_id
+
+--echo #
+--echo # Restarting server with the original server_id=$server_id
+--echo #
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+select @@global.server_id;
+select name, originator, status from mysql.event;
+
+# Cleanup
+drop event ev;
diff --git a/mysql-test/t/fast_prefix_index_fetch_innodb.test b/mysql-test/t/fast_prefix_index_fetch_innodb.test
index c3b3440d82d..1987416ff87 100644
--- a/mysql-test/t/fast_prefix_index_fetch_innodb.test
+++ b/mysql-test/t/fast_prefix_index_fetch_innodb.test
@@ -1,9 +1,6 @@
-- source include/have_innodb.inc
---disable_warnings
-drop table if exists prefixinno;
---enable_warnings
-
+SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
@@ -665,4 +662,58 @@ select @cluster_lookups;
select @cluster_lookups_avoided;
DROP TABLE t1;
-set global innodb_prefix_index_cluster_optimization = OFF;
+
+--echo #
+--echo # MDEV-20464 Division by 0 in row_search_with_covering_prefix()
+--echo #
+CREATE TABLE t1 (f1 INT, f2 INT AS (f1), f3 INT AS (f1), f4 INT AS (f1),
+ KEY (f1,f2,f3)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (NULL),(0);
+SELECT f1, MAX(f3), COUNT(f4) FROM t1 GROUP BY f1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-23600 Division by 0 in row_search_with_covering_prefix()
+--echo #
+CREATE TABLE t(c POINT UNIQUE) ENGINE=InnoDB;
+INSERT t SET c=POINT(1,1);
+SELECT * FROM t WHERE c > (SELECT MAX(c) FROM t);
+DROP TABLE t;
+
+--echo #
+--echo # MDEV-12486 Wrong results with innodb_prefix_index_cluster_optimization
+--echo #
+CREATE TABLE wp_blogs (
+ blog_id bigint(20) NOT NULL auto_increment,
+ site_id bigint(20) NOT NULL default '0',
+ domain varchar(200) NOT NULL default '',
+ path varchar(100) NOT NULL default '',
+ registered datetime NOT NULL default '0000-00-00 00:00:00',
+ last_updated datetime NOT NULL default '0000-00-00 00:00:00',
+ public tinyint(2) NOT NULL default '1',
+ archived tinyint(2) NOT NULL default '0',
+ mature tinyint(2) NOT NULL default '0',
+ spam tinyint(2) NOT NULL default '0',
+ deleted tinyint(2) NOT NULL default '0',
+ lang_id int(11) NOT NULL default '0',
+ PRIMARY KEY (blog_id),
+ KEY domain (domain(50),path(5)),
+ KEY lang_id (lang_id)
+) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+INSERT INTO wp_blogs (domain, path) VALUES
+('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'),
+('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
+('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
+
+SET GLOBAL innodb_prefix_index_cluster_optimization=off;
+SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
+AND path IN ( '/fondsinvesteringer/', '/' );
+
+SET GLOBAL innodb_prefix_index_cluster_optimization=on;
+SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
+AND path IN ( '/fondsinvesteringer/', '/' );
+
+DROP TABLE wp_blogs;
+
+SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
index 17c93332cb3..3a09a544532 100644
--- a/mysql-test/t/foreign_key.test
+++ b/mysql-test/t/foreign_key.test
@@ -117,4 +117,28 @@ alter table t_34455
drop table t_34455;
+--echo #
+--echo # MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
+--echo #
+
+CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
+--error ER_DUP_CONSTRAINT_NAME
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
+
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
+--error ER_DUP_CONSTRAINT_NAME
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+DROP TABLE tfk;
+
+CREATE TABLE tfk (c1 INT, c2 INT,
+ CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
+show create table tfk;
+--error ER_DUP_CONSTRAINT_NAME
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+--error ER_DUP_KEYNAME
+ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
+DROP TABLE tfk;
+
+DROP TABLE tpk;
+
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 2e53ce7f112..d52f13ab978 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -716,3 +716,17 @@ CREATE TABLE t1 (
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22275 (Memory leak)
+--echo #
+
+CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=MyISAM;
+ALTER TABLE tmp ADD FULLTEXT (a);
+INSERT INTO tmp VALUES ('foo');
+DROP TABLE tmp;
+
+CREATE TEMPORARY TABLE tmp (a TEXT) ENGINE=Aria;
+ALTER TABLE tmp ADD FULLTEXT (a);
+INSERT INTO tmp VALUES ('foo');
+DROP TABLE tmp;
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index 2eaaf218e5e..805e9954b81 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -531,6 +531,7 @@ DROP TABLE merge_t;
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '{"c":"d"}');
SELECT JSON_MERGE_PATCH(NULL, '[1,2,3]');
+SELECT JSON_MERGE_PATCH(NULL, 'a');
SELECT JSON_MERGE_PATCH('{"a":"b"}', NULL, '[1,2,3]', '{"c":null,"d":"e"}');
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
@@ -541,5 +542,18 @@ SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
--echo #
+--echo # MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
+--echo #
+
+SELECT
+ CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
+ CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
+
+SELECT
+ CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
+ CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 04fee6fb66b..8dfec3063f4 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -689,6 +689,94 @@ SELECT STDDEV_SAMP(a) FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-21977 main.func_math fails due to undefined behaviour
+--echo #
+
+SELECT 9223372036854775808 DIV 1;
+--error ER_DATA_OUT_OF_RANGE
+SELECT 9223372036854775808 DIV -1;
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9223372036854775808 DIV 1;
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9223372036854775808 DIV -1;
+
+SELECT 9223372036854775808 MOD 1;
+SELECT 9223372036854775808 MOD -1;
+SELECT -9223372036854775808 MOD 1;
+SELECT -9223372036854775808 MOD -1;
+
+SELECT 1 MOD 9223372036854775808;
+SELECT -1 MOD 9223372036854775808;
+SELECT 1 MOD -9223372036854775808;
+SELECT -1 MOD -9223372036854775808;
+
+SELECT 9223372036854775808 MOD 9223372036854775808;
+SELECT 9223372036854775808 MOD -9223372036854775808;
+SELECT -9223372036854775808 MOD 9223372036854775808;
+SELECT -9223372036854775808 MOD -9223372036854775808;
+
+--echo #
+--echo # MDEV-22502 MDB crashes in CREATE TABLE AS SELECT when the precision of returning type = 0
+--echo #
+
+CREATE TABLE t1 (d decimal(5,5));
+INSERT INTO t1 VALUES (0.55555);
+SELECT TRUNCATE(d,0) FROM t1;
+CREATE TABLE t2 AS SELECT TRUNCATE(d,0) FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # MDEV-22503 MDB limits DECIMAL column precision to 16 doing CTAS with floor/ceil over DECIMAL(X,Y) where X > 16
+--echo #
+
+CREATE TABLE t44 (d1 decimal(38,0) DEFAULT NULL);
+INSERT INTO t44 VALUES (12345678901234567890123456789012345678);
+SELECT FLOOR(d1) FROM t44;
+CREATE TABLE t45 AS SELECT FLOOR(d1) FROM t44;
+SELECT * FROM t45;
+SHOW CREATE TABLE t45;
+DROP TABLE t44, t45;
+
+
+DELIMITER $$;
+CREATE PROCEDURE p1(prec INT, scale INT)
+BEGIN
+ DECLARE maxval VARCHAR(128) DEFAULT '';
+ SET @type= CONCAT('DECIMAL(', prec, ',', scale,')');
+ SET @stmt= CONCAT('CREATE TABLE t1 (a ', @type, ',b ', @type, 'unsigned)');
+ PREPARE stmt FROM @stmt;
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+ SET maxval= CONCAT(REPEAT('9', prec-scale), '.', REPEAT('9',scale));
+ INSERT INTO t1 VALUES (maxval, maxval);
+ CREATE TABLE t2 AS SELECT a, b, FLOOR(a) AS fa, FLOOR(b) AS fb FROM t1;
+ SHOW CREATE TABLE t2;
+ SELECT * FROM t2;
+ DROP TABLE t1, t2;
+END;
+$$
+CREATE PROCEDURE p2(prec INT)
+BEGIN
+ DECLARE scale INT DEFAULT 0;
+ WHILE scale < prec AND scale <= 30 DO
+ CALL p1(prec, scale);
+ SET scale= scale + 1;
+ END WHILE;
+END;
+$$
+DELIMITER ;$$
+--vertical_results
+CALL p2(38);
+CALL p2(30);
+--horizontal_results
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
+
+
+--echo #
--echo # End of 10.1 tests
--echo #
@@ -704,8 +792,3 @@ select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
--echo #
select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678');
-
-#
-# MDEV-13673 Bad result in view
-#
-explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index cdbbe708153..75ff47aa24c 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -1139,6 +1139,21 @@ PREPARE stmt FROM "SELECT 'x' ORDER BY NAME_CONST( 'f', 'foo' )";
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
+--echo #
+--echo # MDEV-19680: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) ||
+--echo # (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))'
+--echo # or alike failed upon SELECT with mix of functions from simple view
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT ISNULL( BENCHMARK(1, MIN(a))) FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo #
--echo # Start of 10.2 tests
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index 21600390bb2..de0fe94b7c1 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -438,19 +438,19 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,
#
SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
--replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+SELECT CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
--replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
--replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
--replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
#
# MDEV-12942 REGEXP_INSTR returns 1 when using brackets
diff --git a/mysql-test/t/func_regexp_pcre_debug.test b/mysql-test/t/func_regexp_pcre_debug.test
index c2581fa4110..cbf5c4a17ee 100644
--- a/mysql-test/t/func_regexp_pcre_debug.test
+++ b/mysql-test/t/func_regexp_pcre_debug.test
@@ -1,6 +1,5 @@
--source include/have_debug.inc
-SET debug_dbug='+d,pcre_exec_error_123';
+SET STATEMENT debug_dbug='+d,pcre_exec_error_123' for
SELECT 'a' RLIKE 'a';
-SET debug_dbug='';
SELECT 'a' RLIKE 'a';
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index d1c0702da80..570fd0ae87a 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -36,14 +36,6 @@ explain extended select - a from t1;
drop table t1;
#
-# Wrong usage of functions
-#
-
-select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
-select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
-select 1 and 0 or 2, 2 or 1 and 0;
-
-#
# Coercibility
#
select _koi8r'a' = _koi8r'A';
@@ -142,15 +134,6 @@ select mod(NULL, 2.0) as 'NULL';
#
-# Bug#6726: NOT BETWEEN parse failure
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2), (2,3), (3,4), (4,5);
-select * from t1 where a not between 1 and 2;
-select * from t1 where a not between 1 and 2 and b not between 3 and 4;
-drop table t1;
-
-#
# Test for bug #12791: one of the arguments of LEAST/GREATEST is NULL
#
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 6c5b1cab95f..22729b4300b 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1970,5 +1970,13 @@ DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
--echo #
+--echo # MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+--echo #
+
+SELECT DAYNAME('2019-01-05')+0;
+SELECT CAST(DAYNAME('2019-01-05') AS SIGNED);
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index f1c30cba9fe..3df005068f0 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -964,10 +964,10 @@ INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0.5 0.5)'), l);
DROP TABLE t1;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index f630a6dc8bf..d1dff584c8f 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -1806,5 +1806,13 @@ drop table t1;
SET timestamp=default;
--echo #
+--echo # MDEV-21056 Memory leak after query with DEFAULT on a geometry field
+--echo #
+
+CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
+SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index f54c4bd981d..fa3a690a2ee 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -2233,6 +2233,18 @@ set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc
--echo #
+--echo # MDEV-22755 CREATE USER leads to indirect SIGABRT in __stack_chk_fail () from fill_schema_user_privileges + *** stack smashing detected *** (on optimized builds)
+--echo #
+
+SET NAMES utf8;
+SET SQL_MODE='';
+CREATE USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
+SELECT * FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE "'abcdefghijklmnopqrstuvwxyz'%";
+SELECT GRANTEE FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE '%觻%';
+DROP USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
+SET SQL_MODE=DEFAULT;
+
+--echo #
--echo # Start of 10.2 tests
--echo #
@@ -2256,5 +2268,30 @@ DROP TABLE t1;
DROP USER dummy@localhost;
--echo #
+--echo # MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated, and
+--echo # inaccurately
+--echo #
+
+CREATE USER foo;
+CREATE DATABASE db;
+CREATE TABLE db.t (a INT);
+
+--connect (con1,localhost,foo,,)
+
+--error ER_TABLEACCESS_DENIED_ERROR
+GRANT ALL ON db.t TO foo;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES,
+INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON db.t TO foo;
+
+--connection default
+--disconnect con1
+
+DROP USER foo;
+DROP TABLE db.t;
+DROP DATABASE db;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/grant5.test b/mysql-test/t/grant5.test
index 649bba7d1ca..944918e63ec 100644
--- a/mysql-test/t/grant5.test
+++ b/mysql-test/t/grant5.test
@@ -20,6 +20,7 @@ show grants for foo; # role
--error ER_DBACCESS_DENIED_ERROR
show grants for foo@'%'; # user
--connection default
+--disconnect conn_1
drop user test, foo;
drop role foo;
@@ -33,3 +34,42 @@ REVOKE EXECUTE ON PROCEDURE sp FROM u;
--error ER_TABLE_NOT_LOCKED
REVOKE PROCESS ON *.* FROM u;
DROP TABLE t1;
+
+#
+# MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user
+#
+create database mysqltest1;
+use mysqltest1;
+create table t1(id int);
+insert t1 values(2);
+create user u1@localhost;
+grant select on mysqltest1.t1 to u1@localhost;
+grant update on mysqltest1.* to u1@localhost;
+connect u1, localhost, u1;
+update mysqltest1.t1 set id=1 where id=2;
+connection default;
+disconnect u1;
+drop user u1@localhost;
+drop database mysqltest1;
+
+#
+# MDEV-22313: Neither SHOW CREATE USER nor SHOW GRANTS prints a user's default role
+#
+CREATE ROLE test_role;
+CREATE USER test_user;
+GRANT test_role TO test_user;
+SET DEFAULT ROLE test_role FOR test_user;
+SHOW GRANTS FOR test_user;
+SET DEFAULT ROLE NONE for test_user;
+SHOW GRANTS FOR test_user;
+SET ROLE test_role;
+SET DEFAULT ROLE test_role;
+SHOW GRANTS;
+SET DEFAULT ROLE NONE;
+SHOW GRANTS;
+DROP USER test_user;
+DROP ROLE test_role;
+
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 78a319f8f84..324b41ce23c 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1946,6 +1946,20 @@ SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 );
drop table t1;
--echo #
+--echo # MDEV-20922: Adding an order by changes the query results
+--echo #
+
+CREATE TABLE t1(a int, b int);
+INSERT INTO t1 values (1, 100), (2, 200), (3, 100), (4, 200), (5, 200);
+
+create view v1 as select a, b+1 as x from t1;
+
+SELECT x, COUNT(DISTINCT a) AS y FROM v1 GROUP BY x ORDER BY y;
+SELECT b+1 AS x, COUNT(DISTINCT a) AS y FROM t1 GROUP BY x ORDER BY y;
+
+drop view v1;
+drop table t1;
+--echo #
--echo # MDEV-10694 - SIGFPE and/or huge memory allocation in maria_create with distinct/group by/ rollup
--echo #
create table t1 (a int,b int) ;
@@ -1965,3 +1979,20 @@ GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAV
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-22019: Sig 11 in next_breadth_first_tab | max_sort_length setting + double
+--echo # GROUP BY leads to crash
+--echo #
+
+
+CALL mtr.add_suppression("Out of sort memory");
+CALL mtr.add_suppression("Sort aborted");
+SET @save_max_sort_length= @@max_sort_length;
+SET max_sort_length=2000000;
+--error ER_OUT_OF_SORTMEMORY
+SELECT * FROM information_schema.tables t JOIN information_schema.columns c
+ON t.table_schema=c.table_schema
+WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type)
+GROUP BY t.table_name;
+SET max_sort_length= @save_max_sort_length;
diff --git a/mysql-test/t/host_cache_size_functionality.test b/mysql-test/t/host_cache_size_functionality.test
index db4f64fd493..9ec26010ab6 100644
--- a/mysql-test/t/host_cache_size_functionality.test
+++ b/mysql-test/t/host_cache_size_functionality.test
@@ -44,7 +44,7 @@ select @@global.Host_Cache_Size > 0;
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
@@ -143,7 +143,7 @@ SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
#let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
#--exec echo "wait" > $restart_file
-#--shutdown_server 10
+#--shutdown_server
#--source include/wait_until_disconnected.inc
#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#-- enable_reconnect
diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test
index d3eb237ae38..2713daff034 100644
--- a/mysql-test/t/index_merge_innodb.test
+++ b/mysql-test/t/index_merge_innodb.test
@@ -199,4 +199,27 @@ SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 819
drop table t1;
set optimizer_switch=@tmp_optimizer_switch;
+--echo #
+--echo # MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect
+--echo # on optimized builds
+--echo #
+
+SET @save_sort_buffer_size=@@sort_buffer_size;
+SET @save_innodb_file_format= @@innodb_file_format;
+SET @save_innodb_large_prefix= @@innodb_large_prefix;
+SET sort_buffer_size=2048;
+
+CREATE TABLE t1 (
+ a VARCHAR(1024) CHARACTER SET UTF8 PRIMARY KEY,
+ b INT,
+ c INT,
+ INDEX (b)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_100;
+EXPLAIN SELECT * FROM t1 WHERE a='1' OR b < 5;
+SELECT * FROM t1 WHERE a='1' OR b < 5;
+DROP TABLE t1;
+
+SET sort_buffer_size= @save_sort_buffer_size;
+
disconnect disable_purge;
diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test
index 2cee768706b..b2216bf9485 100644
--- a/mysql-test/t/index_merge_myisam.test
+++ b/mysql-test/t/index_merge_myisam.test
@@ -244,6 +244,55 @@ DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save;
--echo #
+--echo # MDEV-21932: ROR union with index_merge_sort_union=off
+--echo #
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+insert into t0 select a+10 from t0;
+insert into t0 select a+20 from t0;
+insert into t0 select a+40 from t0;
+insert into t0 select a+80 from t0;
+insert into t0 select a+160 from t0;
+delete from t0 where a > 300;
+
+create table t1 (
+ f1 int, f2 int, f3 int, f4 int,
+ primary key (f1), key (f3), key(f4)
+) engine=myisam;
+insert into t1 select a+100, a+100, a+100, a+100 from t0;
+insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL);
+analyze table t1;
+
+set optimizer_switch='index_merge_sort_union=off';
+set optimizer_switch='index_merge_union=on';
+
+let $q1=
+select * from t1
+ where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+ (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+eval explain $q1;
+eval $q1;
+
+insert into t1 values (52,0,1,0),(53,0,1,0);
+insert into t1 values (50,0,1,0),(51,0,1,0);
+insert into t1 values (48,0,1,0),(49,0,1,0);
+insert into t1 values (46,0,1,0),(47,0,1,0);
+insert into t1 values (44,0,1,0),(45,0,1,0);
+analyze table t1;
+
+let $q2=
+select * from t1
+ where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
+ (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
+eval explain $q2;
+eval $q2;
+
+drop table t0,t1;
+
+set optimizer_switch= @optimizer_switch_save;
+
+--echo #
--echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
--echo #
@@ -270,3 +319,5 @@ explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
set @@optimizer_switch= @optimizer_switch_save;
drop table t0;
+
+--echo # End of 10.1 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 20654a95717..df00ff26908 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1894,3 +1894,28 @@ SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (t
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
DROP TABLE tt1, tt2;
+
+--echo #
+--echo # MDEV-13242 Wrong results for queries with row constructors and information_schema
+--echo #
+
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a',193);
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
+--echo # Start of 10.2 Test
+--echo #
+--echo # MDEV-14836: Assertion `m_status == DA_ERROR' failed in
+--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
+--echo #
+
+SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
+
+--echo #
+--echo # End of 10.2 Test
+--echo #
diff --git a/mysql-test/t/init_file_set_password-7656.test b/mysql-test/t/init_file_set_password-7656.test
index ecee3924355..b3c785a28d9 100644
--- a/mysql-test/t/init_file_set_password-7656.test
+++ b/mysql-test/t/init_file_set_password-7656.test
@@ -15,7 +15,7 @@ EOF
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
diff --git a/mysql-test/t/innodb_ext_key.combinations b/mysql-test/t/innodb_ext_key.combinations
new file mode 100644
index 00000000000..6ad97eaf75b
--- /dev/null
+++ b/mysql-test/t/innodb_ext_key.combinations
@@ -0,0 +1,5 @@
+[on]
+optimizer_switch=extended_keys=on
+
+[off]
+optimizer_switch=extended_keys=off
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 8def57ad377..f5edd736490 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -1,9 +1,4 @@
---source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
+--source include/innodb_prefix_index_cluster_optimization.inc
SET SESSION STORAGE_ENGINE='InnoDB';
@@ -19,32 +14,12 @@ use dbt3_s001;
--enable_result_log
--enable_query_log
-set @save_ext_key_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
@@ -53,16 +28,6 @@ select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
show status like 'handler_read%';
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-flush status;
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
@@ -71,16 +36,6 @@ select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -89,21 +44,12 @@ select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
flush status;
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-flush status;
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -112,25 +58,6 @@ select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-flush status;
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@@ -139,7 +66,6 @@ select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -152,20 +78,6 @@ select l_orderkey, l_linenumber
or l_receiptdate='1992-07-01' and l_orderkey=5603;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -178,20 +90,6 @@ select l_orderkey, l_linenumber
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
@@ -202,28 +100,6 @@ select l_orderkey, l_linenumber from lineitem
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
@@ -233,17 +109,6 @@ select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
show status like 'handler_read%';
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
@@ -255,23 +120,6 @@ show status like 'handler_read%';
create index i_p_retailprice on part(p_retailprice);
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-flush status;
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select o_orderkey, p_partkey
@@ -296,8 +144,6 @@ create table t0 (a int);
insert into t0 values (1), (2), (3), (4), (5);
create index i_p_size on part(p_size);
-set optimizer_switch='extended_keys=on';
-
explain
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
@@ -320,7 +166,6 @@ use test;
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
-SET optimizer_switch='extended_keys=on';
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,2);
@@ -339,10 +184,7 @@ set optimizer_switch=@save_optimizer_switch;
--echo # (valgrinf complains fixed by the patch for bug #914560)
--echo #
-set @save_optimizer_switch=@@optimizer_switch;
-
SET optimizer_switch = 'derived_with_keys=on';
-SET optimizer_switch = 'extended_keys=on';
CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('j'), ('v');
@@ -382,24 +224,12 @@ INSERT INTO t2 VALUES
(10), (11), (12), (13), (14),
(15), (16), (17), (18), (19), (24);
-set @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch = 'extended_keys=off';
-EXPLAIN
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-
-SET optimizer_switch = 'extended_keys=on';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-set optimizer_switch=@save_optimizer_switch;
-
DROP TABLE t1,t2;
--echo #
@@ -413,13 +243,11 @@ CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
-set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
-SET optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 WHERE b=a;
@@ -448,24 +276,11 @@ KEY c4 (c4)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-set @save_optimizer_switch=@@optimizer_switch;
-
-set session optimizer_switch='extended_keys=off';
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-
-DELETE FROM t1;
-
-set session optimizer_switch='extended_keys=on';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-set optimizer_switch=@save_optimizer_switch;
-
DROP TABLE t1;
--echo #
@@ -474,8 +289,6 @@ DROP TABLE t1;
--echo # (performance regression introduced in the patch for mdev-3851)
--echo #
-set @save_optimizer_switch=@@optimizer_switch;
-
create table t1 (a int not null) engine=innodb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -489,14 +302,6 @@ select
A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
from t1 A, t1 B;
-set optimizer_switch='extended_keys=off';
-explain
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-flush status;
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
flush status;
@@ -522,15 +327,6 @@ alter table t3 add primary key (pk1, pk2);
alter table t3 add key (col1, col2);
analyze table t1,t3;
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
-
-set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
@@ -544,8 +340,6 @@ drop table t1,t2,t3;
--echo # Bug mdev-4340: performance regression with extended_keys=on
--echo #
-set @save_optimizer_switch=@@optimizer_switch;
-
CREATE TABLE t1 (
page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
page_namespace int(11) NOT NULL DEFAULT '0',
@@ -649,13 +443,6 @@ INSERT INTO t3 VALUES
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
-set optimizer_switch='extended_keys=off';
-EXPLAIN
-SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
- WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
-ORDER BY rev_timestamp ASC LIMIT 10;
-
-set optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
@@ -674,14 +461,10 @@ create table t2 (a bigint not null unique auto_increment, b varchar(10), primary
insert into t1 (b) values (null), (null), (null);
insert into t2 (b) values (null), (null), (null);
-set optimizer_switch='extended_keys=on';
explain select a from t1 where b is null order by a desc limit 2;
select a from t1 where b is null order by a desc limit 2;
explain select a from t2 where b is null order by a desc limit 2;
select a from t2 where b is null order by a desc limit 2;
-set optimizer_switch='extended_keys=off';
-explain select a from t2 where b is null order by a desc limit 2;
-select a from t2 where b is null order by a desc limit 2;
explain select a from t2 where b is null order by a desc;
select a from t2 where b is null order by a desc;
@@ -691,8 +474,6 @@ select a from t2 where b is null order by a desc,a,a;
drop table t1, t2;
-set optimizer_switch=@save_optimizer_switch;
-
--echo #
--echo # MDEV-10325: Queries examines all rows of a tables when it should not
--echo #
diff --git a/mysql-test/t/innodb_icp_debug.test b/mysql-test/t/innodb_icp_debug.test
new file mode 100644
index 00000000000..4aa08c61e87
--- /dev/null
+++ b/mysql-test/t/innodb_icp_debug.test
@@ -0,0 +1,6 @@
+--source include/have_innodb.inc
+
+set default_storage_engine=innodb;
+--source include/icp_debug_kill.inc
+set default_storage_engine=default;
+
diff --git a/mysql-test/t/insert_debug-master.opt b/mysql-test/t/insert_debug-master.opt
new file mode 100644
index 00000000000..824f656cbd5
--- /dev/null
+++ b/mysql-test/t/insert_debug-master.opt
@@ -0,0 +1 @@
+--innodb_autoinc_lock_mode=2
diff --git a/mysql-test/t/insert_debug.test b/mysql-test/t/insert_debug.test
new file mode 100644
index 00000000000..b35d6b838da
--- /dev/null
+++ b/mysql-test/t/insert_debug.test
@@ -0,0 +1,54 @@
+source include/have_innodb.inc;
+source include/have_debug.inc;
+source include/have_debug_sync.inc;
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+connect (con1, localhost, root,,);
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+
+connection default;
+
+let $conn0_id= `SELECT CONNECTION_ID()`;
+
+CREATE TABLE t1(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
+INSERT INTO t1(c1, c2, c3) VALUES('A1','B1','IT1'), ('A2','B2','IT1'), ('A3','B3','IT1'), ('A4','B4','IT1'), ('A5','B5','IT1'), ('A6','B6','IT1'), ('A7','B7','IT1');
+
+CREATE TABLE t2(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NOT NULL, c3 VARCHAR(10) NOT NULL);
+INSERT INTO t2(c1, c2, c3) VALUES ('A3','B3','IT2'), ('A2','B2','IT2'), ('A4','B4','IT2'), ('A5','B5','II2');
+
+CREATE TABLE result(id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10),
+c3 VARCHAR(10), update_count INT DEFAULT 0, UNIQUE KEY uniq_idx (c1,c2), PRIMARY KEY (id)) ENGINE = innodb;
+
+# Insert one row from 't1' into the 'result' table and wait on a debug sync
+# point. The next insert statement from an session 2 inserts values that would
+# lead to unique key clash, when this insert resumes.
+# The subsequent inserts of this statement(after resume) will fail because of a
+# clash with the unique index, and are expected to update the row which clashes
+# with the unique key.
+# Without the fix for bug#30194841 a stale auto increment value, would cause a
+# collision with existing auto increment column value and ends up updating that
+# colliding row, instead of the row colliding with the unique index.
+SET DEBUG_SYNC = "ha_write_row_end WAIT_FOR flushed EXECUTE 1";
+send INSERT INTO result(c1, c2, c3) SELECT * FROM t1 ON DUPLICATE KEY UPDATE c2=t1.c2, c3='UT1', update_count=update_count+1;
+
+# While session 1 is waiting (after one insert), insert rows that will cause a clash
+# with the inserts of session 1 on the unique key.
+connection con1;
+
+# Wait for the session 1 to hit the debug sync point.
+let $wait_condition=SELECT 1 FROM information_schema.processlist WHERE id = $conn0_id AND state LIKE '%ha_write_row_end%';
+--source include/wait_condition.inc
+
+INSERT INTO result(c1, c2, c3) SELECT * FROM t2 ON DUPLICATE KEY UPDATE c2=t2.c2, c3='UT2', update_count=update_count+1;
+
+# Signal to resume the insert statement in session 1
+SET DEBUG_SYNC = "now SIGNAL flushed";
+connection default;
+reap;
+SELECT * FROM result;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE result;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/t/limit_rows_examined.test b/mysql-test/t/limit_rows_examined.test
index 28b39a4caa1..4ccf25dc17a 100644
--- a/mysql-test/t/limit_rows_examined.test
+++ b/mysql-test/t/limit_rows_examined.test
@@ -577,3 +577,20 @@ EXECUTE ps;
drop view v;
drop table t1, t2;
+
+--echo #
+--echo # 10.1 Test
+--echo #
+--echo # MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
+--echo # failed in Diagnostics_area::set_error_status
+--echo #
+set @old_mode= @@sql_mode;
+
+CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
+INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
+
+SET @@sql_mode='STRICT_TRANS_TABLES';
+INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
+
+SET @@sql_mode=@old_mode;
+DROP TABLE t1;
diff --git a/mysql-test/t/locale.opt b/mysql-test/t/locale.opt
new file mode 100644
index 00000000000..0ea17c2e0a8
--- /dev/null
+++ b/mysql-test/t/locale.opt
@@ -0,0 +1 @@
+--lc-messages=de_DE
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index ff77b4991c0..af4a35a5139 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -619,3 +619,17 @@ UNLOCK TABLES;
UNLOCK TABLES;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-21398 Deadlock (server hang) or assertion failure in
+--echo # Diagnostics_area::set_error_status upon ALTER under lock
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+LOCK TABLE t1 WRITE, t1 AS t1a READ;
+ALTER TABLE t1 CHANGE COLUMN IF EXISTS x xx INT;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/lock_view.test b/mysql-test/t/lock_view.test
new file mode 100644
index 00000000000..dd8809ab89d
--- /dev/null
+++ b/mysql-test/t/lock_view.test
@@ -0,0 +1,76 @@
+source include/not_embedded.inc;
+#
+# LOCK TABLES and privileges on views
+#
+create database mysqltest1;
+create database mysqltest2;
+create database mysqltest3;
+create user invoker@localhost;
+create user definer@localhost;
+grant select,show view on mysqltest1.* to invoker@localhost;
+grant select,show view on mysqltest1.* to definer@localhost;
+grant select,show view on mysqltest2.* to invoker@localhost;
+grant select,show view on mysqltest2.* to definer@localhost;
+grant select,show view on mysqltest3.* to invoker@localhost;
+grant select on performance_schema.* to definer@localhost;
+create table mysqltest1.t1 (a int);
+create definer=definer@localhost view mysqltest2.v2 as select * from mysqltest1.t1;
+create definer=definer@localhost view mysqltest3.v3 as select * from mysqltest2.v2;
+create definer=definer@localhost view mysqltest3.v3is as select schema_name from information_schema.schemata order by schema_name;
+create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user;
+create definer=definer@localhost view mysqltest3.v3nt as select 1;
+create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1;
+
+exec $MYSQL_DUMP --compact -B mysqltest1 mysqltest2 mysqltest3;
+
+connect inv,localhost,invoker;
+error ER_DBACCESS_DENIED_ERROR;
+lock table mysqltest3.v3 write;
+disconnect inv;
+connection default;
+
+grant lock tables on mysqltest3.* to invoker@localhost;
+connect inv,localhost,invoker;
+show create view mysqltest3.v3;
+show create view mysqltest3.v3is;
+show create view mysqltest3.v3ps;
+show create view mysqltest3.v3nt;
+show create view mysqltest3.v3i;
+error ER_VIEW_INVALID;
+lock table mysqltest3.v3 write;
+error ER_VIEW_INVALID;
+lock table mysqltest3.v3i write;
+lock table mysqltest3.v3is write; select * from mysqltest3.v3is;
+lock table mysqltest3.v3ps write; select * from mysqltest3.v3ps;
+lock table mysqltest3.v3nt write; select * from mysqltest3.v3nt;
+disconnect inv;
+connection default;
+
+grant lock tables on mysqltest2.* to invoker@localhost;
+connect inv,localhost,invoker;
+error ER_VIEW_INVALID;
+lock table mysqltest3.v3 write;
+error ER_VIEW_INVALID;
+lock table mysqltest3.v3i write;
+disconnect inv;
+connection default;
+
+grant lock tables on mysqltest1.* to definer@localhost;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3 write; select * from mysqltest3.v3;
+error ER_VIEW_INVALID;
+lock table mysqltest3.v3i write;
+disconnect inv;
+connection default;
+
+grant lock tables on mysqltest1.* to invoker@localhost;
+connect inv,localhost,invoker;
+lock table mysqltest3.v3i write; select * from mysqltest3.v3i;
+disconnect inv;
+connection default;
+
+drop user invoker@localhost;
+drop user definer@localhost;
+drop database mysqltest1;
+drop database mysqltest2;
+drop database mysqltest3;
diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test
index 2808458e9f1..1afc0e29f3a 100644
--- a/mysql-test/t/log_errchk.test
+++ b/mysql-test/t/log_errchk.test
@@ -31,7 +31,7 @@
--echo # and slow query log file.
# Restart server with fifo file as general log file.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 60
+--shutdown_server
--source include/wait_until_disconnected.inc
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
diff --git a/mysql-test/t/log_slow_debug.test b/mysql-test/t/log_slow_debug.test
index fd8e613ea1f..7390f1a8469 100644
--- a/mysql-test/t/log_slow_debug.test
+++ b/mysql-test/t/log_slow_debug.test
@@ -9,7 +9,7 @@ SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON;
-SET @save_dbug = @@debug_dbug;
+SET @saved_dbug = @@debug_dbug;
SET SESSION debug_dbug="+d,simulate_slow_query";
DELIMITER $$;
@@ -119,7 +119,7 @@ CALL show_slow_log();
--echo # Clean up
--echo #
-SET SESSION debug_dbug=@save_dbug;
+SET SESSION debug_dbug=@saved_dbug;
TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 4ea8a7639ef..6e02b80caef 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -54,7 +54,7 @@ select * from general_log where argument like '%general_log%';
#
# Check some basic queries interfering with the log tables.
-# In our test we'll use a tbale with verbose comments to the short
+# In our test we'll use a table with verbose comments to the short
# command type names, used in the tables
#
@@ -269,6 +269,14 @@ alter table mysql.slow_log engine=memory;
#alter table mysql.slow_log engine=blackhole;
set storage_engine= @save_storage_engine;
+# Make sure only non-transactional Aria table can be used for logging
+--error ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+--error ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
+
drop table mysql.slow_log;
drop table mysql.general_log;
@@ -467,6 +475,24 @@ drop table slow_log_new, general_log_new;
use test;
#
+# Bug#69953 / MDEV-4851
+# Log tables should be modifable on LOG_OUTPUT != TABLE
+#
+#
+
+SET GLOBAL LOG_OUTPUT = 'FILE';
+SET GLOBAL slow_query_log = 1;
+SET GLOBAL general_log = 1;
+
+ALTER TABLE mysql.slow_log ADD COLUMN comment_text TEXT NOT NULL;
+ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
+
+SET GLOBAL LOG_OUTPUT = 'NONE';
+ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
+ALTER TABLE mysql.general_log DROP COLUMN comment_text;
+
+
+#
# Bug#27857 (Log tables supplies the wrong value for generating
# AUTO_INCREMENT numbers)
#
diff --git a/mysql-test/t/mdev375.test b/mysql-test/t/mdev375.test
index 9e35190b927..6fdb35016ca 100644
--- a/mysql-test/t/mdev375.test
+++ b/mysql-test/t/mdev375.test
@@ -27,6 +27,8 @@ SELECT 2;
--connection default
SELECT 0;
+let $count_sessions=11;
+--source include/wait_until_count_sessions.inc
show status like "Threads_connected";
SET GLOBAL log_warnings=@save_log_warnings;
diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test
index 3898d5bbef6..ab5f19f7093 100644
--- a/mysql-test/t/mdev6830.test
+++ b/mysql-test/t/mdev6830.test
@@ -2,7 +2,7 @@
# MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view
#
--source include/have_debug.inc
-
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
@@ -60,4 +60,4 @@ SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
drop table t1,t2,t3,t4;
drop view v2,v3;
-
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test
index 9bd2cab2c8a..5873d2eb233 100644
--- a/mysql-test/t/merge-big.test
+++ b/mysql-test/t/merge-big.test
@@ -42,7 +42,7 @@ LOCK TABLE t1 WRITE;
#SELECT NOW();
connect (con1,localhost,root,,);
let $con1_id= `SELECT CONNECTION_ID()`;
- SET @orig_debug=@@debug;
+ SET @orig_debug=@@global.debug_dbug;
SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
send INSERT INTO t1 VALUES (1);
connection default;
diff --git a/mysql-test/t/merge_debug.test b/mysql-test/t/merge_debug.test
index 3c617cfc545..50017bc1331 100644
--- a/mysql-test/t/merge_debug.test
+++ b/mysql-test/t/merge_debug.test
@@ -14,7 +14,7 @@ call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair i
drop table if exists crashed,t2,t3,t4;
--enable_warnings
-SET @orig_debug=@@debug;
+SET @orig_debug=@@global.debug_dbug;
#
# Check that MariaDB handles reopen that fails without crashing
diff --git a/mysql-test/t/multi_update_big.test b/mysql-test/t/multi_update_big.test
index a0f17fabec4..d6fec704822 100644
--- a/mysql-test/t/multi_update_big.test
+++ b/mysql-test/t/multi_update_big.test
@@ -1,4 +1,5 @@
--source include/long_test.inc
+--source include/have_sequence.inc
#
# Test of update statement that uses many tables.
@@ -40,25 +41,9 @@ if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`)
# Bug#1820 Rows not deleted from second table on multi-table delete
#
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
---echo # The protocolling of many inserts into t1 is suppressed.
---disable_query_log
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
-let $1=19;
-set @d=4;
-begin;
-while ($1)
-{
- eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
- eval SET @d=@d*2;
- dec $1;
-}
-commit;
---enable_query_log
+INSERT INTO t1 SELECT seq,seq FROM seq_1_to_2097152;
+
ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/t/multi_update_debug.test b/mysql-test/t/multi_update_debug.test
index 2da376e1b87..479405124b0 100644
--- a/mysql-test/t/multi_update_debug.test
+++ b/mysql-test/t/multi_update_debug.test
@@ -10,12 +10,11 @@ create table t0 (x int);
insert t0 values (11), (22);
create trigger tr1 before update on t1 for each row insert t0 values (new.b);
-set debug_sync='open_tables_after_open_and_process_table WAIT_FOR cont';
+set debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR cont';
send update t1 join t2 on (a=c+4) set b=d;
connect con1, localhost, root;
-let $wait_condition= select count(*) from information_schema.processlist where state = ' debug sync point: open_tables_after_open_and_process_table'
-source include/wait_condition.inc;
+set debug_sync='now WAIT_FOR ready';
set debug_sync='mdl_acquire_lock_wait SIGNAL cont';
lock table t1 write, t0 write;
let $wait_condition= select count(*) from information_schema.processlist where state = 'Waiting for table metadata lock'
diff --git a/mysql-test/t/myisam_debug.test b/mysql-test/t/myisam_debug.test
index 465ecd70895..2861c344b10 100644
--- a/mysql-test/t/myisam_debug.test
+++ b/mysql-test/t/myisam_debug.test
@@ -66,7 +66,7 @@ create table t1 (a int, index(a));
lock tables t1 write;
insert t1 values (1),(2),(1);
set @old_dbug=@@debug_dbug;
-set debug_dbug='+d,mi_lock_database_failure';
+SET debug_dbug='+d,mi_lock_database_failure';
unlock tables;
-set debug_dbug=@old_dbug;
+SET debug_dbug=@old_dbug;
drop table t1;
diff --git a/mysql-test/t/myisam_icp_debug.test b/mysql-test/t/myisam_icp_debug.test
new file mode 100644
index 00000000000..d5b1af799fa
--- /dev/null
+++ b/mysql-test/t/myisam_icp_debug.test
@@ -0,0 +1 @@
+--source include/icp_debug_kill.inc
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 8fbbbc1602e..8c2f5e2c32b 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -2,8 +2,6 @@
-- source include/not_embedded.inc
# need to have the dynamic loading turned on for the client plugin tests
--source include/have_plugin_auth.inc
-# This test is slow on buildbot.
---source include/big_test.inc
# Run test with default character set
--source include/default_charset.inc
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index a19be30e68f..5dad8702fc5 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -219,3 +219,38 @@ DROP TABLE test.t1;
SET GLOBAL enforce_storage_engine=NULL;
--echo End of 10.1 tests
+
+--echo #
+--echo # MDEV-23201 'Roles' are created incorrectly on an install that was previously MySQL 5.7
+--echo #
+--echo #
+
+--exec $MYSQL_DUMP --result-file $MYSQLTEST_VARDIR/tmp/user.sql mysql user
+--remove_file $MYSQLD_DATADIR/mysql/user.frm
+--remove_file $MYSQLD_DATADIR/mysql/user.MYI
+--remove_file $MYSQLD_DATADIR/mysql/user.MYD
+
+--copy_file std_data/mysql57user.frm $MYSQLD_DATADIR/mysql/user.frm
+--copy_file std_data/mysql57user.MYI $MYSQLD_DATADIR/mysql/user.MYI
+--copy_file std_data/mysql57user.MYD $MYSQLD_DATADIR/mysql/user.MYD
+FLUSH TABLES mysql.user;
+FLUSH PRIVILEGES;
+SHOW CREATE TABLE mysql.user;
+
+--exec $MYSQL_UPGRADE --force 2>&1
+SHOW CREATE TABLE mysql.user;
+
+CREATE ROLE `aRole`;
+SET ROLE `aRole`;
+
+FLUSH PRIVILEGES;
+
+SET ROLE `aRole`;
+SELECT `User`, `is_role` FROM `mysql`.`user`;
+
+DROP ROLE `aRole`;
+--exec $MYSQL mysql < $MYSQLTEST_VARDIR/tmp/user.sql
+FLUSH PRIVILEGES;
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+--echo End of 10.2 tests
diff --git a/mysql-test/t/mysqlbinlog_row_minimal.test b/mysql-test/t/mysqlbinlog_row_minimal.test
index b69aa6da14b..b399cc4ac45 100644
--- a/mysql-test/t/mysqlbinlog_row_minimal.test
+++ b/mysql-test/t/mysqlbinlog_row_minimal.test
@@ -33,6 +33,33 @@ FLUSH BINARY LOGS;
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log with system table
+--echo #
+FLUSH BINARY LOGS;
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1), (2) ON DUPLICATE KEY UPDATE pk= pk + 10;
+
+--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
+
+FLUSH BINARY LOGS;
+--exec $MYSQL_BINLOG --verbose $datadir/$binlog > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+--echo Proof: two subsequent patterns must be found
+--let SEARCH_PATTERN= ### UPDATE `test`.`t1`
+--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN= ### INSERT INTO `test`.`t1`
+--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+--source include/search_pattern_in_file.inc
+
+DROP TABLE t1;
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+SELECT * FROM t1;
+
+--echo # Cleanup
+DROP TABLE t1;
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
#
# MDEV-14605 ON UPDATE CURRENT_TIMESTAMP fields by multi-table UPDATE are not logged with binlog_row_image=MINIMAL
#
@@ -64,11 +91,12 @@ UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
WHERE t1.id = 1;
--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1)
FLUSH BINARY LOGS;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /@3=\d*/@3=X/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/
---exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --start-position=$binlog_pos
+--replace_regex /table id \d*/table id TID/ /mapped to number \d*/mapped to number TID/ /at \d*/at POS/ /end_log_pos \d*/end_log_pos END_LOG_POS/ /GTID \d*-\d*-\d*/GTID D-S-N/ /\d{6} *\d*:\d\d:\d\d/<date>/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /@3=\d*/@3=X/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /thread_id=\d*/thread_id=TID/
+--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --start-position=$binlog_pos --stop-position=$binlog_end
DROP TABLE t1,t2;
diff --git a/mysql-test/t/mysqld--defaults-file.test b/mysql-test/t/mysqld--defaults-file.test
index 3bfe0aa891f..91d30eb1617 100644
--- a/mysql-test/t/mysqld--defaults-file.test
+++ b/mysql-test/t/mysqld--defaults-file.test
@@ -29,3 +29,19 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
+--echo #
+--echo # MDEV-21374: When "--help --verbose" prints out configuration file paths,
+--echo # the --defaults-file option is not considered
+--echo #
+
+--echo # Test on `defaults-file`
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/my.cnf --help --verbose | grep -A 1 'Default options are read';
+
+--echo # Test on `defaults-extra-file`
+# <first-defaults> = `/etc/my.cnf /etc/mysql/my.cnf`
+# Using sysconfdir configuration, we don't always have `/etc/mysql/my.cnf`, so replace them with a regex as well.
+copy_file $MYSQLTEST_VARDIR/my.cnf $MYSQLTEST_VARDIR/my_test.cnf;
+--replace_regex /.*my_test.cnf/<first-defaults> MYSQLTEST_VARDIR\/my_test.cnf/
+exec $MYSQLD --defaults-extra-file=$MYSQLTEST_VARDIR/my_test.cnf --help --verbose | grep -A 1 'Default options are read';
+remove_file $MYSQLTEST_VARDIR/my_test.cnf;
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 6eb0dc7bb81..12834b6177b 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -23,7 +23,9 @@ perl;
log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone
- collation-server character-set-server log-tc-size version.*/;
+ collation-server character-set-server log-tc-size table-cache
+ table-open-cache table-open-cache-instances max-connections
+ version.*/;
# Plugins which may or may not be there:
@plugins=qw/innodb archive blackhole federated partition
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 34976350c78..4478406b395 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2688,10 +2688,45 @@ select count(*) from t2;
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
drop tables t2, t1;
+
--echo #
---echo # Test for --add-drop-trigger
+--echo # MDEV-22037: Add ability to skip content of some tables
+--echo # (work around for MDEV-20939)
--echo #
+
+use mysql;
+
+--echo # check that all tables we need are not empty
+
+select count(*) >= 1 from mysql.proc;
+select count(*) >= 1 from mysql.db;
+
+
+--exec $MYSQL_DUMP mysql --ignore-table-data=mysql.db >$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql
+
+
+--echo # for proc we have CREATE and INSERT for all other only CREATE
+
+let SEARCH_RANGE=500000000;
+let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql;
+let SEARCH_PATTERN=INSERT INTO `proc`;
+source include/search_pattern_in_file.inc;
+let SEARCH_PATTERN=INSERT INTO `db`;
+source include/search_pattern_in_file.inc;
+let SEARCH_PATTERN=CREATE TABLE `db`;
+source include/search_pattern_in_file.inc;
+let SEARCH_PATTERN=CREATE TABLE `proc`;
+source include/search_pattern_in_file.inc;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20939.sql
use test;
+
+--echo # End of 10.1 tests
+
+--echo #
+--echo # Test for --add-drop-trigger
+--echo #
+
CREATE TABLE t1 (a int, b int);
CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.b=NEW.a + 10;
@@ -2699,3 +2734,5 @@ CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
INSERT INTO t1 (a) VALUES (1),(2),(3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
DROP TABLE t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/mysqltest_tracking_info.test b/mysql-test/t/mysqltest_tracking_info.test
index d31f68b3cbd..dc51167137a 100644
--- a/mysql-test/t/mysqltest_tracking_info.test
+++ b/mysql-test/t/mysqltest_tracking_info.test
@@ -2,6 +2,9 @@
--source include/no_protocol.inc
--source include/not_embedded.inc
+
+set @save_session_track_system_variables=@@session_track_system_variables;
+
SELECT @@session.character_set_connection;
SET @@session.session_track_system_variables='character_set_connection';
@@ -22,4 +25,23 @@ SET NAMES 'utf8';
SET NAMES 'big5';
--disable_session_track_info
-SET @@session.session_track_system_variables= default;
+SET @@session.session_track_system_variables= @save_session_track_system_variables;
+
+--echo #
+--echo # MDEV-22504: session tracking return incorrectly long traking data
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+SET @@session.session_track_system_variables='optimizer_switch';
+
+--enable_session_track_info
+set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
+--disable_session_track_info
+
+set @@optimizer_switch=@save_optimizer_switch;
+
+
+SET @@session.session_track_system_variables= @save_session_track_system_variables;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/nested_profiling.test b/mysql-test/t/nested_profiling.test
new file mode 100644
index 00000000000..ba89aefc647
--- /dev/null
+++ b/mysql-test/t/nested_profiling.test
@@ -0,0 +1,42 @@
+# ==== Purpose ====
+#
+# Test verifies that "init_connect" and "init_slave" system variables work
+# fine when "profiling=on".
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Create regular user without super privilege so that "init_connect"
+# variable is effective.
+# 1 - Enable profiling.
+# 2 - Start a new connection which will try to execute the statements
+# specified in "init_connect". No assert should be reported.
+# 3 - Execute SHOW PROFILES to verify that statements specified in
+# "init_connect" are displayed as part of profiling.
+#
+# ==== References ====
+#
+# MDEV-22706: Assertion `!current' failed in PROFILING::start_new_query
+#
+--source include/not_embedded.inc
+--source include/have_profiling.inc
+
+SET @saved_profiling=@@GLOBAL.profiling;
+SET @saved_init_connect=@@GLOBAL.init_connect;
+SET GLOBAL init_connect="set @a=2;set @b=3";
+SET GLOBAL profiling=on;
+
+create user mysqltest1@localhost;
+connect (con1,localhost,mysqltest1,,);
+connection con1;
+SELECT @a, @b;
+--replace_column 2 #
+SHOW PROFILES;
+
+#========== Clean up ===========
+connection default;
+disconnect con1;
+DROP USER mysqltest1@localhost;
+
+SET GLOBAL profiling=@saved_profiling;
+SET GLOBAL init_connect=@saved_init_connect;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index d67c67de89c..e9802f95721 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -14,6 +14,8 @@ call mtr.add_suppression("Out of sort memory; increase server sort buffer size")
# Test old ORDER BY bug
#
+--source include/have_sequence.inc
+
CREATE TABLE t1 (
id int(6) DEFAULT '0' NOT NULL,
idservice int(5),
@@ -2146,6 +2148,74 @@ SELECT DISTINCT pk FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-21044: Wrong result when using a smaller size for sort buffer
+--echo #
+
+create table t1(a varchar(765),b int);
+insert into t1 values ("a",1),("b",2),("c",3),("e",4);
+insert into t1 values ("d",5),("f",6),("g",7),("h",8);
+insert into t1 values ("k",11),("l",12),("i",9),("j",10);
+insert into t1 values ("m",13),("n",14),("o",15),("p",16);
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size=1024;
+select * from t1 order by b;
+set @@sort_buffer_size= @save_sort_buffer_size;
+drop table t1;
+
+--echo #
+--echo # MDEV-22715: SIGSEGV in radixsort_for_str_ptr and in native_compare/my_qsort2 (optimized builds)
+--echo #
+
+SET @save_sort_buffer_size= @@sort_buffer_size;
+SET @save_max_sort_length= @@max_sort_length;
+SET max_sort_length=8;
+SET sort_buffer_size=1024;
+CREATE TABLE t1(a INT, b DECIMAL(65), c BLOB);
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25;
+INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_25;
+SELECT * FROM t1 ORDER BY a,b;
+SET @@sort_buffer_size= @save_sort_buffer_size;
+SET @@max_sort_length= @save_max_sort_length;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
+--echo # SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
+--echo #
+
+SET @save_max_sort_length= @@max_sort_length;
+SET @save_sort_buffer_size= @@sort_buffer_size;
+SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
+SET max_sort_length=8;
+SET sort_buffer_size=1024;
+# needed to make sure we use addon fields
+SET max_length_for_sort_data=7000;
+CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
+INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
+--source include/analyze-format.inc
+ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
+SELECT * FROM t1 ORDER BY a LIMIT 5;
+SET max_sort_length= @save_max_sort_length;
+SET sort_buffer_size= @save_sort_buffer_size;
+SET max_length_for_sort_data= @save_max_length_for_sort_data;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b));
+INSERT INTO t1 VALUES (0, 1),(1, 2);
+CREATE TABLE t2 SELECT * FROM t1;
+
+EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
+SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
+
+DROP TABLE t1,t2;
+
+--echo # end of 10.1 tests
+
+--echo #
--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
--echo #
@@ -2201,3 +2271,26 @@ GROUP BY id
ORDER BY id+1 DESC;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-24033: SIGSEGV in __memcmp_avx2_movbe from queue_insert | SIGSEGV in __memcmp_avx2_movbe from native_compare
+--echo #
+
+SET @save_max_length_for_sort_data=@@max_length_for_sort_data;
+SET @save_max_sort_length= @@max_sort_length;
+SET @save_sql_select_limit= @@sql_select_limit;
+
+CREATE TABLE t1 (a DECIMAL(64,0), b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
+
+SET max_length_for_sort_data= 30;
+SET sql_select_limit = 3;
+SET max_sort_length=8;
+SELECT * FROM t1 ORDER BY a+1;
+
+SET max_length_for_sort_data=@save_max_length_for_sort_data;
+SET max_sort_length= @save_max_sort_length;
+SET sql_select_limit= @save_sql_select_limit;
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index 5faaca00ea8..c5bd31c576e 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -1090,7 +1090,9 @@ CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
--echo # For now, we're testing the parser.
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
+--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
+--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
DROP TABLE t1;
@@ -1131,8 +1133,11 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
+--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
+--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
+--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
DROP TABLE t1;
@@ -1346,3 +1351,17 @@ create function fs() returns serial return 1;
create table t1 ( id serial );
show create table t1;
drop table t1;
+
+#
+# BETWEEN syntax
+#
+create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+create or replace view v1 as select 1 between (2 in (3,4)) and 5;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+create or replace view v1 as select 1 between (2 like 3) and 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+create or replace view v1 as select 1 not between (2 like 3) and 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+drop view v1;
diff --git a/mysql-test/t/parser_precedence.test b/mysql-test/t/parser_precedence.test
deleted file mode 100644
index 7b69bc9c6da..00000000000
--- a/mysql-test/t/parser_precedence.test
+++ /dev/null
@@ -1,335 +0,0 @@
-
---disable_warnings
-drop table if exists t1_30237_bool;
---enable_warnings
-
-set sql_mode=NO_UNSIGNED_SUBTRACTION;
-
-create table t1_30237_bool(A boolean, B boolean, C boolean);
-
-insert into t1_30237_bool values
-(FALSE, FALSE, FALSE),
-(FALSE, FALSE, NULL),
-(FALSE, FALSE, TRUE),
-(FALSE, NULL, FALSE),
-(FALSE, NULL, NULL),
-(FALSE, NULL, TRUE),
-(FALSE, TRUE, FALSE),
-(FALSE, TRUE, NULL),
-(FALSE, TRUE, TRUE),
-(NULL, FALSE, FALSE),
-(NULL, FALSE, NULL),
-(NULL, FALSE, TRUE),
-(NULL, NULL, FALSE),
-(NULL, NULL, NULL),
-(NULL, NULL, TRUE),
-(NULL, TRUE, FALSE),
-(NULL, TRUE, NULL),
-(NULL, TRUE, TRUE),
-(TRUE, FALSE, FALSE),
-(TRUE, FALSE, NULL),
-(TRUE, FALSE, TRUE),
-(TRUE, NULL, FALSE),
-(TRUE, NULL, NULL),
-(TRUE, NULL, TRUE),
-(TRUE, TRUE, FALSE),
-(TRUE, TRUE, NULL),
-(TRUE, TRUE, TRUE) ;
-
---echo Testing OR, XOR, AND
-select A, B, A OR B, A XOR B, A AND B
- from t1_30237_bool where C is null order by A, B;
-
---echo Testing that OR is associative
-select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A OR B) OR C) != (A OR (B OR C));
-
---echo Testing that XOR is associative
-select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A XOR B) XOR C) != (A XOR (B XOR C));
-
---echo Testing that AND is associative
-select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A AND B) AND C) != (A AND (B AND C));
-
---echo Testing that AND has precedence over OR
-select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A OR (B AND C)) != (A OR B AND C);
-select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A AND B) OR C) != (A AND B OR C);
-
---echo Testing that AND has precedence over XOR
-select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A XOR (B AND C)) != (A XOR B AND C);
-select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A AND B) XOR C) != (A AND B XOR C);
-
---echo Testing that XOR has precedence over OR
-select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A XOR B) OR C) != (A XOR B OR C);
-select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A OR (B XOR C)) != (A OR B XOR C);
-
-drop table t1_30237_bool;
-
---echo Testing that NOT has precedence over OR
-select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
-
---echo Testing that NOT has precedence over XOR
-select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
-
---echo Testing that NOT has precedence over AND
-select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
-
---echo Testing that NOT is associative
-select NOT NOT TRUE, NOT NOT NOT FALSE;
-
---echo Testing that IS has precedence over NOT
-select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
-select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
-select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
-select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
-select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
-select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
-select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
-select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
-
---echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
-# Documenting existing behavior in 5.0.48
--- error ER_PARSE_ERROR
-select TRUE IS TRUE IS TRUE IS TRUE;
--- error ER_PARSE_ERROR
-select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
--- error ER_PARSE_ERROR
-select NULL IS FALSE IS FALSE IS FALSE;
--- error ER_PARSE_ERROR
-select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
--- error ER_PARSE_ERROR
-select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
--- error ER_PARSE_ERROR
-select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
-
---echo Testing that IS [NOT] NULL predicates are associative
-# Documenting existing behavior in 5.0.48
-select FALSE IS NULL IS NULL IS NULL;
-select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
-
---echo Testing that comparison operators are left associative
-select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
-select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
-select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
-select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
-select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
-select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
-select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
-select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
-
--- echo Testing that | is associative
-select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
-
--- echo Testing that & is associative
-select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
-
--- echo Testing that << is left associative
-select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
-
--- echo Testing that >> is left associative
-select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
-
---echo Testing that & has precedence over |
-select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
-select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
-
---echo Testing that << has precedence over |
-select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
-select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
-
---echo Testing that >> has precedence over |
-select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
-select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
-
---echo Testing that << has precedence over &
-select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
-select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
-
---echo Testing that >> has precedence over &
-select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
-select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
-
---echo Testing that >> and << have the same precedence
-select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
-select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
-
---echo Testing that binary + is associative
-select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
-
---echo Testing that binary - is left associative
-select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
-
---echo Testing that binary + and binary - have the same precedence
-# evaluated left to right
-select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
-select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
-
---echo Testing that binary + has precedence over |
-select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
-select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
-
---echo Testing that binary + has precedence over &
-select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
-select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
-
---echo Testing that binary + has precedence over <<
-select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
-select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
-
---echo Testing that binary + has precedence over >>
-select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
-select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
-
---echo Testing that binary - has precedence over |
-select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
-select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
-
---echo Testing that binary - has precedence over &
-select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
-select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
-
---echo Testing that binary - has precedence over <<
-select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
-select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
-
---echo Testing that binary - has precedence over >>
-select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
-select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
-
---echo Testing that * is associative
-select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
-
---echo Testing that * has precedence over |
-select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
-select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
-
---echo Testing that * has precedence over &
-select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
-select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
-
---echo Testing that * has precedence over <<
-# Actually, can't prove it for the first case,
-# since << is a multiplication by a power of 2,
-# and * is associative
-select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
-select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
-
---echo Testing that * has precedence over >>
-# >> is a multiplication by a (negative) power of 2,
-# see above.
-select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
-select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
-
---echo Testing that * has precedence over binary +
-select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
-select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
-
---echo Testing that * has precedence over binary -
-select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
-select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
-
---echo Testing that / is left associative
-select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
-
---echo Testing that / has precedence over |
-select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
-select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
-
---echo Testing that / has precedence over &
-select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
-select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
-
---echo Testing that / has precedence over <<
-select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
-select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
-
---echo Testing that / has precedence over >>
-select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
-select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
-
---echo Testing that / has precedence over binary +
-select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
-select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
-
---echo Testing that / has precedence over binary -
-select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
-select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
-
-# TODO: %, DIV, MOD
-
---echo Testing that ^ is associative
-select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
-select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
-
---echo Testing that ^ has precedence over |
-select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
-select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over &
-select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
-select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over <<
-select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
-select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
-
---echo Testing that ^ has precedence over >>
-select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
-select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over binary +
-select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
-select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over binary -
-select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
-select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
-
---echo Testing that ^ has precedence over *
-select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
-select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over /
-select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
-select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over %
-select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
-select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
-
---echo Testing that ^ has precedence over DIV
-select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
-select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over MOD
-select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
-select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
-
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 0f965cc810a..b82485dfc5c 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2971,5 +2971,49 @@ SELECT 1 FROM t1 WHERE a XOR 'a';
DROP TABLE t1;
--echo #
+--echo # Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE
+--echo # WITH A COMPOSITE PREFIX INDEX
+--echo #
+create table t1(id int unsigned not null,
+ data varchar(2) default null,
+ key data_idx (data(1),id)
+) default charset=utf8
+partition by range (id) (
+ partition p10 values less than (10),
+ partition p20 values less than (20)
+);
+insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
+select id from t1 where data = 'ab' order by id;
+drop table t1;
+
+create table t1(id int unsigned not null,
+ data text default null,
+ key data_idx (data(1),id)
+) default charset=utf8
+partition by range (id) (
+ partition p10 values less than (10),
+ partition p20 values less than (20)
+);
+insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ;
+select id from t1 where data = 'ab' order by id;
+drop table t1;
+
+--echo #
+--echo # MDEV-5628: Assertion `! is_set()' or `!is_set() ||
+--echo # (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
+--echo # partitioned table with subquery (MySQL:71630)
+--echo #
+
+CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--error ER_SUBQUERY_NO_1_ROW
+UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
+
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test
index 1235e5b8dc2..b52e92445a8 100644
--- a/mysql-test/t/partition_alter.test
+++ b/mysql-test/t/partition_alter.test
@@ -112,3 +112,44 @@ insert into t1 values(0, 1, 1, NULL, now(), now());
alter online table t1 delay_key_write=1;
show create table t1;
drop table t1;
+
+--echo #
+--echo # MDEV-19751 Wrong partitioning by KEY() after key dropped
+--echo #
+create or replace table t1 (pk int, x timestamp(6), primary key (pk, x)) engine innodb
+partition by key() partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+--echo # Inplace for DROP PRIMARY KEY when partitioned by default field list is denied
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t1 drop primary key, drop column x, add primary key (pk), algorithm=inplace;
+alter table t1 drop primary key, drop column x, add primary key (pk);
+select * from t1 partition (p0);
+drop table t1;
+
+create or replace table t1 (pk int not null, x timestamp(6), unique u(pk, x)) engine innodb
+partition by key() partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+--echo # Same for NOT NULL UNIQUE KEY as this is actually primary key
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+alter table t1 drop key u, drop column x, add unique (pk), algorithm=inplace;
+alter table t1 drop key u, drop column x, add unique (pk);
+select * from t1 partition (p0);
+drop table t1;
+
+create or replace table t1 (pk int, x timestamp(6), primary key (pk)) engine innodb
+partition by key(pk) partitions 2;
+insert into t1 (pk, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+--echo # Inplace for DROP PRIMARY KEY when partitioned by explicit field list is allowed
+alter table t1 drop primary key, add primary key (pk, x), algorithm=inplace;
+select * from t1 partition (p0);
+drop table t1;
+
+create or replace table t1 (k int, x timestamp(6), unique key u (x, k)) engine innodb
+partition by key(k) partitions 2;
+insert into t1 (k, x) values (1, '2000-01-01 00:00'), (2, '2000-01-01 00:01');
+--echo # Inplace for DROP KEY is allowed
+alter table t1 drop key u, algorithm=inplace;
+select * from t1 partition (p0);
+drop table t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index b682162f7ea..518ef187d54 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -1,7 +1,3 @@
-if (`select plugin_auth_version < "5.6.25" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB as of 5.6.24 or earlier
-}
--source include/not_embedded.inc
--source include/have_partition.inc
--source include/have_innodb.inc
@@ -405,9 +401,7 @@ DROP TABLE t1;
# Bug #14673: Wrong InnoDB default row format
#
create table t1 (a int) engine=innodb partition by hash(a) ;
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 #
show table status like 't1';
drop table t1;
@@ -417,33 +411,23 @@ drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 Create_time
show table status;
insert into t1 values (0), (1), (2), (3);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 Create_time 13 Update_time
show table status;
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 Create_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 Create_time 13 Update_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
+--replace_column 12 Create_time 13 Update_time
show table status;
drop table t1;
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index e1a17d49174..d2e828b2589 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -276,3 +276,23 @@ RENAME TABLE t1 TO t2;
DROP TABLE t1;
--echo # End of 10.1 test
+
+--echo #
+--echo # MDEV-21258: Can't uninstall plugin if the library file doesn't exist
+--echo #
+
+insert into mysql.plugin values ("unexisting_plugin", "soname");
+
+# check that we have the plugin installed
+select * from mysql.plugin WHERE name='unexisting_plugin';
+
+# make attempt to uninstall the plugin
+UNINSTALL PLUGIN unexisting_plugin;
+
+# check that we have the plugin uninstalled
+select * from mysql.plugin WHERE name='unexisting_plugin';
+
+--error ER_SP_DOES_NOT_EXIST
+UNINSTALL PLUGIN unexisting_plugin;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/plugin_innodb.test b/mysql-test/t/plugin_innodb.test
index fb5dd84b997..03afa190400 100644
--- a/mysql-test/t/plugin_innodb.test
+++ b/mysql-test/t/plugin_innodb.test
@@ -1,13 +1,6 @@
--source include/not_embedded.inc
--source include/have_example_plugin.inc
---source include/have_innodb.inc
-
-if (!`select count(*) from information_schema.plugins
- where plugin_name = 'innodb' and plugin_status = 'active' and
- plugin_library is null`) {
- skip Need compiled-in InnoDB;
-}
-
+--source include/have_static_innodb.inc
--replace_regex /\.dll/.so/
eval install plugin example soname '$HA_EXAMPLE_SO';
diff --git a/mysql-test/t/pool_of_threads.test b/mysql-test/t/pool_of_threads.test
index cb62a27faeb..95b320e6dad 100644
--- a/mysql-test/t/pool_of_threads.test
+++ b/mysql-test/t/pool_of_threads.test
@@ -92,3 +92,9 @@ connection con2;
connection extracon;
--reap
+
+# Check if compression works OK
+connect (comp_con,localhost,root,,,,,COMPRESS);
+SELECT 1;
+disconnect comp_con;
+
diff --git a/mysql-test/t/precedence.test b/mysql-test/t/precedence.test
new file mode 100644
index 00000000000..ad367c23603
--- /dev/null
+++ b/mysql-test/t/precedence.test
@@ -0,0 +1,4788 @@
+#
+# A fairly exhastive test for operator precedence
+#
+
+disable_warnings;
+
+#################### I couldn't come up with a test where precedence changes the result here
+#
+#create or replace view v1 as select BINARY 2 IS TRUE, BINARY (2 IS TRUE), (BINARY 2) IS TRUE;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 IS TRUE, BINARY (2 IS TRUE), (BINARY 2) IS TRUE union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 OR 3, BINARY (2 OR 3), (BINARY 2) OR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 OR 3, BINARY (2 OR 3), (BINARY 2) OR 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 || 3, BINARY (2 || 3), (BINARY 2) || 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 || 3, BINARY (2 || 3), (BINARY 2) || 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 XOR 3, BINARY (2 XOR 3), (BINARY 2) XOR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 XOR 3, BINARY (2 XOR 3), (BINARY 2) XOR 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 AND 3, BINARY (2 AND 3), (BINARY 2) AND 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 AND 3, BINARY (2 AND 3), (BINARY 2) AND 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 && 3, BINARY (2 && 3), (BINARY 2) && 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 && 3, BINARY (2 && 3), (BINARY 2) && 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 | 3, BINARY (2 | 3), (BINARY 2) | 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 | 3, BINARY (2 | 3), (BINARY 2) | 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 & 3, BINARY (2 & 3), (BINARY 2) & 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 & 3, BINARY (2 & 3), (BINARY 2) & 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 << 3, BINARY (2 << 3), (BINARY 2) << 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 << 3, BINARY (2 << 3), (BINARY 2) << 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 >> 3, BINARY (2 >> 3), (BINARY 2) >> 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 >> 3, BINARY (2 >> 3), (BINARY 2) >> 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY '2000-01-01' +INTERVAL 1 DAY, BINARY ('2000-01-01' +INTERVAL 1 DAY), (BINARY '2000-01-01') +INTERVAL 1 DAY;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY '2000-01-01' +INTERVAL 1 DAY, BINARY ('2000-01-01' +INTERVAL 1 DAY), (BINARY '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 + 3, BINARY (2 + 3), (BINARY 2) + 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 + 3, BINARY (2 + 3), (BINARY 2) + 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 - 3, BINARY (2 - 3), (BINARY 2) - 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 - 3, BINARY (2 - 3), (BINARY 2) - 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 * 3, BINARY (2 * 3), (BINARY 2) * 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 * 3, BINARY (2 * 3), (BINARY 2) * 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 / 3, BINARY (2 / 3), (BINARY 2) / 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 / 3, BINARY (2 / 3), (BINARY 2) / 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 DIV 3, BINARY (2 DIV 3), (BINARY 2) DIV 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 DIV 3, BINARY (2 DIV 3), (BINARY 2) DIV 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 MOD 3, BINARY (2 MOD 3), (BINARY 2) MOD 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 MOD 3, BINARY (2 MOD 3), (BINARY 2) MOD 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 % 3, BINARY (2 % 3), (BINARY 2) % 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 % 3, BINARY (2 % 3), (BINARY 2) % 3 union select * from v1;
+#
+#create or replace view v1 as select BINARY 2 ^ 3, BINARY (2 ^ 3), (BINARY 2) ^ 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select BINARY 2 ^ 3, BINARY (2 ^ 3), (BINARY 2) ^ 3 union select * from v1;
+#
+#set sql_mode=PIPES_AS_CONCAT;
+#create or replace view v1 as select 2 || 3 COLLATE latin1_bin, 2 || (3 COLLATE latin1_bin), (2 || 3) COLLATE latin1_bin;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 || 3 COLLATE latin1_bin, 2 || (3 COLLATE latin1_bin), (2 || 3) COLLATE latin1_bin union select * from v1;
+
+########################## The result doesn't depend on the precedence
+#
+#create or replace view v1 as select NOT 2 XOR 0, NOT (2 XOR 0), (NOT 2) XOR 0;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select NOT 2 XOR 0, NOT (2 XOR 0), (NOT 2) XOR 0 union select * from v1;
+#
+#create or replace view v1 as select - 2 * 3, - (2 * 3), (- 2) * 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select - 2 * 3, - (2 * 3), (- 2) * 3 union select * from v1;
+#
+#create or replace view v1 as select - 2 / 3, - (2 / 3), (- 2) / 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select - 2 / 3, - (2 / 3), (- 2) / 3 union select * from v1;
+#
+#create or replace view v1 as select - 2 DIV 3, - (2 DIV 3), (- 2) DIV 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select - 2 DIV 3, - (2 DIV 3), (- 2) DIV 3 union select * from v1;
+#
+#create or replace view v1 as select - 2 MOD 3, - (2 MOD 3), (- 2) MOD 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select - 2 MOD 3, - (2 MOD 3), (- 2) MOD 3 union select * from v1;
+#
+#create or replace view v1 as select - 2 % 3, - (2 % 3), (- 2) % 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select - 2 % 3, - (2 % 3), (- 2) % 3 union select * from v1;
+#
+#create or replace view v1 as select ~ 2 ^ 3, ~ (2 ^ 3), (~ 2) ^ 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select ~ 2 ^ 3, ~ (2 ^ 3), (~ 2) ^ 3 union select * from v1;
+#
+#create or replace view v1 as select ! 2 XOR 3, ! (2 XOR 3), (! 2) XOR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select ! 2 XOR 3, ! (2 XOR 3), (! 2) XOR 3 union select * from v1;
+#
+#create or replace view v1 as select 2 OR 3 OR 3, 2 OR (3 OR 3), (2 OR 3) OR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 OR 3 OR 3, 2 OR (3 OR 3), (2 OR 3) OR 3 union select * from v1;
+#
+#create or replace view v1 as select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3 union select * from v1;
+#
+#create or replace view v1 as select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3 union select * from v1;
+#
+#create or replace view v1 as select 2 || 3 || 3, 2 || (3 || 3), (2 || 3) || 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 || 3 || 3, 2 || (3 || 3), (2 || 3) || 3 union select * from v1;
+#
+#create or replace view v1 as select 2 XOR 3 IS FALSE, 2 XOR (3 IS FALSE), (2 XOR 3) IS FALSE;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 XOR 3 IS FALSE, 2 XOR (3 IS FALSE), (2 XOR 3) IS FALSE union select * from v1;
+#
+#create or replace view v1 as select 2 XOR 3 XOR 3, 2 XOR (3 XOR 3), (2 XOR 3) XOR 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 XOR 3 XOR 3, 2 XOR (3 XOR 3), (2 XOR 3) XOR 3 union select * from v1;
+#
+#create or replace view v1 as select 2 AND 3 AND 3, 2 AND (3 AND 3), (2 AND 3) AND 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 AND 3 AND 3, 2 AND (3 AND 3), (2 AND 3) AND 3 union select * from v1;
+#
+#create or replace view v1 as select 2 AND 3 && 3, 2 AND (3 && 3), (2 AND 3) && 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 AND 3 && 3, 2 AND (3 && 3), (2 AND 3) && 3 union select * from v1;
+#
+#create or replace view v1 as select 2 && 3 AND 3, 2 && (3 AND 3), (2 && 3) AND 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 && 3 AND 3, 2 && (3 AND 3), (2 && 3) AND 3 union select * from v1;
+#
+#create or replace view v1 as select 2 && 3 && 3, 2 && (3 && 3), (2 && 3) && 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 && 3 && 3, 2 && (3 && 3), (2 && 3) && 3 union select * from v1;
+#
+#create or replace view v1 as select 2 | 3 | 3, 2 | (3 | 3), (2 | 3) | 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 | 3 | 3, 2 | (3 | 3), (2 | 3) | 3 union select * from v1;
+#
+#create or replace view v1 as select 2 & 3 & 3, 2 & (3 & 3), (2 & 3) & 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 & 3 & 3, 2 & (3 & 3), (2 & 3) & 3 union select * from v1;
+#
+#create or replace view v1 as select 2 + 3 + 3, 2 + (3 + 3), (2 + 3) + 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 + 3 + 3, 2 + (3 + 3), (2 + 3) + 3 union select * from v1;
+#
+#create or replace view v1 as select 2 + 3 - 3, 2 + (3 - 3), (2 + 3) - 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 + 3 - 3, 2 + (3 - 3), (2 + 3) - 3 union select * from v1;
+#
+#create or replace view v1 as select 2 * 3 << 3, 2 * (3 << 3), (2 * 3) << 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 * 3 << 3, 2 * (3 << 3), (2 * 3) << 3 union select * from v1;
+#
+#create or replace view v1 as select 2 * 3 * 3, 2 * (3 * 3), (2 * 3) * 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 * 3 * 3, 2 * (3 * 3), (2 * 3) * 3 union select * from v1;
+#
+#create or replace view v1 as select 2 * 3 / 3, 2 * (3 / 3), (2 * 3) / 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 * 3 / 3, 2 * (3 / 3), (2 * 3) / 3 union select * from v1;
+#
+#create or replace view v1 as select 2 ^ 3 ^ 3, 2 ^ (3 ^ 3), (2 ^ 3) ^ 3;
+#Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+#select 2 ^ 3 ^ 3, 2 ^ (3 ^ 3), (2 ^ 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT NULL IS TRUE, NOT (NULL IS TRUE), (NOT NULL) IS TRUE union select * from v1;
+
+create or replace view v1 as select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! NULL IS TRUE, ! (NULL IS TRUE), (! NULL) IS TRUE union select * from v1;
+
+create or replace view v1 as select charset(NOT 2 COLLATE latin1_bin), charset(NOT (2 COLLATE latin1_bin)), charset((NOT 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(NOT 2 COLLATE latin1_bin), charset(NOT (2 COLLATE latin1_bin)), charset((NOT 2) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select NOT 2 IN (0,2), NOT (2 IN (0,2)), (NOT 2) IN (0,2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 IN (0,2), NOT (2 IN (0,2)), (NOT 2) IN (0,2) union select * from v1;
+
+create or replace view v1 as select NOT 2 OR 3, NOT (2 OR 3), (NOT 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 OR 3, NOT (2 OR 3), (NOT 2) OR 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 AND 0, NOT (2 AND 0), (NOT 2) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 AND 0, NOT (2 AND 0), (NOT 2) AND 0 union select * from v1;
+
+create or replace view v1 as select NOT 2 && 0, NOT (2 && 0), (NOT 2) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 && 0, NOT (2 && 0), (NOT 2) && 0 union select * from v1;
+
+create or replace view v1 as select NOT 2 = 3, NOT (2 = 3), (NOT 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 = 3, NOT (2 = 3), (NOT 2) = 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 <=> 3, NOT (2 <=> 3), (NOT 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 <=> 3, NOT (2 <=> 3), (NOT 2) <=> 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 >= 3, NOT (2 >= 3), (NOT 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 >= 3, NOT (2 >= 3), (NOT 2) >= 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 <= 3, NOT (2 <= 3), (NOT 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 <= 3, NOT (2 <= 3), (NOT 2) <= 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 < 3, NOT (2 < 3), (NOT 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 < 3, NOT (2 < 3), (NOT 2) < 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 <> 3, NOT (2 <> 3), (NOT 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 <> 3, NOT (2 <> 3), (NOT 2) <> 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 > 3, NOT (2 > 3), (NOT 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 > 3, NOT (2 > 3), (NOT 2) > 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 != 3, NOT (2 != 3), (NOT 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 != 3, NOT (2 != 3), (NOT 2) != 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 LIKE 3, NOT (2 LIKE 3), (NOT 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 LIKE 3, NOT (2 LIKE 3), (NOT 2) LIKE 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 REGEXP 3, NOT (2 REGEXP 3), (NOT 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 REGEXP 3, NOT (2 REGEXP 3), (NOT 2) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 | 3, NOT (2 | 3), (NOT 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 | 3, NOT (2 | 3), (NOT 2) | 3 union select * from v1;
+
+create or replace view v1 as select NOT 0 & 2, NOT (0 & 2), (NOT 0) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 0 & 2, NOT (0 & 2), (NOT 0) & 2 union select * from v1;
+
+create or replace view v1 as select NOT 0 << 3, NOT (0 << 3), (NOT 0) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 0 << 3, NOT (0 << 3), (NOT 0) << 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 >> 3, NOT (2 >> 3), (NOT 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 >> 3, NOT (2 >> 3), (NOT 2) >> 3 union select * from v1;
+
+create or replace view v1 as select NOT '2000-01-01' +INTERVAL 1 DAY, NOT ('2000-01-01' +INTERVAL 1 DAY), (NOT '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT '2000-01-01' +INTERVAL 1 DAY, NOT ('2000-01-01' +INTERVAL 1 DAY), (NOT '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select NOT 2 + 3, NOT (2 + 3), (NOT 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 + 3, NOT (2 + 3), (NOT 2) + 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 - 3, NOT (2 - 3), (NOT 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 - 3, NOT (2 - 3), (NOT 2) - 3 union select * from v1;
+
+create or replace view v1 as select NOT 0 * 3, NOT (0 * 3), (NOT 0) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 0 * 3, NOT (0 * 3), (NOT 0) * 3 union select * from v1;
+
+create or replace view v1 as select NOT 0 / 3, NOT (0 / 3), (NOT 0) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 0 / 3, NOT (0 / 3), (NOT 0) / 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 DIV 3, NOT (2 DIV 3), (NOT 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 DIV 3, NOT (2 DIV 3), (NOT 2) DIV 3 union select * from v1;
+
+create or replace view v1 as select NOT 6 MOD 3, NOT (6 MOD 3), (NOT 6) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 6 MOD 3, NOT (6 MOD 3), (NOT 6) MOD 3 union select * from v1;
+
+create or replace view v1 as select NOT 6 % 3, NOT (6 % 3), (NOT 6) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 6 % 3, NOT (6 % 3), (NOT 6) % 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 ^ 3, NOT (2 ^ 3), (NOT 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 ^ 3, NOT (2 ^ 3), (NOT 2) ^ 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 BETWEEN 3 AND 4, NOT (2 BETWEEN 3 AND 4), (NOT 2) BETWEEN 3 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 BETWEEN 3 AND 4, NOT (2 BETWEEN 3 AND 4), (NOT 2) BETWEEN 3 AND 4 union select * from v1;
+
+create or replace view v1 as select - 2 IS TRUE, - (2 IS TRUE), (- 2) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 IS TRUE, - (2 IS TRUE), (- 2) IS TRUE union select * from v1;
+
+create or replace view v1 as select charset(- "2" COLLATE latin1_bin), charset(- ("2" COLLATE latin1_bin)), charset((- "2") COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(- "2" COLLATE latin1_bin), charset(- ("2" COLLATE latin1_bin)), charset((- "2") COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select - 2 IN (2,1), - (2 IN (2,1)), (- 2) IN (2,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 IN (2,1), - (2 IN (2,1)), (- 2) IN (2,1) union select * from v1;
+
+create or replace view v1 as select - 2 OR 3, - (2 OR 3), (- 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 OR 3, - (2 OR 3), (- 2) OR 3 union select * from v1;
+
+create or replace view v1 as select - 2 || 3, - (2 || 3), (- 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 || 3, - (2 || 3), (- 2) || 3 union select * from v1;
+
+create or replace view v1 as select - 0 XOR 3, - (0 XOR 3), (- 0) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 0 XOR 3, - (0 XOR 3), (- 0) XOR 3 union select * from v1;
+
+create or replace view v1 as select - 2 AND 3, - (2 AND 3), (- 2) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 AND 3, - (2 AND 3), (- 2) AND 3 union select * from v1;
+
+create or replace view v1 as select - 2 && 3, - (2 && 3), (- 2) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 && 3, - (2 && 3), (- 2) && 3 union select * from v1;
+
+create or replace view v1 as select - 2 = 2, - (2 = 2), (- 2) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 = 2, - (2 = 2), (- 2) = 2 union select * from v1;
+
+create or replace view v1 as select - 2 <=> 2, - (2 <=> 2), (- 2) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 <=> 2, - (2 <=> 2), (- 2) <=> 2 union select * from v1;
+
+create or replace view v1 as select - 2 >= 1, - (2 >= 1), (- 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 >= 1, - (2 >= 1), (- 2) >= 1 union select * from v1;
+
+create or replace view v1 as select - 2 <= 3, - (2 <= 3), (- 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 <= 3, - (2 <= 3), (- 2) <= 3 union select * from v1;
+
+create or replace view v1 as select - 2 < 3, - (2 < 3), (- 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 < 3, - (2 < 3), (- 2) < 3 union select * from v1;
+
+create or replace view v1 as select - 2 <> 3, - (2 <> 3), (- 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 <> 3, - (2 <> 3), (- 2) <> 3 union select * from v1;
+
+create or replace view v1 as select - 2 > 1, - (2 > 1), (- 2) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 > 1, - (2 > 1), (- 2) > 1 union select * from v1;
+
+create or replace view v1 as select - 2 != 3, - (2 != 3), (- 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 != 3, - (2 != 3), (- 2) != 3 union select * from v1;
+
+create or replace view v1 as select - 2 LIKE 2, - (2 LIKE 2), (- 2) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 LIKE 2, - (2 LIKE 2), (- 2) LIKE 2 union select * from v1;
+
+create or replace view v1 as select - 2 REGEXP 2, - (2 REGEXP 2), (- 2) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 REGEXP 2, - (2 REGEXP 2), (- 2) REGEXP 2 union select * from v1;
+
+create or replace view v1 as select - 2 | 3, - (2 | 3), (- 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 | 3, - (2 | 3), (- 2) | 3 union select * from v1;
+
+create or replace view v1 as select - 2 & 3, - (2 & 3), (- 2) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 & 3, - (2 & 3), (- 2) & 3 union select * from v1;
+
+create or replace view v1 as select - 2 << 3, - (2 << 3), (- 2) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 << 3, - (2 << 3), (- 2) << 3 union select * from v1;
+
+create or replace view v1 as select - 2 >> 3, - (2 >> 3), (- 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 >> 3, - (2 >> 3), (- 2) >> 3 union select * from v1;
+
+create or replace view v1 as select - '2000-01-01' +INTERVAL 1 DAY, - ('2000-01-01' +INTERVAL 1 DAY), (- '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - '2000-01-01' +INTERVAL 1 DAY, - ('2000-01-01' +INTERVAL 1 DAY), (- '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select - 2 + 3, - (2 + 3), (- 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 + 3, - (2 + 3), (- 2) + 3 union select * from v1;
+
+create or replace view v1 as select - 2 - 3, - (2 - 3), (- 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 - 3, - (2 - 3), (- 2) - 3 union select * from v1;
+
+create or replace view v1 as select - 2 ^ 3, - (2 ^ 3), (- 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 ^ 3, - (2 ^ 3), (- 2) ^ 3 union select * from v1;
+
+create or replace view v1 as select - 2 BETWEEN 1 AND 3, - (2 BETWEEN 1 AND 3), (- 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 BETWEEN 1 AND 3, - (2 BETWEEN 1 AND 3), (- 2) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 IS TRUE, ~ (2 IS TRUE), (~ 2) IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 IS TRUE, ~ (2 IS TRUE), (~ 2) IS TRUE union select * from v1;
+
+create or replace view v1 as select charset(~ 2 COLLATE latin1_bin), charset(~ (2 COLLATE latin1_bin)), charset((~ 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(~ 2 COLLATE latin1_bin), charset(~ (2 COLLATE latin1_bin)), charset((~ 2) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select ~ 2 IN (0,1), ~ (2 IN (0,1)), (~ 2) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 IN (0,1), ~ (2 IN (0,1)), (~ 2) IN (0,1) union select * from v1;
+
+create or replace view v1 as select ~ 2 OR 3, ~ (2 OR 3), (~ 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 OR 3, ~ (2 OR 3), (~ 2) OR 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 XOR 3, ~ (2 XOR 3), (~ 2) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 XOR 3, ~ (2 XOR 3), (~ 2) XOR 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 AND 3, ~ (2 AND 3), (~ 2) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 AND 3, ~ (2 AND 3), (~ 2) AND 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 && 3, ~ (2 && 3), (~ 2) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 && 3, ~ (2 && 3), (~ 2) && 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 = 3, ~ (2 = 3), (~ 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 = 3, ~ (2 = 3), (~ 2) = 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 <=> 3, ~ (2 <=> 3), (~ 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 <=> 3, ~ (2 <=> 3), (~ 2) <=> 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 >= 3, ~ (2 >= 3), (~ 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 >= 3, ~ (2 >= 3), (~ 2) >= 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 <= 3, ~ (2 <= 3), (~ 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 <= 3, ~ (2 <= 3), (~ 2) <= 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 < 3, ~ (2 < 3), (~ 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 < 3, ~ (2 < 3), (~ 2) < 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 <> 3, ~ (2 <> 3), (~ 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 <> 3, ~ (2 <> 3), (~ 2) <> 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 > 3, ~ (2 > 3), (~ 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 > 3, ~ (2 > 3), (~ 2) > 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 != 3, ~ (2 != 3), (~ 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 != 3, ~ (2 != 3), (~ 2) != 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 LIKE 3, ~ (2 LIKE 3), (~ 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 LIKE 3, ~ (2 LIKE 3), (~ 2) LIKE 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 REGEXP 3, ~ (2 REGEXP 3), (~ 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 REGEXP 3, ~ (2 REGEXP 3), (~ 2) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 | 3, ~ (2 | 3), (~ 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 | 3, ~ (2 | 3), (~ 2) | 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 & 3, ~ (2 & 3), (~ 2) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 & 3, ~ (2 & 3), (~ 2) & 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 << 3, ~ (2 << 3), (~ 2) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 << 3, ~ (2 << 3), (~ 2) << 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 >> 3, ~ (2 >> 3), (~ 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 >> 3, ~ (2 >> 3), (~ 2) >> 3 union select * from v1;
+
+create or replace view v1 as select ~ '2000-01-01' +INTERVAL 1 DAY, ~ ('2000-01-01' +INTERVAL 1 DAY), (~ '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ '2000-01-01' +INTERVAL 1 DAY, ~ ('2000-01-01' +INTERVAL 1 DAY), (~ '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select ~ 10000 + 3, ~ (10000 + 3), (~ 10000) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 10000 + 3, ~ (10000 + 3), (~ 10000) + 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 - 3, ~ (2 - 3), (~ 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 - 3, ~ (2 - 3), (~ 2) - 3 union select * from v1;
+
+create or replace view v1 as select ~ 10000000000000000000 * 2, ~ (100 * 2), (~ 10000000000000000000) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 10000000000000000000 * 2, ~ (100 * 2), (~ 10000000000000000000) * 2 union select * from v1;
+
+create or replace view v1 as select ~ 2 / 3, ~ (2 / 3), (~ 2) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 / 3, ~ (2 / 3), (~ 2) / 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 DIV 3, ~ (2 DIV 3), (~ 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 DIV 3, ~ (2 DIV 3), (~ 2) DIV 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 MOD 3, ~ (2 MOD 3), (~ 2) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 MOD 3, ~ (2 MOD 3), (~ 2) MOD 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 % 3, ~ (2 % 3), (~ 2) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 % 3, ~ (2 % 3), (~ 2) % 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 BETWEEN 1 AND 3, ~ (2 BETWEEN 1 AND 3), (~ 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 BETWEEN 1 AND 3, ~ (2 BETWEEN 1 AND 3), (~ 2) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select charset(! 2 COLLATE latin1_bin), charset(! (2 COLLATE latin1_bin)), charset((! 2) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(! 2 COLLATE latin1_bin), charset(! (2 COLLATE latin1_bin)), charset((! 2) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select ! 2 IN (0,2), ! (2 IN (0,2)), (! 2) IN (0,2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 IN (0,2), ! (2 IN (0,2)), (! 2) IN (0,2) union select * from v1;
+
+create or replace view v1 as select ! 2 OR 3, ! (2 OR 3), (! 2) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 OR 3, ! (2 OR 3), (! 2) OR 3 union select * from v1;
+
+create or replace view v1 as select ! 2 || 3, ! (2 || 3), (! 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 || 3, ! (2 || 3), (! 2) || 3 union select * from v1;
+
+create or replace view v1 as select ! 2 AND 0, ! (2 AND 0), (! 2) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 AND 0, ! (2 AND 0), (! 2) AND 0 union select * from v1;
+
+create or replace view v1 as select ! 2 && 0, ! (2 && 0), (! 2) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 && 0, ! (2 && 0), (! 2) && 0 union select * from v1;
+
+create or replace view v1 as select ! 2 = 3, ! (2 = 3), (! 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 = 3, ! (2 = 3), (! 2) = 3 union select * from v1;
+
+create or replace view v1 as select ! 2 <=> 3, ! (2 <=> 3), (! 2) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 <=> 3, ! (2 <=> 3), (! 2) <=> 3 union select * from v1;
+
+create or replace view v1 as select ! 2 >= 3, ! (2 >= 3), (! 2) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 >= 3, ! (2 >= 3), (! 2) >= 3 union select * from v1;
+
+create or replace view v1 as select ! 2 <= 3, ! (2 <= 3), (! 2) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 <= 3, ! (2 <= 3), (! 2) <= 3 union select * from v1;
+
+create or replace view v1 as select ! 2 < 3, ! (2 < 3), (! 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 < 3, ! (2 < 3), (! 2) < 3 union select * from v1;
+
+create or replace view v1 as select ! 2 <> 3, ! (2 <> 3), (! 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 <> 3, ! (2 <> 3), (! 2) <> 3 union select * from v1;
+
+create or replace view v1 as select ! 2 > 3, ! (2 > 3), (! 2) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 > 3, ! (2 > 3), (! 2) > 3 union select * from v1;
+
+create or replace view v1 as select ! 2 != 3, ! (2 != 3), (! 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 != 3, ! (2 != 3), (! 2) != 3 union select * from v1;
+
+create or replace view v1 as select ! 2 LIKE 3, ! (2 LIKE 3), (! 2) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 LIKE 3, ! (2 LIKE 3), (! 2) LIKE 3 union select * from v1;
+
+create or replace view v1 as select ! 2 REGEXP 3, ! (2 REGEXP 3), (! 2) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 REGEXP 3, ! (2 REGEXP 3), (! 2) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select ! 2 | 3, ! (2 | 3), (! 2) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 | 3, ! (2 | 3), (! 2) | 3 union select * from v1;
+
+create or replace view v1 as select ! 2 & 0, ! (2 & 0), (! 2) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 & 0, ! (2 & 0), (! 2) & 0 union select * from v1;
+
+create or replace view v1 as select ! 0 << 3, ! (0 << 3), (! 0) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 0 << 3, ! (0 << 3), (! 0) << 3 union select * from v1;
+
+create or replace view v1 as select ! 2 >> 3, ! (2 >> 3), (! 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 >> 3, ! (2 >> 3), (! 2) >> 3 union select * from v1;
+
+create or replace view v1 as select ! '2000-01-01' +INTERVAL 1 DAY, ! ('2000-01-01' +INTERVAL 1 DAY), (! '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! '2000-01-01' +INTERVAL 1 DAY, ! ('2000-01-01' +INTERVAL 1 DAY), (! '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select ! 2 + 3, ! (2 + 3), (! 2) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 + 3, ! (2 + 3), (! 2) + 3 union select * from v1;
+
+create or replace view v1 as select ! 2 - 3, ! (2 - 3), (! 2) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 - 3, ! (2 - 3), (! 2) - 3 union select * from v1;
+
+create or replace view v1 as select ! 0 * 3, ! (0 * 3), (! 0) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 0 * 3, ! (0 * 3), (! 0) * 3 union select * from v1;
+
+create or replace view v1 as select ! 0 / 3, ! (0 / 3), (! 0) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 0 / 3, ! (0 / 3), (! 0) / 3 union select * from v1;
+
+create or replace view v1 as select ! 2 DIV 3, ! (2 DIV 3), (! 2) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 DIV 3, ! (2 DIV 3), (! 2) DIV 3 union select * from v1;
+
+create or replace view v1 as select ! 6 MOD 3, ! (6 MOD 3), (! 6) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 6 MOD 3, ! (6 MOD 3), (! 6) MOD 3 union select * from v1;
+
+create or replace view v1 as select ! 6 % 3, ! (6 % 3), (! 6) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 6 % 3, ! (6 % 3), (! 6) % 3 union select * from v1;
+
+create or replace view v1 as select ! 2 ^ 3, ! (2 ^ 3), (! 2) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 ^ 3, ! (2 ^ 3), (! 2) ^ 3 union select * from v1;
+
+create or replace view v1 as select ! 2 BETWEEN 3 AND 4, ! (2 BETWEEN 3 AND 4), (! 2) BETWEEN 3 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 BETWEEN 3 AND 4, ! (2 BETWEEN 3 AND 4), (! 2) BETWEEN 3 AND 4 union select * from v1;
+
+create or replace view v1 as select CHARSET(BINARY '2' COLLATE latin1_bin), CHARSET(BINARY ('2' COLLATE latin1_bin)), 'error'/*CHARSET((BINARY '2') COLLATE latin1_bin)*/;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select CHARSET(BINARY '2' COLLATE latin1_bin), CHARSET(BINARY ('2' COLLATE latin1_bin)), 'error'/*CHARSET((BINARY '2') COLLATE latin1_bin)*/ union select * from v1;
+
+create or replace view v1 as select BINARY 'c' IN ('C','X'), BINARY ('c' IN ('C','X')), (BINARY 'c') IN ('C','X');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' IN ('C','X'), BINARY ('c' IN ('C','X')), (BINARY 'c') IN ('C','X') union select * from v1;
+
+create or replace view v1 as select BINARY 'c' = 'C', BINARY ('c' = 'C'), (BINARY 'c') = 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' = 'C', BINARY ('c' = 'C'), (BINARY 'c') = 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' <=> 'C', BINARY ('c' <=> 'C'), (BINARY 'c') <=> 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' <=> 'C', BINARY ('c' <=> 'C'), (BINARY 'c') <=> 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' >= 'D', BINARY ('c' >= 'D'), (BINARY 'c') >= 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' >= 'D', BINARY ('c' >= 'D'), (BINARY 'c') >= 'D' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' <= 'C', BINARY ('c' <= 'C'), (BINARY 'c') <= 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' <= 'C', BINARY ('c' <= 'C'), (BINARY 'c') <= 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' < 'D', BINARY ('c' < 'D'), (BINARY 'c') < 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' < 'D', BINARY ('c' < 'D'), (BINARY 'c') < 'D' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' <> 'C', BINARY ('c' <> 'C'), (BINARY 'c') <> 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' <> 'C', BINARY ('c' <> 'C'), (BINARY 'c') <> 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' > 'C', BINARY ('c' > 'C'), (BINARY 'c') > 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' > 'C', BINARY ('c' > 'C'), (BINARY 'c') > 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' != 'C', BINARY ('c' != 'C'), (BINARY 'c') != 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' != 'C', BINARY ('c' != 'C'), (BINARY 'c') != 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' LIKE 'C', BINARY ('c' LIKE 'C'), (BINARY 'c') LIKE 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' LIKE 'C', BINARY ('c' LIKE 'C'), (BINARY 'c') LIKE 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' REGEXP 'C', BINARY ('c' REGEXP 'C'), (BINARY 'c') REGEXP 'C';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' REGEXP 'C', BINARY ('c' REGEXP 'C'), (BINARY 'c') REGEXP 'C' union select * from v1;
+
+create or replace view v1 as select BINARY 'c' BETWEEN 'A' AND 'D', BINARY ('c' BETWEEN 'A' AND 'D'), (BINARY 'c') BETWEEN 'A' AND 'D';
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' BETWEEN 'A' AND 'D', BINARY ('c' BETWEEN 'A' AND 'D'), (BINARY 'c') BETWEEN 'A' AND 'D' union select * from v1;
+
+create or replace view v1 as select 2 OR 3 IS FALSE, 2 OR (3 IS FALSE), (2 OR 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 IS FALSE, 2 OR (3 IS FALSE), (2 OR 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 OR 3 COLLATE latin1_bin), charset(2 OR (3 COLLATE latin1_bin)), charset((2 OR 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 OR 3 COLLATE latin1_bin), charset(2 OR (3 COLLATE latin1_bin)), charset((2 OR 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 0 OR 3 IN (3,10), 0 OR (3 IN (3,10)), (0 OR 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 IN (3,10), 0 OR (3 IN (3,10)), (0 OR 3) IN (3,10) union select * from v1;
+
+create or replace view v1 as select 1 OR 0 XOR 1, 1 OR (0 XOR 1), (1 OR 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 OR 0 XOR 1, 1 OR (0 XOR 1), (1 OR 0) XOR 1 union select * from v1;
+
+create or replace view v1 as select 1 OR 1 AND 0, 1 OR (1 AND 0), (1 OR 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 OR 1 AND 0, 1 OR (1 AND 0), (1 OR 1) AND 0 union select * from v1;
+
+create or replace view v1 as select 1 OR 1 && 0, 1 OR (1 && 0), (1 OR 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 OR 1 && 0, 1 OR (1 && 0), (1 OR 1) && 0 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 = 3, 2 OR (3 = 3), (2 OR 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 = 3, 2 OR (3 = 3), (2 OR 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 <=> 3, 2 OR (3 <=> 3), (2 OR 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 <=> 3, 2 OR (3 <=> 3), (2 OR 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 >= 3, 2 OR (3 >= 3), (2 OR 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 >= 3, 2 OR (3 >= 3), (2 OR 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 <= 0, 2 OR (3 <= 0), (2 OR 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 <= 0, 2 OR (3 <= 0), (2 OR 3) <= 0 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 < 0, 2 OR (3 < 0), (2 OR 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 < 0, 2 OR (3 < 0), (2 OR 3) < 0 union select * from v1;
+
+create or replace view v1 as select 0 OR 3 <> 3, 0 OR (3 <> 3), (0 OR 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 <> 3, 0 OR (3 <> 3), (0 OR 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 > 3, 2 OR (3 > 3), (2 OR 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 > 3, 2 OR (3 > 3), (2 OR 3) > 3 union select * from v1;
+
+create or replace view v1 as select 0 OR 3 != 3, 0 OR (3 != 3), (0 OR 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 != 3, 0 OR (3 != 3), (0 OR 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 LIKE 3, 2 OR (3 LIKE 3), (2 OR 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 LIKE 3, 2 OR (3 LIKE 3), (2 OR 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 REGEXP 3, 2 OR (3 REGEXP 3), (2 OR 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 REGEXP 3, 2 OR (3 REGEXP 3), (2 OR 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 | 3, 2 OR (3 | 3), (2 OR 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 | 3, 2 OR (3 | 3), (2 OR 3) | 3 union select * from v1;
+
+create or replace view v1 as select 0 OR 2 & 2, 0 OR (2 & 2), (0 OR 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 2 & 2, 0 OR (2 & 2), (0 OR 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 << 3, 2 OR (3 << 3), (2 OR 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 << 3, 2 OR (3 << 3), (2 OR 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 >> 3, 2 OR (3 >> 3), (2 OR 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 >> 3, 2 OR (3 >> 3), (2 OR 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 OR '2000-01-01' +INTERVAL 1 DAY, 2 OR ('2000-01-01' +INTERVAL 1 DAY), (2 OR '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR '2000-01-01' +INTERVAL 1 DAY, 2 OR ('2000-01-01' +INTERVAL 1 DAY), (2 OR '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 OR 3 + 3, 2 OR (3 + 3), (2 OR 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 + 3, 2 OR (3 + 3), (2 OR 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 - 3, 2 OR (3 - 3), (2 OR 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 - 3, 2 OR (3 - 3), (2 OR 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 * 3, 2 OR (3 * 3), (2 OR 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 * 3, 2 OR (3 * 3), (2 OR 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 / 3, 2 OR (3 / 3), (2 OR 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 / 3, 2 OR (3 / 3), (2 OR 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 DIV 3, 2 OR (3 DIV 3), (2 OR 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 DIV 3, 2 OR (3 DIV 3), (2 OR 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 0 OR 3 MOD 3, 0 OR (3 MOD 3), (0 OR 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 MOD 3, 0 OR (3 MOD 3), (0 OR 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 0 OR 3 % 3, 0 OR (3 % 3), (0 OR 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 % 3, 0 OR (3 % 3), (0 OR 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 ^ 3, 2 OR (3 ^ 3), (2 OR 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 ^ 3, 2 OR (3 ^ 3), (2 OR 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 OR 3 BETWEEN 2 AND 3, 2 OR (3 BETWEEN 2 AND 3), (2 OR 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 BETWEEN 2 AND 3, 2 OR (3 BETWEEN 2 AND 3), (2 OR 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 || 3 COLLATE latin1_bin), charset(2 || (3 COLLATE latin1_bin)), charset((2 || 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 || 3 COLLATE latin1_bin), charset(2 || (3 COLLATE latin1_bin)), charset((2 || 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10) union select * from v1;
+
+create or replace view v1 as select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1 union select * from v1;
+
+create or replace view v1 as select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0 union select * from v1;
+
+create or replace view v1 as select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0 union select * from v1;
+
+create or replace view v1 as select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0 union select * from v1;
+
+create or replace view v1 as select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0 union select * from v1;
+
+create or replace view v1 as select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 | 3, 2 || (3 | 3), (2 || 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 | 3, 2 || (3 | 3), (2 || 3) | 3 union select * from v1;
+
+create or replace view v1 as select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 || 3 + 3, 2 || (3 + 3), (2 || 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 + 3, 2 || (3 + 3), (2 || 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 - 3, 2 || (3 - 3), (2 || 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 - 3, 2 || (3 - 3), (2 || 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 ^ 3, 2 || (3 ^ 3), (2 || 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 ^ 3, 2 || (3 ^ 3), (2 || 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select charset(2 XOR 3 COLLATE latin1_bin), charset(2 XOR (3 COLLATE latin1_bin)), charset((2 XOR 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 XOR 3 COLLATE latin1_bin), charset(2 XOR (3 COLLATE latin1_bin)), charset((2 XOR 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 IN (4,5), 2 XOR (3 IN (4,5)), (2 XOR 3) IN (4,5);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 IN (4,5), 2 XOR (3 IN (4,5)), (2 XOR 3) IN (4,5) union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 OR 3, 2 XOR (3 OR 3), (2 XOR 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 OR 3, 2 XOR (3 OR 3), (2 XOR 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 0 AND 0, 2 XOR (0 AND 0), (2 XOR 0) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 0 AND 0, 2 XOR (0 AND 0), (2 XOR 0) AND 0 union select * from v1;
+
+create or replace view v1 as select 2 XOR 0 && 0, 2 XOR (0 && 0), (2 XOR 0) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 0 && 0, 2 XOR (0 && 0), (2 XOR 0) && 0 union select * from v1;
+
+create or replace view v1 as select 2 XOR 2 = 3, 2 XOR (2 = 3), (2 XOR 2) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 2 = 3, 2 XOR (2 = 3), (2 XOR 2) = 3 union select * from v1;
+
+create or replace view v1 as select NULL XOR 3 <=> 3, NULL XOR (3 <=> 3), (NULL XOR 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NULL XOR 3 <=> 3, NULL XOR (3 <=> 3), (NULL XOR 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 1 >= 3, 2 XOR (1 >= 3), (2 XOR 1) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 1 >= 3, 2 XOR (1 >= 3), (2 XOR 1) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 <= 3, 2 XOR (3 <= 3), (2 XOR 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 <= 3, 2 XOR (3 <= 3), (2 XOR 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 1 < 3, 2 XOR (1 < 3), (2 XOR 1) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 1 < 3, 2 XOR (1 < 3), (2 XOR 1) < 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 2 <> 3, 2 XOR (2 <> 3), (2 XOR 2) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 2 <> 3, 2 XOR (2 <> 3), (2 XOR 2) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 > 3, 2 XOR (3 > 3), (2 XOR 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 > 3, 2 XOR (3 > 3), (2 XOR 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 2 != 3, 2 XOR (2 != 3), (2 XOR 2) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 2 != 3, 2 XOR (2 != 3), (2 XOR 2) != 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 1 LIKE 3, 2 XOR (1 LIKE 3), (2 XOR 1) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 1 LIKE 3, 2 XOR (1 LIKE 3), (2 XOR 1) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 1 REGEXP 3, 2 XOR (1 REGEXP 3), (2 XOR 1) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 1 REGEXP 3, 2 XOR (1 REGEXP 3), (2 XOR 1) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 | 3, 2 XOR (3 | 3), (2 XOR 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 | 3, 2 XOR (3 | 3), (2 XOR 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 0 & 0, 2 XOR (0 & 0), (2 XOR 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 0 & 0, 2 XOR (0 & 0), (2 XOR 0) & 0 union select * from v1;
+
+create or replace view v1 as select 0 XOR 3 << 3, 0 XOR (3 << 3), (0 XOR 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 XOR 3 << 3, 0 XOR (3 << 3), (0 XOR 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 >> 3, 2 XOR (3 >> 3), (2 XOR 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 >> 3, 2 XOR (3 >> 3), (2 XOR 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR '2000-01-01' +INTERVAL 1 DAY, 2 XOR ('2000-01-01' +INTERVAL 1 DAY), (2 XOR '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR '2000-01-01' +INTERVAL 1 DAY, 2 XOR ('2000-01-01' +INTERVAL 1 DAY), (2 XOR '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 + 3, 2 XOR (3 + 3), (2 XOR 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 + 3, 2 XOR (3 + 3), (2 XOR 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 - 3, 2 XOR (3 - 3), (2 XOR 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 - 3, 2 XOR (3 - 3), (2 XOR 3) - 3 union select * from v1;
+
+create or replace view v1 as select 0 XOR 3 * 3, 0 XOR (3 * 3), (0 XOR 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 XOR 3 * 3, 0 XOR (3 * 3), (0 XOR 3) * 3 union select * from v1;
+
+create or replace view v1 as select 0 XOR 3 / 3, 0 XOR (3 / 3), (0 XOR 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 XOR 3 / 3, 0 XOR (3 / 3), (0 XOR 3) / 3 union select * from v1;
+
+create or replace view v1 as select 0 XOR 3 DIV 3, 0 XOR (3 DIV 3), (0 XOR 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 XOR 3 DIV 3, 0 XOR (3 DIV 3), (0 XOR 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 MOD 3, 2 XOR (3 MOD 3), (2 XOR 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 MOD 3, 2 XOR (3 MOD 3), (2 XOR 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 % 3, 2 XOR (3 % 3), (2 XOR 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 % 3, 2 XOR (3 % 3), (2 XOR 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 ^ 3, 2 XOR (3 ^ 3), (2 XOR 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 ^ 3, 2 XOR (3 ^ 3), (2 XOR 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 BETWEEN 0 AND 3, 2 XOR (3 BETWEEN 0 AND 3), (2 XOR 3) BETWEEN 0 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 BETWEEN 0 AND 3, 2 XOR (3 BETWEEN 0 AND 3), (2 XOR 3) BETWEEN 0 AND 3 union select * from v1;
+
+create or replace view v1 as select 0 AND 3 IS FALSE, 0 AND (3 IS FALSE), (0 AND 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 AND 3 IS FALSE, 0 AND (3 IS FALSE), (0 AND 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 AND 3 COLLATE latin1_bin), charset(2 AND (3 COLLATE latin1_bin)), charset((2 AND 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 AND 3 COLLATE latin1_bin), charset(2 AND (3 COLLATE latin1_bin)), charset((2 AND 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 AND 3 IN (0,1), 2 AND (3 IN (0,1)), (2 AND 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 IN (0,1), 2 AND (3 IN (0,1)), (2 AND 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 0 AND 3 OR 3, 0 AND (3 OR 3), (0 AND 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 AND 3 OR 3, 0 AND (3 OR 3), (0 AND 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3 union select * from v1;
+
+create or replace view v1 as select 0 AND 3 XOR 3, 0 AND (3 XOR 3), (0 AND 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 AND 3 XOR 3, 0 AND (3 XOR 3), (0 AND 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 = 3, 2 AND (3 = 3), (2 AND 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 = 3, 2 AND (3 = 3), (2 AND 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 <=> 3, 2 AND (3 <=> 3), (2 AND 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 <=> 3, 2 AND (3 <=> 3), (2 AND 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 >= 3, 2 AND (3 >= 3), (2 AND 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 >= 3, 2 AND (3 >= 3), (2 AND 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 4 <= 3, 2 AND (4 <= 3), (2 AND 4) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 4 <= 3, 2 AND (4 <= 3), (2 AND 4) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 < 3, 2 AND (3 < 3), (2 AND 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 < 3, 2 AND (3 < 3), (2 AND 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 <> 3, 2 AND (3 <> 3), (2 AND 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 <> 3, 2 AND (3 <> 3), (2 AND 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 > 1, 2 AND (3 > 1), (2 AND 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 > 1, 2 AND (3 > 1), (2 AND 3) > 1 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 != 3, 2 AND (3 != 3), (2 AND 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 != 3, 2 AND (3 != 3), (2 AND 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 LIKE 3, 2 AND (3 LIKE 3), (2 AND 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 LIKE 3, 2 AND (3 LIKE 3), (2 AND 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 REGEXP 3, 2 AND (3 REGEXP 3), (2 AND 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 REGEXP 3, 2 AND (3 REGEXP 3), (2 AND 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 | 3, 2 AND (3 | 3), (2 AND 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 | 3, 2 AND (3 | 3), (2 AND 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 2 & 2, 2 AND (2 & 2), (2 AND 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 2 & 2, 2 AND (2 & 2), (2 AND 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 << 3, 2 AND (3 << 3), (2 AND 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 << 3, 2 AND (3 << 3), (2 AND 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 >> 1, 2 AND (3 >> 1), (2 AND 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 >> 1, 2 AND (3 >> 1), (2 AND 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 AND '2000-01-01' +INTERVAL 1 DAY, 2 AND ('2000-01-01' +INTERVAL 1 DAY), (2 AND '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND '2000-01-01' +INTERVAL 1 DAY, 2 AND ('2000-01-01' +INTERVAL 1 DAY), (2 AND '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 AND 3 + 3, 2 AND (3 + 3), (2 AND 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 + 3, 2 AND (3 + 3), (2 AND 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 - 3, 2 AND (3 - 3), (2 AND 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 - 3, 2 AND (3 - 3), (2 AND 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 * 3, 2 AND (3 * 3), (2 AND 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 * 3, 2 AND (3 * 3), (2 AND 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 / 3, 2 AND (3 / 3), (2 AND 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 / 3, 2 AND (3 / 3), (2 AND 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 DIV 3, 2 AND (3 DIV 3), (2 AND 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 DIV 3, 2 AND (3 DIV 3), (2 AND 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 MOD 3, 2 AND (3 MOD 3), (2 AND 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 MOD 3, 2 AND (3 MOD 3), (2 AND 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 % 3, 2 AND (3 % 3), (2 AND 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 % 3, 2 AND (3 % 3), (2 AND 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 ^ 3, 2 AND (3 ^ 3), (2 AND 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 ^ 3, 2 AND (3 ^ 3), (2 AND 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 AND 3 BETWEEN 2 AND 3, 2 AND (3 BETWEEN 2 AND 3), (2 AND 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 BETWEEN 2 AND 3, 2 AND (3 BETWEEN 2 AND 3), (2 AND 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 0 && 3 IS FALSE, 0 && (3 IS FALSE), (0 && 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 && 3 IS FALSE, 0 && (3 IS FALSE), (0 && 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 && 3 COLLATE latin1_bin), charset(2 && (3 COLLATE latin1_bin)), charset((2 && 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 && 3 COLLATE latin1_bin), charset(2 && (3 COLLATE latin1_bin)), charset((2 && 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 && 3 IN (0,1), 2 && (3 IN (0,1)), (2 && 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 IN (0,1), 2 && (3 IN (0,1)), (2 && 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 0 && 3 OR 3, 0 && (3 OR 3), (0 && 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 && 3 OR 3, 0 && (3 OR 3), (0 && 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3 union select * from v1;
+
+create or replace view v1 as select 0 && 3 XOR 3, 0 && (3 XOR 3), (0 && 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 && 3 XOR 3, 0 && (3 XOR 3), (0 && 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 = 3, 2 && (3 = 3), (2 && 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 = 3, 2 && (3 = 3), (2 && 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 <=> 3, 2 && (3 <=> 3), (2 && 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 <=> 3, 2 && (3 <=> 3), (2 && 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 >= 3, 2 && (3 >= 3), (2 && 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 >= 3, 2 && (3 >= 3), (2 && 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 && 4 <= 3, 2 && (4 <= 3), (2 && 4) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 4 <= 3, 2 && (4 <= 3), (2 && 4) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 < 3, 2 && (3 < 3), (2 && 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 < 3, 2 && (3 < 3), (2 && 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 <> 3, 2 && (3 <> 3), (2 && 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 <> 3, 2 && (3 <> 3), (2 && 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 > 1, 2 && (3 > 1), (2 && 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 > 1, 2 && (3 > 1), (2 && 3) > 1 union select * from v1;
+
+create or replace view v1 as select 2 && 3 != 3, 2 && (3 != 3), (2 && 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 != 3, 2 && (3 != 3), (2 && 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 LIKE 3, 2 && (3 LIKE 3), (2 && 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 LIKE 3, 2 && (3 LIKE 3), (2 && 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 REGEXP 3, 2 && (3 REGEXP 3), (2 && 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 REGEXP 3, 2 && (3 REGEXP 3), (2 && 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 | 3, 2 && (3 | 3), (2 && 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 | 3, 2 && (3 | 3), (2 && 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 && 2 & 2, 2 && (2 & 2), (2 && 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 2 & 2, 2 && (2 & 2), (2 && 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 && 3 << 3, 2 && (3 << 3), (2 && 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 << 3, 2 && (3 << 3), (2 && 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 >> 1, 2 && (3 >> 1), (2 && 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 >> 1, 2 && (3 >> 1), (2 && 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 && '2000-01-01' +INTERVAL 1 DAY, 2 && ('2000-01-01' +INTERVAL 1 DAY), (2 && '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && '2000-01-01' +INTERVAL 1 DAY, 2 && ('2000-01-01' +INTERVAL 1 DAY), (2 && '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 && 3 + 3, 2 && (3 + 3), (2 && 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 + 3, 2 && (3 + 3), (2 && 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 - 3, 2 && (3 - 3), (2 && 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 - 3, 2 && (3 - 3), (2 && 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 * 3, 2 && (3 * 3), (2 && 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 * 3, 2 && (3 * 3), (2 && 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 / 3, 2 && (3 / 3), (2 && 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 / 3, 2 && (3 / 3), (2 && 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 DIV 3, 2 && (3 DIV 3), (2 && 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 DIV 3, 2 && (3 DIV 3), (2 && 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 MOD 3, 2 && (3 MOD 3), (2 && 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 MOD 3, 2 && (3 MOD 3), (2 && 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 % 3, 2 && (3 % 3), (2 && 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 % 3, 2 && (3 % 3), (2 && 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 ^ 3, 2 && (3 ^ 3), (2 && 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 ^ 3, 2 && (3 ^ 3), (2 && 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 && 3 BETWEEN 2 AND 3, 2 && (3 BETWEEN 2 AND 3), (2 && 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 BETWEEN 2 AND 3, 2 && (3 BETWEEN 2 AND 3), (2 && 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 IS FALSE, 2 = (3 IS FALSE), (2 = 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 IS FALSE, 2 = (3 IS FALSE), (2 = 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 = 3 COLLATE latin1_bin), charset(2 = (3 COLLATE latin1_bin)), charset((2 = 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 = 3 COLLATE latin1_bin), charset(2 = (3 COLLATE latin1_bin)), charset((2 = 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 = 3 IN (0,1), 2 = (3 IN (0,1)), (2 = 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 IN (0,1), 2 = (3 IN (0,1)), (2 = 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 = 3 OR 3, 2 = (3 OR 3), (2 = 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 OR 3, 2 = (3 OR 3), (2 = 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 XOR 3, 2 = (3 XOR 3), (2 = 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 XOR 3, 2 = (3 XOR 3), (2 = 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 = 2 AND 2, 2 = (2 AND 2), (2 = 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 2 AND 2, 2 = (2 AND 2), (2 = 2) AND 2 union select * from v1;
+
+create or replace view v1 as select 2 = 2 && 2, 2 = (2 && 2), (2 = 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 2 && 2, 2 = (2 && 2), (2 = 2) && 2 union select * from v1;
+
+create or replace view v1 as select 1 = 3 = 3, 1 = (3 = 3), (1 = 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 = 3, 1 = (3 = 3), (1 = 3) = 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 <=> 3, 1 = (3 <=> 3), (1 = 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 <=> 3, 1 = (3 <=> 3), (1 = 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 >= 3, 1 = (3 >= 3), (1 = 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 >= 3, 1 = (3 >= 3), (1 = 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 <= 3, 2 = (3 <= 3), (2 = 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 <= 3, 2 = (3 <= 3), (2 = 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 < 3, 2 = (3 < 3), (2 = 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 < 3, 2 = (3 < 3), (2 = 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 <> 3, 2 = (3 <> 3), (2 = 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 <> 3, 2 = (3 <> 3), (2 = 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 0 = 3 > 3, 0 = (3 > 3), (0 = 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 = 3 > 3, 0 = (3 > 3), (0 = 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 != 3, 2 = (3 != 3), (2 = 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 != 3, 2 = (3 != 3), (2 = 3) != 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 LIKE 3, 1 = (3 LIKE 3), (1 = 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 LIKE 3, 1 = (3 LIKE 3), (1 = 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 REGEXP 3, 1 = (3 REGEXP 3), (1 = 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 REGEXP 3, 1 = (3 REGEXP 3), (1 = 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 | 3, 2 = (3 | 3), (2 = 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 | 3, 2 = (3 | 3), (2 = 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 & 2, 2 = (3 & 2), (2 = 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 & 2, 2 = (3 & 2), (2 = 3) & 2 union select * from v1;
+
+create or replace view v1 as select 3 = 3 << 3, 3 = (3 << 3), (3 = 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 3 << 3, 3 = (3 << 3), (3 = 3) << 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 >> 1, 1 = (3 >> 1), (1 = 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 >> 1, 1 = (3 >> 1), (1 = 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 = '2000-01-01' +INTERVAL 1 DAY, 2 = ('2000-01-01' +INTERVAL 1 DAY), (2 = '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = '2000-01-01' +INTERVAL 1 DAY, 2 = ('2000-01-01' +INTERVAL 1 DAY), (2 = '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 = 3 + 3, 2 = (3 + 3), (2 = 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 + 3, 2 = (3 + 3), (2 = 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 - 3, 2 = (3 - 3), (2 = 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 - 3, 2 = (3 - 3), (2 = 3) - 3 union select * from v1;
+
+create or replace view v1 as select 3 = 3 * 3, 3 = (3 * 3), (3 = 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 3 * 3, 3 = (3 * 3), (3 = 3) * 3 union select * from v1;
+
+create or replace view v1 as select 3 = 9 / 3, 3 = (9 / 3), (3 = 9) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 9 / 3, 3 = (9 / 3), (3 = 9) / 3 union select * from v1;
+
+create or replace view v1 as select 3 = 9 DIV 3, 3 = (9 DIV 3), (3 = 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 9 DIV 3, 3 = (9 DIV 3), (3 = 9) DIV 3 union select * from v1;
+
+create or replace view v1 as select 3 = 3 MOD 3, 3 = (3 MOD 3), (3 = 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 3 MOD 3, 3 = (3 MOD 3), (3 = 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 3 = 3 % 3, 3 = (3 % 3), (3 = 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 = 3 % 3, 3 = (3 % 3), (3 = 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 ^ 3, 2 = (3 ^ 3), (2 = 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 ^ 3, 2 = (3 ^ 3), (2 = 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 1 = 3 BETWEEN 1 AND 3, 1 = (3 BETWEEN 1 AND 3), (1 = 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 = 3 BETWEEN 1 AND 3, 1 = (3 BETWEEN 1 AND 3), (1 = 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 IS FALSE, 2 <=> (3 IS FALSE), (2 <=> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 IS FALSE, 2 <=> (3 IS FALSE), (2 <=> 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 <=> 3 COLLATE latin1_bin), charset(2 <=> (3 COLLATE latin1_bin)), charset((2 <=> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 <=> 3 COLLATE latin1_bin), charset(2 <=> (3 COLLATE latin1_bin)), charset((2 <=> 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 IN (0,1), 2 <=> (3 IN (0,1)), (2 <=> 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 IN (0,1), 2 <=> (3 IN (0,1)), (2 <=> 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 OR 3, 2 <=> (3 OR 3), (2 <=> 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 OR 3, 2 <=> (3 OR 3), (2 <=> 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 XOR 3, 2 <=> (3 XOR 3), (2 <=> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 XOR 3, 2 <=> (3 XOR 3), (2 <=> 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 2 AND 2, 2 <=> (2 AND 2), (2 <=> 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 2 AND 2, 2 <=> (2 AND 2), (2 <=> 2) AND 2 union select * from v1;
+
+create or replace view v1 as select 2 <=> 2 && 2, 2 <=> (2 && 2), (2 <=> 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 2 && 2, 2 <=> (2 && 2), (2 <=> 2) && 2 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 = 3, 1 <=> (3 = 3), (1 <=> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 = 3, 1 <=> (3 = 3), (1 <=> 3) = 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 <=> 3, 1 <=> (3 <=> 3), (1 <=> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 <=> 3, 1 <=> (3 <=> 3), (1 <=> 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 >= 3, 1 <=> (3 >= 3), (1 <=> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 >= 3, 1 <=> (3 >= 3), (1 <=> 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 <= 3, 2 <=> (3 <= 3), (2 <=> 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 <= 3, 2 <=> (3 <= 3), (2 <=> 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 < 3, 2 <=> (3 < 3), (2 <=> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 < 3, 2 <=> (3 < 3), (2 <=> 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 <> 3, 2 <=> (3 <> 3), (2 <=> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 <> 3, 2 <=> (3 <> 3), (2 <=> 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 0 <=> 3 > 3, 0 <=> (3 > 3), (0 <=> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 <=> 3 > 3, 0 <=> (3 > 3), (0 <=> 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 != 3, 2 <=> (3 != 3), (2 <=> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 != 3, 2 <=> (3 != 3), (2 <=> 3) != 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 LIKE 3, 1 <=> (3 LIKE 3), (1 <=> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 LIKE 3, 1 <=> (3 LIKE 3), (1 <=> 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 REGEXP 3, 1 <=> (3 REGEXP 3), (1 <=> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 REGEXP 3, 1 <=> (3 REGEXP 3), (1 <=> 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 | 3, 2 <=> (3 | 3), (2 <=> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 | 3, 2 <=> (3 | 3), (2 <=> 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 & 2, 2 <=> (3 & 2), (2 <=> 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 & 2, 2 <=> (3 & 2), (2 <=> 3) & 2 union select * from v1;
+
+create or replace view v1 as select 3 <=> 3 << 3, 3 <=> (3 << 3), (3 <=> 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 3 << 3, 3 <=> (3 << 3), (3 <=> 3) << 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 >> 1, 1 <=> (3 >> 1), (1 <=> 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 >> 1, 1 <=> (3 >> 1), (1 <=> 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 <=> '2000-01-01' +INTERVAL 1 DAY, 2 <=> ('2000-01-01' +INTERVAL 1 DAY), (2 <=> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> '2000-01-01' +INTERVAL 1 DAY, 2 <=> ('2000-01-01' +INTERVAL 1 DAY), (2 <=> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 + 3, 2 <=> (3 + 3), (2 <=> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 + 3, 2 <=> (3 + 3), (2 <=> 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 - 3, 2 <=> (3 - 3), (2 <=> 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 - 3, 2 <=> (3 - 3), (2 <=> 3) - 3 union select * from v1;
+
+create or replace view v1 as select 3 <=> 3 * 3, 3 <=> (3 * 3), (3 <=> 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 3 * 3, 3 <=> (3 * 3), (3 <=> 3) * 3 union select * from v1;
+
+create or replace view v1 as select 3 <=> 9 / 3, 3 <=> (9 / 3), (3 <=> 9) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 9 / 3, 3 <=> (9 / 3), (3 <=> 9) / 3 union select * from v1;
+
+create or replace view v1 as select 3 <=> 9 DIV 3, 3 <=> (9 DIV 3), (3 <=> 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 9 DIV 3, 3 <=> (9 DIV 3), (3 <=> 9) DIV 3 union select * from v1;
+
+create or replace view v1 as select 3 <=> 3 MOD 3, 3 <=> (3 MOD 3), (3 <=> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 3 MOD 3, 3 <=> (3 MOD 3), (3 <=> 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 3 <=> 3 % 3, 3 <=> (3 % 3), (3 <=> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <=> 3 % 3, 3 <=> (3 % 3), (3 <=> 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 ^ 3, 2 <=> (3 ^ 3), (2 <=> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 ^ 3, 2 <=> (3 ^ 3), (2 <=> 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 1 <=> 3 BETWEEN 1 AND 3, 1 <=> (3 BETWEEN 1 AND 3), (1 <=> 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <=> 3 BETWEEN 1 AND 3, 1 <=> (3 BETWEEN 1 AND 3), (1 <=> 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 4 >= 3 IS FALSE, 4 >= (3 IS FALSE), (4 >= 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 >= 3 IS FALSE, 4 >= (3 IS FALSE), (4 >= 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 >= 3 COLLATE latin1_bin), charset(2 >= (3 COLLATE latin1_bin)), charset((2 >= 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 >= 3 COLLATE latin1_bin), charset(2 >= (3 COLLATE latin1_bin)), charset((2 >= 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 >= 3 IN (1,1), 2 >= (3 IN (1,1)), (2 >= 3) IN (1,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 IN (1,1), 2 >= (3 IN (1,1)), (2 >= 3) IN (1,1) union select * from v1;
+
+create or replace view v1 as select 2 >= 3 OR 0, 2 >= (3 OR 0), (2 >= 3) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 OR 0, 2 >= (3 OR 0), (2 >= 3) OR 0 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 XOR 0, 2 >= (3 XOR 0), (2 >= 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 XOR 0, 2 >= (3 XOR 0), (2 >= 3) XOR 0 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 AND 3, 2 >= (3 AND 3), (2 >= 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 AND 3, 2 >= (3 AND 3), (2 >= 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 && 3, 2 >= (3 && 3), (2 >= 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 && 3, 2 >= (3 && 3), (2 >= 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 = 3, 2 >= (3 = 3), (2 >= 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 = 3, 2 >= (3 = 3), (2 >= 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 <=> 3, 2 >= (3 <=> 3), (2 >= 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 <=> 3, 2 >= (3 <=> 3), (2 >= 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 >= 3, 2 >= (3 >= 3), (2 >= 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 >= 3, 2 >= (3 >= 3), (2 >= 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 0 >= 3 <= 3, 0 >= (3 <= 3), (0 >= 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 >= 3 <= 3, 0 >= (3 <= 3), (0 >= 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 0 >= 2 < 3, 0 >= (2 < 3), (0 >= 2) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 >= 2 < 3, 0 >= (2 < 3), (0 >= 2) < 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 <> 0, 2 >= (3 <> 0), (2 >= 3) <> 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 <> 0, 2 >= (3 <> 0), (2 >= 3) <> 0 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 > 3, 2 >= (3 > 3), (2 >= 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 > 3, 2 >= (3 > 3), (2 >= 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 != 0, 2 >= (3 != 0), (2 >= 3) != 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 != 0, 2 >= (3 != 0), (2 >= 3) != 0 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 LIKE 3, 2 >= (3 LIKE 3), (2 >= 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 LIKE 3, 2 >= (3 LIKE 3), (2 >= 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 REGEXP 3, 2 >= (3 REGEXP 3), (2 >= 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 REGEXP 3, 2 >= (3 REGEXP 3), (2 >= 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 | 3, 2 >= (3 | 3), (2 >= 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 | 3, 2 >= (3 | 3), (2 >= 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 & 1, 2 >= (3 & 1), (2 >= 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 & 1, 2 >= (3 & 1), (2 >= 3) & 1 union select * from v1;
+
+create or replace view v1 as select 3 >= 3 << 3, 3 >= (3 << 3), (3 >= 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 >= 3 << 3, 3 >= (3 << 3), (3 >= 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 >> 3, 2 >= (3 >> 3), (2 >= 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 >> 3, 2 >= (3 >> 3), (2 >= 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 >= '2000-01-01' +INTERVAL 1 DAY, 2 >= ('2000-01-01' +INTERVAL 1 DAY), (2 >= '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= '2000-01-01' +INTERVAL 1 DAY, 2 >= ('2000-01-01' +INTERVAL 1 DAY), (2 >= '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 >= 3 + 3, 2 >= (3 + 3), (2 >= 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 + 3, 2 >= (3 + 3), (2 >= 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 - 3, 2 >= (3 - 3), (2 >= 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 - 3, 2 >= (3 - 3), (2 >= 3) - 3 union select * from v1;
+
+create or replace view v1 as select 3 >= 3 * 3, 3 >= (3 * 3), (3 >= 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 >= 3 * 3, 3 >= (3 * 3), (3 >= 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 / 3, 2 >= (3 / 3), (2 >= 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 / 3, 2 >= (3 / 3), (2 >= 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 DIV 3, 2 >= (3 DIV 3), (2 >= 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 DIV 3, 2 >= (3 DIV 3), (2 >= 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 MOD 3, 2 >= (3 MOD 3), (2 >= 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 MOD 3, 2 >= (3 MOD 3), (2 >= 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 % 3, 2 >= (3 % 3), (2 >= 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 % 3, 2 >= (3 % 3), (2 >= 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 ^ 3, 2 >= (3 ^ 3), (2 >= 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 ^ 3, 2 >= (3 ^ 3), (2 >= 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 BETWEEN 1 AND 3, 2 >= (3 BETWEEN 1 AND 3), (2 >= 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 BETWEEN 1 AND 3, 2 >= (3 BETWEEN 1 AND 3), (2 >= 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 1 IS FALSE, 2 <= (1 IS FALSE), (2 <= 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 1 IS FALSE, 2 <= (1 IS FALSE), (2 <= 1) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 <= 3 COLLATE latin1_bin), charset(2 <= (3 COLLATE latin1_bin)), charset((2 <= 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 <= 3 COLLATE latin1_bin), charset(2 <= (3 COLLATE latin1_bin)), charset((2 <= 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 <= 3 IN (0,1), 2 <= (3 IN (0,1)), (2 <= 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 IN (0,1), 2 <= (3 IN (0,1)), (2 <= 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 <= 3 OR 3, 2 <= (3 OR 3), (2 <= 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 OR 3, 2 <= (3 OR 3), (2 <= 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 1 XOR 1, 2 <= (1 XOR 1), (2 <= 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 1 XOR 1, 2 <= (1 XOR 1), (2 <= 1) XOR 1 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 AND 3, 2 <= (3 AND 3), (2 <= 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 AND 3, 2 <= (3 AND 3), (2 <= 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 && 3, 2 <= (3 && 3), (2 <= 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 && 3, 2 <= (3 && 3), (2 <= 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 0 = 0, 2 <= (0 = 0), (2 <= 0) = 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 0 = 0, 2 <= (0 = 0), (2 <= 0) = 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 0 <=> 0, 2 <= (0 <=> 0), (2 <= 0) <=> 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 0 <=> 0, 2 <= (0 <=> 0), (2 <= 0) <=> 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 0 >= 0, 2 <= (0 >= 0), (2 <= 0) >= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 0 >= 0, 2 <= (0 >= 0), (2 <= 0) >= 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 <= 3, 2 <= (3 <= 3), (2 <= 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 <= 3, 2 <= (3 <= 3), (2 <= 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 < 3, 2 <= (3 < 3), (2 <= 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 < 3, 2 <= (3 < 3), (2 <= 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 <> 3, 2 <= (3 <> 3), (2 <= 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 <> 3, 2 <= (3 <> 3), (2 <= 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 > 0, 2 <= (3 > 0), (2 <= 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 > 0, 2 <= (3 > 0), (2 <= 3) > 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 != 3, 2 <= (3 != 3), (2 <= 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 != 3, 2 <= (3 != 3), (2 <= 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 0 LIKE 0, 2 <= (0 LIKE 0), (2 <= 0) LIKE 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 0 LIKE 0, 2 <= (0 LIKE 0), (2 <= 0) LIKE 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 0 REGEXP 0, 2 <= (0 REGEXP 0), (2 <= 0) REGEXP 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 0 REGEXP 0, 2 <= (0 REGEXP 0), (2 <= 0) REGEXP 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 | 3, 2 <= (3 | 3), (2 <= 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 | 3, 2 <= (3 | 3), (2 <= 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 & 2, 2 <= (3 & 2), (2 <= 3) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 & 2, 2 <= (3 & 2), (2 <= 3) & 2 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 << 3, 2 <= (3 << 3), (2 <= 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 << 3, 2 <= (3 << 3), (2 <= 3) << 3 union select * from v1;
+
+create or replace view v1 as select 0 <= 3 >> 1, 0 <= (3 >> 1), (0 <= 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 <= 3 >> 1, 0 <= (3 >> 1), (0 <= 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 <= '2000-01-01' +INTERVAL 1 DAY, 2 <= ('2000-01-01' +INTERVAL 1 DAY), (2 <= '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= '2000-01-01' +INTERVAL 1 DAY, 2 <= ('2000-01-01' +INTERVAL 1 DAY), (2 <= '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 <= 3 + 3, 2 <= (3 + 3), (2 <= 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 + 3, 2 <= (3 + 3), (2 <= 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 - 3, 2 <= (3 - 3), (2 <= 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 - 3, 2 <= (3 - 3), (2 <= 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 * 3, 2 <= (3 * 3), (2 <= 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 * 3, 2 <= (3 * 3), (2 <= 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 / 3, 2 <= (3 / 3), (2 <= 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 / 3, 2 <= (3 / 3), (2 <= 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 9 DIV 3, 2 <= (9 DIV 3), (2 <= 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 9 DIV 3, 2 <= (9 DIV 3), (2 <= 9) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 MOD 3, 2 <= (3 MOD 3), (2 <= 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 MOD 3, 2 <= (3 MOD 3), (2 <= 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 % 3, 2 <= (3 % 3), (2 <= 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 % 3, 2 <= (3 % 3), (2 <= 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 ^ 3, 2 <= (3 ^ 3), (2 <= 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 ^ 3, 2 <= (3 ^ 3), (2 <= 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 BETWEEN 1 AND 3, 2 <= (3 BETWEEN 1 AND 3), (2 <= 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 BETWEEN 1 AND 3, 2 <= (3 BETWEEN 1 AND 3), (2 <= 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 < 1 IS FALSE, 2 < (1 IS FALSE), (2 < 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 1 IS FALSE, 2 < (1 IS FALSE), (2 < 1) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 < 3 COLLATE latin1_bin), charset(2 < (3 COLLATE latin1_bin)), charset((2 < 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 < 3 COLLATE latin1_bin), charset(2 < (3 COLLATE latin1_bin)), charset((2 < 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 < 3 IN (0,1), 2 < (3 IN (0,1)), (2 < 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 IN (0,1), 2 < (3 IN (0,1)), (2 < 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 < 3 OR 3, 2 < (3 OR 3), (2 < 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 OR 3, 2 < (3 OR 3), (2 < 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 XOR 0, 2 < (3 XOR 0), (2 < 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 XOR 0, 2 < (3 XOR 0), (2 < 3) XOR 0 union select * from v1;
+
+create or replace view v1 as select 2 < 3 AND 3, 2 < (3 AND 3), (2 < 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 AND 3, 2 < (3 AND 3), (2 < 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 && 3, 2 < (3 && 3), (2 < 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 && 3, 2 < (3 && 3), (2 < 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 = 1, 2 < (3 = 1), (2 < 3) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 = 1, 2 < (3 = 1), (2 < 3) = 1 union select * from v1;
+
+create or replace view v1 as select 2 < 3 <=> 1, 2 < (3 <=> 1), (2 < 3) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 <=> 1, 2 < (3 <=> 1), (2 < 3) <=> 1 union select * from v1;
+
+create or replace view v1 as select 2 < 3 >= 1, 2 < (3 >= 1), (2 < 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 >= 1, 2 < (3 >= 1), (2 < 3) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 < 3 <= 3, 2 < (3 <= 3), (2 < 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 <= 3, 2 < (3 <= 3), (2 < 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 < 3, 2 < (3 < 3), (2 < 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 < 3, 2 < (3 < 3), (2 < 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 <> 3, 2 < (3 <> 3), (2 < 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 <> 3, 2 < (3 <> 3), (2 < 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 > 0, 2 < (3 > 0), (2 < 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 > 0, 2 < (3 > 0), (2 < 3) > 0 union select * from v1;
+
+create or replace view v1 as select 2 < 3 != 3, 2 < (3 != 3), (2 < 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 != 3, 2 < (3 != 3), (2 < 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 LIKE 1, 2 < (3 LIKE 1), (2 < 3) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 LIKE 1, 2 < (3 LIKE 1), (2 < 3) LIKE 1 union select * from v1;
+
+create or replace view v1 as select 2 < 3 REGEXP 1, 2 < (3 REGEXP 1), (2 < 3) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 REGEXP 1, 2 < (3 REGEXP 1), (2 < 3) REGEXP 1 union select * from v1;
+
+create or replace view v1 as select 2 < 3 | 3, 2 < (3 | 3), (2 < 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 | 3, 2 < (3 | 3), (2 < 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 < 4 & 4, 2 < (4 & 4), (2 < 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 4 & 4, 2 < (4 & 4), (2 < 4) & 4 union select * from v1;
+
+create or replace view v1 as select 2 < 3 << 3, 2 < (3 << 3), (2 < 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 << 3, 2 < (3 << 3), (2 < 3) << 3 union select * from v1;
+
+create or replace view v1 as select 0 < 3 >> 1, 0 < (3 >> 1), (0 < 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 < 3 >> 1, 0 < (3 >> 1), (0 < 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 < '2000-01-01' +INTERVAL 1 DAY, 2 < ('2000-01-01' +INTERVAL 1 DAY), (2 < '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < '2000-01-01' +INTERVAL 1 DAY, 2 < ('2000-01-01' +INTERVAL 1 DAY), (2 < '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 < 3 + 3, 2 < (3 + 3), (2 < 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 + 3, 2 < (3 + 3), (2 < 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 - 3, 2 < (3 - 3), (2 < 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 - 3, 2 < (3 - 3), (2 < 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 * 3, 2 < (3 * 3), (2 < 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 * 3, 2 < (3 * 3), (2 < 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 / 3, 2 < (3 / 3), (2 < 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 / 3, 2 < (3 / 3), (2 < 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 < 9 DIV 3, 2 < (9 DIV 3), (2 < 9) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 9 DIV 3, 2 < (9 DIV 3), (2 < 9) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 MOD 3, 2 < (3 MOD 3), (2 < 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 MOD 3, 2 < (3 MOD 3), (2 < 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 % 3, 2 < (3 % 3), (2 < 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 % 3, 2 < (3 % 3), (2 < 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 ^ 3, 2 < (3 ^ 3), (2 < 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 ^ 3, 2 < (3 ^ 3), (2 < 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 BETWEEN 1 AND 3, 2 < (3 BETWEEN 1 AND 3), (2 < 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 BETWEEN 1 AND 3, 2 < (3 BETWEEN 1 AND 3), (2 < 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 IS FALSE, 2 <> (3 IS FALSE), (2 <> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 IS FALSE, 2 <> (3 IS FALSE), (2 <> 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 <> 3 COLLATE latin1_bin), charset(2 <> (3 COLLATE latin1_bin)), charset((2 <> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 <> 3 COLLATE latin1_bin), charset(2 <> (3 COLLATE latin1_bin)), charset((2 <> 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 <> 3 IN (0,0), 2 <> (3 IN (0,0)), (2 <> 3) IN (0,0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 IN (0,0), 2 <> (3 IN (0,0)), (2 <> 3) IN (0,0) union select * from v1;
+
+create or replace view v1 as select 1 <> 3 OR 3, 1 <> (3 OR 3), (1 <> 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <> 3 OR 3, 1 <> (3 OR 3), (1 <> 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 XOR 3, 2 <> (3 XOR 3), (2 <> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 XOR 3, 2 <> (3 XOR 3), (2 <> 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 3 <> 3 AND 3, 3 <> (3 AND 3), (3 <> 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <> 3 AND 3, 3 <> (3 AND 3), (3 <> 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 3 <> 3 && 3, 3 <> (3 && 3), (3 <> 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <> 3 && 3, 3 <> (3 && 3), (3 <> 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 = 3, 2 <> (3 = 3), (2 <> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 = 3, 2 <> (3 = 3), (2 <> 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 <=> 3, 2 <> (3 <=> 3), (2 <> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 <=> 3, 2 <> (3 <=> 3), (2 <> 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 >= 3, 2 <> (3 >= 3), (2 <> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 >= 3, 2 <> (3 >= 3), (2 <> 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 1 <> 3 <= 3, 1 <> (3 <= 3), (1 <> 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <> 3 <= 3, 1 <> (3 <= 3), (1 <> 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 0 <> 3 < 3, 0 <> (3 < 3), (0 <> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 <> 3 < 3, 0 <> (3 < 3), (0 <> 3) < 3 union select * from v1;
+
+create or replace view v1 as select 0 <> 3 <> 3, 0 <> (3 <> 3), (0 <> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 <> 3 <> 3, 0 <> (3 <> 3), (0 <> 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 > 3, 2 <> (3 > 3), (2 <> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 > 3, 2 <> (3 > 3), (2 <> 3) > 3 union select * from v1;
+
+create or replace view v1 as select 0 <> 3 != 3, 0 <> (3 != 3), (0 <> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 <> 3 != 3, 0 <> (3 != 3), (0 <> 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 LIKE 3, 2 <> (3 LIKE 3), (2 <> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 LIKE 3, 2 <> (3 LIKE 3), (2 <> 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 REGEXP 3, 2 <> (3 REGEXP 3), (2 <> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 REGEXP 3, 2 <> (3 REGEXP 3), (2 <> 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 | 3, 2 <> (3 | 3), (2 <> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 | 3, 2 <> (3 | 3), (2 <> 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 4 & 4, 2 <> (4 & 4), (2 <> 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 4 & 4, 2 <> (4 & 4), (2 <> 4) & 4 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 << 3, 2 <> (3 << 3), (2 <> 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 << 3, 2 <> (3 << 3), (2 <> 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 >> 3, 2 <> (3 >> 3), (2 <> 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 >> 3, 2 <> (3 >> 3), (2 <> 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 <> '2000-01-01' +INTERVAL 1 DAY, 2 <> ('2000-01-01' +INTERVAL 1 DAY), (2 <> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> '2000-01-01' +INTERVAL 1 DAY, 2 <> ('2000-01-01' +INTERVAL 1 DAY), (2 <> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 <> 3 + 3, 2 <> (3 + 3), (2 <> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 + 3, 2 <> (3 + 3), (2 <> 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 - 3, 2 <> (3 - 3), (2 <> 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 - 3, 2 <> (3 - 3), (2 <> 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 * 3, 2 <> (3 * 3), (2 <> 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 * 3, 2 <> (3 * 3), (2 <> 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 / 3, 2 <> (3 / 3), (2 <> 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 / 3, 2 <> (3 / 3), (2 <> 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 DIV 3, 2 <> (3 DIV 3), (2 <> 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 DIV 3, 2 <> (3 DIV 3), (2 <> 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 3 <> 3 MOD 3, 3 <> (3 MOD 3), (3 <> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <> 3 MOD 3, 3 <> (3 MOD 3), (3 <> 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 3 <> 3 % 3, 3 <> (3 % 3), (3 <> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 <> 3 % 3, 3 <> (3 % 3), (3 <> 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 ^ 3, 2 <> (3 ^ 3), (2 <> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 ^ 3, 2 <> (3 ^ 3), (2 <> 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 <> 3 BETWEEN 2 AND 3, 2 <> (3 BETWEEN 2 AND 3), (2 <> 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 BETWEEN 2 AND 3, 2 <> (3 BETWEEN 2 AND 3), (2 <> 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 > 0 IS FALSE, 2 > (0 IS FALSE), (2 > 0) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 0 IS FALSE, 2 > (0 IS FALSE), (2 > 0) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 > 3 COLLATE latin1_bin), charset(2 > (3 COLLATE latin1_bin)), charset((2 > 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 > 3 COLLATE latin1_bin), charset(2 > (3 COLLATE latin1_bin)), charset((2 > 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 > 3 IN (1,1), 2 > (3 IN (1,1)), (2 > 3) IN (1,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 IN (1,1), 2 > (3 IN (1,1)), (2 > 3) IN (1,1) union select * from v1;
+
+create or replace view v1 as select 0 > 3 OR 3, 0 > (3 OR 3), (0 > 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 > 3 OR 3, 0 > (3 OR 3), (0 > 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3 union select * from v1;
+
+create or replace view v1 as select 4 > 3 XOR 3, 4 > (3 XOR 3), (4 > 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 > 3 XOR 3, 4 > (3 XOR 3), (4 > 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 AND 3, 2 > (3 AND 3), (2 > 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 AND 3, 2 > (3 AND 3), (2 > 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 && 3, 2 > (3 && 3), (2 > 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 && 3, 2 > (3 && 3), (2 > 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 = 3, 2 > (3 = 3), (2 > 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 = 3, 2 > (3 = 3), (2 > 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 <=> 3, 2 > (3 <=> 3), (2 > 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 <=> 3, 2 > (3 <=> 3), (2 > 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 >= 3, 2 > (3 >= 3), (2 > 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 >= 3, 2 > (3 >= 3), (2 > 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 > 0 <= 0, 2 > (0 <= 0), (2 > 0) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 0 <= 0, 2 > (0 <= 0), (2 > 0) <= 0 union select * from v1;
+
+create or replace view v1 as select 2 > 0 < 0, 2 > (0 < 0), (2 > 0) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 0 < 0, 2 > (0 < 0), (2 > 0) < 0 union select * from v1;
+
+create or replace view v1 as select 2 > 1 <> 1, 2 > (1 <> 1), (2 > 1) <> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 1 <> 1, 2 > (1 <> 1), (2 > 1) <> 1 union select * from v1;
+
+create or replace view v1 as select 2 > 3 > 3, 2 > (3 > 3), (2 > 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 > 3, 2 > (3 > 3), (2 > 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 > 1 != 1, 2 > (1 != 1), (2 > 1) != 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 1 != 1, 2 > (1 != 1), (2 > 1) != 1 union select * from v1;
+
+create or replace view v1 as select 2 > 3 LIKE 3, 2 > (3 LIKE 3), (2 > 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 LIKE 3, 2 > (3 LIKE 3), (2 > 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 REGEXP 3, 2 > (3 REGEXP 3), (2 > 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 REGEXP 3, 2 > (3 REGEXP 3), (2 > 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 | 3, 2 > (3 | 3), (2 > 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 | 3, 2 > (3 | 3), (2 > 3) | 3 union select * from v1;
+
+create or replace view v1 as select 4 > 2 & 2, 4 > (2 & 2), (4 > 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 > 2 & 2, 4 > (2 & 2), (4 > 2) & 2 union select * from v1;
+
+create or replace view v1 as select 4 > 3 << 3, 4 > (3 << 3), (4 > 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 > 3 << 3, 4 > (3 << 3), (4 > 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 >> 3, 2 > (3 >> 3), (2 > 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 >> 3, 2 > (3 >> 3), (2 > 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 > '2000-01-01' +INTERVAL 1 DAY, 2 > ('2000-01-01' +INTERVAL 1 DAY), (2 > '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > '2000-01-01' +INTERVAL 1 DAY, 2 > ('2000-01-01' +INTERVAL 1 DAY), (2 > '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 > 3 + 3, 2 > (3 + 3), (2 > 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 + 3, 2 > (3 + 3), (2 > 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 - 3, 2 > (3 - 3), (2 > 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 - 3, 2 > (3 - 3), (2 > 3) - 3 union select * from v1;
+
+create or replace view v1 as select 4 > 3 * 3, 4 > (3 * 3), (4 > 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 > 3 * 3, 4 > (3 * 3), (4 > 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 / 3, 2 > (3 / 3), (2 > 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 / 3, 2 > (3 / 3), (2 > 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 DIV 3, 2 > (3 DIV 3), (2 > 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 DIV 3, 2 > (3 DIV 3), (2 > 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 MOD 3, 2 > (3 MOD 3), (2 > 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 MOD 3, 2 > (3 MOD 3), (2 > 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 % 3, 2 > (3 % 3), (2 > 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 % 3, 2 > (3 % 3), (2 > 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 ^ 3, 2 > (3 ^ 3), (2 > 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 ^ 3, 2 > (3 ^ 3), (2 > 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 > 3 BETWEEN 1 AND 3, 2 > (3 BETWEEN 1 AND 3), (2 > 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 BETWEEN 1 AND 3, 2 > (3 BETWEEN 1 AND 3), (2 > 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 IS FALSE, 2 != (3 IS FALSE), (2 != 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 IS FALSE, 2 != (3 IS FALSE), (2 != 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 != 3 COLLATE latin1_bin), charset(2 != (3 COLLATE latin1_bin)), charset((2 != 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 != 3 COLLATE latin1_bin), charset(2 != (3 COLLATE latin1_bin)), charset((2 != 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 != 3 IN (0,0), 2 != (3 IN (0,0)), (2 != 3) IN (0,0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 IN (0,0), 2 != (3 IN (0,0)), (2 != 3) IN (0,0) union select * from v1;
+
+create or replace view v1 as select 1 != 3 OR 3, 1 != (3 OR 3), (1 != 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 != 3 OR 3, 1 != (3 OR 3), (1 != 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 XOR 3, 2 != (3 XOR 3), (2 != 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 XOR 3, 2 != (3 XOR 3), (2 != 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 3 != 3 AND 3, 3 != (3 AND 3), (3 != 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 != 3 AND 3, 3 != (3 AND 3), (3 != 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 3 != 3 && 3, 3 != (3 && 3), (3 != 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 != 3 && 3, 3 != (3 && 3), (3 != 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 = 3, 2 != (3 = 3), (2 != 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 = 3, 2 != (3 = 3), (2 != 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 <=> 3, 2 != (3 <=> 3), (2 != 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 <=> 3, 2 != (3 <=> 3), (2 != 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 >= 3, 2 != (3 >= 3), (2 != 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 >= 3, 2 != (3 >= 3), (2 != 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 1 != 3 <= 3, 1 != (3 <= 3), (1 != 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 != 3 <= 3, 1 != (3 <= 3), (1 != 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 0 != 3 < 3, 0 != (3 < 3), (0 != 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 != 3 < 3, 0 != (3 < 3), (0 != 3) < 3 union select * from v1;
+
+create or replace view v1 as select 0 != 3 <> 3, 0 != (3 <> 3), (0 != 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 != 3 <> 3, 0 != (3 <> 3), (0 != 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 > 3, 2 != (3 > 3), (2 != 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 > 3, 2 != (3 > 3), (2 != 3) > 3 union select * from v1;
+
+create or replace view v1 as select 0 != 3 != 3, 0 != (3 != 3), (0 != 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 != 3 != 3, 0 != (3 != 3), (0 != 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 LIKE 3, 2 != (3 LIKE 3), (2 != 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 LIKE 3, 2 != (3 LIKE 3), (2 != 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 REGEXP 3, 2 != (3 REGEXP 3), (2 != 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 REGEXP 3, 2 != (3 REGEXP 3), (2 != 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 | 3, 2 != (3 | 3), (2 != 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 | 3, 2 != (3 | 3), (2 != 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 != 4 & 4, 2 != (4 & 4), (2 != 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 4 & 4, 2 != (4 & 4), (2 != 4) & 4 union select * from v1;
+
+create or replace view v1 as select 2 != 3 << 3, 2 != (3 << 3), (2 != 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 << 3, 2 != (3 << 3), (2 != 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 >> 3, 2 != (3 >> 3), (2 != 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 >> 3, 2 != (3 >> 3), (2 != 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 != '2000-01-01' +INTERVAL 1 DAY, 2 != ('2000-01-01' +INTERVAL 1 DAY), (2 != '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != '2000-01-01' +INTERVAL 1 DAY, 2 != ('2000-01-01' +INTERVAL 1 DAY), (2 != '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 != 3 + 3, 2 != (3 + 3), (2 != 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 + 3, 2 != (3 + 3), (2 != 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 - 3, 2 != (3 - 3), (2 != 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 - 3, 2 != (3 - 3), (2 != 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 * 3, 2 != (3 * 3), (2 != 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 * 3, 2 != (3 * 3), (2 != 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 / 3, 2 != (3 / 3), (2 != 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 / 3, 2 != (3 / 3), (2 != 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 DIV 3, 2 != (3 DIV 3), (2 != 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 DIV 3, 2 != (3 DIV 3), (2 != 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 3 != 3 MOD 3, 3 != (3 MOD 3), (3 != 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 != 3 MOD 3, 3 != (3 MOD 3), (3 != 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 3 != 3 % 3, 3 != (3 % 3), (3 != 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 != 3 % 3, 3 != (3 % 3), (3 != 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 ^ 3, 2 != (3 ^ 3), (2 != 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 ^ 3, 2 != (3 ^ 3), (2 != 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 != 3 BETWEEN 2 AND 3, 2 != (3 BETWEEN 2 AND 3), (2 != 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 BETWEEN 2 AND 3, 2 != (3 BETWEEN 2 AND 3), (2 != 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 IS FALSE, 2 LIKE (3 IS FALSE), (2 LIKE 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 IS FALSE, 2 LIKE (3 IS FALSE), (2 LIKE 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 LIKE 3 COLLATE latin1_bin), charset(2 LIKE (3 COLLATE latin1_bin)), charset((2 LIKE 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 LIKE 3 COLLATE latin1_bin), charset(2 LIKE (3 COLLATE latin1_bin)), charset((2 LIKE 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 IN (0,1), 2 LIKE (3 IN (0,1)), (2 LIKE 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 IN (0,1), 2 LIKE (3 IN (0,1)), (2 LIKE 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 OR 3, 2 LIKE (3 OR 3), (2 LIKE 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 OR 3, 2 LIKE (3 OR 3), (2 LIKE 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 XOR 3, 2 LIKE (3 XOR 3), (2 LIKE 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 XOR 3, 2 LIKE (3 XOR 3), (2 LIKE 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 AND 2, 2 LIKE (2 AND 2), (2 LIKE 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 AND 2, 2 LIKE (2 AND 2), (2 LIKE 2) AND 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 && 2, 2 LIKE (2 && 2), (2 LIKE 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 && 2, 2 LIKE (2 && 2), (2 LIKE 2) && 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 = 1, 2 LIKE (2 = 1), (2 LIKE 2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 = 1, 2 LIKE (2 = 1), (2 LIKE 2) = 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 <=> 1, 2 LIKE (2 <=> 1), (2 LIKE 2) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 <=> 1, 2 LIKE (2 <=> 1), (2 LIKE 2) <=> 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 >= 1, 2 LIKE (2 >= 1), (2 LIKE 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 >= 1, 2 LIKE (2 >= 1), (2 LIKE 2) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 <= 3, 2 LIKE (3 <= 3), (2 LIKE 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 <= 3, 2 LIKE (3 <= 3), (2 LIKE 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 < 3, 2 LIKE (3 < 3), (2 LIKE 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 < 3, 2 LIKE (3 < 3), (2 LIKE 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 <> 3, 2 LIKE (3 <> 3), (2 LIKE 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 <> 3, 2 LIKE (3 <> 3), (2 LIKE 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 > 0, 2 LIKE (2 > 0), (2 LIKE 2) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 > 0, 2 LIKE (2 > 0), (2 LIKE 2) > 0 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 != 3, 2 LIKE (3 != 3), (2 LIKE 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 != 3, 2 LIKE (3 != 3), (2 LIKE 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 LIKE 1, 2 LIKE (2 LIKE 1), (2 LIKE 2) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 LIKE 1, 2 LIKE (2 LIKE 1), (2 LIKE 2) LIKE 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 REGEXP 1, 2 LIKE (2 REGEXP 1), (2 LIKE 2) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 REGEXP 1, 2 LIKE (2 REGEXP 1), (2 LIKE 2) REGEXP 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 | 3, 2 LIKE (3 | 3), (2 LIKE 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 | 3, 2 LIKE (3 | 3), (2 LIKE 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 & 2, 2 LIKE (2 & 2), (2 LIKE 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 & 2, 2 LIKE (2 & 2), (2 LIKE 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 << 2, 2 LIKE (2 << 2), (2 LIKE 2) << 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 << 2, 2 LIKE (2 << 2), (2 LIKE 2) << 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 4 >> 1, 2 LIKE (4 >> 1), (2 LIKE 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 4 >> 1, 2 LIKE (4 >> 1), (2 LIKE 4) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE '2000-01-01' +INTERVAL 1 DAY, 2 LIKE ('2000-01-01' +INTERVAL 1 DAY), (2 LIKE '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE '2000-01-01' +INTERVAL 1 DAY, 2 LIKE ('2000-01-01' +INTERVAL 1 DAY), (2 LIKE '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 + 3, 2 LIKE (3 + 3), (2 LIKE 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 + 3, 2 LIKE (3 + 3), (2 LIKE 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 - 3, 2 LIKE (3 - 3), (2 LIKE 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 - 3, 2 LIKE (3 - 3), (2 LIKE 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 * 2, 2 LIKE (2 * 2), (2 LIKE 2) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 * 2, 2 LIKE (2 * 2), (2 LIKE 2) * 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 / 2, 2 LIKE (2 / 2), (2 LIKE 2) / 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 / 2, 2 LIKE (2 / 2), (2 LIKE 2) / 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 4 DIV 2, 2 LIKE (4 DIV 2), (2 LIKE 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 4 DIV 2, 2 LIKE (4 DIV 2), (2 LIKE 4) DIV 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 MOD 2, 2 LIKE (2 MOD 2), (2 LIKE 2) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 MOD 2, 2 LIKE (2 MOD 2), (2 LIKE 2) MOD 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 % 2, 2 LIKE (2 % 2), (2 LIKE 2) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 % 2, 2 LIKE (2 % 2), (2 LIKE 2) % 2 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 ^ 3, 2 LIKE (3 ^ 3), (2 LIKE 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 ^ 3, 2 LIKE (3 ^ 3), (2 LIKE 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 BETWEEN 1 AND 3, 2 LIKE (2 BETWEEN 1 AND 3), (2 LIKE 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 BETWEEN 1 AND 3, 2 LIKE (2 BETWEEN 1 AND 3), (2 LIKE 2) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 IS FALSE, 2 REGEXP (3 IS FALSE), (2 REGEXP 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 IS FALSE, 2 REGEXP (3 IS FALSE), (2 REGEXP 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 REGEXP 3 COLLATE latin1_bin), charset(2 REGEXP (3 COLLATE latin1_bin)), charset((2 REGEXP 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 REGEXP 3 COLLATE latin1_bin), charset(2 REGEXP (3 COLLATE latin1_bin)), charset((2 REGEXP 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 IN (0,1), 2 REGEXP (3 IN (0,1)), (2 REGEXP 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 IN (0,1), 2 REGEXP (3 IN (0,1)), (2 REGEXP 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 OR 3, 2 REGEXP (3 OR 3), (2 REGEXP 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 OR 3, 2 REGEXP (3 OR 3), (2 REGEXP 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 XOR 3, 2 REGEXP (3 XOR 3), (2 REGEXP 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 XOR 3, 2 REGEXP (3 XOR 3), (2 REGEXP 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 AND 2, 2 REGEXP (2 AND 2), (2 REGEXP 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 AND 2, 2 REGEXP (2 AND 2), (2 REGEXP 2) AND 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 && 2, 2 REGEXP (2 && 2), (2 REGEXP 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 && 2, 2 REGEXP (2 && 2), (2 REGEXP 2) && 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 = 1, 2 REGEXP (2 = 1), (2 REGEXP 2) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 = 1, 2 REGEXP (2 = 1), (2 REGEXP 2) = 1 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 <=> 1, 2 REGEXP (2 <=> 1), (2 REGEXP 2) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 <=> 1, 2 REGEXP (2 <=> 1), (2 REGEXP 2) <=> 1 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 >= 1, 2 REGEXP (2 >= 1), (2 REGEXP 2) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 >= 1, 2 REGEXP (2 >= 1), (2 REGEXP 2) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 <= 3, 2 REGEXP (3 <= 3), (2 REGEXP 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 <= 3, 2 REGEXP (3 <= 3), (2 REGEXP 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 < 3, 2 REGEXP (3 < 3), (2 REGEXP 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 < 3, 2 REGEXP (3 < 3), (2 REGEXP 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 <> 3, 2 REGEXP (3 <> 3), (2 REGEXP 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 <> 3, 2 REGEXP (3 <> 3), (2 REGEXP 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 > 0, 2 REGEXP (2 > 0), (2 REGEXP 2) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 > 0, 2 REGEXP (2 > 0), (2 REGEXP 2) > 0 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 != 3, 2 REGEXP (3 != 3), (2 REGEXP 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 != 3, 2 REGEXP (3 != 3), (2 REGEXP 3) != 3 union select * from v1;
+
+create or replace view v1 as select 1 REGEXP 3 LIKE 3, 1 REGEXP (3 LIKE 3), (1 REGEXP 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 REGEXP 3 LIKE 3, 1 REGEXP (3 LIKE 3), (1 REGEXP 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 1 REGEXP 3 REGEXP 3, 1 REGEXP (3 REGEXP 3), (1 REGEXP 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 REGEXP 3 REGEXP 3, 1 REGEXP (3 REGEXP 3), (1 REGEXP 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 | 3, 2 REGEXP (3 | 3), (2 REGEXP 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 | 3, 2 REGEXP (3 | 3), (2 REGEXP 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 & 2, 2 REGEXP (2 & 2), (2 REGEXP 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 & 2, 2 REGEXP (2 & 2), (2 REGEXP 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 << 2, 2 REGEXP (2 << 2), (2 REGEXP 2) << 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 << 2, 2 REGEXP (2 << 2), (2 REGEXP 2) << 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 4 >> 1, 2 REGEXP (4 >> 1), (2 REGEXP 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 4 >> 1, 2 REGEXP (4 >> 1), (2 REGEXP 4) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP '2000-01-01' +INTERVAL 1 DAY, 2 REGEXP ('2000-01-01' +INTERVAL 1 DAY), (2 REGEXP '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP '2000-01-01' +INTERVAL 1 DAY, 2 REGEXP ('2000-01-01' +INTERVAL 1 DAY), (2 REGEXP '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 + 3, 2 REGEXP (3 + 3), (2 REGEXP 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 + 3, 2 REGEXP (3 + 3), (2 REGEXP 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 - 3, 2 REGEXP (3 - 3), (2 REGEXP 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 - 3, 2 REGEXP (3 - 3), (2 REGEXP 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 * 2, 2 REGEXP (2 * 2), (2 REGEXP 2) * 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 * 2, 2 REGEXP (2 * 2), (2 REGEXP 2) * 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 / 2, 2 REGEXP (2 / 2), (2 REGEXP 2) / 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 / 2, 2 REGEXP (2 / 2), (2 REGEXP 2) / 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 4 DIV 2, 2 REGEXP (4 DIV 2), (2 REGEXP 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 4 DIV 2, 2 REGEXP (4 DIV 2), (2 REGEXP 4) DIV 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 MOD 2, 2 REGEXP (2 MOD 2), (2 REGEXP 2) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 MOD 2, 2 REGEXP (2 MOD 2), (2 REGEXP 2) MOD 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 % 2, 2 REGEXP (2 % 2), (2 REGEXP 2) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 % 2, 2 REGEXP (2 % 2), (2 REGEXP 2) % 2 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 ^ 3, 2 REGEXP (3 ^ 3), (2 REGEXP 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 ^ 3, 2 REGEXP (3 ^ 3), (2 REGEXP 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 2 BETWEEN 1 AND 3, 2 REGEXP (2 BETWEEN 1 AND 3), (2 REGEXP 2) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 2 BETWEEN 1 AND 3, 2 REGEXP (2 BETWEEN 1 AND 3), (2 REGEXP 2) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 IS FALSE, 2 | (3 IS FALSE), (2 | 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 IS FALSE, 2 | (3 IS FALSE), (2 | 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 | 3 COLLATE latin1_bin), charset(2 | (3 COLLATE latin1_bin)), charset((2 | 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 | 3 COLLATE latin1_bin), charset(2 | (3 COLLATE latin1_bin)), charset((2 | 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 | 3 IN (0,1), 2 | (3 IN (0,1)), (2 | 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 IN (0,1), 2 | (3 IN (0,1)), (2 | 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 | 3 OR 3, 2 | (3 OR 3), (2 | 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 OR 3, 2 | (3 OR 3), (2 | 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 XOR 3, 2 | (3 XOR 3), (2 | 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 XOR 3, 2 | (3 XOR 3), (2 | 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 AND 3, 2 | (3 AND 3), (2 | 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 AND 3, 2 | (3 AND 3), (2 | 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 && 3, 2 | (3 && 3), (2 | 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 && 3, 2 | (3 && 3), (2 | 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 = 3, 2 | (3 = 3), (2 | 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 = 3, 2 | (3 = 3), (2 | 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 <=> 3, 2 | (3 <=> 3), (2 | 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 <=> 3, 2 | (3 <=> 3), (2 | 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 >= 3, 2 | (3 >= 3), (2 | 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 >= 3, 2 | (3 >= 3), (2 | 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 <= 3, 2 | (3 <= 3), (2 | 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 <= 3, 2 | (3 <= 3), (2 | 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 < 3, 2 | (3 < 3), (2 | 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 < 3, 2 | (3 < 3), (2 | 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 <> 3, 2 | (3 <> 3), (2 | 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 <> 3, 2 | (3 <> 3), (2 | 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 > 3, 2 | (3 > 3), (2 | 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 > 3, 2 | (3 > 3), (2 | 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 != 3, 2 | (3 != 3), (2 | 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 != 3, 2 | (3 != 3), (2 | 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 LIKE 3, 2 | (3 LIKE 3), (2 | 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 LIKE 3, 2 | (3 LIKE 3), (2 | 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 REGEXP 3, 2 | (3 REGEXP 3), (2 | 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 REGEXP 3, 2 | (3 REGEXP 3), (2 | 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 | 0 & 0, 2 | (0 & 0), (2 | 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 0 & 0, 2 | (0 & 0), (2 | 0) & 0 union select * from v1;
+
+create or replace view v1 as select 2 | 3 << 3, 2 | (3 << 3), (2 | 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 << 3, 2 | (3 << 3), (2 | 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 >> 3, 2 | (3 >> 3), (2 | 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 >> 3, 2 | (3 >> 3), (2 | 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 | '2000-01-01' +INTERVAL 1 DAY, 2 | ('2000-01-01' +INTERVAL 1 DAY), (2 | '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | '2000-01-01' +INTERVAL 1 DAY, 2 | ('2000-01-01' +INTERVAL 1 DAY), (2 | '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 | 1 + 1, 2 | (1 + 1), (2 | 1) + 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 1 + 1, 2 | (1 + 1), (2 | 1) + 1 union select * from v1;
+
+create or replace view v1 as select 2 | 3 - 3, 2 | (3 - 3), (2 | 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 - 3, 2 | (3 - 3), (2 | 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 * 3, 2 | (3 * 3), (2 | 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 * 3, 2 | (3 * 3), (2 | 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 / 3, 2 | (3 / 3), (2 | 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 / 3, 2 | (3 / 3), (2 | 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 DIV 3, 2 | (3 DIV 3), (2 | 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 DIV 3, 2 | (3 DIV 3), (2 | 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 MOD 3, 2 | (3 MOD 3), (2 | 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 MOD 3, 2 | (3 MOD 3), (2 | 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 % 3, 2 | (3 % 3), (2 | 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 % 3, 2 | (3 % 3), (2 | 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 ^ 3, 2 | (3 ^ 3), (2 | 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 ^ 3, 2 | (3 ^ 3), (2 | 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 BETWEEN 1 AND 3, 2 | (3 BETWEEN 1 AND 3), (2 | 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 BETWEEN 1 AND 3, 2 | (3 BETWEEN 1 AND 3), (2 | 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 & 1 IS FALSE, 2 & (1 IS FALSE), (2 & 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 1 IS FALSE, 2 & (1 IS FALSE), (2 & 1) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 & 3 COLLATE latin1_bin), charset(2 & (3 COLLATE latin1_bin)), charset((2 & 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 & 3 COLLATE latin1_bin), charset(2 & (3 COLLATE latin1_bin)), charset((2 & 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 & 4 IN (0,1), 2 & (4 IN (0,1)), (2 & 4) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 4 IN (0,1), 2 & (4 IN (0,1)), (2 & 4) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 & 3 OR 3, 2 & (3 OR 3), (2 & 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 OR 3, 2 & (3 OR 3), (2 & 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 & 1 XOR 1, 2 & (1 XOR 1), (2 & 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 1 XOR 1, 2 & (1 XOR 1), (2 & 1) XOR 1 union select * from v1;
+
+create or replace view v1 as select 2 & 3 AND 3, 2 & (3 AND 3), (2 & 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 AND 3, 2 & (3 AND 3), (2 & 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 && 3, 2 & (3 && 3), (2 & 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 && 3, 2 & (3 && 3), (2 & 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 = 2, 2 & (3 = 2), (2 & 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 = 2, 2 & (3 = 2), (2 & 3) = 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 <=> 2, 2 & (3 <=> 2), (2 & 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 <=> 2, 2 & (3 <=> 2), (2 & 3) <=> 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 >= 2, 2 & (3 >= 2), (2 & 3) >= 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 >= 2, 2 & (3 >= 2), (2 & 3) >= 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 <= 3, 2 & (3 <= 3), (2 & 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 <= 3, 2 & (3 <= 3), (2 & 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 < 3, 2 & (3 < 3), (2 & 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 < 3, 2 & (3 < 3), (2 & 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 <> 3, 2 & (3 <> 3), (2 & 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 <> 3, 2 & (3 <> 3), (2 & 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 > 1, 2 & (3 > 1), (2 & 3) > 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 > 1, 2 & (3 > 1), (2 & 3) > 1 union select * from v1;
+
+create or replace view v1 as select 2 & 3 != 3, 2 & (3 != 3), (2 & 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 != 3, 2 & (3 != 3), (2 & 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 LIKE 2, 2 & (3 LIKE 2), (2 & 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 LIKE 2, 2 & (3 LIKE 2), (2 & 3) LIKE 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 REGEXP 2, 2 & (3 REGEXP 2), (2 & 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 REGEXP 2, 2 & (3 REGEXP 2), (2 & 3) REGEXP 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 | 3, 2 & (3 | 3), (2 & 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 | 3, 2 & (3 | 3), (2 & 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 << 3, 2 & (3 << 3), (2 & 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 << 3, 2 & (3 << 3), (2 & 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 >> 1, 2 & (3 >> 1), (2 & 3) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 >> 1, 2 & (3 >> 1), (2 & 3) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 & '2000-01-01' +INTERVAL 1 DAY, 2 & ('2000-01-01' +INTERVAL 1 DAY), (2 & '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & '2000-01-01' +INTERVAL 1 DAY, 2 & ('2000-01-01' +INTERVAL 1 DAY), (2 & '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 & 3 + 3, 2 & (3 + 3), (2 & 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 + 3, 2 & (3 + 3), (2 & 3) + 3 union select * from v1;
+
+create or replace view v1 as select 6 & 4 - 3, 6 & (4 - 3), (6 & 4) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 6 & 4 - 3, 6 & (4 - 3), (6 & 4) - 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 * 3, 2 & (3 * 3), (2 & 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 * 3, 2 & (3 * 3), (2 & 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 / 3, 2 & (3 / 3), (2 & 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 / 3, 2 & (3 / 3), (2 & 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 DIV 2, 2 & (3 DIV 2), (2 & 3) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 DIV 2, 2 & (3 DIV 2), (2 & 3) DIV 2 union select * from v1;
+
+create or replace view v1 as select 2 & 3 MOD 3, 2 & (3 MOD 3), (2 & 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 MOD 3, 2 & (3 MOD 3), (2 & 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 % 3, 2 & (3 % 3), (2 & 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 % 3, 2 & (3 % 3), (2 & 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 ^ 3, 2 & (3 ^ 3), (2 & 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 ^ 3, 2 & (3 ^ 3), (2 & 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 BETWEEN 1 AND 3, 2 & (3 BETWEEN 1 AND 3), (2 & 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 BETWEEN 1 AND 3, 2 & (3 BETWEEN 1 AND 3), (2 & 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 IS FALSE, 2 << (3 IS FALSE), (2 << 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 IS FALSE, 2 << (3 IS FALSE), (2 << 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 << 3 COLLATE latin1_bin), charset(2 << (3 COLLATE latin1_bin)), charset((2 << 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 << 3 COLLATE latin1_bin), charset(2 << (3 COLLATE latin1_bin)), charset((2 << 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 << 3 IN (0,1), 2 << (3 IN (0,1)), (2 << 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 IN (0,1), 2 << (3 IN (0,1)), (2 << 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 << 3 OR 3, 2 << (3 OR 3), (2 << 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 OR 3, 2 << (3 OR 3), (2 << 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 XOR 3, 2 << (3 XOR 3), (2 << 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 XOR 3, 2 << (3 XOR 3), (2 << 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 AND 3, 2 << (3 AND 3), (2 << 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 AND 3, 2 << (3 AND 3), (2 << 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 && 3, 2 << (3 && 3), (2 << 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 && 3, 2 << (3 && 3), (2 << 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 = 3, 2 << (3 = 3), (2 << 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 = 3, 2 << (3 = 3), (2 << 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 <=> 3, 2 << (3 <=> 3), (2 << 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 <=> 3, 2 << (3 <=> 3), (2 << 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 >= 3, 2 << (3 >= 3), (2 << 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 >= 3, 2 << (3 >= 3), (2 << 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 <= 3, 2 << (3 <= 3), (2 << 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 <= 3, 2 << (3 <= 3), (2 << 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 < 3, 2 << (3 < 3), (2 << 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 < 3, 2 << (3 < 3), (2 << 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 <> 3, 2 << (3 <> 3), (2 << 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 <> 3, 2 << (3 <> 3), (2 << 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 > 3, 2 << (3 > 3), (2 << 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 > 3, 2 << (3 > 3), (2 << 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 != 3, 2 << (3 != 3), (2 << 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 != 3, 2 << (3 != 3), (2 << 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 LIKE 3, 2 << (3 LIKE 3), (2 << 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 LIKE 3, 2 << (3 LIKE 3), (2 << 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 REGEXP 3, 2 << (3 REGEXP 3), (2 << 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 REGEXP 3, 2 << (3 REGEXP 3), (2 << 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 | 3, 2 << (3 | 3), (2 << 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 | 3, 2 << (3 | 3), (2 << 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 & 3, 2 << (3 & 3), (2 << 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 & 3, 2 << (3 & 3), (2 << 3) & 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 << 3, 2 << (3 << 3), (2 << 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 << 3, 2 << (3 << 3), (2 << 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 << 2 >> 3, 2 << (2 >> 3), (2 << 2) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 2 >> 3, 2 << (2 >> 3), (2 << 2) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 << '2000-01-01' +INTERVAL 1 DAY, 2 << ('2000-01-01' +INTERVAL 1 DAY), (2 << '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << '2000-01-01' +INTERVAL 1 DAY, 2 << ('2000-01-01' +INTERVAL 1 DAY), (2 << '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 << 3 + 3, 2 << (3 + 3), (2 << 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 + 3, 2 << (3 + 3), (2 << 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 - 3, 2 << (3 - 3), (2 << 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 - 3, 2 << (3 - 3), (2 << 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 * 3, 2 << (3 * 3), (2 << 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 * 3, 2 << (3 * 3), (2 << 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 / 3, 2 << (3 / 3), (2 << 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 / 3, 2 << (3 / 3), (2 << 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 DIV 3, 2 << (3 DIV 3), (2 << 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 DIV 3, 2 << (3 DIV 3), (2 << 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 MOD 3, 2 << (3 MOD 3), (2 << 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 MOD 3, 2 << (3 MOD 3), (2 << 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 % 3, 2 << (3 % 3), (2 << 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 % 3, 2 << (3 % 3), (2 << 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 ^ 3, 2 << (3 ^ 3), (2 << 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 ^ 3, 2 << (3 ^ 3), (2 << 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 BETWEEN 1 AND 3, 2 << (3 BETWEEN 1 AND 3), (2 << 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 BETWEEN 1 AND 3, 2 << (3 BETWEEN 1 AND 3), (2 << 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 IS FALSE, 2 >> (3 IS FALSE), (2 >> 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 IS FALSE, 2 >> (3 IS FALSE), (2 >> 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 >> 3 COLLATE latin1_bin), charset(2 >> (3 COLLATE latin1_bin)), charset((2 >> 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 >> 3 COLLATE latin1_bin), charset(2 >> (3 COLLATE latin1_bin)), charset((2 >> 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 >> 3 IN (0,1), 2 >> (3 IN (0,1)), (2 >> 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 IN (0,1), 2 >> (3 IN (0,1)), (2 >> 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 >> 3 OR 0, 2 >> (3 OR 0), (2 >> 3) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 OR 0, 2 >> (3 OR 0), (2 >> 3) OR 0 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 XOR 3, 2 >> (3 XOR 3), (2 >> 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 XOR 3, 2 >> (3 XOR 3), (2 >> 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 AND 3, 2 >> (3 AND 3), (2 >> 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 AND 3, 2 >> (3 AND 3), (2 >> 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 && 3, 2 >> (3 && 3), (2 >> 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 && 3, 2 >> (3 && 3), (2 >> 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 = 3, 2 >> (3 = 3), (2 >> 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 = 3, 2 >> (3 = 3), (2 >> 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 <=> 3, 2 >> (3 <=> 3), (2 >> 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 <=> 3, 2 >> (3 <=> 3), (2 >> 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 >= 3, 2 >> (3 >= 3), (2 >> 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 >= 3, 2 >> (3 >= 3), (2 >> 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 <= 0, 2 >> (3 <= 0), (2 >> 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 <= 0, 2 >> (3 <= 0), (2 >> 3) <= 0 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 < 3, 2 >> (3 < 3), (2 >> 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 < 3, 2 >> (3 < 3), (2 >> 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 <> 3, 2 >> (3 <> 3), (2 >> 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 <> 3, 2 >> (3 <> 3), (2 >> 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 > 3, 2 >> (3 > 3), (2 >> 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 > 3, 2 >> (3 > 3), (2 >> 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 != 3, 2 >> (3 != 3), (2 >> 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 != 3, 2 >> (3 != 3), (2 >> 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 LIKE 3, 2 >> (3 LIKE 3), (2 >> 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 LIKE 3, 2 >> (3 LIKE 3), (2 >> 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 REGEXP 3, 2 >> (3 REGEXP 3), (2 >> 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 REGEXP 3, 2 >> (3 REGEXP 3), (2 >> 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 | 3, 2 >> (3 | 3), (2 >> 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 | 3, 2 >> (3 | 3), (2 >> 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 & 1, 2 >> (3 & 1), (2 >> 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 & 1, 2 >> (3 & 1), (2 >> 3) & 1 union select * from v1;
+
+create or replace view v1 as select 2 >> 1 << 3, 2 >> (1 << 3), (2 >> 1) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 1 << 3, 2 >> (1 << 3), (2 >> 1) << 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 >> 3, 2 >> (3 >> 3), (2 >> 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 >> 3, 2 >> (3 >> 3), (2 >> 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 >> '2000-01-01' +INTERVAL 1 DAY, 2 >> ('2000-01-01' +INTERVAL 1 DAY), (2 >> '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> '2000-01-01' +INTERVAL 1 DAY, 2 >> ('2000-01-01' +INTERVAL 1 DAY), (2 >> '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 >> 3 + 3, 2 >> (3 + 3), (2 >> 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 + 3, 2 >> (3 + 3), (2 >> 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 1 - 1, 2 >> (1 - 1), (2 >> 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 1 - 1, 2 >> (1 - 1), (2 >> 1) - 1 union select * from v1;
+
+create or replace view v1 as select 2 >> 1 * 3, 2 >> (1 * 3), (2 >> 1) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 1 * 3, 2 >> (1 * 3), (2 >> 1) * 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 / 3, 2 >> (3 / 3), (2 >> 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 / 3, 2 >> (3 / 3), (2 >> 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 DIV 3, 2 >> (3 DIV 3), (2 >> 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 DIV 3, 2 >> (3 DIV 3), (2 >> 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 MOD 3, 2 >> (3 MOD 3), (2 >> 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 MOD 3, 2 >> (3 MOD 3), (2 >> 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 % 3, 2 >> (3 % 3), (2 >> 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 % 3, 2 >> (3 % 3), (2 >> 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 ^ 3, 2 >> (3 ^ 3), (2 >> 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 ^ 3, 2 >> (3 ^ 3), (2 >> 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 BETWEEN 1 AND 3, 2 >> (3 BETWEEN 1 AND 3), (2 >> 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 BETWEEN 1 AND 3, 2 >> (3 BETWEEN 1 AND 3), (2 >> 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 IS FALSE, 2 + (3 IS FALSE), (2 + 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 IS FALSE, 2 + (3 IS FALSE), (2 + 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 + 3 COLLATE latin1_bin), charset(2 + (3 COLLATE latin1_bin)), charset((2 + 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 + 3 COLLATE latin1_bin), charset(2 + (3 COLLATE latin1_bin)), charset((2 + 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 + 3 IN (0,1), 2 + (3 IN (0,1)), (2 + 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 IN (0,1), 2 + (3 IN (0,1)), (2 + 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 + 3 OR 3, 2 + (3 OR 3), (2 + 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 OR 3, 2 + (3 OR 3), (2 + 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 XOR 3, 2 + (3 XOR 3), (2 + 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 XOR 3, 2 + (3 XOR 3), (2 + 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 AND 3, 2 + (3 AND 3), (2 + 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 AND 3, 2 + (3 AND 3), (2 + 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 && 3, 2 + (3 && 3), (2 + 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 && 3, 2 + (3 && 3), (2 + 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 = 3, 2 + (3 = 3), (2 + 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 = 3, 2 + (3 = 3), (2 + 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 <=> 3, 2 + (3 <=> 3), (2 + 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 <=> 3, 2 + (3 <=> 3), (2 + 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 >= 3, 2 + (3 >= 3), (2 + 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 >= 3, 2 + (3 >= 3), (2 + 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 <= 3, 2 + (3 <= 3), (2 + 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 <= 3, 2 + (3 <= 3), (2 + 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 < 3, 2 + (3 < 3), (2 + 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 < 3, 2 + (3 < 3), (2 + 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 <> 3, 2 + (3 <> 3), (2 + 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 <> 3, 2 + (3 <> 3), (2 + 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 > 3, 2 + (3 > 3), (2 + 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 > 3, 2 + (3 > 3), (2 + 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 != 3, 2 + (3 != 3), (2 + 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 != 3, 2 + (3 != 3), (2 + 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 LIKE 3, 2 + (3 LIKE 3), (2 + 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 LIKE 3, 2 + (3 LIKE 3), (2 + 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 REGEXP 3, 2 + (3 REGEXP 3), (2 + 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 REGEXP 3, 2 + (3 REGEXP 3), (2 + 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 | 3, 2 + (3 | 3), (2 + 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 | 3, 2 + (3 | 3), (2 + 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 & 3, 2 + (3 & 3), (2 + 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 & 3, 2 + (3 & 3), (2 + 3) & 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 << 3, 2 + (3 << 3), (2 + 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 << 3, 2 + (3 << 3), (2 + 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 >> 3, 2 + (3 >> 3), (2 + 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 >> 3, 2 + (3 >> 3), (2 + 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 + '2000-01-01' +INTERVAL 1 DAY, 2 + ('2000-01-01' +INTERVAL 1 DAY), (2 + '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + '2000-01-01' +INTERVAL 1 DAY, 2 + ('2000-01-01' +INTERVAL 1 DAY), (2 + '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 + 3 * 3, 2 + (3 * 3), (2 + 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 * 3, 2 + (3 * 3), (2 + 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 / 3, 2 + (3 / 3), (2 + 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 / 3, 2 + (3 / 3), (2 + 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 DIV 3, 2 + (3 DIV 3), (2 + 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 DIV 3, 2 + (3 DIV 3), (2 + 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 + 1 MOD 3, 2 + (1 MOD 3), (2 + 1) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 1 MOD 3, 2 + (1 MOD 3), (2 + 1) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 + 1 % 3, 2 + (1 % 3), (2 + 1) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 1 % 3, 2 + (1 % 3), (2 + 1) % 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 ^ 3, 2 + (3 ^ 3), (2 + 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 ^ 3, 2 + (3 ^ 3), (2 + 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 + 3 BETWEEN 1 AND 3, 2 + (3 BETWEEN 1 AND 3), (2 + 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 BETWEEN 1 AND 3, 2 + (3 BETWEEN 1 AND 3), (2 + 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 IS FALSE, 2 - (3 IS FALSE), (2 - 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 IS FALSE, 2 - (3 IS FALSE), (2 - 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 - 3 COLLATE latin1_bin), charset(2 - (3 COLLATE latin1_bin)), charset((2 - 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 - 3 COLLATE latin1_bin), charset(2 - (3 COLLATE latin1_bin)), charset((2 - 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 - 3 IN (0,1), 2 - (3 IN (0,1)), (2 - 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 IN (0,1), 2 - (3 IN (0,1)), (2 - 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 - 2 OR 0, 2 - (2 OR 0), (2 - 2) OR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 2 OR 0, 2 - (2 OR 0), (2 - 2) OR 0 union select * from v1;
+
+create or replace view v1 as select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0 union select * from v1;
+
+create or replace view v1 as select 2 - 3 XOR 3, 2 - (3 XOR 3), (2 - 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 XOR 3, 2 - (3 XOR 3), (2 - 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 - 2 AND 2, 2 - (2 AND 2), (2 - 2) AND 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 2 AND 2, 2 - (2 AND 2), (2 - 2) AND 2 union select * from v1;
+
+create or replace view v1 as select 2 - 2 && 2, 2 - (2 && 2), (2 - 2) && 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 2 && 2, 2 - (2 && 2), (2 - 2) && 2 union select * from v1;
+
+create or replace view v1 as select 2 - 3 = 3, 2 - (3 = 3), (2 - 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 = 3, 2 - (3 = 3), (2 - 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 <=> 3, 2 - (3 <=> 3), (2 - 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 <=> 3, 2 - (3 <=> 3), (2 - 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 >= 3, 2 - (3 >= 3), (2 - 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 >= 3, 2 - (3 >= 3), (2 - 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 <= 2, 2 - (3 <= 2), (2 - 3) <= 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 <= 2, 2 - (3 <= 2), (2 - 3) <= 2 union select * from v1;
+
+create or replace view v1 as select 2 - 3 < 3, 2 - (3 < 3), (2 - 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 < 3, 2 - (3 < 3), (2 - 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 <> 3, 2 - (3 <> 3), (2 - 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 <> 3, 2 - (3 <> 3), (2 - 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 > 3, 2 - (3 > 3), (2 - 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 > 3, 2 - (3 > 3), (2 - 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 != 3, 2 - (3 != 3), (2 - 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 != 3, 2 - (3 != 3), (2 - 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 LIKE 3, 2 - (3 LIKE 3), (2 - 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 LIKE 3, 2 - (3 LIKE 3), (2 - 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 REGEXP 3, 2 - (3 REGEXP 3), (2 - 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 REGEXP 3, 2 - (3 REGEXP 3), (2 - 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 - 0 | 1, 2 - (0 | 1), (2 - 0) | 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 0 | 1, 2 - (0 | 1), (2 - 0) | 1 union select * from v1;
+
+create or replace view v1 as select 2 - 1 & 2, 2 - (1 & 2), (2 - 1) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 1 & 2, 2 - (1 & 2), (2 - 1) & 2 union select * from v1;
+
+create or replace view v1 as select 2 - 1 << 1, 2 - (1 << 1), (2 - 1) << 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 1 << 1, 2 - (1 << 1), (2 - 1) << 1 union select * from v1;
+
+create or replace view v1 as select 2 - 3 >> 3, 2 - (3 >> 3), (2 - 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 >> 3, 2 - (3 >> 3), (2 - 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 - '2000-01-01' +INTERVAL 1 DAY, 2 - ('2000-01-01' +INTERVAL 1 DAY), (2 - '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - '2000-01-01' +INTERVAL 1 DAY, 2 - ('2000-01-01' +INTERVAL 1 DAY), (2 - '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 - 3 + 3, 2 - (3 + 3), (2 - 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 + 3, 2 - (3 + 3), (2 - 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 - 3, 2 - (3 - 3), (2 - 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 - 3, 2 - (3 - 3), (2 - 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 * 3, 2 - (3 * 3), (2 - 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 * 3, 2 - (3 * 3), (2 - 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 / 3, 2 - (3 / 3), (2 - 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 / 3, 2 - (3 / 3), (2 - 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 DIV 3, 2 - (3 DIV 3), (2 - 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 DIV 3, 2 - (3 DIV 3), (2 - 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 MOD 3, 2 - (3 MOD 3), (2 - 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 MOD 3, 2 - (3 MOD 3), (2 - 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 % 3, 2 - (3 % 3), (2 - 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 % 3, 2 - (3 % 3), (2 - 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 ^ 3, 2 - (3 ^ 3), (2 - 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 ^ 3, 2 - (3 ^ 3), (2 - 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 - 3 BETWEEN 1 AND 3, 2 - (3 BETWEEN 1 AND 3), (2 - 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 BETWEEN 1 AND 3, 2 - (3 BETWEEN 1 AND 3), (2 - 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 * 0 IS FALSE, 2 * (0 IS FALSE), (2 * 0) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 0 IS FALSE, 2 * (0 IS FALSE), (2 * 0) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 * 3 COLLATE latin1_bin), charset(2 * (3 COLLATE latin1_bin)), charset((2 * 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 * 3 COLLATE latin1_bin), charset(2 * (3 COLLATE latin1_bin)), charset((2 * 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 * 0 IN (0,1), 2 * (0 IN (0,1)), (2 * 0) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 0 IN (0,1), 2 * (0 IN (0,1)), (2 * 0) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 * 3 OR 3, 2 * (3 OR 3), (2 * 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 OR 3, 2 * (3 OR 3), (2 * 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 XOR 0, 2 * (3 XOR 0), (2 * 3) XOR 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 XOR 0, 2 * (3 XOR 0), (2 * 3) XOR 0 union select * from v1;
+
+create or replace view v1 as select 2 * 3 AND 3, 2 * (3 AND 3), (2 * 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 AND 3, 2 * (3 AND 3), (2 * 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 && 3, 2 * (3 && 3), (2 * 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 && 3, 2 * (3 && 3), (2 * 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 = 3, 2 * (3 = 3), (2 * 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 = 3, 2 * (3 = 3), (2 * 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 <=> 3, 2 * (3 <=> 3), (2 * 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 <=> 3, 2 * (3 <=> 3), (2 * 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 >= 3, 2 * (3 >= 3), (2 * 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 >= 3, 2 * (3 >= 3), (2 * 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 <= 3, 2 * (3 <= 3), (2 * 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 <= 3, 2 * (3 <= 3), (2 * 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 * 0 < 3, 2 * (0 < 3), (2 * 0) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 0 < 3, 2 * (0 < 3), (2 * 0) < 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 <> 3, 2 * (3 <> 3), (2 * 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 <> 3, 2 * (3 <> 3), (2 * 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 > 3, 2 * (3 > 3), (2 * 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 > 3, 2 * (3 > 3), (2 * 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 != 3, 2 * (3 != 3), (2 * 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 != 3, 2 * (3 != 3), (2 * 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 LIKE 3, 2 * (3 LIKE 3), (2 * 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 LIKE 3, 2 * (3 LIKE 3), (2 * 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 REGEXP 3, 2 * (3 REGEXP 3), (2 * 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 REGEXP 3, 2 * (3 REGEXP 3), (2 * 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 | 3, 2 * (3 | 3), (2 * 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 | 3, 2 * (3 | 3), (2 * 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 & 3, 2 * (3 & 3), (2 * 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 & 3, 2 * (3 & 3), (2 * 3) & 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 >> 2, 2 * (3 >> 2), (2 * 3) >> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 >> 2, 2 * (3 >> 2), (2 * 3) >> 2 union select * from v1;
+
+create or replace view v1 as select 2 * '2000-01-01' +INTERVAL 1 DAY, 2 * ('2000-01-01' +INTERVAL 1 DAY), (2 * '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * '2000-01-01' +INTERVAL 1 DAY, 2 * ('2000-01-01' +INTERVAL 1 DAY), (2 * '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 * 3 + 3, 2 * (3 + 3), (2 * 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 + 3, 2 * (3 + 3), (2 * 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 - 3, 2 * (3 - 3), (2 * 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 - 3, 2 * (3 - 3), (2 * 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 DIV 2, 2 * (3 DIV 2), (2 * 3) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 DIV 2, 2 * (3 DIV 2), (2 * 3) DIV 2 union select * from v1;
+
+create or replace view v1 as select 2 * 3 MOD 2, 2 * (3 MOD 2), (2 * 3) MOD 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 MOD 2, 2 * (3 MOD 2), (2 * 3) MOD 2 union select * from v1;
+
+create or replace view v1 as select 2 * 3 % 2, 2 * (3 % 2), (2 * 3) % 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 % 2, 2 * (3 % 2), (2 * 3) % 2 union select * from v1;
+
+create or replace view v1 as select 2 * 3 ^ 3, 2 * (3 ^ 3), (2 * 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 ^ 3, 2 * (3 ^ 3), (2 * 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 * 3 BETWEEN 1 AND 3, 2 * (3 BETWEEN 1 AND 3), (2 * 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 BETWEEN 1 AND 3, 2 * (3 BETWEEN 1 AND 3), (2 * 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 IS FALSE, 2 / (3 IS FALSE), (2 / 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 IS FALSE, 2 / (3 IS FALSE), (2 / 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 / 3 COLLATE latin1_bin), charset(2 / (3 COLLATE latin1_bin)), charset((2 / 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 / 3 COLLATE latin1_bin), charset(2 / (3 COLLATE latin1_bin)), charset((2 / 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 / 3 IN (0,1), 2 / (3 IN (0,1)), (2 / 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 IN (0,1), 2 / (3 IN (0,1)), (2 / 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 / 3 OR 3, 2 / (3 OR 3), (2 / 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 OR 3, 2 / (3 OR 3), (2 / 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 XOR 3, 2 / (3 XOR 3), (2 / 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 XOR 3, 2 / (3 XOR 3), (2 / 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 AND 3, 2 / (3 AND 3), (2 / 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 AND 3, 2 / (3 AND 3), (2 / 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 && 3, 2 / (3 && 3), (2 / 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 && 3, 2 / (3 && 3), (2 / 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 = 3, 2 / (3 = 3), (2 / 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 = 3, 2 / (3 = 3), (2 / 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 <=> 3, 2 / (3 <=> 3), (2 / 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 <=> 3, 2 / (3 <=> 3), (2 / 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 >= 3, 2 / (3 >= 3), (2 / 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 >= 3, 2 / (3 >= 3), (2 / 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 <= 3, 2 / (3 <= 3), (2 / 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 <= 3, 2 / (3 <= 3), (2 / 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 < 3, 2 / (3 < 3), (2 / 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 < 3, 2 / (3 < 3), (2 / 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 <> 3, 2 / (3 <> 3), (2 / 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 <> 3, 2 / (3 <> 3), (2 / 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 > 3, 2 / (3 > 3), (2 / 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 > 3, 2 / (3 > 3), (2 / 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 != 3, 2 / (3 != 3), (2 / 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 != 3, 2 / (3 != 3), (2 / 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 LIKE 3, 2 / (3 LIKE 3), (2 / 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 LIKE 3, 2 / (3 LIKE 3), (2 / 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 REGEXP 3, 2 / (3 REGEXP 3), (2 / 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 REGEXP 3, 2 / (3 REGEXP 3), (2 / 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 | 3, 2 / (3 | 3), (2 / 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 | 3, 2 / (3 | 3), (2 / 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 & 3, 2 / (3 & 3), (2 / 3) & 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 & 3, 2 / (3 & 3), (2 / 3) & 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 << 3, 2 / (3 << 3), (2 / 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 << 3, 2 / (3 << 3), (2 / 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 >> 3, 2 / (3 >> 3), (2 / 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 >> 3, 2 / (3 >> 3), (2 / 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 / '2000-01-01' +INTERVAL 1 DAY, 2 / ('2000-01-01' +INTERVAL 1 DAY), (2 / '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / '2000-01-01' +INTERVAL 1 DAY, 2 / ('2000-01-01' +INTERVAL 1 DAY), (2 / '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 / 3 + 3, 2 / (3 + 3), (2 / 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 + 3, 2 / (3 + 3), (2 / 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 - 3, 2 / (3 - 3), (2 / 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 - 3, 2 / (3 - 3), (2 / 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 * 3, 2 / (3 * 3), (2 / 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 * 3, 2 / (3 * 3), (2 / 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 / 3, 2 / (3 / 3), (2 / 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 / 3, 2 / (3 / 3), (2 / 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 DIV 3, 2 / (3 DIV 3), (2 / 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 DIV 3, 2 / (3 DIV 3), (2 / 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 MOD 3, 2 / (3 MOD 3), (2 / 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 MOD 3, 2 / (3 MOD 3), (2 / 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 % 3, 2 / (3 % 3), (2 / 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 % 3, 2 / (3 % 3), (2 / 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 ^ 3, 2 / (3 ^ 3), (2 / 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 ^ 3, 2 / (3 ^ 3), (2 / 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 BETWEEN 1 AND 3, 2 / (3 BETWEEN 1 AND 3), (2 / 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 BETWEEN 1 AND 3, 2 / (3 BETWEEN 1 AND 3), (2 / 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 IS FALSE, 2 DIV (3 IS FALSE), (2 DIV 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 IS FALSE, 2 DIV (3 IS FALSE), (2 DIV 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 DIV 3 COLLATE latin1_bin), charset(2 DIV (3 COLLATE latin1_bin)), charset((2 DIV 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 DIV 3 COLLATE latin1_bin), charset(2 DIV (3 COLLATE latin1_bin)), charset((2 DIV 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 IN (0,1), 2 DIV (3 IN (0,1)), (2 DIV 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 IN (0,1), 2 DIV (3 IN (0,1)), (2 DIV 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 OR 3, 2 DIV (3 OR 3), (2 DIV 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 OR 3, 2 DIV (3 OR 3), (2 DIV 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 XOR 3, 2 DIV (3 XOR 3), (2 DIV 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 XOR 3, 2 DIV (3 XOR 3), (2 DIV 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 AND 3, 2 DIV (3 AND 3), (2 DIV 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 AND 3, 2 DIV (3 AND 3), (2 DIV 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 && 3, 2 DIV (3 && 3), (2 DIV 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 && 3, 2 DIV (3 && 3), (2 DIV 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 = 3, 2 DIV (3 = 3), (2 DIV 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 = 3, 2 DIV (3 = 3), (2 DIV 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 <=> 3, 2 DIV (3 <=> 3), (2 DIV 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 <=> 3, 2 DIV (3 <=> 3), (2 DIV 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 >= 3, 2 DIV (3 >= 3), (2 DIV 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 >= 3, 2 DIV (3 >= 3), (2 DIV 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 <= 3, 2 DIV (3 <= 3), (2 DIV 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 <= 3, 2 DIV (3 <= 3), (2 DIV 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 < 3, 2 DIV (3 < 3), (2 DIV 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 < 3, 2 DIV (3 < 3), (2 DIV 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 <> 3, 2 DIV (3 <> 3), (2 DIV 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 <> 3, 2 DIV (3 <> 3), (2 DIV 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 > 3, 2 DIV (3 > 3), (2 DIV 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 > 3, 2 DIV (3 > 3), (2 DIV 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 != 3, 2 DIV (3 != 3), (2 DIV 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 != 3, 2 DIV (3 != 3), (2 DIV 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 LIKE 3, 2 DIV (3 LIKE 3), (2 DIV 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 LIKE 3, 2 DIV (3 LIKE 3), (2 DIV 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 REGEXP 3, 2 DIV (3 REGEXP 3), (2 DIV 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 REGEXP 3, 2 DIV (3 REGEXP 3), (2 DIV 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 | 3, 2 DIV (3 | 3), (2 DIV 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 | 3, 2 DIV (3 | 3), (2 DIV 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 & 1, 2 DIV (3 & 1), (2 DIV 3) & 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 & 1, 2 DIV (3 & 1), (2 DIV 3) & 1 union select * from v1;
+
+create or replace view v1 as select 4 DIV 3 << 3, 4 DIV (3 << 3), (4 DIV 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 DIV 3 << 3, 4 DIV (3 << 3), (4 DIV 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 >> 3, 2 DIV (3 >> 3), (2 DIV 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 >> 3, 2 DIV (3 >> 3), (2 DIV 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV '2000-01-01' +INTERVAL 1 DAY, 2 DIV ('2000-01-01' +INTERVAL 1 DAY), (2 DIV '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV '2000-01-01' +INTERVAL 1 DAY, 2 DIV ('2000-01-01' +INTERVAL 1 DAY), (2 DIV '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 + 3, 2 DIV (3 + 3), (2 DIV 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 + 3, 2 DIV (3 + 3), (2 DIV 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 - 3, 2 DIV (3 - 3), (2 DIV 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 - 3, 2 DIV (3 - 3), (2 DIV 3) - 3 union select * from v1;
+
+create or replace view v1 as select 4 DIV 3 * 3, 4 DIV (3 * 3), (4 DIV 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 4 DIV 3 * 3, 4 DIV (3 * 3), (4 DIV 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 / 3, 2 DIV (3 / 3), (2 DIV 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 / 3, 2 DIV (3 / 3), (2 DIV 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 DIV 3, 2 DIV (3 DIV 3), (2 DIV 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 DIV 3, 2 DIV (3 DIV 3), (2 DIV 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 MOD 3, 2 DIV (3 MOD 3), (2 DIV 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 MOD 3, 2 DIV (3 MOD 3), (2 DIV 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 % 3, 2 DIV (3 % 3), (2 DIV 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 % 3, 2 DIV (3 % 3), (2 DIV 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 ^ 3, 2 DIV (3 ^ 3), (2 DIV 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 ^ 3, 2 DIV (3 ^ 3), (2 DIV 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 BETWEEN 1 AND 3, 2 DIV (3 BETWEEN 1 AND 3), (2 DIV 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 BETWEEN 1 AND 3, 2 DIV (3 BETWEEN 1 AND 3), (2 DIV 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 IS FALSE, 2 MOD (3 IS FALSE), (2 MOD 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 IS FALSE, 2 MOD (3 IS FALSE), (2 MOD 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 MOD 3 COLLATE latin1_bin), charset(2 MOD (3 COLLATE latin1_bin)), charset((2 MOD 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 MOD 3 COLLATE latin1_bin), charset(2 MOD (3 COLLATE latin1_bin)), charset((2 MOD 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 IN (0,1), 2 MOD (3 IN (0,1)), (2 MOD 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 IN (0,1), 2 MOD (3 IN (0,1)), (2 MOD 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 OR 3, 2 MOD (3 OR 3), (2 MOD 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 OR 3, 2 MOD (3 OR 3), (2 MOD 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 XOR 3, 2 MOD (3 XOR 3), (2 MOD 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 XOR 3, 2 MOD (3 XOR 3), (2 MOD 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 AND 3, 2 MOD (3 AND 3), (2 MOD 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 AND 3, 2 MOD (3 AND 3), (2 MOD 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 && 3, 2 MOD (3 && 3), (2 MOD 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 && 3, 2 MOD (3 && 3), (2 MOD 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 = 2, 2 MOD (3 = 2), (2 MOD 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 = 2, 2 MOD (3 = 2), (2 MOD 3) = 2 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 <=> 2, 2 MOD (3 <=> 2), (2 MOD 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 <=> 2, 2 MOD (3 <=> 2), (2 MOD 3) <=> 2 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 >= 1, 2 MOD (3 >= 1), (2 MOD 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 >= 1, 2 MOD (3 >= 1), (2 MOD 3) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 <= 3, 2 MOD (3 <= 3), (2 MOD 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 <= 3, 2 MOD (3 <= 3), (2 MOD 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 < 3, 2 MOD (3 < 3), (2 MOD 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 < 3, 2 MOD (3 < 3), (2 MOD 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 <> 3, 2 MOD (3 <> 3), (2 MOD 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 <> 3, 2 MOD (3 <> 3), (2 MOD 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 > 3, 2 MOD (3 > 3), (2 MOD 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 > 3, 2 MOD (3 > 3), (2 MOD 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 != 3, 2 MOD (3 != 3), (2 MOD 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 != 3, 2 MOD (3 != 3), (2 MOD 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 LIKE 2, 2 MOD (3 LIKE 2), (2 MOD 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 LIKE 2, 2 MOD (3 LIKE 2), (2 MOD 3) LIKE 2 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 REGEXP 2, 2 MOD (3 REGEXP 2), (2 MOD 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 REGEXP 2, 2 MOD (3 REGEXP 2), (2 MOD 3) REGEXP 2 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 | 3, 2 MOD (3 | 3), (2 MOD 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 | 3, 2 MOD (3 | 3), (2 MOD 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 4 & 4, 2 MOD (4 & 4), (2 MOD 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 4 & 4, 2 MOD (4 & 4), (2 MOD 4) & 4 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 << 3, 2 MOD (3 << 3), (2 MOD 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 << 3, 2 MOD (3 << 3), (2 MOD 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 >> 3, 2 MOD (3 >> 3), (2 MOD 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 >> 3, 2 MOD (3 >> 3), (2 MOD 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD '2000-01-01' +INTERVAL 1 DAY, 2 MOD ('2000-01-01' +INTERVAL 1 DAY), (2 MOD '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD '2000-01-01' +INTERVAL 1 DAY, 2 MOD ('2000-01-01' +INTERVAL 1 DAY), (2 MOD '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 + 3, 2 MOD (3 + 3), (2 MOD 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 + 3, 2 MOD (3 + 3), (2 MOD 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 - 3, 2 MOD (3 - 3), (2 MOD 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 - 3, 2 MOD (3 - 3), (2 MOD 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 * 3, 2 MOD (3 * 3), (2 MOD 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 * 3, 2 MOD (3 * 3), (2 MOD 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 / 3, 2 MOD (3 / 3), (2 MOD 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 / 3, 2 MOD (3 / 3), (2 MOD 3) / 3 union select * from v1;
+
+create or replace view v1 as select 3 MOD 4 DIV 3, 3 MOD (4 DIV 3), (3 MOD 4) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 MOD 4 DIV 3, 3 MOD (4 DIV 3), (3 MOD 4) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 MOD 3, 2 MOD (3 MOD 3), (2 MOD 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 MOD 3, 2 MOD (3 MOD 3), (2 MOD 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 % 3, 2 MOD (3 % 3), (2 MOD 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 % 3, 2 MOD (3 % 3), (2 MOD 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 ^ 3, 2 MOD (3 ^ 3), (2 MOD 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 ^ 3, 2 MOD (3 ^ 3), (2 MOD 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 BETWEEN 1 AND 3, 2 MOD (3 BETWEEN 1 AND 3), (2 MOD 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 BETWEEN 1 AND 3, 2 MOD (3 BETWEEN 1 AND 3), (2 MOD 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 IS FALSE, 2 % (3 IS FALSE), (2 % 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 IS FALSE, 2 % (3 IS FALSE), (2 % 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 % 3 COLLATE latin1_bin), charset(2 % (3 COLLATE latin1_bin)), charset((2 % 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 % 3 COLLATE latin1_bin), charset(2 % (3 COLLATE latin1_bin)), charset((2 % 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 % 3 IN (0,1), 2 % (3 IN (0,1)), (2 % 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 IN (0,1), 2 % (3 IN (0,1)), (2 % 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 % 3 OR 3, 2 % (3 OR 3), (2 % 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 OR 3, 2 % (3 OR 3), (2 % 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 XOR 3, 2 % (3 XOR 3), (2 % 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 XOR 3, 2 % (3 XOR 3), (2 % 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 AND 3, 2 % (3 AND 3), (2 % 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 AND 3, 2 % (3 AND 3), (2 % 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 && 3, 2 % (3 && 3), (2 % 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 && 3, 2 % (3 && 3), (2 % 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 = 2, 2 % (3 = 2), (2 % 3) = 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 = 2, 2 % (3 = 2), (2 % 3) = 2 union select * from v1;
+
+create or replace view v1 as select 2 % 3 <=> 2, 2 % (3 <=> 2), (2 % 3) <=> 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 <=> 2, 2 % (3 <=> 2), (2 % 3) <=> 2 union select * from v1;
+
+create or replace view v1 as select 2 % 3 >= 1, 2 % (3 >= 1), (2 % 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 >= 1, 2 % (3 >= 1), (2 % 3) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 % 3 <= 3, 2 % (3 <= 3), (2 % 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 <= 3, 2 % (3 <= 3), (2 % 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 < 3, 2 % (3 < 3), (2 % 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 < 3, 2 % (3 < 3), (2 % 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 <> 3, 2 % (3 <> 3), (2 % 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 <> 3, 2 % (3 <> 3), (2 % 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 > 3, 2 % (3 > 3), (2 % 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 > 3, 2 % (3 > 3), (2 % 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 != 3, 2 % (3 != 3), (2 % 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 != 3, 2 % (3 != 3), (2 % 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 LIKE 2, 2 % (3 LIKE 2), (2 % 3) LIKE 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 LIKE 2, 2 % (3 LIKE 2), (2 % 3) LIKE 2 union select * from v1;
+
+create or replace view v1 as select 2 % 3 REGEXP 2, 2 % (3 REGEXP 2), (2 % 3) REGEXP 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 REGEXP 2, 2 % (3 REGEXP 2), (2 % 3) REGEXP 2 union select * from v1;
+
+create or replace view v1 as select 2 % 3 | 3, 2 % (3 | 3), (2 % 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 | 3, 2 % (3 | 3), (2 % 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 % 4 & 4, 2 % (4 & 4), (2 % 4) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 4 & 4, 2 % (4 & 4), (2 % 4) & 4 union select * from v1;
+
+create or replace view v1 as select 2 % 3 << 3, 2 % (3 << 3), (2 % 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 << 3, 2 % (3 << 3), (2 % 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 >> 3, 2 % (3 >> 3), (2 % 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 >> 3, 2 % (3 >> 3), (2 % 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 % '2000-01-01' +INTERVAL 1 DAY, 2 % ('2000-01-01' +INTERVAL 1 DAY), (2 % '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % '2000-01-01' +INTERVAL 1 DAY, 2 % ('2000-01-01' +INTERVAL 1 DAY), (2 % '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 % 3 + 3, 2 % (3 + 3), (2 % 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 + 3, 2 % (3 + 3), (2 % 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 - 3, 2 % (3 - 3), (2 % 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 - 3, 2 % (3 - 3), (2 % 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 * 3, 2 % (3 * 3), (2 % 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 * 3, 2 % (3 * 3), (2 % 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 / 3, 2 % (3 / 3), (2 % 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 / 3, 2 % (3 / 3), (2 % 3) / 3 union select * from v1;
+
+create or replace view v1 as select 3 % 4 DIV 3, 3 % (4 DIV 3), (3 % 4) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 % 4 DIV 3, 3 % (4 DIV 3), (3 % 4) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 MOD 3, 2 % (3 MOD 3), (2 % 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 MOD 3, 2 % (3 MOD 3), (2 % 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 % 3, 2 % (3 % 3), (2 % 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 % 3, 2 % (3 % 3), (2 % 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 ^ 3, 2 % (3 ^ 3), (2 % 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 ^ 3, 2 % (3 ^ 3), (2 % 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 BETWEEN 1 AND 3, 2 % (3 BETWEEN 1 AND 3), (2 % 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 BETWEEN 1 AND 3, 2 % (3 BETWEEN 1 AND 3), (2 % 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 IS FALSE, 2 ^ (3 IS FALSE), (2 ^ 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 IS FALSE, 2 ^ (3 IS FALSE), (2 ^ 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 ^ 3 COLLATE latin1_bin), charset(2 ^ (3 COLLATE latin1_bin)), charset((2 ^ 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 ^ 3 COLLATE latin1_bin), charset(2 ^ (3 COLLATE latin1_bin)), charset((2 ^ 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 IN (0,1), 2 ^ (3 IN (0,1)), (2 ^ 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 IN (0,1), 2 ^ (3 IN (0,1)), (2 ^ 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 OR 3, 2 ^ (3 OR 3), (2 ^ 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 OR 3, 2 ^ (3 OR 3), (2 ^ 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 XOR 3, 2 ^ (3 XOR 3), (2 ^ 3) XOR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 XOR 3, 2 ^ (3 XOR 3), (2 ^ 3) XOR 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 AND 3, 2 ^ (3 AND 3), (2 ^ 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 AND 3, 2 ^ (3 AND 3), (2 ^ 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 && 3, 2 ^ (3 && 3), (2 ^ 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 && 3, 2 ^ (3 && 3), (2 ^ 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 = 3, 2 ^ (3 = 3), (2 ^ 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 = 3, 2 ^ (3 = 3), (2 ^ 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 <=> 3, 2 ^ (3 <=> 3), (2 ^ 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 <=> 3, 2 ^ (3 <=> 3), (2 ^ 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 >= 3, 2 ^ (3 >= 3), (2 ^ 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 >= 3, 2 ^ (3 >= 3), (2 ^ 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 <= 3, 2 ^ (3 <= 3), (2 ^ 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 <= 3, 2 ^ (3 <= 3), (2 ^ 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 < 3, 2 ^ (3 < 3), (2 ^ 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 < 3, 2 ^ (3 < 3), (2 ^ 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 <> 3, 2 ^ (3 <> 3), (2 ^ 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 <> 3, 2 ^ (3 <> 3), (2 ^ 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 > 3, 2 ^ (3 > 3), (2 ^ 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 > 3, 2 ^ (3 > 3), (2 ^ 3) > 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 != 3, 2 ^ (3 != 3), (2 ^ 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 != 3, 2 ^ (3 != 3), (2 ^ 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 LIKE 3, 2 ^ (3 LIKE 3), (2 ^ 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 LIKE 3, 2 ^ (3 LIKE 3), (2 ^ 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 REGEXP 3, 2 ^ (3 REGEXP 3), (2 ^ 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 REGEXP 3, 2 ^ (3 REGEXP 3), (2 ^ 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 | 3, 2 ^ (3 | 3), (2 ^ 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 | 3, 2 ^ (3 | 3), (2 ^ 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 0 & 0, 2 ^ (0 & 0), (2 ^ 0) & 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 0 & 0, 2 ^ (0 & 0), (2 ^ 0) & 0 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 << 3, 2 ^ (3 << 3), (2 ^ 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 << 3, 2 ^ (3 << 3), (2 ^ 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 >> 3, 2 ^ (3 >> 3), (2 ^ 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 >> 3, 2 ^ (3 >> 3), (2 ^ 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ '2000-01-01' +INTERVAL 1 DAY, 2 ^ ('2000-01-01' +INTERVAL 1 DAY), (2 ^ '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ '2000-01-01' +INTERVAL 1 DAY, 2 ^ ('2000-01-01' +INTERVAL 1 DAY), (2 ^ '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 + 1, 2 ^ (3 + 1), (2 ^ 3) + 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 + 1, 2 ^ (3 + 1), (2 ^ 3) + 1 union select * from v1;
+
+create or replace view v1 as select 5 ^ 1 - 1, 5 ^ (1 - 1), (5 ^ 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 5 ^ 1 - 1, 5 ^ (1 - 1), (5 ^ 1) - 1 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 * 3, 2 ^ (3 * 3), (2 ^ 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 * 3, 2 ^ (3 * 3), (2 ^ 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 / 3, 2 ^ (3 / 3), (2 ^ 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 / 3, 2 ^ (3 / 3), (2 ^ 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 DIV 3, 2 ^ (3 DIV 3), (2 ^ 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 DIV 3, 2 ^ (3 DIV 3), (2 ^ 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 MOD 3, 2 ^ (3 MOD 3), (2 ^ 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 MOD 3, 2 ^ (3 MOD 3), (2 ^ 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 % 3, 2 ^ (3 % 3), (2 ^ 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 % 3, 2 ^ (3 % 3), (2 ^ 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 BETWEEN 1 AND 3, 2 ^ (3 BETWEEN 1 AND 3), (2 ^ 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 BETWEEN 1 AND 3, 2 ^ (3 BETWEEN 1 AND 3), (2 ^ 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 1 IS FALSE, 2 BETWEEN 1 AND (1 IS FALSE), (2 BETWEEN 1 AND 1) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 1 IS FALSE, 2 BETWEEN 1 AND (1 IS FALSE), (2 BETWEEN 1 AND 1) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin), charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin)), charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 BETWEEN 1 AND 3 COLLATE latin1_bin), charset(2 BETWEEN 1 AND (3 COLLATE latin1_bin)), charset((2 BETWEEN 1 AND 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 IN (0,1), 2 BETWEEN 1 AND (3 IN (0,1)), (2 BETWEEN 1 AND 3) IN (0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 IN (0,1), 2 BETWEEN 1 AND (3 IN (0,1)), (2 BETWEEN 1 AND 3) IN (0,1) union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 OR 3, 2 BETWEEN 1 AND (3 OR 3), (2 BETWEEN 1 AND 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 OR 3, 2 BETWEEN 1 AND (3 OR 3), (2 BETWEEN 1 AND 3) OR 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 1 XOR 1, 2 BETWEEN 1 AND (1 XOR 1), (2 BETWEEN 1 AND 1) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 1 XOR 1, 2 BETWEEN 1 AND (1 XOR 1), (2 BETWEEN 1 AND 1) XOR 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 AND 3, 2 BETWEEN 1 AND (3 AND 3), (2 BETWEEN 1 AND 3) AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 AND 3, 2 BETWEEN 1 AND (3 AND 3), (2 BETWEEN 1 AND 3) AND 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 && 3, 2 BETWEEN 1 AND (3 && 3), (2 BETWEEN 1 AND 3) && 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 && 3, 2 BETWEEN 1 AND (3 && 3), (2 BETWEEN 1 AND 3) && 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 = 1, 2 BETWEEN 1 AND (3 = 1), (2 BETWEEN 1 AND 3) = 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 = 1, 2 BETWEEN 1 AND (3 = 1), (2 BETWEEN 1 AND 3) = 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <=> 1, 2 BETWEEN 1 AND (3 <=> 1), (2 BETWEEN 1 AND 3) <=> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 <=> 1, 2 BETWEEN 1 AND (3 <=> 1), (2 BETWEEN 1 AND 3) <=> 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 >= 1, 2 BETWEEN 1 AND (3 >= 1), (2 BETWEEN 1 AND 3) >= 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 >= 1, 2 BETWEEN 1 AND (3 >= 1), (2 BETWEEN 1 AND 3) >= 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <= 3, 2 BETWEEN 1 AND (3 <= 3), (2 BETWEEN 1 AND 3) <= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 <= 3, 2 BETWEEN 1 AND (3 <= 3), (2 BETWEEN 1 AND 3) <= 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 < 3, 2 BETWEEN 1 AND (3 < 3), (2 BETWEEN 1 AND 3) < 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 < 3, 2 BETWEEN 1 AND (3 < 3), (2 BETWEEN 1 AND 3) < 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 <> 3, 2 BETWEEN 1 AND (3 <> 3), (2 BETWEEN 1 AND 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 <> 3, 2 BETWEEN 1 AND (3 <> 3), (2 BETWEEN 1 AND 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 > 0, 2 BETWEEN 1 AND (3 > 0), (2 BETWEEN 1 AND 3) > 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 > 0, 2 BETWEEN 1 AND (3 > 0), (2 BETWEEN 1 AND 3) > 0 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 != 3, 2 BETWEEN 1 AND (3 != 3), (2 BETWEEN 1 AND 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 != 3, 2 BETWEEN 1 AND (3 != 3), (2 BETWEEN 1 AND 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 LIKE 1, 2 BETWEEN 1 AND (3 LIKE 1), (2 BETWEEN 1 AND 3) LIKE 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 LIKE 1, 2 BETWEEN 1 AND (3 LIKE 1), (2 BETWEEN 1 AND 3) LIKE 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 REGEXP 1, 2 BETWEEN 1 AND (3 REGEXP 1), (2 BETWEEN 1 AND 3) REGEXP 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 REGEXP 1, 2 BETWEEN 1 AND (3 REGEXP 1), (2 BETWEEN 1 AND 3) REGEXP 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 | 3, 2 BETWEEN 1 AND (3 | 3), (2 BETWEEN 1 AND 3) | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 | 3, 2 BETWEEN 1 AND (3 | 3), (2 BETWEEN 1 AND 3) | 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 2 & 2, 2 BETWEEN 1 AND (2 & 2), (2 BETWEEN 1 AND 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 2 & 2, 2 BETWEEN 1 AND (2 & 2), (2 BETWEEN 1 AND 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 << 3, 2 BETWEEN 1 AND (3 << 3), (2 BETWEEN 1 AND 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 << 3, 2 BETWEEN 1 AND (3 << 3), (2 BETWEEN 1 AND 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 4 >> 1, 2 BETWEEN 1 AND (4 >> 1), (2 BETWEEN 1 AND 4) >> 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 4 >> 1, 2 BETWEEN 1 AND (4 >> 1), (2 BETWEEN 1 AND 4) >> 1 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY, 2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY), (2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND '2000-01-01' +INTERVAL 1 DAY, 2 BETWEEN 1 AND ('2000-01-01' +INTERVAL 1 DAY), (2 BETWEEN 1 AND '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 + 3, 2 BETWEEN 1 AND (3 + 3), (2 BETWEEN 1 AND 3) + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 + 3, 2 BETWEEN 1 AND (3 + 3), (2 BETWEEN 1 AND 3) + 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 - 3, 2 BETWEEN 1 AND (3 - 3), (2 BETWEEN 1 AND 3) - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 - 3, 2 BETWEEN 1 AND (3 - 3), (2 BETWEEN 1 AND 3) - 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 * 3, 2 BETWEEN 1 AND (3 * 3), (2 BETWEEN 1 AND 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 * 3, 2 BETWEEN 1 AND (3 * 3), (2 BETWEEN 1 AND 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 / 3, 2 BETWEEN 1 AND (3 / 3), (2 BETWEEN 1 AND 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 / 3, 2 BETWEEN 1 AND (3 / 3), (2 BETWEEN 1 AND 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 4 DIV 2, 2 BETWEEN 1 AND (4 DIV 2), (2 BETWEEN 1 AND 4) DIV 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 4 DIV 2, 2 BETWEEN 1 AND (4 DIV 2), (2 BETWEEN 1 AND 4) DIV 2 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 MOD 3, 2 BETWEEN 1 AND (3 MOD 3), (2 BETWEEN 1 AND 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 MOD 3, 2 BETWEEN 1 AND (3 MOD 3), (2 BETWEEN 1 AND 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 % 3, 2 BETWEEN 1 AND (3 % 3), (2 BETWEEN 1 AND 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 % 3, 2 BETWEEN 1 AND (3 % 3), (2 BETWEEN 1 AND 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 ^ 3, 2 BETWEEN 1 AND (3 ^ 3), (2 BETWEEN 1 AND 3) ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 ^ 3, 2 BETWEEN 1 AND (3 ^ 3), (2 BETWEEN 1 AND 3) ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 BETWEEN 1 AND 3, 2 BETWEEN 1 AND (3 BETWEEN 1 AND 3), (2 BETWEEN 1 AND 3) BETWEEN 1 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 BETWEEN 1 AND 3, 2 BETWEEN 1 AND (3 BETWEEN 1 AND 3), (2 BETWEEN 1 AND 3) BETWEEN 1 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 IS FALSE, 2 LIKE 2 ESCAPE (3 IS FALSE), (2 LIKE 2 ESCAPE 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 IS FALSE, 2 LIKE 2 ESCAPE (3 IS FALSE), (2 LIKE 2 ESCAPE 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin), charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin)), charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 LIKE 1 ESCAPE 3 COLLATE latin1_bin), charset(2 LIKE 1 ESCAPE (3 COLLATE latin1_bin)), charset((2 LIKE 1 ESCAPE 3) COLLATE latin1_bin) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN(0,1), 2 LIKE 1 ESCAPE (3 IN(0,1)), (2 LIKE 1 ESCAPE 3) IN(0,1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 IN(0,1), 2 LIKE 1 ESCAPE (3 IN(0,1)), (2 LIKE 1 ESCAPE 3) IN(0,1) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 OR 4, 2 LIKE 1 ESCAPE (3 OR 4), (2 LIKE 1 ESCAPE 3) OR 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 OR 4, 2 LIKE 1 ESCAPE (3 OR 4), (2 LIKE 1 ESCAPE 3) OR 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 || 4, 2 LIKE 1 ESCAPE (3 || 4), (2 LIKE 1 ESCAPE 3) || 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 || 4, 2 LIKE 1 ESCAPE (3 || 4), (2 LIKE 1 ESCAPE 3) || 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 XOR 4, 2 LIKE 1 ESCAPE (3 XOR 4), (2 LIKE 1 ESCAPE 3) XOR 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 XOR 4, 2 LIKE 1 ESCAPE (3 XOR 4), (2 LIKE 1 ESCAPE 3) XOR 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 AND 0, 2 LIKE 2 ESCAPE (3 AND 0), (2 LIKE 2 ESCAPE 3) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 AND 0, 2 LIKE 2 ESCAPE (3 AND 0), (2 LIKE 2 ESCAPE 3) AND 0 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 && 0, 2 LIKE 2 ESCAPE (3 && 0), (2 LIKE 2 ESCAPE 3) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 && 0, 2 LIKE 2 ESCAPE (3 && 0), (2 LIKE 2 ESCAPE 3) && 0 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 = 4, 2 LIKE 2 ESCAPE (3 = 4), (2 LIKE 2 ESCAPE 3) = 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 = 4, 2 LIKE 2 ESCAPE (3 = 4), (2 LIKE 2 ESCAPE 3) = 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 <=> 4, 2 LIKE 2 ESCAPE (3 <=> 4), (2 LIKE 2 ESCAPE 3) <=> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 <=> 4, 2 LIKE 2 ESCAPE (3 <=> 4), (2 LIKE 2 ESCAPE 3) <=> 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 >= 4, 2 LIKE 2 ESCAPE (3 >= 4), (2 LIKE 2 ESCAPE 3) >= 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 >= 4, 2 LIKE 2 ESCAPE (3 >= 4), (2 LIKE 2 ESCAPE 3) >= 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 <= 4, 2 LIKE 1 ESCAPE (3 <= 4), (2 LIKE 1 ESCAPE 3) <= 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 <= 4, 2 LIKE 1 ESCAPE (3 <= 4), (2 LIKE 1 ESCAPE 3) <= 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 < 4, 2 LIKE 1 ESCAPE (3 < 4), (2 LIKE 1 ESCAPE 3) < 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 < 4, 2 LIKE 1 ESCAPE (3 < 4), (2 LIKE 1 ESCAPE 3) < 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 <> 4, 2 LIKE 1 ESCAPE (3 <> 4), (2 LIKE 1 ESCAPE 3) <> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 <> 4, 2 LIKE 1 ESCAPE (3 <> 4), (2 LIKE 1 ESCAPE 3) <> 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 > 4, 2 LIKE 2 ESCAPE (3 > 4), (2 LIKE 2 ESCAPE 3) > 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 > 4, 2 LIKE 2 ESCAPE (3 > 4), (2 LIKE 2 ESCAPE 3) > 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 != 4, 2 LIKE 1 ESCAPE (3 != 4), (2 LIKE 1 ESCAPE 3) != 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 != 4, 2 LIKE 1 ESCAPE (3 != 4), (2 LIKE 1 ESCAPE 3) != 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 LIKE 4, 2 LIKE 2 ESCAPE (3 LIKE 4), (2 LIKE 2 ESCAPE 3) LIKE 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 LIKE 4, 2 LIKE 2 ESCAPE (3 LIKE 4), (2 LIKE 2 ESCAPE 3) LIKE 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 REGEXP 4, 2 LIKE 2 ESCAPE (3 REGEXP 4), (2 LIKE 2 ESCAPE 3) REGEXP 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 REGEXP 4, 2 LIKE 2 ESCAPE (3 REGEXP 4), (2 LIKE 2 ESCAPE 3) REGEXP 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 | 4, 2 LIKE 1 ESCAPE (3 | 4), (2 LIKE 1 ESCAPE 3) | 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 | 4, 2 LIKE 1 ESCAPE (3 | 4), (2 LIKE 1 ESCAPE 3) | 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 & 4, 2 LIKE 2 ESCAPE (3 & 4), (2 LIKE 2 ESCAPE 3) & 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 & 4, 2 LIKE 2 ESCAPE (3 & 4), (2 LIKE 2 ESCAPE 3) & 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 1 << 1, 2 LIKE 2 ESCAPE (1 << 1), (2 LIKE 2 ESCAPE 1) << 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 1 << 1, 2 LIKE 2 ESCAPE (1 << 1), (2 LIKE 2 ESCAPE 1) << 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 >> 4, 2 LIKE 2 ESCAPE (3 >> 4), (2 LIKE 2 ESCAPE 3) >> 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 >> 4, 2 LIKE 2 ESCAPE (3 >> 4), (2 LIKE 2 ESCAPE 3) >> 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY, 2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY), (2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 +INTERVAL 1 DAY, 2 LIKE 1 ESCAPE (3 +INTERVAL 1 DAY), (2 LIKE 1 ESCAPE 3) +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 + 4, 2 LIKE 1 ESCAPE (3 + 4), (2 LIKE 1 ESCAPE 3) + 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 + 4, 2 LIKE 1 ESCAPE (3 + 4), (2 LIKE 1 ESCAPE 3) + 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 1 - 1, 2 LIKE 2 ESCAPE (1 - 1), (2 LIKE 2 ESCAPE 1) - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 1 - 1, 2 LIKE 2 ESCAPE (1 - 1), (2 LIKE 2 ESCAPE 1) - 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 * 0, 2 LIKE 2 ESCAPE (3 * 0), (2 LIKE 2 ESCAPE 3) * 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 * 0, 2 LIKE 2 ESCAPE (3 * 0), (2 LIKE 2 ESCAPE 3) * 0 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 DIV 3, 2 LIKE 2 ESCAPE (3 DIV 3), (2 LIKE 2 ESCAPE 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 DIV 3, 2 LIKE 2 ESCAPE (3 DIV 3), (2 LIKE 2 ESCAPE 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 MOD 1, 2 LIKE 2 ESCAPE (3 MOD 1), (2 LIKE 2 ESCAPE 3) MOD 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 MOD 1, 2 LIKE 2 ESCAPE (3 MOD 1), (2 LIKE 2 ESCAPE 3) MOD 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 % 1, 2 LIKE 2 ESCAPE (3 % 1), (2 LIKE 2 ESCAPE 3) % 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 % 1, 2 LIKE 2 ESCAPE (3 % 1), (2 LIKE 2 ESCAPE 3) % 1 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 ^ 4, 2 LIKE 1 ESCAPE (3 ^ 4), (2 LIKE 1 ESCAPE 3) ^ 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 ^ 4, 2 LIKE 1 ESCAPE (3 ^ 4), (2 LIKE 1 ESCAPE 3) ^ 4 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4, 2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4), (2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 2 ESCAPE 3 BETWEEN 2 AND 4, 2 LIKE 2 ESCAPE (3 BETWEEN 2 AND 4), (2 LIKE 2 ESCAPE 3) BETWEEN 2 AND 4 union select * from v1;
+
+create or replace view v1 as select NOT 2 IN (SELECT 0 UNION SELECT 2), NOT (2 IN (SELECT 0 UNION SELECT 2)), (NOT 2) IN (SELECT 0 UNION SELECT 2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 IN (SELECT 0 UNION SELECT 2), NOT (2 IN (SELECT 0 UNION SELECT 2)), (NOT 2) IN (SELECT 0 UNION SELECT 2) union select * from v1;
+
+create or replace view v1 as select - 2 IN (SELECT 2 UNION SELECT 1), - (2 IN (SELECT 2 UNION SELECT 1)), (- 2) IN (SELECT 2 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - 2 IN (SELECT 2 UNION SELECT 1), - (2 IN (SELECT 2 UNION SELECT 1)), (- 2) IN (SELECT 2 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select ~ 2 IN (SELECT 0 UNION SELECT 1), ~ (2 IN (SELECT 0 UNION SELECT 1)), (~ 2) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 IN (SELECT 0 UNION SELECT 1), ~ (2 IN (SELECT 0 UNION SELECT 1)), (~ 2) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select ! 2 IN (SELECT 0 UNION SELECT 2), ! (2 IN (SELECT 0 UNION SELECT 2)), (! 2) IN (SELECT 0 UNION SELECT 2);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 IN (SELECT 0 UNION SELECT 2), ! (2 IN (SELECT 0 UNION SELECT 2)), (! 2) IN (SELECT 0 UNION SELECT 2) union select * from v1;
+
+create or replace view v1 as select BINARY 'c' IN (SELECT 'C' UNION SELECT 'X'), BINARY ('c' IN (SELECT 'C' UNION SELECT 'X')), (BINARY 'c') IN (SELECT 'C' UNION SELECT 'X');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select BINARY 'c' IN (SELECT 'C' UNION SELECT 'X'), BINARY ('c' IN (SELECT 'C' UNION SELECT 'X')), (BINARY 'c') IN (SELECT 'C' UNION SELECT 'X') union select * from v1;
+
+create or replace view v1 as select 0 OR 3 IN (SELECT 3 UNION SELECT 10), 0 OR (3 IN (SELECT 3 UNION SELECT 10)), (0 OR 3) IN (SELECT 3 UNION SELECT 10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 OR 3 IN (SELECT 3 UNION SELECT 10), 0 OR (3 IN (SELECT 3 UNION SELECT 10)), (0 OR 3) IN (SELECT 3 UNION SELECT 10) union select * from v1;
+
+create or replace view v1 as select 0 || 3 IN (SELECT 3 UNION SELECT 10), 0 || (3 IN (SELECT 3 UNION SELECT 10)), (0 || 3) IN (SELECT 3 UNION SELECT 10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 IN (SELECT 3 UNION SELECT 10), 0 || (3 IN (SELECT 3 UNION SELECT 10)), (0 || 3) IN (SELECT 3 UNION SELECT 10) union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 IN (SELECT 4 UNION SELECT 5), 2 XOR (3 IN (SELECT 4 UNION SELECT 5)), (2 XOR 3) IN (SELECT 4 UNION SELECT 5);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 IN (SELECT 4 UNION SELECT 5), 2 XOR (3 IN (SELECT 4 UNION SELECT 5)), (2 XOR 3) IN (SELECT 4 UNION SELECT 5) union select * from v1;
+
+create or replace view v1 as select 2 AND 3 IN (SELECT 0 UNION SELECT 1), 2 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 AND 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 AND 3 IN (SELECT 0 UNION SELECT 1), 2 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 AND 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 && 3 IN (SELECT 0 UNION SELECT 1), 2 && (3 IN (SELECT 0 UNION SELECT 1)), (2 && 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 && 3 IN (SELECT 0 UNION SELECT 1), 2 && (3 IN (SELECT 0 UNION SELECT 1)), (2 && 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 = 3 IN (SELECT 0 UNION SELECT 1), 2 = (3 IN (SELECT 0 UNION SELECT 1)), (2 = 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 IN (SELECT 0 UNION SELECT 1), 2 = (3 IN (SELECT 0 UNION SELECT 1)), (2 = 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 IN (SELECT 0 UNION SELECT 1), 2 <=> (3 IN (SELECT 0 UNION SELECT 1)), (2 <=> 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 IN (SELECT 0 UNION SELECT 1), 2 <=> (3 IN (SELECT 0 UNION SELECT 1)), (2 <=> 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 >= 3 IN (SELECT 1 UNION SELECT 1), 2 >= (3 IN (SELECT 1 UNION SELECT 1)), (2 >= 3) IN (SELECT 1 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 IN (SELECT 1 UNION SELECT 1), 2 >= (3 IN (SELECT 1 UNION SELECT 1)), (2 >= 3) IN (SELECT 1 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 <= 3 IN (SELECT 0 UNION SELECT 1), 2 <= (3 IN (SELECT 0 UNION SELECT 1)), (2 <= 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 IN (SELECT 0 UNION SELECT 1), 2 <= (3 IN (SELECT 0 UNION SELECT 1)), (2 <= 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 < 3 IN (SELECT 0 UNION SELECT 1), 2 < (3 IN (SELECT 0 UNION SELECT 1)), (2 < 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 IN (SELECT 0 UNION SELECT 1), 2 < (3 IN (SELECT 0 UNION SELECT 1)), (2 < 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 <> 3 IN (SELECT 0 UNION SELECT 0), 2 <> (3 IN (SELECT 0 UNION SELECT 0)), (2 <> 3) IN (SELECT 0 UNION SELECT 0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <> 3 IN (SELECT 0 UNION SELECT 0), 2 <> (3 IN (SELECT 0 UNION SELECT 0)), (2 <> 3) IN (SELECT 0 UNION SELECT 0) union select * from v1;
+
+create or replace view v1 as select 2 > 3 IN (SELECT 1 UNION SELECT 1), 2 > (3 IN (SELECT 1 UNION SELECT 1)), (2 > 3) IN (SELECT 1 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 > 3 IN (SELECT 1 UNION SELECT 1), 2 > (3 IN (SELECT 1 UNION SELECT 1)), (2 > 3) IN (SELECT 1 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 != 3 IN (SELECT 0 UNION SELECT 0), 2 != (3 IN (SELECT 0 UNION SELECT 0)), (2 != 3) IN (SELECT 0 UNION SELECT 0);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 != 3 IN (SELECT 0 UNION SELECT 0), 2 != (3 IN (SELECT 0 UNION SELECT 0)), (2 != 3) IN (SELECT 0 UNION SELECT 0) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 IN (SELECT 0 UNION SELECT 1), 2 REGEXP (3 IN (SELECT 0 UNION SELECT 1)), (2 REGEXP 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 IN (SELECT 0 UNION SELECT 1), 2 REGEXP (3 IN (SELECT 0 UNION SELECT 1)), (2 REGEXP 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 | 3 IN (SELECT 0 UNION SELECT 1), 2 | (3 IN (SELECT 0 UNION SELECT 1)), (2 | 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 IN (SELECT 0 UNION SELECT 1), 2 | (3 IN (SELECT 0 UNION SELECT 1)), (2 | 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 & 4 IN (SELECT 0 UNION SELECT 1), 2 & (4 IN (SELECT 0 UNION SELECT 1)), (2 & 4) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 4 IN (SELECT 0 UNION SELECT 1), 2 & (4 IN (SELECT 0 UNION SELECT 1)), (2 & 4) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 << 3 IN (SELECT 0 UNION SELECT 1), 2 << (3 IN (SELECT 0 UNION SELECT 1)), (2 << 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 IN (SELECT 0 UNION SELECT 1), 2 << (3 IN (SELECT 0 UNION SELECT 1)), (2 << 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 >> 3 IN (SELECT 0 UNION SELECT 1), 2 >> (3 IN (SELECT 0 UNION SELECT 1)), (2 >> 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 IN (SELECT 0 UNION SELECT 1), 2 >> (3 IN (SELECT 0 UNION SELECT 1)), (2 >> 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 + 3 IN (SELECT 0 UNION SELECT 1), 2 + (3 IN (SELECT 0 UNION SELECT 1)), (2 + 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 IN (SELECT 0 UNION SELECT 1), 2 + (3 IN (SELECT 0 UNION SELECT 1)), (2 + 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 - 3 IN (SELECT 0 UNION SELECT 1), 2 - (3 IN (SELECT 0 UNION SELECT 1)), (2 - 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 3 IN (SELECT 0 UNION SELECT 1), 2 - (3 IN (SELECT 0 UNION SELECT 1)), (2 - 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 * 0 IN (SELECT 0 UNION SELECT 1), 2 * (0 IN (SELECT 0 UNION SELECT 1)), (2 * 0) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 0 IN (SELECT 0 UNION SELECT 1), 2 * (0 IN (SELECT 0 UNION SELECT 1)), (2 * 0) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 / 3 IN (SELECT 0 UNION SELECT 1), 2 / (3 IN (SELECT 0 UNION SELECT 1)), (2 / 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 IN (SELECT 0 UNION SELECT 1), 2 / (3 IN (SELECT 0 UNION SELECT 1)), (2 / 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 IN (SELECT 0 UNION SELECT 1), 2 DIV (3 IN (SELECT 0 UNION SELECT 1)), (2 DIV 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 IN (SELECT 0 UNION SELECT 1), 2 DIV (3 IN (SELECT 0 UNION SELECT 1)), (2 DIV 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 IN (SELECT 0 UNION SELECT 1), 2 MOD (3 IN (SELECT 0 UNION SELECT 1)), (2 MOD 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 IN (SELECT 0 UNION SELECT 1), 2 MOD (3 IN (SELECT 0 UNION SELECT 1)), (2 MOD 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 % 3 IN (SELECT 0 UNION SELECT 1), 2 % (3 IN (SELECT 0 UNION SELECT 1)), (2 % 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 IN (SELECT 0 UNION SELECT 1), 2 % (3 IN (SELECT 0 UNION SELECT 1)), (2 % 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 IN (SELECT 0 UNION SELECT 1), 2 ^ (3 IN (SELECT 0 UNION SELECT 1)), (2 ^ 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 IN (SELECT 0 UNION SELECT 1), 2 ^ (3 IN (SELECT 0 UNION SELECT 1)), (2 ^ 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1), 2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 IN (SELECT 0 UNION SELECT 1), 2 BETWEEN 1 AND (3 IN (SELECT 0 UNION SELECT 1)), (2 BETWEEN 1 AND 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 1 ESCAPE 3 IN (SELECT 0 UNION SELECT 1), 2 LIKE 1 ESCAPE (3 IN (SELECT 0 UNION SELECT 1)), (2 LIKE 1 ESCAPE 3) IN (SELECT 0 UNION SELECT 1) union select * from v1;
+
+create or replace view v1 as select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND 2) AND NULL, 3 BETWEEN 1 AND (2 AND NULL), (3 BETWEEN 1 AND 2) AND NULL;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 3 BETWEEN 1 AND 2 AND NULL, 3 BETWEEN (1 AND 2) AND NULL, 3 BETWEEN 1 AND (2 AND NULL), (3 BETWEEN 1 AND 2) AND NULL union select * from v1;
+
+set sql_mode=PIPES_AS_CONCAT;
+create or replace view v1 as select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 OR 3 || 3, 2 OR (3 || 3), (2 OR 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 OR 3, 2 || (3 OR 3), (2 || 3) OR 3 union select * from v1;
+
+create or replace view v1 as select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select NOT 2 || 3, NOT (2 || 3), (NOT 2) || 3 union select * from v1;
+
+create or replace view v1 as select - '2 ' || 3, - ('2 ' || 3), (- '2 ') || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select - '2 ' || 3, - ('2 ' || 3), (- '2 ') || 3 union select * from v1;
+
+create or replace view v1 as select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ~ 2 || 3, ~ (2 || 3), (~ 2) || 3 union select * from v1;
+
+create or replace view v1 as select ! 2 || 3, ! (2 || 3), (! 2) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select ! 2 || 3, ! (2 || 3), (! 2) || 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 IS FALSE, 2 || (3 IS FALSE), (2 || 3) IS FALSE union select * from v1;
+
+create or replace view v1 as select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 IN (3,10), 0 || (3 IN (3,10)), (0 || 3) IN (3,10) union select * from v1;
+
+create or replace view v1 as select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 0 XOR 1, 1 || (0 XOR 1), (1 || 0) XOR 1 union select * from v1;
+
+create or replace view v1 as select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 1 AND 0, 1 || (1 AND 0), (1 || 1) AND 0 union select * from v1;
+
+create or replace view v1 as select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 || 1 && 0, 1 || (1 && 0), (1 || 1) && 0 union select * from v1;
+
+create or replace view v1 as select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 = 3, 2 || (3 = 3), (2 || 3) = 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 <=> 3, 2 || (3 <=> 3), (2 || 3) <=> 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 >= 3, 2 || (3 >= 3), (2 || 3) >= 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 <= 0, 2 || (3 <= 0), (2 || 3) <= 0 union select * from v1;
+
+create or replace view v1 as select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 < 0, 2 || (3 < 0), (2 || 3) < 0 union select * from v1;
+
+create or replace view v1 as select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 <> 3, 0 || (3 <> 3), (0 || 3) <> 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 > 3, 2 || (3 > 3), (2 || 3) > 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 != 3, 0 || (3 != 3), (0 || 3) != 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 LIKE 3, 2 || (3 LIKE 3), (2 || 3) LIKE 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 REGEXP 3, 2 || (3 REGEXP 3), (2 || 3) REGEXP 3 union select * from v1;
+
+create or replace view v1 as select 2 || ' 3' | 3, 2 || (' 3' | 3), (2 || ' 3') | 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || ' 3' | 3, 2 || (' 3' | 3), (2 || ' 3') | 3 union select * from v1;
+
+create or replace view v1 as select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 2 & 2, 0 || (2 & 2), (0 || 2) & 2 union select * from v1;
+
+create or replace view v1 as select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 << 3, 2 || (3 << 3), (2 || 3) << 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 >> 3, 2 || (3 >> 3), (2 || 3) >> 3 union select * from v1;
+
+create or replace view v1 as select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || '2000-01-01' +INTERVAL 1 DAY, 2 || ('2000-01-01' +INTERVAL 1 DAY), (2 || '2000-01-01') +INTERVAL 1 DAY union select * from v1;
+
+create or replace view v1 as select 2 || ' 3' + 3, 2 || (' 3' + 3), (2 || ' 3') + 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || ' 3' + 3, 2 || (' 3' + 3), (2 || ' 3') + 3 union select * from v1;
+
+create or replace view v1 as select 2 || ' 3' - 3, 2 || (' 3' - 3), (2 || ' 3') - 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || ' 3' - 3, 2 || (' 3' - 3), (2 || ' 3') - 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 * 3, 2 || (3 * 3), (2 || 3) * 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 / 3, 2 || (3 / 3), (2 || 3) / 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 DIV 3, 2 || (3 DIV 3), (2 || 3) DIV 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 MOD 3, 0 || (3 MOD 3), (0 || 3) MOD 3 union select * from v1;
+
+create or replace view v1 as select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 || 3 % 3, 0 || (3 % 3), (0 || 3) % 3 union select * from v1;
+
+create or replace view v1 as select 2 || ' 3' ^ 3, 2 || (' 3' ^ 3), (2 || ' 3') ^ 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || ' 3' ^ 3, 2 || (' 3' ^ 3), (2 || ' 3') ^ 3 union select * from v1;
+
+create or replace view v1 as select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 || 3 BETWEEN 2 AND 3, 2 || (3 BETWEEN 2 AND 3), (2 || 3) BETWEEN 2 AND 3 union select * from v1;
+
+create or replace view v1 as select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 XOR 3 || 3, 2 XOR (3 || 3), (2 XOR 3) || 3 union select * from v1;
+
+create or replace view v1 as select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 AND 3 || 3, 0 AND (3 || 3), (0 AND 3) || 3 union select * from v1;
+
+create or replace view v1 as select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 && 3 || 3, 0 && (3 || 3), (0 && 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 = 3 || 3, 2 = (3 || 3), (2 = 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <=> 3 || 3, 2 <=> (3 || 3), (2 <=> 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >= 3 || 0, 2 >= (3 || 0), (2 >= 3) || 0 union select * from v1;
+
+create or replace view v1 as select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 <= 3 || 3, 2 <= (3 || 3), (2 <= 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 < 3 || 3, 2 < (3 || 3), (2 < 3) || 3 union select * from v1;
+
+create or replace view v1 as select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 <> 3 || 3, 1 <> (3 || 3), (1 <> 3) || 3 union select * from v1;
+
+create or replace view v1 as select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 0 > 3 || 3, 0 > (3 || 3), (0 > 3) || 3 union select * from v1;
+
+create or replace view v1 as select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 1 != 3 || 3, 1 != (3 || 3), (1 != 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 LIKE 3 || 3, 2 LIKE (3 || 3), (2 LIKE 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 REGEXP 3 || 3, 2 REGEXP (3 || 3), (2 REGEXP 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 | 3 || 3, 2 | (3 || 3), (2 | 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 & 3 || 3, 2 & (3 || 3), (2 & 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 << 3 || 3, 2 << (3 || 3), (2 << 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 >> 3 || 0, 2 >> (3 || 0), (2 >> 3) || 0 union select * from v1;
+
+create or replace view v1 as select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 + 3 || 3, 2 + (3 || 3), (2 + 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 - 2 || 0, 2 - (2 || 0), (2 - 2) || 0 union select * from v1;
+
+create or replace view v1 as select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 * 3 || 3, 2 * (3 || 3), (2 * 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 / 3 || 3, 2 / (3 || 3), (2 / 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 DIV 3 || 3, 2 DIV (3 || 3), (2 DIV 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 MOD 3 || 3, 2 MOD (3 || 3), (2 MOD 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 % 3 || 3, 2 % (3 || 3), (2 % 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 ^ 3 || 3, 2 ^ (3 || 3), (2 ^ 3) || 3 union select * from v1;
+
+create or replace view v1 as select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select 2 BETWEEN 1 AND 3 || 3, 2 BETWEEN 1 AND (3 || 3), (2 BETWEEN 1 AND 3) || 3 union select * from v1;
+
+create or replace view v1 as select charset(2 LIKE 1 ESCAPE 3 || ''), charset(2 LIKE 1 ESCAPE (3 || '')), charset((2 LIKE 1 ESCAPE 3) || '');
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+select charset(2 LIKE 1 ESCAPE 3 || ''), charset(2 LIKE 1 ESCAPE (3 || '')), charset((2 LIKE 1 ESCAPE 3) || '') union select * from v1;
+
+# not precedence tests as such, but still tests of Item::print, parentheses and enum precedence
+
+create or replace view v1 as select ! - 1, - ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select ! BINARY 1, BINARY ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select ! (NOT 1), NOT ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select ! ~ 1, ~ ! 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select - BINARY 1, BINARY - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select - (NOT 1), NOT - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select - ~ 1, ~ - 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select BINARY (NOT 1), NOT BINARY 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select BINARY ~ 1, ~ BINARY 1;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select NOT ~ 1, ~ (NOT 1);
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+create or replace view v1 as select 1 IS TRUE IS FALSE, 2 IS FALSE IS UNKNOWN, 3 IS UNKNOWN IS NULL, 4 IS NULL IS TRUE;
+Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
+
+drop view v1;
diff --git a/mysql-test/t/precedence_bugs.test b/mysql-test/t/precedence_bugs.test
new file mode 100644
index 00000000000..6e8e624c840
--- /dev/null
+++ b/mysql-test/t/precedence_bugs.test
@@ -0,0 +1,41 @@
+--echo #
+--echo # Bug#6726: NOT BETWEEN parse failure
+--echo #
+create table t1 (a int, b int);
+insert into t1 values (1,2), (2,3), (3,4), (4,5);
+select * from t1 where a not between 1 and 2;
+select * from t1 where a not between 1 and 2 and b not between 3 and 4;
+drop table t1;
+
+--echo #
+--echo # MDEV-13673 Bad result in view
+--echo #
+explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
+
+--echo #
+--echo # MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
+--echo #
+create table t1 (i int, j int);
+insert t1 values (1,1),(2,2);
+create view v1 as select (2, 3) not in (select i, j from t1);
+select * from v1;
+query_vertical show create view v1;
+drop view v1;
+drop table t1;
+
+--echo #
+--echo # MDEV-23656 view: removal of parentheses results in wrong result
+--echo #
+create table t1 (a int, b decimal(10,2));
+insert into t1 values (1, 10.2);
+create view v1 as select avg(b) / (2 + a) from t1;
+query_vertical show create view v1;
+drop view v1;
+drop table t1;
+
+--echo #
+--echo # MDEV-17408 VIEW is incorrectly defined for a combination of = and BETWEEN
+--echo #
+create view v1 as select 1 like (now() between '2000-01-01' and '2012-12-12' );
+query_vertical show create view v1;
+drop view v1;
diff --git a/mysql-test/t/processlist_notembedded.test b/mysql-test/t/processlist_notembedded.test
index 2dc6a0539ab..26021040c39 100644
--- a/mysql-test/t/processlist_notembedded.test
+++ b/mysql-test/t/processlist_notembedded.test
@@ -1,6 +1,7 @@
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/not_embedded.inc;
+source include/count_sessions.inc;
--echo #
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
@@ -10,9 +11,9 @@ connect (con1,localhost,root,,);
connection con1;
-let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "' or sleep (30)")`;
+let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "sleep'")`;
-SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
--disable_query_log
--send_eval $q;
--enable_query_log
@@ -23,12 +24,37 @@ SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
exec $MYSQL test -e "SHOW PROCESSLIST" > $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
-let SEARCH_PATTERN=sleep \(30\);
+let SEARCH_PATTERN=sleep;
source include/search_pattern_in_file.inc;
remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
+SET DEBUG_SYNC= 'now SIGNAL go';
+
+connection con1;
+reap;
disconnect con1;
+connection default;
SET DEBUG_SYNC = 'RESET';
+source include/wait_until_count_sessions.inc;
+
--echo End of 5.5 tests
+
+--echo #
+--echo # MDEV-23752: SHOW EXPLAIN FOR thd waits for sleep
+--echo #
+
+--connect (con1,localhost,root,,)
+--let $con_id = `SELECT CONNECTION_ID()`
+--send select sleep(100000);
+
+--connection default
+
+--replace_result $con_id con_id
+eval SHOW EXPLAIN FOR $con_id;
+
+--replace_result $con_id con_id
+eval KILL QUERY $con_id;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index b82394b56f6..90af3ff7ce1 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -4885,6 +4885,23 @@ drop procedure p;
drop view v1;
drop table t1;
+
+--echo #
+--echo # MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
+--echo #
+
+CREATE TABLE t1 (a INT);
+--error ER_INVALID_DEFAULT_PARAM
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
+--error ER_INVALID_DEFAULT_PARAM
+EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
+EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
+EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
+DROP TABLE t1;
+--error ER_INVALID_DEFAULT_PARAM
+EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
+EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
+
--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 4091b8406fa..7235c6af3b3 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1720,6 +1720,23 @@ drop table t1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=@save_userstat;
+--echo #
+--echo # MDEV-5924: MariaDB could crash after changing the query_cache size
+--echo #
+
+SET GLOBAL query_cache_size= 50*1024;
+SET GLOBAL query_cache_type= 1;
+SET query_cache_type= 1;
+
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT * FROM v1 WHERE pk IN (5178922,5178924,6911605,6584899,1754348,7735031,9583206,8377182,6309967,3110885,7197937,5582397,9811721,8310302,7001831,3687942,8454635,8743988,9524703,3313583,1376007,5276565,7238861,5307189,2242691,2052764,8160476,7668014,5891525,9070968,1989181,3014068,5365005,2974655,6877822,7813446,6188705,1028564,6426696,6098205,7231857,2749710,4996963,9879425,2995803,8160614,1934799,1981216,3673522,2135299,4803054,8515609,1825485,5805694,8211425,3712249,8013259,3496368,4339706,2326187,3236816,8158416,5749801,6339492,2517486,1769729,2576400,8177368,5471847,4670669,5694046,5155990,1219314,1304321,7951736,2381942,1467330,3329376,6069503,3821151,8118179,4575775,5291671,4757186,6241302,9809112,5388351,3356292,5753921,8776535,7101943,8558868,6655212,5498901,1629516,8016143,1156005,1280700,9236450,8289703,4549957,5404968,3594833,3034667,3167602,7983322,3939941,8382949,9258422,6927947,9639236,3246566,3144943,5516067,5266540,3760726,6491516,9515090,7776229,1582824,4031951,3336517,5871612,4268432,2600433,6188018,6158355,6442214,7808502,7692871,9180969,3982238,9212692,9944381,3932525,5937118,6315460,2464477,1933151,3393646,4244674,7036026,1470764,3015029,2453765,9876129,2097534,3467391,4287658,8120651,4975540,4454101,7758102,6087905,2167022,7575454,5370086,8289703,7460235,8734512,7346801,6660293,5826843,4305511,8093597,8970031,9104476,1784973,9245925,6893890,4996414,3144393,1145568,2702056,4984878,5602859,7088073,2044113,5248275,6037094,2185287,1791564,3180374,8750991,9187011,6411453,9600372,4819671,3105667,2837051,1252548,3729003,7986618,8305633,5684432,4528808,8670104,4132202,2101516,5218475,6885513,4886413,1288803,9584167,6524475,3943649,6195846,4204986,5435592,8877334,9276275,8848358,3583435,6662216,7178298,1973526,5917205,9156387,8877334,4559432,2792144,9831634,8846710,6979858,5287277,2220718,9358123,4140029,1263122,8049789,9508361,3597030,8504348,4525924,9062866,1880691,9788375,4746612,7711822,9735366,9227523,9701721,2832519,4498870,3725021,4836151,2351181,7339935,9890686,7641098,1797607,1571838,3258377,6244186,5147476,6760543,9151580,2465576,2545776,6846237,4037582,8310440,2503616,1998245,1716445,2364913,4665039,8420440,1187728,1065917,1734710,5826705,8538681,8311950,4662017,7804519,7696853,7385116,8674362,2787612,2393341,1652313,2254364,3852737,4177108,7013641,8654037,9062728,7826629,2569396,1039138,2572692,9001892,3470550,4859359,5218887,6479568,1424621,3535644,7808639,7817291,8825149,6060302,2830047,7787765,5971313,9603256,1800491,3429214,9350021,8716796,1972564,6054946,6445510,9234802,5616729,6064559,2048233,9458511,1597244,3902862,2530120,5723846,3463821,9008346,3055130,2941696,8774337,3095367,2195037,6208480,9869262,3615295,9916641,1078002,1815597,7737228,1412261,6588607,9740173,6696411,7740386,1641326,9269546,3848754,7745193,6819458,5297164,1280975,1224395,5247589,7793533,5314743,8814025,2579010,7882659,6753128,9558349,8710067,7898727,4209106,2634902,7311233,1644897,8363449,6201339,1770828,3572174,5493408,8835449,5644332,5096115,7116088,1534484,3204544,1772064,2091903,6744476,9183166,5546005,1030075,7387725,1300888,5799789,7340209,7356552,7677627,9410995,5775894,9442581,5718353,6544937,9809524,7171569,4565475,1397293,6687759,1509353,3715682,8607208,3506118,3910827,1890167,1559341,4150329,9679336,9756927,1292373,3445419,2105361,6594238,4234237,8359466,7352432,1492462,9482818,1601226,8561614,4186584,5849365,1460189,9139495,3113357,8384460,7229660,8701553,7786254,4606399,2057708,1638992,1083221,8147293,9569198,4776550,2539871,8040039,7104141,8090713,7242568,2361480,6913940,7958053,1414596,3451461,9160644,7901473,8289703,5428588,3063232,2302291,5366378,8216918,8033447,8048965,8636322,7807952,7146026,6589569,2882644,1971328,7786392,5357864,4637985,2137222,9819961,9039932,8900680,1666732,8126968,1652999,7199035,8229003,7845581,8902328,8100051,9506164,8168579,8786560,4753890,6941268,5035552,2919860,9570983,4751968,4566574,7540023,1621963,7924270,7578750,6669494,5857192,6409805,2030792,4401779,5737991,8241088,4739746,2776901,7373718,8786697,9211593,6219741,1758331,3863586,6932754,5006164,8200302,5925033,1962127,2728149,8540191,9044326,6171264,4224899,9248672,5911026,6974502,1950317,4998611,2561569,2891845,3243957,8806335,8058303,8791778,1475708,3335281,7841186,9153228,5532135,5453994,5966369,4194824,3612686,8645385,9952621,1211349,2806289,4358520,7454330,5964035,2415313,8897384,6479431,1467330,6496185,8941055,8369903,5015502,5586105,4288482,3266204,1793212,6083923,6920394,1272048,7913696,1253234,3975372,9038970,7229522,7319061,4729995,9990386,5756942,4622741,8179565,1901840,2060729,6308593,2311767,6058517,9440521,4506286,2667724,2707412,9264328,7481658,7283767,4022613,7292282,7722808,1607543,3303695,9334091,4429382,7483169,2624877,7084777,1376693,3797668,1654510,6480667,4619720,9884094,5862548,9422256,4009429,6273574,8836135,8204696,7987167,1890991,6920944,2501831,7627502,3287765,9907714,8246444,2397872,6005920,6982330,5250473,8604049,6665649,4658172,8910156,2989349,2872344,5909790,5837142,1457168,6535461,2226623,1763137,9385314,1692550,9805267,2558547,7501022,7434143,5598876,5709976,6785263,6020614,1443572,3101684,3374557,4787536,3978530,9441757,1930130,9930648,8580841,9180145,1442749,9766128,9032516,7260009,3941177,6559494,9137985,4546386,3074356,5515518,9012878,2276748,4035247,9025100,6259704,9377487,4794540,5761474,2752593,3987731,8114746,2718948,3247390,3037689,3311660,8790679,5536666,2222091,5232482,8974563,4368682,3214843,8420028,8806335,8848220,7466827,6930969,8109664,5539825,4431991,9777114,1658630,1989456,4565338,4458084,9845504,1885635,9934494,5555755,2949661,1578155,8792465,5856231,1098190,3172134,3951339,2971771,6514724,7918090,8303161,8927734,5148162,3115005,8331726,8686172,9277099,5245941,8956710,9073989,9181930,1564422,7557327,9082504,3478927,5851699,1516220,6011001,3210998,7561996,3128875,3419052,8286682,3075180,4222702,9359085,4364151,5275878,8327606,8856597,5770950,4176971,9744155,7107299,3555694,8808120,1351837,1360076,6263137,8084533,7500198,4953704,5528839,7879226,7829376,8476745,9084976,9013153,9360595,1519927,9272705,2386062,6703552,2987976,2653991,7962310,6720443,7441421,9816116,8835861,1495346,2436462,3964523,5086776,2948287,9331619,3395294,2654541,4939971,5529388,2443054,8942016,4211166,4622741,4996826,3370712,8998596,8414672,6178268,8606521,4673553,8279541,6275634,5673858,3244918,1834274,1526931,7676940,2071578,4389968,8847671,8347793,5627304,3150848,6094223,3139175,7662246,4629882,6958709,6080078,6604812,6250503,8088928,8115158,5547515,6602340,9526214,7144378,6659744,2319869,8054733,1483261,5373657,5053268,2558273,4960433,3183807,8498855,9974731,2374801,8405883,1960617,4945877,2526550,7739700,5407440,6752304,8544998,3976608,6499618,1631164,8728744,3698516,8548431,5066864,5619064,5310623,6882492,6150802,6524063,6251052,3584671,8603775,2213165,7723495,4073150,9552993,9999450,8793975,6491241,4660095,9930786,4196609,8377456,4691268,3305343,4692779,5583221,8125320,4233688,4325836,7907516,4892318,4463714,3417266,1417343,9836441,1187866,2645751,7921936,2998275,2052352,5054229,9570159,9308273,7085052,4329132,6040390,5786056,7763320,5193618,8289703,5839752,2938400,9261032,2333740,8758682,8836135,3190261,2023376,1993301,8853439,8487869,8288879,1314758,9366775,4800720,2819610,1451126,3274719,2042053,9648025,2290206,7490997,1195281,1606033,1245407,3106765,2140518,9124389,8877197,7443206,5344268,1341262,5363906,7709762,3759902,4991333,2916427,3489913,1779754,4042251,5729888,4771057,3584533,4547760,5565505,7738327,7732559,5686904,2558273,2051116,4332153,9457275,9341644,4819946,2643692,7991149,1085830,4004486,4451492,8963714,3540176,4449020,5051483,2061691,2676651,5276153,9197860,7980850,3026428,2856414,8852752,4922805,8302612,1072509,9081542,9056823,8404922,6097930,3939804,4919097,7398712,5407302,6692565,2214401,5561660,7238311,9212554,4992568,6093811,5223144,1899368,7665542,4582092,7409286,9964294,1835372,4815963,3387054,7423294,9401657,1044494,8743713,6644226,8916748,6272750,6561965,4788223,4657897,3687393,6183486,3993774,6385223,8807159,2952682,2643692,7253280,2452804,5163818,3558853,6846511,3127502,1926834,8465347,4805801,2904479,2171691,8575622,3015853,8413299,9511245,3628479,4821868,1020324,9179046,5233032,4244400,3795471,2762893,2857376,7661010,6360778,4951644,1309265,8922927,7212219,2014862,9049407,5376403,5611511,2232940,5183456,2757949,4638946,6997848,7474517,6429168,1501800,5802124,8222274,9924880,8694000,3835708,8349304,5278213,1097091,5408126,6541915,8095245,3619415,6916961,2786102,4845352,7466827,3578079,8144683,4338470,1635971,9640609,3117614,1855010,5728103,6300903,7430709,1900192,3673660,6037643,5595443,7049072,6462951,3585632,8084533,1853363,8477294,2266586,1465270,1276580,2511856,2895828,4337097,3626968,7087249,8985000,9414840,7458724,1141174,7457214,1602325,4407272,7694519,5595306,3399688,8429092,5586380,2441543,4488845,6415573,9871047,2366287,5840713,7647552,8970306,3026016,8186569,5060821,9175888,2428634,4199768,7791061,9595565,2325363,2228820,2966415,5135116,7646453,5928054,6217681,2612930,8201812,4628372,4872955,3597305,5363082,6790893,7307388,2064025,6947860,9389984,2415451,4464401,8022598,7566390,6675811,3299850,6845413,9396438,2775527,1796508,1665359,7119934,1264907,2772644,8598693,4670669,2209182,5293182,1299514,7853683,7307525,3205093,1643661,5012481,3448440,2148208,6146820,6530380,5167251,4132614,4331054,9009719,4979522,3280487,7764144,6472427,9053253,4821456,3984985,4425674,7194503,2939361,6038879,6136795,9609985,1561401,3836807,7960662,8419204,4684951,6060989,9063690,5382308,6334548,5833572,9388198,8814849,5744033,4868148,1200775,6155197,5857192,1321624,9067535,4156234,2739959,4067108,3602661,8168441,4998748,5604919,4829833,5483520,9798538,3330474,2504852,4206909,1574035,1379440,9239746,3629440,8028366,1766845,8773513,1564834,9511657,7040695,7232955,4622467,6376022,7167312,3728591,2885940,4396835,8868270,7126800,9963195,6857360,8126831,5344406,3878555,7389236,9083740,5007949,4776962,9162017,8039764,2822631,7905044,1516357,9784667,6493438,7841873,9634292,3971252,2542480,3446517,4340805,4752929,6867660,3490188,3628890,9403579,5384231,3443496,9004089,6138854,1594360,7386215,9240707,3856857,5428863,2509521,9643905,7018722,9202941,5178375,4411254,7385116,1032135,5022506,3187652,5829727,7550186,7026824,2408035,9947540,9273666,7087936,3519851,2677337,8457244,2005661,4680969,7654968,2781570,4380081,5025390,3519851,9721084,1380264,2092041,1889892,2931121,7856018,3507766,5226303,4501617,8759506,6521591,6303924,5419250,4346023,2481506,6510330,3082870,7123367,4848236,7687789,8214035,6017868,4840545,8739181,4010116,7725280,6304473,6717834,6878509,8717071,7901062,6616348,4601318,7868927,3206878,3577255,2269744,3181472,1819305,4741119,5834259,1561264,7062255,9452194,2613754,3131347,7384979,6041351,2607711,7039733,7047561,2902420,1954162,9234252,9188522,8082885,4378570,3174057,3865371,2107696,6976425,7944458,9164901,7252593,5173294,8744537,1974624,9989013,4207321,5217926,2511032,1816970,1975036,7593170,5195953,3204681,2588897,5102981,1978607,2856002,7484954,7652359,6692153,1021011,7428237,5203643,2542892,8071487,3258789,8846160,9323516,7058685,6720581,9020843,3444595,1471038,4219131,5868041,4378570,3913986,5849914,1166580,6608795,5926269,9542007,7833496,7679412,9654891,2661956,2453765,9437225,8606246,1918182,2806838,9062179,7191619,1914337,6861343,9976791,2286773,4190429,2203964,6232238,7523681,6100128,7373992,6461715,7533432,4364425,3069549,5995483,3859741,9647476,2696838,9232879,3760177,9996704,3229263,1862838,5615081,5493682,2845703,2029144,3163070,6955413,6317382,9031143,8281463,4034286,6611404,5656692,6529281,2557037,7679138,3738891,7174179,1447692,4899871,1031311,2919723,9078796,6147369,9996154,1052597,5393844,9947265,8596496,4228469,3644683,5696243,9690322,3616119,1088714,2409408,9116287,6616210,8487594,6966949,9066986,8876098,1753799,3326492,2843505,4818298,3586044,6671554,9584304,9400833,3439788,9963745,9062454,5329025,4675338,4869110,9144851,4437484,6226333,2525177,6007293,2460083,9634979,2118820,6699844,6908035,2795578,3744247,9154464,7273742,2250106,4507247,1230575,4279830,6382064,2348434,8891067,3391723,4348358,9550247,3103195,8312500,1096817,1399078,1557693,9679061,5311035,8970581,3799728,4678497,3626144,2506088,5866256,6802154,2960510,8350540,3022857,9459060,2306274,6918197,1693374,6662902,2821807,9658737,3177215,7515991,7572296,6487258,7247650,3706619,2758773,1652862,7224166,6737197,6782653,9508499,6613464,6106307,7986755,3156753,1912689,1157928,3418365,2435089,6668395,2821121,4458084,6213150,7384841,4956588,5656692,9468399,7376190,1529541,7625167,8110488,4155548,4326660,9321182,7022293,2455001,2438247,6575973,6285659,7469299,7221694,2205200,8063247,1420089,6965988,1546844,1101211,1029525,1977233,7771560,1325469,1002197,7301620,8807983,6497558,9104614,4806625,6226608,6400192,4939971,1838119,5926544,5520736,1008239,7172256,2969299,1701065,2148345,9481033,6402252,3724060,5954696,3031097,1415832,4303314,2261367,1832077,2679534,9446289,6289642,5956481,6198181,4659408,2550033,5247451,2534515,3963287,5095428,2133926,2739273,8188217,3215667,3772262,5836044,9515914,7171432,1232360,3201110,3740264,8057205,2948013,2683380,3211685,3389938,5149536,5809814,2937438,1515121,2497161,1916946,9803070,3426055,2634490,2554565,6387695,1088165,3881027,9005325,4338607,8863464,7781997,8261825,4775314,5127700,7733795,7307662,2691619,7675155,7405029,3044555,5825195,7004577,1170974,5709426,6961456,8078491,6280166,4126296,6142974,3652511,6972854,8634674,3751251,3765670,8268692,6040664,6930145,7486328,5643508,7432495,6320541,5509338,5313095,5205291,1573486,7694519,9343841,2139007,5612060,4143325,1307479,9871459,7109771,6907073,8700454,8613937,1154495,8917709,7844482,8447906,4566436,7239135,8489517,6052200,3839691,8229141,2835678,4199905,4175323,8708282,8194808,4871032,1574859,5727005,5008087,8324310,1463348,2027908,8441726,9971160,4810195,5793334,3275268,9397537,4217071,9775192,7305740,5373931,9941085,2398422,1982727,9201156,4322540,4933517,4495849,5232894,6585449,7331008,2030380,7920013,2480133,3811264,4413452,9220382,1735946,9804443,7867004,1716995,4794265,9334091,9085937,6289505,6787734,2436599,6362701,1682113,9238510,2713180,9974731,8810867,5440124,1605346,7554306,2156448,8995162,1488616,5659713,9083602,1474746,8179290,3266479,6432189,3670639,3946395,9397125,2223464,2407348,7623107,5608078,1825759,9384216,8912216,1553573,3422897,2014999,9478012,3343109,1127990,4734252,2919174,6914352,5589126,6739257,9217086,7136825,6427658,1636795,4750732,8867584,3355194,6962417,7476028,3676681,3311248,7041381,5358688,6461715,2466674,1160812,5658477,7668701,3436492,1520339,1155868,7340484,5543807,9931472,4916351,4708572,9482269,6733489,3684921,1550277,1217529,7894882,8505722,1027053,1472686,7768676,7660186,6224548,1642013,7472045,9516738,9112304,7475891,9356063,7386627,1142272,2380706,6537246,8979507,5205017,6678558,9957977,7552108,7161132,8668594,6944839,1344284,2669509,6835388,1734024,1395782,1526519,2048233,4932006,8337219,7240371,8092910,5380798,6250778,3054855,9382293,7395965,8190826,7143417,6188568,4846725,3462585,3192459,4239730,2046173,3249038,7091369,8025619,6921768,7681472,3949142,9657363,7432083,9947952,7155502,5621810,9702407,4531005,9706253,6277420,4844802,7171432,7510910,7433593,5931900,8650329,8901092,5858154,4095260,4981582,3058837,1055618,3214157,8112823,8584686,2161529,9165863,8723663,3921676,9294815,7104553,2218933,4856338,6214111,9738388,4507385,9814605,5619476,3073944,6663589,6171264,3944747,7595642,2061828,1291549,3983886,9349472,8080001,1524597,7195190,5899627,8965774,1866134,8026992,2628311,2957077,8510116,9107772,6343338,8253860,4008056,8646896,4668334,3932388,3253845,5886444,5178100,2396499,2014038,2950347,5752685,4460418,2222091,3933761,6116195,6655349,5753921,7576416,4029617,9855392,7905731,3363021,5107925,9814193,8291625,3396118,7727340,8709106,7378662,2883880,9994369,1283721,6381515,9586502,9243728,1684173,5730987,8065444,5034179,1582687,1839355,8079864,3111434,6681854,4377883,6971893,4306335,6193237,1788269,6387695,2837463,4385025,5243469,3174743,4987213,4790969,8780242,4800720,2618560,4176147,4818984,7139160,2503341,3850814,9791671,2962158,9929962,5429962,5096252,3986495,4558197,7627365,9094863,9817352,4991607,7182281,5376953,5630050,8035095,2510208,6003860,2938125,7106887,3171859,1955535,7287338,1773712,7754669,7495941,8222000,4877899,7259323,4678359,1366531,4223800,3587005,3707168,2965866,2295425,1219451,7376739,3728454,9970886,6685424,5303894,2315887,9703781,2909561,2175811,2323165,7140121,5034454,7728713,5091583,6640106,2812194,1678405,8201538,2672393,4156784,8321426,5984634,2550033,2953506,6023086,1902389,1477493,4717636,4315399,2133514,6376846,5195816,4818298,9213790,2461318,1505645,7708389,3072433,4026733,2905441,4950271,9309646,2427673,3788604,5009185,8055969,6708496,2996353,3267303,8261962,7856567,5043243,5857742,4757736,8148254,6347595,3138214,7927566,9555328,1061660,9522094,7344879,3679702,9596115,2885391,5208862,1187316,2430694,6269180,7927566,8208404,1305557,1094345,3691787,5673171,5388214,4610794,3382659,1052047,6508132,9796203,1656845,1468566,2053451,3425094,7553344,4655014,8623550,3527130,1465820,9716827,3031921,7952148,3823211,9178497,9751296,2261642,4323776,9275726,9396713,8665298,9065475,3965347,4339019,9221206,8415771,3620239,6043273,4017669,5966918,7879364,1225357,1557693,1418029,5619750,3420288,4062301,4727935,8520965,4057769,9912384,1385345,3190261,1635009,5948928,9135787,8316482,4085784,7848876,2012527,4822143,2933731,4295349,4014236,6482864,3328826,7162643,2271255,2981796,9557113,9432693,9047897,6868209,5119186,8063522,3421249,8389816,6970932,1526794,9981323,6666061,8019989,2235137,9397674,2172653,4471405,9574966,1193222,2005249,3118026,1768218,3572723,3890502,7165664,9276138,4645675,1415008,1691864,3969055,9891784,3438964,9327087,8777359,2208221,2164550,3255218,9043640,4385986,8827209,9126037,7295166,6357345,1478454,2973831,9655166,1058364,2829772,8735198,6611129,8250564,6625549,2459808,6358993,6145446,6513763,8809906,3443222,1175506,7884445,5938491,3910003,2754791,6642028,6344024,7692321,7374542,4383651,1791976,6447158,1875610,7949401,4899871,5562210,9243316,1815460,1476806,2551406,6766448,3296005,1213958,2557037,9905792,9026611,9817352,3179687,7716079,5693908,2177871,2351318,7162918,6483001,7673095,6473388,7181182,7209884,9192642,2536437,6816848,3608978,9982421,6441802,3296966,8742614,5900588,7242019,3370437,5003005,1180038,9520996,3764846,3674896,3289688,2631469,9101318,2526824,8989807,5007400,7113479,5401260,7174453,3273345,5511123,2270706,1593536,6365859,5335891,1730178,7051544,7387725,6149566,5393157,4172851,1414047,7900924,7161407,4330230,4966888,5813796,5835769,2828125,9380371,6140365,6038192,7937316,2771408,5123031,4912918,4870758,1837982,4010116,2574890,6298431,3201385,2466812,6776748,3491561,2513092,7227188,6759307,5692810,9042953,7330047,3757431,8803588,5969116,6781829,1129501,8984313,9088272,2991958,5577041,1259963,3164169,1823287,5426803,6726211,7632995,2600433,4440368,5447265,5885894,7922348,5123031,7642471,7846130,9620559,1999069,5252807,7059509,5707778,4822280,9482543,3017227,8660079,8191787,6408432,2930847,9877914,8539230,9252243,2676239,4667510,2959274,3407928,5126190,6587783,7850250,7819076,3590988,2506912,4833679,3799865,6584762,2210281,4922119,8892715,4637023,7906829,3403945,1856384,9367874,3473297,7413269,3380325,2544815,4784790,7654968,9615203,6342239,9971298,4251541,2117309,4519607,7946517,3183120,1297866,6738845,1051910,3286804,8972640,3738891,2159606,7285964,5103530,6586410,7077911,4817749,6329193,7722259,1603561,5926681,9375427,3019973,4063812,9994644,6939620,2578460,4693328,6574325,7145065,7464492,9687576,1096542,1156280,6125946,6278930,8918533,8050064,3693298,2677200,1683486,6537109,2888824,4219543,1459091,8626159,3761962,7572845,9624130,3825820,3968780,9332580,1971603,1976409,3816619,2862869,9997940,2307785,6790069,4718322,6846374,8813613,1777969,3496368,4872543,9539810,7721435,7458587,2303665,3877731,4899459,2769210,5956069,4456573,4572067,7691223,1483673,7730087,9200744,7586166,8124221,3849990,6962142,1059600,8411376,1920242,4776962,5097625,6823440,6225646,9569747,6536422,7835830,9529373,6981643,4710769,5347152,2032440,9251419,6622802,7945831,8088516,5485855,2476974,2988937,5269012,3038101,7923171,9959075,7870986,2211242,2853256,9069732,7463119,3007064,6093948,3587417,7560760,3138900,7839126,1839767,7027923,5026901,8167617,6376571,7295303,8993240,9487762,3256179,5992187,1379440,4252777,2920959,7083404,4800170,3793411,8635635,1105880,1255706,5607391,8953414,8598556,2320556,7952972,5181121,5320098,5126464,5088424,8310302,2346237,9359497,9002166,7384567,9643218,4989135,3976333,5771224,3207702,6949234,5828079,1304595,2371093,1488204,6173599,6773727,8357406,6408294,9555328,4717910,9692520,1911865,6779769,5003417,3555969,6274536,2307785,9147460,4669708,8062423,2040130,4858810,8818420,2114013,7345428,1764511,8593612,3003219,2669921,6790618,1456893,4204849,9576339,4165985,6714675,8679168,5553833,9517425,4499008,9095275,5443008,2026672,2348159,7412719,4820083,2114974,7480285,6037643,2184051,8626983,2354614,6275634,6289505,8980880,7612533,9296875,2471069,1254608,5995071,1334533,9300170,7675155,9326675,8334060,1420776,9482681,6162338,3772125,9906066,7634506,9190582,6864776,4980621,4321441,2985504,1883026,7451583,1762176,2202453,6793502,6691879,2246124,2810958,2945541,5521011,6893066,9458099,9021118,3825271,6098617,2557449,1967208,7262207,4133438,1194869,4129455,7893096,7865768,4447372,3305892,5086364,4075759,3208389,6939208,4536224,8330490,7111282,5166290,9741546,2888275,8646896,8943939,6785263,8600479,9068771,9970336,1762588,9280670,1178115,1618530,3697692,9509460,6584213,6604125,3295181,7342956,8532638,7602783,2369445,9894943,3896545,5538314,9294677,8260726,6422164,2759735,1321487,3750839,8825698,9824768,3100723,1905136,5832061,8110076,3261810,3254257,4751968,2966964,2386199,6297744,8689193,9639648,4221878,6668258,6972305,7666915,9481719,7949813,2905578,2983993,4068893,1119064,5430648,8445571,1074844,9077972,5795669,9986267,2391555,9248260,9822845,8139328,2283752,1693374,2869735,4131240,6762603,8740417,8077941,2270980,2107284,3566955,7001831,5853759,8375259,3725296,9212966,6295822,7248474,3069274,3972213,5722198,6054946,5055191,8563949,9722595,9314178,1884674,9386138,3497467,6645874,9457138,1390701,1110000,9389160,2602355,2966140,1065917,1773025,4560668,8858108,9937103,9985168,4180130,1220413,3248764,1978744,8799468,8390914,3350250,1365570,5284805,7485504,8485122,2234451,2189544,2404602,6783477,5243881,6506759,1344696,7390609,4827224,8981018,9410720,7455017,4858947,2450195,3420425,7191207,9621932,8185333,4497222,9738250,4422927,8697296,8542800,1031723,7697265,4978424,7184341,8407806,1947021,6649032,3291748,8159240,5358276,1976959,1654510,5760513,1439041,4238906,4916351,4981994,6522415,5391647,4358245,9611770,1479003,5523620,4626174,8002960,7481796,3053894,8994476,3166503,5167526,6147781,4260742,2627899,4039230,4318557,6865875,3765258,6450592,5683197,2331268,5849777,2020767,6841018,1609466,3505157,6818222,9844543,1439590,1806671,4161727,7229934,9302505,7736267,8379104,4578521,1070449,2215637,9368972,1574035,7941986,9432556,1309539,1029113,2759872,6681716,6356933,2844879,7301071,7437988,8677932,7377288,9637863,6880569,6660156,3174057,5158874,5587478,8644012,8555709,2346786,7618026,9019470,7005401,9906204,1703262,4032501,7838989,8333786,1762863,3143569,9122741,3526306,2465850,5283157,4307983,3519302,7056213,3846557,7551559,6949920,1160125,7774307,5189910,6339355,2794616,7558563,6337158,4785751,8296295,8522476,1073608,4164199,9388610,6213287,8196319,8426071,9106262,8256332,2998275,9091156,4796463,4509582,6045196,5527465,9914581,7866455,6419692,9112030,1833175,4547760,9400970,2865753,2384552,8228454,8048828,3656906,7353118,2841583,6660018,9567001,7639175,4403564,3567642,6511566,7309448,8705261,7249710,5712310,2257522,1211624,2218246,7110458,4687561,3014617,1655746,4319107,5145690,5181259,4268157,7204940,2313140,8344085,1324645,8695922,1282760,1873413,4350143,6906112,2536437,9478836,5441497,9173278,8342300,8581115,2676376,3102645,5790725,3300399,2581344,1209014,7187911,4402877,6129516,9254028,8025482,7049758,7237350,6868759,6244735,7693283,1226455,6558395,6015396,6962966,5222869,9681259,5745407,3885696,6958709,6495498,1543685,9283279,5948654,9869125,5851013,2692443,9506988,8744674,4460968,4648147,3575607,1954162,4647460,8678619,3831451,7477539,7618713,7850387,9041580,9737701,4016433,4211715,7136001,1026779,5677841,1975311,8964263,7656478,5381347,7785430,8208404,4928024,3792312,2912307,4417709,7512557,4328857,9718750,5635406,5338775,7167449,1241424,3586044,4579208,2104400,1230850,8892166,5830688,9494354,6495361,4289169,8081100,6983703,6889770,2306961,5557952,7257400,4796051,2386474,3050186,7518600,3436630,6901718,7799987,3918792,9866241,8053634,5555618,7658538,3985122,6106307,4879959,3976608,9416625,6934402,4309494,6746124,1595596,5348388,2456649,5898254,4907012,1169189,4647735,5388626,6224136,9518524,2193664,2929748,9683593,4296173,3884460,1203933,4047058,8309890,5801712,9778625,5489837,8029602,6043823,1441375,1160125,5433120,4456710,7173080,1354446,1911590,3964248,7478637,7652221,1706008,7592483,2295013,5852111,9839462,9779861,7191894,7055389,4018493,3069549,7088897,2740234,8468368,7775405,2202453,1168365,6172912,1716995,6445648,1971328,6488357,9616577,6997436,4256210,4597885,4251403,6260665,4079055,5777130,4956176,1926696,4624389,3939117,7569137,8367843,3940353,6426834,5414031,2072952,1567993,3523422,5414718,2348022,6912017,1646820,1932601,7998428,9695816,9699523,1423660,1212448,3342422,7540847,6507171,9365539,3629714,2051803,7540298,3961776,9458236,1759292,7292007,5433807,1079238,6490966,9811035,2019119,3625869,5026763,8080276,6429992,5289886,5218612,9552169,2538909,9989013,8544448,8159515,6794601,4868148,7567077,4892868,5590774,5479263,8266906,3542373,2303253,3980590,2714279,2693130,7217575,1203659,2055099,9571945,6062225,1927520,1273422,6836624,1369415,1206130,3703598,5902236,9379959,3092895,3758117,9898788,7712097,9604354,1842376,1853500,4512878,3268402,3922088,6190216,8310577,5100921,7714981,6142974,6286895,6352264,8973876,8173522,9187973,8870880,2830322,8990081,9592819,8423873,4667098,3257827,1758468,2822631,2489883,3597442,8758407,3192733,9264739,3965072,4136734,4235610,1190887,2005386,6793365,8823089,9379272,2474227,2320968,8770904,6902542,9323104,5511398,8132461,2687774,9538986,7251495,8858795,2219345,1334396,3525619,9166824,3521362,6780456,2744628,6460342,3387741,4477172,2120056,1148727,2329895,1354995,9301132,2203689,1208877,8199890,9995468,3802337,5022644,2997863,2789672,5896057,8815811,6691329,1890853,3052383,8181900,4440643,3005828,5410736,9325714,7986343,2078857,7098373,9154190,1204071,8104995,1948257,1367492,1446594,4737823,6863677,6014160,5766830,8911804,3673385,7483993,9615615,1196792,2820159,5404418,2107421,2103164,4727249,9409347,8449142,6057556,8186843,2250930,2623092,2266860,3613098,8221176,3921401,1190063,1504409,3352722,9422119,7835418,6958709,2368209,4004486,4603790,8584686,4846313,5992187,1894561,9653381,9572631,3024642,3194107,7834320,4545974,6243225,5866668,5358825,6606872,5392471,1362960,9954544,4158294,7925231,6069641,9396301,2946640,7708389,5514968,6014709,1372299,3421661,5150497,4008468,5298126,2243103,7428649,8902191,7824295,2916702,9393417,3995971,7999801,1792938,2502792,8146469,2937164,6939071,5904022,8729019,9300720,4910720,6877136,9117935,3636032,9279434,1667831,2534515,8511627,9510559,1428466,3602523,6937561,3283370,7483444,3457229,2033676,2848999,9641845,6750656,3414657,9519485,2771545,7396926,5259674,8880355,3356979,7401870,7537002,7822784,7258224,7619949,1351837,3986770,5388900,2783355,5885345,7711685,7533843,8645797,5894409,7084091,2023925,9585128,3241348,5181808,8486633,7509124,4420455,2102203,7391571,6408020,4552703,5873672,2610733,5396316,5814620,7840362,9709548,5589263,4772842,6615524,1190475,4657211,4590332,7197799,6405685,2400756,4575637,7341857,1358840,9191680,5042007,5779602,2113876,8623138,6945663,8385284,6030639,1211624,8272674,3876358,5544769,8496246,3642486,2145874,6711380,2377685,7096176,7819900,7232131,8041687,5540786,4132888,1181274,3310287,6814514,8714462,1154083,6763565,8845474,6383575,1052734,4477722,8870193,9541183,5229187,8721603,5181121,6255996,2205200,6456222,2373291,1638992,8686996,9980773,8556671,2596588,8093048,3568054,8504623,7560211,8314971,7435653,9206100,4283401,6929321,7892547,6791992,1301025,7579025,2009506,7302032,6144348,1744049,4652954,4263351,2906402,5619476,5228500,9547088,4249618,3318664,9977890,4474014,5451385,3122970,4170928,6637084,5580062,3993637,6038879,2408584,4396011,7067474,1791290,3602249,5070022,4352478,5560974,5258575,3315643,7344192,6619781,4021240,2025161,2780471,2710296,7075027,5007125,6253387,7836242,2111541,1915847,1898132,8355621,7295303,5968704,1875610,7719787,9693756,3544433,4869796,7704544,1145706,3255493,6317245,3472610,1031860,7589187,1587219,2316024,4919235,4710357,8832290,8419067,9547775,1521026,7727890,1486557,8126968,6568695,9818313,4580718,7411621,1897857,3689453,8011749,5526229,1439590,8686996,6624313,9006011,1031448,7397201,7323867,1022659,7661285,8611053,3187515,2266174,7030807,1988632,5002456,1447555,3030685,2144638,9576477,4895065,6220428,6371353,4662017,9210083,5910064,9719985,6841293,2452667,9932708,9657226,7213043,4825027,6706710,9017822,1225082,2321380,5676330,3470275,4499008,9314453,1728942,7214279,5987243,5545181,1679092,4130966,3308502,1485870,3416030,4101303,8604049,4545288,2805877,1714660,7760848,5083892,8944076,8083297,4341766,6709320,7851348,6984664,5069198,3818130,8206207,6047531,6206283,2856552,1208740,7201782,8676147,8264846,4168457,4111053,4267471,6577621,1911727,1806671,5765869,4645263,9599685,4241104,9358261,2449234,8053222,9979949,7151107,1476669,2177322,6751754,1148864,1124420,7578201,5074142,1534347,3101135,8968246,2674316,5595993,3296829,1451263,9923645,3144943,9086761,5283157,1004257,4766937,7540847,3200012,2027496,3750564,3505432,5908416,9821609,3038925,8026718,5832611,6608383,9044326,6085433,6710281,7287475,6673751,9109970,6131713,8546234,6405960,5238250,1616333,1514984,6766036,2796127,5320922,7186264,8038940,6961318,2970397,8315383,1568405,8081375,4109130,7023391,7482070,1615234,2262878,9819137,4189880,1166305,1107666,7260147,2496063,1575958,6237045,1971740,8670928,6546585,3623809,8240676,3325531,5762435,4368408,4905502,4432128,6977523,5828079,7759201,8335571,8038803,2721008,9185089,3098388,5313919,6298019,5243469,1023483,4491729,7177612,1928619,5698440,4224899,1935623,4813766,4405349,8582626,1045181,9804031,9238922,2783630,3260299,8215820,3778030,2175399,7035339,5900039,7653457,9932296,8077117,6630218,7855743,2438110,8619705,4472229,5127288,2822357,5519500,7355453,5281784,1621139,9760635,1564010,5795806,1028564,1467605,5366516,5515106,4708984,8016555,4503128,6819732,4639083,2340744,7748764,2092453,2947463,7022430,6272064,3833236,3221023,2265899,3006378,2264389,9246887,5345092,3754959,8768981,1659179,9620010,1245819,6007843,2458297,6713989,5858016,8057067,8871841,4948623,1234832,6412139,5526779,6626510,4506011,5199249,7400085,1258590,1335357,2441131,9518112,9328323,7513244,3718154,2872482,8686172,9312942,6069915,4521530,3169250,7329635,2481369,9345626,2539459,6019790,7796005,9426788,2333190,2661682,3400787,6518432,2717163,6953353,8526733,1576919,1944000,9968826,4507247,3821975,3500900,5690200,9840835,7295028,8545684,1834411,5398788,4384613,5723571,6194335,7624618,2287048,1958282,6211776,7065826,3871688,7312057,9001205,7084503,8918945,8507644,6545211,6089553,6200378,6205596,5275878,5133193,3368927,6631866,2766326,1216979,2129257,6648345,5746505,3151260,1655197,6860656,8165008,3309600,9723968,1857208,5513595,5124679,9537612,9171768,9135513,3667617,5696105,5065490,1733062,1155456,7295852,8720642,4797424,8729431,8618469,2940185,1174819,8349166,5381072,4946838,9492019,6145721,8015182,2375488,8656646,7076538,8943801,5053405,9153228,6228530,9325851,8660079,5352508,6609756,8235595,3863174,6553588,5775894,5746368,7021057,6976562,6134460,3887207,3048950,2425750,9270370,2942520,1540664,3841339,4136734,4060379,6738983,2458023,8454223,6641342,3450637,7791198,2164138,2475189,2497436,5165878,1277404,9094314,4799072,8011611,2963394,9312530,8679718,6637908,5223281,1418579,9493942,6712203,2990997,8991867,8163360,4156784,2006210,2811096,4720794,8685211,6300903,6822616,2452804,7695617,2647125,7638488,7735992,9739898,5805557,2532318,6160552,5288925,7921936,3402160,8034545,2010192,3913024,7668701,8862503,8278717,8186294,5577865,2893081,5138687,9538436,7876892,3328140,5435317,4574264,1331100,9287811,6335372,2491119,5052169,8125869,5954284,6572814,9105850,7187225,7311096,9235763,4366760,3604034,9326538,5971450,2090805,3220886,7086151,2029556,9172729,6246246,1085006,8185333,1558105,7721298,1673873,8433761,5778503,2401443,1425445,3955734,7078598,6142837,9639099,8200164,1102584,2389770,4702804,7423568,6611816,5854034,6531890,4533752,5199249,7982772,7802185,7578750,3470687,5305953,2196548,8727920,3662261,1259277,1384796,4084274);
+
+# Cleanup
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.5 tests
--echo #
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 2558ae4e404..264f7c784ce 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1721,6 +1721,22 @@ select * from t1;
drop table t1;
--echo #
+--echo # MDEV-22191: Range access is not picked when index_merge_sort_union is turned off
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+set @save_optimizer_switch="index_merge_sort_union=OFF";
+CREATE TABLE t1 (a INT, INDEX(a));
+INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+explain
+SELECT * FROM t1 WHERE a > 5;
+SELECT * FROM t1 WHERE a > 5;
+set @@optimizer_switch=@save_optimizer_switch;
+drop table t1;
+
+--echo # End of 5.5 tests
+
+--echo #
--echo # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
--echo #
@@ -2080,6 +2096,94 @@ set eq_range_index_dive_limit=default;
drop table t1;
--echo #
+--echo # MDEV-24117: Memory management problem in statistics state...
+--echo # (just the testcase)
+--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);
+
+# 4K rows
+insert into t1
+select A.a + B.a* 10 + C.a * 100 + D.a * 1000
+from t0 A, t0 B, t0 C, t0 D
+where D.a<4;
+
+create table t2 (
+ a int,
+ b int,
+ key(a)
+);
+
+insert into t2 values (1,1),(2,2),(3,3);
+
+set @query=(select group_concat(a) from t1);
+
+set @tmp_24117= @@max_session_mem_used;
+
+--echo #
+--echo # On debug build, the usage was
+--echo # - 2.8M without the bug
+--echo # - 1G with the bug.
+
+set max_session_mem_used=64*1024*1024;
+
+set @query=concat('explain select * from t2 where a in (', @query, ')');
+
+prepare s from @query;
+
+--echo # This should not fail with an error:
+execute s;
+set max_session_mem_used=@tmp_24117;
+
+deallocate prepare s;
+
+drop table t0,t1,t2;
+--echo #
+--echo # MDEV-23811: Both disjunct of WHERE condition contain range conditions
+--echo # for the same index such that the second range condition
+--echo # fully covers the first one. Additionally one of the disjuncts
+--echo # contains a range condition for the other index.
+--echo #
+
+create table t1 (
+ pk int primary key auto_increment, a int, b int,
+ index idx1(a), index idx2(b)
+);
+insert into t1(a,b) values
+ (5,50), (1,10), (3,30), (7,70), (8,80), (4,40), (2,20), (6,60);
+insert into t1(a,b) select a+10, b+100 from t1;
+insert into t1(a,b) select a+20, b+200 from t1;
+insert into t1(a,b) select a+30, b+300 from t1;
+insert into t1(a,b) select a,b from t1;
+
+analyze table t1;
+
+let $q1=
+select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5);
+eval explain $q1;
+eval $q1;
+
+let $q2=
+select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100);
+eval explain $q2;
+eval $q2;
+
+let $q3=
+select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100);
+eval explain $q3;
+eval $q3;
+
+let $q4=
+select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4);
+eval explain $q4;
+eval $q4;
+
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test
index a17ef3f1146..428e5c26e5c 100644
--- a/mysql-test/t/range_innodb.test
+++ b/mysql-test/t/range_innodb.test
@@ -46,6 +46,32 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
drop table t0,t1,t2;
+
+--echo #
+--echo # MDEV-10466: constructing an invalid SEL_ARG
+--echo #
+
+create table t1 (
+ pk int, a int, b int,
+ primary key (pk), index idx1(b), index idx2(b)
+) engine=innodb;
+insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0);
+create table t2 (c int) engine=innodb;
+insert into t2 values (1),(2);
+create table t3 (d int) engine=innodb;
+insert into t3 values (3),(-1),(4);
+
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='extended_keys=on';
+
+explain
+select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
+select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
+
+set optimizer_switch=@save_optimizer_switch;
+
+drop table t1,t2,t3;
+
CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2)
@@ -80,10 +106,13 @@ create table t1 (
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 @saved_dbug = @@GLOBAL.debug_dbug;
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 @@GLOBAL.debug_dbug = @saved_dbug;
set @@optimizer_switch= @optimizer_switch_save;
+
+--echo # End of 10.1 tests
diff --git a/mysql-test/t/range_interrupted-13751.test b/mysql-test/t/range_interrupted-13751.test
index 8b2c1834ee5..b0793edeb9d 100644
--- a/mysql-test/t/range_interrupted-13751.test
+++ b/mysql-test/t/range_interrupted-13751.test
@@ -14,14 +14,14 @@ INSERT INTO t1 (c) SELECT c FROM t1;
INSERT INTO t1 (c) SELECT c FROM t1;
set @old_dbug=@@session.debug_dbug;
-set debug_dbug="+d,kill_join_init_read_record";
+SET debug_dbug="+d,kill_join_init_read_record";
--error ER_QUERY_INTERRUPTED
SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
WHERE alias1.c = alias2.c OR alias1.i <= 1
;
-set debug_dbug=@old_dbug;
+SET debug_dbug=@old_dbug;
DROP TABLE t1;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 75978ac482b..435eb99683a 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -1,6 +1,7 @@
#
# Test of repair table
#
+--source include/have_sequence.inc
--source include/default_charset.inc
call mtr.add_suppression("character set is multi-byte");
@@ -246,3 +247,23 @@ UNLOCK TABLES;
DROP TABLE t1;
--echo # End of 10.0 tests
+
+#
+# MDEV-17153 server crash on repair table ... use_frm
+#
+# Note, this test case doesn't crash, but shows spurios warnings
+# unless the bug is fixed
+#
+create table t1 (a int, b varchar(200));
+insert t1 select seq, repeat(200, seq) from seq_1_to_30;
+delete from t1 where a % 13 = 0;
+repair table t1 use_frm;
+delete from t1 where a % 11 = 0;
+repair table t1 extended use_frm;
+delete from t1 where a % 7 = 0;
+set myisam_repair_threads = 2;
+repair table t1 use_frm;
+set myisam_repair_threads = default;
+drop table t1;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/rpl_mysql_upgrade_slave_repo_check.test b/mysql-test/t/rpl_mysql_upgrade_slave_repo_check.test
new file mode 100644
index 00000000000..24b5f029e8d
--- /dev/null
+++ b/mysql-test/t/rpl_mysql_upgrade_slave_repo_check.test
@@ -0,0 +1,127 @@
+# ==== Purpose ====
+#
+# While upgrading from "mysql" to "mariadb" if slave info repositories are
+# configured to be tables then appropriate warnings should be reported.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 1 - On MariaDB server create `mysql`.`slave_master_info` and
+# `mysql.slave_relay_log_info` tables to simulate upgrade from "mysql"
+# to "mariadb" server. Insert data into these tables.
+# 2 - Execute "mysql_upgrade" script and verify that appropriate warning
+# is reported. i.e Warning is to alert user that the data present in
+# repository tables will be ignored.
+# 3 - Truncate these tables. This simulates repositories being file and
+# the tables are empty.
+# 4 - Execute "mysql_upgrade" script and verify that no warnings are
+# reported.
+#
+# ==== References ====
+#
+# MDEV-10047: table-based master info repository
+#
+
+--source include/have_innodb.inc
+--source include/mysql_upgrade_preparation.inc
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+
+--write_file $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql
+--disable_query_log
+--disable_result_log
+SET SQL_LOG_BIN=0;
+# Table structure extracted from MySQL-5.6.47
+CREATE TABLE `mysql`.`slave_master_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
+ `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
+ `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
+ `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
+ `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
+ `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
+ `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
+ `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
+ `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
+ `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
+ `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
+ `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
+ `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
+ `Heartbeat` float NOT NULL,
+ `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
+ `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
+ `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
+ `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
+ `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
+ `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
+ `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
+ PRIMARY KEY (`Host`,`Port`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';
+
+INSERT INTO `mysql`.`slave_master_info` VALUES (23,'master-bin.000001', 120, 'localhost', 'root'," ", 13000, 60, 0," "," "," "," "," ",0 , 60," ", " ", '28e10fdd-6289-11ea-aab9-207918567a34',10," "," ", 0 );
+
+# Table structure extracted from MySQL-5.6.47
+CREATE TABLE `mysql`.`slave_relay_log_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+ `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+ `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+ `Number_of_workers` int(10) unsigned NOT NULL,
+ `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information';
+
+INSERT INTO `mysql`.`slave_relay_log_info` VALUES (7,'./slave-relay-bin.000001',4 ," ",0, 0 ,0 , 1);
+SET SQL_LOG_BIN=1;
+--enable_query_log
+--enable_result_log
+EOF
+
+--echo ********************************************************************
+--echo * Test case1: Upgrade when repository tables have data. *
+--echo * mysql_upgrade script should report warnings. *
+--echo ********************************************************************
+--connection master
+--source $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log 2>&1
+--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log
+
+--connection slave
+--source $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log 2>&1
+--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log
+
+--connection master
+let $datadir= `select @@datadir`;
+remove_file $datadir/mysql_upgrade_info;
+TRUNCATE TABLE `mysql`.`slave_master_info`;
+TRUNCATE TABLE `mysql`.`slave_relay_log_info`;
+--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log
+--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log
+
+--echo ********************************************************************
+--echo * Test case2: Upgrade when repository tables are empty. *
+--echo * mysql_upgrade script should not report any warning. *
+--echo ********************************************************************
+--connection master
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log 2>&1
+--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log
+
+--connection slave
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log 2>&1
+--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log
+
+--echo "====== Clean up ======"
+--connection master
+let $datadir= `select @@datadir`;
+remove_file $datadir/mysql_upgrade_info;
+DROP TABLE `mysql`.`slave_master_info`, `mysql`.`slave_relay_log_info`;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql
+--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log
+--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log
+
+--source include/rpl_end.inc
diff --git a/mysql-test/t/select_debug.test b/mysql-test/t/select_debug.test
index 49415400db3..922cec7ed7a 100644
--- a/mysql-test/t/select_debug.test
+++ b/mysql-test/t/select_debug.test
@@ -10,6 +10,7 @@ create table t2 (a int);
insert into t2 values (2), (3);
set session join_cache_level=3;
+SET @saved_dbug = @@SESSION.debug_dbug;
set @@debug_dbug= 'd,opt';
explain select t1.b from t1,t2 where t1.b=t2.a;
@@ -17,3 +18,4 @@ select t1.b from t1,t2 where t1.b=t2.a;
set session join_cache_level=default;
drop table t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index c9e1bea1f12..a31573edb8e 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -1272,6 +1272,18 @@ set optimizer_switch= @save_optimizer_switch;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
+--echo #
+--echo # MDEV-21495: Conditional jump or move depends on uninitialised value in sel_arg_range_seq_next
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 SELECT seq, seq from seq_1_to_100;
+set optimizer_use_condition_selectivity=4;
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+SELECT * from t1 WHERE a = 5 and b = 5;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
+
--echo # End of 10.1 tests
#
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
index 6615ff66737..2a87d24cf6d 100644
--- a/mysql-test/t/show_explain.test
+++ b/mysql-test/t/show_explain.test
@@ -15,7 +15,7 @@ SET @old_debug= @@session.debug;
# is that we use the following commands for synchronization:
#
# set @show_explain_probe_select_id=1;
-# set debug_dbug='d,show_explain_probe_join_exec_start';
+# SET debug_dbug='d,show_explain_probe_join_exec_start';
# send select count(*) from t1 where a < 100000;
#
# When ran with mysqltest_embedded, this translates into:
@@ -75,7 +75,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
#
connection con1;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select count(*) from t1 where a < 100000;
connection default;
@@ -103,109 +103,109 @@ evalp show explain for $thr2;
connection con1;
reap;
set optimizer_switch= @show_expl_tmp;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # UNION, first branch
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # UNION, second branch
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # Uncorrelated subquery, select
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # Uncorrelated subquery, explain
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a, (select max(a) from t0 B) from t0 A where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # correlated subquery, select
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # correlated subquery, explain
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2; # <---
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo # correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
# TODO: explain in the parent subuqery when the un-correlated child has been
# run (and have done irreversible cleanups)
@@ -218,7 +218,7 @@ set debug_dbug=@old_debug;
--echo # I've found experimentally that select_id==2 here...
--echo #
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
--source include/wait_condition.inc
@@ -228,14 +228,14 @@ evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Attempt SHOW EXPLAIN for an UPDATE
--echo #
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
@@ -247,14 +247,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
--echo #
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
connection default;
--source include/wait_condition.inc
@@ -266,14 +266,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Multiple SHOW EXPLAIN calls for one select
--echo #
create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
connection default;
--source include/wait_condition.inc
@@ -285,14 +285,14 @@ evalp show explain for $thr2;
connection con1;
reap;
drop table t2;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
--echo #
explain select * from t0 order by a;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select * from t0 order by a;
connection default;
@@ -300,7 +300,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... with "Using temporary"
@@ -309,7 +309,7 @@ connection default;
explain select distinct a from t0;
connection con1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select distinct a from t0;
connection default;
@@ -317,7 +317,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
@@ -326,7 +326,7 @@ connection default;
explain select distinct a from t0;
connection con1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
send select distinct a from t0;
connection default;
@@ -334,7 +334,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
@@ -343,7 +343,7 @@ CREATE TABLE t2 ( a INT );
INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
-set debug_dbug='+d,show_explain_in_find_all_keys';
+SET debug_dbug='+d,show_explain_in_find_all_keys';
send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
connection default;
@@ -354,7 +354,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
@@ -370,7 +370,7 @@ INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
connection default;
@@ -378,7 +378,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
@@ -394,7 +394,7 @@ INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
explain SELECT * FROM v1, t2;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send SELECT * FROM v1, t2;
connection default;
@@ -405,7 +405,7 @@ evalp kill query $thr2;
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;
@@ -413,21 +413,21 @@ DROP TABLE t2, t3;
--echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
--echo #
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select sleep(1);
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Same as above, but try another reason for JOIN to be degenerate
--echo #
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select * from t0 where 1>10;
connection default;
--source include/wait_condition.inc
@@ -435,7 +435,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Same as above, but try another reason for JOIN to be degenerate (2)
@@ -443,7 +443,7 @@ set debug_dbug=@old_debug;
create table t3(a int primary key);
insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send select * from t0,t3 where t3.a=112233;
connection default;
--source include/wait_condition.inc
@@ -451,7 +451,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t3;
--echo #
@@ -470,7 +470,7 @@ explain SELECT * FROM t2 WHERE a =
);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
send SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
@@ -480,7 +480,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t2;
@@ -513,7 +513,7 @@ WHERE a1 < ALL (
);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
send
SELECT count(*) FROM t2, t3
WHERE a1 < ALL (
@@ -526,7 +526,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t2, t3, t4;
--echo #
@@ -538,7 +538,7 @@ INSERT INTO t2 VALUES
(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
send
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
connection default;
@@ -547,7 +547,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t2;
DROP TABLE t1;
@@ -559,7 +559,7 @@ CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send SELECT 'test' FROM t1 WHERE a=1;
connection default;
@@ -567,7 +567,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
@@ -591,7 +591,7 @@ set join_cache_level=0;
explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_test_if_quick_select';
+SET debug_dbug='+d,show_explain_probe_test_if_quick_select';
send
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
@@ -608,7 +608,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
--echo #
@@ -619,7 +619,7 @@ CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send SHOW INDEX FROM t1;
connection default;
@@ -627,7 +627,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
@@ -641,7 +641,7 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
EXPLAIN SELECT a + 1 FROM v1;
-set debug_dbug='+d,show_explain_probe_join_tab_preread';
+SET debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
send
@@ -651,7 +651,7 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t1;
@@ -667,7 +667,7 @@ INSERT INTO t1 VALUES (4),(6);
EXPLAIN
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
-set debug_dbug='+d,show_explain_probe_union_read';
+SET debug_dbug='+d,show_explain_probe_union_read';
send
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
@@ -681,7 +681,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1;
--echo #
@@ -703,7 +703,7 @@ SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
@@ -714,7 +714,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1, t2;
--echo #
@@ -737,7 +737,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
select distinct t1.a from t1,t3 where t1.a=t3.a;
connection default;
@@ -746,7 +746,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1,t3,t4;
@@ -756,7 +756,7 @@ drop table t1,t3,t4;
create user test2@localhost;
grant ALL on test.* to test2@localhost;
-# Give the user SUPER privilege so it can set debug_dbug variable.
+# Give the user SUPER privilege so it can SET debug_dbug variable.
grant super on *.* to test2@localhost;
connect (con2, localhost, test2,,);
connection con1;
@@ -765,7 +765,7 @@ connection con1;
--echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
--echo #
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@@ -781,7 +781,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
--echo #
--echo # Check that user test2 can do SHOW EXPLAIN on its own queries
@@ -791,7 +791,7 @@ connect (con3, localhost, test2,,);
connection con2;
let $thr_con2=`select connection_id()`;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@@ -817,10 +817,10 @@ disconnect con2;
grant process on *.* to test2@localhost;
connect (con2, localhost, test2,,);
connection con1;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where a < 3;
@@ -832,7 +832,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
@@ -912,7 +912,7 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
@@ -924,10 +924,10 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
--send
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
@@ -940,7 +940,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
@@ -956,7 +956,7 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13;
EXPLAIN SELECT a FROM t1 GROUP BY a;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT a FROM t1 GROUP BY a;
@@ -967,7 +967,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1;
@@ -983,7 +983,7 @@ INSERT INTO t2 VALUES (86,'English'),(87,'Russian');
explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
--send
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
@@ -994,7 +994,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
drop table t1, t2;
--echo #
@@ -1033,7 +1033,7 @@ explain
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
send
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
@@ -1045,7 +1045,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
@@ -1069,7 +1069,7 @@ SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
@@ -1082,7 +1082,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
--echo #
@@ -1109,7 +1109,7 @@ select charset('');
select hex('');
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
select * from t0 where length('') = a;
@@ -1124,7 +1124,7 @@ connection con1;
# The constant should be two letters, the last looking like 'bl'
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set names default;
--echo #
@@ -1151,7 +1151,7 @@ WHERE b <= ANY (
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
send
SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
@@ -1166,7 +1166,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
DROP TABLE t1,t2;
drop table t0;
@@ -1182,7 +1182,7 @@ insert into t1 select a,a from t0;
create table t2 as select * from t1;
set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
+SET debug_dbug='+d,show_explain_probe_best_ext_lim_search';
send
explain
select * from t0
diff --git a/mysql-test/t/show_explain_non_select.test b/mysql-test/t/show_explain_non_select.test
index 21b16739141..505e9296222 100644
--- a/mysql-test/t/show_explain_non_select.test
+++ b/mysql-test/t/show_explain_non_select.test
@@ -38,7 +38,7 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
--echo # Test SHOW EXPLAIN for single-table DELETE
--echo #
connection con2;
-set debug_dbug='+d,show_explain_probe_delete_exec_start';
+SET debug_dbug='+d,show_explain_probe_delete_exec_start';
send delete from t1 where a<10 and b+1>1000;
connection default;
@@ -51,7 +51,7 @@ reap;
--echo # Test SHOW EXPLAIN for multi-table DELETE
--echo #
set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
+SET debug_dbug='+d,show_explain_probe_do_select';
send delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
connection default;
--source include/wait_condition.inc
@@ -63,7 +63,7 @@ reap;
--echo # Test SHOW EXPLAIN for single-table UPDATE
--echo #
connection con2;
-set debug_dbug='+d,show_explain_probe_update_exec_start';
+SET debug_dbug='+d,show_explain_probe_update_exec_start';
send update t1 set filler='filler-data-2' where a<10 and b+1>1000;
connection default;
@@ -74,5 +74,5 @@ reap;
drop table t0,t1;
-set debug_dbug=@old_debug;
+SET debug_dbug=@old_debug;
set debug_sync='RESET';
diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test
index 13cd1538143..cbff0f50f96 100644
--- a/mysql-test/t/show_explain_ps.test
+++ b/mysql-test/t/show_explain_ps.test
@@ -38,7 +38,8 @@ let $wait_condition= select State='show_explain_trap' from information_schema.pr
#
connection con1;
set @show_explain_probe_select_id=1;
-set debug_dbug='d,show_explain_probe_join_exec_start';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='d,show_explain_probe_join_exec_start';
send select count(*) from t0 where a < 100000;
connection default;
@@ -47,7 +48,7 @@ evalp show explain for $thr2;
connection con1;
reap;
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
evalp select event_name
from
diff --git a/mysql-test/t/slowlog_enospace-10508.test b/mysql-test/t/slowlog_enospace-10508.test
index b2c26a5984d..74dca21f8ec 100644
--- a/mysql-test/t/slowlog_enospace-10508.test
+++ b/mysql-test/t/slowlog_enospace-10508.test
@@ -9,7 +9,8 @@ create table t1 (a int, b int) engine=memory;
insert t1 select seq, seq+1 from seq_1_to_1000;
set global general_log=0;
set global log_queries_not_using_indexes=1;
-set debug_dbug='+d,simulate_file_write_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,simulate_file_write_error';
--disable_result_log
--let $run= 50
while ($run)
@@ -18,7 +19,7 @@ while ($run)
dec $run;
}
--enable_result_log
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
set global general_log=1;
set global log_queries_not_using_indexes=default;
drop table t1;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 4dd3c51e4b0..b0c957ad164 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -3851,3 +3851,22 @@ SELECT @msg;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP TABLE t1;
+
+--echo #
+--echo # 10.2 Test
+--echo #
+--echo # MDEV-MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status
+--echo #
+
+SET @old_optimizer_switch = @@SESSION.OPTIMIZER_SWITCH;
+
+SET @cmd:="SET @@SESSION.SQL_MODE=(SELECT 'a')";
+
+--error ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES
+SET @@SESSION.OPTIMIZER_SWITCH="in_to_exists=OFF,materialization=OFF";
+PREPARE stmt FROM @cmd;
+
+set @@SESSION.OPTIMIZER_SWITCH=@old_optimizer_switch;
+
+--echo # End of 10.2 Test
diff --git a/mysql-test/t/sp2.test b/mysql-test/t/sp2.test
new file mode 100644
index 00000000000..a638bf1e706
--- /dev/null
+++ b/mysql-test/t/sp2.test
@@ -0,0 +1,37 @@
+--source include/not_embedded.inc
+
+#
+# MDEV-18457 Assertion `(bitmap->map + (bitmap->full_head_size/6*6)) <=
+# full_head_end' failed in _ma_check_bitmap
+#
+# test 1
+#
+
+CREATE DATABASE test1;
+--disable_query_log
+--let $a=`select repeat('a',3023)`
+--eval CREATE PROCEDURE test1.sp1() SELECT '$a'
+--let $a=`select repeat('a',114513)`
+--eval CREATE PROCEDURE test.sp2() SELECT '$a'
+--enable_query_log
+
+CREATE PROCEDURE test1.sp3() BEGIN END;
+--replace_column 5 # 6 #
+SHOW PROCEDURE STATUS;
+
+# Cleanup
+DROP PROCEDURE sp2;
+DROP DATABASE test1;
+
+#
+# MDEV-18457, test 2
+#
+--disable_query_log
+INSERT INTO `mysql`.`event` VALUES ('test','ev_28716_248','UPDATE IGNORE `GLOBAL_STATUS` SET `VARIABLE_NAME` = 138 ORDER BY `VARIABLE_NAME` LIMIT 6','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:27:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `GLOBAL_STATUS` SET `VARIABLE_NAME` = 138 ORDER BY `VARIABLE_NAME` LIMIT 6'),('test','ev_28718_1','SELECT `VARIABLE_NAME` FROM `INNODB_SYS_TABLES` ORDER BY `N_COLS` LIMIT 14','root@localhost',NULL,5,'SECOND','2020-05-18 08:19:53','2020-05-18 08:19:53','2020-05-18 08:23:04','2020-05-18 08:19:53','2020-05-18 08:23:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `VARIABLE_NAME` FROM `INNODB_SYS_TABLES` ORDER BY `N_COLS` LIMIT 14'),('test','ev_28714_146','UPDATE `oltp60` SET `k` = \'beside\' ORDER BY `c` LIMIT 5','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:23','2020-05-18 08:21:23','2020-05-18 08:22:30','2020-05-18 08:21:23','2020-05-18 08:23:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `oltp60` SET `k` = \'beside\' ORDER BY `c` LIMIT 5'),('test','ev_28714_213','START TRANSACTION','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:09','2020-05-18 08:22:09','2020-05-18 08:22:43','2020-05-18 08:22:09','2020-05-18 08:25:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28716_2','INSERT IGNORE INTO `oltp154` ( `pad`, _next_field ) VALUES ( \'\', DEFAULT ) ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:19:53','2020-05-18 08:19:53','2020-05-18 08:23:04','2020-05-18 08:19:53','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp154` ( `pad`, ) VALUES ( \'\', DEFAULT ) ;'),('test','ev_28716_233','UPDATE IGNORE `help_category` SET `name` = NULL ORDER BY `url` LIMIT 8 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:43','2020-05-18 08:22:43',NULL,'2020-05-18 08:22:43','2020-05-18 08:25:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_category` SET `name` = NULL ORDER BY `url` LIMIT 8 ;'),('test','ev_28716_189','INSERT IGNORE INTO `oltp21` ( `c` ) VALUES ( \'p\' )','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:20','2020-05-18 08:22:20','2020-05-18 08:22:59','2020-05-18 08:22:20','2020-05-18 08:25:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp21` ( `c` ) VALUES ( \'p\' )'),('test','ev_28718_4','COMMIT ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:19:53','2020-05-18 08:19:53','2020-05-18 08:22:34','2020-05-18 08:19:53','2020-05-18 08:22:56','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT ;'),('test','ev_28718_129','INSERT INTO `innodb_table_stats` SELECT * FROM `time_zone_leap_second`','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:42','2020-05-18 08:21:42','2020-05-18 08:22:59','2020-05-18 08:21:42','2020-05-18 08:24:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `innodb_table_stats` SELECT * FROM `time_zone_leap_second`'),('test','ev_28714_214','REPLACE INTO `oltp45` ( `c`, _next_field ) VALUES ( 163, NULL )','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:10','2020-05-18 08:22:10','2020-05-18 08:22:45','2020-05-18 08:22:10','2020-05-18 08:26:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp45` ( `c`, ) VALUES ( 163, NULL )'),('test','ev_28716_4','START TRANSACTION','root@localhost',NULL,5,'SECOND','2020-05-18 08:19:54','2020-05-18 08:19:54','2020-05-18 08:22:37','2020-05-18 08:19:54','2020-05-18 08:23:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28716_5','REPLACE INTO `PLUGINS` () VALUES ()','root@localhost',NULL,3,'SECOND','2020-05-18 08:19:54','2020-05-18 08:19:54','2020-05-18 08:23:05','2020-05-18 08:19:54','2020-05-18 08:23:49','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `PLUGINS` () VALUES ()'),('test','ev_28714_266','SELECT * FROM `oltp54` ORDER BY `id` LIMIT 177 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:44','2020-05-18 08:22:44',NULL,'2020-05-18 08:22:44','2020-05-18 08:25:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp54` ORDER BY `id` LIMIT 177 ;'),('test','ev_28716_6','REPLACE INTO `TABLE_PRIVILEGES` ( `TABLE_SCHEMA`, _next_field ) VALUES ( 40, \'\' )','root@localhost',NULL,4,'SECOND','2020-05-18 08:19:54','2020-05-18 08:19:54','2020-05-18 08:22:44','2020-05-18 08:19:54','2020-05-18 08:23:35','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `TABLE_PRIVILEGES` ( `TABLE_SCHEMA`, ) VALUES ( 40, \'\' )'),('test','ev_28718_8','REPLACE INTO `column_stats` ( `hist_type`, _next_field ) VALUES ( \'f\', DEFAULT ) ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:19:54','2020-05-18 08:19:54','2020-05-18 08:23:05','2020-05-18 08:19:54','2020-05-18 08:24:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `column_stats` ( `hist_type`, ) VALUES ( \'f\', DEFAULT ) ;'),('test','ev_28716_117','SHOW EXPLAIN FOR 236','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:23','2020-05-18 08:21:23','2020-05-18 08:22:31','2020-05-18 08:21:23','2020-05-18 08:24:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 236'),('test','ev_28714_268','REPLACE INTO `INNODB_SYS_INDEXES` ( `TABLE_ID` ) VALUES ( \'\' )','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:46','2020-05-18 08:22:46',NULL,'2020-05-18 08:22:46','2020-05-18 08:24:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `INNODB_SYS_INDEXES` ( `TABLE_ID` ) VALUES ( \'\' )'),('test','ev_28714_271','SELECT `ROLE_NAME` FROM `INNODB_FT_BEING_DELETED` ORDER BY `DOC_ID` LIMIT 12','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:46','2020-05-18 08:22:46',NULL,'2020-05-18 08:22:46','2020-05-18 08:23:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `ROLE_NAME` FROM `INNODB_FT_BEING_DELETED` ORDER BY `DOC_ID` LIMIT 12'),('test','ev_28714_89','SELECT * FROM `oltp118` ORDER BY `pad` LIMIT 217','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:52','2020-05-18 08:20:52','2020-05-18 08:22:32','2020-05-18 08:20:52','2020-05-18 08:24:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp118` ORDER BY `pad` LIMIT 217'),('test','ev_28716_208','SHOW SLAVE HOSTS','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:29','2020-05-18 08:22:29',NULL,'2020-05-18 08:22:29','2020-05-18 08:23:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW SLAVE HOSTS'),('test','ev_28716_8','INSERT IGNORE INTO `time_zone_transition` ( `Transition_type_id` ) VALUES ( \'w\' )','root@localhost',NULL,6,'SECOND','2020-05-18 08:19:54','2020-05-18 08:19:54','2020-05-18 08:22:33','2020-05-18 08:19:54','2020-05-18 08:23:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_transition` ( `Transition_type_id` ) VALUES ( \'w\' )'),('test','ev_28714_6','UPDATE IGNORE `INNODB_METRICS` SET `TIME_ELAPSED` = NULL ORDER BY `COMMENT` LIMIT 2','root@localhost',NULL,2,'SECOND','2020-05-18 08:19:55','2020-05-18 08:19:55','2020-05-18 08:23:01','2020-05-18 08:19:55','2020-05-18 08:23:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `INNODB_METRICS` SET `TIME_ELAPSED` = NULL ORDER BY `COMMENT` LIMIT 2'),('test','ev_28716_9','SELECT * FROM `gtid_slave_pos` INTO OUTFILE \'load_gtid_slave_pos\' ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:19:55','2020-05-18 08:19:55','2020-05-18 08:22:41','2020-05-18 08:19:55','2020-05-18 08:23:58','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `gtid_slave_pos` INTO OUTFILE \'load_gtid_slave_pos\' ;'),('test','ev_28716_41','INSERT IGNORE INTO `time_zone_leap_second` ( `Transition_time`, _next_field ) VALUES ( NULL, \'\' )','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:11','2020-05-18 08:20:11','2020-05-18 08:22:32','2020-05-18 08:20:11','2020-05-18 08:24:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_leap_second` ( `Transition_time`, ) VALUES ( NULL, \'\' )'),('test','ev_28714_257','INSERT IGNORE INTO `time_zone_transition_type` ( `Is_DST`, _next_field ) VALUES ( \'\', 115 ) ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:37','2020-05-18 08:22:37',NULL,'2020-05-18 08:22:37','2020-05-18 08:25:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_transition_type` ( `Is_DST`, ) VALUES ( \'\', 115 ) ;'),('test','ev_28718_12','DELETE FROM `help_category` ORDER BY `name` LIMIT 8','root@localhost',NULL,6,'SECOND','2020-05-18 08:19:55','2020-05-18 08:19:55','2020-05-18 08:22:34','2020-05-18 08:19:55','2020-05-18 08:22:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `help_category` ORDER BY `name` LIMIT 8'),('test','ev_28714_8','SELECT `SEGMENT_NUMBER` FROM `INNODB_BUFFER_PAGE_LRU` ORDER BY `IS_HASHED` LIMIT 202','root@localhost',NULL,9,'SECOND','2020-05-18 08:19:55','2020-05-18 08:19:55','2020-05-18 08:22:26','2020-05-18 08:19:55','2020-05-18 08:24:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `SEGMENT_NUMBER` FROM `INNODB_BUFFER_PAGE_LRU` ORDER BY `IS_HASHED` LIMIT 202'),('test','ev_28714_9','DELETE FROM `time_zone_name` ORDER BY `Name` LIMIT 9 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:19:55','2020-05-18 08:19:55','2020-05-18 08:22:26','2020-05-18 08:19:55','2020-05-18 08:23:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `time_zone_name` ORDER BY `Name` LIMIT 9 ;'),('test','ev_28714_282','SHOW EXPLAIN FOR 88','root@localhost',NULL,8,'SECOND','2020-05-18 08:23:00','2020-05-18 08:23:00',NULL,'2020-05-18 08:23:00','2020-05-18 08:23:22','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 88'),('test','ev_28714_10','COMMIT ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:19:56','2020-05-18 08:19:56','2020-05-18 08:22:30','2020-05-18 08:19:56','2020-05-18 08:23:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT ;'),('test','ev_28714_187','REPLACE INTO `oltp140` () VALUES (),(),(),() ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:49','2020-05-18 08:21:49','2020-05-18 08:23:06','2020-05-18 08:21:49','2020-05-18 08:23:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp140` () VALUES (),(),(),() ;'),('test','ev_28718_15','DELETE FROM `oltp153` ORDER BY `id` LIMIT 7','root@localhost',NULL,6,'SECOND','2020-05-18 08:19:56','2020-05-18 08:19:56','2020-05-18 08:22:35','2020-05-18 08:19:56','2020-05-18 08:23:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp153` ORDER BY `id` LIMIT 7'),('test','ev_28714_11','UPDATE IGNORE `oltp73` SET `k` = \'\' ORDER BY `k` LIMIT 6','root@localhost',NULL,8,'SECOND','2020-05-18 08:19:57','2020-05-18 08:19:57','2020-05-18 08:23:00','2020-05-18 08:19:57','2020-05-18 08:23:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp73` SET `k` = \'\' ORDER BY `k` LIMIT 6'),('test','ev_28714_230','SELECT * FROM `general_log` ORDER BY `command_type` LIMIT 215','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:18','2020-05-18 08:22:18','2020-05-18 08:22:56','2020-05-18 08:22:18','2020-05-18 08:22:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `general_log` ORDER BY `command_type` LIMIT 215'),('test','ev_28716_11','INSERT INTO `func` SELECT * FROM `time_zone_leap_second` ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:19:57','2020-05-18 08:19:57','2020-05-18 08:22:34','2020-05-18 08:19:57','2020-05-18 08:24:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `func` SELECT * FROM `time_zone_leap_second` ;'),('test','ev_28714_12','CREATE INDEX m ON `oltp79` ( q(251) )','root@localhost',NULL,1,'SECOND','2020-05-18 08:19:57','2020-05-18 08:19:57','2020-05-18 08:22:33','2020-05-18 08:19:57','2020-05-18 08:23:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','CREATE INDEX m ON `oltp79` ( q(251) )'),('test','ev_28718_16','SELECT * FROM test.`oltp125` AS table1 WHERE (NOT table1.`id` <= \'pl\' OR table1.`pad` != table1.`k`) LIMIT 8','root@localhost',NULL,9,'SECOND','2020-05-18 08:19:57','2020-05-18 08:19:57','2020-05-18 08:22:31','2020-05-18 08:19:57','2020-05-18 08:23:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp125` AS table1 WHERE (NOT table1.`id` <= \'pl\' OR table1.`pad` != table1.`k`) LIMIT 8'),('test','ev_28716_179','SELECT * FROM (test.`oltp86` AS table1 STRAIGHT_JOIN INFORMATION_SCHEMA.`VIEWS` AS table2 ON ( table2.`TABLE_CATALOG` = table1.`id` ) ) WHERE table1.`k` != table1.`id` HAVING table1.`c` != \'2010-11-29 21:40:34.028315\' IS NULL LIMIT 1 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:18','2020-05-18 08:22:18','2020-05-18 08:22:57','2020-05-18 08:22:18','2020-05-18 08:25:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp86` AS table1 STRAIGHT_JOIN INFORMATION_SCHEMA.`VIEWS` AS table2 ON ( table2.`TABLE_CATALOG` = table1.`id` ) ) WHERE table1.`k` != table1.`id` HAVING table1.`c` != \'2010-11-29 21:40:34.028315\' IS NULL LIMIT 1 ;'),('test','ev_28718_17','START TRANSACTION','root@localhost',NULL,4,'SECOND','2020-05-18 08:19:58','2020-05-18 08:19:58','2020-05-18 08:22:46','2020-05-18 08:19:58','2020-05-18 08:23:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28714_250','INSERT IGNORE INTO `user_variables` ( `VARIABLE_NAME` ) VALUES ( NULL ) ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:34','2020-05-18 08:22:34',NULL,'2020-05-18 08:22:34','2020-05-18 08:23:31','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `user_variables` ( `VARIABLE_NAME` ) VALUES ( NULL ) ;'),('test','ev_28714_82','SELECT * FROM `TRIGGERS` ORDER BY `SQL_MODE` LIMIT 252 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:50','2020-05-18 08:20:50','2020-05-18 08:22:31','2020-05-18 08:20:50','2020-05-18 08:24:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `TRIGGERS` ORDER BY `SQL_MODE` LIMIT 252 ;'),('test','ev_28716_72','SELECT * FROM `GLOBAL_STATUS` ORDER BY `VARIABLE_VALUE` LIMIT 20','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:27','2020-05-18 08:20:27','2020-05-18 08:22:32','2020-05-18 08:20:27','2020-05-18 08:23:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `GLOBAL_STATUS` ORDER BY `VARIABLE_VALUE` LIMIT 20'),('test','ev_28714_14','UPDATE IGNORE `oltp72` SET `c` = \'j\' ORDER BY `k` LIMIT 8','root@localhost',NULL,4,'SECOND','2020-05-18 08:19:59','2020-05-18 08:19:59','2020-05-18 08:22:33','2020-05-18 08:19:59','2020-05-18 08:22:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp72` SET `c` = \'j\' ORDER BY `k` LIMIT 8'),('test','ev_28718_217','SELECT * FROM `time_zone_transition_type` ORDER BY `Transition_type_id` LIMIT 133','root@localhost',NULL,6,'SECOND','2020-05-18 08:23:00','2020-05-18 08:23:00',NULL,'2020-05-18 08:23:00','2020-05-18 08:26:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `time_zone_transition_type` ORDER BY `Transition_type_id` LIMIT 133'),('test','ev_28718_19','REPLACE INTO `oltp58` () VALUES (),(),(),(),(),(),()','root@localhost',NULL,1,'SECOND','2020-05-18 08:19:59','2020-05-18 08:19:59','2020-05-18 08:23:01','2020-05-18 08:19:59','2020-05-18 08:23:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp58` () VALUES (),(),(),(),(),(),()'),('test','ev_28718_218','UPDATE IGNORE `oltp76` SET `pad` = \'\' ORDER BY `id` LIMIT 4','root@localhost',NULL,3,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:25:08','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp76` SET `pad` = \'\' ORDER BY `id` LIMIT 4'),('test','ev_28716_143','SELECT * FROM `INNODB_SYS_VIRTUAL` ORDER BY `TABLE_ID` LIMIT 178','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:49','2020-05-18 08:21:49','2020-05-18 08:22:24','2020-05-18 08:21:49','2020-05-18 08:22:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `INNODB_SYS_VIRTUAL` ORDER BY `TABLE_ID` LIMIT 178'),('test','ev_28714_62','SELECT `sub_id` FROM `proc` ORDER BY `created` LIMIT 16','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:33','2020-05-18 08:20:33','2020-05-18 08:22:32','2020-05-18 08:20:33','2020-05-18 08:24:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `sub_id` FROM `proc` ORDER BY `created` LIMIT 16'),('test','ev_28714_16','SELECT * FROM (INFORMATION_SCHEMA.`STATISTICS` AS table1 STRAIGHT_JOIN test.`oltp87` AS table2 ON ( table2.`pad` = table1.`NON_UNIQUE` ) ) WHERE ( table2.`c` = table2.`k` AND table1.`TABLE_NAME` = 5) LIMIT 5 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:19:59','2020-05-18 08:19:59','2020-05-18 08:22:49','2020-05-18 08:19:59','2020-05-18 08:23:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`STATISTICS` AS table1 STRAIGHT_JOIN test.`oltp87` AS table2 ON ( table2.`pad` = table1.`NON_UNIQUE` ) ) WHERE ( table2.`c` = table2.`k` AND table1.`TABLE_NAME` = 5) LIMIT 5 ;'),('test','ev_28714_133','UPDATE IGNORE `time_zone_transition_type` SET `Is_DST` = NULL ORDER BY `Transition_type_id` LIMIT 4','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:12','2020-05-18 08:21:12','2020-05-18 08:22:23','2020-05-18 08:21:12','2020-05-18 08:24:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `time_zone_transition_type` SET `Is_DST` = NULL ORDER BY `Transition_type_id` LIMIT 4'),('test','ev_28716_190','SELECT `description` FROM `roles_mapping` ORDER BY `Role` LIMIT 103 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:20','2020-05-18 08:22:20','2020-05-18 08:23:00','2020-05-18 08:22:20','2020-05-18 08:25:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `description` FROM `roles_mapping` ORDER BY `Role` LIMIT 103 ;'),('test','ev_28714_85','UPDATE IGNORE `help_topic` SET `url` = NULL ORDER BY `name` LIMIT 8 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:50','2020-05-18 08:20:50','2020-05-18 08:22:29','2020-05-18 08:20:50','2020-05-18 08:23:39','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_topic` SET `url` = NULL ORDER BY `name` LIMIT 8 ;'),('test','ev_28718_22','SHOW PROFILE ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:00','2020-05-18 08:20:00','2020-05-18 08:22:57','2020-05-18 08:20:00','2020-05-18 08:23:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW PROFILE ;'),('test','ev_28714_18','SHOW BINLOG EVENTS ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:01','2020-05-18 08:20:01','2020-05-18 08:22:40','2020-05-18 08:20:01','2020-05-18 08:24:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW BINLOG EVENTS ;'),('test','ev_28716_19','UPDATE IGNORE `help_relation` SET `help_topic_id` = 127 ORDER BY `help_keyword_id` LIMIT 9 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:01','2020-05-18 08:20:01','2020-05-18 08:22:56','2020-05-18 08:20:01','2020-05-18 08:24:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_relation` SET `help_topic_id` = 127 ORDER BY `help_keyword_id` LIMIT 9 ;'),('test','ev_28716_214','REPLACE INTO `oltp131` ( `c` ) VALUES ( \'provider\' )','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:33','2020-05-18 08:22:33',NULL,'2020-05-18 08:22:33','2020-05-18 08:24:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp131` ( `c` ) VALUES ( \'provider\' )'),('test','ev_28714_210','SHOW COLLATION','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:06','2020-05-18 08:22:06','2020-05-18 08:22:39','2020-05-18 08:22:06','2020-05-18 08:23:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW COLLATION'),('test','ev_28718_153','SELECT * FROM (INFORMATION_SCHEMA.`USER_PRIVILEGES` AS table1 RIGHT OUTER JOIN mysql.`innodb_index_stats` AS table2 ON ( table2.`table_name` = table1.`GRANTEE` ) ) WHERE ( table2.`table_name` != table2.`stat_description` AND table2.`stat_name` < 5) LIMIT 9 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:25:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`USER_PRIVILEGES` AS table1 RIGHT OUTER JOIN mysql.`innodb_index_stats` AS table2 ON ( table2.`table_name` = table1.`GRANTEE` ) ) WHERE ( table2.`table_name` != table2.`stat_description` AND table2.`stat_name` < 5) LIMIT 9 ;'),('test','ev_28714_283','INSERT IGNORE INTO `time_zone_name` ( `Name` ) VALUES ( NULL )','root@localhost',NULL,5,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:25:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_name` ( `Name` ) VALUES ( NULL )'),('test','ev_28718_227','SELECT * FROM (INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` AS table1 INNER JOIN test.`oltp141` AS table2 ON ( table2.`c` = table1.`TABLE_SCHEMA` ) ) WHERE table2.`c` != 5 LIMIT 6 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:23:08','2020-05-18 08:23:08',NULL,'2020-05-18 08:23:08','2020-05-18 08:26:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`KEY_COLUMN_USAGE` AS table1 INNER JOIN test.`oltp141` AS table2 ON ( table2.`c` = table1.`TABLE_SCHEMA` ) ) WHERE table2.`c` != 5 LIMIT 6 ;'),('test','ev_28718_30','UPDATE `INNODB_SYS_TABLES` SET `ZIP_PAGE_SIZE` = \'application\' ORDER BY `SPACE` LIMIT 2','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:03','2020-05-18 08:20:03','2020-05-18 08:22:36','2020-05-18 08:20:03','2020-05-18 08:23:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `INNODB_SYS_TABLES` SET `ZIP_PAGE_SIZE` = \'application\' ORDER BY `SPACE` LIMIT 2'),('test','ev_28716_180','REPLACE INTO `oltp148` () VALUES ()','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:18','2020-05-18 08:22:18','2020-05-18 08:22:56','2020-05-18 08:22:18','2020-05-18 08:23:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp148` () VALUES ()'),('test','ev_28714_20','SELECT * FROM `oltp125` ORDER BY `pad` LIMIT 12','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:02','2020-05-18 08:20:02','2020-05-18 08:22:36','2020-05-18 08:20:02','2020-05-18 08:24:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp125` ORDER BY `pad` LIMIT 12'),('test','ev_28714_150','INSERT IGNORE INTO `help_keyword` () VALUES (),(),(),(),(),(),(),(),() ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:34','2020-05-18 08:21:29','2020-05-18 08:22:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `help_keyword` () VALUES (),(),(),(),(),(),(),(),() ;'),('test','ev_28714_21','UPDATE IGNORE `INNODB_LOCK_WAITS` SET `blocking_trx_id` = \'x\' ORDER BY `blocking_trx_id` LIMIT 2 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:02','2020-05-18 08:20:02','2020-05-18 08:22:45','2020-05-18 08:20:02','2020-05-18 08:23:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `INNODB_LOCK_WAITS` SET `blocking_trx_id` = \'x\' ORDER BY `blocking_trx_id` LIMIT 2 ;'),('test','ev_28716_178','DELETE FROM `INNODB_SYS_INDEXES` ORDER BY `SPACE` LIMIT 0','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:17','2020-05-18 08:22:17','2020-05-18 08:22:56','2020-05-18 08:22:17','2020-05-18 08:24:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `INNODB_SYS_INDEXES` ORDER BY `SPACE` LIMIT 0'),('test','ev_28714_245','DELETE FROM `index_stats` ORDER BY `avg_frequency` LIMIT 1','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:29','2020-05-18 08:22:29',NULL,'2020-05-18 08:22:29','2020-05-18 08:26:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `index_stats` ORDER BY `avg_frequency` LIMIT 1'),('test','ev_28718_28','UPDATE `innodb_table_stats` SET `last_update` = NULL ORDER BY `database_name` LIMIT 2','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:02','2020-05-18 08:20:02','2020-05-18 08:22:41','2020-05-18 08:20:02','2020-05-18 08:23:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `innodb_table_stats` SET `last_update` = NULL ORDER BY `database_name` LIMIT 2'),('test','ev_28716_28','SELECT * FROM mysql.`proxies_priv` AS table1 WHERE ( (NOT table1.`Timestamp` <= 8 AND table1.`Proxied_host` < table1.`Grantor`) OR table1.`Host` <> 8) HAVING table1.`Timestamp` <> 4 IS NULL LIMIT 6','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:04','2020-05-18 08:20:04','2020-05-18 08:22:28','2020-05-18 08:20:04','2020-05-18 08:23:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM mysql.`proxies_priv` AS table1 WHERE ( (NOT table1.`Timestamp` <= 8 AND table1.`Proxied_host` < table1.`Grantor`) OR table1.`Host` <> 8) HAVING table1.`Timestamp` <> 4 IS NULL LIMIT 6'),('test','ev_28714_209','SHOW PROFILE ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:06','2020-05-18 08:22:06','2020-05-18 08:22:39','2020-05-18 08:22:06','2020-05-18 08:25:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW PROFILE ;'),('test','ev_28714_22','SELECT * FROM (test.`oltp44` AS table1 STRAIGHT_JOIN mysql.`help_keyword` AS table2 ON ( table2.`name` = table1.`k` ) ) WHERE (NOT ( (NOT table2.`help_keyword_id` > \'k\' AND table2.`help_keyword_id` != \'1949-05-18 02:36:35.016964\') OR table1.`pad` < \'1906-07-04 17:02:32.006064\') AND table2.`name` != \'n\') HAVING NOT (table2.`help_keyword_id` = \'v\' IS NOT NULL OR table1.`pad` >= 1) LIMIT 7 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:03','2020-05-18 08:20:03','2020-05-18 08:22:41','2020-05-18 08:20:03','2020-05-18 08:22:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp44` AS table1 STRAIGHT_JOIN mysql.`help_keyword` AS table2 ON ( table2.`name` = table1.`k` ) ) WHERE (NOT ( (NOT table2.`help_keyword_id` > \'k\' AND table2.`help_keyword_id` != \'1949-05-18 02:36:35.016964\') OR table1.`pad` < \'1906-07-04 17:02:32.006064\') AND table2.`name` != \'n\') HAVING NOT (table2.`help_keyword_id` = \'v\' IS NOT NULL OR table1.`pad` >= 1) LIMIT 7 ;'),('test','ev_28718_223','SELECT * FROM test.`oltp124` AS table1 WHERE ( ( ( table1.`id` >= \'wr\' AND table1.`k` <> table1.`id`) AND table1.`k` <= \'r\') AND table1.`id` >= table1.`c`) LIMIT 7','root@localhost',NULL,1,'SECOND','2020-05-18 08:23:05','2020-05-18 08:23:05',NULL,'2020-05-18 08:23:05','2020-05-18 08:25:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp124` AS table1 WHERE ( ( ( table1.`id` >= \'wr\' AND table1.`k` <> table1.`id`) AND table1.`k` <= \'r\') AND table1.`id` >= table1.`c`) LIMIT 7'),('test','ev_28714_284','INSERT INTO `help_keyword` SELECT * FROM `servers` ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:24:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `help_keyword` SELECT * FROM `servers` ;'),('test','ev_28718_150','SELECT * FROM `tables_priv` ORDER BY `Table_priv` LIMIT 46 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:56','2020-05-18 08:21:56','2020-05-18 08:22:32','2020-05-18 08:21:56','2020-05-18 08:24:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `tables_priv` ORDER BY `Table_priv` LIMIT 46 ;'),('test','ev_28714_139','UPDATE IGNORE `t5_MyISAM` SET `id` = \'endless\' ORDER BY `col_char` LIMIT 3','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:17','2020-05-18 08:21:17','2020-05-18 08:22:29','2020-05-18 08:21:17','2020-05-18 08:23:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `t5_MyISAM` SET `id` = \'endless\' ORDER BY `col_char` LIMIT 3'),('test','ev_28714_25','SELECT * FROM `event` ORDER BY `status` LIMIT 15','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:03','2020-05-18 08:20:03','2020-05-18 08:22:36','2020-05-18 08:20:03','2020-05-18 08:23:56','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `event` ORDER BY `status` LIMIT 15'),('test','ev_28718_32','COMMIT','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:03','2020-05-18 08:20:03','2020-05-18 08:23:04','2020-05-18 08:20:03','2020-05-18 08:23:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28716_26','SELECT * FROM `procs_priv` ORDER BY `Grantor` LIMIT 74','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:04','2020-05-18 08:20:04','2020-05-18 08:22:45','2020-05-18 08:20:04','2020-05-18 08:23:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `procs_priv` ORDER BY `Grantor` LIMIT 74'),('test','ev_28718_35','SELECT * FROM `help_category` ORDER BY `help_category_id` LIMIT 157','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:04','2020-05-18 08:20:04','2020-05-18 08:22:56','2020-05-18 08:20:04','2020-05-18 08:22:58','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `help_category` ORDER BY `help_category_id` LIMIT 157'),('test','ev_28716_76','SELECT * FROM (INFORMATION_SCHEMA.`COLLATION_CHARACTER_SET_APPLICABILITY` AS table1 STRAIGHT_JOIN mysql.`gtid_slave_pos` AS table2 ON ( table2.`server_id` = table1.`CHARACTER_SET_NAME` ) ) WHERE ( (NOT table2.`domain_id` >= \'ft\' AND table2.`server_id` <> \'tq\') OR table1.`CHARACTER_SET_NAME` = 9) LIMIT 8 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:35','2020-05-18 08:20:35','2020-05-18 08:22:33','2020-05-18 08:20:35','2020-05-18 08:24:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`COLLATION_CHARACTER_SET_APPLICABILITY` AS table1 STRAIGHT_JOIN mysql.`gtid_slave_pos` AS table2 ON ( table2.`server_id` = table1.`CHARACTER_SET_NAME` ) ) WHERE ( (NOT table2.`domain_id` >= \'ft\' AND table2.`server_id` <> \'tq\') OR table1.`CHARACTER_SET_NAME` = 9) LIMIT 8 ;'),('test','ev_28718_36','SELECT * FROM test.`oltp159` AS table1 WHERE table1.`k` = 9 LIMIT 0 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:04','2020-05-18 08:20:04','2020-05-18 08:22:32','2020-05-18 08:20:04','2020-05-18 08:23:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp159` AS table1 WHERE table1.`k` = 9 LIMIT 0 ;'),('test','ev_28714_285','SHOW EXPLAIN FOR 246','root@localhost',NULL,7,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:26:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 246'),('test','ev_28718_222','SELECT `id` FROM `oltp34` ORDER BY `id` LIMIT 168 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:23:04','2020-05-18 08:23:04',NULL,'2020-05-18 08:23:04','2020-05-18 08:25:56','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp34` ORDER BY `id` LIMIT 168 ;'),('test','ev_28716_226','UPDATE `PARAMETERS` SET `PARAMETER_MODE` = 78 ORDER BY `DTD_IDENTIFIER` LIMIT 8','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:38','2020-05-18 08:22:38',NULL,'2020-05-18 08:22:38','2020-05-18 08:24:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `PARAMETERS` SET `PARAMETER_MODE` = 78 ORDER BY `DTD_IDENTIFIER` LIMIT 8'),('test','ev_28714_170','SELECT * FROM `innodb_table_stats` ORDER BY `sum_of_other_index_sizes` LIMIT 32','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:39','2020-05-18 08:21:39','2020-05-18 08:23:05','2020-05-18 08:21:39','2020-05-18 08:25:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `innodb_table_stats` ORDER BY `sum_of_other_index_sizes` LIMIT 32'),('test','y','SET @a=@a','root@localhost','2020-05-18 08:23:06',NULL,NULL,'2020-05-18 08:23:06','2020-05-18 08:23:06',NULL,NULL,NULL,'ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SET @a=@a'),('test','ev_28716_34','DELETE FROM `roles_mapping` ORDER BY `User` LIMIT 5','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:07','2020-05-18 08:20:07','2020-05-18 08:22:31','2020-05-18 08:20:07','2020-05-18 08:23:35','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `roles_mapping` ORDER BY `User` LIMIT 5'),('test','ev_28714_251','SELECT * FROM test.`oltp117` AS table1 WHERE ( ( ( ( table1.`pad` != \'1908-09-13 15:39:21.026567\' OR table1.`c` <> \'2017-05-05 18:24:59.064732\') AND table1.`id` != \'rh\') OR table1.`c` <> \'hz\') AND table1.`c` > \'zk\') HAVING table1.`id` <= \'k\' LIMIT 9 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:25:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp117` AS table1 WHERE ( ( ( ( table1.`pad` != \'1908-09-13 15:39:21.026567\' OR table1.`c` <> \'2017-05-05 18:24:59.064732\') AND table1.`id` != \'rh\') OR table1.`c` <> \'hz\') AND table1.`c` > \'zk\') HAVING table1.`id` <= \'k\' LIMIT 9 ;'),('test','ev_28714_186','UPDATE `oltp83` SET `k` = DEFAULT ORDER BY `c` LIMIT 9 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:49','2020-05-18 08:21:49','2020-05-18 08:23:06','2020-05-18 08:21:49','2020-05-18 08:24:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `oltp83` SET `k` = DEFAULT ORDER BY `c` LIMIT 9 ;'),('test','ev_28714_86','INSERT IGNORE INTO `VIEWS` ( `CHARACTER_SET_CLIENT` ) VALUES ( DEFAULT )','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:51','2020-05-18 08:20:51','2020-05-18 08:22:26','2020-05-18 08:20:51','2020-05-18 08:23:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `VIEWS` ( `CHARACTER_SET_CLIENT` ) VALUES ( DEFAULT )'),('test','ev_28714_291','SELECT `c` FROM `oltp2` ORDER BY `id` LIMIT 85 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:06','2020-05-18 08:23:06',NULL,'2020-05-18 08:23:06','2020-05-18 08:24:06','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `oltp2` ORDER BY `id` LIMIT 85 ;'),('test','ev_28718_224','SELECT * FROM `t3_InnoDB` ORDER BY `col_datetime` LIMIT 243','root@localhost',NULL,7,'SECOND','2020-05-18 08:23:05','2020-05-18 08:23:05',NULL,'2020-05-18 08:23:05','2020-05-18 08:24:47','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `t3_InnoDB` ORDER BY `col_datetime` LIMIT 243'),('test','ev_28718_41','UPDATE IGNORE `oltp49` SET `c` = 171 ORDER BY `pad` LIMIT 2','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:08','2020-05-18 08:20:08','2020-05-18 08:22:40','2020-05-18 08:20:08','2020-05-18 08:24:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp49` SET `c` = 171 ORDER BY `pad` LIMIT 2'),('test','ev_28714_32','INSERT IGNORE INTO `column_stats` () VALUES (),(),(),()','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:08','2020-05-18 08:20:08','2020-05-18 08:22:29','2020-05-18 08:20:08','2020-05-18 08:23:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `column_stats` () VALUES (),(),(),()'),('test','ev_28716_142','SELECT * FROM test.`oltp125` AS table1 WHERE NOT ( (NOT ( table1.`id` <= table1.`c` AND table1.`k` <= \'1947-07-22 07:23:12.006168\') AND table1.`id` <= table1.`pad`) OR table1.`c` != table1.`k`) HAVING (NOT ( table1.`k` <= \'2009-04-07 03:30:34.054734\' AND table1.`c` <= \'wk\') AND table1.`k` >= \'kr\') LIMIT 3','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:49','2020-05-18 08:21:49','2020-05-18 08:23:06','2020-05-18 08:21:49','2020-05-18 08:23:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp125` AS table1 WHERE NOT ( (NOT ( table1.`id` <= table1.`c` AND table1.`k` <= \'1947-07-22 07:23:12.006168\') AND table1.`id` <= table1.`pad`) OR table1.`c` != table1.`k`) HAVING (NOT ( table1.`k` <= \'2009-04-07 03:30:34.054734\' AND table1.`c` <= \'wk\') AND table1.`k` >= \'kr\') LIMIT 3'),('test','ev_28716_195','REPLACE INTO `servers` ( `Db`, _next_field ) VALUES ( DEFAULT, \'\' )','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:03','2020-05-18 08:22:22','2020-05-18 08:26:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `servers` ( `Db`, ) VALUES ( DEFAULT, \'\' )'),('test','ev_28714_35','COMMIT','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:11','2020-05-18 08:20:11','2020-05-18 08:22:45','2020-05-18 08:20:11','2020-05-18 08:23:21','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28718_186','ALTER TABLE IF EXISTS `time_zone_transition_type` DROP CONSTRAINT IF EXISTS `Is_DST`, LOCK=NONE, ADD KEY IF NOT EXISTS h ( `Transition_type_id` )','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:24','2020-05-18 08:22:24','2020-05-18 08:23:05','2020-05-18 08:22:24','2020-05-18 08:24:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','ALTER TABLE IF EXISTS `time_zone_transition_type` DROP CONSTRAINT IF EXISTS `Is_DST`, LOCK=NONE, ADD KEY IF NOT EXISTS h ( `Transition_type_id` )'),('test','ev_28718_219','INSERT IGNORE INTO `oltp154` () VALUES (),(),(),()','root@localhost',NULL,1,'SECOND','2020-05-18 08:23:01','2020-05-18 08:23:01',NULL,'2020-05-18 08:23:01','2020-05-18 08:24:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp154` () VALUES (),(),(),()'),('test','ev_28718_61','UPDATE `t5_InnoDB` SET `col_bit` = DEFAULT ORDER BY `id` LIMIT 1 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:37','2020-05-18 08:20:37','2020-05-18 08:22:33','2020-05-18 08:20:37','2020-05-18 08:23:26','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `t5_InnoDB` SET `col_bit` = DEFAULT ORDER BY `id` LIMIT 1 ;'),('test','ev_28716_250','SELECT * FROM (mysql.`roles_mapping` AS table1 INNER JOIN test.`oltp20` AS table2 ON ( table2.`k` = table1.`Role` ) ) WHERE NOT ( ( ( table2.`k` <> \'gq\' OR table2.`id` = table1.`User`) AND table1.`Role` < \'1928-08-10 21:51:07.051221\') OR table1.`User` <= \'qe\') LIMIT 7','root@localhost',NULL,3,'SECOND','2020-05-18 08:23:06','2020-05-18 08:23:06',NULL,'2020-05-18 08:23:06','2020-05-18 08:27:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`roles_mapping` AS table1 INNER JOIN test.`oltp20` AS table2 ON ( table2.`k` = table1.`Role` ) ) WHERE NOT ( ( ( table2.`k` <> \'gq\' OR table2.`id` = table1.`User`) AND table1.`Role` < \'1928-08-10 21:51:07.051221\') OR table1.`User` <= \'qe\') LIMIT 7'),('test','ev_28716_162','UPDATE IGNORE `ROUTINES` SET `SQL_PATH` = \'f\' ORDER BY `DATABASE_COLLATION` LIMIT 6','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:06','2020-05-18 08:22:06','2020-05-18 08:22:38','2020-05-18 08:22:06','2020-05-18 08:23:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `ROUTINES` SET `SQL_PATH` = \'f\' ORDER BY `DATABASE_COLLATION` LIMIT 6'),('test','ev_28718_43','SELECT * FROM (mysql.`column_stats` AS table1 INNER JOIN mysql.`procs_priv` AS table2 ON ( table2.`Host` = table1.`hist_type` ) ) WHERE (NOT table1.`avg_frequency` != \'aw\' OR table1.`avg_length` > table1.`histogram`) HAVING ( (table1.`avg_length` > \'1969-05-15 02:38:54.019842\' IS NULL AND table2.`Routine_type` >= \'w\') OR table2.`Db` < \'wv\') LIMIT 4','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:10','2020-05-18 08:20:10','2020-05-18 08:22:26','2020-05-18 08:20:10','2020-05-18 08:22:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`column_stats` AS table1 INNER JOIN mysql.`procs_priv` AS table2 ON ( table2.`Host` = table1.`hist_type` ) ) WHERE (NOT table1.`avg_frequency` != \'aw\' OR table1.`avg_length` > table1.`histogram`) HAVING ( (table1.`avg_length` > \'1969-05-15 02:38:54.019842\' IS NULL AND table2.`Routine_type` >= \'w\') OR table2.`Db` < \'wv\') LIMIT 4'),('test','ev_28718_135','SELECT * FROM (test.`t9_InnoDB` AS table1 STRAIGHT_JOIN mysql.`global_priv` AS table2 ON ( table2.`Host` = table1.`col_blob` ) ) WHERE (NOT table2.`User` <> \'uf\' OR table1.`col_int` > table1.`col_int`) HAVING ( (table2.`Host` < 2 IS NULL AND table2.`User` >= \'1972-03-13 15:59:05.038669\') AND table1.`id` >= \'f\') LIMIT 3 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:45','2020-05-18 08:21:45','2020-05-18 08:23:04','2020-05-18 08:21:45','2020-05-18 08:25:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`t9_InnoDB` AS table1 STRAIGHT_JOIN mysql.`global_priv` AS table2 ON ( table2.`Host` = table1.`col_blob` ) ) WHERE (NOT table2.`User` <> \'uf\' OR table1.`col_int` > table1.`col_int`) HAVING ( (table2.`Host` < 2 IS NULL AND table2.`User` >= \'1972-03-13 15:59:05.038669\') AND table1.`id` >= \'f\') LIMIT 3 ;'),('test','ev_28714_178','UPDATE IGNORE `TABLE_STATISTICS` SET `ROWS_CHANGED` = DEFAULT ORDER BY `ROWS_READ` LIMIT 7','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:44','2020-05-18 08:21:44','2020-05-18 08:23:09','2020-05-18 08:21:44','2020-05-18 08:24:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `TABLE_STATISTICS` SET `ROWS_CHANGED` = DEFAULT ORDER BY `ROWS_READ` LIMIT 7'),('test','ev_28716_45','START TRANSACTION','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:12','2020-05-18 08:20:12','2020-05-18 08:22:57','2020-05-18 08:20:12','2020-05-18 08:23:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28716_163','SELECT * FROM `roles_mapping` ORDER BY `Role` LIMIT 89','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:07','2020-05-18 08:22:07','2020-05-18 08:22:39','2020-05-18 08:22:07','2020-05-18 08:25:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `roles_mapping` ORDER BY `Role` LIMIT 89'),('test','ev_28714_37','DELETE FROM `COLLATION_CHARACTER_SET_APPLICABILITY` ORDER BY `COLLATION_NAME` LIMIT 3','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:13','2020-05-18 08:20:13','2020-05-18 08:22:34','2020-05-18 08:20:13','2020-05-18 08:23:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `COLLATION_CHARACTER_SET_APPLICABILITY` ORDER BY `COLLATION_NAME` LIMIT 3'),('test','ev_28714_211','SELECT `INDEX_ID` FROM `INNODB_FT_DEFAULT_STOPWORD` ORDER BY `value` LIMIT 198 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:07','2020-05-18 08:22:07','2020-05-18 08:22:39','2020-05-18 08:22:07','2020-05-18 08:23:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `INDEX_ID` FROM `INNODB_FT_DEFAULT_STOPWORD` ORDER BY `value` LIMIT 198 ;'),('test','ev_28716_230','UPDATE IGNORE `help_relation` SET `help_keyword_id` = 121 ORDER BY `help_topic_id` LIMIT 9','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:41','2020-05-18 08:22:41',NULL,'2020-05-18 08:22:41','2020-05-18 08:23:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_relation` SET `help_keyword_id` = 121 ORDER BY `help_topic_id` LIMIT 9'),('test','ev_28716_47','SHOW STATUS','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:13','2020-05-18 08:20:13','2020-05-18 08:22:59','2020-05-18 08:20:13','2020-05-18 08:23:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW STATUS'),('test','ev_28714_64','UPDATE IGNORE `plugin` SET `dl` = \'specialist\' ORDER BY `name` LIMIT 4','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:38','2020-05-18 08:20:38','2020-05-18 08:22:33','2020-05-18 08:20:38','2020-05-18 08:23:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `plugin` SET `dl` = \'specialist\' ORDER BY `name` LIMIT 4'),('test','ev_28718_134','START TRANSACTION','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:44','2020-05-18 08:21:44','2020-05-18 08:23:04','2020-05-18 08:21:44','2020-05-18 08:23:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28714_42','INSERT IGNORE INTO `oltp71` ( `id` ) VALUES ( 253 ) ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:14','2020-05-18 08:20:14','2020-05-18 08:22:30','2020-05-18 08:20:14','2020-05-18 08:23:19','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp71` ( `id` ) VALUES ( 253 ) ;'),('test','ev_28714_163','SELECT * FROM `SPATIAL_REF_SYS` INTO OUTFILE \'load_SPATIAL_REF_SYS\' ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:37','2020-05-18 08:21:37','2020-05-18 08:22:51','2020-05-18 08:21:37','2020-05-18 08:25:39','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `SPATIAL_REF_SYS` INTO OUTFILE \'load_SPATIAL_REF_SYS\' ;'),('test','ev_28714_43','INSERT IGNORE INTO `time_zone_leap_second` () VALUES ()','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:15','2020-05-18 08:20:15','2020-05-18 08:23:00','2020-05-18 08:20:15','2020-05-18 08:23:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_leap_second` () VALUES ()'),('test','ev_28716_78','SELECT * FROM `oltp35` ORDER BY `c` LIMIT 12','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:38','2020-05-18 08:20:38','2020-05-18 08:22:41','2020-05-18 08:20:38','2020-05-18 08:23:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp35` ORDER BY `c` LIMIT 12'),('test','ev_28716_234','SELECT * FROM mysql.`column_stats` AS table1 WHERE ( (NOT table1.`avg_length` != table1.`hist_type` AND table1.`max_value` <= table1.`avg_length`) AND table1.`max_value` = table1.`db_name`) HAVING table1.`db_name` >= 7 IS NOT NULL LIMIT 3','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:44','2020-05-18 08:22:44',NULL,'2020-05-18 08:22:44','2020-05-18 08:26:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM mysql.`column_stats` AS table1 WHERE ( (NOT table1.`avg_length` != table1.`hist_type` AND table1.`max_value` <= table1.`avg_length`) AND table1.`max_value` = table1.`db_name`) HAVING table1.`db_name` >= 7 IS NOT NULL LIMIT 3'),('test','ev_28714_249','UPDATE IGNORE `ENABLED_ROLES` SET `ROLE_NAME` = \'q\' ORDER BY `ROLE_NAME` LIMIT 0 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:31','2020-05-18 08:22:31',NULL,'2020-05-18 08:22:31','2020-05-18 08:25:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `ENABLED_ROLES` SET `ROLE_NAME` = \'q\' ORDER BY `ROLE_NAME` LIMIT 0 ;'),('test','ev_28714_212','UPDATE IGNORE `FILES` SET `FULLTEXT_KEYS` = \'highly\' ORDER BY `CREATE_TIME` LIMIT 0 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:09','2020-05-18 08:22:09','2020-05-18 08:22:42','2020-05-18 08:22:09','2020-05-18 08:23:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `FILES` SET `FULLTEXT_KEYS` = \'highly\' ORDER BY `CREATE_TIME` LIMIT 0 ;'),('test','ev_28714_76','UPDATE IGNORE `oltp33` SET `id` = NULL ORDER BY `c` LIMIT 6','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:45','2020-05-18 08:20:45','2020-05-18 08:22:21','2020-05-18 08:20:45','2020-05-18 08:24:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp33` SET `id` = NULL ORDER BY `c` LIMIT 6'),('test','ev_28718_51','UPDATE IGNORE `SPATIAL_REF_SYS` SET `AUTH_SRID` = DEFAULT ORDER BY `AUTH_NAME` LIMIT 5','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:15','2020-05-18 08:20:15','2020-05-18 08:22:33','2020-05-18 08:20:15','2020-05-18 08:23:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `SPATIAL_REF_SYS` SET `AUTH_SRID` = DEFAULT ORDER BY `AUTH_NAME` LIMIT 5'),('test','ev_28718_60','UPDATE IGNORE `roles_mapping` SET `Role` = \'courtroom\' ORDER BY `User` LIMIT 8','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:30','2020-05-18 08:20:30','2020-05-18 08:22:42','2020-05-18 08:20:30','2020-05-18 08:23:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `roles_mapping` SET `Role` = \'courtroom\' ORDER BY `User` LIMIT 8'),('test','ev_28718_69','SELECT `VARIABLE_VALUE` FROM `REFERENTIAL_CONSTRAINTS` ORDER BY `CONSTRAINT_NAME` LIMIT 71','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:42','2020-05-18 08:20:42','2020-05-18 08:23:00','2020-05-18 08:20:42','2020-05-18 08:24:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `VARIABLE_VALUE` FROM `REFERENTIAL_CONSTRAINTS` ORDER BY `CONSTRAINT_NAME` LIMIT 71'),('test','ev_28716_140','REPLACE INTO `INNODB_SYS_INDEXES` ( `N_FIELDS` ) VALUES ( \'x\' )','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:48','2020-05-18 08:21:48','2020-05-18 08:23:05','2020-05-18 08:21:48','2020-05-18 08:23:55','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `INNODB_SYS_INDEXES` ( `N_FIELDS` ) VALUES ( \'x\' )'),('test','ev_28714_47','REPLACE INTO `INNODB_FT_DEFAULT_STOPWORD` () VALUES (),()','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:16','2020-05-18 08:20:16','2020-05-18 08:22:33','2020-05-18 08:20:16','2020-05-18 08:22:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `INNODB_FT_DEFAULT_STOPWORD` () VALUES (),()'),('test','ev_28716_53','SHOW CREATE DATABASE e','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:16','2020-05-18 08:20:16','2020-05-18 08:22:49','2020-05-18 08:20:16','2020-05-18 08:24:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW CREATE DATABASE e'),('test','ev_28718_199','INSERT IGNORE INTO `INNODB_CMPMEM_RESET` () VALUES (),()','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:26:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `INNODB_CMPMEM_RESET` () VALUES (),()'),('test','ev_28714_48','INSERT INTO `help_topic` ( `description`, _next_field ) VALUES ( \'x\', DEFAULT ) ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:17','2020-05-18 08:20:17','2020-05-18 08:22:32','2020-05-18 08:20:17','2020-05-18 08:24:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `help_topic` ( `description`, ) VALUES ( \'x\', DEFAULT ) ;'),('test','ev_28714_168','SELECT `query_time` FROM `index_stats` ORDER BY `prefix_arity` LIMIT 177','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:39','2020-05-18 08:21:39','2020-05-18 08:22:57','2020-05-18 08:21:39','2020-05-18 08:23:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `query_time` FROM `index_stats` ORDER BY `prefix_arity` LIMIT 177'),('test','ev_28716_181','SELECT `Table_name` FROM `db` ORDER BY `Grant_priv` LIMIT 88','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:58','2020-05-18 08:22:19','2020-05-18 08:25:08','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Table_name` FROM `db` ORDER BY `Grant_priv` LIMIT 88'),('test','ev_28718_106','INSERT INTO `COLLATION_CHARACTER_SET_APPLICABILITY` ( `CHARACTER_SET_NAME`, _next_field ) VALUES ( NULL, \'\' )','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:20','2020-05-18 08:21:20','2020-05-18 08:22:30','2020-05-18 08:21:20','2020-05-18 08:23:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `COLLATION_CHARACTER_SET_APPLICABILITY` ( `CHARACTER_SET_NAME`, ) VALUES ( NULL, \'\' )'),('test','ev_28718_146','INSERT INTO `APPLICABLE_ROLES` SELECT * FROM `INNODB_SYS_FOREIGN`','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:53','2020-05-18 08:21:53','2020-05-18 08:22:30','2020-05-18 08:21:53','2020-05-18 08:23:06','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `APPLICABLE_ROLES` SELECT * FROM `INNODB_SYS_FOREIGN`'),('test','ev_28714_167','REPLACE INTO `USER_STATISTICS` ( `DENIED_CONNECTIONS` ) VALUES ( \'now\' ) ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:38','2020-05-18 08:21:38','2020-05-18 08:23:00','2020-05-18 08:21:38','2020-05-18 08:25:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `USER_STATISTICS` ( `DENIED_CONNECTIONS` ) VALUES ( \'now\' ) ;'),('test','ev_28714_130','DELETE FROM `oltp89` ORDER BY `c` LIMIT 9 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:10','2020-05-18 08:21:10','2020-05-18 08:22:22','2020-05-18 08:21:10','2020-05-18 08:24:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp89` ORDER BY `c` LIMIT 9 ;'),('test','ev_28714_52','DELETE FROM `time_zone_name` ORDER BY `Time_zone_id` LIMIT 8 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:18','2020-05-18 08:20:18','2020-05-18 08:22:24','2020-05-18 08:20:18','2020-05-18 08:23:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `time_zone_name` ORDER BY `Time_zone_id` LIMIT 8 ;'),('test','ev_28716_218','SHOW TRIGGERS','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:24:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW TRIGGERS'),('test','ev_28714_239','ALTER IGNORE TABLE IF EXISTS ind_constr_t3 ADD INDEX IF NOT EXISTS o USING BTREE ( h DESC ), LOCK=NONE, /* compatibility 10.5.2 */ RENAME INDEX IF EXISTS `id` TO m, LOCK=DEFAULT, DROP CONSTRAINT IF EXISTS z, /* compatibility 10.5.2 */ RENAME KEY IF EXISTS ind5 TO v ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:24','2020-05-18 08:22:24','2020-05-18 08:23:05','2020-05-18 08:22:24','2020-05-18 08:26:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','ALTER IGNORE TABLE IF EXISTS ind_constr_t3 ADD INDEX IF NOT EXISTS o USING BTREE ( h DESC ), LOCK=NONE, /* compatibility 10.5.2 */ RENAME INDEX IF EXISTS `id` TO m, LOCK=DEFAULT, DROP CONSTRAINT IF EXISTS z, /* compatibility 10.5.2 */ RENAME KEY IF EXISTS ind5 TO v ;'),('test','ev_28716_57','REPLACE INTO `gtid_slave_pos` ( `sub_id` ) VALUES ( \'\' )','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:20','2020-05-18 08:20:20','2020-05-18 08:22:29','2020-05-18 08:20:20','2020-05-18 08:22:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `gtid_slave_pos` ( `sub_id` ) VALUES ( \'\' )'),('test','ev_28714_241','SELECT * FROM `oltp90` ORDER BY `id` LIMIT 196 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:25','2020-05-18 08:22:25','2020-05-18 08:23:08','2020-05-18 08:22:25','2020-05-18 08:26:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp90` ORDER BY `id` LIMIT 196 ;'),('test','ev_28718_139','SELECT `k` FROM `oltp9` ORDER BY `c` LIMIT 2','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:48','2020-05-18 08:21:48','2020-05-18 08:23:05','2020-05-18 08:21:48','2020-05-18 08:25:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `k` FROM `oltp9` ORDER BY `c` LIMIT 2'),('test','ev_28714_55','INSERT IGNORE INTO `TABLES` ( `TABLE_CATALOG` ) VALUES ( \'\' )','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:20','2020-05-18 08:20:20','2020-05-18 08:23:03','2020-05-18 08:20:20','2020-05-18 08:23:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `TABLES` ( `TABLE_CATALOG` ) VALUES ( \'\' )'),('test','ev_28718_55','SELECT * FROM `EVENTS` INTO OUTFILE \'load_EVENTS\' ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:20','2020-05-18 08:20:20','2020-05-18 08:23:10','2020-05-18 08:20:20','2020-05-18 08:23:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `EVENTS` INTO OUTFILE \'load_EVENTS\' ;'),('test','ev_28718_192','FLUSH ERROR LOGS, USER_RESOURCES','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:29','2020-05-18 08:22:29',NULL,'2020-05-18 08:22:29','2020-05-18 08:25:49','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','FLUSH ERROR LOGS, USER_RESOURCES'),('test','ev_28716_219','UPDATE IGNORE `time_zone_name` SET `Name` = \'v\' ORDER BY `Name` LIMIT 9','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:26:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `time_zone_name` SET `Name` = \'v\' ORDER BY `Name` LIMIT 9'),('test','ev_28716_59','INSERT IGNORE INTO `innodb_index_stats` ( `last_update`, _next_field ) VALUES ( DEFAULT, \'request\' ) ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:21','2020-05-18 08:20:21','2020-05-18 08:22:34','2020-05-18 08:20:21','2020-05-18 08:23:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `innodb_index_stats` ( `last_update`, ) VALUES ( DEFAULT, \'request\' ) ;'),('test','ev_28716_207','INSERT IGNORE INTO `INNODB_SYS_VIRTUAL` ( `BASE_POS` ) VALUES ( \'suburban\' )','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:28','2020-05-18 08:22:28',NULL,'2020-05-18 08:22:28','2020-05-18 08:25:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `INNODB_SYS_VIRTUAL` ( `BASE_POS` ) VALUES ( \'suburban\' )'),('test','f','SET @a=@a','root@localhost','2020-05-18 08:23:06',NULL,NULL,'2020-05-18 08:23:06','2020-05-18 08:23:06',NULL,NULL,NULL,'ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SET @a=@a'),('test','ev_28718_200','SELECT * FROM (test.`t5_InnoDB` AS table1 RIGHT OUTER JOIN mysql.`index_stats` AS table2 ON ( table2.`table_name` = table1.`id` ) ) WHERE ( table1.`col_dec` >= 0 AND table1.`col_timestamp` = \'x\') LIMIT 6 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:26:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`t5_InnoDB` AS table1 RIGHT OUTER JOIN mysql.`index_stats` AS table2 ON ( table2.`table_name` = table1.`id` ) ) WHERE ( table1.`col_dec` >= 0 AND table1.`col_timestamp` = \'x\') LIMIT 6 ;'),('test','ev_28714_185','FLUSH NO_WRITE_TO_BINLOG RELAY LOGS, USER_RESOURCES, STATUS','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:48','2020-05-18 08:21:48','2020-05-18 08:22:23','2020-05-18 08:21:48','2020-05-18 08:22:56','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','FLUSH NO_WRITE_TO_BINLOG RELAY LOGS, USER_RESOURCES, STATUS'),('test','ev_28716_193','INSERT INTO `plugin` ( `name` ) VALUES ( \'r\' )','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:21','2020-05-18 08:22:21','2020-05-18 08:23:00','2020-05-18 08:22:21','2020-05-18 08:24:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `plugin` ( `name` ) VALUES ( \'r\' )'),('test','ev_28714_296','SELECT * FROM `SPATIAL_REF_SYS` ORDER BY `SRID` LIMIT 65 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:10','2020-05-18 08:23:10',NULL,'2020-05-18 08:23:10','2020-05-18 08:23:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `SPATIAL_REF_SYS` ORDER BY `SRID` LIMIT 65 ;'),('test','ev_28718_58','SELECT * FROM (INFORMATION_SCHEMA.`REFERENTIAL_CONSTRAINTS` AS table1 STRAIGHT_JOIN test.`oltp161` AS table2 ON ( table2.`k` = table1.`UNIQUE_CONSTRAINT_NAME` ) ) WHERE (NOT (NOT ( (NOT table2.`c` != table1.`CONSTRAINT_NAME` OR table2.`c` > table1.`CONSTRAINT_NAME`) OR table2.`id` = table1.`CONSTRAINT_CATALOG`) OR table1.`UNIQUE_CONSTRAINT_CATALOG` = \'1958-06-11 02:29:35.054611\') OR table1.`UPDATE_RULE` != \'jt\') LIMIT 8 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:23','2020-05-18 08:20:23','2020-05-18 08:22:35','2020-05-18 08:20:23','2020-05-18 08:24:19','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`REFERENTIAL_CONSTRAINTS` AS table1 STRAIGHT_JOIN test.`oltp161` AS table2 ON ( table2.`k` = table1.`UNIQUE_CONSTRAINT_NAME` ) ) WHERE (NOT (NOT ( (NOT table2.`c` != table1.`CONSTRAINT_NAME` OR table2.`c` > table1.`CONSTRAINT_NAME`) OR table2.`id` = table1.`CONSTRAINT_CATALOG`) OR table1.`UNIQUE_CONSTRAINT_CATALOG` = \'1958-06-11 02:29:35.054611\') OR table1.`UPDATE_RULE` != \'jt\') LIMIT 8 ;'),('test','ev_28718_65','SELECT * FROM `oltp160` ORDER BY `c` LIMIT 196 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:38','2020-05-18 08:20:38','2020-05-18 08:22:54','2020-05-18 08:20:38','2020-05-18 08:24:53','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp160` ORDER BY `c` LIMIT 196 ;'),('test','ev_28714_203','UPDATE IGNORE `THREAD_POOL_QUEUES` SET `POSITION` = \'p\' ORDER BY `QUEUEING_TIME_MICROSECONDS` LIMIT 2 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:22:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `THREAD_POOL_QUEUES` SET `POSITION` = \'p\' ORDER BY `QUEUEING_TIME_MICROSECONDS` LIMIT 2 ;'),('test','ev_28716_62','UPDATE IGNORE `proc` SET `definer` = \'h\' ORDER BY `sql_mode` LIMIT 1','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:23','2020-05-18 08:20:23','2020-05-18 08:22:48','2020-05-18 08:20:23','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `proc` SET `definer` = \'h\' ORDER BY `sql_mode` LIMIT 1'),('test','ev_28718_110','SHOW DATABASES ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:34','2020-05-18 08:21:29','2020-05-18 08:23:26','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW DATABASES ;'),('test','ev_28714_59','SELECT * FROM test.`oltp109` AS table1 WHERE (NOT (NOT ( (NOT ( ( table1.`k` <> table1.`id` AND table1.`pad` <= table1.`id`) AND table1.`id` <> 3) OR table1.`k` >= table1.`k`) OR table1.`pad` >= \'kn\') AND table1.`pad` <= \'2001-08-19 13:35:40.063449\') OR table1.`c` < 7) LIMIT 8','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:24','2020-05-18 08:20:24','2020-05-18 08:22:27','2020-05-18 08:20:24','2020-05-18 08:23:55','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp109` AS table1 WHERE (NOT (NOT ( (NOT ( ( table1.`k` <> table1.`id` AND table1.`pad` <= table1.`id`) AND table1.`id` <> 3) OR table1.`k` >= table1.`k`) OR table1.`pad` >= \'kn\') AND table1.`pad` <= \'2001-08-19 13:35:40.063449\') OR table1.`c` < 7) LIMIT 8'),('test','ev_28716_64','SELECT `c` FROM `oltp39` ORDER BY `c` LIMIT 71','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:24','2020-05-18 08:20:24','2020-05-18 08:23:07','2020-05-18 08:20:24','2020-05-18 08:24:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `oltp39` ORDER BY `c` LIMIT 71'),('test','ev_28714_240','SELECT * FROM `oltp128` INTO OUTFILE \'load_oltp128\' ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:24','2020-05-18 08:22:24','2020-05-18 08:23:05','2020-05-18 08:22:24','2020-05-18 08:23:47','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp128` INTO OUTFILE \'load_oltp128\' ;'),('test','ev_28716_66','REPLACE INTO `t4_Aria` ( `col_datetime` ) VALUES ( \'y\' )','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:25','2020-05-18 08:20:25','2020-05-18 08:23:11','2020-05-18 08:20:25','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `t4_Aria` ( `col_datetime` ) VALUES ( \'y\' )'),('test','ev_28714_261','UPDATE IGNORE `column_stats` SET `avg_length` = \'flexible\' ORDER BY `max_value` LIMIT 7 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:41','2020-05-18 08:22:41',NULL,'2020-05-18 08:22:41','2020-05-18 08:25:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `column_stats` SET `avg_length` = \'flexible\' ORDER BY `max_value` LIMIT 7 ;'),('test','ev_28716_243','SELECT `id` FROM `oltp130` ORDER BY `pad` LIMIT 206','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:54','2020-05-18 08:22:54',NULL,'2020-05-18 08:22:54','2020-05-18 08:26:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp130` ORDER BY `pad` LIMIT 206'),('test','ev_28716_155','DELETE FROM `event` ORDER BY `last_executed` LIMIT 0 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:24:49','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `event` ORDER BY `last_executed` LIMIT 0 ;'),('test','ev_28716_253','UPDATE IGNORE `oltp7` SET `pad` = DEFAULT ORDER BY `c` LIMIT 9','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:08','2020-05-18 08:23:08',NULL,'2020-05-18 08:23:08','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp7` SET `pad` = DEFAULT ORDER BY `c` LIMIT 9'),('test','ev_28716_68','UPDATE `oltp3` SET `id` = \'y\' ORDER BY `id` LIMIT 1','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:26','2020-05-18 08:20:26','2020-05-18 08:22:38','2020-05-18 08:20:26','2020-05-18 08:23:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `oltp3` SET `id` = \'y\' ORDER BY `id` LIMIT 1'),('test','ev_28716_119','INSERT INTO `oltp84` SELECT * FROM `oltp142`','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:24','2020-05-18 08:21:24','2020-05-18 08:22:31','2020-05-18 08:21:24','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `oltp84` SELECT * FROM `oltp142`'),('test','ev_28714_66','SELECT `THROTTLES` FROM `INNODB_METRICS` ORDER BY `TYPE` LIMIT 88','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:39','2020-05-18 08:20:39','2020-05-18 08:22:35','2020-05-18 08:20:39','2020-05-18 08:24:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `THROTTLES` FROM `INNODB_METRICS` ORDER BY `TYPE` LIMIT 88'),('test','ev_28714_202','SELECT `k` FROM `oltp113` ORDER BY `c` LIMIT 192','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:23:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `k` FROM `oltp113` ORDER BY `c` LIMIT 192'),('test','ev_28718_86','SELECT * FROM INFORMATION_SCHEMA.`ENGINES` AS table1 WHERE NOT (NOT table1.`SAVEPOINTS` <= table1.`ENGINE` OR table1.`XA` < table1.`COMMENT`) LIMIT 2 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:41','2020-05-18 08:20:58','2020-05-18 08:25:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`ENGINES` AS table1 WHERE NOT (NOT table1.`SAVEPOINTS` <= table1.`ENGINE` OR table1.`XA` < table1.`COMMENT`) LIMIT 2 ;'),('test','ev_28718_84','DELETE FROM `CHECK_CONSTRAINTS` ORDER BY `CONSTRAINT_CATALOG` LIMIT 4','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:55','2020-05-18 08:20:55','2020-05-18 08:22:33','2020-05-18 08:20:55','2020-05-18 08:24:53','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `CHECK_CONSTRAINTS` ORDER BY `CONSTRAINT_CATALOG` LIMIT 4'),('test','ev_28718_111','REPLACE INTO `t4_MyISAM` ( `col_int` ) VALUES ( NULL ) ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:37','2020-05-18 08:21:29','2020-05-18 08:24:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `t4_MyISAM` ( `col_int` ) VALUES ( NULL ) ;'),('test','ev_28714_151','SELECT `id` FROM `oltp56` ORDER BY `c` LIMIT 43','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:34','2020-05-18 08:21:29','2020-05-18 08:24:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp56` ORDER BY `c` LIMIT 43'),('test','ev_28718_187','REPLACE INTO `oltp64` () VALUES (),() ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:25','2020-05-18 08:22:25','2020-05-18 08:23:07','2020-05-18 08:22:25','2020-05-18 08:24:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp64` () VALUES (),() ;'),('test','ev_28716_75','SELECT * FROM (mysql.`help_keyword` AS table1 STRAIGHT_JOIN mysql.`event` AS table2 ON ( table2.`sql_mode` = table1.`help_keyword_id` ) ) WHERE NOT ( (NOT table2.`ends` <> table1.`help_keyword_id` OR table1.`help_keyword_id` <= table2.`db_collation`) OR table2.`db_collation` <> 1) HAVING ( table2.`name` != 3 AND table2.`execute_at` < 0) LIMIT 2','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:35','2020-05-18 08:20:35','2020-05-18 08:22:38','2020-05-18 08:20:35','2020-05-18 08:24:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`help_keyword` AS table1 STRAIGHT_JOIN mysql.`event` AS table2 ON ( table2.`sql_mode` = table1.`help_keyword_id` ) ) WHERE NOT ( (NOT table2.`ends` <> table1.`help_keyword_id` OR table1.`help_keyword_id` <= table2.`db_collation`) OR table2.`db_collation` <> 1) HAVING ( table2.`name` != 3 AND table2.`execute_at` < 0) LIMIT 2'),('test','ev_28718_67','UPDATE IGNORE `oltp129` SET `pad` = 47 ORDER BY `k` LIMIT 7','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:40','2020-05-18 08:20:40','2020-05-18 08:22:20','2020-05-18 08:20:40','2020-05-18 08:23:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp129` SET `pad` = 47 ORDER BY `k` LIMIT 7'),('test','ev_28718_68','UPDATE IGNORE `oltp156` SET `c` = NULL ORDER BY `c` LIMIT 7','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:41','2020-05-18 08:20:41','2020-05-18 08:22:34','2020-05-18 08:20:41','2020-05-18 08:22:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp156` SET `c` = NULL ORDER BY `c` LIMIT 7'),('test','ev_28714_68','START TRANSACTION','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:41','2020-05-18 08:20:41','2020-05-18 08:22:38','2020-05-18 08:20:41','2020-05-18 08:24:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION'),('test','ev_28716_81','SELECT * FROM (mysql.`innodb_table_stats` AS table1 INNER JOIN test.`oltp60` AS table2 ON ( table2.`pad` = table1.`n_rows` ) ) WHERE ( table1.`n_rows` != table2.`id` AND table1.`table_name` >= 5) LIMIT 1 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:20:41','2020-05-18 08:20:41','2020-05-18 08:22:46','2020-05-18 08:20:41','2020-05-18 08:24:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`innodb_table_stats` AS table1 INNER JOIN test.`oltp60` AS table2 ON ( table2.`pad` = table1.`n_rows` ) ) WHERE ( table1.`n_rows` != table2.`id` AND table1.`table_name` >= 5) LIMIT 1 ;'),('test','ev_28714_252','SELECT * FROM INFORMATION_SCHEMA.`CHECK_CONSTRAINTS` AS table1 WHERE NOT ( table1.`CONSTRAINT_CATALOG` < table1.`CONSTRAINT_NAME` OR table1.`TABLE_NAME` < 3) LIMIT 1','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:35','2020-05-18 08:22:35',NULL,'2020-05-18 08:22:35','2020-05-18 08:25:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`CHECK_CONSTRAINTS` AS table1 WHERE NOT ( table1.`CONSTRAINT_CATALOG` < table1.`CONSTRAINT_NAME` OR table1.`TABLE_NAME` < 3) LIMIT 1'),('test','ev_28716_83','SHOW ENGINES','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:42','2020-05-18 08:20:42','2020-05-18 08:22:54','2020-05-18 08:20:42','2020-05-18 08:24:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW ENGINES'),('test','ev_28718_70','UPDATE IGNORE `ROUTINES` SET `CHARACTER_OCTET_LENGTH` = \'agriculture\' ORDER BY `NUMERIC_PRECISION` LIMIT 4 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:42','2020-05-18 08:20:42','2020-05-18 08:22:41','2020-05-18 08:20:42','2020-05-18 08:24:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `ROUTINES` SET `CHARACTER_OCTET_LENGTH` = \'agriculture\' ORDER BY `NUMERIC_PRECISION` LIMIT 4 ;'),('test','ev_28714_288','REPLACE INTO `OPTIMIZER_TRACE` ( `TRACE`, _next_field ) VALUES ( \'beneath\', NULL ) ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:03','2020-05-18 08:23:03',NULL,'2020-05-18 08:23:03','2020-05-18 08:25:49','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `OPTIMIZER_TRACE` ( `TRACE`, ) VALUES ( \'beneath\', NULL ) ;'),('test','ev_28714_70','INSERT INTO `slow_log` SELECT * FROM `procs_priv`','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:42','2020-05-18 08:20:42','2020-05-18 08:22:37','2020-05-18 08:20:42','2020-05-18 08:24:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `slow_log` SELECT * FROM `procs_priv`'),('test','ev_28714_287','REPLACE INTO `help_category` ( `help_category_id` ) VALUES ( NULL ) ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:23:02','2020-05-18 08:23:02',NULL,'2020-05-18 08:23:02','2020-05-18 08:26:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `help_category` ( `help_category_id` ) VALUES ( NULL ) ;'),('test','ev_28718_71','SELECT `c` FROM `oltp160` ORDER BY `k` LIMIT 134','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:43','2020-05-18 08:20:43','2020-05-18 08:22:48','2020-05-18 08:20:43','2020-05-18 08:22:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `oltp160` ORDER BY `k` LIMIT 134'),('test','ev_28714_286','SHOW COUNT(*) WARNINGS','root@localhost',NULL,9,'SECOND','2020-05-18 08:23:02','2020-05-18 08:23:02',NULL,'2020-05-18 08:23:02','2020-05-18 08:23:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW COUNT(*) WARNINGS'),('test','ev_28716_101','INSERT INTO `t4_MyISAM` ( `id` ) VALUES ( DEFAULT ) ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:03','2020-05-18 08:21:03','2020-05-18 08:22:48','2020-05-18 08:21:03','2020-05-18 08:25:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `t4_MyISAM` ( `id` ) VALUES ( DEFAULT ) ;'),('test','ev_28716_249','UPDATE `INNODB_SYS_SEMAPHORE_WAITS` SET `THREAD_ID` = \'\' ORDER BY `WAIT_OBJECT` LIMIT 3','root@localhost',NULL,7,'SECOND','2020-05-18 08:23:02','2020-05-18 08:23:02',NULL,'2020-05-18 08:23:02','2020-05-18 08:26:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `INNODB_SYS_SEMAPHORE_WAITS` SET `THREAD_ID` = \'\' ORDER BY `WAIT_OBJECT` LIMIT 3'),('test','ev_28714_115','SHOW BINLOG EVENTS','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:03','2020-05-18 08:21:03','2020-05-18 08:22:48','2020-05-18 08:21:03','2020-05-18 08:25:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW BINLOG EVENTS'),('test','ev_28714_75','SELECT * FROM `KEY_COLUMN_USAGE` ORDER BY `CONSTRAINT_NAME` LIMIT 185 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:44','2020-05-18 08:20:44','2020-05-18 08:22:56','2020-05-18 08:20:44','2020-05-18 08:24:06','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `KEY_COLUMN_USAGE` ORDER BY `CONSTRAINT_NAME` LIMIT 185 ;'),('test','ev_28718_73','SHOW TRIGGERS','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:44','2020-05-18 08:20:44','2020-05-18 08:22:59','2020-05-18 08:20:44','2020-05-18 08:24:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW TRIGGERS'),('test','ev_28716_88','SELECT `db_name` FROM `general_log` ORDER BY `server_id` LIMIT 149','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:44','2020-05-18 08:20:44','2020-05-18 08:23:00','2020-05-18 08:20:44','2020-05-18 08:24:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `db_name` FROM `general_log` ORDER BY `server_id` LIMIT 149'),('test','ev_28714_218','START TRANSACTION ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:11','2020-05-18 08:22:11','2020-05-18 08:22:47','2020-05-18 08:22:11','2020-05-18 08:23:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION ;'),('test','ev_28718_74','UPDATE `index_stats` SET `table_name` = \'\' ORDER BY `avg_frequency` LIMIT 7','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:45','2020-05-18 08:20:45','2020-05-18 08:23:00','2020-05-18 08:20:45','2020-05-18 08:23:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `index_stats` SET `table_name` = \'\' ORDER BY `avg_frequency` LIMIT 7'),('test','ev_28716_90','CREATE UNIQUE INDEX ind3 ON ind_constr_t2 ( `id`(52) ) ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:45','2020-05-18 08:20:45','2020-05-18 08:23:05','2020-05-18 08:20:45','2020-05-18 08:24:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','CREATE UNIQUE INDEX ind3 ON ind_constr_t2 ( `id`(52) ) ;'),('test','ev_28716_91','REPLACE INTO `table_stats` ( `cardinality` ) VALUES ( DEFAULT )','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:45','2020-05-18 08:20:45','2020-05-18 08:22:56','2020-05-18 08:20:45','2020-05-18 08:24:31','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `table_stats` ( `cardinality` ) VALUES ( DEFAULT )'),('test','ev_28718_75','DELETE FROM `INNODB_FT_DEFAULT_STOPWORD` ORDER BY `value` LIMIT 6','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:46','2020-05-18 08:20:46','2020-05-18 08:22:58','2020-05-18 08:20:46','2020-05-18 08:23:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `INNODB_FT_DEFAULT_STOPWORD` ORDER BY `value` LIMIT 6'),('test','ev_28718_95','INSERT IGNORE INTO `oltp19` ( `c`, _next_field ) VALUES ( 86, \'contain\' )','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:02','2020-05-18 08:21:02','2020-05-18 08:23:04','2020-05-18 08:21:02','2020-05-18 08:23:21','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp19` ( `c`, ) VALUES ( 86, \'contain\' )'),('test','ev_28714_289','SELECT `col_int` FROM `oltp109` ORDER BY `c` LIMIT 29','root@localhost',NULL,3,'SECOND','2020-05-18 08:23:03','2020-05-18 08:23:03',NULL,'2020-05-18 08:23:03','2020-05-18 08:26:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `col_int` FROM `oltp109` ORDER BY `c` LIMIT 29'),('test','ev_28714_77','UPDATE IGNORE `proc` SET `specific_name` = \'\' ORDER BY `created` LIMIT 8','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:46','2020-05-18 08:20:46','2020-05-18 08:22:24','2020-05-18 08:20:46','2020-05-18 08:23:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `proc` SET `specific_name` = \'\' ORDER BY `created` LIMIT 8'),('test','ev_28718_76','UPDATE IGNORE `THREAD_POOL_STATS` SET `POLLS_BY_LISTENER` = \'\' ORDER BY `GROUP_ID` LIMIT 5','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:46','2020-05-18 08:20:46','2020-05-18 08:22:24','2020-05-18 08:20:46','2020-05-18 08:24:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `THREAD_POOL_STATS` SET `POLLS_BY_LISTENER` = \'\' ORDER BY `GROUP_ID` LIMIT 5'),('test','ev_28714_290','SELECT * FROM (mysql.`columns_priv` AS table1 RIGHT OUTER JOIN test.`oltp54` AS table2 ON ( table2.`c` = table1.`Host` ) ) WHERE table2.`c` > table1.`Column_priv` HAVING ( table1.`Column_name` >= \'ey\' OR table2.`c` <> \'y\') LIMIT 0','root@localhost',NULL,9,'SECOND','2020-05-18 08:23:03','2020-05-18 08:23:03',NULL,'2020-05-18 08:23:03','2020-05-18 08:24:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`columns_priv` AS table1 RIGHT OUTER JOIN test.`oltp54` AS table2 ON ( table2.`c` = table1.`Host` ) ) WHERE table2.`c` > table1.`Column_priv` HAVING ( table1.`Column_name` >= \'ey\' OR table2.`c` <> \'y\') LIMIT 0'),('test','ev_28714_78','REPLACE INTO `oltp33` () VALUES (),(),(),(),(),(),(),() ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:47','2020-05-18 08:20:47','2020-05-18 08:22:23','2020-05-18 08:20:47','2020-05-18 08:22:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp33` () VALUES (),(),(),(),(),(),(),() ;'),('test','ev_28714_246','UPDATE IGNORE `CHARACTER_SETS` SET `CHARACTER_SET_NAME` = \'\' ORDER BY `CHARACTER_SET_NAME` LIMIT 1','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:30','2020-05-18 08:22:30',NULL,'2020-05-18 08:22:30','2020-05-18 08:22:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `CHARACTER_SETS` SET `CHARACTER_SET_NAME` = \'\' ORDER BY `CHARACTER_SET_NAME` LIMIT 1'),('test','ev_28714_79','DELETE FROM `procs_priv` ORDER BY `Timestamp` LIMIT 8','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:48','2020-05-18 08:20:48','2020-05-18 08:22:28','2020-05-18 08:20:48','2020-05-18 08:23:21','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `procs_priv` ORDER BY `Timestamp` LIMIT 8'),('test','ev_28718_80','SHOW EXPLAIN FOR 253 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:48','2020-05-18 08:20:48','2020-05-18 08:22:24','2020-05-18 08:20:48','2020-05-18 08:22:30','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 253 ;'),('test','ev_28718_183','UPDATE IGNORE `tables_priv` SET `User` = \'round\' ORDER BY `Host` LIMIT 3','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:01','2020-05-18 08:22:22','2020-05-18 08:26:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `tables_priv` SET `User` = \'round\' ORDER BY `Host` LIMIT 3'),('test','ev_28716_199','SELECT * FROM `PROFILING` ORDER BY `BLOCK_OPS_OUT` LIMIT 144','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:03','2020-05-18 08:22:22','2020-05-18 08:26:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `PROFILING` ORDER BY `BLOCK_OPS_OUT` LIMIT 144'),('test','ev_28714_140','UPDATE IGNORE `oltp64` SET `c` = 197 ORDER BY `c` LIMIT 3','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:18','2020-05-18 08:21:18','2020-05-18 08:23:09','2020-05-18 08:21:18','2020-05-18 08:23:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp64` SET `c` = 197 ORDER BY `c` LIMIT 3'),('test','ev_28714_87','UPDATE IGNORE `plugin` SET `name` = \'\' ORDER BY `dl` LIMIT 1','root@localhost',NULL,3,'SECOND','2020-05-18 08:20:51','2020-05-18 08:20:51','2020-05-18 08:22:25','2020-05-18 08:20:51','2020-05-18 08:24:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `plugin` SET `name` = \'\' ORDER BY `dl` LIMIT 1'),('test','ev_28714_244','DELETE FROM `oltp146` ORDER BY `id` LIMIT 0','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:28','2020-05-18 08:22:28',NULL,'2020-05-18 08:22:28','2020-05-18 08:25:26','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp146` ORDER BY `id` LIMIT 0'),('test','ev_28714_93','UPDATE IGNORE `CLIENT_STATISTICS` SET `ROWS_DELETED` = 40 ORDER BY `ROWS_INSERTED` LIMIT 2','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:52','2020-05-18 08:20:52','2020-05-18 08:22:27','2020-05-18 08:20:52','2020-05-18 08:22:47','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `CLIENT_STATISTICS` SET `ROWS_DELETED` = 40 ORDER BY `ROWS_INSERTED` LIMIT 2'),('test','ev_28716_92','SELECT * FROM (test.`oltp147` AS table1 RIGHT OUTER JOIN mysql.`slow_log` AS table2 ON ( table2.`lock_time` = table1.`c` ) ) WHERE ( ( ( ( ( (NOT (NOT ( ( ( (NOT ( ( table1.`c` <= \'l\' OR table2.`db` >= 3) AND table1.`c` <> 1) OR table2.`last_insert_id` = table2.`rows_affected`) AND table1.`id` != \'e\') AND table1.`k` = 2) AND table2.`rows_examined` < \'2010-05-14 12:39:03.016386\') OR table2.`rows_examined` >= table2.`rows_sent`) OR table2.`rows_affected` <> table1.`c`) OR table2.`user_host` <= table2.`user_host`) OR table2.`rows_examined` <> \'1973-12-26 19:08:11.056914\') OR table1.`pad` >= \'1996-04-01 21:55:05.005559\') AND table1.`pad` <> \'1910-01-08 20:21:36.009380\') AND table1.`id` > table1.`pad`) HAVING ( ( ( ( ( table2.`rows_sent` > 5 AND table2.`thread_id` = \'2032-01-24 11:37:50.000518\') OR table1.`c` = \'ng\') OR table1.`id` < 0) OR table2.`lock_time` <> \'g\') OR table2.`start_time` <= \'1960-05-21 02:11:21.058354\') LIMIT 4','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:53','2020-05-18 08:20:53','2020-05-18 08:22:30','2020-05-18 08:20:53','2020-05-18 08:24:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp147` AS table1 RIGHT OUTER JOIN mysql.`slow_log` AS table2 ON ( table2.`lock_time` = table1.`c` ) ) WHERE ( ( ( ( ( (NOT (NOT ( ( ( (NOT ( ( table1.`c` <= \'l\' OR table2.`db` >= 3) AND table1.`c` <> 1) OR table2.`last_insert_id` = table2.`rows_affected`) AND table1.`id` != \'e\') AND table1.`k` = 2) AND table2.`rows_examined` < \'2010-05-14 12:39:03.016386\') OR table2.`rows_examined` >= table2.`rows_sent`) OR table2.`rows_affected` <> table1.`c`) OR table2.`user_host` <= table2.`user_host`) OR table2.`rows_examined` <> \'1973-12-26 19:08:11.056914\') OR table1.`pad` >= \'1996-04-01 21:55:05.005559\') AND table1.`pad` <> \'1910-01-08 20:21:36.009380\') AND table1.`id` > table1.`pad`) HAVING ( ( ( ( ( table2.`rows_sent` > 5 AND table2.`thread_id` = \'2032-01-24 11:37:50.000518\') OR table1.`c` = \'ng\') OR table1.`id` < 0) OR table2.`lock_time` <> \'g\') OR table2.`start_time` <= \'1960-05-21 02:11:21.058354\') LIMIT 4'),('test','ev_28716_211','DELETE FROM `oltp32` ORDER BY `c` LIMIT 6','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:29','2020-05-18 08:22:29',NULL,'2020-05-18 08:22:29','2020-05-18 08:23:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp32` ORDER BY `c` LIMIT 6'),('test','ev_28718_82','SHOW TABLE STATUS ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:53','2020-05-18 08:20:53','2020-05-18 08:22:31','2020-05-18 08:20:53','2020-05-18 08:23:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW TABLE STATUS ;'),('test','ev_28716_94','UPDATE IGNORE `innodb_index_stats` SET `last_update` = \'welfare\' ORDER BY `last_update` LIMIT 6','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:54','2020-05-18 08:20:54','2020-05-18 08:22:33','2020-05-18 08:20:54','2020-05-18 08:23:39','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `innodb_index_stats` SET `last_update` = \'welfare\' ORDER BY `last_update` LIMIT 6'),('test','ev_28718_83','REPLACE INTO `oltp161` () VALUES (),()','root@localhost',NULL,5,'SECOND','2020-05-18 08:20:54','2020-05-18 08:20:54','2020-05-18 08:22:33','2020-05-18 08:20:54','2020-05-18 08:24:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp161` () VALUES (),()'),('test','ev_28714_94','REPLACE INTO `SPATIAL_REF_SYS` ( `AUTH_NAME` ) VALUES ( \'flower\' ) ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:20:54','2020-05-18 08:20:54','2020-05-18 08:22:34','2020-05-18 08:20:54','2020-05-18 08:24:55','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `SPATIAL_REF_SYS` ( `AUTH_NAME` ) VALUES ( \'flower\' ) ;'),('test','ev_28714_253','ALTER TABLE IF EXISTS ind_constr_t1 ADD UNIQUE KEY ind9 ( b(63) ASC ), LOCK=DEFAULT ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:36','2020-05-18 08:22:36',NULL,'2020-05-18 08:22:36','2020-05-18 08:24:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','ALTER TABLE IF EXISTS ind_constr_t1 ADD UNIQUE KEY ind9 ( b(63) ASC ), LOCK=DEFAULT ;'),('test','ev_28714_96','SELECT `k` FROM `oltp38` ORDER BY `k` LIMIT 144','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:56','2020-05-18 08:20:56','2020-05-18 08:22:33','2020-05-18 08:20:56','2020-05-18 08:22:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `k` FROM `oltp38` ORDER BY `k` LIMIT 144'),('test','ev_28714_97','START TRANSACTION ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:20:57','2020-05-18 08:20:57','2020-05-18 08:22:34','2020-05-18 08:20:57','2020-05-18 08:22:56','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION ;'),('test','ev_28716_95','SELECT * FROM INFORMATION_SCHEMA.`INNODB_MUTEXES` AS table1 WHERE ( ( table1.`CREATE_FILE` = \'2031-03-15 18:29:24.029027\' OR table1.`OS_WAITS` <= \'u\') OR table1.`NAME` = 4) LIMIT 6 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:34','2020-05-18 08:20:58','2020-05-18 08:22:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`INNODB_MUTEXES` AS table1 WHERE ( ( table1.`CREATE_FILE` = \'2031-03-15 18:29:24.029027\' OR table1.`OS_WAITS` <= \'u\') OR table1.`NAME` = 4) LIMIT 6 ;'),('test','ev_28714_215','SELECT * FROM mysql.`help_keyword` AS table1 WHERE table1.`name` != table1.`help_keyword_id` LIMIT 9','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:10','2020-05-18 08:22:10','2020-05-18 08:22:45','2020-05-18 08:22:10','2020-05-18 08:26:23','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM mysql.`help_keyword` AS table1 WHERE table1.`name` != table1.`help_keyword_id` LIMIT 9'),('test','ev_28714_104','DELETE FROM `tables_priv` ORDER BY `Host` LIMIT 8 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:37','2020-05-18 08:20:58','2020-05-18 08:25:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `tables_priv` ORDER BY `Host` LIMIT 8 ;'),('test','ev_28718_87','SELECT `c` FROM `oltp86` ORDER BY `c` LIMIT 111 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:46','2020-05-18 08:20:58','2020-05-18 08:23:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `oltp86` ORDER BY `c` LIMIT 111 ;'),('test','ev_28714_107','UPDATE IGNORE `oltp115` SET `id` = 204 ORDER BY `pad` LIMIT 6 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:41','2020-05-18 08:20:58','2020-05-18 08:23:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp115` SET `id` = 204 ORDER BY `pad` LIMIT 6 ;'),('test','ev_28716_96','SELECT `c` FROM `oltp80` ORDER BY `pad` LIMIT 137 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:58','2020-05-18 08:20:58','2020-05-18 08:22:36','2020-05-18 08:20:58','2020-05-18 08:22:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `oltp80` ORDER BY `pad` LIMIT 137 ;'),('test','ev_28718_88','FLUSH NO_WRITE_TO_BINLOG QUERY CACHE','root@localhost',NULL,2,'SECOND','2020-05-18 08:20:59','2020-05-18 08:20:59','2020-05-18 08:22:35','2020-05-18 08:20:59','2020-05-18 08:25:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','FLUSH NO_WRITE_TO_BINLOG QUERY CACHE'),('test','ev_28718_208','DELETE FROM `table_stats` ORDER BY `db_name` LIMIT 5','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:45','2020-05-18 08:22:45',NULL,'2020-05-18 08:22:45','2020-05-18 08:23:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `table_stats` ORDER BY `db_name` LIMIT 5'),('test','ev_28718_154','SELECT * FROM `INNODB_CMP_PER_INDEX` ORDER BY `compress_ops` LIMIT 39','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:25:31','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `INNODB_CMP_PER_INDEX` ORDER BY `compress_ops` LIMIT 39'),('test','ev_28714_110','SELECT * FROM `global_priv` ORDER BY `User` LIMIT 75','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:00','2020-05-18 08:21:00','2020-05-18 08:22:36','2020-05-18 08:21:00','2020-05-18 08:25:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `global_priv` ORDER BY `User` LIMIT 75'),('test','ev_28714_112','SELECT * FROM (INFORMATION_SCHEMA.`THREAD_POOL_QUEUES` AS table1 INNER JOIN INFORMATION_SCHEMA.`CHECK_CONSTRAINTS` AS table2 ON ( table2.`CHECK_CLAUSE` = table1.`PRIORITY` ) ) WHERE table2.`CONSTRAINT_NAME` > table2.`CONSTRAINT_SCHEMA` LIMIT 1 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:00','2020-05-18 08:21:00','2020-05-18 08:22:35','2020-05-18 08:21:00','2020-05-18 08:24:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`THREAD_POOL_QUEUES` AS table1 INNER JOIN INFORMATION_SCHEMA.`CHECK_CONSTRAINTS` AS table2 ON ( table2.`CHECK_CLAUSE` = table1.`PRIORITY` ) ) WHERE table2.`CONSTRAINT_NAME` > table2.`CONSTRAINT_SCHEMA` LIMIT 1 ;'),('test','ev_28714_113','DELETE FROM `gtid_slave_pos` ORDER BY `seq_no` LIMIT 4','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:01','2020-05-18 08:21:01','2020-05-18 08:22:53','2020-05-18 08:21:01','2020-05-18 08:24:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `gtid_slave_pos` ORDER BY `seq_no` LIMIT 4'),('test','ev_28714_254','UPDATE IGNORE `KEY_COLUMN_USAGE` SET `TABLE_NAME` = 32 ORDER BY `REFERENCED_COLUMN_NAME` LIMIT 9','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:36','2020-05-18 08:22:36',NULL,'2020-05-18 08:22:36','2020-05-18 08:24:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `KEY_COLUMN_USAGE` SET `TABLE_NAME` = 32 ORDER BY `REFERENCED_COLUMN_NAME` LIMIT 9'),('test','ev_28716_98','UPDATE IGNORE `FILES` SET `DATA_LENGTH` = 192 ORDER BY `CREATION_TIME` LIMIT 7 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:01','2020-05-18 08:21:01','2020-05-18 08:22:38','2020-05-18 08:21:01','2020-05-18 08:23:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `FILES` SET `DATA_LENGTH` = 192 ORDER BY `CREATION_TIME` LIMIT 7 ;'),('test','ev_28718_180','SELECT * FROM `oltp58` INTO OUTFILE \'load_oltp58\' ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:17','2020-05-18 08:22:17','2020-05-18 08:22:56','2020-05-18 08:22:17','2020-05-18 08:23:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp58` INTO OUTFILE \'load_oltp58\' ;'),('test','ev_28718_96','SELECT * FROM (test.`oltp104` AS table1 RIGHT OUTER JOIN test.`oltp89` AS table2 ON ( table2.`k` = table1.`pad` ) ) WHERE (NOT (NOT ( ( (NOT table2.`pad` = table1.`c` AND table1.`c` <> \'1970-10-01 14:36:52.023873\') OR table1.`id` = table2.`pad`) OR table1.`c` >= table2.`c`) OR table1.`id` <> table2.`k`) AND table1.`c` != table2.`pad`) LIMIT 3 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:02','2020-05-18 08:21:02','2020-05-18 08:22:36','2020-05-18 08:21:02','2020-05-18 08:25:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp104` AS table1 RIGHT OUTER JOIN test.`oltp89` AS table2 ON ( table2.`k` = table1.`pad` ) ) WHERE (NOT (NOT ( ( (NOT table2.`pad` = table1.`c` AND table1.`c` <> \'1970-10-01 14:36:52.023873\') OR table1.`id` = table2.`pad`) OR table1.`c` >= table2.`c`) OR table1.`id` <> table2.`k`) AND table1.`c` != table2.`pad`) LIMIT 3 ;'),('test','ev_28718_209','SELECT * FROM `roles_mapping` ORDER BY `User` LIMIT 17','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:45','2020-05-18 08:22:45',NULL,'2020-05-18 08:22:45','2020-05-18 08:25:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `roles_mapping` ORDER BY `User` LIMIT 17'),('test','ev_28716_251','ALTER IGNORE TABLE IF EXISTS ind_constr_t2 ENABLE KEYS ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:23:06','2020-05-18 08:23:06',NULL,'2020-05-18 08:23:06','2020-05-18 08:24:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','ALTER IGNORE TABLE IF EXISTS ind_constr_t2 ENABLE KEYS ;'),('test','ev_28716_237','SHOW DATABASES ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:49','2020-05-18 08:22:49',NULL,'2020-05-18 08:22:49','2020-05-18 08:23:07','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW DATABASES ;'),('test','ev_28714_274','UPDATE `columns_priv` SET `User` = \'\' ORDER BY `User` LIMIT 6','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:48','2020-05-18 08:22:48',NULL,'2020-05-18 08:22:48','2020-05-18 08:24:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `columns_priv` SET `User` = \'\' ORDER BY `User` LIMIT 6'),('test','ev_28716_176','SHOW FUNCTION CODE a','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:17','2020-05-18 08:22:17','2020-05-18 08:22:56','2020-05-18 08:22:17','2020-05-18 08:24:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW FUNCTION CODE a'),('test','ev_28716_105','INSERT IGNORE INTO `time_zone_transition` () VALUES ()','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:03','2020-05-18 08:21:03','2020-05-18 08:23:01','2020-05-18 08:21:03','2020-05-18 08:23:55','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_transition` () VALUES ()'),('test','ev_28714_159','SELECT * FROM `TABLESPACES` INTO OUTFILE \'load_TABLESPACES\' ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:35','2020-05-18 08:21:35','2020-05-18 08:22:46','2020-05-18 08:21:35','2020-05-18 08:25:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `TABLESPACES` INTO OUTFILE \'load_TABLESPACES\' ;'),('test','ev_28714_116','DELETE FROM `oltp143` ORDER BY `pad` LIMIT 7','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:05','2020-05-18 08:21:05','2020-05-18 08:22:47','2020-05-18 08:21:05','2020-05-18 08:24:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp143` ORDER BY `pad` LIMIT 7'),('test','ev_28716_107','SELECT * FROM `oltp144` ORDER BY `c` LIMIT 88','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:05','2020-05-18 08:21:05','2020-05-18 08:23:09','2020-05-18 08:21:05','2020-05-18 08:24:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp144` ORDER BY `c` LIMIT 88'),('test','ev_28718_100','UPDATE `oltp20` SET `c` = 76 ORDER BY `pad` LIMIT 7','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:05','2020-05-18 08:21:05','2020-05-18 08:22:48','2020-05-18 08:21:05','2020-05-18 08:23:53','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `oltp20` SET `c` = 76 ORDER BY `pad` LIMIT 7'),('test','ev_28714_120','SHOW OPEN TABLES ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:06','2020-05-18 08:21:06','2020-05-18 08:22:57','2020-05-18 08:21:06','2020-05-18 08:23:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW OPEN TABLES ;'),('test','ev_28714_121','SELECT * FROM (INFORMATION_SCHEMA.`GLOBAL_STATUS` AS table1 RIGHT OUTER JOIN test.`oltp145` AS table2 ON ( table2.`c` = table1.`VARIABLE_NAME` ) ) WHERE ( ( ( ( table1.`VARIABLE_VALUE` >= 3 OR table1.`VARIABLE_VALUE` != 4) AND table2.`id` <= table1.`VARIABLE_VALUE`) OR table2.`pad` != table1.`VARIABLE_VALUE`) OR table1.`VARIABLE_NAME` < table1.`VARIABLE_VALUE`) HAVING (table2.`pad` < 1 IS NOT NULL OR table1.`VARIABLE_VALUE` = \'t\') LIMIT 9','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:06','2020-05-18 08:21:06','2020-05-18 08:22:19','2020-05-18 08:21:06','2020-05-18 08:25:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`GLOBAL_STATUS` AS table1 RIGHT OUTER JOIN test.`oltp145` AS table2 ON ( table2.`c` = table1.`VARIABLE_NAME` ) ) WHERE ( ( ( ( table1.`VARIABLE_VALUE` >= 3 OR table1.`VARIABLE_VALUE` != 4) AND table2.`id` <= table1.`VARIABLE_VALUE`) OR table2.`pad` != table1.`VARIABLE_VALUE`) OR table1.`VARIABLE_NAME` < table1.`VARIABLE_VALUE`) HAVING (table2.`pad` < 1 IS NOT NULL OR table1.`VARIABLE_VALUE` = \'t\') LIMIT 9'),('test','ev_28714_224','INSERT IGNORE INTO `INNODB_FT_INDEX_TABLE` ( `DOC_ID`, _next_field ) VALUES ( \'love\', \'r\' )','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:15','2020-05-18 08:22:15','2020-05-18 08:22:54','2020-05-18 08:22:15','2020-05-18 08:24:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `INNODB_FT_INDEX_TABLE` ( `DOC_ID`, ) VALUES ( \'love\', \'r\' )'),('test','ev_28714_123','UPDATE IGNORE `REFERENTIAL_CONSTRAINTS` SET `REFERENCED_TABLE_NAME` = DEFAULT ORDER BY `UNIQUE_CONSTRAINT_NAME` LIMIT 4','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:07','2020-05-18 08:21:07','2020-05-18 08:23:05','2020-05-18 08:21:07','2020-05-18 08:23:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `REFERENTIAL_CONSTRAINTS` SET `REFERENCED_TABLE_NAME` = DEFAULT ORDER BY `UNIQUE_CONSTRAINT_NAME` LIMIT 4'),('test','ev_28714_294','UPDATE IGNORE `oltp136` SET `c` = DEFAULT ORDER BY `pad` LIMIT 2','root@localhost',NULL,6,'SECOND','2020-05-18 08:23:08','2020-05-18 08:23:08',NULL,'2020-05-18 08:23:08','2020-05-18 08:26:39','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp136` SET `c` = DEFAULT ORDER BY `pad` LIMIT 2'),('test','ev_28716_252','REPLACE INTO `servers` ( `Socket`, _next_field ) VALUES ( \'i\', DEFAULT )','root@localhost',NULL,8,'SECOND','2020-05-18 08:23:07','2020-05-18 08:23:07',NULL,'2020-05-18 08:23:07','2020-05-18 08:25:35','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `servers` ( `Socket`, ) VALUES ( \'i\', DEFAULT )'),('test','ev_28718_226','DELETE FROM `INNODB_SYS_VIRTUAL` ORDER BY `TABLE_ID` LIMIT 3','root@localhost',NULL,9,'SECOND','2020-05-18 08:23:08','2020-05-18 08:23:08',NULL,'2020-05-18 08:23:08','2020-05-18 08:24:06','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `INNODB_SYS_VIRTUAL` ORDER BY `TABLE_ID` LIMIT 3'),('test','ev_28716_254','DROP INDEX IF EXISTS ind1 ON `oltp148`','root@localhost',NULL,5,'SECOND','2020-05-18 08:23:08','2020-05-18 08:23:08',NULL,'2020-05-18 08:23:08','2020-05-18 08:23:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DROP INDEX IF EXISTS ind1 ON `oltp148`'),('test','ev_28716_244','SHOW CREATE FUNCTION b','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:55','2020-05-18 08:22:55',NULL,'2020-05-18 08:22:55','2020-05-18 08:25:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW CREATE FUNCTION b'),('test','ev_28714_126','SELECT `User` FROM `time_zone_leap_second` ORDER BY `Transition_time` LIMIT 212','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:08','2020-05-18 08:21:08','2020-05-18 08:22:20','2020-05-18 08:21:08','2020-05-18 08:25:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `User` FROM `time_zone_leap_second` ORDER BY `Transition_time` LIMIT 212'),('test','ev_28714_127','SELECT * FROM `INNODB_SYS_COLUMNS` INTO OUTFILE \'load_INNODB_SYS_COLUMNS\' ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:08','2020-05-18 08:21:08','2020-05-18 08:22:59','2020-05-18 08:21:08','2020-05-18 08:24:47','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `INNODB_SYS_COLUMNS` INTO OUTFILE \'load_INNODB_SYS_COLUMNS\' ;'),('test','ev_28716_112','SHOW CREATE TABLE y','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:08','2020-05-18 08:21:08','2020-05-18 08:22:59','2020-05-18 08:21:08','2020-05-18 08:23:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW CREATE TABLE y'),('test','ev_28714_128','SHOW EXPLAIN FOR 104','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:09','2020-05-18 08:21:09','2020-05-18 08:22:58','2020-05-18 08:21:09','2020-05-18 08:25:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 104'),('test','ev_28716_196','SELECT * FROM `proc` ORDER BY `body` LIMIT 12','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:02','2020-05-18 08:22:22','2020-05-18 08:24:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `proc` ORDER BY `body` LIMIT 12'),('test','ev_28718_125','UPDATE IGNORE `THREAD_POOL_STATS` SET `THREAD_CREATIONS_DUE_TO_STALL` = 122 ORDER BY `POLLS_BY_WORKER` LIMIT 4 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:40','2020-05-18 08:21:40','2020-05-18 08:23:01','2020-05-18 08:21:40','2020-05-18 08:24:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `THREAD_POOL_STATS` SET `THREAD_CREATIONS_DUE_TO_STALL` = 122 ORDER BY `POLLS_BY_WORKER` LIMIT 4 ;'),('test','ev_28716_114','UPDATE IGNORE `global_priv` SET `Host` = NULL ORDER BY `Priv` LIMIT 8','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:11','2020-05-18 08:21:11','2020-05-18 08:22:22','2020-05-18 08:21:11','2020-05-18 08:22:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `global_priv` SET `Host` = NULL ORDER BY `Priv` LIMIT 8'),('test','ev_28714_132','/* compatibility 10.4.3 */ CREATE OR REPLACE TABLE ind_constr_t4 (f VARBINARY(1025), b LONGTEXT, UNIQUE(b)) AS SELECT /* `transaction_registry` */ `isolation_level`, `commit_id` FROM `time_zone`','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:11','2020-05-18 08:21:11','2020-05-18 08:22:59','2020-05-18 08:21:11','2020-05-18 08:23:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','/* compatibility 10.4.3 */ CREATE OR REPLACE TABLE ind_constr_t4 (f VARBINARY(1025), b LONGTEXT, UNIQUE(b)) AS SELECT /* `transaction_registry` */ `isolation_level`, `commit_id` FROM `time_zone`'),('test','ev_28718_229','UPDATE IGNORE `COLUMN_PRIVILEGES` SET `COLUMN_NAME` = \'\' ORDER BY `TABLE_CATALOG` LIMIT 8 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:23:09','2020-05-18 08:23:09',NULL,'2020-05-18 08:23:09','2020-05-18 08:23:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `COLUMN_PRIVILEGES` SET `COLUMN_NAME` = \'\' ORDER BY `TABLE_CATALOG` LIMIT 8 ;'),('test','ev_28714_232','FLUSH PRIVILEGES, PRIVILEGES, LOGS ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:57','2020-05-18 08:22:19','2020-05-18 08:23:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','FLUSH PRIVILEGES, PRIVILEGES, LOGS ;'),('test','ev_28714_138','SELECT * FROM `innodb_table_stats` ORDER BY `clustered_index_size` LIMIT 59 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:15','2020-05-18 08:21:15','2020-05-18 08:22:25','2020-05-18 08:21:15','2020-05-18 08:24:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `innodb_table_stats` ORDER BY `clustered_index_size` LIMIT 59 ;'),('test','ev_28718_126','UPDATE IGNORE `STATISTICS` SET `CARDINALITY` = 47 ORDER BY `COLUMN_NAME` LIMIT 3 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:41','2020-05-18 08:21:41','2020-05-18 08:22:58','2020-05-18 08:21:41','2020-05-18 08:25:52','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `STATISTICS` SET `CARDINALITY` = 47 ORDER BY `COLUMN_NAME` LIMIT 3 ;'),('test','ev_28718_228','REPLACE INTO `db` ( `Select_priv` ) VALUES ( DEFAULT )','root@localhost',NULL,1,'SECOND','2020-05-18 08:23:09','2020-05-18 08:23:09',NULL,'2020-05-18 08:23:09','2020-05-18 08:24:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `db` ( `Select_priv` ) VALUES ( DEFAULT )'),('test','ev_28714_295','SELECT * FROM `time_zone_transition_type` ORDER BY `Transition_type_id` LIMIT 237','root@localhost',NULL,9,'SECOND','2020-05-18 08:23:10','2020-05-18 08:23:10',NULL,'2020-05-18 08:23:10','2020-05-18 08:23:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `time_zone_transition_type` ORDER BY `Transition_type_id` LIMIT 237'),('test','ev_28714_141','SELECT * FROM (mysql.`time_zone_transition` AS table1 RIGHT OUTER JOIN INFORMATION_SCHEMA.`INNODB_SYS_FOREIGN_COLS` AS table2 ON ( table2.`FOR_COL_NAME` = table1.`Transition_time` ) ) WHERE table1.`Transition_time` != 5 HAVING table1.`Transition_type_id` > \'1910-11-02 04:07:10.013374\' IS NOT NULL LIMIT 3 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:18','2020-05-18 08:21:18','2020-05-18 08:22:29','2020-05-18 08:21:18','2020-05-18 08:22:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (mysql.`time_zone_transition` AS table1 RIGHT OUTER JOIN INFORMATION_SCHEMA.`INNODB_SYS_FOREIGN_COLS` AS table2 ON ( table2.`FOR_COL_NAME` = table1.`Transition_time` ) ) WHERE table1.`Transition_time` != 5 HAVING table1.`Transition_type_id` > \'1910-11-02 04:07:10.013374\' IS NOT NULL LIMIT 3 ;'),('test','ev_28718_202','SHOW EXPLAIN FOR 14','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:40','2020-05-18 08:22:40',NULL,'2020-05-18 08:22:40','2020-05-18 08:24:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 14'),('test','ev_28718_188','SELECT `c` FROM `t3_InnoDB` ORDER BY `id` LIMIT 193','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:25','2020-05-18 08:22:25','2020-05-18 08:23:08','2020-05-18 08:22:25','2020-05-18 08:25:40','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `c` FROM `t3_InnoDB` ORDER BY `id` LIMIT 193'),('test','ev_28718_103','UPDATE `INNODB_CMP` SET `page_size` = \'z\' ORDER BY `compress_ops` LIMIT 3','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:18','2020-05-18 08:21:18','2020-05-18 08:23:10','2020-05-18 08:21:18','2020-05-18 08:23:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE `INNODB_CMP` SET `page_size` = \'z\' ORDER BY `compress_ops` LIMIT 3'),('test','ev_28714_143','SELECT `user_host` FROM `transaction_registry` ORDER BY `begin_timestamp` LIMIT 187','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:19','2020-05-18 08:21:19','2020-05-18 08:22:25','2020-05-18 08:21:19','2020-05-18 08:23:53','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `user_host` FROM `transaction_registry` ORDER BY `begin_timestamp` LIMIT 187'),('test','ev_28718_104','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_FT_BEING_DELETED` AS table1 LEFT JOIN INFORMATION_SCHEMA.`TABLE_STATISTICS` AS table2 ON ( table2.`TABLE_NAME` = table1.`DOC_ID` ) ) WHERE table1.`DOC_ID` != table2.`TABLE_NAME` LIMIT 2 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:19','2020-05-18 08:21:19','2020-05-18 08:23:06','2020-05-18 08:21:19','2020-05-18 08:24:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_FT_BEING_DELETED` AS table1 LEFT JOIN INFORMATION_SCHEMA.`TABLE_STATISTICS` AS table2 ON ( table2.`TABLE_NAME` = table1.`DOC_ID` ) ) WHERE table1.`DOC_ID` != table2.`TABLE_NAME` LIMIT 2 ;'),('test','ev_28718_105','REPLACE INTO `INNODB_SYS_FIELDS` ( `POS` ) VALUES ( \'\' ) ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:19','2020-05-18 08:21:19','2020-05-18 08:23:05','2020-05-18 08:21:19','2020-05-18 08:24:35','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `INNODB_SYS_FIELDS` ( `POS` ) VALUES ( \'\' ) ;'),('test','ev_28714_144','SELECT `pad` FROM `t4_InnoDB` ORDER BY `col_varchar` LIMIT 122','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:19','2020-05-18 08:21:19','2020-05-18 08:22:24','2020-05-18 08:21:19','2020-05-18 08:24:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `pad` FROM `t4_InnoDB` ORDER BY `col_varchar` LIMIT 122'),('test','ev_28716_146','SELECT * FROM (INFORMATION_SCHEMA.`OPTIMIZER_TRACE` AS table1 INNER JOIN INFORMATION_SCHEMA.`TRIGGERS` AS table2 ON ( table2.`COLLATION_CONNECTION` = table1.`QUERY` ) ) WHERE ( table1.`INSUFFICIENT_PRIVILEGES` >= table2.`ACTION_REFERENCE_NEW_TABLE` AND table1.`TRACE` <= table1.`QUERY`) HAVING table2.`TRIGGER_CATALOG` >= 7 LIMIT 1','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:51','2020-05-18 08:21:51','2020-05-18 08:22:25','2020-05-18 08:21:51','2020-05-18 08:25:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`OPTIMIZER_TRACE` AS table1 INNER JOIN INFORMATION_SCHEMA.`TRIGGERS` AS table2 ON ( table2.`COLLATION_CONNECTION` = table1.`QUERY` ) ) WHERE ( table1.`INSUFFICIENT_PRIVILEGES` >= table2.`ACTION_REFERENCE_NEW_TABLE` AND table1.`TRACE` <= table1.`QUERY`) HAVING table2.`TRIGGER_CATALOG` >= 7 LIMIT 1'),('test','ev_28718_107','UPDATE IGNORE `column_stats` SET `nulls_ratio` = \'entrepreneur\' ORDER BY `hist_size` LIMIT 9','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:21','2020-05-18 08:21:21','2020-05-18 08:22:32','2020-05-18 08:21:21','2020-05-18 08:24:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `column_stats` SET `nulls_ratio` = \'entrepreneur\' ORDER BY `hist_size` LIMIT 9'),('test','ev_28716_116','SELECT * FROM (INFORMATION_SCHEMA.`user_variables` AS table1 LEFT JOIN test.`oltp110` AS table2 ON ( table2.`c` = table1.`VARIABLE_NAME` ) ) WHERE ( table1.`VARIABLE_TYPE` != table1.`CHARACTER_SET_NAME` AND table1.`CHARACTER_SET_NAME` >= table1.`VARIABLE_NAME`) HAVING table1.`VARIABLE_VALUE` != \'i\' IS NULL LIMIT 4 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:22','2020-05-18 08:21:22','2020-05-18 08:22:32','2020-05-18 08:21:22','2020-05-18 08:24:21','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`user_variables` AS table1 LEFT JOIN test.`oltp110` AS table2 ON ( table2.`c` = table1.`VARIABLE_NAME` ) ) WHERE ( table1.`VARIABLE_TYPE` != table1.`CHARACTER_SET_NAME` AND table1.`CHARACTER_SET_NAME` >= table1.`VARIABLE_NAME`) HAVING table1.`VARIABLE_VALUE` != \'i\' IS NULL LIMIT 4 ;'),('test','ev_28716_157','DELETE FROM `time_zone` ORDER BY `Use_leap_seconds` LIMIT 2','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:25:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `time_zone` ORDER BY `Use_leap_seconds` LIMIT 2'),('test','ev_28714_147','SELECT `id` FROM `oltp157` ORDER BY `c` LIMIT 112','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:23','2020-05-18 08:21:23','2020-05-18 08:22:31','2020-05-18 08:21:23','2020-05-18 08:24:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp157` ORDER BY `c` LIMIT 112'),('test','ev_28718_109','SELECT `Transition_time` FROM `time_zone_transition` ORDER BY `Transition_time` LIMIT 120 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:24','2020-05-18 08:21:24','2020-05-18 08:22:33','2020-05-18 08:21:24','2020-05-18 08:22:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Transition_time` FROM `time_zone_transition` ORDER BY `Transition_time` LIMIT 120 ;'),('test','ev_28716_120','SELECT * FROM `procs_priv` ORDER BY `Timestamp` LIMIT 104 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:24','2020-05-18 08:21:24','2020-05-18 08:22:32','2020-05-18 08:21:24','2020-05-18 08:25:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `procs_priv` ORDER BY `Timestamp` LIMIT 104 ;'),('test','ev_28714_148','SELECT * FROM `innodb_index_stats` ORDER BY `index_name` LIMIT 226 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:26','2020-05-18 08:21:26','2020-05-18 08:22:38','2020-05-18 08:21:26','2020-05-18 08:23:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `innodb_index_stats` ORDER BY `index_name` LIMIT 226 ;'),('test','n','SET @a=@a','root@localhost','2020-05-18 08:22:36',NULL,NULL,'2020-05-18 08:22:36','2020-05-18 08:22:36',NULL,NULL,NULL,'ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SET @a=@a'),('test','ev_28716_156','SHOW FUNCTION STATUS','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:02','2020-05-18 08:22:02','2020-05-18 08:22:34','2020-05-18 08:22:02','2020-05-18 08:23:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW FUNCTION STATUS'),('test','ev_28716_123','SELECT * FROM `servers` ORDER BY `Owner` LIMIT 133 ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:34','2020-05-18 08:21:29','2020-05-18 08:25:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `servers` ORDER BY `Owner` LIMIT 133 ;'),('test','ev_28718_112','UPDATE IGNORE `t9_InnoDB` SET `col_int` = \'t\' ORDER BY `col_blob` LIMIT 9','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:29','2020-05-18 08:21:29','2020-05-18 08:22:34','2020-05-18 08:21:29','2020-05-18 08:24:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `t9_InnoDB` SET `col_int` = \'t\' ORDER BY `col_blob` LIMIT 9'),('test','ev_28714_242','SELECT * FROM `t4_MyISAM` ORDER BY `col_enum` LIMIT 43','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:25','2020-05-18 08:22:25','2020-05-18 08:23:08','2020-05-18 08:22:25','2020-05-18 08:26:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `t4_MyISAM` ORDER BY `col_enum` LIMIT 43'),('test','ev_28716_220','SELECT * FROM `oltp115` ORDER BY `pad` LIMIT 55','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:37','2020-05-18 08:22:37',NULL,'2020-05-18 08:22:37','2020-05-18 08:23:21','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp115` ORDER BY `pad` LIMIT 55'),('test','ev_28714_153','UPDATE IGNORE `SYSTEM_VARIABLES` SET `NUMERIC_MIN_VALUE` = \'y\' ORDER BY `NUMERIC_MAX_VALUE` LIMIT 3 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:30','2020-05-18 08:21:30','2020-05-18 08:22:37','2020-05-18 08:21:30','2020-05-18 08:23:39','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `SYSTEM_VARIABLES` SET `NUMERIC_MIN_VALUE` = \'y\' ORDER BY `NUMERIC_MAX_VALUE` LIMIT 3 ;'),('test','ev_28714_154','DELETE FROM `oltp118` ORDER BY `pad` LIMIT 9','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:30','2020-05-18 08:21:30','2020-05-18 08:22:35','2020-05-18 08:21:30','2020-05-18 08:22:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `oltp118` ORDER BY `pad` LIMIT 9'),('test','ev_28718_116','SELECT `pad` FROM `oltp30` ORDER BY `id` LIMIT 130','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:30','2020-05-18 08:21:30','2020-05-18 08:22:39','2020-05-18 08:21:30','2020-05-18 08:23:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `pad` FROM `oltp30` ORDER BY `id` LIMIT 130'),('test','ev_28714_157','SELECT * FROM `innodb_table_stats` ORDER BY `clustered_index_size` LIMIT 141','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:31','2020-05-18 08:21:31','2020-05-18 08:22:38','2020-05-18 08:21:31','2020-05-18 08:24:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `innodb_table_stats` ORDER BY `clustered_index_size` LIMIT 141'),('test','ev_28716_125','START TRANSACTION ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:31','2020-05-18 08:21:31','2020-05-18 08:22:35','2020-05-18 08:21:31','2020-05-18 08:23:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','START TRANSACTION ;'),('test','ev_28714_158','UPDATE IGNORE `oltp132` SET `id` = DEFAULT ORDER BY `c` LIMIT 6','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:31','2020-05-18 08:21:31','2020-05-18 08:22:36','2020-05-18 08:21:31','2020-05-18 08:24:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp132` SET `id` = DEFAULT ORDER BY `c` LIMIT 6'),('test','ev_28716_126','DELETE FROM `slow_log` ORDER BY `insert_id` LIMIT 3','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:32','2020-05-18 08:21:32','2020-05-18 08:22:37','2020-05-18 08:21:32','2020-05-18 08:25:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `slow_log` ORDER BY `insert_id` LIMIT 3'),('test','ev_28716_127','DELETE FROM `COLUMN_PRIVILEGES` ORDER BY `TABLE_NAME` LIMIT 4 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:35','2020-05-18 08:21:35','2020-05-18 08:22:42','2020-05-18 08:21:35','2020-05-18 08:24:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `COLUMN_PRIVILEGES` ORDER BY `TABLE_NAME` LIMIT 4 ;'),('test','ev_28718_120','ALTER IGNORE TABLE `time_zone_transition_type` ADD INDEX IF NOT EXISTS l USING BTREE ( e, y, `Is_DST` ) KEY_BLOCK_SIZE = 17980, ORDER BY `Is_DST` ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:35','2020-05-18 08:21:35','2020-05-18 08:22:47','2020-05-18 08:21:35','2020-05-18 08:25:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','ALTER IGNORE TABLE `time_zone_transition_type` ADD INDEX IF NOT EXISTS l USING BTREE ( e, y, `Is_DST` ) KEY_BLOCK_SIZE = 17980, ORDER BY `Is_DST` ;'),('test','ev_28714_160','UPDATE IGNORE `APPLICABLE_ROLES` SET `IS_DEFAULT` = DEFAULT ORDER BY `GRANTEE` LIMIT 4','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:35','2020-05-18 08:21:35','2020-05-18 08:22:46','2020-05-18 08:21:35','2020-05-18 08:23:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `APPLICABLE_ROLES` SET `IS_DEFAULT` = DEFAULT ORDER BY `GRANTEE` LIMIT 4'),('test','ev_28716_128','SELECT * FROM `time_zone_transition_type` ORDER BY `Is_DST` LIMIT 175 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:35','2020-05-18 08:21:35','2020-05-18 08:22:47','2020-05-18 08:21:35','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `time_zone_transition_type` ORDER BY `Is_DST` LIMIT 175 ;'),('test','ev_28718_121','UPDATE IGNORE `db` SET `References_priv` = DEFAULT ORDER BY `Host` LIMIT 3 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:36','2020-05-18 08:21:36','2020-05-18 08:22:57','2020-05-18 08:21:36','2020-05-18 08:25:22','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `db` SET `References_priv` = DEFAULT ORDER BY `Host` LIMIT 3 ;'),('test','ev_28716_129','REPLACE INTO `event` ( `body_utf8`, _next_field ) VALUES ( DEFAULT, DEFAULT )','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:36','2020-05-18 08:21:36','2020-05-18 08:22:50','2020-05-18 08:21:36','2020-05-18 08:25:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `event` ( `body_utf8`, ) VALUES ( DEFAULT, DEFAULT )'),('test','ev_28718_175','INSERT IGNORE INTO `oltp77` ( `k`, _next_field ) VALUES ( \'o\', NULL )','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:12','2020-05-18 08:22:12','2020-05-18 08:22:49','2020-05-18 08:22:12','2020-05-18 08:23:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp77` ( `k`, ) VALUES ( \'o\', NULL )'),('test','ev_28716_242','UPDATE IGNORE `oltp104` SET `id` = 16 ORDER BY `k` LIMIT 5 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:52','2020-05-18 08:22:52',NULL,'2020-05-18 08:22:52','2020-05-18 08:26:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp104` SET `id` = 16 ORDER BY `k` LIMIT 5 ;'),('test','ev_28718_122','COMMIT','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:37','2020-05-18 08:21:37','2020-05-18 08:22:50','2020-05-18 08:21:37','2020-05-18 08:23:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28716_167','UPDATE IGNORE `time_zone` SET `Time_zone_id` = 194 ORDER BY `Use_leap_seconds` LIMIT 1','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:13','2020-05-18 08:22:13','2020-05-18 08:22:52','2020-05-18 08:22:13','2020-05-18 08:26:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `time_zone` SET `Time_zone_id` = 194 ORDER BY `Use_leap_seconds` LIMIT 1'),('test','ev_28714_164','DELETE FROM `INNODB_CMP` ORDER BY `compress_time` LIMIT 0 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:38','2020-05-18 08:21:38','2020-05-18 08:22:55','2020-05-18 08:21:38','2020-05-18 08:23:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `INNODB_CMP` ORDER BY `compress_time` LIMIT 0 ;'),('test','ev_28718_124','SELECT * FROM (INFORMATION_SCHEMA.`SYSTEM_VARIABLES` AS table1 RIGHT OUTER JOIN mysql.`servers` AS table2 ON ( table2.`Owner` = table1.`VARIABLE_NAME` ) ) WHERE table2.`Host` < table2.`Wrapper` LIMIT 8','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:38','2020-05-18 08:21:38','2020-05-18 08:22:55','2020-05-18 08:21:38','2020-05-18 08:23:17','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`SYSTEM_VARIABLES` AS table1 RIGHT OUTER JOIN mysql.`servers` AS table2 ON ( table2.`Owner` = table1.`VARIABLE_NAME` ) ) WHERE table2.`Host` < table2.`Wrapper` LIMIT 8'),('test','ev_28714_165','REPLACE INTO `PLUGINS` ( `PLUGIN_TYPE`, _next_field ) VALUES ( DEFAULT, \'revelation\' )','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:38','2020-05-18 08:21:38','2020-05-18 08:23:03','2020-05-18 08:21:38','2020-05-18 08:23:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `PLUGINS` ( `PLUGIN_TYPE`, ) VALUES ( DEFAULT, \'revelation\' )'),('test','ev_28714_166','SELECT `Time_zone_id` FROM `procs_priv` ORDER BY `Host` LIMIT 205 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:38','2020-05-18 08:21:38','2020-05-18 08:23:03','2020-05-18 08:21:38','2020-05-18 08:23:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Time_zone_id` FROM `procs_priv` ORDER BY `Host` LIMIT 205 ;'),('test','ev_28714_169','SELECT * FROM (test.`oltp121` AS table1 STRAIGHT_JOIN test.`oltp82` AS table2 ON ( table2.`pad` = table1.`c` ) ) WHERE ( table2.`pad` <> 5 AND table2.`k` <> \'1924-04-05 09:22:15.045927\') LIMIT 2','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:39','2020-05-18 08:21:39','2020-05-18 08:23:01','2020-05-18 08:21:39','2020-05-18 08:25:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp121` AS table1 STRAIGHT_JOIN test.`oltp82` AS table2 ON ( table2.`pad` = table1.`c` ) ) WHERE ( table2.`pad` <> 5 AND table2.`k` <> \'1924-04-05 09:22:15.045927\') LIMIT 2'),('test','ev_28718_127','REPLACE INTO `ROUTINES` ( `PARAMETER_STYLE` ) VALUES ( DEFAULT )','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:41','2020-05-18 08:21:41','2020-05-18 08:22:59','2020-05-18 08:21:41','2020-05-18 08:24:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `ROUTINES` ( `PARAMETER_STYLE` ) VALUES ( DEFAULT )'),('test','ev_28714_277','CREATE OR REPLACE UNIQUE INDEX q ON `time_zone_transition_type` ( `Is_DST` ) ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:50','2020-05-18 08:22:50',NULL,'2020-05-18 08:22:50','2020-05-18 08:26:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','CREATE OR REPLACE UNIQUE INDEX q ON `time_zone_transition_type` ( `Is_DST` ) ;'),('test','ev_28714_220','SELECT * FROM test.`oltp77` AS table1 WHERE table1.`k` <= \'1988-09-14 14:55:53.056462\' LIMIT 8 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:13','2020-05-18 08:22:13','2020-05-18 08:22:52','2020-05-18 08:22:13','2020-05-18 08:25:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp77` AS table1 WHERE table1.`k` <= \'1988-09-14 14:55:53.056462\' LIMIT 8 ;'),('test','ev_28718_128','SELECT * FROM `t2_Aria` ORDER BY `col_int` LIMIT 223 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:42','2020-05-18 08:21:42','2020-05-18 08:23:01','2020-05-18 08:21:42','2020-05-18 08:24:44','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `t2_Aria` ORDER BY `col_int` LIMIT 223 ;'),('test','ev_28718_130','INSERT INTO `proc` ( `security_type` ) VALUES ( \'\' ) ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:42','2020-05-18 08:21:42','2020-05-18 08:23:03','2020-05-18 08:21:42','2020-05-18 08:24:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `proc` ( `security_type` ) VALUES ( \'\' ) ;'),('test','ev_28714_173','REPLACE INTO `THREAD_POOL_GROUPS` ( `IS_STALLED`, _next_field ) VALUES ( \'champion\', NULL ) ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:43','2020-05-18 08:21:43','2020-05-18 08:23:02','2020-05-18 08:21:43','2020-05-18 08:24:45','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `THREAD_POOL_GROUPS` ( `IS_STALLED`, ) VALUES ( \'champion\', NULL ) ;'),('test','ev_28716_130','DROP INDEX IF EXISTS ind3 ON `COLUMN_PRIVILEGES`','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:43','2020-05-18 08:21:43','2020-05-18 08:23:03','2020-05-18 08:21:43','2020-05-18 08:24:26','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DROP INDEX IF EXISTS ind3 ON `COLUMN_PRIVILEGES`'),('test','ev_28714_174','DELETE FROM `PROFILING` ORDER BY `CONTEXT_VOLUNTARY` LIMIT 5 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:43','2020-05-18 08:21:43','2020-05-18 08:23:04','2020-05-18 08:21:43','2020-05-18 08:24:04','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `PROFILING` ORDER BY `CONTEXT_VOLUNTARY` LIMIT 5 ;'),('test','ev_28714_234','SELECT `k` FROM `oltp44` ORDER BY `k` LIMIT 83','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:58','2020-05-18 08:22:19','2020-05-18 08:23:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `k` FROM `oltp44` ORDER BY `k` LIMIT 83'),('test','ev_28718_131','UPDATE IGNORE `servers` SET `Owner` = NULL ORDER BY `Socket` LIMIT 1','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:43','2020-05-18 08:21:43','2020-05-18 08:23:06','2020-05-18 08:21:43','2020-05-18 08:23:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `servers` SET `Owner` = NULL ORDER BY `Socket` LIMIT 1'),('test','ev_28716_198','REPLACE INTO `VIEWS` ( `IS_UPDATABLE` ) VALUES ( NULL )','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:03','2020-05-18 08:22:22','2020-05-18 08:23:26','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `VIEWS` ( `IS_UPDATABLE` ) VALUES ( NULL )'),('test','ev_28718_133','INSERT IGNORE INTO `oltp19` () VALUES (),(),(),(),() ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:44','2020-05-18 08:21:44','2020-05-18 08:23:03','2020-05-18 08:21:44','2020-05-18 08:23:34','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `oltp19` () VALUES (),(),(),(),() ;'),('test','ev_28718_230','REPLACE INTO `time_zone_leap_second` () VALUES () ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:23:10','2020-05-18 08:23:10',NULL,'2020-05-18 08:23:10','2020-05-18 08:24:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `time_zone_leap_second` () VALUES () ;'),('test','ev_28716_255','SELECT `Transition_type_id` FROM `time_zone` ORDER BY `Time_zone_id` LIMIT 33 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:23:10','2020-05-18 08:23:10',NULL,'2020-05-18 08:23:10','2020-05-18 08:26:42','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Transition_type_id` FROM `time_zone` ORDER BY `Time_zone_id` LIMIT 33 ;'),('test','ev_28714_179','SELECT * FROM INFORMATION_SCHEMA.`INNODB_BUFFER_POOL_STATS` AS table1 WHERE NOT ( ( table1.`PAGES_MADE_NOT_YOUNG_RATE` != table1.`PAGES_WRITTEN_RATE` AND table1.`PENDING_FLUSH_LIST` <> \'y\') OR table1.`POOL_ID` < table1.`PENDING_DECOMPRESS`) HAVING NOT ( (table1.`PAGES_WRITTEN_RATE` < \'1925-08-04 22:30:53.036416\' IS NULL OR table1.`PAGES_READ_RATE` >= \'1997-01-10 12:21:02.002847\') AND table1.`PAGES_MADE_NOT_YOUNG_RATE` >= 2) LIMIT 8','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:45','2020-05-18 08:21:45','2020-05-18 08:23:06','2020-05-18 08:21:45','2020-05-18 08:23:19','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`INNODB_BUFFER_POOL_STATS` AS table1 WHERE NOT ( ( table1.`PAGES_MADE_NOT_YOUNG_RATE` != table1.`PAGES_WRITTEN_RATE` AND table1.`PENDING_FLUSH_LIST` <> \'y\') OR table1.`POOL_ID` < table1.`PENDING_DECOMPRESS`) HAVING NOT ( (table1.`PAGES_WRITTEN_RATE` < \'1925-08-04 22:30:53.036416\' IS NULL OR table1.`PAGES_READ_RATE` >= \'1997-01-10 12:21:02.002847\') AND table1.`PAGES_MADE_NOT_YOUNG_RATE` >= 2) LIMIT 8'),('test','ev_28718_136','REPLACE INTO `oltp141` () VALUES (),(),(),(),()','root@localhost',NULL,1,'SECOND','2020-05-18 08:21:46','2020-05-18 08:21:46','2020-05-18 08:23:04','2020-05-18 08:21:46','2020-05-18 08:23:22','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp141` () VALUES (),(),(),(),()'),('test','ev_28716_200','SHOW EXPLAIN FOR 202','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:22','2020-05-18 08:22:22','2020-05-18 08:23:02','2020-05-18 08:22:22','2020-05-18 08:25:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW EXPLAIN FOR 202'),('test','ev_28716_137','INSERT INTO `INNODB_SYS_FOREIGN_COLS` SELECT * FROM `SPATIAL_REF_SYS` ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:46','2020-05-18 08:21:46','2020-05-18 08:22:22','2020-05-18 08:21:46','2020-05-18 08:24:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `INNODB_SYS_FOREIGN_COLS` SELECT * FROM `SPATIAL_REF_SYS` ;'),('test','ev_28718_137','UPDATE IGNORE `oltp70` SET `id` = \'\' ORDER BY `k` LIMIT 9','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:46','2020-05-18 08:21:46','2020-05-18 08:23:10','2020-05-18 08:21:46','2020-05-18 08:24:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp70` SET `id` = \'\' ORDER BY `k` LIMIT 9'),('test','ev_28714_180','DELETE FROM `PARAMETERS` ORDER BY `SPECIFIC_SCHEMA` LIMIT 7 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:46','2020-05-18 08:21:46','2020-05-18 08:22:22','2020-05-18 08:21:46','2020-05-18 08:22:52','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `PARAMETERS` ORDER BY `SPECIFIC_SCHEMA` LIMIT 7 ;'),('test','ev_28714_292','SELECT * FROM (INFORMATION_SCHEMA.`TABLE_CONSTRAINTS` AS table1 STRAIGHT_JOIN test.`oltp52` AS table2 ON ( table2.`c` = table1.`TABLE_NAME` ) ) WHERE ( ( (NOT ( ( ( ( ( ( (NOT ( (NOT ( ( table2.`c` < table1.`TABLE_NAME` AND table1.`CONSTRAINT_TYPE` >= \'lv\') AND table2.`k` > 8) AND table1.`CONSTRAINT_SCHEMA` = table1.`CONSTRAINT_NAME`) AND table2.`c` < \'v\') OR table1.`CONSTRAINT_CATALOG` >= \'jh\') AND table1.`CONSTRAINT_SCHEMA` != table2.`k`) AND table2.`c` <= \'h\') OR table1.`CONSTRAINT_TYPE` >= \'2022-07-19 11:11:43.033203\') OR table2.`k` >= \'rp\') AND table1.`CONSTRAINT_SCHEMA` >= table2.`id`) AND table2.`c` < \'1931-03-20 21:53:59.016968\') OR table2.`pad` < \'p\') OR table1.`TABLE_NAME` != table1.`CONSTRAINT_TYPE`) AND table2.`id` != 4) LIMIT 0 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:23:07','2020-05-18 08:23:07',NULL,'2020-05-18 08:23:07','2020-05-18 08:25:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`TABLE_CONSTRAINTS` AS table1 STRAIGHT_JOIN test.`oltp52` AS table2 ON ( table2.`c` = table1.`TABLE_NAME` ) ) WHERE ( ( (NOT ( ( ( ( ( ( (NOT ( (NOT ( ( table2.`c` < table1.`TABLE_NAME` AND table1.`CONSTRAINT_TYPE` >= \'lv\') AND table2.`k` > 8) AND table1.`CONSTRAINT_SCHEMA` = table1.`CONSTRAINT_NAME`) AND table2.`c` < \'v\') OR table1.`CONSTRAINT_CATALOG` >= \'jh\') AND table1.`CONSTRAINT_SCHEMA` != table2.`k`) AND table2.`c` <= \'h\') OR table1.`CONSTRAINT_TYPE` >= \'2022-07-19 11:11:43.033203\') OR table2.`k` >= \'rp\') AND table1.`CONSTRAINT_SCHEMA` >= table2.`id`) AND table2.`c` < \'1931-03-20 21:53:59.016968\') OR table2.`pad` < \'p\') OR table1.`TABLE_NAME` != table1.`CONSTRAINT_TYPE`) AND table2.`id` != 4) LIMIT 0 ;'),('test','ev_28716_138','RESET QUERY CACHE','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:47','2020-05-18 08:21:47','2020-05-18 08:22:23','2020-05-18 08:21:47','2020-05-18 08:23:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','RESET QUERY CACHE'),('test','ev_28718_138','SELECT * FROM `table_stats` ORDER BY `cardinality` LIMIT 0 ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:47','2020-05-18 08:21:47','2020-05-18 08:22:23','2020-05-18 08:21:47','2020-05-18 08:23:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `table_stats` ORDER BY `cardinality` LIMIT 0 ;'),('test','ev_28718_140','REPLACE INTO `oltp82` ( `k`, _next_field ) VALUES ( \'o\', \'miss\' )','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:48','2020-05-18 08:21:48','2020-05-18 08:22:23','2020-05-18 08:21:48','2020-05-18 08:23:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp82` ( `k`, ) VALUES ( \'o\', \'miss\' )'),('test','ev_28716_141','SELECT * FROM `servers` ORDER BY `Host` LIMIT 243 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:48','2020-05-18 08:21:48','2020-05-18 08:22:23','2020-05-18 08:21:48','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `servers` ORDER BY `Host` LIMIT 243 ;'),('test','ev_28716_144','SELECT * FROM (test.`oltp83` AS table1 INNER JOIN test.`oltp73` AS table2 ON ( table2.`c` = table1.`pad` ) ) WHERE ( ( ( ( table2.`k` >= table2.`id` AND table2.`pad` <> table2.`id`) AND table2.`pad` <> \'rs\') OR table1.`pad` = table2.`pad`) OR table2.`id` != 1) HAVING table2.`id` > 1 LIMIT 9','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:50','2020-05-18 08:21:50','2020-05-18 08:22:25','2020-05-18 08:21:50','2020-05-18 08:22:52','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`oltp83` AS table1 INNER JOIN test.`oltp73` AS table2 ON ( table2.`c` = table1.`pad` ) ) WHERE ( ( ( ( table2.`k` >= table2.`id` AND table2.`pad` <> table2.`id`) AND table2.`pad` <> \'rs\') OR table1.`pad` = table2.`pad`) OR table2.`id` != 1) HAVING table2.`id` > 1 LIMIT 9'),('test','ev_28714_188','SHOW GRANTS','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:50','2020-05-18 08:21:50','2020-05-18 08:23:09','2020-05-18 08:21:50','2020-05-18 08:25:22','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW GRANTS'),('test','ev_28716_145','SELECT `User` FROM `time_zone_leap_second` ORDER BY `Transition_time` LIMIT 54 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:50','2020-05-18 08:21:50','2020-05-18 08:23:10','2020-05-18 08:21:50','2020-05-18 08:25:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `User` FROM `time_zone_leap_second` ORDER BY `Transition_time` LIMIT 54 ;'),('test','ev_28716_204','DELETE FROM `THREAD_POOL_STATS` ORDER BY `THREAD_CREATIONS_DUE_TO_STALL` LIMIT 5','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:26','2020-05-18 08:22:26','2020-05-18 08:23:09','2020-05-18 08:22:26','2020-05-18 08:26:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `THREAD_POOL_STATS` ORDER BY `THREAD_CREATIONS_DUE_TO_STALL` LIMIT 5'),('test','ev_28718_190','SELECT * FROM `THREAD_POOL_QUEUES` ORDER BY `PRIORITY` LIMIT 0 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:25','2020-05-18 08:22:25','2020-05-18 08:23:08','2020-05-18 08:22:25','2020-05-18 08:23:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `THREAD_POOL_QUEUES` ORDER BY `PRIORITY` LIMIT 0 ;'),('test','ev_28718_142','SELECT * FROM `oltp89` ORDER BY `id` LIMIT 73 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:51','2020-05-18 08:21:51','2020-05-18 08:22:25','2020-05-18 08:21:51','2020-05-18 08:25:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `oltp89` ORDER BY `id` LIMIT 73 ;'),('test','ev_28714_189','SELECT `pad` FROM `oltp60` ORDER BY `id` LIMIT 8','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:51','2020-05-18 08:21:51','2020-05-18 08:23:09','2020-05-18 08:21:51','2020-05-18 08:23:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `pad` FROM `oltp60` ORDER BY `id` LIMIT 8'),('test','ev_28714_190','REPLACE INTO `oltp34` () VALUES ()','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:51','2020-05-18 08:21:51','2020-05-18 08:22:25','2020-05-18 08:21:51','2020-05-18 08:25:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp34` () VALUES ()'),('test','ev_28716_147','UPDATE IGNORE `oltp39` SET `k` = \'horn\' ORDER BY `id` LIMIT 8 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:51','2020-05-18 08:21:51','2020-05-18 08:23:10','2020-05-18 08:21:51','2020-05-18 08:23:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp39` SET `k` = \'horn\' ORDER BY `id` LIMIT 8 ;'),('test','ev_28718_193','SHOW CREATE FUNCTION u','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:30','2020-05-18 08:22:30',NULL,'2020-05-18 08:22:30','2020-05-18 08:23:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW CREATE FUNCTION u'),('test','ev_28718_144','SELECT `TABLE_CATALOG` FROM `VIEWS` ORDER BY `COLLATION_CONNECTION` LIMIT 135 ;','root@localhost',NULL,7,'SECOND','2020-05-18 08:21:52','2020-05-18 08:21:52','2020-05-18 08:22:29','2020-05-18 08:21:52','2020-05-18 08:23:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `TABLE_CATALOG` FROM `VIEWS` ORDER BY `COLLATION_CONNECTION` LIMIT 135 ;'),('test','ev_28714_191','REPLACE INTO `oltp50` () VALUES (),(),() ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:53','2020-05-18 08:21:53','2020-05-18 08:22:30','2020-05-18 08:21:53','2020-05-18 08:24:03','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp50` () VALUES (),(),() ;'),('test','ev_28716_148','SELECT `Correction` FROM `time_zone` ORDER BY `Time_zone_id` LIMIT 138 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:53','2020-05-18 08:21:53','2020-05-18 08:22:30','2020-05-18 08:21:53','2020-05-18 08:23:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Correction` FROM `time_zone` ORDER BY `Time_zone_id` LIMIT 138 ;'),('test','ev_28718_145','SHOW PROFILE ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:53','2020-05-18 08:21:53','2020-05-18 08:22:30','2020-05-18 08:21:53','2020-05-18 08:24:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW PROFILE ;'),('test','ev_28714_248','INSERT IGNORE INTO `ENABLED_ROLES` ( `ROLE_NAME` ) VALUES ( NULL )','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:31','2020-05-18 08:22:31',NULL,'2020-05-18 08:22:31','2020-05-18 08:24:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `ENABLED_ROLES` ( `ROLE_NAME` ) VALUES ( NULL )'),('test','ev_28716_149','SELECT * FROM `servers` ORDER BY `Password` LIMIT 216','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:53','2020-05-18 08:21:53','2020-05-18 08:22:30','2020-05-18 08:21:53','2020-05-18 08:22:51','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `servers` ORDER BY `Password` LIMIT 216'),('test','ev_28714_193','SELECT `id` FROM `oltp149` ORDER BY `pad` LIMIT 199 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:21:54','2020-05-18 08:21:54','2020-05-18 08:22:31','2020-05-18 08:21:54','2020-05-18 08:24:12','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp149` ORDER BY `pad` LIMIT 199 ;'),('test','ev_28716_150','SELECT * FROM `SCHEMATA` ORDER BY `SCHEMA_COMMENT` LIMIT 92','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:54','2020-05-18 08:21:54','2020-05-18 08:22:31','2020-05-18 08:21:54','2020-05-18 08:24:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `SCHEMATA` ORDER BY `SCHEMA_COMMENT` LIMIT 92'),('test','ev_28718_148','SELECT * FROM `columns_priv` INTO OUTFILE \'load_columns_priv\' ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:21:55','2020-05-18 08:21:55','2020-05-18 08:22:31','2020-05-18 08:21:55','2020-05-18 08:25:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `columns_priv` INTO OUTFILE \'load_columns_priv\' ;'),('test','ev_28716_151','DROP INDEX o ON ind_constr_t2','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:55','2020-05-18 08:21:55','2020-05-18 08:22:32','2020-05-18 08:21:55','2020-05-18 08:25:48','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DROP INDEX o ON ind_constr_t2'),('test','ev_28718_151','REPLACE INTO `roles_mapping` ( `Admin_option`, _next_field ) VALUES ( \'\', \'\' ) ;','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:57','2020-05-18 08:21:57','2020-05-18 08:22:32','2020-05-18 08:21:57','2020-05-18 08:24:02','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `roles_mapping` ( `Admin_option`, ) VALUES ( \'\', \'\' ) ;'),('test','ev_28714_194','SELECT `SOURCE_FILE` FROM `SESSION_VARIABLES` ORDER BY `VARIABLE_VALUE` LIMIT 212','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:57','2020-05-18 08:21:57','2020-05-18 08:22:32','2020-05-18 08:21:57','2020-05-18 08:24:46','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `SOURCE_FILE` FROM `SESSION_VARIABLES` ORDER BY `VARIABLE_VALUE` LIMIT 212'),('test','ev_28716_152','REPLACE INTO `oltp38` ( `c`, _next_field ) VALUES ( 117, NULL ) ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:21:57','2020-05-18 08:21:57','2020-05-18 08:22:32','2020-05-18 08:21:57','2020-05-18 08:25:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp38` ( `c`, ) VALUES ( 117, NULL ) ;'),('test','ev_28718_152','UPDATE IGNORE `oltp35` SET `k` = \'\' ORDER BY `id` LIMIT 1 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:21:57','2020-05-18 08:21:57','2020-05-18 08:22:32','2020-05-18 08:21:57','2020-05-18 08:24:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp35` SET `k` = \'\' ORDER BY `id` LIMIT 1 ;'),('test','ev_28718_147','SELECT * FROM test.`oltp26` AS table1 WHERE ( ( (NOT (NOT ( ( ( table1.`k` <> table1.`pad` AND table1.`pad` <= table1.`id`) AND table1.`k` < \'g\') AND table1.`k` <> \'r\') OR table1.`k` < \'1964-07-26 03:46:24.059922\') AND table1.`pad` >= table1.`id`) AND table1.`k` != \'1906-01-29 02:15:53.017843\') OR table1.`k` > \'2035-03-05 08:38:25.012034\') LIMIT 4 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:54','2020-05-18 08:21:54','2020-05-18 08:22:31','2020-05-18 08:21:54','2020-05-18 08:25:18','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM test.`oltp26` AS table1 WHERE ( ( (NOT (NOT ( ( ( table1.`k` <> table1.`pad` AND table1.`pad` <= table1.`id`) AND table1.`k` < \'g\') AND table1.`k` <> \'r\') OR table1.`k` < \'1964-07-26 03:46:24.059922\') AND table1.`pad` >= table1.`id`) AND table1.`k` != \'1906-01-29 02:15:53.017843\') OR table1.`k` > \'2035-03-05 08:38:25.012034\') LIMIT 4 ;'),('test','ev_28714_197','REPLACE INTO `help_topic` ( `description`, _next_field ) VALUES ( 113, \'\' )','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:58','2020-05-18 08:21:58','2020-05-18 08:22:32','2020-05-18 08:21:58','2020-05-18 08:24:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `help_topic` ( `description`, ) VALUES ( 113, \'\' )'),('test','ev_28716_153','SELECT * FROM `roles_mapping` ORDER BY `Role` LIMIT 53','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:58','2020-05-18 08:21:58','2020-05-18 08:22:32','2020-05-18 08:21:58','2020-05-18 08:24:20','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `roles_mapping` ORDER BY `Role` LIMIT 53'),('test','ev_28714_198','SELECT `Grantor` FROM `plugin` ORDER BY `name` LIMIT 85','root@localhost',NULL,5,'SECOND','2020-05-18 08:21:58','2020-05-18 08:21:58','2020-05-18 08:22:32','2020-05-18 08:21:58','2020-05-18 08:25:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `Grantor` FROM `plugin` ORDER BY `name` LIMIT 85'),('test','ev_28714_199','REPLACE INTO `oltp138` () VALUES (),()','root@localhost',NULL,2,'SECOND','2020-05-18 08:21:58','2020-05-18 08:21:58','2020-05-18 08:22:33','2020-05-18 08:21:58','2020-05-18 08:24:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','REPLACE INTO `oltp138` () VALUES (),()'),('test','ev_28714_200','UPDATE IGNORE `oltp124` SET `id` = \'b\' ORDER BY `k` LIMIT 0','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:59','2020-05-18 08:21:59','2020-05-18 08:22:33','2020-05-18 08:21:59','2020-05-18 08:24:52','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp124` SET `id` = \'b\' ORDER BY `k` LIMIT 0'),('test','ev_28714_201','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_SYS_VIRTUAL` AS table1 INNER JOIN test.`t2_MyISAM` AS table2 ON ( table2.`col_varchar` = table1.`TABLE_ID` ) ) WHERE NOT ( (NOT (NOT ( (NOT ( (NOT (NOT ( ( ( ( ( ( table2.`id` < table1.`BASE_POS` OR table1.`POS` != 8) AND table2.`col_int` <> table2.`col_datetime`) OR table2.`col_varchar` > \'f\') AND table2.`id` >= \'1941-06-08 00:24:32.050817\') OR table2.`col_varchar` != table1.`BASE_POS`) AND table2.`col_int` != table2.`col_varchar`) OR table2.`col_varchar` < \'sz\') OR table1.`TABLE_ID` < table2.`id`) OR table1.`TABLE_ID` != \'2034-08-06 20:33:09.065403\') AND table2.`col_int` >= \'z\') OR table2.`col_datetime` <= 8) AND table2.`id` > 1) AND table2.`id` > table1.`TABLE_ID`) AND table1.`BASE_POS` < table2.`id`) HAVING table2.`col_datetime` < \'1974-01-20 11:30:56.045603\' LIMIT 4 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:21:59','2020-05-18 08:21:59','2020-05-18 08:22:33','2020-05-18 08:21:59','2020-05-18 08:24:01','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_SYS_VIRTUAL` AS table1 INNER JOIN test.`t2_MyISAM` AS table2 ON ( table2.`col_varchar` = table1.`TABLE_ID` ) ) WHERE NOT ( (NOT (NOT ( (NOT ( (NOT (NOT ( ( ( ( ( ( table2.`id` < table1.`BASE_POS` OR table1.`POS` != 8) AND table2.`col_int` <> table2.`col_datetime`) OR table2.`col_varchar` > \'f\') AND table2.`id` >= \'1941-06-08 00:24:32.050817\') OR table2.`col_varchar` != table1.`BASE_POS`) AND table2.`col_int` != table2.`col_varchar`) OR table2.`col_varchar` < \'sz\') OR table1.`TABLE_ID` < table2.`id`) OR table1.`TABLE_ID` != \'2034-08-06 20:33:09.065403\') AND table2.`col_int` >= \'z\') OR table2.`col_datetime` <= 8) AND table2.`id` > 1) AND table2.`id` > table1.`TABLE_ID`) AND table1.`BASE_POS` < table2.`id`) HAVING table2.`col_datetime` < \'1974-01-20 11:30:56.045603\' LIMIT 4 ;'),('test','ev_28714_204','SHOW SLAVE HOSTS','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:23:54','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW SLAVE HOSTS'),('test','ev_28718_156','UPDATE IGNORE `oltp81` SET `pad` = \'c\' ORDER BY `pad` LIMIT 0','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:24:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp81` SET `pad` = \'c\' ORDER BY `pad` LIMIT 0'),('test','ev_28718_159','UPDATE IGNORE `db` SET `Event_priv` = \'\' ORDER BY `Insert_priv` LIMIT 3 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:25:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `db` SET `Event_priv` = \'\' ORDER BY `Insert_priv` LIMIT 3 ;'),('test','ev_28718_160','INSERT IGNORE INTO `global_priv` ( `Priv` ) VALUES ( \'\' )','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:25:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `global_priv` ( `Priv` ) VALUES ( \'\' )'),('test','ev_28714_205','UPDATE IGNORE `EVENTS` SET `EXECUTE_AT` = \'g\' ORDER BY `CHARACTER_SET_CLIENT` LIMIT 9','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:26:11','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `EVENTS` SET `EXECUTE_AT` = \'g\' ORDER BY `CHARACTER_SET_CLIENT` LIMIT 9'),('test','ev_28716_158','UPDATE IGNORE `oltp84` SET `id` = 92 ORDER BY `id` LIMIT 4 ;','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:03','2020-05-18 08:22:03','2020-05-18 08:22:35','2020-05-18 08:22:03','2020-05-18 08:22:43','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp84` SET `id` = 92 ORDER BY `id` LIMIT 4 ;'),('test','ev_28714_206','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_SYS_TABLESTATS` AS table1 RIGHT OUTER JOIN test.`oltp49` AS table2 ON ( table2.`id` = table1.`REF_COUNT` ) ) WHERE table1.`NUM_ROWS` = \'1912-04-26 14:32:34.022333\' LIMIT 6','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:36','2020-05-18 08:22:04','2020-05-18 08:23:58','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`INNODB_SYS_TABLESTATS` AS table1 RIGHT OUTER JOIN test.`oltp49` AS table2 ON ( table2.`id` = table1.`REF_COUNT` ) ) WHERE table1.`NUM_ROWS` = \'1912-04-26 14:32:34.022333\' LIMIT 6'),('test','ev_28716_159','SHOW TABLE STATUS','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:36','2020-05-18 08:22:04','2020-05-18 08:25:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW TABLE STATUS'),('test','ev_28718_163','UPDATE IGNORE `oltp22` SET `pad` = \'pot\' ORDER BY `k` LIMIT 7','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:36','2020-05-18 08:22:04','2020-05-18 08:25:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `oltp22` SET `pad` = \'pot\' ORDER BY `k` LIMIT 7'),('test','ev_28714_207','INSERT IGNORE INTO `INNODB_BUFFER_POOL_STATS` ( `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` ) VALUES ( \'r\' ) ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:36','2020-05-18 08:22:04','2020-05-18 08:24:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `INNODB_BUFFER_POOL_STATS` ( `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` ) VALUES ( \'r\' ) ;'),('test','ev_28716_160','UPDATE IGNORE `VIEWS` SET `DEFINER` = \'y\' ORDER BY `IS_UPDATABLE` LIMIT 4 ;','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:36','2020-05-18 08:22:04','2020-05-18 08:23:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `VIEWS` SET `DEFINER` = \'y\' ORDER BY `IS_UPDATABLE` LIMIT 4 ;'),('test','ev_28718_164','UPDATE IGNORE `ROUTINES` SET `ROUTINE_TYPE` = \'\' ORDER BY `DATA_TYPE` LIMIT 9 ;','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:04','2020-05-18 08:22:04','2020-05-18 08:22:37','2020-05-18 08:22:04','2020-05-18 08:23:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `ROUTINES` SET `ROUTINE_TYPE` = \'\' ORDER BY `DATA_TYPE` LIMIT 9 ;'),('test','ev_28714_208','FLUSH DES_KEY_FILE','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:05','2020-05-18 08:22:05','2020-05-18 08:22:38','2020-05-18 08:22:05','2020-05-18 08:25:33','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','FLUSH DES_KEY_FILE'),('test','ev_28718_165','SELECT `id` FROM `oltp122` ORDER BY `pad` LIMIT 190 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:05','2020-05-18 08:22:05','2020-05-18 08:22:38','2020-05-18 08:22:05','2020-05-18 08:24:16','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp122` ORDER BY `pad` LIMIT 190 ;'),('test','ev_28716_161','DELETE FROM `index_stats` ORDER BY `index_name` LIMIT 6','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:05','2020-05-18 08:22:05','2020-05-18 08:22:38','2020-05-18 08:22:05','2020-05-18 08:24:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `index_stats` ORDER BY `index_name` LIMIT 6'),('test','ev_28718_170','COMMIT','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:10','2020-05-18 08:22:10','2020-05-18 08:22:44','2020-05-18 08:22:10','2020-05-18 08:26:24','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28716_165','INSERT INTO `t2_MyISAM` SELECT * FROM `oltp81`','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:10','2020-05-18 08:22:10','2020-05-18 08:22:45','2020-05-18 08:22:10','2020-05-18 08:25:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `t2_MyISAM` SELECT * FROM `oltp81`'),('test','ev_28714_216','INSERT IGNORE INTO `time_zone_leap_second` () VALUES ()','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:10','2020-05-18 08:22:10','2020-05-18 08:22:44','2020-05-18 08:22:10','2020-05-18 08:26:05','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `time_zone_leap_second` () VALUES ()'),('test','ev_28714_217','INSERT IGNORE INTO `columns_priv` ( `Timestamp` ) VALUES ( NULL )','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:11','2020-05-18 08:22:11','2020-05-18 08:22:47','2020-05-18 08:22:11','2020-05-18 08:24:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `columns_priv` ( `Timestamp` ) VALUES ( NULL )'),('test','ev_28718_173','UPDATE IGNORE `help_topic` SET `name` = \'g\' ORDER BY `help_category_id` LIMIT 3','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:11','2020-05-18 08:22:11','2020-05-18 08:22:47','2020-05-18 08:22:11','2020-05-18 08:24:10','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_topic` SET `name` = \'g\' ORDER BY `help_category_id` LIMIT 3'),('test','ev_28718_176','COMMIT ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:12','2020-05-18 08:22:12','2020-05-18 08:22:50','2020-05-18 08:22:12','2020-05-18 08:26:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT ;'),('test','ev_28714_219','UPDATE IGNORE `time_zone_name` SET `Time_zone_id` = 160 ORDER BY `Time_zone_id` LIMIT 6','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:12','2020-05-18 08:22:12','2020-05-18 08:22:49','2020-05-18 08:22:12','2020-05-18 08:23:38','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `time_zone_name` SET `Time_zone_id` = 160 ORDER BY `Time_zone_id` LIMIT 6'),('test','ev_28716_168','INSERT INTO `general_log` SELECT * FROM `plugin`','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:13','2020-05-18 08:22:13','2020-05-18 08:22:52','2020-05-18 08:22:13','2020-05-18 08:23:25','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT INTO `general_log` SELECT * FROM `plugin`'),('test','ev_28718_177','DELETE FROM `THREAD_POOL_GROUPS` ORDER BY `QUEUE_LENGTH` LIMIT 8','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:13','2020-05-18 08:22:13','2020-05-18 08:22:52','2020-05-18 08:22:13','2020-05-18 08:25:50','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `THREAD_POOL_GROUPS` ORDER BY `QUEUE_LENGTH` LIMIT 8'),('test','ev_28714_221','SELECT `TABLESPACE_NAME` FROM `GLOBAL_STATUS` ORDER BY `VARIABLE_NAME` LIMIT 68','root@localhost',NULL,7,'SECOND','2020-05-18 08:22:13','2020-05-18 08:22:13','2020-05-18 08:22:52','2020-05-18 08:22:13','2020-05-18 08:24:15','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `TABLESPACE_NAME` FROM `GLOBAL_STATUS` ORDER BY `VARIABLE_NAME` LIMIT 68'),('test','ev_28714_222','SELECT `value` FROM `INNODB_CMP_PER_INDEX_RESET` ORDER BY `uncompress_ops` LIMIT 55','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:14','2020-05-18 08:22:14','2020-05-18 08:22:53','2020-05-18 08:22:14','2020-05-18 08:26:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `value` FROM `INNODB_CMP_PER_INDEX_RESET` ORDER BY `uncompress_ops` LIMIT 55'),('test','ev_28714_223','UPDATE IGNORE `ALL_PLUGINS` SET `PLUGIN_TYPE_VERSION` = NULL ORDER BY `PLUGIN_TYPE` LIMIT 9','root@localhost',NULL,1,'SECOND','2020-05-18 08:22:14','2020-05-18 08:22:14','2020-05-18 08:22:53','2020-05-18 08:22:14','2020-05-18 08:23:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `ALL_PLUGINS` SET `PLUGIN_TYPE_VERSION` = NULL ORDER BY `PLUGIN_TYPE` LIMIT 9'),('test','ev_28716_171','SELECT * FROM `KEY_COLUMN_USAGE` ORDER BY `TABLE_CATALOG` LIMIT 205','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:14','2020-05-18 08:22:14','2020-05-18 08:22:53','2020-05-18 08:22:14','2020-05-18 08:24:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `KEY_COLUMN_USAGE` ORDER BY `TABLE_CATALOG` LIMIT 205'),('test','ev_28718_178','UPDATE IGNORE `help_topic` SET `help_category_id` = \'\' ORDER BY `name` LIMIT 1 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:14','2020-05-18 08:22:14','2020-05-18 08:22:53','2020-05-18 08:22:14','2020-05-18 08:26:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','UPDATE IGNORE `help_topic` SET `help_category_id` = \'\' ORDER BY `name` LIMIT 1 ;'),('test','ev_28718_179','SELECT `k` FROM `oltp19` ORDER BY `c` LIMIT 152','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:15','2020-05-18 08:22:15','2020-05-18 08:22:54','2020-05-18 08:22:15','2020-05-18 08:26:00','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `k` FROM `oltp19` ORDER BY `c` LIMIT 152'),('test','ev_28716_173','INSERT IGNORE INTO `ROUTINES` () VALUES (),(),() ;','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:15','2020-05-18 08:22:15','2020-05-18 08:22:54','2020-05-18 08:22:15','2020-05-18 08:23:59','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `ROUTINES` () VALUES (),(),() ;'),('test','ev_28714_225','COMMIT','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:15','2020-05-18 08:22:15','2020-05-18 08:22:54','2020-05-18 08:22:15','2020-05-18 08:23:29','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28716_174','SELECT * FROM `INNODB_FT_INDEX_CACHE` ORDER BY `POSITION` LIMIT 248 ;','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:16','2020-05-18 08:22:16','2020-05-18 08:22:55','2020-05-18 08:22:16','2020-05-18 08:23:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `INNODB_FT_INDEX_CACHE` ORDER BY `POSITION` LIMIT 248 ;'),('test','ev_28714_226','SELECT * FROM `func` ORDER BY `type` LIMIT 48','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:16','2020-05-18 08:22:16','2020-05-18 08:22:55','2020-05-18 08:22:16','2020-05-18 08:24:57','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `func` ORDER BY `type` LIMIT 48'),('test','ev_28716_175','DELETE FROM `CHECK_CONSTRAINTS` ORDER BY `CONSTRAINT_NAME` LIMIT 7','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:16','2020-05-18 08:22:16','2020-05-18 08:22:55','2020-05-18 08:22:16','2020-05-18 08:25:32','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','DELETE FROM `CHECK_CONSTRAINTS` ORDER BY `CONSTRAINT_NAME` LIMIT 7'),('test','ev_28714_227','SELECT `id` FROM `oltp100` ORDER BY `c` LIMIT 232 ;','root@localhost',NULL,3,'SECOND','2020-05-18 08:22:16','2020-05-18 08:22:16','2020-05-18 08:22:55','2020-05-18 08:22:16','2020-05-18 08:23:08','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT `id` FROM `oltp100` ORDER BY `c` LIMIT 232 ;'),('test','ev_28714_228','SHOW TABLES','root@localhost',NULL,2,'SECOND','2020-05-18 08:22:17','2020-05-18 08:22:17','2020-05-18 08:22:56','2020-05-18 08:22:17','2020-05-18 08:23:09','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SHOW TABLES'),('test','ev_28714_229','SELECT * FROM `db` ORDER BY `Select_priv` LIMIT 87 ;','root@localhost',NULL,6,'SECOND','2020-05-18 08:22:17','2020-05-18 08:22:17','2020-05-18 08:22:56','2020-05-18 08:22:17','2020-05-18 08:23:28','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `db` ORDER BY `Select_priv` LIMIT 87 ;'),('test','ev_28716_182','COMMIT','root@localhost',NULL,5,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:58','2020-05-18 08:22:19','2020-05-18 08:24:36','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','COMMIT'),('test','ev_28714_233','INSERT IGNORE INTO `APPLICABLE_ROLES` ( `IS_GRANTABLE` ) VALUES ( \'pasta\' )','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:59','2020-05-18 08:22:19','2020-05-18 08:23:27','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','INSERT IGNORE INTO `APPLICABLE_ROLES` ( `IS_GRANTABLE` ) VALUES ( \'pasta\' )'),('test','ev_28716_185','SELECT * FROM INFORMATION_SCHEMA.`PROFILING` AS table1 WHERE (NOT ( table1.`SEQ` > \'b\' OR table1.`DURATION` = table1.`SOURCE_FUNCTION`) AND table1.`SOURCE_FILE` <> table1.`SOURCE_FUNCTION`) LIMIT 2','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:59','2020-05-18 08:22:19','2020-05-18 08:25:37','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`PROFILING` AS table1 WHERE (NOT ( table1.`SEQ` > \'b\' OR table1.`DURATION` = table1.`SOURCE_FUNCTION`) AND table1.`SOURCE_FILE` <> table1.`SOURCE_FUNCTION`) LIMIT 2'),('test','ev_28714_231','SELECT * FROM INFORMATION_SCHEMA.`PARAMETERS` AS table1 WHERE ( ( ( ( table1.`SPECIFIC_CATALOG` = table1.`PARAMETER_NAME` OR table1.`DATA_TYPE` >= table1.`NUMERIC_SCALE`) OR table1.`COLLATION_NAME` >= \'2039-09-23 05:43:03.009381\') AND table1.`SPECIFIC_CATALOG` < table1.`ORDINAL_POSITION`) AND table1.`CHARACTER_MAXIMUM_LENGTH` >= \'b\') HAVING NOT table1.`SPECIFIC_NAME` < \'hv\' LIMIT 1','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:19','2020-05-18 08:22:19','2020-05-18 08:22:58','2020-05-18 08:22:19','2020-05-18 08:25:14','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM INFORMATION_SCHEMA.`PARAMETERS` AS table1 WHERE ( ( ( ( table1.`SPECIFIC_CATALOG` = table1.`PARAMETER_NAME` OR table1.`DATA_TYPE` >= table1.`NUMERIC_SCALE`) OR table1.`COLLATION_NAME` >= \'2039-09-23 05:43:03.009381\') AND table1.`SPECIFIC_CATALOG` < table1.`ORDINAL_POSITION`) AND table1.`CHARACTER_MAXIMUM_LENGTH` >= \'b\') HAVING NOT table1.`SPECIFIC_NAME` < \'hv\' LIMIT 1'),('test','ev_28714_236','SELECT * FROM `INNODB_CMP` ORDER BY `uncompress_time` LIMIT 209','root@localhost',NULL,4,'SECOND','2020-05-18 08:22:20','2020-05-18 08:22:20','2020-05-18 08:23:00','2020-05-18 08:22:20','2020-05-18 08:25:52','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM `INNODB_CMP` ORDER BY `uncompress_time` LIMIT 209'),('test','ev_28714_238','SELECT * FROM (test.`t5_InnoDB` AS table1 STRAIGHT_JOIN test.`oltp30` AS table2 ON ( table2.`k` = table1.`col_timestamp` ) ) WHERE ( ( ( ( (NOT ( ( table1.`col_bit` <> table1.`col_blob` AND table2.`k` = table2.`pad`) OR table2.`id` > 0) AND table1.`col_timestamp` != table1.`col_bit`) AND table1.`col_char` >= table1.`col_timestamp`) OR table1.`col_char` != table1.`col_blob`) AND table2.`k` > table2.`id`) OR table1.`col_int` <> \'2019-03-13 11:33:09.052418\') LIMIT 7','root@localhost',NULL,9,'SECOND','2020-05-18 08:22:24','2020-05-18 08:22:24','2020-05-18 08:23:05','2020-05-18 08:22:24','2020-05-18 08:25:13','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (test.`t5_InnoDB` AS table1 STRAIGHT_JOIN test.`oltp30` AS table2 ON ( table2.`k` = table1.`col_timestamp` ) ) WHERE ( ( ( ( (NOT ( ( table1.`col_bit` <> table1.`col_blob` AND table2.`k` = table2.`pad`) OR table2.`id` > 0) AND table1.`col_timestamp` != table1.`col_bit`) AND table1.`col_char` >= table1.`col_timestamp`) OR table1.`col_char` != table1.`col_blob`) AND table2.`k` > table2.`id`) OR table1.`col_int` <> \'2019-03-13 11:33:09.052418\') LIMIT 7'),('test','ev_28716_205','SELECT * FROM (INFORMATION_SCHEMA.`SYSTEM_VARIABLES` AS table1 RIGHT JOIN mysql.`slow_log` AS table2 ON ( table2.`lock_time` = table1.`VARIABLE_COMMENT` ) ) WHERE NOT (NOT ( ( ( ( table1.`VARIABLE_NAME` != table2.`lock_time` AND table2.`rows_examined` <> 2) OR table1.`GLOBAL_VALUE` != \'2032-10-01 07:09:48.018373\') AND table2.`last_insert_id` < table2.`query_time`) OR table2.`query_time` = \'n\') AND table2.`sql_text` = \'1997-04-25 15:23:24.051074\') HAVING ( ( (NOT table2.`rows_sent` <> 8 AND table1.`NUMERIC_MIN_VALUE` >= \'1961-10-22 13:14:51.023261\') OR table2.`thread_id` <= \'f\') OR table2.`rows_affected` <= \'2007-12-07 08:50:48.063969\') LIMIT 2','root@localhost',NULL,8,'SECOND','2020-05-18 08:22:26','2020-05-18 08:22:26','2020-05-18 08:23:10','2020-05-18 08:22:26','2020-05-18 08:25:41','ENABLED','DROP','STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION','',1,'SYSTEM','latin1','latin1_swedish_ci','latin1_swedish_ci','SELECT * FROM (INFORMATION_SCHEMA.`SYSTEM_VARIABLES` AS table1 RIGHT JOIN mysql.`slow_log` AS table2 ON ( table2.`lock_time` = table1.`VARIABLE_COMMENT` ) ) WHERE NOT (NOT ( ( ( ( table1.`VARIABLE_NAME` != table2.`lock_time` AND table2.`rows_examined` <> 2) OR table1.`GLOBAL_VALUE` != \'2032-10-01 07:09:48.018373\') AND table2.`last_insert_id` < table2.`query_time`) OR table2.`query_time` = \'n\') AND table2.`sql_text` = \'1997-04-25 15:23:24.051074\') HAVING ( ( (NOT table2.`rows_sent` <> 8 AND table1.`NUMERIC_MIN_VALUE` >= \'1961-10-22 13:14:51.023261\') OR table2.`thread_id` <= \'f\') OR table2.`rows_affected` <= \'2007-12-07 08:50:48.063969\') LIMIT 2');
+--enable_query_log
+select count(*) from mysql.event;
+flush tables;
+--disable_result_log
+show events;
+--enable_result_log
+truncate table mysql.event;
diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test
index aa8cd225d7b..59c13107e01 100644
--- a/mysql-test/t/ssl_7937.test
+++ b/mysql-test/t/ssl_7937.test
@@ -21,15 +21,6 @@ create procedure have_ssl()
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
--echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
-# this is the test where certificate verification fails.
-# but yassl doesn't support certificate verification, so
-# we fake the test result for yassl
-let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
-if (!$yassl) {
- --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" "Error in the certificate." "Failed to verify the server certificate"
- --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
-}
-if ($yassl) {
- --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
-}
+--replace_regex /SSL connection error.*certificate[^\n]*/SSL connection error: Failed to verify the server certificate/
+--exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
drop procedure have_ssl;
diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test
index edfead46658..88f6b963cc4 100644
--- a/mysql-test/t/ssl_8k_key.test
+++ b/mysql-test/t/ssl_8k_key.test
@@ -1,6 +1,3 @@
-# schannel does not support keys longer than 4k
--- source include/not_windows.inc
-
-- source include/have_ssl_communication.inc
#
# Bug#29784 YaSSL assertion failure when reading 8k key.
diff --git a/mysql-test/t/ssl_crl.test b/mysql-test/t/ssl_crl.test
index dc30a9b5934..643fb80c747 100644
--- a/mysql-test/t/ssl_crl.test
+++ b/mysql-test/t/ssl_crl.test
@@ -8,6 +8,6 @@
--echo # try logging in with a certificate in the server's --ssl-crl : should fail
# 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"
+--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 2013 (HY000): Lost connection to MySQL server at 'sending authentication information', system error: 32" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked"
--error 1
--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/t/ssl_crl_clients.test b/mysql-test/t/ssl_crl_clients.test
index fc954a2fc38..f1dc4909cc6 100644
--- a/mysql-test/t/ssl_crl_clients.test
+++ b/mysql-test/t/ssl_crl_clients.test
@@ -1,6 +1,12 @@
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
--- source include/have_openssl.inc
+
+if (`SELECT COUNT(*) = 0 FROM information_schema.GLOBAL_VARIABLES
+ WHERE (VARIABLE_NAME ='version_compile_os' AND VARIABLE_VALUE LIKE 'Win%' OR
+ VARIABLE_NAME='have_openssl' AND VARIABLE_VALUE='YES')`)
+{
+ skip Need openssl or Windows;
+}
--echo # Test clients with and without CRL lists
@@ -14,10 +20,12 @@ 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 "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
--error 1
--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 "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
--error 1
--exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
@@ -26,11 +34,11 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
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
---replace_regex /.*mysqladmin.*:/mysqladmin:/
+--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1
--echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
---replace_regex /.*mysqladmin.*:/mysqladmin:/
+--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
--error 1
--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1
diff --git a/mysql-test/t/ssl_system_ca.combinations b/mysql-test/t/ssl_system_ca.combinations
new file mode 100644
index 00000000000..6e3576ada15
--- /dev/null
+++ b/mysql-test/t/ssl_system_ca.combinations
@@ -0,0 +1,11 @@
+[good]
+#
+# hostname on the certificate is localhost
+#
+
+[bad]
+#
+# hostname on the certificate is server8k
+#
+loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem
+loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
diff --git a/mysql-test/t/ssl_system_ca.test b/mysql-test/t/ssl_system_ca.test
new file mode 100644
index 00000000000..920e391090f
--- /dev/null
+++ b/mysql-test/t/ssl_system_ca.test
@@ -0,0 +1,22 @@
+#
+# Tests here don't use --ssl-ca but expect the certificate to be
+# signed by a CA in a system CA store
+#
+# They only work for openssl, because the following line works only there:
+let SSL_CERT_DIR=$MYSQL_TMP_DIR;
+
+source include/not_embedded.inc;
+
+if (`select @@version_ssl_library not like 'OpenSSL%'`) {
+ skip Needs OpenSSL;
+}
+
+# See `openssl x509 -in cacert.pem -noout -issuer_hash`
+copy_file $MYSQL_TEST_DIR/std_data/cacert.pem $MYSQL_TMP_DIR/ed1f42db.0;
+
+#
+# test --ssl-verify-server-cert
+#
+
+disable_abort_on_error;
+exec $MYSQL --ssl-verify-server-cert -Ee "select (variable_value <> '') as have_ssl from information_schema.session_status where variable_name='ssl_cipher'" 2>&1;
diff --git a/mysql-test/t/stat_tables-enospc.test b/mysql-test/t/stat_tables-enospc.test
index 932b2bde302..fe8fe3590ae 100644
--- a/mysql-test/t/stat_tables-enospc.test
+++ b/mysql-test/t/stat_tables-enospc.test
@@ -16,9 +16,10 @@ while ($i) {
}
--enable_query_log
set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
-set debug_dbug='+d,simulate_file_write_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,simulate_file_write_error';
set @@max_heap_table_size=128*1024;
--replace_regex /'.*'/'tmp-file'/
analyze table t1;
-set debug_dbug='';
+SET debug_dbug= @saved_dbug;
drop table t1;
diff --git a/mysql-test/t/stat_tables_innodb.test b/mysql-test/t/stat_tables_innodb.test
index 04e81de8f9d..008ca6911e9 100644
--- a/mysql-test/t/stat_tables_innodb.test
+++ b/mysql-test/t/stat_tables_innodb.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/have_sequence.inc
SET SESSION STORAGE_ENGINE='InnoDB';
@@ -9,4 +10,23 @@ set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
+--echo #
+--echo # MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows.
+--echo #
+
+CREATE TABLE t1(a INT) ENGINE=INNODB;
+INSERT INTO t1 SELECT 1 FROM seq_1_to_60000;
+
+SET @save_use_stat_tables= @@use_stat_tables;
+SET use_stat_tables= preferably;
+SELECT count(*) FROM t1;
+CREATE INDEX idx ON t1(a);
+ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (idx);
+SELECT * FROM mysql.index_stats where table_name='t1';
+SELECT * FROM mysql.column_stats where table_name='t1';
+SET use_stat_tables= @save_use_stat_tables;
+DROP TABLE t1;
+
+--echo # end of 10.1 tests
+
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/stat_tables_partition.test b/mysql-test/t/stat_tables_partition.test
index 1316e5cca11..11b74818d82 100644
--- a/mysql-test/t/stat_tables_partition.test
+++ b/mysql-test/t/stat_tables_partition.test
@@ -11,7 +11,33 @@ CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
ANALYZE TABLE t1;
+DROP TABLE t1;
-SET use_stat_tables = DEFAULT;
+--echo #
+--echo # MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows
+--echo #
+CREATE TABLE t1 (
+ id int(11) auto_increment primary key,
+ c1 int(11) DEFAULT NULL
+) PARTITION BY RANGE (id) (
+ PARTITION p0 VALUES LESS THAN (4),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+);
-DROP TABLE t1;
+insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1);
+insert into t1(c1) select c1 from t1;
+insert into t1(c1) select c1 from t1;
+
+select count(*) from t1;
+select count(*) from t1 where id <4;
+flush status;
+set session use_stat_tables='preferably';
+
+--echo # Must NOT show "Engine-independent statistics collected":
+alter table t1 analyze partition p0;
+
+--echo # Should not have Handler_read_rnd_next=34
+show session status like 'Handler_read_rnd%';
+drop table t1;
+
+SET use_stat_tables = DEFAULT;
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 5012e9eb4d8..6eada9b27d9 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -7,6 +7,8 @@ drop table if exists t0,t1,t2,t3,t4,t5,t6;
drop view if exists v1, v2;
--enable_warnings
+--source include/have_sequence.inc
+
set @subselect4_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set optimizer_switch='semijoin_with_cache=on';
@@ -2077,3 +2079,126 @@ insert into t1 values(2,1),(1,2);
select (select c1 from t1 group by c1,c2 order by c1 limit 1) as x;
(select c1 from t1 group by c1,c2 order by c1 limit 1);
drop table t1;
+
+--echo #
+--echo # MDEV-22498: SIGSEGV in Bitmap<64u>::merge on SELECT
+--echo #
+
+set @save_sql_select_limit= @@sql_select_limit;
+SET sql_select_limit=0;
+
+CREATE TABLE t1(b INT, c INT);
+CREATE TABLE t2(a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
+
+let $query=
+SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1);
+
+eval EXPLAIN EXTENDED $query;
+eval $query;
+
+SET @@sql_select_limit= @save_sql_select_limit;
+
+eval EXPLAIN EXTENDED $query;
+eval $query;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-17606: Query returns wrong results (while using CHARACTER SET utf8)
+--echo #
+
+CREATE TABLE t1(l1 varchar(10), i2 int);
+INSERT INTO t1 VALUES ('e',2),('o',6),('x',4);
+CREATE TABLE t2 (v1 varchar(10) CHARACTER SET utf8, KEY v1 (v1(3)));
+INSERT INTO t2 VALUES ('k'),('rid'),('f'),('x');
+
+EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-19232: Floating point precision / value comparison problem
+--echo #
+
+CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0));
+INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797);
+INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422);
+
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=on';
+
+SELECT
+population, area, population/area,
+cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1;
+
+SELECT * FROM t1 A
+WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
+
+SET optimizer_switch='subquery_cache=off';
+SELECT * FROM t1 A
+WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region);
+
+SET @@optimizer_switch= @save_optimizer_switch;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (2),(3);
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+
+EXPLAIN
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+
+DROP TABLE t1,t2;
+
+--echo # end of 10.1 tests
+
+--echo #
+--echo # MDEV-22852: SIGSEGV in sortlength (optimized builds)
+--echo #
+
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=off';
+CREATE TABLE t1 (a INT,b INT);
+INSERT INTO t1 VALUES (0,0),(0,0);
+SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
+SET @@optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE
+--echo # with subquery with ROLLUP
+--echo #
+
+CREATE TABLE t1 (i INT DEFAULT 0, c VARCHAR(2048));
+INSERT INTO t1 SELECT 0, seq FROM seq_1_to_6000;
+
+CREATE TABLE t2 (f VARCHAR(2048) DEFAULT '');
+INSERT INTO t2 VALUES ('1'),('bar');
+
+EXPLAIN
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+
+SELECT * FROM t2;
+DELETE FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP );
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test
index 1354953e972..e27ce57038b 100644
--- a/mysql-test/t/subselect_exists2in.test
+++ b/mysql-test/t/subselect_exists2in.test
@@ -330,8 +330,8 @@ drop table t1,t3;
--echo # String* Field_varstring::val_str(String*, String*)
--echo #
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch='in_to_exists=on,exists_to_in=on';
+SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'in_to_exists=off', 'in_to_exists=on');
+SET optimizer_switch='exists_to_in=on';
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('k'),('m');
@@ -466,8 +466,8 @@ explain extended
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
+SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'materialization=off', 'materialization=on');
+SET optimizer_switch = 'exists_to_in=on,semijoin=off';
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
explain extended
@@ -829,5 +829,117 @@ DROP TABLE t1;
--echo # End of 10.0 tests
+--echo #
+--echo # MDEV-23221: A subquery causes crash
+--echo #
+create table t1 (
+location_code varchar(10),
+country_id varchar(10)
+);
+insert into t1 values ('HKG', 'HK');
+insert into t1 values ('NYC', 'US');
+insert into t1 values ('LAX', 'US');
+
+create table t2 (
+container_id varchar(10),
+cntr_activity_type varchar(10),
+cntr_dest varchar(10)
+);
+insert into t2 values ('AAAA1111', 'VSL', 'NYC');
+insert into t2 values ('AAAA1111', 'CUV', 'NYC');
+insert into t2 values ('BBBB2222', 'VSL', 'LAX');
+insert into t2 values ('BBBB2222', 'XYZ', 'LAX');
+
+let $query=
+select
+ (select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry,
+ (select
+ max(container_id)
+ from t2 as cl2
+ where
+ cl2.container_id = cl1.container_id and
+ cl2.cntr_activity_type = 'CUV' and
+ exists (select location_code
+ from t1
+ where
+ location_code = cl2.cntr_dest and
+ country_id = dest_cntry)
+ ) as CUV
+from
+ t2 cl1;
+
+--echo # Must not crash or return an error:
+eval $query;
+
+eval prepare s from "$query";
+execute s;
+execute s;
+
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-20557: SQL query with duplicate table aliases consistently crashes server
+--echo # (Just a testcase)
+--echo #
+
+create table t1 (id int, id2 int);
+create table t2 (id int, id2 int, a int);
+create table t3 (id int);
+create table t4 (id int);
+
+--error ER_NOT_SUPPORTED_YET
+select (select 1 from t1 where (exists
+ (select 1 from t2
+ where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt
+from t3;
+
+drop table t1,t2,t3,t4;
+
+
+--echo #
+--echo # MDEV-21649: Crash when using nested EXISTS
+--echo # (Just a testcase)
+--echo #
+CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
+CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id));
+CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id));
+
+SELECT
+ W0.`id`
+FROM
+ `t1` W0
+WHERE (
+ EXISTS(
+ SELECT
+ V0.`id`
+ FROM
+ `t2` V0
+ WHERE (
+ EXISTS(
+ SELECT
+ U0.`id`
+ FROM
+ `t2` U0
+ INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`)
+ WHERE (
+ U0.`ip_id` = V0.`ip_id`
+ AND U4.`storage_method_id` = (
+ SELECT
+ U5.`storage_method_id`
+ FROM
+ `t3` U5
+ WHERE
+ U5.`storage_target_id` = V0.`id`
+ LIMIT
+ 1
+ )
+ )
+ )
+ )
+ )
+);
+
+drop table t1,t2,t3;
+
#restore defaults
set optimizer_switch=default;
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 544bcd994ed..2c117fe00d6 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -611,3 +611,19 @@ FROM t1
DROP TABLE t1,t2,t3,t4;
+
+--echo #
+--echo # MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
+--echo #
+
+set @save_character_set_connection=@@character_set_connection;
+set character_set_connection='utf8';
+
+CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB;
+INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05');
+CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB;
+INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
+SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
+DROP TABLE t1,t2;
+
+set character_set_connection=@save_character_set_connection;
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
index bc318bf624d..d87569f8668 100644
--- a/mysql-test/t/sum_distinct-big.test
+++ b/mysql-test/t/sum_distinct-big.test
@@ -19,32 +19,15 @@ set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
-INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
-INSERT INTO t1 (id) SELECT id FROM t1; /* 8 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 12 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 16 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 20 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 24 */
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1_to_1024 b;
# Just test that AVG(DISTINCT) is there
SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
SELECT SUM(DISTINCT id)/COUNT(DISTINCT id) FROM t1 GROUP BY id % 13;
-INSERT INTO t1 SELECT id+1024 FROM t1;
-INSERT INTO t1 SELECT id+2048 FROM t1;
-INSERT INTO t1 SELECT id+4096 FROM t1;
-INSERT INTO t1 SELECT id+8192 FROM t1;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_1025_to_16384 b;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_16384 b
+ORDER by (a.seq*0+b.seq)*rand();
# SELECT '++++++++++++++++++++++++++++++++++++++++++++++++++';
@@ -74,9 +57,10 @@ SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
SET max_heap_table_size=default;
-INSERT INTO t1 SELECT id+16384 FROM t1;
-DELETE FROM t2;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t1 SELECT b.seq FROM seq_1_to_128,seq_16385_to_32768 b;
+TRUNCATE t2;
+INSERT INTO t2 SELECT b.seq FROM seq_1_to_128 a,seq_1_to_32768 b
+ORDER BY (a.seq*0+b.seq)*rand();
SELECT SUM(DISTINCT id) sm FROM t2;
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index bd3bba34f89..dc5fe7f3cd0 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -639,3 +639,22 @@ ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL;
# was not dropped during the first TRUNCATE due to extra table handles.
TRUNCATE TABLE t1;
DROP TEMPORARY TABLE t1;
+
+--echo #
+--echo # MDEV-21695 Server crashes in TABLE::evaluate_update_default_function upon UPDATE on temporary table
+--echo #
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TEMPORARY TABLE t1 (a DATETIME ON UPDATE CURRENT_TIMESTAMP);
+ALTER TABLE t1 ADD b INT;
+INSERT INTO t1 (b) VALUES (1),(2);
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t1 CHANGE COLUMN x xx INT;
+UPDATE t1 SET b = 3;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/temp_table_symlink.test b/mysql-test/t/temp_table_symlink.test
new file mode 100644
index 00000000000..9297b472805
--- /dev/null
+++ b/mysql-test/t/temp_table_symlink.test
@@ -0,0 +1,32 @@
+source include/not_windows.inc;
+
+#
+# MDEV-23569 temporary tables can overwrite existing files
+#
+
+let datadir=`select @@datadir`;
+create table d1 (a int);
+create temporary table t1 (a int);
+perl;
+chdir "$ENV{MYSQL_TMP_DIR}/mysqld.1/";
+for (<#sql*.MYI>) {
+ /^#sql(.*)_([0-9a-f]+_)([0-9a-f]+)\.MYI$/ or die;
+ symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MYI", hex($3)+1;
+ symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+1;
+ symlink "$ENV{datadir}/test/d1.MYI", sprintf "#sql$1_$2%x.MAI", hex($3)+2;
+ symlink "$ENV{datadir}/test/d1.MYI", "#sql_$1_0.MAI";
+}
+EOF
+
+error 1,1030;
+create temporary table t2 (a int);
+error 1,1030;
+create temporary table t3 (a int) engine=Aria;
+error 1,1030;
+select * from information_schema.columns where table_schema='test';
+
+flush tables;
+select * from d1;
+drop temporary table t1;
+remove_files_wildcard $MYSQL_TMP_DIR/mysqld.1 *sql*;
+drop table d1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 7c78460c1b4..fead1739c06 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -369,12 +369,18 @@ select @a;
--echo #
--echo # BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
--echo #
+
+# Set timestamp to make sure DATETIME->DATE truncation happens.
+# Otherwise, the warning would disappear at '00:00:00' sharp,
+# and a different execution plan would be chosen.
+SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-01 00:00:01');
create table t1(a date,key(a));
insert into t1 values ('2012-01-01'),('2012-02-02');
explain
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
drop table t1;
+SET TIMESTAMP=DEFAULT;
--echo #
--echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
@@ -627,3 +633,21 @@ DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
+
+--echo #
+--echo # Start of 10.2 tests
+--echo #
+
+--echo #
+--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+--echo #
+
+CREATE TABLE t1 (f DATE, KEY(f));
+INSERT INTO t1 VALUES ('2020-01-01'),('2020-01-02');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 0da84052546..85be66a40e0 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -32,10 +32,12 @@ drop table t1;
# Test insert of now() and curtime()
#
+SET TIMESTAMP=UNIX_TIMESTAMP('2020-08-11 00:00:01');
CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
insert into t1 (b,c,d) values(now(),curtime(),now());
select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
drop table t1;
+SET TIMESTAMP=DEFAULT;
#
# Test of datetime and not null
@@ -201,6 +203,7 @@ drop table t1;
#
# Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function.
#
+
create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
@@ -214,7 +217,9 @@ select f1, f2, f3 from t1 where cast(f1 as datetime) between f2 and
select f2 from t1 where '2001-04-10 12:34:56' between f2 and '01-05-01';
select f2, f3 from t1 where '01-03-10' between f2 and f3;
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:01');
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
+SET timestamp=DEFAULT;
drop table t1;
#
@@ -748,6 +753,49 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+--echo #
+
+CREATE TABLE t1
+(
+ id INT NOT NULL PRIMARY KEY,
+ id2 INT,
+ k TINYINT,
+ j INT,
+ t DATETIME,
+ KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'2019-12-13 10:09:59'),
+(54,54,1,0,'2019-12-13 16:28:41'),
+(55,54,1,0,'2019-12-13 16:29:10'),
+(56,54,1,0,'2019-12-13 16:29:43'),
+(57,54,1,0,'2019-12-13 16:30:16'),
+(58,54,1,0,'2019-12-13 16:30:49'),
+(59,54,1,0,'2019-12-13 16:31:23'),
+(60,54,1,0,'2019-12-13 16:31:55'),
+(61,54,1,0,'2019-12-13 16:32:28'),
+(62,54,1,0,'2019-12-13 16:33:01'),
+(63,54,1,0,'2019-12-13 16:33:34'),
+(64,54,1,0,'2019-12-13 16:34:07'),
+(65,54,1,0,'2019-12-13 16:34:40'),
+(66,54,1,0,'2019-12-13 16:35:13'),
+(67,54,1,0,'2019-12-13 16:35:46'),
+(68,54,1,0,'2019-12-13 16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=max(t);
+SELECT t FROM t1 WHERE id2=54 and j=0 and k=1 GROUP BY t HAVING t=max(t);
+DROP TABLE t1;
+
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1);
+SELECT pk<DATE'2001-01-01' FROM t1 GROUP BY pk;
+SELECT pk<DATE'2001-01-01' FROM v1 GROUP BY pk;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.1 tests
--echo #
@@ -794,6 +842,15 @@ ALTER TABLE t1 MODIFY a DATETIME;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+--echo #
+
+CREATE TABLE t1 (f DATETIME, KEY(f));
+INSERT INTO t1 VALUES ('2020-01-01 00:00:00'),('2020-01-02 00:00:00');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
+DROP TABLE t1;
+
--echo #
--echo # End of 10.2 tests
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 9dba1c709d5..fcea68a1c46 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -486,6 +486,20 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-23282 FLOAT(53,0) badly handles out-of-range values
+--echo #
+
+CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL);
+INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
+SELECT c1, c2 FROM t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL);
+INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40);
+SELECT c1, c2 FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/t/type_int.test b/mysql-test/t/type_int.test
index 830b175fb5d..584d30df2ad 100644
--- a/mysql-test/t/type_int.test
+++ b/mysql-test/t/type_int.test
@@ -15,6 +15,18 @@ SELECT COALESCE(@a) FROM t1 ORDER BY STRCMP(STDDEV_SAMP(a), 'bar');
DROP TABLE t1;
--echo #
+--echo # MDEV-21065 UNIQUE constraint causes a query with string comparison to omit a row in the result set
+--echo #
+
+CREATE TABLE t1 (c0 INT UNIQUE);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL), (NULL), (1), (0);
+SELECT * FROM t1 WHERE c0 < '\n2';
+DROP TABLE t1;
+
+SELECT CAST('\n2' AS INT);
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 2f3409f56e9..e5d903e95cd 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1825,6 +1825,32 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result
+--echo #
+
+SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val;
+
+SET sql_mode='';
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999'));
+CREATE TABLE t2 (a TEXT, d DECIMAL(15,2));
+INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1;
+INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1;
+SELECT d, a FROM t2 ORDER BY d,a;
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
--echo # Bug#18408499 UNSIGNED BIGINT HIGH VALUES
--echo # WRONG NUMERICAL COMPARISON RESULTS
--echo #
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
index 7a79cd12f70..31dc7a11e2d 100644
--- a/mysql-test/t/type_set.test
+++ b/mysql-test/t/type_set.test
@@ -102,7 +102,7 @@ DROP TABLE t1;
--echo #
--echo #
---echo # MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns
+--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
--echo #
CREATE TABLE t1 (c1 DATE PRIMARY KEY);
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index cce5900a993..9ef80cf28fb 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -747,6 +747,40 @@ SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selecti
set @@old_mode= @save_old_mode;
--echo #
+--echo # MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+--echo #
+
+CREATE OR REPLACE TABLE t1
+(
+ id INT NOT NULL PRIMARY KEY,
+ id2 INT,
+ k TINYINT,
+ j INT,
+ t TIME,
+ KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'10:09:59'),
+(54,54,1,0,'16:28:41'),
+(55,54,1,0,'16:29:10'),
+(56,54,1,0,'16:29:43'),
+(57,54,1,0,'16:30:16'),
+(58,54,1,0,'16:30:49'),
+(59,54,1,0,'16:31:23'),
+(60,54,1,0,'16:31:55'),
+(61,54,1,0,'16:32:28'),
+(62,54,1,0,'16:33:01'),
+(63,54,1,0,'16:33:34'),
+(64,54,1,0,'16:34:07'),
+(65,54,1,0,'16:34:40'),
+(66,54,1,0,'16:35:13'),
+(67,54,1,0,'16:35:46'),
+(68,54,1,0,'16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=MAX(t);
+SELECT t FROM t1 WHERE id2=54 AND j=0 AND k=1 GROUP BY t HAVING t=MAX(t);
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
@@ -781,5 +815,14 @@ DROP FUNCTION f1;
--echo #
+--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
+--echo #
+
+CREATE TABLE t1 (f TIME, KEY(f));
+INSERT INTO t1 VALUES ('10:10:10'),('20:20:20');
+EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '23:59:59';
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 881e753de7d..07c7f599db7 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -47,7 +47,7 @@ select lookup();
select lookup("127.0.0.1");
--error ER_CANT_INITIALIZE_UDF
select lookup(127,0,0,1);
-select lookup("localhost");
+select lookup("localhost") rlike '^127\.\\d+\.\\d+.\\d+$';
--error ER_CANT_INITIALIZE_UDF
select reverse_lookup();
@@ -541,3 +541,25 @@ select * from v1;
drop view v1;
drop function myfunc_int;
drop table t1;
+
+--echo #
+--echo # MDEV-23327: Can't uninstall UDF if the implementation library
+--echo # file doesn't exist
+--echo #
+
+# emulate brocken so/ddl udf
+insert into mysql.func values ("unexisting_udf", 0, "soname", "function");
+
+# check that we have the function "installed"
+select * from mysql.func WHERE name='unexisting_udf';
+
+# make attempt to drop the function
+DROP FUNCTION unexisting_udf;
+
+# check that we have the plugin uninstalled
+select * from mysql.plugin WHERE name='unexisting_udf';
+
+--error ER_SP_DOES_NOT_EXIST
+DROP FUNCTION unexisting_udf;
+
+--echo # End of 10.2 tests
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 707bda6d81b..9f747c9080f 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1184,11 +1184,11 @@ select 4
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
;
+--error ER_AGGREGATE_ORDER_FOR_UNION
eval $my_stmt;
+--error ER_AGGREGATE_ORDER_FOR_UNION
eval prepare stmt1 from '$my_stmt';
-execute stmt1;
-execute stmt1;
let $my_stmt=
select 1 as foo
@@ -1201,13 +1201,11 @@ union
order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
;
+--error ER_AGGREGATE_ORDER_FOR_UNION
eval $my_stmt;
+--error ER_AGGREGATE_ORDER_FOR_UNION
eval prepare stmt1 from '$my_stmt';
-execute stmt1;
-execute stmt1;
-
-deallocate prepare stmt1;
--echo End of 5.1 tests
@@ -1637,3 +1635,14 @@ eval $q;
eval EXPLAIN EXTENDED $q;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT()
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT t1 VALUES (1),(2),(3);
+
+--error ER_AGGREGATE_ORDER_FOR_UNION
+(SELECT 1 AS a) UNION (SELECT a FROM t1 GROUP BY a) ORDER BY GROUP_CONCAT(a);
+DROP TABLE t1;
diff --git a/mysql-test/t/union_crash-714.test b/mysql-test/t/union_crash-714.test
index 6c31a2202cb..90b849037f2 100644
--- a/mysql-test/t/union_crash-714.test
+++ b/mysql-test/t/union_crash-714.test
@@ -3,7 +3,9 @@
#
--source include/have_debug.inc
create table t1 (i tinyint);
-set debug_dbug='+d,bug11747970_raise_error';
+SET @saved_dbug = @@SESSION.debug_dbug;
+SET debug_dbug='+d,bug11747970_raise_error';
--error ER_QUERY_INTERRUPTED
insert into t1 (i) select i from t1 union select i from t1;
drop table t1;
+SET debug_dbug= @saved_dbug; \ No newline at end of file
diff --git a/mysql-test/t/uniques_crash-7912.test b/mysql-test/t/uniques_crash-7912.test
deleted file mode 100644
index 8dc82f8f540..00000000000
--- a/mysql-test/t/uniques_crash-7912.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# MDEV-7912
-#
-# multitable delete with wrongly set sort_buffer_size crashes in merge_buffers
-
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/windows.inc
-
-call mtr.add_suppression("Out of memory");
-
-set sql_mode="";
---disable_warnings
-drop table if exists t1,t2;
-create table `t1` (`a` datetime not null) engine=InnoDB;
-create table `t2` (`a` int not null) engine=innodb;
-replace into t1 values (),();
-insert into t2 values(0);
-set session sort_buffer_size = 1024*1024*1024*1024;
-#Either fail with EE_OUTOFMEMORY, or succeed
---error 0 , 5
-delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a;
---enable_warnings
-
-drop table t2;
-drop table t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index d4e5fdd7a46..cd5cc6efade 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -6362,17 +6362,6 @@ INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
drop view v;
drop tables t1,t2,t3;
-#
-# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
-#
-create table t1 (i int, j int);
-insert t1 values (1,1),(2,2);
-create view v1 as select (2, 3) not in (select i, j from t1);
-select * from v1;
-show create view v1;
-drop view v1;
-drop table t1;
-
--echo #
--echo # MDEV-10704: Assertion `field->field->table == table_arg'
--echo # failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
diff --git a/mysql-test/t/warnings_debug.test b/mysql-test/t/warnings_debug.test
index 3055e3894e5..6605daf875d 100644
--- a/mysql-test/t/warnings_debug.test
+++ b/mysql-test/t/warnings_debug.test
@@ -9,6 +9,7 @@ create table t1 (a int primary key) engine=innodb;
# Test that warnings produced during autocommit (after calling
# set_ok_status()) are still reported to the client.
+SET @saved_dbug = @@SESSION.debug_dbug;
SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
INSERT INTO t1 VALUES (1);
# The warning will be shown automatically by mysqltest; there was a bug where
@@ -17,3 +18,4 @@ INSERT INTO t1 VALUES (1);
SHOW WARNINGS;
drop table t1;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index a4d42ce2b91..c7e3dac598b 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1,6 +1,7 @@
#
# Window Functions Tests
#
+--source include/have_sequence.inc
--disable_warnings
drop table if exists t1,t2;
@@ -2342,5 +2343,185 @@ select rank() over (partition by 'abc' order by 'xyz') from t1;
drop table t1;
--echo #
+--echo # MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
+--echo #
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
+drop table t1;
+
+--echo #
+--echo # MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*)
+--echo #
+
+CREATE TABLE t1 (i int) ;
+INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2);
+
+SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ;
+drop table t1;
+
+--echo #
+--echo # MDEV-21318: Wrong results with window functions and implicit grouping
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--echo #
+--echo # With empty const table
+--echo # The expected result here is 1, NULL
+--echo #
+
+explain
+SELECT row_number() over(), sum(1) FROM t1;
+SELECT row_number() over(), sum(1) FROM t1;
+
+insert into t1 values (2);
+
+--echo #
+--echo # Const table has 1 row, but still impossible where
+--echo # The expected result here is 1, NULL
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1;
+SELECT row_number() over(), sum(1) FROM t1 where a=1;
+
+--echo #
+--echo # Impossible HAVING
+--echo # Empty result is expected
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+
+--echo #
+--echo # const table has 1 row, no impossible where
+--echo # The expected result here is 1, 2
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2;
+SELECT row_number() over(), sum(a) FROM t1 where a=2;
+drop table t1;
+
+--echo #
+--echo # Impossible Where
+--echo #
+
+create table t1(a int);
+insert into t1 values (1);
+
+--echo #
+--echo # Expected result is NULL, 0, NULL
+--echo #
+EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+
+--echo #
+--echo # Expected result is 1, 0, NULL
+--echo #
+
+EXPLAIN
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+
+drop table t1;
+
+--echo #
+--echo # MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
+--echo #
+
+CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY ) ;
+INSERT INTO t0 VALUES (1),(2),(3);
+
+SELECT a FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+
+SELECT a, ROW_NUMBER() OVER v2
+FROM t0
+WHERE a < 8
+GROUP BY 1.5
+WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
+
+drop table t0;
+
+--echo #
+--echo # MDEV-16230:Server crashes when Analyze format=json is run with a window function with
+--echo # empty PARTITION BY and ORDER BY clauses
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+
+--source include/analyze-format.inc
+ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1;
+SELECT row_number() OVER() FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22984: Throw an error when arguments to window functions are window functions
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+
+--error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
+SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM t1;
+--error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
+SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function
+--echo #
+
+CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED);
+INSERT INTO t1 VALUES (1),(2);
+SELECT MIN(d) OVER () FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22463: Element_type &Bounds_checked_array<Item *>::operator[](size_t) [Element_type = Item *]:
+--echo # Assertion `n < m_size' failed
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT, g int, h INT, i INT);
+INSERT INTO t1 SELECT seq,seq,seq,seq, seq,seq,seq,seq,seq FROM seq_1_to_5;
+
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+--sorted_result
+SELECT a FROM t1 ORDER BY ROW_NUMBER() OVER (PARTITION BY -1,1,0,2,3,4,5,6,7,8);
+SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4);
+SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6);
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18916: crash in Window_spec::print_partition() with decimals
+--echo #
+
+--error ER_TOO_BIG_SCALE
+SELECT cast((rank() over w1) as decimal (53,56));
+--error ER_WRONG_WINDOW_SPEC_NAME
+SELECT cast((rank() over w1) as decimal (53,30));
+
+--echo #
+--echo # MDEV-15180: server crashed with NTH_VALUE()
+--echo #
+
+CREATE TABLE t1 (i1 int, a int);
+INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
+
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
+
+CREATE VIEW v1 AS (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) ;
+SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/t/win_ntile.test b/mysql-test/t/win_ntile.test
index 6f12e1f4005..c65ba7e1521 100644
--- a/mysql-test/t/win_ntile.test
+++ b/mysql-test/t/win_ntile.test
@@ -169,3 +169,46 @@ from t1;
drop table t1;
+
+--echo #
+--echo # MDEV-9911 NTILE must return an error when parameter is not stable
+--echo #
+
+create table t1 (
+ pk int primary key,
+ c1 nvarchar(10),
+ c2 nvarchar(10),
+ c3 int
+);
+
+insert into t1 values
+ (1, 'Mark', 'Male', 5),
+ (2, 'John', 'Male', 5),
+ (3, 'Pam', 'Female', 6),
+ (4, 'Sara', 'Female', 6),
+ (5, 'Todd', 'Male', 5),
+ (6, 'Mary', 'Female', 6),
+ (7, 'Ben', 'Male', 5),
+ (8, 'Jodi', 'Female', 6),
+ (9, 'Tom', 'Male', 5),
+ (10, 'Lucky', 'Male', 5),
+ (11, 'Mark', 'Male', 5),
+ (12, 'John', 'Male', 5),
+ (13, 'Pam', 'Female', 6),
+ (14, 'Sara', 'Female', 6),
+ (15, 'Todd', 'Male', 5),
+ (16, 'Mary', 'Female', 6),
+ (17, 'Ben', 'Male', 5),
+ (18, 'Jodi', 'Female', 6),
+ (19, 'Tom', 'Male', 5),
+ (20, 'Lucky', 'Male', 5);
+# Correct usage of NTILE with a fix argument NTILE(6).
+select c1, c2, c3, ntile(6) over (partition by c2 order by pk) from t1;
+# Correct usage - constant NTILE (argument) in each partition.
+select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
+
+update t1 set c3= 1 where pk = 1;
+--error ER_INVALID_NTILE_ARGUMENT
+select c1, c2, c3, ntile(c3) over (partition by c2 order by pk) from t1;
+
+drop table t1;
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 1990da921ec..7eac636dc5d 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,241 +23,132 @@
#
##############################################################################
#
-# Based on 10.2 259edb1f60b5d4e9061a81e90c5a8ec9d0741751
+# Based on bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8
+# Fri Oct 30 12:58:16 2020 +0200
+# MDEV-23991 fixup: Initialize the memory
-main.alter_table_mdev539_maria : Include file modified in 10.2.27
-main.alter_table_mdev539_myisam : Include file modified in 10.2.27
+main.alter_table : Modified in 10.2.35
main.alter_table_trans : MDEV-12084 - timeout
-main.analyze : Modified in 10.2.27
-main.analyze_format_json : Modified in 10.2.27
-main.analyze_stmt : Modified in 10.2.27
-main.analyze_stmt_orderby : Modified in 10.2.27
-main.analyze_stmt_privileges2 : Modified in 10.2.27
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
+main.aria_icp_debug : Added in 10.2.35
main.auth_named_pipe : MDEV-14724 - System error 2
-main.bootstrap : Modified in 10.2.27
-main.bug13633383 : Modified in 10.2.27
-main.cast : Modified in 10.2.27
-main.compare : Modified in 10.2.28
-main.compound : Modified in 10.2.27
-main.compress : Include file modified in 10.2.27
+main.blackhole : Modified in 10.2.35
+main.bootstrap_innodb : Added in 10.2.35
main.connect : MDEV-17282 - Wrong result
main.connect2 : MDEV-13885 - Server crash
-main.constraints : Modified in 10.2.27
main.count_distinct2 : MDEV-11768 - timeout
-main.create : Modified in 10.2.27
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_event : MDEV-16271 - Wrong result
-main.cte_nonrecursive : Modified in 10.2.27
-main.cte_recursive : Modified in 10.2.27
-main.ctype_create : Modified in 10.2.27
-main.ctype_latin1_de : Modified in 10.2.27
-main.ctype_uca : Include file modified in 10.2.28
-main.ctype_uca_innodb : Include file modified in 10.2.28
-main.ctype_ucs : MDEV-17681 - Data too long for column; modified in 10.2.27
+main.ctype_ucs : MDEV-17681 - Data too long for column
main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade
main.ctype_utf16 : MDEV-10675: timeout or extra warnings
-main.ctype_utf16_def : Configuration modified in 10.2.27
-main.ctype_utf8 : Include file modified in 10.2.28
-main.ctype_utf8mb4 : Modified in 10.2.27
-main.ctype_utf8mb4_heap : Include file modified in 10.2.27
-main.ctype_utf8mb4_innodb : Include file modified in 10.2.27
-main.ctype_utf8mb4_myisam : Include file modified in 10.2.27
+main.ctype_utf8 : Modified in 10.2.35
main.debug_sync : MDEV-10607 - internal error
-main.default : Modified in 10.2.27
-main.derived : Modified in 10.2.27
-main.derived_cond_pushdown : Modified in 10.2.27
main.derived_opt : MDEV-11768 - timeout
-main.derived_view : Modified in 10.2.27
main.dirty_close : MDEV-19368 - mysqltest failed but provided no output
-main.distinct : MDEV-14194 - Crash; modified in 10.2.27
-main.drop_bad_db_type : MDEV-15676 - Wrong result; modified in 10.2.28
-main.drop_debug : Modified in 10.1.42
-main.dyncol : Modified in 10.2.27
-main.events_1 : Modified in 10.2.27
-main.events_2 : MDEV-13277 - Crash; modified in 10.2.27
-main.events_bugs : MDEV-12892 - Crash; modified in 10.2.27
-main.events_grant : Modified in 10.2.27
+main.distinct : MDEV-14194 - Crash
+main.drop_bad_db_type : MDEV-15676 - Wrong result
+main.events_2 : MDEV-13277 - Crash
+main.events_bugs : MDEV-12892 - Crash
main.events_restart : MDEV-12236 - Server shutdown problem
main.events_slowlog : MDEV-12821 - Wrong result
-main.explain_json : Modified in 10.2.27
+main.fast_prefix_index_fetch_innodb : Modified in 10.2.35
main.flush : MDEV-19368 - mysqltest failed but provided no output
-main.flush2 : Modified in 10.2.27
-main.func_isnull : Modified in 10.2.27
-main.func_math : Modified in 10.2.28
-main.func_misc : Modified in 10.2.27
-main.function_defaults : Modified in 10.2.27
+main.func_gconcat : MDEV-21379 - Valgrind warnings
+main.func_json : Modified in 10.2.35
+main.func_test : Modified in 10.2.35
main.gis : MDEV-13411 - wrong result on P8
-main.grant : Configuration added in 10.2.27
-main.grant2 : Configuration added in 10.2.27
-main.grant4 : Configuration added in 10.2.27
-main.grant_cache_no_prot : Include file modified in 10.2.27
-main.grant_cache_ps_prot : Include file modified in 10.2.27
-main.grant_explain_non_select : Modified in 10.2.27
-main.greedy_optimizer : Modified in 10.2.27
-main.group_by : Modified in 10.2.27
-main.group_min_max : Modified in 10.2.27
-main.handlersocket : Configuration added in 10.2.27
+main.gis_notembedded : MDEV-21264 - Wrong result with different default charset
+main.grant : Modified in 10.2.35
+main.grant5 : Modified in 10.2.35
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
-main.index_intersect : Modified in 10.2.27
main.index_intersect_innodb : MDEV-10643 - failed with timeout
-main.index_merge_innodb : MDEV-7142 - Plan mismatch; modified in 10.2.28
-main.index_merge_myisam : Modified in 10.2.28
-main.information_schema : Modified in 10.2.27
-main.information_schema-big : Modified in 10.2.27
-main.information_schema_db : Modified in 10.2.28
-main.information_schema_parameters : Modified in 10.2.27
-main.information_schema_routines : Modified in 10.2.27
-main.innodb_ext_key : Modified in 10.2.27
-main.innodb_icp : Modified in 10.2.27
-main.innodb_mysql_lock : MDEV-7861 - Wrong result
-main.join : Modified in 10.2.27
-main.join_cache : Modified in 10.2.27
-main.join_nested_jcl6 : Modified in 10.2.27
-main.join_outer : Modified in 10.2.27
-main.join_outer_innodb : Modified in 10.2.27
-main.join_outer_jcl6 : Modified in 10.2.27
-main.kill : Modified in 10.2.28
+main.index_merge_innodb : MDEV-7142 - Plan mismatch
+main.information_schema : Modified in 10.2.35
+main.innodb_ext_key : Modified in 10.2.35
+main.innodb_icp_debug : Added in 10.2.35
+main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure (Fixed in 10.3+, MDEV-22947)
main.kill-2 : MDEV-13257 - Wrong result
main.kill_processlist-6619 : MDEV-10793 - Wrong result
-main.limit_rows_examined : Modified in 10.2.27
+main.limit_rows_examined : Modified in 10.2.35
main.loaddata : MDEV-19368 - mysqltest failed but provided no output
main.locale : MDEV-20521 - Missing warning
-main.log_slow : MDEV-13263 - Wrong result; modified in 10.2.27
-main.log_slow_debug : Modified in 10.2.28
+main.lock_view : Added in 10.2.35
+main.log_slow : MDEV-13263 - Wrong result
+main.log_tables : Modified in 10.2.35
main.log_tables-big : MDEV-13408 - wrong result
main.mdev-504 : MDEV-15171 - warning
-main.mdev13607 : Modified in 10.2.27
main.mdev375 : MDEV-10607 - sporadic "can't connect"
-main.merge : MDEV-10607 - sporadic "can't connect"; modified in 10.2.27
-main.mrr_icp_extra : Modified in 10.2.27
-main.multi_update_debug : MDEV-20136 - Debug sync point wait timed out
-main.myisam : Modified in 10.2.28
-main.myisam_explain_non_select_all : Modified in 10.2.27
-main.myisam_icp : Modified in 10.2.27
-main.myisam_mrr : Modified in 10.2.27
-main.mysql : Modified in 10.2.27
-main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2; modified in 10.2.27
+main.merge : MDEV-10607 - sporadic "can't connect"
+main.multi_update_big : Modified in 10.2.35
+main.myisam_icp_debug : Added in 10.2.35
+main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2
main.mysql_client_test_comp : MDEV-16641 - Error in exec
main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed
-main.mysql_comments : Modified in 10.2.27
+main.mysql_upgrade : Modified in 10.2.35
main.mysql_upgrade_noengine : MDEV-14355 - Wrong result
-main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error
-main.mysqlcheck : Modified in 10.2.27
-main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.2.27
-main.mysqldump-max : Modified in 10.2.27
-main.mysqldump-nl : Modified in 10.2.27
+main.mysqlbinlog_row_minimal : Modified in 10.2.35
+main.mysqld--help : Modified in 10.2.35
+main.mysqld_option_err : MDEV-21571 - Crash on bootstrap
+main.mysqldump : MDEV-14800 - Stack smashing detected
main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug
main.mysqlslap : MDEV-11801 - timeout
main.mysqltest : MDEV-9269 - fails on Alpha; MDEV-13887 - Wrong result
-main.named_pipe : Include file modified in 10.2.27
main.old-mode : MDEV-19373 - Wrong result
-main.openssl_1 : MDEV-13492 - Unknown SSL error; modified in 10.2.27
main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1
-main.order_by_innodb : Modified in 10.2.28
+main.order_by : Modified in 10.2.35
main.order_by_optimizer_innodb : MDEV-10683 - Wrong result
-main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock; modified in 10.2.28
-main.partition_example : Configuration added in 10.2.27
-main.partition_innodb : Modified in 10.2.27
+main.parser : Modified in 10.2.35
+main.partition : Modified in 10.2.35
+main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock
main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings
main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1
-main.partition_key_cache : Modified in 10.2.27
-main.partition_pruning : Modified in 10.2.27
-main.plugin : Configuration added in 10.2.27
-main.plugin_innodb : Configuration added in 10.2.27
-main.plugin_load : Configuration modified in 10.2.27
-main.plugin_load_option : Configuration modified in 10.2.27
-main.plugin_not_embedded : Configuration added in 10.2.27
-main.pool_of_threads : Modified in 10.2.27
-main.processlist : Modified in 10.2.28
-main.processlist_notembedded : Added in 10.2.28
-main.ps : Configuration modified in 10.2.27
+main.plugin_innodb : Modified in 10.2.35
+main.pool_of_threads : Modified in 10.2.35
+main.precedence : Added in 10.2.35
+main.precedence_bugs : Added in 10.2.35
+main.processlist_notembedded : Modified in 10.2.35
+main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
main.query_cache : MDEV-16180 - Wrong result
-main.query_cache_debug : MDEV-15281 - Query cache is disabled; modified in 10.2.27
-main.query_cache_ps_no_prot : Modified in 10.2.27
-main.range : Modified in 10.2.27
-main.range_interrupted-13751 : Modified in 10.2.27
-main.range_mrr_icp : Modified in 10.2.27
-main.range_vs_index_merge : Modified in 10.2.27
+main.query_cache_debug : MDEV-15281 - Query cache is disabled
+main.range : Modified in 10.2.35
+main.range_innodb : MDEV-23371 - Server crash
main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away
-main.repair : Modified in 10.2.27
-main.schema : Modified in 10.2.27
-main.select : Modified in 10.2.27
-main.selectivity : Modified in 10.2.28
-main.selectivity_innodb : Modified in 10.2.27
-main.selectivity_no_engine : Modified in 10.2.27
main.set_statement : MDEV-13183 - Wrong result
main.set_statement_notembedded : MDEV-19414 - Wrong result
-main.shm : MDEV-12727 - Mismatch, ERROR 2013; include file modified in 10.2.27
-main.show_bad_definer-5553 : Modified in 10.2.27
-main.show_check : Modified in 10.2.27
+main.shm : MDEV-12727 - Mismatch, ERROR 2013
main.show_explain : MDEV-10674 - Wrong result code
-main.sp : Modified in 10.2.28
-main.sp-code : Modified in 10.2.28
-main.sp-error : Modified in 10.2.27
-main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.2.27
+main.sp-security : MDEV-10607 - sporadic "can't connect"
main.sp_notembedded : MDEV-10607 - internal error
-main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.2.27
-main.ssl-big : Modified in 10.2.27
+main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1
main.ssl_ca : MDEV-10895 - SSL connection error on Power
main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1
-main.ssl_compress : Modified in 10.2.27
-main.ssl_connect : MDEV-13492 - Unknown SSL error
-main.ssl_crl : MDEV-19119 - Wrong error code
main.ssl_timeout : MDEV-11244 - Crash
-main.stat_tables : Modified in 10.2.28
-main.stat_tables-enospc : Modified in 10.2.27
-main.stat_tables_par : MDEV-13266 - Wrong result
main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding
-main.statistics : Modified in 10.2.27
main.status : MDEV-13255 - Wrong result
-main.subselect : Modified in 10.2.27
-main.subselect2 : Modified in 10.2.27
-main.subselect3 : Modified in 10.2.27
-main.subselect3_jcl6 : Modified in 10.2.27
-main.subselect4 : Modified in 10.2.27
-main.subselect_exists2in : Modified in 10.2.27
-main.subselect_extra : Modified in 10.2.27
-main.subselect_innodb : MDEV-10614 - Sporadic wrong results
-main.subselect_mat_cost : Modified in 10.2.27
-main.subselect_mat_cost_bugs : Modified in 10.2.27
-main.subselect_sj : Modified in 10.2.28
-main.subselect_sj2 : Modified in 10.2.27
-main.subselect_sj2_mat : Modified in 10.2.27
-main.subselect_sj_jcl6 : Modified in 10.2.27
-main.subselect_sj_mat : Modified in 10.2.27
-main.subselect_sj_nonmerged : Modified in 10.2.27
-main.sum_distinct-big : Modified in 10.2.28
-main.table_options-5867 : Configuration added in 10.2.27
+main.subselect4 : Modified in 10.2.35
+main.subselect_innodb : MDEV-10614 - Sporadic wrong results; modified in 10.2.35
+main.sum_distinct-big : Modified in 10.2.35
main.tc_heuristic_recover : MDEV-14189 - Wrong result
-main.trigger : Modified in 10.2.27
-main.trigger-compat : Modified in 10.2.27
-main.trigger_notembedded : Modified in 10.2.27
-main.truncate_badse : Configuration added in 10.2.27
+main.temp_table_symlink : MDEV-24058 - Wrong error code; added in 10.2.35
main.type_blob : MDEV-15195 - Wrong result
-main.type_date : Modified in 10.2.27
-main.type_datetime : Modified in 10.2.27
+main.type_date : Modified in 10.2.35
+main.type_datetime : Modified in 10.2.35
main.type_datetime_hires : MDEV-10687 - Timeout
-main.type_int : Modified in 10.2.27
-main.type_newdecimal : Modified in 10.2.28
-main.type_time_6065 : Modified in 10.2.27
-main.type_varchar : Configuration added in 10.2.27
-main.union : Modified in 10.2.27
-main.upgrade : Configuration added in 10.2.27
-main.userstat : MDEV-12904 - SSL errors; configuration added in 10.2.27
-main.variables : Modified in 10.2.27
-main.variables-notembedded : Modified in 10.2.27
-main.view : Modified in 10.2.27
+main.type_newdecimal : Modified in 10.2.35
+main.type_temporal_innodb : MDEV-24025 - Wrong result
+main.udf : Modified in 10.2.35
+main.userstat : MDEV-12904 - SSL errors
+main.view : Modified in 10.2.35
main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query
+main.win : Modified in 10.2.35
main.xa : MDEV-11769 - lock wait timeout
-main.xtradb_mrr : Modified in 10.2.27
#-----------------------------------------------------------------------
archive.archive_bitfield : MDEV-11771 - table is marked as crashed
archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
archive.discover : MDEV-10510 - Table is marked as crashed
-archive.discover_5438 : Configuration added in 10.2.27
archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
#-----------------------------------------------------------------------
@@ -266,87 +157,87 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
#-----------------------------------------------------------------------
-binlog.binlog_commit_wait : MDEV-10150 - Mismatch
-binlog.binlog_innodb : Configuration added in 10.2.27
-binlog.binlog_killed : MDEV-12925 - Wrong result
-binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown; modified in 10.2.27
-binlog.binlog_mixed_cache_stat : Configuration added in 10.2.27
-binlog.binlog_mysqlbinlog2 : Modified in 10.2.27
-binlog.binlog_row_cache_stat : Include file modified in 10.2.27
-binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.2.27
-binlog.binlog_stm_cache_stat : Include file modified in 10.2.27
-binlog.binlog_stm_drop_tmp_tbl : Include file modified in 10.2.27
-binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog : MDEV-19764 - Out of memory; modified in 10.2.27
-binlog.load_data_stm_view : MDEV-16948 - Wrong result
+binlog.binlog_commit_wait : MDEV-10150 - Mismatch
+binlog.binlog_killed : MDEV-12925 - Wrong result
+binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown
+binlog.binlog_mysqlbinlog_row : Modified in 10.2.35
+binlog.binlog_mysqlbinlog_row_frag : Modified in 10.2.35
+binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown
+binlog.binlog_recover_checksum_error : Added in 10.2.35
+binlog.binlog_show_binlog_event_random_pos : Modified in 10.2.35
+binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result
+binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
+binlog.flashback-largebinlog : MDEV-19764 - Out of memory
+binlog.load_data_stm_view : MDEV-16948 - Wrong result
#-----------------------------------------------------------------------
-binlog_encryption.binlog_mdev_20574_old_binlog : Added in 10.2.28
binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint
binlog_encryption.encrypted_master : MDEV-14201 - Extra warnings
binlog_encryption.encrypted_master_switch_to_unencrypted : MDEV-14190 - Can't init tc log
binlog_encryption.encryption_combo : MDEV-14199 - Table is marked as crashed
-binlog_encryption.mysqlbinlog : Modified in 10.2.28
+binlog_encryption.multisource : MDEV-21289 - Wrong error code
binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash
binlog_encryption.rpl_checksum : MDEV-16951 - Wrong result
binlog_encryption.rpl_gtid_basic : MDEV-16947 - Server failed to start
+binlog_encryption.rpl_incident : MDEV-21569 - mutex: LOCK_global_system_variables unlocking
binlog_encryption.rpl_loadfile : MDEV-16645 - Timeout in include
binlog_encryption.rpl_parallel : MDEV-10653 - Timeout in include
-binlog_encryption.rpl_parallel_ignored_errors : Added in 10.2.28
+binlog_encryption.rpl_parallel_ignored_errors : MDEV-22471 - Slave crash
binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout
binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgrind
binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning
binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts
binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Wrong result (test assertion)
-binlog_encryption.rpl_sync : MDEV-13830 - Assertion failure
binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query
#-----------------------------------------------------------------------
-connect.grant : Modified in 10.2.28
-connect.grant2 : Modified in 10.2.28
-connect.ini_grant : Modified in 10.2.28
-connect.mysql_grant : Modified in 10.2.28
-connect.pivot : MDEV-14803 - Failed to discover table
-connect.vcol : MDEV-12374 - Fails on Windows
-connect.xml2_grant : Include file modified in 10.2.28
-connect.xml_grant : Include file modified in 10.2.28
-connect.zip : MDEV-13884 - Wrong result
-
-#-----------------------------------------------------------------------
-
-encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace
-encryption.debug_key_management : MDEV-13841 - Timeout
-encryption.encrypt_and_grep : MDEV-13765 - Wrong result
-encryption.file_creation : Added in 10.2.27
-encryption.innochecksum : MDEV-13644 - Assertion failure
-encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket
-encryption.innodb-checksum-algorithm : MDEV-16896 - Server crash
-encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
-encryption.innodb-discard-import : MDEV-19113 - Timeout
-encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout
-encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
-encryption.innodb-force-corrupt : MDEV-17286 - SSL error
-encryption.innodb-page_encryption : MDEV-10641 - mutex problem
-encryption.innodb-read-only : MDEV-16563 - Crash on startup
-encryption.innodb-redo-badkey : Re-enabled in 10.2.28; modified in 10.2.28
-encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
-encryption.innodb-spatial-index : MDEV-13746 - Wrong result
-encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout
-encryption.innodb_encrypt_log : MDEV-13725 - Wrong result
-encryption.innodb_encrypt_log_corruption : Configuration modified in 10.2.27
-encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result
-encryption.innodb_encryption : MDEV-15675 - Timeout
-encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
-encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
-encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash
-encryption.innodb_first_page : MDEV-10689 - Crash
-encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart
-encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing
-encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing
-encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing
-encryption.tempfiles : Modified in 10.2.27
+connect.pivot : MDEV-14803 - Failed to discover table
+connect.updelx : Modified in 10.2.35
+connect.vcol : MDEV-12374 - Fails on Windows
+connect.zip : MDEV-13884 - Wrong result
+
+#-----------------------------------------------------------------------
+
+disks.disks_notembedded : MDEV-21587 - Wrong result
+
+#-----------------------------------------------------------------------
+
+encryption.create_or_replace : Modified in 10.2.35
+encryption.create_or_replace_big : Added in 10.2.35
+encryption.debug_key_management : MDEV-13841 - Timeout
+encryption.encrypt_and_grep : MDEV-13765 - Wrong result
+encryption.innochecksum : MDEV-13644 - Assertion failure
+encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket
+encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
+encryption.innodb-discard-import : MDEV-19113 - Timeout
+encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout
+encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
+encryption.innodb-force-corrupt : MDEV-17286 - SSL error
+encryption.innodb-missing-key : MDEV-17286 - SSL error
+encryption.innodb-page_encryption : MDEV-10641 - mutex problem
+encryption.innodb-page_encryption_compression : Modified in 10.2.35
+encryption.innodb-page_encryption_log_encryption : Modified in 10.2.35
+encryption.innodb-read-only : MDEV-16563 - Crash on startup
+encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup
+encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
+encryption.innodb-spatial-index : MDEV-13746 - Wrong result
+encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout
+encryption.innodb_encrypt_log : MDEV-13725 - Wrong result
+encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash
+encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result
+encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout
+encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
+encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
+encryption.innodb_encryption_is : MDEV-12898 - Server hang on startup
+encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash
+encryption.innodb_first_page : MDEV-10689 - Crash
+encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart
+encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
+encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
+encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+)
+encryption.tempfiles_encrypted : Added in 10.2.35
#-----------------------------------------------------------------------
@@ -371,37 +262,9 @@ federated.federatedx : MDEV-10617 - Wrong checksum
#-----------------------------------------------------------------------
-funcs_1.innodb_storedproc_07 : Include file modified in 10.2.27
-funcs_1.innodb_storedproc_08 : Include file modified in 10.2.27
-funcs_1.innodb_trig_03e : Modified in 10.2.27
-funcs_1.is_basics_mixed : Modified in 10.2.28
-funcs_1.is_columns : Modified in 10.2.27
-funcs_1.is_columns_innodb : Modified in 10.2.27
-funcs_1.is_columns_memory : Modified in 10.2.27
-funcs_1.is_columns_myisam : Modified in 10.2.27
-funcs_1.is_routines : Include file modified in 10.2.27
-funcs_1.is_routines_embedded : Include file modified in 10.2.27
-funcs_1.is_schemata : Include file modified in 10.2.27
-funcs_1.is_schemata_embedded : Include file modified in 10.2.27
-funcs_1.is_schemata_is_mysql_test : Modified in 10.2.27
-funcs_1.is_tables : Include file modified in 10.2.27
-funcs_1.is_tables_embedded : Include file modified in 10.2.27
-funcs_1.is_tables_innodb : Include file modified in 10.2.27
-funcs_1.is_tables_memory : Include file modified in 10.2.27
-funcs_1.is_tables_myisam : Include file modified in 10.2.27
-funcs_1.is_tables_myisam_embedded : Include file modified in 10.2.27
-funcs_1.is_triggers : Include file modified in 10.2.27
-funcs_1.is_triggers_embedded : Include file modified in 10.2.27
-funcs_1.memory_storedproc_07 : Include file modified in 10.2.27
-funcs_1.memory_storedproc_08 : Include file modified in 10.2.27
-funcs_1.memory_trig_03e : Modified in 10.2.27
-funcs_1.memory_views : MDEV-11773 - timeout
-funcs_1.myisam_storedproc_07 : Include file modified in 10.2.27
-funcs_1.myisam_storedproc_08 : Include file modified in 10.2.27
-funcs_1.myisam_trig_03e : Modified in 10.2.27
-funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
-funcs_1.processlist_val_ps : MDEV-12175 - Wrong plan
-funcs_1.storedproc : Modified in 10.2.27
+funcs_1.memory_views : MDEV-11773 - timeout
+funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
+funcs_1.processlist_val_ps : MDEV-12175 - Wrong plan
#-----------------------------------------------------------------------
@@ -410,8 +273,7 @@ funcs_2.myisam_charset : MDEV-11535 - Timeout
#-----------------------------------------------------------------------
-funcs_2/charset.* : MDEV-10999 - Not maintained
-funcs_2/charset.charset_master : Modified in 10.2.27
+funcs_2/charset.* : MDEV-10999 - Not maintained
#-----------------------------------------------------------------------
@@ -423,74 +285,69 @@ galera_3nodes.* : Suite is not stable yet
#-----------------------------------------------------------------------
-gcol.gcol_rollback : MDEV-16954 - Unknown storage engine 'InnoDB'
-gcol.gcol_select_innodb : Include file modified in 10.2.27
-gcol.gcol_select_myisam : Include file modified in 10.2.27
-gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion; modified in 10.2.27
-gcol.innodb_virtual_debug : MDEV-19114 - Assertion failure
-gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result; modified in 10.2.28
-gcol.innodb_virtual_index : Modified in 10.2.27
+gcol.gcol_keys_innodb : Include file modified in 10.2.35
+gcol.gcol_keys_myisam : Include file modified in 10.2.35
+gcol.gcol_partition_innodb : Include file modified in 10.2.35
+gcol.gcol_update : Include file modified in 10.2.35
+gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion
+gcol.innodb_virtual_debug : MDEV-23111 - Server crash
+gcol.innodb_virtual_debug_purge : Include file modified in 10.2.35
+gcol.innodb_virtual_fk : Modified in 10.2.35
+gcol.innodb_virtual_index : Modified in 10.2.35
+gcol.innodb_virtual_purge : Include file modified in 10.2.35
#-----------------------------------------------------------------------
innodb.101_compatibility : MDEV-13891 - Wrong result
-innodb.alter_copy : MDEV-16181 - Assertion failure; modified in 10.2.27
+innodb.alter_copy : MDEV-16181 - Assertion failure
innodb.alter_crash : MDEV-16944 - The process cannot access the file
-innodb.auto_increment_dup : Modified in 10.2.27
-innodb.autoinc_persist : MDEV-15282 - Assertion failure
+innodb.alter_table : Modified in 10.2.35
innodb.binlog_consistent : MDEV-10618 - Server fails to start
+innodb.blob-crash : MDEV-20481 - Failures upon recovery
innodb.doublewrite : MDEV-12905 - Server crash
-innodb.foreign-keys : Modified in 10.2.27
-innodb.foreign_key : Modified in 10.2.27
+innodb.foreign-keys : Modified in 10.2.35
+innodb.foreign_key : Modified in 10.2.35
innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed
-innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure
-innodb.ibuf_not_empty : MDEV-19021 - Wrong result; modified in 10.2.28
-innodb.information_schema_grants : Added in 10.2.28
+innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch
+innodb.ibuf_not_empty : MDEV-19021 - Wrong result
+innodb.innodb : Modified in 10.2.35
+innodb.innodb-64k : Modified in 10.2.35
innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup
-innodb.innodb-alter : Modified in 10.2.27
innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
-innodb.innodb-autoinc : Modified in 10.2.28
innodb.innodb-blob : MDEV-12053 - Client crash
-innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query; modified in 10.2.28
+innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query
innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown
-innodb.innodb-fkcheck : Modified in 10.2.27
-innodb.innodb-get-fk : MDEV-13276 - Server crash; modified in 10.2.27
+innodb.innodb-get-fk : MDEV-13276 - Server crash
+innodb.innodb-index : Include file modified in 10.2.35
+innodb.innodb-index-debug : Include file modified in 10.2.35
innodb.innodb-index-online : MDEV-14809 - Cannot save statistics
-innodb.innodb-mdev7046 : Modified in 10.2.27
innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure
innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result
innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
-innodb.innodb-read-view : Added in 10.2.27
-innodb.innodb-system-table-view : Configuration modified in 10.2.27
innodb.innodb-table-online : MDEV-13894 - Wrong result
-innodb.innodb-virtual-columns-debug : Modified in 10.2.28
-innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno; modified in 10.2.27
+innodb.innodb-wl5522-1 : MDEV-22945 - Server crash
+innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno
innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc
innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt
innodb.innodb_bug30423 : MDEV-7311 - Wrong result
innodb.innodb_bug47167 : MDEV-20524 - Table 'user' is marked as crashed and should be repaired
innodb.innodb_bug48024 : MDEV-14352 - Assertion failure
-innodb.innodb_bug59641 : MDEV-13830 - Assertion failure
-innodb.innodb_bug68148 : Modified in 10.2.27
-innodb.innodb_bug84958 : Added in 10.2.27
-innodb.innodb_bulk_create_index_debug : Include file modified in 10.2.27
-innodb.innodb_bulk_create_index_flush : Configuration added in 10.2.27
innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to start
innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full
-innodb.innodb_force_recovery : Modified in 10.2.28
innodb.innodb_information_schema : MDEV-8851 - Wrong result
innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed
innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mysql : MDEV-19873 - Wrong result
innodb.innodb_stats : MDEV-10682 - wrong result
-innodb.innodb_stats_persistent : Modified in 10.2.28
+innodb.innodb_stats_drop_locked : Modified in 10.2.35
+innodb.innodb_stats_persistent : MDEV-21567 - Wrong result in execution plan
innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed
innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait
+innodb.innodb_trx_weight : Configuration deleted in 10.2.35
innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks
-innodb.log_alter_table : Configuration added in 10.2.27
innodb.log_corruption : MDEV-13251 - Wrong result
innodb.log_data_file_size : MDEV-14204 - Server failed to start
innodb.log_file_name : MDEV-14193 - Exception
@@ -499,79 +356,80 @@ innodb.monitor : MDEV-16179 - Wrong result
innodb.purge_secondary : MDEV-15681 - Wrong result
innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
-innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile; modified in 10.2.27
-innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace
-innodb.stat_tables : Added in 10.2.28
+innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile
+innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace; modified in 10.2.35
+innodb.stats_persistent : Added in 10.2.35
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning
innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start
+innodb.temp_table_savepoint : MDEV-24077 - Assertion failure
innodb.temporary_table : MDEV-13265 - Wrong result
-innodb.temporary_table_optimization : Modified in 10.2.28
-innodb.trx_id_future : Modified in 10.1.42
+innodb.truncate : Modified in 10.2.35
innodb.undo_truncate : MDEV-17340 - Server hung
-innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away; modified in 10.2.27
+innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away
+innodb.update-cascade : Combinations added in 10.2.35
innodb.update_time : MDEV-14804 - Wrong result
innodb.xa_recovery : MDEV-15279 - mysqld got exception
#-----------------------------------------------------------------------
-innodb_fts.concurrent_insert : Modified in 10.2.28
-innodb_fts.crash_recovery : Modified in 10.2.28
-innodb_fts.innodb_fts_misc : Modified in 10.2.28
+innodb_fts.basic : Modified in 10.2.35
+innodb_fts.fulltext2 : MDEV-24074 - Server crash
+innodb_fts.innodb_fts_misc_1 : Modified in 10.2.35
innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning
innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log
innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed
-innodb_fts.sync : MDEV-14808 - Wrong result
+innodb_fts.sync_ddl : MDEV-21568 - Errno: 2000
#-----------------------------------------------------------------------
-innodb_gis.rtree_compress2 : Modified in 10.2.27
+innodb_gis.gis_split_nan : MDEV-21678 - Cannot get geometry object
+innodb_gis.rtree_add_index : Include file modified in 10.2.35
+innodb_gis.rtree_compress : Include file modified in 10.2.35
innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded
-innodb_gis.rtree_purge : MDEV-15275 - Timeout
+innodb_gis.rtree_purge : MDEV-15275 - Timeout; include file modified in 10.2.35
innodb_gis.rtree_recovery : MDEV-15274 - Error on check
innodb_gis.rtree_split : MDEV-14208 - Too many arguments
-innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file
+innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file; include file modified in 10.2.35
innodb_gis.types : MDEV-15679 - Table is marked as crashed
-innodb_gis.update_root : Modified in 10.2.27
#-----------------------------------------------------------------------
-innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed
-innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings
-innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.2.27
-innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure
-innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket
-innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192
+innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed
+innodb_zip.create_options : MDEV-24076 - Assertion failure
+innodb_zip.index_large_prefix_4k : MDEV-21679 - Row size too large
+innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings
+innodb_zip.recover : MDEV-22512 - Server fails to restart (Fixed in 10.5+)
+innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2
+innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure
+innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket
+innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192
#-----------------------------------------------------------------------
-maria.icp : Modified in 10.2.27
maria.insert_select : MDEV-12757 - Timeout
maria.insert_select-7314 : MDEV-16492 - Timeout
-maria.lock : Modified in 10.2.28
maria.maria : MDEV-14430 - Extra warning
-maria.maria-big : Modified in 10.2.27
-maria.maria-gis-recovery : Modified in 10.2.27
-maria.maria-no-logging : Modified in 10.2.27
-maria.maria-recover : Modified in 10.2.27
-maria.maria-recovery : Modified in 10.2.27
-maria.maria3 : Modified in 10.2.27
#-----------------------------------------------------------------------
-mariabackup.apply-log-only : MDEV-20135 - Timeout
-mariabackup.big_innodb_log : Added in 10.2.27
-mariabackup.data_directory : MDEV-15270 - Error on exec
-mariabackup.extra_lsndir_stream : Added in 10.2.28
-mariabackup.full_backup : MDEV-16571 - Wrong result
-mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future
-mariabackup.incremental_encrypted : MDEV-15667 - Timeout
-mariabackup.mdev-14447 : MDEV-15201 - Timeout
-mariabackup.mdev-18438 : Added in 10.2.28
-mariabackup.partial : Modified in 10.2.28
-mariabackup.partial_exclude : MDEV-15270 - Error on exec
-mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
-mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11
-mariabackup.xb_partition : MDEV-17584 - Crash on shutdown
+mariabackup.apply-log-only : MDEV-20135 - Timeout
+mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown
+mariabackup.data_directory : MDEV-15270 - Error on exec
+mariabackup.ddl_incremental_encrypted : Added in 10.2.35
+mariabackup.full_backup : MDEV-16571 - Wrong result
+mariabackup.huge_lsn : MDEV-17286 - SSL error
+mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure
+mariabackup.incremental_ddl_during_backup : Modified in 10.2.35
+mariabackup.incremental_encrypted : MDEV-15667 - Timeout
+mariabackup.innodb_redo_overwrite : Added in 10.2.35
+mariabackup.mdev-14447 : MDEV-15201 - Timeout
+mariabackup.mlog_index_load : Modified in 10.2.35
+mariabackup.partial_exclude : MDEV-15270 - Error on exec
+mariabackup.rpl_slave_info : Added in 10.2.35
+mariabackup.unencrypted_page_compressed : Include file modified in 10.2.35
+mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
+mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11
+mariabackup.xb_partition : MDEV-17584 - Crash on shutdown
#-----------------------------------------------------------------------
@@ -591,7 +449,8 @@ mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message
#-----------------------------------------------------------------------
multi_source.gtid : MDEV-14202 - Crash
-multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - wrong result
+multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - Wrong result, MDEV-21290 - Wrong result
+multi_source.mdev-8874 : MDEV-19415 - AddressSanitizer: heap-use-after-free
multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free
multi_source.multisource : MDEV-10417 - Fails on Mips
multi_source.reset_slave : MDEV-10690 - Wrong result
@@ -603,69 +462,38 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h
parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query
parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired
parts.partition_auto_increment_maria : MDEV-14430 - Extra warning
-parts.partition_debug : Modified in 10.2.28
-parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.2.28
-parts.partition_debug_myisam : Modified in 10.2.28
+parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
-parts.partition_exch_qa_4_innodb : Include file modified in 10.2.27
-parts.partition_exch_qa_4_myisam : Include file modified in 10.2.27
-parts.partition_exch_qa_8_innodb : Include file modified in 10.2.27
-parts.partition_exch_qa_8_myisam : Include file modified in 10.2.27
parts.partition_innodb_status_file : MDEV-12901 - Valgrind
-parts.partition_mgm_lc0_archive : Include file modified in 10.2.27
-parts.partition_mgm_lc0_innodb : Include file modified in 10.2.27
-parts.partition_mgm_lc0_memory : Include file modified in 10.2.27
-parts.partition_mgm_lc0_myisam : Include file modified in 10.2.27
-parts.partition_mgm_lc1_archive : Include file modified in 10.2.27
-parts.partition_mgm_lc1_innodb : Include file modified in 10.2.27
-parts.partition_mgm_lc1_memory : Include file modified in 10.2.27
-parts.partition_mgm_lc1_myisam : Include file modified in 10.2.27
-parts.partition_mgm_lc2_archive : Include file modified in 10.2.27
-parts.partition_mgm_lc2_innodb : Include file modified in 10.2.27
-parts.partition_mgm_lc2_memory : Include file modified in 10.2.27
-parts.partition_mgm_lc2_myisam : Include file modified in 10.2.27
parts.partition_special_innodb : MDEV-16942 - Timeout
-parts.reorganize_partition_innodb : Added in 10.2.28
-
-#-----------------------------------------------------------------------
-
-percona.* : MDEV-10997 - Not maintained
-
-#-----------------------------------------------------------------------
-
-perfschema.connect_attrs : MDEV-17283 - Wrong result
-perfschema.dml_file_instances : MDEV-15179 - Wrong result
-perfschema.dml_threads : MDEV-17746 - Wrong errno
-perfschema.func_file_io : MDEV-5708 - fails for s390x
-perfschema.func_mutex : MDEV-5708 - fails for s390x
-perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash
-perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash; configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_again_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash; configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_bad_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_good_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_good_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_noname_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_noname_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_auth_plugin : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_blocked : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_max_con : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_again_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_again_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_noname_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_noname_deny : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_passwd : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash; configuration modified in 10.2.27
-perfschema.privilege_table_io : MDEV-13184 - Extra lines
-perfschema.rpl_gtid_func : MDEV-16897 - Wrong result
-perfschema.socket_instances_func : MDEV-20140 - Wrong result
-perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result
-perfschema.socket_summary_by_instance_func : MDEV-19413 - Wrong result
-perfschema.stage_mdl_function : Include file modified in 10.2.27
-perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders; include file modified in 10.2.27
-perfschema.stage_mdl_procedure : MDEV-11545 - Missing row; include file modified in 10.2.27
-perfschema.stage_mdl_table : MDEV-12638 - Wrong result; include file modified in 10.2.27
-perfschema.threads_mysql : MDEV-10677 - Wrong result
+
+#-----------------------------------------------------------------------
+
+percona.* : MDEV-10997 - Not maintained (Fixed in 10.3+)
+
+#-----------------------------------------------------------------------
+
+perfschema.bad_option_1 : MDEV-21571 - Crash on bootstrap
+perfschema.connect_attrs : MDEV-17283 - Wrong result
+perfschema.dml_file_instances : MDEV-15179 - Wrong result
+perfschema.dml_threads : MDEV-17746 - Wrong errno
+perfschema.func_file_io : MDEV-5708 - fails for s390x
+perfschema.func_mutex : MDEV-5708 - fails for s390x
+perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash
+perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash
+perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash
+perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash
+perfschema.privilege_table_io : MDEV-13184 - Extra lines
+perfschema.relaylog : MDEV-24075 - Extra warning
+perfschema.rpl_gtid_func : MDEV-16897 - Wrong result
+perfschema.socket_instances_func : MDEV-20140 - Wrong result
+perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result
+perfschema.socket_summary_by_instance_func : MDEV-19413 - Wrong result
+perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders
+perfschema.stage_mdl_procedure : MDEV-11545 - Missing row
+perfschema.stage_mdl_table : MDEV-12638 - Wrong result
+perfschema.start_server_low_digest : MDEV-21221 - Wrong result
+perfschema.threads_mysql : MDEV-10677 - Wrong result
#-----------------------------------------------------------------------
@@ -673,11 +501,9 @@ perfschema_stress.* : MDEV-10996 - Not maintained
#-----------------------------------------------------------------------
-plugins.feedback_plugin_load : Modified in 10.2.28
plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such
plugins.processlist : MDEV-16574 - Wrong result
-plugins.qc_info : Modified in 10.2.27
-plugins.server_audit : MDEV-9562 - crashes on sol10-sparc
+plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.2.35
plugins.thread_pool_server_audit : MDEV-14295 - Wrong result
#-----------------------------------------------------------------------
@@ -693,7 +519,6 @@ rocksdb.drop_index_inplace : MDEV-14162 - Crash on shutdown
rocksdb.drop_table : MDEV-14308 - Timeout
rocksdb.drop_table3 : MDEV-16949 - Server crash
rocksdb.dup_key_update : MDEV-17284 - Wrong result
-rocksdb.index_merge_rocksdb2 : Include file modified in 10.2.28
rocksdb.locking_issues : MDEV-14464 - Wrong result
rocksdb.mariadb_ignore_dirs : MDEV-16639 - Server crash
rocksdb.mariadb_port_fixes : MDEV-16387 - Wrong plan
@@ -714,116 +539,107 @@ rocksdb_rpl.rpl_binlog_xid_count : MDEV-16644 - Server crash
#-----------------------------------------------------------------------
-roles.acl_statistics : Configuration added in 10.2.27
-roles.create_and_grant_role : MDEV-11772 - wrong result
-roles.definer : Modified in 10.2.27
-roles.show_create_database-10463 : Modified in 10.2.27
-
-#-----------------------------------------------------------------------
-
-rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free
-rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server
-rpl.create_or_replace_mix : MDEV-20523 - Wrong result
-rpl.create_or_replace_statement : MDEV-20523 - Wrong result
-rpl.create_select : MDEV-14121 - Assertion failure
-rpl.last_insert_id : MDEV-10625 - warnings in error log
-rpl.mdev_17588 : Modified in 10.2.27
-rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
-rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
-rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
-rpl.rpl_binlog_errors : MDEV-12742 - Crash
-rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master
-rpl.rpl_colSize : MDEV-16112 - Server crash
-rpl.rpl_create_or_replace_fail : Added in 10.2.27
-rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac
-rpl.rpl_ddl : MDEV-10417 - Fails on Mips
-rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
-rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors
-rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
-rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start
-rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning
-rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning
-rpl.rpl_failed_drop_tbl_binlog : Added in 10.2.27
-rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output
-rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
-rpl.rpl_gtid_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection
-rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout
-rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash
-rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings
-rpl.rpl_gtid_reconnect : MDEV-14497 - Crash
-rpl.rpl_gtid_startpos : MDEV-20141 - mysqltest failed but provided no output
-rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings
-rpl.rpl_gtid_until : MDEV-10625 - warnings in error log
-rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips
-rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
-rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
-rpl.rpl_insert_id : MDEV-15197 - Wrong result
-rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure
-rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query
-rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
-rpl.rpl_known_bugs_detection : Modified in 10.2.27
-rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog
-rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors
-rpl.rpl_mdev6020 : MDEV-15272 - Server crash
-rpl.rpl_mdev_17614 : Added in 10.2.27
-rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed
-rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed
-rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait
-rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_master
-rpl.rpl_parallel : MDEV-10653 - Timeouts
-rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash
-rpl.rpl_parallel_ignored_errors : Added in 10.2.28
-rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
-rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout
-rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master
-rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master
-rpl.rpl_parallel_retry : MDEV-11119 - Crash; MDEV-17109 - Timeout
-rpl.rpl_parallel_temptable : MDEV-10356 - Crash; MDEV-19076 - Wrong result
-rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
-rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings
-rpl.rpl_row_001 : MDEV-16653 - Internal check fails
-rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
-rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed
-rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result
-rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed
-rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed
-rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed
-rpl.rpl_row_index_choice : MDEV-15196 - Slave crash
-rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
-rpl.rpl_row_type_conv_err_msg : Added in 10.2.27
-rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum
-rpl.rpl_semi_sync : MDEV-11220 - Wrong result
-rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result
-rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result
-rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
-rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures
-rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
-rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning
-rpl.rpl_show_slave_hosts : MDEV-10681 - Crash
-rpl.rpl_skip_replication : MDEV-13258 - Extra warning
-rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock
-rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 - Extra warning
-rpl.rpl_slow_query_log : MDEV-13250 - Test abort
-rpl.rpl_sp_effects : MDEV-13249 - Crash
-rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout
-rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed
-rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master
-rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion
-rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash
-rpl.rpl_sync : MDEV-13830 - Assertion failure
-rpl.rpl_sync_with_innodb_thd_conc : Added in 10.2.27
-rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master
-rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
-rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output
-rpl.rpl_trigger : MDEV-18055 - Wrong result
-rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error
-rpl.rpl_unsafe_statements : Modified in 10.1.42
-rpl.rpl_user_variables : MDEV-20522 - Wrong result
-rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
-
-#-----------------------------------------------------------------------
-
-rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc
+roles.create_and_grant_role : MDEV-11772 - wrong result
+
+#-----------------------------------------------------------------------
+
+rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free
+rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server
+rpl.create_or_replace_mix : MDEV-20523 - Wrong result
+rpl.create_or_replace_statement : MDEV-20523 - Wrong result
+rpl.create_select : MDEV-14121 - Assertion failure
+rpl.last_insert_id : MDEV-10625 - warnings in error log
+rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
+rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
+rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
+rpl.rpl_binlog_errors : MDEV-12742 - Crash
+rpl.rpl_binlog_index : Modified in 10.2.35
+rpl.rpl_checksum_cache : MDEV-22510 - Server crash
+rpl.rpl_colSize : MDEV-16112 - Server crash
+rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac
+rpl.rpl_ddl : MDEV-10417 - Fails on Mips
+rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
+rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors
+rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
+rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start
+rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning
+rpl.rpl_filter_tables_dynamic : Modified in 10.2.35
+rpl.rpl_filter_wild_tables_dynamic : Modified in 10.2.35
+rpl.rpl_flushlog_loop : MDEV-21570 - Server crash
+rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output
+rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
+rpl.rpl_gtid_crash : MDEV-13643 - Lost connection; modified in 10.2.35
+rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; MDEV-23103 - Could not delete gtid domain; modified in 10.2.35
+rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash
+rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings
+rpl.rpl_gtid_reconnect : MDEV-14497 - Crash
+rpl.rpl_gtid_startpos : MDEV-20141 - mysqltest failed but provided no output
+rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings
+rpl.rpl_gtid_until : MDEV-10625 - warnings in error log
+rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips
+rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_insert_id : MDEV-15197 - Wrong result
+rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure
+rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query
+rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
+rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog
+rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors
+rpl.rpl_mdev6020 : MDEV-23426 - Server crash, ASAN failures; MDEV-15272 - Server crash
+rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout
+rpl.rpl_mysql_upgrade : Modified in 10.2.35
+rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait
+rpl.rpl_parallel : MDEV-10653 - Timeouts
+rpl.rpl_parallel2 : Modified in 10.2.35
+rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash
+rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
+rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout
+rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master
+rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master
+rpl.rpl_parallel_optimistic_until : MDEV-23021 - Query didn't return a result set
+rpl.rpl_parallel_retry : MDEV-11119 - Crash; MDEV-17109 - Timeout
+rpl.rpl_parallel_temptable : MDEV-10356 - Crash; MDEV-19076 - Wrong result
+rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
+rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings
+rpl.rpl_rewrt_db : MDEV-24060 - Server did not start
+rpl.rpl_row_001 : MDEV-16653 - Internal check fails
+rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
+rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed
+rpl.rpl_row_corruption : MDEV-21569 - mutex: LOCK_global_system_variables unlocking
+rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result
+rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed
+rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed
+rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed
+rpl.rpl_row_index_choice : MDEV-15196 - Slave crash
+rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum
+rpl.rpl_semi_sync : MDEV-11220 - Wrong result
+rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result
+rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result
+rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
+rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures
+rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
+rpl.rpl_show_slave_hosts : MDEV-10681 - Crash
+rpl.rpl_skip_replication : MDEV-23372 - Extra warning
+rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock; ; modified in 10.2.35
+rpl.rpl_slave_load_tmpdir_not_exist : MDEV-23372 - Extra warning
+rpl.rpl_slow_query_log : MDEV-13250 - Test abort
+rpl.rpl_sp_effects : MDEV-13249 - Crash
+rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout; modified in 10.2.35
+rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion
+rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash
+rpl.rpl_sync : MDEV-10633 - Database page corruption
+rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
+rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output
+rpl.rpl_trigger : MDEV-18055 - Wrong result
+rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error
+rpl.rpl_user_variables : MDEV-20522 - Wrong result
+rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
+rpl.show_status_stop_slave_race-7126 : Modified in 10.2.35
+
+#-----------------------------------------------------------------------
+
+rpl-tokudb.* : MDEV-14354 - Tests failing with tcmalloc
#-----------------------------------------------------------------------
@@ -831,8 +647,7 @@ rpl/extra/rpl_tests.* : MDEV-10994 - Not maintained
#-----------------------------------------------------------------------
-sphinx.* : MDEV-10986 - Tests have not been maintained
-sphinx.sphinx : Modified in 10.2.28
+sphinx.* : MDEV-10986 - Tests have not been maintained
#-----------------------------------------------------------------------
@@ -841,15 +656,12 @@ spider.basic_sql : MDEV-11186 - Internal check fails
#-----------------------------------------------------------------------
-spider/bg.direct_aggregate : MDEV-7098 - Packets out of order
-spider/bg.direct_aggregate_part : MDEV-7098 - Trying to unlock mutex that wasn't locked
-spider/bg.ha : MDEV-9329 - failures on s390x
-spider/bg.ha_part : MDEV-9329 - Fails on Ubuntu/s390x
-spider/bg.spider3_fixes : MDEV-12639 - Syntax error
-spider/bg.spider3_fixes_part : MDEV-7098 - Trying to unlock mutex
-spider/bg.spider_fixes : MDEV-7098 -Mutex problem, MDEV-9329 - failures on s390x
-spider/bg.spider_fixes_part : MDEV-7098 - Trying to unlock mutex that wasn't locked
-spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x
+spider/bg.* : MDEV-24059 - Timeout
+spider/bg.ha : MDEV-9329 - failures on s390x
+spider/bg.ha_part : MDEV-9329 - Fails on Ubuntu/s390x
+spider/bg.spider3_fixes : MDEV-12639 - Syntax error
+spider/bg.spider_fixes : MDEV-9329 - failures on s390x
+spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x
#-----------------------------------------------------------------------
@@ -865,46 +677,19 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
#-----------------------------------------------------------------------
-sys_vars.aria_recover_options_basic : Modified in 10.2.27
sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.binlog_cache_size_basic : Modified in 10.2.27
-sys_vars.binlog_stmt_cache_size_basic : Modified in 10.2.27
-sys_vars.character_set_client_basic : Modified in 10.2.27
-sys_vars.character_set_connection_basic : Modified in 10.2.27
-sys_vars.character_set_database_basic : Modified in 10.2.27
-sys_vars.character_set_results_basic : Modified in 10.2.27
-sys_vars.character_set_server_basic : Modified in 10.2.27
-sys_vars.character_set_server_func : Modified in 10.2.27
-sys_vars.collation_connection_basic : Modified in 10.2.27
-sys_vars.collation_database_basic : Modified in 10.2.27
-sys_vars.collation_server_basic : Modified in 10.2.27
-sys_vars.delayed_insert_limit_func : Modified in 10.2.28
-sys_vars.expire_logs_days_basic : Modified in 10.2.27
-sys_vars.histogram_size_basic : Modified in 10.2.27
sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
-sys_vars.innodb_change_buffering_debug_basic : Modified in 10.2.28
-sys_vars.innodb_max_dirty_pages_pct_basic : Modified in 10.2.27
-sys_vars.innodb_max_dirty_pages_pct_lwm_basic : Modified in 10.2.27
-sys_vars.innodb_read_io_threads_basic : Configuration added in 10.2.27
-sys_vars.innodb_write_io_threads_basic : Configuration added in 10.2.27
+sys_vars.innodb_checksum_algorithm_basic : MDEV-21568 - Errno: 2000
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash
-sys_vars.log_slow_verbosity_basic : Modified in 10.2.27
-sys_vars.max_connect_errors_basic : Modified in 10.2.27
-sys_vars.max_connections_basic : Modified in 10.2.27
-sys_vars.max_heap_table_size_basic : Modified in 10.2.27
-sys_vars.max_seeks_for_key_func : Modified in 10.2.27
-sys_vars.myisam_recover_options_basic : Configuration added in 10.2.27
-sys_vars.myisam_sort_buffer_size_basic : Modified in 10.2.27
-sys_vars.optimizer_switch_basic : Modified in 10.2.27
-sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion
+sys_vars.replicate_do_db_basic : Modified in 10.2.35
+sys_vars.rpl_init_slave_func : Modified in 10.2.35
+sys_vars.session_track_system_variables_basic : Modified in 10.2.35
sys_vars.slow_query_log_func : MDEV-14273 - Wrong result
-sys_vars.sysvars_innodb : Modified in 10.2.28
-sys_vars.sysvars_server_embedded : Include file modified in 10.2.27
-sys_vars.sysvars_server_notembedded : Include file modified in 10.2.27
sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result
-sys_vars.userstat_basic : Modified in 10.2.27
sys_vars.wait_timeout_func : MDEV-12896 - Wrong result
+sys_vars.wsrep_cluster_address_basic : Modified in 10.2.35
+sys_vars.wsrep_on_basic : Configuration deleted in 10.2.35
#-----------------------------------------------------------------------
@@ -912,10 +697,6 @@ tokudb.change_column_all_1000_10 : MDEV-12640 - Lost connection
tokudb.change_column_bin : MDEV-12640 - Lost connection
tokudb.change_column_char : MDEV-12822 - Lost connection
tokudb.change_column_varbin : MDEV-17682 - Timeout
-tokudb.cluster_2968-0 : Modified in 10.2.27
-tokudb.cluster_2968-1 : Modified in 10.2.27
-tokudb.cluster_2968-2 : Modified in 10.2.27
-tokudb.cluster_2968-3 : Modified in 10.2.27
tokudb.cluster_filter : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan
tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan
@@ -933,7 +714,6 @@ tokudb.rows-32m-rand-insert : MDEV-12640 - Crash
tokudb.rows-32m-seq-insert : MDEV-12640 - Crash
tokudb.savepoint-5 : MDEV-15280 - Wrong result
tokudb.type_datetime : MDEV-15193 - Wrong result
-tokudb.type_varchar : Modified in 10.2.27
#-----------------------------------------------------------------------
@@ -954,14 +734,7 @@ tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
#-----------------------------------------------------------------------
-tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
-tokudb_parts.partition_debug_tokudb : Include file modified in 10.2.28
-tokudb_parts.partition_exch_qa_4_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_exch_qa_8_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc0_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc10_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc1_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc2_tokudb : Include file modified in 10.2.27
+tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
#-----------------------------------------------------------------------
@@ -981,29 +754,21 @@ unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236
unit.ma_pagecache_consist_64kRD : MDEV-19367 - AddressSanitizer CHECK failed
unit.ma_pagecache_consist_64kWR : MDEV-19367 - AddressSanitizer CHECK failed
unit.ma_test_loghandler : MDEV-10638 - record read not ok
+unit.mf_iocache : MDEV-20952 - Buffer overflow
#-----------------------------------------------------------------------
-vcol.cross_db : Modified in 10.2.27
-vcol.not_supported : MDEV-10639 - Testcase timeout
-vcol.update : Modified in 10.2.27
-vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout; modified in 10.2.28
-vcol.vcol_misc : MDEV-16651 - Wrong error message
-vcol.vcol_select_innodb : Modified in 10.2.27
-vcol.vcol_select_myisam : Modified in 10.2.27
-vcol.vcol_sql_mode : Added in 10.2.27
-vcol.vcol_sql_mode_upgrade : Added in 10.2.27
-vcol.vcol_trigger_sp_innodb : Include file modified in 10.2.27
-vcol.vcol_trigger_sp_myisam : Include file modified in 10.2.27
+vcol.not_supported : MDEV-10639 - Testcase timeout
+vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
+vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.2.35
#-----------------------------------------------------------------------
-wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
-wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
-wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.2.27
-wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use
-wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock
+wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
+wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
+wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use
+wsrep.variables : Modified in 10.2.35
#-----------------------------------------------------------------------
-wsrep_info.plugin : MDEV-13569 - No nodes coming from prim view
+wsrep_info.plugin : MDEV-22470 - WSREP: no nodes coming from prim view, prim not possible
diff --git a/mysys/hash.c b/mysys/hash.c
index 2c45ac35710..d5903df40bd 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -116,17 +116,23 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
static inline void my_hash_free_elements(HASH *hash)
{
uint records= hash->records;
+ if (records == 0)
+ return;
+
/*
Set records to 0 early to guard against anyone looking at the structure
during the free process
*/
hash->records= 0;
+
if (hash->free)
{
HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*);
HASH_LINK *end= data + records;
- while (data < end)
+ do
+ {
(*hash->free)((data++)->data);
+ } while (data < end);
}
}
@@ -786,14 +792,13 @@ void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record,
my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument)
{
uint records, i;
- HASH_LINK *data;
records= hash->records;
- data= dynamic_element(&hash->array,0,HASH_LINK*);
for (i= 0 ; i < records ; i++)
{
- if ((*action)(data[i].data, argument))
+ if ((*action)(dynamic_element(&hash->array, i, HASH_LINK *)->data,
+ argument))
return 1;
}
return 0;
diff --git a/mysys/list.c b/mysys/list.c
index 10dfd7ec6ef..65da5d452cc 100644
--- a/mysys/list.c
+++ b/mysys/list.c
@@ -14,7 +14,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/*
- Code for handling dubble-linked lists in C
+ Code for handling doubly linked lists in C
*/
#include "mysys_priv.h"
@@ -22,7 +22,7 @@
- /* Add a element to start of list */
+ /* Add an element to start of list */
LIST *list_add(LIST *root, LIST *element)
{
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index d7689e204b6..e09c7f930c8 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates
- Copyright (c) 2010, 2015, MariaDB
+ Copyright (c) 2010, 2020, 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
@@ -250,7 +250,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
info->write_buffer= info->buffer + cachesize;
else
info->write_buffer= info->buffer;
- info->alloced_buffer= 1;
+ info->alloced_buffer= buffer_block;
break; /* Enough memory found */
}
if (cachesize == min_cache)
@@ -324,14 +324,14 @@ int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave)
DBUG_ASSERT(!master->share);
DBUG_ASSERT(master->alloced_buffer);
- if (!(slave_buf= (uchar*)my_malloc(master->buffer_length, MYF(0))))
+ if (!(slave_buf= (uchar*)my_malloc(master->alloced_buffer, MYF(0))))
{
return 1;
}
memcpy(slave, master, sizeof(IO_CACHE));
slave->buffer= slave_buf;
- memcpy(slave->buffer, master->buffer, master->buffer_length);
+ memcpy(slave->buffer, master->buffer, master->alloced_buffer);
slave->read_pos= slave->buffer + (master->read_pos - master->buffer);
slave->read_end= slave->buffer + (master->read_end - master->buffer);
@@ -804,7 +804,8 @@ int _my_b_cache_read(IO_CACHE *info, uchar *Buffer, size_t Count)
info->read_pos=info->buffer+Count;
info->read_end=info->buffer+length;
info->pos_in_file=pos_in_file;
- memcpy(Buffer, info->buffer, Count);
+ if (Count)
+ memcpy(Buffer, info->buffer, Count);
DBUG_RETURN(0);
}
@@ -1305,7 +1306,8 @@ static int _my_b_cache_read_r(IO_CACHE *cache, uchar *Buffer, size_t Count)
DBUG_RETURN(1);
}
cnt= (len > Count) ? Count : len;
- memcpy(Buffer, cache->read_pos, cnt);
+ if (cnt)
+ memcpy(Buffer, cache->read_pos, cnt);
Count -= cnt;
Buffer+= cnt;
left_length+= cnt;
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index 7590d576a7c..3a49c749010 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -56,6 +56,18 @@ static ElfW(Addr) offset= 0;
#define offset 0
#endif
+#ifndef bfd_get_section_flags
+#define bfd_get_section_flags(H, S) bfd_section_flags(S)
+#endif /* bfd_get_section_flags */
+
+#ifndef bfd_get_section_size
+#define bfd_get_section_size(S) bfd_section_size(S)
+#endif /* bfd_get_section_size */
+
+#ifndef bfd_get_section_vma
+#define bfd_get_section_vma(H, S) bfd_section_vma(S)
+#endif /* bfd_get_section_vma */
+
/**
finds a file name, a line number, and a function name corresponding to addr.
@@ -147,10 +159,18 @@ err:
#include <ctype.h>
#include <sys/wait.h>
+#if defined(HAVE_POLL_H)
+#include <poll.h>
+#elif defined(HAVE_SYS_POLL_H)
+#include <sys/poll.h>
+#endif /* defined(HAVE_POLL_H) */
+
static int in[2], out[2];
static pid_t pid;
static char addr2line_binary[1024];
static char output[1024];
+static struct pollfd poll_fds;
+Dl_info info;
int start_addr2line_fork(const char *binary_path)
{
@@ -200,15 +220,16 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
ssize_t extra_bytes_read = 0;
ssize_t parsed = 0;
- fd_set set;
- struct timeval timeout;
+ int ret;
int filename_start = -1;
int line_number_start = -1;
- Dl_info info;
void *offset;
+ poll_fds.fd = out[0];
+ poll_fds.events = POLLIN | POLLRDBAND;
+
if (!dladdr(ptr, &info))
return 1;
@@ -230,16 +251,16 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
if (write(in[1], input, len) <= 0)
return 3;
- FD_ZERO(&set);
- FD_SET(out[0], &set);
- /* 100 ms should be plenty of time for addr2line to issue a response. */
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
+ /* 500 ms should be plenty of time for addr2line to issue a response. */
/* Read in a loop till all the output from addr2line is complete. */
while (parsed == total_bytes_read &&
- select(out[0] + 1, &set, NULL, NULL, &timeout) > 0)
+ (ret= poll(&poll_fds, 1, 500)))
{
+ /* error during poll */
+ if (ret < 0)
+ return 1;
+
extra_bytes_read= read(out[0], output + total_bytes_read,
sizeof(output) - total_bytes_read);
if (extra_bytes_read < 0)
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 3b614cb4c15..5bfcb455b8a 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates
+ Copyright (c) 2010, 2020, 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
@@ -449,7 +450,8 @@ char *strmake_root(MEM_ROOT *root, const char *str, size_t len)
char *pos;
if ((pos=alloc_root(root,len+1)))
{
- memcpy(pos,str,len);
+ if (len)
+ memcpy(pos,str,len);
pos[len]=0;
}
return pos;
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index c79c5a2d324..f857101af02 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -255,7 +255,8 @@ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
{
my_bool res;
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_lock(map);
res= bitmap_fast_test_and_set(map, bitmap_bit);
bitmap_unlock(map);
@@ -288,7 +289,8 @@ my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
{
my_bool res;
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_lock(map);
res= bitmap_fast_test_and_clear(map, bitmap_bit);
bitmap_unlock(map);
@@ -317,8 +319,8 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
uint prefix_bytes, prefix_bits, d;
uchar *m= (uchar *)map->bitmap;
- DBUG_ASSERT(map->bitmap &&
- (prefix_size <= map->n_bits || prefix_size == (uint) ~0));
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(prefix_size <= map->n_bits || prefix_size == (uint) ~0);
set_if_smaller(prefix_size, map->n_bits);
if ((prefix_bytes= prefix_size / 8))
memset(m, 0xff, prefix_bytes);
@@ -340,7 +342,8 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
uchar *m= (uchar*) map->bitmap;
uchar *end_prefix= m+(prefix_size-1)/8;
uchar *end;
- DBUG_ASSERT(m && prefix_size <= map->n_bits);
+ DBUG_ASSERT(m);
+ DBUG_ASSERT(prefix_size <= map->n_bits);
/* Empty prefix is always true */
if (!prefix_size)
@@ -393,8 +396,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
+ DBUG_ASSERT(map1->bitmap && map2->bitmap);
+ DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr;
while (m1 < end)
@@ -412,8 +415,9 @@ my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
+ DBUG_ASSERT(map1->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr;
while (m1 < end)
@@ -431,7 +435,8 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
uint len= no_words_in_map(map), len2 = no_words_in_map(map2);
- DBUG_ASSERT(map->bitmap && map2->bitmap);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(map2->bitmap);
end= to+MY_MIN(len,len2);
while (to < end)
@@ -476,7 +481,8 @@ my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array,
uint i, j, start_idx, end_idx;
my_bitmap_map cur_res;
- DBUG_ASSERT(bitmap_count && end_bit >= start_bit);
+ DBUG_ASSERT(bitmap_count);
+ DBUG_ASSERT(end_bit >= start_bit);
for (j= 0; j < bitmap_count; j++)
DBUG_ASSERT(end_bit < bitmap_array[j]->n_bits);
@@ -504,8 +510,9 @@ my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2)
{
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
- DBUG_ASSERT(map1->bitmap && map2->bitmap &&
- map1->n_bits==map2->n_bits);
+ DBUG_ASSERT(map1->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr;
while ( m1 < end)
if ((*m1++ | *m2++) != 0xFFFFFFFF)
@@ -550,8 +557,9 @@ void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
{
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map->n_bits==map2->n_bits);
end= map->last_word_ptr;
@@ -564,8 +572,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
{
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map->n_bits == map2->n_bits);
end= map->last_word_ptr;
while (to <= end)
@@ -576,8 +585,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
{
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map->n_bits == map2->n_bits);
while (to <= end)
*to++ ^= *from++;
}
@@ -614,8 +624,9 @@ void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
{
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
- DBUG_ASSERT(map->bitmap && map2->bitmap &&
- map->n_bits==map2->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(map2->bitmap);
+ DBUG_ASSERT(map->n_bits == map2->n_bits);
end= map->last_word_ptr;
while (to <= end)
@@ -744,7 +755,8 @@ uint bitmap_lock_set_next(MY_BITMAP *map)
void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
{
bitmap_lock(map);
- DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
+ DBUG_ASSERT(map->bitmap);
+ DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_clear_bit(map, bitmap_bit);
bitmap_unlock(map);
}
diff --git a/mysys/my_default.c b/mysys/my_default.c
index 2ca03f9daf3..c1d971f5062 100644
--- a/mysys/my_default.c
+++ b/mysys/my_default.c
@@ -1035,6 +1035,11 @@ void my_print_default_files(const char *conf_file)
char name[FN_REFLEN], **ext;
puts("\nDefault options are read from the following files in the given order:");
+ if (my_defaults_file)
+ {
+ puts(my_defaults_file);
+ return;
+ }
if (dirname_length(conf_file))
fputs(conf_file,stdout);
@@ -1059,7 +1064,12 @@ void my_print_default_files(const char *conf_file)
if (**dirs)
pos= *dirs;
else if (my_defaults_extra_file)
+ {
pos= my_defaults_extra_file;
+ fputs(pos, stdout);
+ fputs(" ", stdout);
+ continue;
+ }
else
continue;
end= convert_dirname(name, pos, NullS);
diff --git a/mysys/my_error.c b/mysys/my_error.c
index 5f1ca0af55b..2bb9305b2fb 100644
--- a/mysys/my_error.c
+++ b/mysys/my_error.c
@@ -112,7 +112,7 @@ void my_error(uint nr, myf MyFlags, ...)
char ebuff[ERRMSGSIZE];
DBUG_ENTER("my_error");
DBUG_PRINT("my", ("nr: %d MyFlags: %lu errno: %d", nr, MyFlags, errno));
-
+
if (!(format = my_get_err_msg(nr)))
(void) my_snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr);
else
diff --git a/mysys/my_getncpus.c b/mysys/my_getncpus.c
index 38585161c22..0d081b72d11 100644
--- a/mysys/my_getncpus.c
+++ b/mysys/my_getncpus.c
@@ -21,30 +21,65 @@
#include <unistd.h>
#endif
+#if defined(__FreeBSD__) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+#include <pthread_np.h>
+#include <sys/cpuset.h>
+#endif
+
static int ncpus=0;
-int my_getncpus()
+int my_getncpus(void)
{
if (!ncpus)
{
+ /*
+ First attempt to get the total number of available cores. sysconf is
+ the fallback, but it can return a larger number. It will return the
+ total number of cores, not the ones available to the process - as
+ configured via core affinity.
+ */
+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+#ifdef __linux__
+ cpu_set_t set;
+#else
+ cpuset_t set;
+#endif
+ if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)
+ {
+#ifdef CPU_COUNT
+ /* CPU_COUNT was introduced with glibc 2.6. */
+ ncpus= CPU_COUNT(&set);
+#else
+ /* Implementation for platforms with glibc < 2.6 */
+ size_t i;
+
+ for (i= 0; i < CPU_SETSIZE; i++)
+ if (CPU_ISSET(i, &set))
+ ncpus++;
+#endif
+ return ncpus;
+ }
+#endif /* (__linux__ || __FreeBSD__) && HAVE_PTHREAD_GETAFFINITY_NP */
+
#ifdef _SC_NPROCESSORS_ONLN
ncpus= sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__WIN__)
SYSTEM_INFO sysinfo;
/*
- * We are not calling GetNativeSystemInfo here because (1) we
- * don't believe that they return different values for number
- * of processors and (2) if WOW64 limits processors for Win32
- * then we don't want to try to override that.
+ We are not calling GetNativeSystemInfo here because (1) we
+ don't believe that they return different values for number
+ of processors and (2) if WOW64 limits processors for Win32
+ then we don't want to try to override that.
*/
GetSystemInfo(&sysinfo);
ncpus= sysinfo.dwNumberOfProcessors;
#else
- /* unknown so play safe: assume SMP and forbid uniprocessor build */
+ /* Unknown so play safe: assume SMP and forbid uniprocessor build */
ncpus= 2;
#endif
}
+
return ncpus;
}
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 31fc68b871f..c40b75e1faf 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2008, 2020, 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
@@ -109,7 +110,7 @@ static char *directory_file_name (char * dst, const char *src)
MY_DIR *my_dir(const char *path, myf MyFlags)
{
- MY_DIR_HANDLE *dirh= 0;
+ MY_DIR_HANDLE *dirh;
FILEINFO finfo;
DIR *dirp;
struct dirent *dp;
@@ -122,10 +123,13 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
tmp_file= directory_file_name(tmp_path, path);
if (!(dirp= opendir(tmp_path)))
- goto error;
+ {
+ my_errno= errno;
+ goto err_open;
+ }
if (!(dirh= my_malloc(sizeof(*dirh), MyFlags | MY_ZEROFILL)))
- goto error;
+ goto err_alloc;
if (my_init_dynamic_array(&dirh->array, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT,
@@ -179,11 +183,11 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
DBUG_RETURN(&dirh->dir);
- error:
- my_errno=errno;
- if (dirp)
- (void) closedir(dirp);
+error:
my_dirend(&dirh->dir);
+err_alloc:
+ (void) closedir(dirp);
+err_open:
if (MyFlags & (MY_FAE | MY_WME))
my_error(EE_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno);
DBUG_RETURN(NULL);
diff --git a/mysys/my_rdtsc.c b/mysys/my_rdtsc.c
index afb97553dd7..b020e224a59 100644
--- a/mysys/my_rdtsc.c
+++ b/mysys/my_rdtsc.c
@@ -812,7 +812,11 @@ void my_timer_init(MY_TIMER_INFO *mti)
time1= my_timer_cycles();
time2= my_timer_ticks();
time3= time2; /* Avoids a Microsoft/IBM compiler warning */
+#if defined(HAVE_SYS_TIMES_H) && defined(HAVE_TIMES)
+ for (i= 0; i < 1000; ++i)
+#else
for (i= 0; i < MY_TIMER_ITERATIONS * 1000; ++i)
+#endif
{
time3= my_timer_ticks();
if (time3 - time2 > 10) break;
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index 2ed62e4541a..5a21a511dda 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -133,8 +133,6 @@ int my_sync(File fd, myf my_flags)
} /* my_sync */
-static const char cur_dir_name[]= {FN_CURLIB, 0};
-
/*
Force directory information to disk.
@@ -151,6 +149,7 @@ int my_sync_dir(const char *dir_name __attribute__((unused)),
myf my_flags __attribute__((unused)))
{
#ifdef NEED_EXPLICIT_SYNC_DIR
+ static const char cur_dir_name[]= {FN_CURLIB, 0};
File dir_fd;
int res= 0;
const char *correct_dir_name;
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 8e38bd7c826..5686dabf35d 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -141,7 +141,7 @@ void my_thread_global_reinit(void)
my_thread_destroy_internal_mutex();
my_thread_init_internal_mutex();
- tmp= my_pthread_getspecific(struct st_my_thread_var*, THR_KEY_mysys);
+ tmp= my_thread_var;
DBUG_ASSERT(tmp);
my_thread_destory_thr_mutex(tmp);
@@ -279,7 +279,7 @@ my_bool my_thread_init(void)
fprintf(stderr,"my_thread_init(): pthread_self: %p\n", pthread_self());
#endif
- if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
+ if (my_thread_var)
{
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_init() called more than once in thread 0x%lx\n",
@@ -297,7 +297,7 @@ my_bool my_thread_init(void)
error= 1;
goto end;
}
- pthread_setspecific(THR_KEY_mysys,tmp);
+ set_mysys_var(tmp);
tmp->pthread_self= pthread_self();
my_thread_init_thr_mutex(tmp);
@@ -334,7 +334,7 @@ end:
void my_thread_end(void)
{
struct st_my_thread_var *tmp;
- tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
+ tmp= my_thread_var;
#ifdef EXTRA_DEBUG_THREADS
fprintf(stderr,"my_thread_end(): tmp: %p pthread_self: %p thread_id: %ld\n",
@@ -357,7 +357,7 @@ void my_thread_end(void)
as the key is used by DBUG.
*/
DBUG_POP();
- pthread_setspecific(THR_KEY_mysys,0);
+ set_mysys_var(NULL);
if (tmp && tmp->init)
{
@@ -441,7 +441,7 @@ extern void **my_thread_var_dbug()
struct st_my_thread_var *tmp;
if (!my_thread_global_init_done)
return NULL;
- tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
+ tmp= my_thread_var;
return tmp && tmp->init ? &tmp->dbug : 0;
}
#endif /* DBUG_OFF */
@@ -453,7 +453,7 @@ safe_mutex_t **my_thread_var_mutex_in_use()
struct st_my_thread_var *tmp;
if (!my_thread_global_init_done)
return NULL;
- tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
+ tmp= my_thread_var;
return tmp ? &tmp->mutex_in_use : 0;
}
diff --git a/mysys/queues.c b/mysys/queues.c
index 5d09ce2063f..7a0ef2017c2 100644
--- a/mysys/queues.c
+++ b/mysys/queues.c
@@ -70,10 +70,9 @@
*/
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
+ my_bool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent)
-
{
DBUG_ENTER("init_queue");
if ((queue->root= (uchar **) my_malloc((max_elements + 1) * sizeof(void*),
@@ -109,7 +108,7 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
*/
int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
- pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
+ my_bool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent)
{
@@ -182,6 +181,28 @@ void delete_queue(QUEUE *queue)
}
+static void insert_at(QUEUE *queue, uchar *element, uint idx)
+{
+ uint next_index, offset_to_key= queue->offset_to_key;
+ uint offset_to_queue_pos= queue->offset_to_queue_pos;
+ /* max_at_top swaps the comparison if we want to order by desc */
+ while ((next_index= idx >> 1) > 0 &&
+ queue->compare(queue->first_cmp_arg,
+ element + offset_to_key,
+ queue->root[next_index] + offset_to_key) *
+ queue->max_at_top < 0)
+ {
+ queue->root[idx]= queue->root[next_index];
+ if (offset_to_queue_pos)
+ (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
+ idx= next_index;
+ }
+ queue->root[idx]= element;
+ if (offset_to_queue_pos)
+ (*(uint*) (element + offset_to_queue_pos-1))= idx;
+}
+
+
/*
Insert element in queue
@@ -191,28 +212,10 @@ void delete_queue(QUEUE *queue)
element Element to insert
*/
-void queue_insert(register QUEUE *queue, uchar *element)
+void queue_insert(QUEUE *queue, uchar *element)
{
- reg2 uint idx, next;
- uint offset_to_queue_pos= queue->offset_to_queue_pos;
DBUG_ASSERT(queue->elements < queue->max_elements);
-
- idx= ++queue->elements;
- /* max_at_top swaps the comparison if we want to order by desc */
- while (idx > 1 &&
- (queue->compare(queue->first_cmp_arg,
- element + queue->offset_to_key,
- queue->root[(next= idx >> 1)] +
- queue->offset_to_key) * queue->max_at_top) < 0)
- {
- queue->root[idx]= queue->root[next];
- if (offset_to_queue_pos)
- (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
- idx= next;
- }
- queue->root[idx]= element;
- if (offset_to_queue_pos)
- (*(uint*) (element+ offset_to_queue_pos-1))= idx;
+ insert_at(queue, element, ++queue->elements);
}
@@ -230,7 +233,7 @@ void queue_insert(register QUEUE *queue, uchar *element)
2 auto_extend is 0; No insertion done
*/
-int queue_insert_safe(register QUEUE *queue, uchar *element)
+int queue_insert_safe(QUEUE *queue, uchar *element)
{
if (queue->elements == queue->max_elements)
@@ -240,7 +243,7 @@ int queue_insert_safe(register QUEUE *queue, uchar *element)
if (resize_queue(queue, queue->max_elements + queue->auto_extent))
return 1;
}
-
+
queue_insert(queue, element);
return 0;
}
@@ -259,81 +262,55 @@ int queue_insert_safe(register QUEUE *queue, uchar *element)
pointer to removed element
*/
-uchar *queue_remove(register QUEUE *queue, uint idx)
+uchar *queue_remove(QUEUE *queue, uint idx)
{
uchar *element;
- DBUG_ASSERT(idx >= 1 && idx <= queue->elements);
+ DBUG_ASSERT(idx >= 1);
+ DBUG_ASSERT(idx <= queue->elements);
element= queue->root[idx];
- _downheap(queue, idx, queue->root[queue->elements--]);
+ queue->root[idx]= queue->root[queue->elements--];
+ queue_replace(queue, idx);
return element;
}
/*
- Add element to fixed position and update heap
+ Restores the heap property from idx down the heap
SYNOPSIS
_downheap()
queue Queue to use
idx Index of element to change
- element Element to store at 'idx'
-
- NOTE
- This only works if element is >= all elements <= start_idx
*/
-void _downheap(register QUEUE *queue, uint start_idx, uchar *element)
+void _downheap(QUEUE *queue, uint idx)
{
- uint elements,half_queue,offset_to_key, next_index, offset_to_queue_pos;
- register uint idx= start_idx;
- my_bool first= TRUE;
-
- offset_to_key=queue->offset_to_key;
- offset_to_queue_pos= queue->offset_to_queue_pos;
- half_queue= (elements= queue->elements) >> 1;
+ uchar *element= queue->root[idx];
+ uint next_index,
+ elements= queue->elements,
+ half_queue= elements >> 1,
+ offset_to_key= queue->offset_to_key,
+ offset_to_queue_pos= queue->offset_to_queue_pos;
while (idx <= half_queue)
{
- next_index=idx+idx;
+ next_index= idx+idx;
if (next_index < elements &&
- (queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- queue->root[next_index+1]+offset_to_key) *
- queue->max_at_top) > 0)
+ (queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ queue->root[next_index+1]+offset_to_key) *
+ queue->max_at_top) > 0)
next_index++;
- if (first &&
- (((queue->compare(queue->first_cmp_arg,
- queue->root[next_index]+offset_to_key,
- element+offset_to_key) * queue->max_at_top) >= 0)))
- {
- queue->root[idx]= element;
- if (offset_to_queue_pos)
- (*(uint*) (element + offset_to_queue_pos-1))= idx;
- return;
- }
- first= FALSE;
- queue->root[idx]= queue->root[next_index];
- if (offset_to_queue_pos)
- (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
- idx=next_index;
- }
-
- /*
- Insert the element into the right position. This is the same code
- as we have in queue_insert()
- */
- while ((next_index= (idx >> 1)) > start_idx &&
- queue->compare(queue->first_cmp_arg,
- element+offset_to_key,
- queue->root[next_index]+offset_to_key)*
- queue->max_at_top < 0)
- {
+ if ((queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ element+offset_to_key) * queue->max_at_top) >= 0)
+ break;
queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx= next_index;
}
- queue->root[idx]= element;
+ queue->root[idx]=element;
if (offset_to_queue_pos)
(*(uint*) (element + offset_to_queue_pos-1))= idx;
}
@@ -351,7 +328,7 @@ void queue_fix(QUEUE *queue)
{
uint i;
for (i= queue->elements >> 1; i > 0; i--)
- _downheap(queue, i, queue_element(queue, i));
+ _downheap(queue, i);
}
@@ -362,13 +339,47 @@ void queue_fix(QUEUE *queue)
queue_replace()
queue Queue to use
idx Index of element to change
- element Element to store at 'idx'
+
+ NOTE
+ optimized for the case when the new position is close to the end of the
+ heap (typical for queue_remove() replacements).
*/
void queue_replace(QUEUE *queue, uint idx)
{
uchar *element= queue->root[idx];
- DBUG_ASSERT(idx >= 1 && idx <= queue->elements);
- queue_remove(queue, idx);
- queue_insert(queue, element);
+ uint next_index,
+ elements= queue->elements,
+ half_queue= elements>>1,
+ offset_to_key= queue->offset_to_key,
+ offset_to_queue_pos= queue->offset_to_queue_pos;
+ my_bool first= TRUE;
+
+ while (idx <= half_queue)
+ {
+ next_index= idx + idx;
+ if (next_index < elements &&
+ queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ queue->root[next_index+1]+offset_to_key) *
+ queue->max_at_top > 0)
+ next_index++;
+ if (first &&
+ queue->compare(queue->first_cmp_arg,
+ queue->root[next_index]+offset_to_key,
+ element+offset_to_key) * queue->max_at_top >= 0)
+ {
+ queue->root[idx]= element;
+ if (offset_to_queue_pos)
+ (*(uint*) (element + offset_to_queue_pos-1))= idx;
+ break;
+ }
+ first= FALSE;
+ queue->root[idx]= queue->root[next_index];
+ if (offset_to_queue_pos)
+ (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
+ idx=next_index;
+ }
+
+ insert_at(queue, element, idx);
}
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 91cddb6dbad..86cf272a437 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -34,107 +34,11 @@
#include <execinfo.h>
#endif
-#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
-
-static char *heap_start;
-
-#if(defined HAVE_BSS_START) && !(defined __linux__)
-extern char *__bss_start;
-#endif
-
-void my_init_stacktrace()
-{
-#if(defined HAVE_BSS_START) && !(defined __linux__)
- heap_start = (char*) &__bss_start;
-#endif
-}
-
-#ifdef __linux__
-
-static void print_buffer(char *buffer, size_t count)
-{
- const char s[]= " ";
- for (; count && *buffer; --count)
- {
- my_write_stderr(isprint(*buffer) ? buffer : s, 1);
- ++buffer;
- }
-}
-
-/**
- Access the pages of this process through /proc/self/task/<tid>/mem
- in order to safely print the contents of a memory address range.
-
- @param addr The address at the start of the memory region.
- @param max_len The length of the memory region.
-
- @return Zero on success.
-*/
-static int safe_print_str(const char *addr, int max_len)
-{
- int fd;
- pid_t tid;
- off_t offset;
- ssize_t nbytes= 0;
- size_t total, count;
- char buf[256];
-
- tid= (pid_t) syscall(SYS_gettid);
-
- sprintf(buf, "/proc/self/task/%d/mem", tid);
-
- if ((fd= open(buf, O_RDONLY)) < 0)
- return -1;
-
- /* Ensure that off_t can hold a pointer. */
- compile_time_assert(sizeof(off_t) >= sizeof(intptr));
-
- total= max_len;
- offset= (intptr) addr;
-
- /* Read up to the maximum number of bytes. */
- while (total)
- {
- count= MY_MIN(sizeof(buf), total);
-
- if ((nbytes= pread(fd, buf, count, offset)) < 0)
- {
- /* Just in case... */
- if (errno == EINTR)
- continue;
- else
- break;
- }
-
- /* Advance offset into memory. */
- total-= nbytes;
- offset+= nbytes;
- addr+= nbytes;
-
- /* Output the printable characters. */
- print_buffer(buf, nbytes);
-
- /* Break if less than requested... */
- if ((count - nbytes))
- break;
- }
-
- if (nbytes == -1)
- my_safe_printf_stderr("Can't read from address %p", addr);
-
- close(fd);
-
- return 0;
-}
-
-#endif
-
/*
Attempt to print a char * pointer as a string.
SYNOPSIS
- Prints either until the end of string ('\0'), or max_len characters have
- been printed.
+ Prints until max_len characters have been printed.
RETURN VALUE
0 Pointer was within the heap address space.
@@ -149,24 +53,25 @@ static int safe_print_str(const char *addr, int max_len)
int my_safe_print_str(const char* val, int max_len)
{
- char *heap_end;
-
-#ifdef __linux__
- // Try and make use of /proc filesystem to safely print memory contents.
- if (!safe_print_str(val, max_len))
- return 0;
-#endif
-
- heap_end= (char*) sbrk(0);
-
- if (!PTR_SANE(val))
+ const char *orig_val= val;
+ if (!val)
{
- my_safe_printf_stderr("%s", "is an invalid pointer");
+ my_safe_printf_stderr("%s", "(null)");
return 1;
}
- for (; max_len && PTR_SANE(val) && *val; --max_len)
- my_write_stderr((val++), 1);
+ for (; max_len; --max_len)
+ {
+ if (my_write_stderr((val++), 1) != 1)
+ {
+ if ((errno == EFAULT) &&(val == orig_val + 1))
+ {
+ // We can not read the address from very beginning
+ my_safe_printf_stderr("Can't access address %p", orig_val);
+ }
+ break;
+ }
+ }
my_safe_printf_stderr("%s", "\n");
return 0;
@@ -506,11 +411,6 @@ static EXCEPTION_POINTERS *exception_ptrs;
#define MODULE64_SIZE_WINXP 576
#define STACKWALK_MAX_FRAMES 64
-void my_init_stacktrace()
-{
-}
-
-
void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
{
exception_ptrs = ep;
diff --git a/mysys_ssl/openssl.c b/mysys_ssl/openssl.c
index f3dc8f4277c..a11db113b14 100644
--- a/mysys_ssl/openssl.c
+++ b/mysys_ssl/openssl.c
@@ -15,7 +15,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_global.h>
-#include <ssl_compat.h>
/*
The check is only done for OpenSSL 1.1.x.
@@ -25,13 +24,14 @@
*/
#ifndef HAVE_OPENSSL11
+#include <ssl_compat.h>
int check_openssl_compatibility()
{
return 0;
}
#else
#include <openssl/evp.h>
-
+#include <ssl_compat.h>
static uint testing, alloc_size, alloc_count;
static void *coc_malloc(size_t size, const char *f __attribute__((unused)),
diff --git a/pcre/AUTHORS b/pcre/AUTHORS
index 23c005a33d6..bb8b32835bd 100644
--- a/pcre/AUTHORS
+++ b/pcre/AUTHORS
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2019 University of Cambridge
+Copyright (c) 1997-2020 University of Cambridge
All rights reserved
@@ -19,7 +19,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2010-2019 Zoltan Herczeg
+Copyright(c) 2010-2020 Zoltan Herczeg
All rights reserved.
@@ -30,7 +30,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Emain domain: freemail.hu
-Copyright(c) 2009-2019 Zoltan Herczeg
+Copyright(c) 2009-2020 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/ChangeLog b/pcre/ChangeLog
index e4d2d9fa24c..04d1ef5b2c4 100644
--- a/pcre/ChangeLog
+++ b/pcre/ChangeLog
@@ -5,6 +5,35 @@ Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.
+Version 8.44 12 February-2020
+-----------------------------
+
+1. Setting --enable-jit=auto for an out-of-tree build failed because the
+source directory wasn't in the search path for AC_TRY_COMPILE always. Patch
+from Ross Burton.
+
+2. Applied a patch from Michael Shigorin to fix 8.43 build on e2k arch
+with lcc compiler (EDG frontend based); the problem it fixes is:
+
+ lcc: "pcrecpp.cc", line 74: error: declaration aliased to undefined entity
+ "_ZN7pcrecpp2RE6no_argE" [-Werror]
+
+3. Change 2 for 8.43 omitted (*LF) from the list of start-of-pattern items. Now
+added.
+
+4. Fix ARMv5 JIT improper handling of labels right after a constant pool.
+
+5. Small patch to pcreposix.c to set the erroroffset field to -1 immediately
+after a successful compile, instead of at the start of matching to avoid a
+sanitizer complaint (regexec is supposed to be thread safe).
+
+6. Check the size of the number after (?C as it is read, in order to avoid
+integer overflow.
+
+7. Tidy up left shifts to avoid sanitize warnings; also fix one NULL deference
+in pcretest.
+
+
Version 8.43 23-February-2019
-----------------------------
diff --git a/pcre/LICENCE b/pcre/LICENCE
index 760a6666b60..57a544814c8 100644
--- a/pcre/LICENCE
+++ b/pcre/LICENCE
@@ -25,7 +25,7 @@ Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England.
-Copyright (c) 1997-2019 University of Cambridge
+Copyright (c) 1997-2020 University of Cambridge
All rights reserved.
@@ -36,7 +36,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu
-Copyright(c) 2010-2019 Zoltan Herczeg
+Copyright(c) 2010-2020 Zoltan Herczeg
All rights reserved.
@@ -47,7 +47,7 @@ Written by: Zoltan Herczeg
Email local part: hzmester
Email domain: freemail.hu
-Copyright(c) 2009-2019 Zoltan Herczeg
+Copyright(c) 2009-2020 Zoltan Herczeg
All rights reserved.
diff --git a/pcre/NEWS b/pcre/NEWS
index 0f184081740..3d91b67dfa9 100644
--- a/pcre/NEWS
+++ b/pcre/NEWS
@@ -5,6 +5,12 @@ Note that this library (now called PCRE1) is now being maintained for bug fixes
only. New projects are advised to use the new PCRE2 libraries.
+Release 8.44 12-February-2020
+-----------------------------
+
+This is a bug-fix release.
+
+
Release 8.43 23-February-2019
-----------------------------
diff --git a/pcre/README b/pcre/README
index 4887ebf350e..334362b3e53 100644
--- a/pcre/README
+++ b/pcre/README
@@ -13,9 +13,10 @@ libraries.
The latest release of PCRE1 is always available in three alternative formats
from:
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.bz2
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.gz
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.bz2
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.zip
+
There is a mailing list for discussion about the development of PCRE at
pcre-dev@exim.org. You can access the archives and subscribe or manage your
@@ -999,4 +1000,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx.
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 10 February 2015
+Last updated: 12 February 2020
diff --git a/pcre/configure.ac b/pcre/configure.ac
index d2e5236cbd6..6a3e5f35d8e 100644
--- a/pcre/configure.ac
+++ b/pcre/configure.ac
@@ -9,19 +9,19 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
-m4_define(pcre_minor, [43])
+m4_define(pcre_minor, [44])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2019-02-23])
+m4_define(pcre_date, [2020-02-12])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre_version, [3:11:2])
-m4_define(libpcre16_version, [2:11:2])
-m4_define(libpcre32_version, [0:11:0])
-m4_define(libpcreposix_version, [0:6:0])
-m4_define(libpcrecpp_version, [0:1:0])
+m4_define(libpcre_version, [3:12:2])
+m4_define(libpcre16_version, [2:12:2])
+m4_define(libpcre32_version, [0:12:0])
+m4_define(libpcreposix_version, [0:7:0])
+m4_define(libpcrecpp_version, [0:2:0])
AC_PREREQ(2.57)
AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre)
@@ -159,12 +159,15 @@ AC_ARG_ENABLE(jit,
if test "$enable_jit" = "auto"; then
AC_LANG(C)
+ SAVE_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS=-I$srcdir
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#define SLJIT_CONFIG_AUTO 1
#include "sljit/sljitConfigInternal.h"
#if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
#error unsupported
#endif]])], enable_jit=yes, enable_jit=no)
+ CPPFLAGS=$SAVE_CPPFLAGS
fi
# Handle --disable-pcregrep-jit (enabled by default)
diff --git a/pcre/doc/html/README.txt b/pcre/doc/html/README.txt
index 4887ebf350e..334362b3e53 100644
--- a/pcre/doc/html/README.txt
+++ b/pcre/doc/html/README.txt
@@ -13,9 +13,10 @@ libraries.
The latest release of PCRE1 is always available in three alternative formats
from:
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.bz2
- ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.gz
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.bz2
+ https://ftp.pcre.org/pub/pcre/pcre-x.xx.tar.zip
+
There is a mailing list for discussion about the development of PCRE at
pcre-dev@exim.org. You can access the archives and subscribe or manage your
@@ -999,4 +1000,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx.
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 10 February 2015
+Last updated: 12 February 2020
diff --git a/pcre/doc/html/pcre.html b/pcre/doc/html/pcre.html
index c87b1066427..0db75e44892 100644
--- a/pcre/doc/html/pcre.html
+++ b/pcre/doc/html/pcre.html
@@ -143,7 +143,7 @@ performance.
One way of guarding against this possibility is to use the
<b>pcre_fullinfo()</b> function to check the compiled pattern's options for UTF.
Alternatively, from release 8.33, you can set the PCRE_NEVER_UTF option at
-compile time. This causes an compile time error if a pattern contains a
+compile time. This causes a compile time error if a pattern contains a
UTF-setting sequence.
</P>
<P>
diff --git a/pcre/doc/html/pcreapi.html b/pcre/doc/html/pcreapi.html
index 2d7adf185a6..2fdfbff5ccf 100644
--- a/pcre/doc/html/pcreapi.html
+++ b/pcre/doc/html/pcreapi.html
@@ -1246,7 +1246,7 @@ the following negative numbers:
PCRE_ERROR_BADOPTION the value of <i>what</i> was invalid
PCRE_ERROR_UNSET the requested field is not set
</pre>
-The "magic number" is placed at the start of each compiled pattern as an simple
+The "magic number" is placed at the start of each compiled pattern as a simple
check against passing an arbitrary memory pointer. The endianness error can
occur if a compiled pattern is saved and reloaded on a different host. Here is
a typical call of <b>pcre_fullinfo()</b>, to obtain the length of the compiled
@@ -1318,7 +1318,7 @@ returned. For anchored patterns, -2 is returned.
</pre>
Return the value of the first data unit (non-UTF character) of any matched
string in the situation where PCRE_INFO_FIRSTCHARACTERFLAGS returns 1;
-otherwise return 0. The fourth argument should point to an <b>uint_t</b>
+otherwise return 0. The fourth argument should point to a <b>uint_t</b>
variable.
</P>
<P>
@@ -1577,7 +1577,7 @@ returned value 1 (with "z" returned from PCRE_INFO_REQUIREDCHAR), but for
</pre>
Return the value of the rightmost literal data unit that must exist in any
matched string, other than at its start, if such a value has been recorded. The
-fourth argument should point to an <b>uint32_t</b> variable. If there is no such
+fourth argument should point to a <b>uint32_t</b> variable. If there is no such
value, 0 is returned.
</P>
<br><a name="SEC16" href="#TOC1">REFERENCE COUNTS</a><br>
diff --git a/pcre/doc/html/pcretest.html b/pcre/doc/html/pcretest.html
index ba540d3c385..842ff3cbe53 100644
--- a/pcre/doc/html/pcretest.html
+++ b/pcre/doc/html/pcretest.html
@@ -99,23 +99,21 @@ the 16-bit library, or <b>pcre32_xx</b> when using the 32-bit library".
<br><a name="SEC4" href="#TOC1">COMMAND LINE OPTIONS</a><br>
<P>
<b>-8</b>
-If both the 8-bit library has been built, this option causes the 8-bit library
-to be used (which is the default); if the 8-bit library has not been built,
-this option causes an error.
+If the 8-bit library has been built, this option causes it to be used (this is
+the default). If the 8-bit library has not been built, this option causes an
+error.
</P>
<P>
<b>-16</b>
-If both the 8-bit or the 32-bit, and the 16-bit libraries have been built, this
-option causes the 16-bit library to be used. If only the 16-bit library has been
-built, this is the default (so has no effect). If only the 8-bit or the 32-bit
-library has been built, this option causes an error.
+If the 16-bit library has been built, this option causes it to be used. If only
+the 16-bit library has been built, this is the default. If the 16-bit library
+has not been built, this option causes an error.
</P>
<P>
<b>-32</b>
-If both the 8-bit or the 16-bit, and the 32-bit libraries have been built, this
-option causes the 32-bit library to be used. If only the 32-bit library has been
-built, this is the default (so has no effect). If only the 8-bit or the 16-bit
-library has been built, this option causes an error.
+If the 32-bit library has been built, this option causes it to be used. If only
+the 32-bit library has been built, this is the default. If the 32-bit library
+has not been built, this option causes an error.
</P>
<P>
<b>-b</b>
@@ -1154,9 +1152,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC17" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 23 February 2017
+Last updated: 10 February 2020
<br>
-Copyright &copy; 1997-2017 University of Cambridge.
+Copyright &copy; 1997-2020 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/pcre-config.txt b/pcre/doc/pcre-config.txt
index 8503ab0ef0c..977e46868a8 100644
--- a/pcre/doc/pcre-config.txt
+++ b/pcre/doc/pcre-config.txt
@@ -16,8 +16,8 @@ DESCRIPTION
pcre-config returns the configuration of the installed PCRE libraries
and the options required to compile a program to use them. Some of the
- options apply only to the 8-bit, or 16-bit, or 32-bit libraries,
- respectively, and are not available if only one of those libraries has
+ options apply only to the 8-bit, or 16-bit, or 32-bit libraries, re-
+ spectively, and are not available if only one of those libraries has
been built. If an unavailable option is encountered, the "usage" infor-
mation is output.
@@ -36,37 +36,37 @@ OPTIONS
--version Writes the version number of the installed PCRE libraries to
the standard output.
- --libs Writes to the standard output the command line options
- required to link with the 8-bit PCRE library (-lpcre on many
+ --libs Writes to the standard output the command line options re-
+ quired to link with the 8-bit PCRE library (-lpcre on many
systems).
- --libs16 Writes to the standard output the command line options
- required to link with the 16-bit PCRE library (-lpcre16 on
- many systems).
+ --libs16 Writes to the standard output the command line options re-
+ quired to link with the 16-bit PCRE library (-lpcre16 on many
+ systems).
- --libs32 Writes to the standard output the command line options
- required to link with the 32-bit PCRE library (-lpcre32 on
- many systems).
+ --libs32 Writes to the standard output the command line options re-
+ quired to link with the 32-bit PCRE library (-lpcre32 on many
+ systems).
--libs-cpp
- Writes to the standard output the command line options
- required to link with PCRE's C++ wrapper library (-lpcrecpp
+ Writes to the standard output the command line options re-
+ quired to link with PCRE's C++ wrapper library (-lpcrecpp
-lpcre on many systems).
--libs-posix
- Writes to the standard output the command line options
- required to link with PCRE's POSIX API wrapper library
+ Writes to the standard output the command line options re-
+ quired to link with PCRE's POSIX API wrapper library
(-lpcreposix -lpcre on many systems).
- --cflags Writes to the standard output the command line options
- required to compile files that use PCRE (this may include
- some -I options, but is blank on many systems).
+ --cflags Writes to the standard output the command line options re-
+ quired to compile files that use PCRE (this may include some
+ -I options, but is blank on many systems).
--cflags-posix
- Writes to the standard output the command line options
- required to compile files that use PCRE's POSIX API wrapper
- library (this may include some -I options, but is blank on
- many systems).
+ Writes to the standard output the command line options re-
+ quired to compile files that use PCRE's POSIX API wrapper li-
+ brary (this may include some -I options, but is blank on many
+ systems).
SEE ALSO
diff --git a/pcre/doc/pcre.3 b/pcre/doc/pcre.3
index 0f2837e7c06..716d58044c7 100644
--- a/pcre/doc/pcre.3
+++ b/pcre/doc/pcre.3
@@ -146,7 +146,7 @@ performance.
One way of guarding against this possibility is to use the
\fBpcre_fullinfo()\fP function to check the compiled pattern's options for UTF.
Alternatively, from release 8.33, you can set the PCRE_NEVER_UTF option at
-compile time. This causes an compile time error if a pattern contains a
+compile time. This causes a compile time error if a pattern contains a
UTF-setting sequence.
.P
If your application is one that supports UTF, be aware that validity checking
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index c027538f500..8ffc90234ac 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -37,10 +37,10 @@ INTRODUCTION
give better JavaScript compatibility.
Starting with release 8.30, it is possible to compile two separate PCRE
- libraries: the original, which supports 8-bit character strings
- (including UTF-8 strings), and a second library that supports 16-bit
- character strings (including UTF-16 strings). The build process allows
- either one or both to be built. The majority of the work to make this
+ libraries: the original, which supports 8-bit character strings (in-
+ cluding UTF-8 strings), and a second library that supports 16-bit char-
+ acter strings (including UTF-16 strings). The build process allows ei-
+ ther one or both to be built. The majority of the work to make this
possible was done by Zoltan Herczeg.
Starting with release 8.32 it is possible to compile a third separate
@@ -121,7 +121,7 @@ SECURITY CONSIDERATIONS
One way of guarding against this possibility is to use the
pcre_fullinfo() function to check the compiled pattern's options for
UTF. Alternatively, from release 8.33, you can set the PCRE_NEVER_UTF
- option at compile time. This causes an compile time error if a pattern
+ option at compile time. This causes a compile time error if a pattern
contains a UTF-setting sequence.
If your application is one that supports UTF, be aware that validity
@@ -314,12 +314,12 @@ THE PCRE 16-BIT LIBRARY
Starting with release 8.30, it is possible to compile a PCRE library
that supports 16-bit character strings, including UTF-16 strings, as
well as or instead of the original 8-bit library. The majority of the
- work to make this possible was done by Zoltan Herczeg. The two
- libraries contain identical sets of functions, used in exactly the same
+ work to make this possible was done by Zoltan Herczeg. The two li-
+ braries contain identical sets of functions, used in exactly the same
way. Only the names of the functions and the data types of their argu-
ments and results are different. To avoid over-complication and reduce
- the documentation maintenance load, most of the PCRE documentation
- describes the 8-bit library, with only occasional references to the
+ the documentation maintenance load, most of the PCRE documentation de-
+ scribes the 8-bit library, with only occasional references to the
16-bit library. This page describes what is different when you use the
16-bit library.
@@ -350,12 +350,12 @@ STRING TYPES
In the 8-bit library, strings are passed to PCRE library functions as
vectors of bytes with the C type "char *". In the 16-bit library,
strings are passed as vectors of unsigned 16-bit quantities. The macro
- PCRE_UCHAR16 specifies an appropriate data type, and PCRE_SPTR16 is
- defined as "const PCRE_UCHAR16 *". In very many environments, "short
- int" is a 16-bit data type. When PCRE is built, it defines PCRE_UCHAR16
- as "unsigned short int", but checks that it really is a 16-bit data
- type. If it is not, the build fails with an error message telling the
- maintainer to modify the definition appropriately.
+ PCRE_UCHAR16 specifies an appropriate data type, and PCRE_SPTR16 is de-
+ fined as "const PCRE_UCHAR16 *". In very many environments, "short int"
+ is a 16-bit data type. When PCRE is built, it defines PCRE_UCHAR16 as
+ "unsigned short int", but checks that it really is a 16-bit data type.
+ If it is not, the build fails with an error message telling the main-
+ tainer to modify the definition appropriately.
STRUCTURE TYPES
@@ -424,9 +424,9 @@ OPTION NAMES
There are two new general option names, PCRE_UTF16 and
PCRE_NO_UTF16_CHECK, which correspond to PCRE_UTF8 and
- PCRE_NO_UTF8_CHECK in the 8-bit library. In fact, these new options
- define the same bits in the options word. There is a discussion about
- the validity of UTF-16 strings in the pcreunicode page.
+ PCRE_NO_UTF8_CHECK in the 8-bit library. In fact, these new options de-
+ fine the same bits in the options word. There is a discussion about the
+ validity of UTF-16 strings in the pcreunicode page.
For the pcre16_config() function there is an option PCRE_CONFIG_UTF16
that returns 1 if UTF-16 support is configured, otherwise 0. If this
@@ -464,8 +464,8 @@ ERROR NAMES
patterns in the other mode, for example, if a pattern compiled with
pcre_compile() is passed to pcre16_exec().
- There are new error codes whose names begin with PCRE_UTF16_ERR for
- invalid UTF-16 strings, corresponding to the PCRE_UTF8_ERR codes for
+ There are new error codes whose names begin with PCRE_UTF16_ERR for in-
+ valid UTF-16 strings, corresponding to the PCRE_UTF8_ERR codes for
UTF-8 strings that are described in the section entitled "Reason codes
for invalid UTF-8 strings" in the main pcreapi page. The UTF-16 errors
are:
@@ -509,8 +509,8 @@ TESTING
NOT SUPPORTED IN 16-BIT MODE
Not all the features of the 8-bit library are available with the 16-bit
- library. The C++ and POSIX wrapper functions support only the 8-bit
- library, and the pcregrep program is at present 8-bit only.
+ library. The C++ and POSIX wrapper functions support only the 8-bit li-
+ brary, and the pcregrep program is at present 8-bit only.
AUTHOR
@@ -651,8 +651,8 @@ THE PCRE 32-BIT LIBRARY
and the data types of their arguments and results are different. To
avoid over-complication and reduce the documentation maintenance load,
most of the PCRE documentation describes the 8-bit library, with only
- occasional references to the 16-bit and 32-bit libraries. This page
- describes what is different when you use the 32-bit library.
+ occasional references to the 16-bit and 32-bit libraries. This page de-
+ scribes what is different when you use the 32-bit library.
WARNING: A single application can be linked with all or any of the
three libraries, but you must take care when processing any particular
@@ -681,8 +681,8 @@ STRING TYPES
In the 8-bit library, strings are passed to PCRE library functions as
vectors of bytes with the C type "char *". In the 32-bit library,
strings are passed as vectors of unsigned 32-bit quantities. The macro
- PCRE_UCHAR32 specifies an appropriate data type, and PCRE_SPTR32 is
- defined as "const PCRE_UCHAR32 *". In very many environments, "unsigned
+ PCRE_UCHAR32 specifies an appropriate data type, and PCRE_SPTR32 is de-
+ fined as "const PCRE_UCHAR32 *". In very many environments, "unsigned
int" is a 32-bit data type. When PCRE is built, it defines PCRE_UCHAR32
as "unsigned int", but checks that it really is a 32-bit data type. If
it is not, the build fails with an error message telling the maintainer
@@ -755,9 +755,9 @@ OPTION NAMES
There are two new general option names, PCRE_UTF32 and
PCRE_NO_UTF32_CHECK, which correspond to PCRE_UTF8 and
- PCRE_NO_UTF8_CHECK in the 8-bit library. In fact, these new options
- define the same bits in the options word. There is a discussion about
- the validity of UTF-32 strings in the pcreunicode page.
+ PCRE_NO_UTF8_CHECK in the 8-bit library. In fact, these new options de-
+ fine the same bits in the options word. There is a discussion about the
+ validity of UTF-32 strings in the pcreunicode page.
For the pcre32_config() function there is an option PCRE_CONFIG_UTF32
that returns 1 if UTF-32 support is configured, otherwise 0. If this
@@ -793,8 +793,8 @@ ERROR NAMES
to a function that processes patterns in the other mode, for example,
if a pattern compiled with pcre_compile() is passed to pcre32_exec().
- There are new error codes whose names begin with PCRE_UTF32_ERR for
- invalid UTF-32 strings, corresponding to the PCRE_UTF8_ERR codes for
+ There are new error codes whose names begin with PCRE_UTF32_ERR for in-
+ valid UTF-32 strings, corresponding to the PCRE_UTF8_ERR codes for
UTF-8 strings that are described in the section entitled "Reason codes
for invalid UTF-8 strings" in the main pcreapi page. The UTF-32 errors
are:
@@ -837,8 +837,8 @@ TESTING
NOT SUPPORTED IN 32-BIT MODE
Not all the features of the 8-bit library are available with the 32-bit
- library. The C++ and POSIX wrapper functions support only the 8-bit
- library, and the pcregrep program is at present 8-bit only.
+ library. The C++ and POSIX wrapper functions support only the 8-bit li-
+ brary, and the pcregrep program is at present 8-bit only.
AUTHOR
@@ -866,8 +866,8 @@ BUILDING PCRE
PCRE is distributed with a configure script that can be used to build
the library in Unix-like environments using the applications known as
- Autotools. Also in the distribution are files to support building
- using CMake instead of configure. The text file README contains general
+ Autotools. Also in the distribution are files to support building us-
+ ing CMake instead of configure. The text file README contains general
information about building with Autotools (some of which is repeated
below), and also has some comments about building on various operating
systems. There is a lot more information about building PCRE without
@@ -892,13 +892,13 @@ PCRE BUILD-TIME OPTIONS
compiler, as described in NON-AUTOTOOLS-BUILD.
The complete list of options for configure (which includes the standard
- ones such as the selection of the installation directory) can be
- obtained by running
+ ones such as the selection of the installation directory) can be ob-
+ tained by running
./configure --help
- The following sections include descriptions of options whose names
- begin with --enable or --disable. These settings specify changes to the
+ The following sections include descriptions of options whose names be-
+ gin with --enable or --disable. These settings specify changes to the
defaults for the configure command. Because of the way that configure
works, --enable and --disable always come in pairs, so the complemen-
tary option always exists as well, but as it specifies the default, it
@@ -916,8 +916,8 @@ BUILDING 8-BIT, 16-BIT AND 32-BIT LIBRARIES
--enable-pcre16
- to the configure command. You can also build yet another separate
- library, called libpcre32, in which strings are contained in vectors of
+ to the configure command. You can also build yet another separate li-
+ brary, called libpcre32, in which strings are contained in vectors of
32-bit data units and interpreted either as single-unit characters or
UTF-32 strings, by adding
@@ -965,8 +965,8 @@ UTF-8, UTF-16 AND UTF-32 SUPPORT
to the configure command. This setting applies to all three libraries,
adding support for UTF-8 to the 8-bit library, support for UTF-16 to
- the 16-bit library, and support for UTF-32 to the to the 32-bit
- library. There are no separate options for enabling UTF-8, UTF-16 and
+ the 16-bit library, and support for UTF-32 to the to the 32-bit li-
+ brary. There are no separate options for enabling UTF-8, UTF-16 and
UTF-32 independently because that would allow ridiculous settings such
as requesting UTF-16 support while building only the 8-bit library. It
is not possible to build one library with UTF support and another with-
@@ -975,8 +975,8 @@ UTF-8, UTF-16 AND UTF-32 SUPPORT
Of itself, this setting does not make PCRE treat strings as UTF-8,
UTF-16 or UTF-32. As well as compiling PCRE with this option, you also
- have have to set the PCRE_UTF8, PCRE_UTF16 or PCRE_UTF32 option (as
- appropriate) when you call one of the pattern compiling functions.
+ have have to set the PCRE_UTF8, PCRE_UTF16 or PCRE_UTF32 option (as ap-
+ propriate) when you call one of the pattern compiling functions.
If you set --enable-utf when compiling in an EBCDIC environment, PCRE
expects its input to be either ASCII or UTF-8 (depending on the run-
@@ -1010,9 +1010,9 @@ JUST-IN-TIME COMPILER SUPPORT
--enable-jit
This support is available only for certain hardware architectures. If
- this option is set for an unsupported architecture, a compile time
- error occurs. See the pcrejit documentation for a discussion of JIT
- usage. When JIT support is enabled, pcregrep automatically makes use of
+ this option is set for an unsupported architecture, a compile time er-
+ ror occurs. See the pcrejit documentation for a discussion of JIT us-
+ age. When JIT support is enabled, pcregrep automatically makes use of
it, unless you add
--disable-pcregrep-jit
@@ -1029,8 +1029,8 @@ CODE VALUE OF NEWLINE
--enable-newline-is-cr
- to the configure command. There is also a --enable-newline-is-lf
- option, which explicitly specifies linefeed as the newline character.
+ to the configure command. There is also a --enable-newline-is-lf op-
+ tion, which explicitly specifies linefeed as the newline character.
Alternatively, you can specify that line endings are to be indicated by
the two character sequence CRLF. If you want this, add
@@ -1124,12 +1124,12 @@ AVOIDING EXCESSIVE STACK USAGE
can replace the pointers so that your own functions are used instead.
Separate functions are provided rather than using pcre_malloc and
- pcre_free because the usage is very predictable: the block sizes
- requested are always the same, and the blocks are always freed in
- reverse order. A calling program might be able to implement optimized
- functions that perform better than malloc() and free(). PCRE runs
- noticeably more slowly when built in this way. This option affects only
- the pcre_exec() function; it is not relevant for pcre_dfa_exec().
+ pcre_free because the usage is very predictable: the block sizes re-
+ quested are always the same, and the blocks are always freed in reverse
+ order. A calling program might be able to implement optimized functions
+ that perform better than malloc() and free(). PCRE runs noticeably more
+ slowly when built in this way. This option affects only the pcre_exec()
+ function; it is not relevant for pcre_dfa_exec().
LIMITING PCRE RESOURCE USAGE
@@ -1152,9 +1152,9 @@ LIMITING PCRE RESOURCE USAGE
calls of match() more strictly than the total number of calls, in order
to restrict the maximum amount of stack (or heap, if --disable-stack-
for-recursion is specified) that is used. A second limit controls this;
- it defaults to the value that is set for --with-match-limit, which
- imposes no additional constraints. However, you can set a lower limit
- by adding, for example,
+ it defaults to the value that is set for --with-match-limit, which im-
+ poses no additional constraints. However, you can set a lower limit by
+ adding, for example,
--with-match-limit-recursion=10000
@@ -1190,9 +1190,9 @@ USING EBCDIC CODE
--enable-ebcdic
to the configure command. This setting implies --enable-rebuild-charta-
- bles. You should only use it if you know that you are in an EBCDIC
- environment (for example, an IBM mainframe operating system). The
- --enable-ebcdic option is incompatible with --enable-utf.
+ bles. You should only use it if you know that you are in an EBCDIC en-
+ vironment (for example, an IBM mainframe operating system). The --en-
+ able-ebcdic option is incompatible with --enable-utf.
The EBCDIC character that corresponds to an ASCII LF is assumed to have
the value 0x15 by default. However, in some EBCDIC environments, 0x25
@@ -1246,8 +1246,8 @@ PCRETEST OPTION FOR LIBREADLINE SUPPORT
--enable-pcretest-libreadline
- to the configure command, pcretest is linked with the libreadline
- library, and when its input is from a terminal, it reads it using the
+ to the configure command, pcretest is linked with the libreadline li-
+ brary, and when its input is from a terminal, it reads it using the
readline() function. This provides line-editing and history facilities.
Note that libreadline is GPL-licensed, so if you distribute a binary of
pcretest linked in this way, there may be licensing issues.
@@ -1278,8 +1278,8 @@ DEBUGGING WITH VALGRIND SUPPORT
--enable-valgrind
option to to the configure command, PCRE will use valgrind annotations
- to mark certain memory regions as unaddressable. This allows it to
- detect invalid memory accesses, and is mostly useful for debugging PCRE
+ to mark certain memory regions as unaddressable. This allows it to de-
+ tect invalid memory accesses, and is mostly useful for debugging PCRE
itself.
@@ -1372,8 +1372,8 @@ PCRE MATCHING ALGORITHMS
ject string. The "standard" algorithm is the one provided by the
pcre_exec(), pcre16_exec() and pcre32_exec() functions. These work in
the same as as Perl's matching function, and provide a Perl-compatible
- matching operation. The just-in-time (JIT) optimization that is
- described in the pcrejit documentation is compatible with these func-
+ matching operation. The just-in-time (JIT) optimization that is de-
+ scribed in the pcrejit documentation is compatible with these func-
tions.
An alternative algorithm is provided by the pcre_dfa_exec(),
@@ -1448,8 +1448,8 @@ THE ALTERNATIVE MATCHING ALGORITHM
Although the general principle of this matching algorithm is that it
scans the subject string only once, without backtracking, there is one
exception: when a lookaround assertion is encountered, the characters
- following or preceding the current point have to be independently
- inspected.
+ following or preceding the current point have to be independently in-
+ spected.
The scan continues until either the end of the subject is reached, or
there are no more unterminated paths. At this point, terminated paths
@@ -1482,9 +1482,9 @@ THE ALTERNATIVE MATCHING ALGORITHM
There are a number of features of PCRE regular expressions that are not
supported by the alternative matching algorithm. They are as follows:
- 1. Because the algorithm finds all possible matches, the greedy or
- ungreedy nature of repetition quantifiers is not relevant. Greedy and
- ungreedy quantifiers are treated in exactly the same way. However, pos-
+ 1. Because the algorithm finds all possible matches, the greedy or un-
+ greedy nature of repetition quantifiers is not relevant. Greedy and un-
+ greedy quantifiers are treated in exactly the same way. However, pos-
sessive quantifiers can make a difference when what follows could also
match what is quantified, for example in a pattern like this:
@@ -1498,8 +1498,8 @@ THE ALTERNATIVE MATCHING ALGORITHM
2. When dealing with multiple paths through the tree simultaneously, it
is not straightforward to keep track of captured substrings for the
- different matching possibilities, and PCRE's implementation of this
- algorithm does not attempt to do this. This means that no captured sub-
+ different matching possibilities, and PCRE's implementation of this al-
+ gorithm does not attempt to do this. This means that no captured sub-
strings are available.
3. Because no substrings are captured, back references within the pat-
@@ -1509,10 +1509,10 @@ THE ALTERNATIVE MATCHING ALGORITHM
ence as the condition or test for a specific group recursion are not
supported.
- 5. Because many paths through the tree may be active, the \K escape
- sequence, which resets the start of the match when encountered (but may
- be on some paths and not on others), is not supported. It causes an
- error if encountered.
+ 5. Because many paths through the tree may be active, the \K escape se-
+ quence, which resets the start of the match when encountered (but may
+ be on some paths and not on others), is not supported. It causes an er-
+ ror if encountered.
6. Callouts are supported, but the value of the capture_top field is
always 1, and the value of the capture_last field is always -1.
@@ -1719,10 +1719,10 @@ PCRE API OVERVIEW
PCRE has its own native API, which is described in this document. There
are also some wrapper functions (for the 8-bit library only) that cor-
- respond to the POSIX regular expression API, but they do not give
- access to all the functionality. They are described in the pcreposix
- documentation. Both of these APIs define a set of C function calls. A
- C++ wrapper (again for the 8-bit library only) is also distributed with
+ respond to the POSIX regular expression API, but they do not give ac-
+ cess to all the functionality. They are described in the pcreposix doc-
+ umentation. Both of these APIs define a set of C function calls. A C++
+ wrapper (again for the 8-bit library only) is also distributed with
PCRE. It is documented in the pcrecpp page.
The native API C function prototypes are defined in the header file
@@ -1734,10 +1734,10 @@ PCRE API OVERVIEW
for different releases of PCRE.
In a Windows environment, if you want to statically link an application
- program against a non-dll pcre.a file, you must define PCRE_STATIC
- before including pcre.h or pcrecpp.h, because otherwise the pcre_mal-
- loc() and pcre_free() exported functions will be declared
- __declspec(dllimport), with unwanted results.
+ program against a non-dll pcre.a file, you must define PCRE_STATIC be-
+ fore including pcre.h or pcrecpp.h, because otherwise the pcre_malloc()
+ and pcre_free() exported functions will be declared __declspec(dl-
+ limport), with unwanted results.
The functions pcre_compile(), pcre_compile2(), pcre_study(), and
pcre_exec() are used for compiling and matching regular expressions in
@@ -1749,10 +1749,10 @@ PCRE API OVERVIEW
Just-in-time compiler support is an optional feature of PCRE that can
be built in appropriate hardware environments. It greatly speeds up the
- matching performance of many patterns. Simple programs can easily
- request that it be used if available, by setting an option that is
- ignored when it is not relevant. More complicated programs might need
- to make use of the functions pcre_jit_stack_alloc(),
+ matching performance of many patterns. Simple programs can easily re-
+ quest that it be used if available, by setting an option that is ig-
+ nored when it is not relevant. More complicated programs might need to
+ make use of the functions pcre_jit_stack_alloc(),
pcre_jit_stack_free(), and pcre_assign_jit_stack() in order to control
the JIT code's memory usage.
@@ -1784,39 +1784,37 @@ PCRE API OVERVIEW
pcre_free_substring() and pcre_free_substring_list() are also provided,
to free the memory used for extracted strings.
- The function pcre_maketables() is used to build a set of character
- tables in the current locale for passing to pcre_compile(),
- pcre_exec(), or pcre_dfa_exec(). This is an optional facility that is
- provided for specialist use. Most commonly, no special tables are
- passed, in which case internal tables that are generated when PCRE is
- built are used.
+ The function pcre_maketables() is used to build a set of character ta-
+ bles in the current locale for passing to pcre_compile(), pcre_exec(),
+ or pcre_dfa_exec(). This is an optional facility that is provided for
+ specialist use. Most commonly, no special tables are passed, in which
+ case internal tables that are generated when PCRE is built are used.
- The function pcre_fullinfo() is used to find out information about a
- compiled pattern. The function pcre_version() returns a pointer to a
+ The function pcre_fullinfo() is used to find out information about a
+ compiled pattern. The function pcre_version() returns a pointer to a
string containing the version of PCRE and its date of release.
- The function pcre_refcount() maintains a reference count in a data
- block containing a compiled pattern. This is provided for the benefit
+ The function pcre_refcount() maintains a reference count in a data
+ block containing a compiled pattern. This is provided for the benefit
of object-oriented applications.
- The global variables pcre_malloc and pcre_free initially contain the
- entry points of the standard malloc() and free() functions, respec-
+ The global variables pcre_malloc and pcre_free initially contain the
+ entry points of the standard malloc() and free() functions, respec-
tively. PCRE calls the memory management functions via these variables,
- so a calling program can replace them if it wishes to intercept the
+ so a calling program can replace them if it wishes to intercept the
calls. This should be done before calling any PCRE functions.
- The global variables pcre_stack_malloc and pcre_stack_free are also
- indirections to memory management functions. These special functions
- are used only when PCRE is compiled to use the heap for remembering
- data, instead of recursive function calls, when running the pcre_exec()
- function. See the pcrebuild documentation for details of how to do
- this. It is a non-standard way of building PCRE, for use in environ-
- ments that have limited stacks. Because of the greater use of memory
- management, it runs more slowly. Separate functions are provided so
- that special-purpose external code can be used for this case. When
- used, these functions always allocate memory blocks of the same size.
- There is a discussion about PCRE's stack usage in the pcrestack docu-
- mentation.
+ The global variables pcre_stack_malloc and pcre_stack_free are also in-
+ directions to memory management functions. These special functions are
+ used only when PCRE is compiled to use the heap for remembering data,
+ instead of recursive function calls, when running the pcre_exec() func-
+ tion. See the pcrebuild documentation for details of how to do this. It
+ is a non-standard way of building PCRE, for use in environments that
+ have limited stacks. Because of the greater use of memory management,
+ it runs more slowly. Separate functions are provided so that special-
+ purpose external code can be used for this case. When used, these func-
+ tions always allocate memory blocks of the same size. There is a dis-
+ cussion about PCRE's stack usage in the pcrestack documentation.
The global variable pcre_callout initially contains NULL. It can be set
by the caller to a "callout" function, which PCRE will then call at
@@ -1915,24 +1913,24 @@ CHECKING BUILD-TIME OPTIONS
The output is an integer that is set to one if UTF-8 support is avail-
able; otherwise it is set to zero. This value should normally be given
to the 8-bit version of this function, pcre_config(). If it is given to
- the 16-bit or 32-bit version of this function, the result is
- PCRE_ERROR_BADOPTION.
+ the 16-bit or 32-bit version of this function, the result is PCRE_ER-
+ ROR_BADOPTION.
PCRE_CONFIG_UTF16
The output is an integer that is set to one if UTF-16 support is avail-
able; otherwise it is set to zero. This value should normally be given
to the 16-bit version of this function, pcre16_config(). If it is given
- to the 8-bit or 32-bit version of this function, the result is
- PCRE_ERROR_BADOPTION.
+ to the 8-bit or 32-bit version of this function, the result is PCRE_ER-
+ ROR_BADOPTION.
PCRE_CONFIG_UTF32
The output is an integer that is set to one if UTF-32 support is avail-
able; otherwise it is set to zero. This value should normally be given
to the 32-bit version of this function, pcre32_config(). If it is given
- to the 8-bit or 16-bit version of this function, the result is
- PCRE_ERROR_BADOPTION.
+ to the 8-bit or 16-bit version of this function, the result is PCRE_ER-
+ ROR_BADOPTION.
PCRE_CONFIG_UNICODE_PROPERTIES
@@ -1949,8 +1947,8 @@ CHECKING BUILD-TIME OPTIONS
The output is a pointer to a zero-terminated "const char *" string. If
JIT support is available, the string contains the name of the architec-
ture for which the JIT compiler is configured, for example "x86 32bit
- (little endian + unaligned)". If JIT support is not available, the
- result is NULL.
+ (little endian + unaligned)". If JIT support is not available, the re-
+ sult is NULL.
PCRE_CONFIG_NEWLINE
@@ -1973,15 +1971,15 @@ CHECKING BUILD-TIME OPTIONS
PCRE_CONFIG_LINK_SIZE
- The output is an integer that contains the number of bytes used for
- internal linkage in compiled regular expressions. For the 8-bit
- library, the value can be 2, 3, or 4. For the 16-bit library, the value
- is either 2 or 4 and is still a number of bytes. For the 32-bit
- library, the value is either 2 or 4 and is still a number of bytes. The
- default value of 2 is sufficient for all but the most massive patterns,
- since it allows the compiled pattern to be up to 64K in size. Larger
- values allow larger regular expressions to be compiled, at the expense
- of slower matching.
+ The output is an integer that contains the number of bytes used for in-
+ ternal linkage in compiled regular expressions. For the 8-bit library,
+ the value can be 2, 3, or 4. For the 16-bit library, the value is ei-
+ ther 2 or 4 and is still a number of bytes. For the 32-bit library, the
+ value is either 2 or 4 and is still a number of bytes. The default
+ value of 2 is sufficient for all but the most massive patterns, since
+ it allows the compiled pattern to be up to 64K in size. Larger values
+ allow larger regular expressions to be compiled, at the expense of
+ slower matching.
PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
@@ -2009,8 +2007,8 @@ CHECKING BUILD-TIME OPTIONS
The output is a long integer that gives the default limit for the depth
of recursion when calling the internal matching function in a
- pcre_exec() execution. Further details are given with pcre_exec()
- below.
+ pcre_exec() execution. Further details are given with pcre_exec() be-
+ low.
PCRE_CONFIG_STACKRECURSE
@@ -2042,11 +2040,11 @@ COMPILING A PATTERN
the information applies equally to pcre_compile2().
The pattern is a C string terminated by a binary zero, and is passed in
- the pattern argument. A pointer to a single block of memory that is
- obtained via pcre_malloc is returned. This contains the compiled code
- and related data. The pcre type is defined for the returned block; this
- is a typedef for a structure whose contents are not externally defined.
- It is up to the caller to free the memory (via pcre_free) when it is no
+ the pattern argument. A pointer to a single block of memory that is ob-
+ tained via pcre_malloc is returned. This contains the compiled code and
+ related data. The pcre type is defined for the returned block; this is
+ a typedef for a structure whose contents are not externally defined. It
+ is up to the caller to free the memory (via pcre_free) when it is no
longer required.
Although the compiled code of a PCRE regex is relocatable, that is, it
@@ -2089,12 +2087,12 @@ COMPILING A PATTERN
textual error message. Error codes and messages are listed below.
If the final argument, tableptr, is NULL, PCRE uses a default set of
- character tables that are built when PCRE is compiled, using the
- default C locale. Otherwise, tableptr must be an address that is the
- result of a call to pcre_maketables(). This value is stored with the
- compiled pattern, and used again by pcre_exec() and pcre_dfa_exec()
- when the pattern is matched. For more discussion, see the section on
- locale support below.
+ character tables that are built when PCRE is compiled, using the de-
+ fault C locale. Otherwise, tableptr must be an address that is the re-
+ sult of a call to pcre_maketables(). This value is stored with the com-
+ piled pattern, and used again by pcre_exec() and pcre_dfa_exec() when
+ the pattern is matched. For more discussion, see the section on locale
+ support below.
This code fragment shows a typical straightforward call to pcre_com-
pile():
@@ -2178,13 +2176,13 @@ COMPILING A PATTERN
PCRE_EXTENDED
- If this bit is set, most white space characters in the pattern are
- totally ignored except when escaped or inside a character class. How-
- ever, white space is not allowed within sequences such as (?> that
- introduce various parenthesized subpatterns, nor within a numerical
- quantifier such as {1,3}. However, ignorable white space is permitted
- between an item and a following quantifier and between a quantifier and
- a following + that indicates possessiveness.
+ If this bit is set, most white space characters in the pattern are to-
+ tally ignored except when escaped or inside a character class. However,
+ white space is not allowed within sequences such as (?> that introduce
+ various parenthesized subpatterns, nor within a numerical quantifier
+ such as {1,3}. However, ignorable white space is permitted between an
+ item and a following quantifier and between a quantifier and a follow-
+ ing + that indicates possessiveness.
White space did not used to include the VT character (code 11), because
Perl did not treat this character as white space. However, Perl changed
@@ -2196,17 +2194,17 @@ COMPILING A PATTERN
PCRE_EXTENDED is equivalent to Perl's /x option, and it can be changed
within a pattern by a (?x) option setting.
- Which characters are interpreted as newlines is controlled by the
- options passed to pcre_compile() or by a special sequence at the start
- of the pattern, as described in the section entitled "Newline conven-
- tions" in the pcrepattern documentation. Note that the end of this type
- of comment is a literal newline sequence in the pattern; escape
- sequences that happen to represent a newline do not count.
+ Which characters are interpreted as newlines is controlled by the op-
+ tions passed to pcre_compile() or by a special sequence at the start of
+ the pattern, as described in the section entitled "Newline conventions"
+ in the pcrepattern documentation. Note that the end of this type of
+ comment is a literal newline sequence in the pattern; escape sequences
+ that happen to represent a newline do not count.
This option makes it possible to include comments inside complicated
patterns. Note, however, that this applies only to data characters.
- White space characters may never appear within special character
- sequences in a pattern, for example within the sequence (?( that intro-
+ White space characters may never appear within special character se-
+ quences in a pattern, for example within the sequence (?( that intro-
duces a conditional subpattern.
PCRE_EXTRA
@@ -2224,9 +2222,9 @@ COMPILING A PATTERN
PCRE_FIRSTLINE
- If this option is set, an unanchored pattern is required to match
- before or at the first newline in the subject string, though the
- matched text may continue over the newline.
+ If this option is set, an unanchored pattern is required to match be-
+ fore or at the first newline in the subject string, though the matched
+ text may continue over the newline.
PCRE_JAVASCRIPT_COMPAT
@@ -2529,8 +2527,8 @@ STUDYING A PATTERN
pcre_study() returns NULL by default. In that circumstance, if the
calling program wants to pass any of the other fields to pcre_exec() or
pcre_dfa_exec(), it must set up its own pcre_extra block. However, if
- pcre_study() is called with the PCRE_STUDY_EXTRA_NEEDED option, it
- returns a pcre_extra block even if studying did not find any additional
+ pcre_study() is called with the PCRE_STUDY_EXTRA_NEEDED option, it re-
+ turns a pcre_extra block even if studying did not find any additional
information. It may still return NULL, however, if an error occurs in
pcre_study().
@@ -2557,10 +2555,10 @@ STUDYING A PATTERN
The third argument for pcre_study() is a pointer for an error message.
If studying succeeds (even if no data is returned), the variable it
- points to is set to NULL. Otherwise it is set to point to a textual
- error message. This is a static string that is part of the library. You
- must not try to free it. You should test the error pointer for NULL
- after calling pcre_study(), to be sure that it has run successfully.
+ points to is set to NULL. Otherwise it is set to point to a textual er-
+ ror message. This is a static string that is part of the library. You
+ must not try to free it. You should test the error pointer for NULL af-
+ ter calling pcre_study(), to be sure that it has run successfully.
When you are finished with a pattern, you can free the memory used for
the study data by calling pcre_free_study(). This function was added to
@@ -2635,10 +2633,10 @@ LOCALE SUPPORT
Unicode support, or use locales, but not try to mix the two.
PCRE contains an internal set of tables that are used when the final
- argument of pcre_compile() is NULL. These are sufficient for many
- applications. Normally, the internal tables recognize only ASCII char-
- acters. However, when PCRE is built, it is possible to cause the inter-
- nal tables to be rebuilt in the default "C" locale of the local system,
+ argument of pcre_compile() is NULL. These are sufficient for many ap-
+ plications. Normally, the internal tables recognize only ASCII charac-
+ ters. However, when PCRE is built, it is possible to cause the internal
+ tables to be rebuilt in the default "C" locale of the local system,
which may cause them to be different.
The internal tables can always be overridden by tables supplied by the
@@ -2649,9 +2647,9 @@ LOCALE SUPPORT
External tables are built by calling the pcre_maketables() function,
which has no arguments, in the relevant locale. The result can then be
passed to pcre_compile() as often as necessary. For example, to build
- and use tables that are appropriate for the French locale (where
- accented characters with values greater than 128 are treated as let-
- ters), the following code could be used:
+ and use tables that are appropriate for the French locale (where ac-
+ cented characters with values greater than 128 are treated as letters),
+ the following code could be used:
setlocale(LC_CTYPE, "fr_FR");
tables = pcre_maketables();
@@ -2660,8 +2658,8 @@ LOCALE SUPPORT
The locale name "fr_FR" is used on Linux and other Unix-like systems;
if you are using Windows, the name for the French locale is "french".
- When pcre_maketables() runs, the tables are built in memory that is
- obtained via pcre_malloc. It is the caller's responsibility to ensure
+ When pcre_maketables() runs, the tables are built in memory that is ob-
+ tained via pcre_malloc. It is the caller's responsibility to ensure
that the memory containing the tables remains available for as long as
it is needed.
@@ -2706,9 +2704,9 @@ INFORMATION ABOUT A PATTERN
PCRE_ERROR_BADOPTION the value of what was invalid
PCRE_ERROR_UNSET the requested field is not set
- The "magic number" is placed at the start of each compiled pattern as
- an simple check against passing an arbitrary memory pointer. The endi-
- anness error can occur if a compiled pattern is saved and reloaded on a
+ The "magic number" is placed at the start of each compiled pattern as a
+ simple check against passing an arbitrary memory pointer. The endian-
+ ness error can occur if a compiled pattern is saved and reloaded on a
different host. Here is a typical call of pcre_fullinfo(), to obtain
the length of the compiled pattern:
@@ -2745,12 +2743,12 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_FIRSTBYTE (deprecated)
Return information about the first data unit of any matched string, for
- a non-anchored pattern. The name of this option refers to the 8-bit
- library, where data units are bytes. The fourth argument should point
- to an int variable. Negative values are used for special cases. How-
- ever, this means that when the 32-bit library is in non-UTF-32 mode,
- the full 32-bit range of characters cannot be returned. For this rea-
- son, this value is deprecated; use PCRE_INFO_FIRSTCHARACTERFLAGS and
+ a non-anchored pattern. The name of this option refers to the 8-bit li-
+ brary, where data units are bytes. The fourth argument should point to
+ an int variable. Negative values are used for special cases. However,
+ this means that when the 32-bit library is in non-UTF-32 mode, the full
+ 32-bit range of characters cannot be returned. For this reason, this
+ value is deprecated; use PCRE_INFO_FIRSTCHARACTERFLAGS and
PCRE_INFO_FIRSTCHARACTER instead.
If there is a fixed first value, for example, the letter "c" from a
@@ -2774,14 +2772,14 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_FIRSTCHARACTER
Return the value of the first data unit (non-UTF character) of any
- matched string in the situation where PCRE_INFO_FIRSTCHARACTERFLAGS
- returns 1; otherwise return 0. The fourth argument should point to an
+ matched string in the situation where PCRE_INFO_FIRSTCHARACTERFLAGS re-
+ turns 1; otherwise return 0. The fourth argument should point to a
uint_t variable.
In the 8-bit library, the value is always less than 256. In the 16-bit
library the value can be up to 0xffff. In the 32-bit library in UTF-32
- mode the value can be up to 0x10ffff, and up to 0xffffffff when not
- using UTF-32 mode.
+ mode the value can be up to 0x10ffff, and up to 0xffffffff when not us-
+ ing UTF-32 mode.
PCRE_INFO_FIRSTCHARACTERFLAGS
@@ -2853,8 +2851,8 @@ INFORMATION ABOUT A PATTERN
Since for the 32-bit library using the non-UTF-32 mode, this function
is unable to return the full 32-bit range of characters, this value is
- deprecated; instead the PCRE_INFO_REQUIREDCHARFLAGS and
- PCRE_INFO_REQUIREDCHAR values should be used.
+ deprecated; instead the PCRE_INFO_REQUIREDCHARFLAGS and PCRE_INFO_RE-
+ QUIREDCHAR values should be used.
PCRE_INFO_MATCH_EMPTY
@@ -2864,10 +2862,10 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_MATCHLIMIT
If the pattern set a match limit by including an item of the form
- (*LIMIT_MATCH=nnnn) at the start, the value is returned. The fourth
- argument should point to an unsigned 32-bit integer. If no such value
- has been set, the call to pcre_fullinfo() returns the error
- PCRE_ERROR_UNSET.
+ (*LIMIT_MATCH=nnnn) at the start, the value is returned. The fourth ar-
+ gument should point to an unsigned 32-bit integer. If no such value has
+ been set, the call to pcre_fullinfo() returns the error PCRE_ERROR_UN-
+ SET.
PCRE_INFO_MAXLOOKBEHIND
@@ -2903,14 +2901,14 @@ INFORMATION ABOUT A PATTERN
strings by name. It is also possible to extract the data directly, by
first converting the name to a number in order to access the correct
pointers in the output vector (described with pcre_exec() below). To do
- the conversion, you need to use the name-to-number map, which is
- described by these three values.
+ the conversion, you need to use the name-to-number map, which is de-
+ scribed by these three values.
The map consists of a number of fixed-size entries. PCRE_INFO_NAMECOUNT
gives the number of entries, and PCRE_INFO_NAMEENTRYSIZE gives the size
- of each entry; both of these return an int value. The entry size
- depends on the length of the longest name. PCRE_INFO_NAMETABLE returns
- a pointer to the first entry of the table. This is a pointer to char in
+ of each entry; both of these return an int value. The entry size de-
+ pends on the length of the longest name. PCRE_INFO_NAMETABLE returns a
+ pointer to the first entry of the table. This is a pointer to char in
the 8-bit library, where the first two bytes of each entry are the num-
ber of the capturing parenthesis, most significant byte first. In the
16-bit library, the pointer points to 16-bit data units, the first of
@@ -2926,9 +2924,9 @@ INFORMATION ABOUT A PATTERN
for groups of the same number are not permitted. Duplicate names for
subpatterns with different numbers are permitted, but only if PCRE_DUP-
NAMES is set. They appear in the table in the order in which they were
- found in the pattern. In the absence of (?| this is the order of
- increasing number; when (?| is used this is not necessarily the case
- because later subpatterns may have lower numbers.
+ found in the pattern. In the absence of (?| this is the order of in-
+ creasing number; when (?| is used this is not necessarily the case be-
+ cause later subpatterns may have lower numbers.
As a simple example of the name/number table, consider the following
pattern after compilation by the 8-bit library (assume PCRE_EXTENDED is
@@ -2955,8 +2953,8 @@ INFORMATION ABOUT A PATTERN
Return 1 if the pattern can be used for partial matching with
pcre_exec(), otherwise 0. The fourth argument should point to an int
- variable. From release 8.00, this always returns 1, because the
- restrictions that previously applied to partial matching have been
+ variable. From release 8.00, this always returns 1, because the re-
+ strictions that previously applied to partial matching have been
lifted. The pcrepartial documentation gives details of partial match-
ing.
@@ -2971,8 +2969,8 @@ INFORMATION ABOUT A PATTERN
the PCRE_EXTENDED option, the result is PCRE_CASELESS, PCRE_MULTILINE,
and PCRE_EXTENDED.
- A pattern is automatically anchored by PCRE if all of its top-level
- alternatives begin with one of the following:
+ A pattern is automatically anchored by PCRE if all of its top-level al-
+ ternatives begin with one of the following:
^ unless PCRE_MULTILINE is set
\A always
@@ -2988,13 +2986,13 @@ INFORMATION ABOUT A PATTERN
If the pattern set a recursion limit by including an item of the form
(*LIMIT_RECURSION=nnnn) at the start, the value is returned. The fourth
argument should point to an unsigned 32-bit integer. If no such value
- has been set, the call to pcre_fullinfo() returns the error
- PCRE_ERROR_UNSET.
+ has been set, the call to pcre_fullinfo() returns the error PCRE_ER-
+ ROR_UNSET.
PCRE_INFO_SIZE
- Return the size of the compiled pattern in bytes (for all three
- libraries). The fourth argument should point to a size_t variable. This
+ Return the size of the compiled pattern in bytes (for all three li-
+ braries). The fourth argument should point to a size_t variable. This
value does not include the size of the pcre structure that is returned
by pcre_compile(). The value that is passed as the argument to
pcre_malloc() when pcre_compile() is getting memory in which to place
@@ -3024,14 +3022,14 @@ INFORMATION ABOUT A PATTERN
For anchored patterns, a last literal value is recorded only if it fol-
lows something of variable length. For example, for the pattern
- /^a\d+z\d+/ the returned value 1 (with "z" returned from
- PCRE_INFO_REQUIREDCHAR), but for /^a\dz\d/ the returned value is 0.
+ /^a\d+z\d+/ the returned value 1 (with "z" returned from PCRE_INFO_RE-
+ QUIREDCHAR), but for /^a\dz\d/ the returned value is 0.
PCRE_INFO_REQUIREDCHAR
Return the value of the rightmost literal data unit that must exist in
any matched string, other than at its start, if such a value has been
- recorded. The fourth argument should point to an uint32_t variable. If
+ recorded. The fourth argument should point to a uint32_t variable. If
there is no such value, 0 is returned.
@@ -3065,14 +3063,14 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
The function pcre_exec() is called to match a subject string against a
compiled pattern, which is passed in the code argument. If the pattern
- was studied, the result of the study should be passed in the extra
- argument. You can call pcre_exec() with the same code and extra argu-
- ments as many times as you like, in order to match different subject
- strings with the same pattern.
-
- This function is the main matching facility of the library, and it
- operates in a Perl-like manner. For specialist use there is also an
- alternative matching function, which is described below in the section
+ was studied, the result of the study should be passed in the extra ar-
+ gument. You can call pcre_exec() with the same code and extra arguments
+ as many times as you like, in order to match different subject strings
+ with the same pattern.
+
+ This function is the main matching facility of the library, and it op-
+ erates in a Perl-like manner. For specialist use there is also an al-
+ ternative matching function, which is described below in the section
about the pcre_dfa_exec() function.
In most applications, the pattern will have been compiled (and option-
@@ -3142,8 +3140,8 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
ited repeats.
Internally, pcre_exec() uses a function called match(), which it calls
- repeatedly (sometimes recursively). The limit set by match_limit is
- imposed on the number of times this function is called during a match,
+ repeatedly (sometimes recursively). The limit set by match_limit is im-
+ posed on the number of times this function is called during a match,
which has the effect of limiting the amount of backtracking that can
take place. For patterns that are not anchored, the count restarts from
zero for each position in the subject string.
@@ -3155,12 +3153,12 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
used in this case (but in a different way) to limit how long the match-
ing can continue.
- The default value for the limit can be set when PCRE is built; the
- default default is 10 million, which handles all but the most extreme
+ The default value for the limit can be set when PCRE is built; the de-
+ fault default is 10 million, which handles all but the most extreme
cases. You can override the default by suppling pcre_exec() with a
- pcre_extra block in which match_limit is set, and
- PCRE_EXTRA_MATCH_LIMIT is set in the flags field. If the limit is
- exceeded, pcre_exec() returns PCRE_ERROR_MATCHLIMIT.
+ pcre_extra block in which match_limit is set, and PCRE_EX-
+ TRA_MATCH_LIMIT is set in the flags field. If the limit is exceeded,
+ pcre_exec() returns PCRE_ERROR_MATCHLIMIT.
A value for the match limit may also be supplied by an item at the
start of a pattern of the form
@@ -3186,9 +3184,9 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
The default value for match_limit_recursion can be set when PCRE is
built; the default default is the same value as the default for
match_limit. You can override the default by suppling pcre_exec() with
- a pcre_extra block in which match_limit_recursion is set, and
- PCRE_EXTRA_MATCH_LIMIT_RECURSION is set in the flags field. If the
- limit is exceeded, pcre_exec() returns PCRE_ERROR_RECURSIONLIMIT.
+ a pcre_extra block in which match_limit_recursion is set, and PCRE_EX-
+ TRA_MATCH_LIMIT_RECURSION is set in the flags field. If the limit is
+ exceeded, pcre_exec() returns PCRE_ERROR_RECURSIONLIMIT.
A value for the recursion limit may also be supplied by an item at the
start of a pattern of the form
@@ -3265,345 +3263,344 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_NEWLINE_ANYCRLF
PCRE_NEWLINE_ANY
- These options override the newline definition that was chosen or
- defaulted when the pattern was compiled. For details, see the descrip-
- tion of pcre_compile() above. During matching, the newline choice
- affects the behaviour of the dot, circumflex, and dollar metacharac-
- ters. It may also alter the way the match position is advanced after a
- match failure for an unanchored pattern.
+ These options override the newline definition that was chosen or de-
+ faulted when the pattern was compiled. For details, see the description
+ of pcre_compile() above. During matching, the newline choice affects
+ the behaviour of the dot, circumflex, and dollar metacharacters. It may
+ also alter the way the match position is advanced after a match failure
+ for an unanchored pattern.
When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is
set, and a match attempt for an unanchored pattern fails when the cur-
- rent position is at a CRLF sequence, and the pattern contains no
- explicit matches for CR or LF characters, the match position is
- advanced by two characters instead of one, in other words, to after the
- CRLF.
+ rent position is at a CRLF sequence, and the pattern contains no ex-
+ plicit matches for CR or LF characters, the match position is advanced
+ by two characters instead of one, in other words, to after the CRLF.
The above rule is a compromise that makes the most common cases work as
- expected. For example, if the pattern is .+A (and the PCRE_DOTALL
- option is not set), it does not match the string "\r\nA" because, after
- failing at the start, it skips both the CR and the LF before retrying.
- However, the pattern [\r\n]A does match that string, because it con-
+ expected. For example, if the pattern is .+A (and the PCRE_DOTALL op-
+ tion is not set), it does not match the string "\r\nA" because, after
+ failing at the start, it skips both the CR and the LF before retrying.
+ However, the pattern [\r\n]A does match that string, because it con-
tains an explicit CR or LF reference, and so advances only by one char-
acter after the first failure.
An explicit match for CR of LF is either a literal appearance of one of
- those characters, or one of the \r or \n escape sequences. Implicit
- matches such as [^X] do not count, nor does \s (which includes CR and
+ those characters, or one of the \r or \n escape sequences. Implicit
+ matches such as [^X] do not count, nor does \s (which includes CR and
LF in the characters that it matches).
- Notwithstanding the above, anomalous effects may still occur when CRLF
+ Notwithstanding the above, anomalous effects may still occur when CRLF
is a valid newline sequence and explicit \r or \n escapes appear in the
pattern.
PCRE_NOTBOL
This option specifies that first character of the subject string is not
- the beginning of a line, so the circumflex metacharacter should not
- match before it. Setting this without PCRE_MULTILINE (at compile time)
- causes circumflex never to match. This option affects only the behav-
+ the beginning of a line, so the circumflex metacharacter should not
+ match before it. Setting this without PCRE_MULTILINE (at compile time)
+ causes circumflex never to match. This option affects only the behav-
iour of the circumflex metacharacter. It does not affect \A.
PCRE_NOTEOL
This option specifies that the end of the subject string is not the end
- of a line, so the dollar metacharacter should not match it nor (except
- in multiline mode) a newline immediately before it. Setting this with-
+ of a line, so the dollar metacharacter should not match it nor (except
+ in multiline mode) a newline immediately before it. Setting this with-
out PCRE_MULTILINE (at compile time) causes dollar never to match. This
- option affects only the behaviour of the dollar metacharacter. It does
+ option affects only the behaviour of the dollar metacharacter. It does
not affect \Z or \z.
PCRE_NOTEMPTY
An empty string is not considered to be a valid match if this option is
- set. If there are alternatives in the pattern, they are tried. If all
- the alternatives match the empty string, the entire match fails. For
+ set. If there are alternatives in the pattern, they are tried. If all
+ the alternatives match the empty string, the entire match fails. For
example, if the pattern
a?b?
- is applied to a string not beginning with "a" or "b", it matches an
- empty string at the start of the subject. With PCRE_NOTEMPTY set, this
+ is applied to a string not beginning with "a" or "b", it matches an
+ empty string at the start of the subject. With PCRE_NOTEMPTY set, this
match is not valid, so PCRE searches further into the string for occur-
rences of "a" or "b".
PCRE_NOTEMPTY_ATSTART
- This is like PCRE_NOTEMPTY, except that an empty string match that is
- not at the start of the subject is permitted. If the pattern is
- anchored, such a match can occur only if the pattern contains \K.
-
- Perl has no direct equivalent of PCRE_NOTEMPTY or
- PCRE_NOTEMPTY_ATSTART, but it does make a special case of a pattern
- match of the empty string within its split() function, and when using
- the /g modifier. It is possible to emulate Perl's behaviour after
- matching a null string by first trying the match again at the same off-
- set with PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED, and then if that
- fails, by advancing the starting offset (see below) and trying an ordi-
- nary match again. There is some code that demonstrates how to do this
- in the pcredemo sample program. In the most general case, you have to
- check to see if the newline convention recognizes CRLF as a newline,
- and if so, and the current character is CR followed by LF, advance the
- starting offset by two characters instead of one.
+ This is like PCRE_NOTEMPTY, except that an empty string match that is
+ not at the start of the subject is permitted. If the pattern is an-
+ chored, such a match can occur only if the pattern contains \K.
+
+ Perl has no direct equivalent of PCRE_NOTEMPTY or PCRE_NOTEMPTY_AT-
+ START, but it does make a special case of a pattern match of the empty
+ string within its split() function, and when using the /g modifier. It
+ is possible to emulate Perl's behaviour after matching a null string by
+ first trying the match again at the same offset with PCRE_NOTEMPTY_AT-
+ START and PCRE_ANCHORED, and then if that fails, by advancing the
+ starting offset (see below) and trying an ordinary match again. There
+ is some code that demonstrates how to do this in the pcredemo sample
+ program. In the most general case, you have to check to see if the new-
+ line convention recognizes CRLF as a newline, and if so, and the cur-
+ rent character is CR followed by LF, advance the starting offset by two
+ characters instead of one.
PCRE_NO_START_OPTIMIZE
- There are a number of optimizations that pcre_exec() uses at the start
- of a match, in order to speed up the process. For example, if it is
+ There are a number of optimizations that pcre_exec() uses at the start
+ of a match, in order to speed up the process. For example, if it is
known that an unanchored match must start with a specific character, it
- searches the subject for that character, and fails immediately if it
- cannot find it, without actually running the main matching function.
+ searches the subject for that character, and fails immediately if it
+ cannot find it, without actually running the main matching function.
This means that a special item such as (*COMMIT) at the start of a pat-
- tern is not considered until after a suitable starting point for the
- match has been found. Also, when callouts or (*MARK) items are in use,
+ tern is not considered until after a suitable starting point for the
+ match has been found. Also, when callouts or (*MARK) items are in use,
these "start-up" optimizations can cause them to be skipped if the pat-
tern is never actually used. The start-up optimizations are in effect a
pre-scan of the subject that takes place before the pattern is run.
- The PCRE_NO_START_OPTIMIZE option disables the start-up optimizations,
- possibly causing performance to suffer, but ensuring that in cases
- where the result is "no match", the callouts do occur, and that items
+ The PCRE_NO_START_OPTIMIZE option disables the start-up optimizations,
+ possibly causing performance to suffer, but ensuring that in cases
+ where the result is "no match", the callouts do occur, and that items
such as (*COMMIT) and (*MARK) are considered at every possible starting
- position in the subject string. If PCRE_NO_START_OPTIMIZE is set at
- compile time, it cannot be unset at matching time. The use of
+ position in the subject string. If PCRE_NO_START_OPTIMIZE is set at
+ compile time, it cannot be unset at matching time. The use of
PCRE_NO_START_OPTIMIZE at matching time (that is, passing it to
- pcre_exec()) disables JIT execution; in this situation, matching is
- always done using interpretively.
+ pcre_exec()) disables JIT execution; in this situation, matching is al-
+ ways done using interpretively.
- Setting PCRE_NO_START_OPTIMIZE can change the outcome of a matching
- operation. Consider the pattern
+ Setting PCRE_NO_START_OPTIMIZE can change the outcome of a matching op-
+ eration. Consider the pattern
(*COMMIT)ABC
- When this is compiled, PCRE records the fact that a match must start
- with the character "A". Suppose the subject string is "DEFABC". The
- start-up optimization scans along the subject, finds "A" and runs the
- first match attempt from there. The (*COMMIT) item means that the pat-
- tern must match the current starting position, which in this case, it
- does. However, if the same match is run with PCRE_NO_START_OPTIMIZE
- set, the initial scan along the subject string does not happen. The
- first match attempt is run starting from "D" and when this fails,
- (*COMMIT) prevents any further matches being tried, so the overall
- result is "no match". If the pattern is studied, more start-up opti-
- mizations may be used. For example, a minimum length for the subject
- may be recorded. Consider the pattern
+ When this is compiled, PCRE records the fact that a match must start
+ with the character "A". Suppose the subject string is "DEFABC". The
+ start-up optimization scans along the subject, finds "A" and runs the
+ first match attempt from there. The (*COMMIT) item means that the pat-
+ tern must match the current starting position, which in this case, it
+ does. However, if the same match is run with PCRE_NO_START_OPTIMIZE
+ set, the initial scan along the subject string does not happen. The
+ first match attempt is run starting from "D" and when this fails,
+ (*COMMIT) prevents any further matches being tried, so the overall re-
+ sult is "no match". If the pattern is studied, more start-up optimiza-
+ tions may be used. For example, a minimum length for the subject may be
+ recorded. Consider the pattern
(*MARK:A)(X|Y)
- The minimum length for a match is one character. If the subject is
- "ABC", there will be attempts to match "ABC", "BC", "C", and then
- finally an empty string. If the pattern is studied, the final attempt
- does not take place, because PCRE knows that the subject is too short,
- and so the (*MARK) is never encountered. In this case, studying the
- pattern does not affect the overall match result, which is still "no
+ The minimum length for a match is one character. If the subject is
+ "ABC", there will be attempts to match "ABC", "BC", "C", and then fi-
+ nally an empty string. If the pattern is studied, the final attempt
+ does not take place, because PCRE knows that the subject is too short,
+ and so the (*MARK) is never encountered. In this case, studying the
+ pattern does not affect the overall match result, which is still "no
match", but it does affect the auxiliary information that is returned.
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set at compile time, the validity of the subject as a
- UTF-8 string is automatically checked when pcre_exec() is subsequently
+ UTF-8 string is automatically checked when pcre_exec() is subsequently
called. The entire string is checked before any other processing takes
- place. The value of startoffset is also checked to ensure that it
- points to the start of a UTF-8 character. There is a discussion about
- the validity of UTF-8 strings in the pcreunicode page. If an invalid
- sequence of bytes is found, pcre_exec() returns the error
- PCRE_ERROR_BADUTF8 or, if PCRE_PARTIAL_HARD is set and the problem is a
- truncated character at the end of the subject, PCRE_ERROR_SHORTUTF8. In
- both cases, information about the precise nature of the error may also
- be returned (see the descriptions of these errors in the section enti-
- tled Error return values from pcre_exec() below). If startoffset con-
+ place. The value of startoffset is also checked to ensure that it
+ points to the start of a UTF-8 character. There is a discussion about
+ the validity of UTF-8 strings in the pcreunicode page. If an invalid
+ sequence of bytes is found, pcre_exec() returns the error PCRE_ER-
+ ROR_BADUTF8 or, if PCRE_PARTIAL_HARD is set and the problem is a trun-
+ cated character at the end of the subject, PCRE_ERROR_SHORTUTF8. In
+ both cases, information about the precise nature of the error may also
+ be returned (see the descriptions of these errors in the section enti-
+ tled Error return values from pcre_exec() below). If startoffset con-
tains a value that does not point to the start of a UTF-8 character (or
to the end of the subject), PCRE_ERROR_BADUTF8_OFFSET is returned.
- If you already know that your subject is valid, and you want to skip
- these checks for performance reasons, you can set the
- PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
- do this for the second and subsequent calls to pcre_exec() if you are
- making repeated calls to find all the matches in a single subject
- string. However, you should be sure that the value of startoffset
- points to the start of a character (or the end of the subject). When
+ If you already know that your subject is valid, and you want to skip
+ these checks for performance reasons, you can set the
+ PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
+ do this for the second and subsequent calls to pcre_exec() if you are
+ making repeated calls to find all the matches in a single subject
+ string. However, you should be sure that the value of startoffset
+ points to the start of a character (or the end of the subject). When
PCRE_NO_UTF8_CHECK is set, the effect of passing an invalid string as a
- subject or an invalid value of startoffset is undefined. Your program
+ subject or an invalid value of startoffset is undefined. Your program
may crash or loop.
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
- These options turn on the partial matching feature. For backwards com-
- patibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial
- match occurs if the end of the subject string is reached successfully,
- but there are not enough subject characters to complete the match. If
+ These options turn on the partial matching feature. For backwards com-
+ patibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial
+ match occurs if the end of the subject string is reached successfully,
+ but there are not enough subject characters to complete the match. If
this happens when PCRE_PARTIAL_SOFT (but not PCRE_PARTIAL_HARD) is set,
- matching continues by testing any remaining alternatives. Only if no
- complete match can be found is PCRE_ERROR_PARTIAL returned instead of
- PCRE_ERROR_NOMATCH. In other words, PCRE_PARTIAL_SOFT says that the
- caller is prepared to handle a partial match, but only if no complete
+ matching continues by testing any remaining alternatives. Only if no
+ complete match can be found is PCRE_ERROR_PARTIAL returned instead of
+ PCRE_ERROR_NOMATCH. In other words, PCRE_PARTIAL_SOFT says that the
+ caller is prepared to handle a partial match, but only if no complete
match can be found.
- If PCRE_PARTIAL_HARD is set, it overrides PCRE_PARTIAL_SOFT. In this
- case, if a partial match is found, pcre_exec() immediately returns
- PCRE_ERROR_PARTIAL, without considering any other alternatives. In
- other words, when PCRE_PARTIAL_HARD is set, a partial match is consid-
+ If PCRE_PARTIAL_HARD is set, it overrides PCRE_PARTIAL_SOFT. In this
+ case, if a partial match is found, pcre_exec() immediately returns
+ PCRE_ERROR_PARTIAL, without considering any other alternatives. In
+ other words, when PCRE_PARTIAL_HARD is set, a partial match is consid-
ered to be more important that an alternative complete match.
- In both cases, the portion of the string that was inspected when the
+ In both cases, the portion of the string that was inspected when the
partial match was found is set as the first matching string. There is a
- more detailed discussion of partial and multi-segment matching, with
+ more detailed discussion of partial and multi-segment matching, with
examples, in the pcrepartial documentation.
The string to be matched by pcre_exec()
- The subject string is passed to pcre_exec() as a pointer in subject, a
- length in length, and a starting offset in startoffset. The units for
- length and startoffset are bytes for the 8-bit library, 16-bit data
- items for the 16-bit library, and 32-bit data items for the 32-bit
- library.
-
- If startoffset is negative or greater than the length of the subject,
- pcre_exec() returns PCRE_ERROR_BADOFFSET. When the starting offset is
- zero, the search for a match starts at the beginning of the subject,
- and this is by far the most common case. In UTF-8 or UTF-16 mode, the
- offset must point to the start of a character, or the end of the sub-
- ject (in UTF-32 mode, one data unit equals one character, so all off-
- sets are valid). Unlike the pattern string, the subject may contain
- binary zeroes.
-
- A non-zero starting offset is useful when searching for another match
- in the same subject by calling pcre_exec() again after a previous suc-
- cess. Setting startoffset differs from just passing over a shortened
- string and setting PCRE_NOTBOL in the case of a pattern that begins
+ The subject string is passed to pcre_exec() as a pointer in subject, a
+ length in length, and a starting offset in startoffset. The units for
+ length and startoffset are bytes for the 8-bit library, 16-bit data
+ items for the 16-bit library, and 32-bit data items for the 32-bit li-
+ brary.
+
+ If startoffset is negative or greater than the length of the subject,
+ pcre_exec() returns PCRE_ERROR_BADOFFSET. When the starting offset is
+ zero, the search for a match starts at the beginning of the subject,
+ and this is by far the most common case. In UTF-8 or UTF-16 mode, the
+ offset must point to the start of a character, or the end of the sub-
+ ject (in UTF-32 mode, one data unit equals one character, so all off-
+ sets are valid). Unlike the pattern string, the subject may contain bi-
+ nary zeroes.
+
+ A non-zero starting offset is useful when searching for another match
+ in the same subject by calling pcre_exec() again after a previous suc-
+ cess. Setting startoffset differs from just passing over a shortened
+ string and setting PCRE_NOTBOL in the case of a pattern that begins
with any kind of lookbehind. For example, consider the pattern
\Biss\B
- which finds occurrences of "iss" in the middle of words. (\B matches
- only if the current position in the subject is not a word boundary.)
- When applied to the string "Mississipi" the first call to pcre_exec()
- finds the first occurrence. If pcre_exec() is called again with just
- the remainder of the subject, namely "issipi", it does not match,
- because \B is always false at the start of the subject, which is deemed
- to be a word boundary. However, if pcre_exec() is passed the entire
+ which finds occurrences of "iss" in the middle of words. (\B matches
+ only if the current position in the subject is not a word boundary.)
+ When applied to the string "Mississipi" the first call to pcre_exec()
+ finds the first occurrence. If pcre_exec() is called again with just
+ the remainder of the subject, namely "issipi", it does not match, be-
+ cause \B is always false at the start of the subject, which is deemed
+ to be a word boundary. However, if pcre_exec() is passed the entire
string again, but with startoffset set to 4, it finds the second occur-
- rence of "iss" because it is able to look behind the starting point to
+ rence of "iss" because it is able to look behind the starting point to
discover that it is preceded by a letter.
- Finding all the matches in a subject is tricky when the pattern can
+ Finding all the matches in a subject is tricky when the pattern can
match an empty string. It is possible to emulate Perl's /g behaviour by
- first trying the match again at the same offset, with the
- PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED options, and then if that
- fails, advancing the starting offset and trying an ordinary match
+ first trying the match again at the same offset, with the
+ PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED options, and then if that
+ fails, advancing the starting offset and trying an ordinary match
again. There is some code that demonstrates how to do this in the pcre-
demo sample program. In the most general case, you have to check to see
- if the newline convention recognizes CRLF as a newline, and if so, and
+ if the newline convention recognizes CRLF as a newline, and if so, and
the current character is CR followed by LF, advance the starting offset
by two characters instead of one.
- If a non-zero starting offset is passed when the pattern is anchored,
+ If a non-zero starting offset is passed when the pattern is anchored,
one attempt to match at the given offset is made. This can only succeed
- if the pattern does not require the match to be at the start of the
+ if the pattern does not require the match to be at the start of the
subject.
How pcre_exec() returns captured substrings
- In general, a pattern matches a certain portion of the subject, and in
- addition, further substrings from the subject may be picked out by
- parts of the pattern. Following the usage in Jeffrey Friedl's book,
- this is called "capturing" in what follows, and the phrase "capturing
- subpattern" is used for a fragment of a pattern that picks out a sub-
- string. PCRE supports several other kinds of parenthesized subpattern
+ In general, a pattern matches a certain portion of the subject, and in
+ addition, further substrings from the subject may be picked out by
+ parts of the pattern. Following the usage in Jeffrey Friedl's book,
+ this is called "capturing" in what follows, and the phrase "capturing
+ subpattern" is used for a fragment of a pattern that picks out a sub-
+ string. PCRE supports several other kinds of parenthesized subpattern
that do not cause substrings to be captured.
Captured substrings are returned to the caller via a vector of integers
- whose address is passed in ovector. The number of elements in the vec-
- tor is passed in ovecsize, which must be a non-negative number. Note:
+ whose address is passed in ovector. The number of elements in the vec-
+ tor is passed in ovecsize, which must be a non-negative number. Note:
this argument is NOT the size of ovector in bytes.
- The first two-thirds of the vector is used to pass back captured sub-
- strings, each substring using a pair of integers. The remaining third
- of the vector is used as workspace by pcre_exec() while matching cap-
- turing subpatterns, and is not available for passing back information.
- The number passed in ovecsize should always be a multiple of three. If
+ The first two-thirds of the vector is used to pass back captured sub-
+ strings, each substring using a pair of integers. The remaining third
+ of the vector is used as workspace by pcre_exec() while matching cap-
+ turing subpatterns, and is not available for passing back information.
+ The number passed in ovecsize should always be a multiple of three. If
it is not, it is rounded down.
- When a match is successful, information about captured substrings is
- returned in pairs of integers, starting at the beginning of ovector,
- and continuing up to two-thirds of its length at the most. The first
- element of each pair is set to the offset of the first character in a
- substring, and the second is set to the offset of the first character
- after the end of a substring. These values are always data unit off-
- sets, even in UTF mode. They are byte offsets in the 8-bit library,
- 16-bit data item offsets in the 16-bit library, and 32-bit data item
+ When a match is successful, information about captured substrings is
+ returned in pairs of integers, starting at the beginning of ovector,
+ and continuing up to two-thirds of its length at the most. The first
+ element of each pair is set to the offset of the first character in a
+ substring, and the second is set to the offset of the first character
+ after the end of a substring. These values are always data unit off-
+ sets, even in UTF mode. They are byte offsets in the 8-bit library,
+ 16-bit data item offsets in the 16-bit library, and 32-bit data item
offsets in the 32-bit library. Note: they are not character counts.
- The first pair of integers, ovector[0] and ovector[1], identify the
- portion of the subject string matched by the entire pattern. The next
- pair is used for the first capturing subpattern, and so on. The value
+ The first pair of integers, ovector[0] and ovector[1], identify the
+ portion of the subject string matched by the entire pattern. The next
+ pair is used for the first capturing subpattern, and so on. The value
returned by pcre_exec() is one more than the highest numbered pair that
- has been set. For example, if two substrings have been captured, the
- returned value is 3. If there are no capturing subpatterns, the return
+ has been set. For example, if two substrings have been captured, the
+ returned value is 3. If there are no capturing subpatterns, the return
value from a successful match is 1, indicating that just the first pair
of offsets has been set.
If a capturing subpattern is matched repeatedly, it is the last portion
of the string that it matched that is returned.
- If the vector is too small to hold all the captured substring offsets,
+ If the vector is too small to hold all the captured substring offsets,
it is used as far as possible (up to two-thirds of its length), and the
- function returns a value of zero. If neither the actual string matched
- nor any captured substrings are of interest, pcre_exec() may be called
- with ovector passed as NULL and ovecsize as zero. However, if the pat-
- tern contains back references and the ovector is not big enough to
- remember the related substrings, PCRE has to get additional memory for
- use during matching. Thus it is usually advisable to supply an ovector
+ function returns a value of zero. If neither the actual string matched
+ nor any captured substrings are of interest, pcre_exec() may be called
+ with ovector passed as NULL and ovecsize as zero. However, if the pat-
+ tern contains back references and the ovector is not big enough to re-
+ member the related substrings, PCRE has to get additional memory for
+ use during matching. Thus it is usually advisable to supply an ovector
of reasonable size.
- There are some cases where zero is returned (indicating vector over-
- flow) when in fact the vector is exactly the right size for the final
+ There are some cases where zero is returned (indicating vector over-
+ flow) when in fact the vector is exactly the right size for the final
match. For example, consider the pattern
(a)(?:(b)c|bd)
- If a vector of 6 elements (allowing for only 1 captured substring) is
+ If a vector of 6 elements (allowing for only 1 captured substring) is
given with subject string "abd", pcre_exec() will try to set the second
captured string, thereby recording a vector overflow, before failing to
- match "c" and backing up to try the second alternative. The zero
- return, however, does correctly indicate that the maximum number of
- slots (namely 2) have been filled. In similar cases where there is tem-
- porary overflow, but the final number of used slots is actually less
- than the maximum, a non-zero value is returned.
+ match "c" and backing up to try the second alternative. The zero re-
+ turn, however, does correctly indicate that the maximum number of slots
+ (namely 2) have been filled. In similar cases where there is temporary
+ overflow, but the final number of used slots is actually less than the
+ maximum, a non-zero value is returned.
The pcre_fullinfo() function can be used to find out how many capturing
- subpatterns there are in a compiled pattern. The smallest size for
- ovector that will allow for n captured substrings, in addition to the
+ subpatterns there are in a compiled pattern. The smallest size for
+ ovector that will allow for n captured substrings, in addition to the
offsets of the substring matched by the whole pattern, is (n+1)*3.
- It is possible for capturing subpattern number n+1 to match some part
+ It is possible for capturing subpattern number n+1 to match some part
of the subject when subpattern n has not been used at all. For example,
- if the string "abc" is matched against the pattern (a|(z))(bc) the
- return from the function is 4, and subpatterns 1 and 3 are matched, but
- 2 is not. When this happens, both values in the offset pairs corre-
- sponding to unused subpatterns are set to -1.
-
- Offset values that correspond to unused subpatterns at the end of the
- expression are also set to -1. For example, if the string "abc" is
- matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
- matched. The return from the function is 2, because the highest used
- capturing subpattern number is 1, and the offsets for for the second
- and third capturing subpatterns (assuming the vector is large enough,
+ if the string "abc" is matched against the pattern (a|(z))(bc) the re-
+ turn from the function is 4, and subpatterns 1 and 3 are matched, but 2
+ is not. When this happens, both values in the offset pairs correspond-
+ ing to unused subpatterns are set to -1.
+
+ Offset values that correspond to unused subpatterns at the end of the
+ expression are also set to -1. For example, if the string "abc" is
+ matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
+ matched. The return from the function is 2, because the highest used
+ capturing subpattern number is 1, and the offsets for for the second
+ and third capturing subpatterns (assuming the vector is large enough,
of course) are set to -1.
- Note: Elements in the first two-thirds of ovector that do not corre-
- spond to capturing parentheses in the pattern are never changed. That
- is, if a pattern contains n capturing parentheses, no more than ovec-
- tor[0] to ovector[2n+1] are set by pcre_exec(). The other elements (in
+ Note: Elements in the first two-thirds of ovector that do not corre-
+ spond to capturing parentheses in the pattern are never changed. That
+ is, if a pattern contains n capturing parentheses, no more than ovec-
+ tor[0] to ovector[2n+1] are set by pcre_exec(). The other elements (in
the first two-thirds) retain whatever values they previously had.
- Some convenience functions are provided for extracting the captured
+ Some convenience functions are provided for extracting the captured
substrings as separate strings. These are described below.
Error return values from pcre_exec()
- If pcre_exec() fails, it returns a negative number. The following are
+ If pcre_exec() fails, it returns a negative number. The following are
defined in the header file:
PCRE_ERROR_NOMATCH (-1)
@@ -3612,7 +3609,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_NULL (-2)
- Either code or subject was passed as NULL, or ovector was NULL and
+ Either code or subject was passed as NULL, or ovector was NULL and
ovecsize was not zero.
PCRE_ERROR_BADOPTION (-3)
@@ -3621,82 +3618,82 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_BADMAGIC (-4)
- PCRE stores a 4-byte "magic number" at the start of the compiled code,
+ PCRE stores a 4-byte "magic number" at the start of the compiled code,
to catch the case when it is passed a junk pointer and to detect when a
pattern that was compiled in an environment of one endianness is run in
- an environment with the other endianness. This is the error that PCRE
+ an environment with the other endianness. This is the error that PCRE
gives when the magic number is not present.
PCRE_ERROR_UNKNOWN_OPCODE (-5)
While running the pattern match, an unknown item was encountered in the
- compiled pattern. This error could be caused by a bug in PCRE or by
+ compiled pattern. This error could be caused by a bug in PCRE or by
overwriting of the compiled pattern.
PCRE_ERROR_NOMEMORY (-6)
- If a pattern contains back references, but the ovector that is passed
+ If a pattern contains back references, but the ovector that is passed
to pcre_exec() is not big enough to remember the referenced substrings,
- PCRE gets a block of memory at the start of matching to use for this
- purpose. If the call via pcre_malloc() fails, this error is given. The
+ PCRE gets a block of memory at the start of matching to use for this
+ purpose. If the call via pcre_malloc() fails, this error is given. The
memory is automatically freed at the end of matching.
- This error is also given if pcre_stack_malloc() fails in pcre_exec().
- This can happen only when PCRE has been compiled with --disable-stack-
+ This error is also given if pcre_stack_malloc() fails in pcre_exec().
+ This can happen only when PCRE has been compiled with --disable-stack-
for-recursion.
PCRE_ERROR_NOSUBSTRING (-7)
- This error is used by the pcre_copy_substring(), pcre_get_substring(),
- and pcre_get_substring_list() functions (see below). It is never
- returned by pcre_exec().
+ This error is used by the pcre_copy_substring(), pcre_get_substring(),
+ and pcre_get_substring_list() functions (see below). It is never re-
+ turned by pcre_exec().
PCRE_ERROR_MATCHLIMIT (-8)
- The backtracking limit, as specified by the match_limit field in a
- pcre_extra structure (or defaulted) was reached. See the description
+ The backtracking limit, as specified by the match_limit field in a
+ pcre_extra structure (or defaulted) was reached. See the description
above.
PCRE_ERROR_CALLOUT (-9)
This error is never generated by pcre_exec() itself. It is provided for
- use by callout functions that want to yield a distinctive error code.
+ use by callout functions that want to yield a distinctive error code.
See the pcrecallout documentation for details.
PCRE_ERROR_BADUTF8 (-10)
- A string that contains an invalid UTF-8 byte sequence was passed as a
- subject, and the PCRE_NO_UTF8_CHECK option was not set. If the size of
- the output vector (ovecsize) is at least 2, the byte offset to the
- start of the the invalid UTF-8 character is placed in the first ele-
- ment, and a reason code is placed in the second element. The reason
+ A string that contains an invalid UTF-8 byte sequence was passed as a
+ subject, and the PCRE_NO_UTF8_CHECK option was not set. If the size of
+ the output vector (ovecsize) is at least 2, the byte offset to the
+ start of the the invalid UTF-8 character is placed in the first ele-
+ ment, and a reason code is placed in the second element. The reason
codes are listed in the following section. For backward compatibility,
- if PCRE_PARTIAL_HARD is set and the problem is a truncated UTF-8 char-
- acter at the end of the subject (reason codes 1 to 5),
- PCRE_ERROR_SHORTUTF8 is returned instead of PCRE_ERROR_BADUTF8.
+ if PCRE_PARTIAL_HARD is set and the problem is a truncated UTF-8 char-
+ acter at the end of the subject (reason codes 1 to 5), PCRE_ER-
+ ROR_SHORTUTF8 is returned instead of PCRE_ERROR_BADUTF8.
PCRE_ERROR_BADUTF8_OFFSET (-11)
- The UTF-8 byte sequence that was passed as a subject was checked and
- found to be valid (the PCRE_NO_UTF8_CHECK option was not set), but the
- value of startoffset did not point to the beginning of a UTF-8 charac-
+ The UTF-8 byte sequence that was passed as a subject was checked and
+ found to be valid (the PCRE_NO_UTF8_CHECK option was not set), but the
+ value of startoffset did not point to the beginning of a UTF-8 charac-
ter or the end of the subject.
PCRE_ERROR_PARTIAL (-12)
- The subject string did not match, but it did match partially. See the
+ The subject string did not match, but it did match partially. See the
pcrepartial documentation for details of partial matching.
PCRE_ERROR_BADPARTIAL (-13)
- This code is no longer in use. It was formerly returned when the
- PCRE_PARTIAL option was used with a compiled pattern containing items
- that were not supported for partial matching. From release 8.00
- onwards, there are no restrictions on partial matching.
+ This code is no longer in use. It was formerly returned when the
+ PCRE_PARTIAL option was used with a compiled pattern containing items
+ that were not supported for partial matching. From release 8.00 on-
+ wards, there are no restrictions on partial matching.
PCRE_ERROR_INTERNAL (-14)
- An unexpected internal error has occurred. This error could be caused
+ An unexpected internal error has occurred. This error could be caused
by a bug in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
@@ -3706,8 +3703,8 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_RECURSIONLIMIT (-21)
The internal recursion limit, as specified by the match_limit_recursion
- field in a pcre_extra structure (or defaulted) was reached. See the
- description above.
+ field in a pcre_extra structure (or defaulted) was reached. See the de-
+ scription above.
PCRE_ERROR_BADNEWLINE (-23)
@@ -3720,30 +3717,30 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_SHORTUTF8 (-25)
- This error is returned instead of PCRE_ERROR_BADUTF8 when the subject
- string ends with a truncated UTF-8 character and the PCRE_PARTIAL_HARD
- option is set. Information about the failure is returned as for
- PCRE_ERROR_BADUTF8. It is in fact sufficient to detect this case, but
- this special error code for PCRE_PARTIAL_HARD precedes the implementa-
- tion of returned information; it is retained for backwards compatibil-
+ This error is returned instead of PCRE_ERROR_BADUTF8 when the subject
+ string ends with a truncated UTF-8 character and the PCRE_PARTIAL_HARD
+ option is set. Information about the failure is returned as for
+ PCRE_ERROR_BADUTF8. It is in fact sufficient to detect this case, but
+ this special error code for PCRE_PARTIAL_HARD precedes the implementa-
+ tion of returned information; it is retained for backwards compatibil-
ity.
PCRE_ERROR_RECURSELOOP (-26)
This error is returned when pcre_exec() detects a recursion loop within
- the pattern. Specifically, it means that either the whole pattern or a
- subpattern has been called recursively for the second time at the same
+ the pattern. Specifically, it means that either the whole pattern or a
+ subpattern has been called recursively for the second time at the same
position in the subject string. Some simple patterns that might do this
- are detected and faulted at compile time, but more complicated cases,
+ are detected and faulted at compile time, but more complicated cases,
in particular mutual recursions between two different subpatterns, can-
not be detected until run time.
PCRE_ERROR_JIT_STACKLIMIT (-27)
- This error is returned when a pattern that was successfully studied
- using a JIT compile option is being matched, but the memory available
- for the just-in-time processing stack is not large enough. See the
- pcrejit documentation for more details.
+ This error is returned when a pattern that was successfully studied us-
+ ing a JIT compile option is being matched, but the memory available for
+ the just-in-time processing stack is not large enough. See the pcrejit
+ documentation for more details.
PCRE_ERROR_BADMODE (-28)
@@ -3752,38 +3749,38 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_BADENDIANNESS (-29)
- This error is given if a pattern that was compiled and saved is
- reloaded on a host with different endianness. The utility function
+ This error is given if a pattern that was compiled and saved is
+ reloaded on a host with different endianness. The utility function
pcre_pattern_to_host_byte_order() can be used to convert such a pattern
so that it runs on the new host.
PCRE_ERROR_JIT_BADOPTION
- This error is returned when a pattern that was successfully studied
- using a JIT compile option is being matched, but the matching mode
- (partial or complete match) does not correspond to any JIT compilation
- mode. When the JIT fast path function is used, this error may be also
- given for invalid options. See the pcrejit documentation for more
- details.
+ This error is returned when a pattern that was successfully studied us-
+ ing a JIT compile option is being matched, but the matching mode (par-
+ tial or complete match) does not correspond to any JIT compilation
+ mode. When the JIT fast path function is used, this error may be also
+ given for invalid options. See the pcrejit documentation for more de-
+ tails.
PCRE_ERROR_BADLENGTH (-32)
- This error is given if pcre_exec() is called with a negative value for
+ This error is given if pcre_exec() is called with a negative value for
the length argument.
Error numbers -16 to -20, -22, and 30 are not used by pcre_exec().
Reason codes for invalid UTF-8 strings
- This section applies only to the 8-bit library. The corresponding
- information for the 16-bit and 32-bit libraries is given in the pcre16
+ This section applies only to the 8-bit library. The corresponding in-
+ formation for the 16-bit and 32-bit libraries is given in the pcre16
and pcre32 pages.
When pcre_exec() returns either PCRE_ERROR_BADUTF8 or PCRE_ERROR_SHORT-
- UTF8, and the size of the output vector (ovecsize) is at least 2, the
- offset of the start of the invalid UTF-8 character is placed in the
+ UTF8, and the size of the output vector (ovecsize) is at least 2, the
+ offset of the start of the invalid UTF-8 character is placed in the
first output vector element (ovector[0]) and a reason code is placed in
- the second element (ovector[1]). The reason codes are given names in
+ the second element (ovector[1]). The reason codes are given names in
the pcre.h header file:
PCRE_UTF8_ERR1
@@ -3792,10 +3789,10 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_UTF8_ERR4
PCRE_UTF8_ERR5
- The string ends with a truncated UTF-8 character; the code specifies
- how many bytes are missing (1 to 5). Although RFC 3629 restricts UTF-8
- characters to be no longer than 4 bytes, the encoding scheme (origi-
- nally defined by RFC 2279) allows for up to 6 bytes, and this is
+ The string ends with a truncated UTF-8 character; the code specifies
+ how many bytes are missing (1 to 5). Although RFC 3629 restricts UTF-8
+ characters to be no longer than 4 bytes, the encoding scheme (origi-
+ nally defined by RFC 2279) allows for up to 6 bytes, and this is
checked first; hence the possibility of 4 or 5 missing bytes.
PCRE_UTF8_ERR6
@@ -3805,24 +3802,24 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_UTF8_ERR10
The two most significant bits of the 2nd, 3rd, 4th, 5th, or 6th byte of
- the character do not have the binary value 0b10 (that is, either the
+ the character do not have the binary value 0b10 (that is, either the
most significant bit is 0, or the next bit is 1).
PCRE_UTF8_ERR11
PCRE_UTF8_ERR12
- A character that is valid by the RFC 2279 rules is either 5 or 6 bytes
+ A character that is valid by the RFC 2279 rules is either 5 or 6 bytes
long; these code points are excluded by RFC 3629.
PCRE_UTF8_ERR13
- A 4-byte character has a value greater than 0x10fff; these code points
+ A 4-byte character has a value greater than 0x10fff; these code points
are excluded by RFC 3629.
PCRE_UTF8_ERR14
- A 3-byte character has a value in the range 0xd800 to 0xdfff; this
- range of code points are reserved by RFC 3629 for use with UTF-16, and
+ A 3-byte character has a value in the range 0xd800 to 0xdfff; this
+ range of code points are reserved by RFC 3629 for use with UTF-16, and
so are excluded from UTF-8.
PCRE_UTF8_ERR15
@@ -3831,28 +3828,28 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_UTF8_ERR18
PCRE_UTF8_ERR19
- A 2-, 3-, 4-, 5-, or 6-byte character is "overlong", that is, it codes
- for a value that can be represented by fewer bytes, which is invalid.
- For example, the two bytes 0xc0, 0xae give the value 0x2e, whose cor-
+ A 2-, 3-, 4-, 5-, or 6-byte character is "overlong", that is, it codes
+ for a value that can be represented by fewer bytes, which is invalid.
+ For example, the two bytes 0xc0, 0xae give the value 0x2e, whose cor-
rect coding uses just one byte.
PCRE_UTF8_ERR20
The two most significant bits of the first byte of a character have the
- binary value 0b10 (that is, the most significant bit is 1 and the sec-
- ond is 0). Such a byte can only validly occur as the second or subse-
+ binary value 0b10 (that is, the most significant bit is 1 and the sec-
+ ond is 0). Such a byte can only validly occur as the second or subse-
quent byte of a multi-byte character.
PCRE_UTF8_ERR21
- The first byte of a character has the value 0xfe or 0xff. These values
+ The first byte of a character has the value 0xfe or 0xff. These values
can never occur in a valid UTF-8 string.
PCRE_UTF8_ERR22
- This error code was formerly used when the presence of a so-called
- "non-character" caused an error. Unicode corrigendum #9 makes it clear
- that such characters should not cause a string to be rejected, and so
+ This error code was formerly used when the presence of a so-called
+ "non-character" caused an error. Unicode corrigendum #9 makes it clear
+ that such characters should not cause a string to be rejected, and so
this code is no longer in use and is never returned.
@@ -3869,78 +3866,78 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
int pcre_get_substring_list(const char *subject,
int *ovector, int stringcount, const char ***listptr);
- Captured substrings can be accessed directly by using the offsets
- returned by pcre_exec() in ovector. For convenience, the functions
+ Captured substrings can be accessed directly by using the offsets re-
+ turned by pcre_exec() in ovector. For convenience, the functions
pcre_copy_substring(), pcre_get_substring(), and pcre_get_sub-
- string_list() are provided for extracting captured substrings as new,
- separate, zero-terminated strings. These functions identify substrings
- by number. The next section describes functions for extracting named
+ string_list() are provided for extracting captured substrings as new,
+ separate, zero-terminated strings. These functions identify substrings
+ by number. The next section describes functions for extracting named
substrings.
- A substring that contains a binary zero is correctly extracted and has
- a further zero added on the end, but the result is not, of course, a C
- string. However, you can process such a string by referring to the
- length that is returned by pcre_copy_substring() and pcre_get_sub-
+ A substring that contains a binary zero is correctly extracted and has
+ a further zero added on the end, but the result is not, of course, a C
+ string. However, you can process such a string by referring to the
+ length that is returned by pcre_copy_substring() and pcre_get_sub-
string(). Unfortunately, the interface to pcre_get_substring_list() is
- not adequate for handling strings containing binary zeros, because the
+ not adequate for handling strings containing binary zeros, because the
end of the final string is not independently indicated.
- The first three arguments are the same for all three of these func-
- tions: subject is the subject string that has just been successfully
+ The first three arguments are the same for all three of these func-
+ tions: subject is the subject string that has just been successfully
matched, ovector is a pointer to the vector of integer offsets that was
passed to pcre_exec(), and stringcount is the number of substrings that
- were captured by the match, including the substring that matched the
+ were captured by the match, including the substring that matched the
entire regular expression. This is the value returned by pcre_exec() if
- it is greater than zero. If pcre_exec() returned zero, indicating that
- it ran out of space in ovector, the value passed as stringcount should
+ it is greater than zero. If pcre_exec() returned zero, indicating that
+ it ran out of space in ovector, the value passed as stringcount should
be the number of elements in the vector divided by three.
- The functions pcre_copy_substring() and pcre_get_substring() extract a
- single substring, whose number is given as stringnumber. A value of
- zero extracts the substring that matched the entire pattern, whereas
- higher values extract the captured substrings. For pcre_copy_sub-
- string(), the string is placed in buffer, whose length is given by
- buffersize, while for pcre_get_substring() a new block of memory is
- obtained via pcre_malloc, and its address is returned via stringptr.
- The yield of the function is the length of the string, not including
- the terminating zero, or one of these error codes:
+ The functions pcre_copy_substring() and pcre_get_substring() extract a
+ single substring, whose number is given as stringnumber. A value of
+ zero extracts the substring that matched the entire pattern, whereas
+ higher values extract the captured substrings. For pcre_copy_sub-
+ string(), the string is placed in buffer, whose length is given by
+ buffersize, while for pcre_get_substring() a new block of memory is ob-
+ tained via pcre_malloc, and its address is returned via stringptr. The
+ yield of the function is the length of the string, not including the
+ terminating zero, or one of these error codes:
PCRE_ERROR_NOMEMORY (-6)
- The buffer was too small for pcre_copy_substring(), or the attempt to
+ The buffer was too small for pcre_copy_substring(), or the attempt to
get memory failed for pcre_get_substring().
PCRE_ERROR_NOSUBSTRING (-7)
There is no substring whose number is stringnumber.
- The pcre_get_substring_list() function extracts all available sub-
- strings and builds a list of pointers to them. All this is done in a
+ The pcre_get_substring_list() function extracts all available sub-
+ strings and builds a list of pointers to them. All this is done in a
single block of memory that is obtained via pcre_malloc. The address of
- the memory block is returned via listptr, which is also the start of
- the list of string pointers. The end of the list is marked by a NULL
- pointer. The yield of the function is zero if all went well, or the
- error code
+ the memory block is returned via listptr, which is also the start of
+ the list of string pointers. The end of the list is marked by a NULL
+ pointer. The yield of the function is zero if all went well, or the er-
+ ror code
PCRE_ERROR_NOMEMORY (-6)
if the attempt to get the memory block failed.
- When any of these functions encounter a substring that is unset, which
- can happen when capturing subpattern number n+1 matches some part of
- the subject, but subpattern n has not been used at all, they return an
+ When any of these functions encounter a substring that is unset, which
+ can happen when capturing subpattern number n+1 matches some part of
+ the subject, but subpattern n has not been used at all, they return an
empty string. This can be distinguished from a genuine zero-length sub-
- string by inspecting the appropriate offset in ovector, which is nega-
+ string by inspecting the appropriate offset in ovector, which is nega-
tive for unset substrings.
- The two convenience functions pcre_free_substring() and pcre_free_sub-
- string_list() can be used to free the memory returned by a previous
+ The two convenience functions pcre_free_substring() and pcre_free_sub-
+ string_list() can be used to free the memory returned by a previous
call of pcre_get_substring() or pcre_get_substring_list(), respec-
- tively. They do nothing more than call the function pointed to by
- pcre_free, which of course could be called directly from a C program.
- However, PCRE is used in some situations where it is linked via a spe-
- cial interface to another programming language that cannot use
- pcre_free directly; it is for these cases that the functions are pro-
+ tively. They do nothing more than call the function pointed to by
+ pcre_free, which of course could be called directly from a C program.
+ However, PCRE is used in some situations where it is linked via a spe-
+ cial interface to another programming language that cannot use
+ pcre_free directly; it is for these cases that the functions are pro-
vided.
@@ -3959,7 +3956,7 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
int stringcount, const char *stringname,
const char **stringptr);
- To extract a substring by name, you first have to find associated num-
+ To extract a substring by name, you first have to find associated num-
ber. For example, for this pattern
(a+)b(?<xxx>\d+)...
@@ -3968,35 +3965,35 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
be unique (PCRE_DUPNAMES was not set), you can find the number from the
name by calling pcre_get_stringnumber(). The first argument is the com-
piled pattern, and the second is the name. The yield of the function is
- the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
+ the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
subpattern of that name.
Given the number, you can extract the substring directly, or use one of
the functions described in the previous section. For convenience, there
are also two functions that do the whole job.
- Most of the arguments of pcre_copy_named_substring() and
- pcre_get_named_substring() are the same as those for the similarly
- named functions that extract by number. As these are described in the
- previous section, they are not re-described here. There are just two
+ Most of the arguments of pcre_copy_named_substring() and
+ pcre_get_named_substring() are the same as those for the similarly
+ named functions that extract by number. As these are described in the
+ previous section, they are not re-described here. There are just two
differences:
- First, instead of a substring number, a substring name is given. Sec-
+ First, instead of a substring number, a substring name is given. Sec-
ond, there is an extra argument, given at the start, which is a pointer
- to the compiled pattern. This is needed in order to gain access to the
+ to the compiled pattern. This is needed in order to gain access to the
name-to-number translation table.
- These functions call pcre_get_stringnumber(), and if it succeeds, they
- then call pcre_copy_substring() or pcre_get_substring(), as appropri-
- ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
+ These functions call pcre_get_stringnumber(), and if it succeeds, they
+ then call pcre_copy_substring() or pcre_get_substring(), as appropri-
+ ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
behaviour may not be what you want (see the next section).
Warning: If the pattern uses the (?| feature to set up multiple subpat-
- terns with the same number, as described in the section on duplicate
- subpattern numbers in the pcrepattern page, you cannot use names to
- distinguish the different subpatterns, because names are not included
- in the compiled code. The matching process uses only numbers. For this
- reason, the use of different names for subpatterns of the same number
+ terns with the same number, as described in the section on duplicate
+ subpattern numbers in the pcrepattern page, you cannot use names to
+ distinguish the different subpatterns, because names are not included
+ in the compiled code. The matching process uses only numbers. For this
+ reason, the use of different names for subpatterns of the same number
causes an error at compile time.
@@ -4005,77 +4002,77 @@ DUPLICATE SUBPATTERN NAMES
int pcre_get_stringtable_entries(const pcre *code,
const char *name, char **first, char **last);
- When a pattern is compiled with the PCRE_DUPNAMES option, names for
- subpatterns are not required to be unique. (Duplicate names are always
- allowed for subpatterns with the same number, created by using the (?|
- feature. Indeed, if such subpatterns are named, they are required to
+ When a pattern is compiled with the PCRE_DUPNAMES option, names for
+ subpatterns are not required to be unique. (Duplicate names are always
+ allowed for subpatterns with the same number, created by using the (?|
+ feature. Indeed, if such subpatterns are named, they are required to
use the same names.)
Normally, patterns with duplicate names are such that in any one match,
- only one of the named subpatterns participates. An example is shown in
+ only one of the named subpatterns participates. An example is shown in
the pcrepattern documentation.
- When duplicates are present, pcre_copy_named_substring() and
- pcre_get_named_substring() return the first substring corresponding to
- the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING
- (-7) is returned; no data is returned. The pcre_get_stringnumber()
- function returns one of the numbers that are associated with the name,
+ When duplicates are present, pcre_copy_named_substring() and
+ pcre_get_named_substring() return the first substring corresponding to
+ the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING
+ (-7) is returned; no data is returned. The pcre_get_stringnumber()
+ function returns one of the numbers that are associated with the name,
but it is not defined which it is.
- If you want to get full details of all captured substrings for a given
- name, you must use the pcre_get_stringtable_entries() function. The
+ If you want to get full details of all captured substrings for a given
+ name, you must use the pcre_get_stringtable_entries() function. The
first argument is the compiled pattern, and the second is the name. The
- third and fourth are pointers to variables which are updated by the
+ third and fourth are pointers to variables which are updated by the
function. After it has run, they point to the first and last entries in
- the name-to-number table for the given name. The function itself
- returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
- there are none. The format of the table is described above in the sec-
- tion entitled Information about a pattern above. Given all the rele-
- vant entries for the name, you can extract each of their numbers, and
- hence the captured data, if any.
+ the name-to-number table for the given name. The function itself re-
+ turns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if there
+ are none. The format of the table is described above in the section en-
+ titled Information about a pattern above. Given all the relevant en-
+ tries for the name, you can extract each of their numbers, and hence
+ the captured data, if any.
FINDING ALL POSSIBLE MATCHES
- The traditional matching function uses a similar algorithm to Perl,
+ The traditional matching function uses a similar algorithm to Perl,
which stops when it finds the first match, starting at a given point in
- the subject. If you want to find all possible matches, or the longest
- possible match, consider using the alternative matching function (see
- below) instead. If you cannot use the alternative function, but still
- need to find all possible matches, you can kludge it up by making use
+ the subject. If you want to find all possible matches, or the longest
+ possible match, consider using the alternative matching function (see
+ below) instead. If you cannot use the alternative function, but still
+ need to find all possible matches, you can kludge it up by making use
of the callout facility, which is described in the pcrecallout documen-
tation.
What you have to do is to insert a callout right at the end of the pat-
- tern. When your callout function is called, extract and save the cur-
- rent matched substring. Then return 1, which forces pcre_exec() to
- backtrack and try other alternatives. Ultimately, when it runs out of
+ tern. When your callout function is called, extract and save the cur-
+ rent matched substring. Then return 1, which forces pcre_exec() to
+ backtrack and try other alternatives. Ultimately, when it runs out of
matches, pcre_exec() will yield PCRE_ERROR_NOMATCH.
OBTAINING AN ESTIMATE OF STACK USAGE
- Matching certain patterns using pcre_exec() can use a lot of process
- stack, which in certain environments can be rather limited in size.
- Some users find it helpful to have an estimate of the amount of stack
- that is used by pcre_exec(), to help them set recursion limits, as
- described in the pcrestack documentation. The estimate that is output
- by pcretest when called with the -m and -C options is obtained by call-
- ing pcre_exec with the values NULL, NULL, NULL, -999, and -999 for its
+ Matching certain patterns using pcre_exec() can use a lot of process
+ stack, which in certain environments can be rather limited in size.
+ Some users find it helpful to have an estimate of the amount of stack
+ that is used by pcre_exec(), to help them set recursion limits, as de-
+ scribed in the pcrestack documentation. The estimate that is output by
+ pcretest when called with the -m and -C options is obtained by calling
+ pcre_exec with the values NULL, NULL, NULL, -999, and -999 for its
first five arguments.
- Normally, if its first argument is NULL, pcre_exec() immediately
- returns the negative error code PCRE_ERROR_NULL, but with this special
- combination of arguments, it returns instead a negative number whose
- absolute value is the approximate stack frame size in bytes. (A nega-
- tive number is used so that it is clear that no match has happened.)
- The value is approximate because in some cases, recursive calls to
+ Normally, if its first argument is NULL, pcre_exec() immediately re-
+ turns the negative error code PCRE_ERROR_NULL, but with this special
+ combination of arguments, it returns instead a negative number whose
+ absolute value is the approximate stack frame size in bytes. (A nega-
+ tive number is used so that it is clear that no match has happened.)
+ The value is approximate because in some cases, recursive calls to
pcre_exec() occur when there are one or two additional variables on the
stack.
- If PCRE has been compiled to use the heap instead of the stack for
- recursion, the value returned is the size of each block that is
- obtained from the heap.
+ If PCRE has been compiled to use the heap instead of the stack for re-
+ cursion, the value returned is the size of each block that is obtained
+ from the heap.
MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
@@ -4085,26 +4082,26 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
int options, int *ovector, int ovecsize,
int *workspace, int wscount);
- The function pcre_dfa_exec() is called to match a subject string
- against a compiled pattern, using a matching algorithm that scans the
- subject string just once, and does not backtrack. This has different
- characteristics to the normal algorithm, and is not compatible with
- Perl. Some of the features of PCRE patterns are not supported. Never-
- theless, there are times when this kind of matching can be useful. For
- a discussion of the two matching algorithms, and a list of features
- that pcre_dfa_exec() does not support, see the pcrematching documenta-
+ The function pcre_dfa_exec() is called to match a subject string
+ against a compiled pattern, using a matching algorithm that scans the
+ subject string just once, and does not backtrack. This has different
+ characteristics to the normal algorithm, and is not compatible with
+ Perl. Some of the features of PCRE patterns are not supported. Never-
+ theless, there are times when this kind of matching can be useful. For
+ a discussion of the two matching algorithms, and a list of features
+ that pcre_dfa_exec() does not support, see the pcrematching documenta-
tion.
- The arguments for the pcre_dfa_exec() function are the same as for
+ The arguments for the pcre_dfa_exec() function are the same as for
pcre_exec(), plus two extras. The ovector argument is used in a differ-
- ent way, and this is described below. The other common arguments are
- used in the same way as for pcre_exec(), so their description is not
+ ent way, and this is described below. The other common arguments are
+ used in the same way as for pcre_exec(), so their description is not
repeated here.
- The two additional arguments provide workspace for the function. The
- workspace vector should contain at least 20 elements. It is used for
+ The two additional arguments provide workspace for the function. The
+ workspace vector should contain at least 20 elements. It is used for
keeping track of multiple paths through the pattern tree. More
- workspace will be needed for patterns and subjects where there are a
+ workspace will be needed for patterns and subjects where there are a
lot of potential matches.
Here is an example of a simple call to pcre_dfa_exec():
@@ -4126,55 +4123,55 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
Option bits for pcre_dfa_exec()
- The unused bits of the options argument for pcre_dfa_exec() must be
- zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
- LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY,
- PCRE_NOTEMPTY_ATSTART, PCRE_NO_UTF8_CHECK, PCRE_BSR_ANYCRLF,
- PCRE_BSR_UNICODE, PCRE_NO_START_OPTIMIZE, PCRE_PARTIAL_HARD, PCRE_PAR-
- TIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
- four of these are exactly the same as for pcre_exec(), so their
- description is not repeated here.
+ The unused bits of the options argument for pcre_dfa_exec() must be
+ zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
+ LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_AT-
+ START, PCRE_NO_UTF8_CHECK, PCRE_BSR_ANYCRLF, PCRE_BSR_UNICODE,
+ PCRE_NO_START_OPTIMIZE, PCRE_PARTIAL_HARD, PCRE_PARTIAL_SOFT,
+ PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last four of
+ these are exactly the same as for pcre_exec(), so their description is
+ not repeated here.
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
- These have the same general effect as they do for pcre_exec(), but the
- details are slightly different. When PCRE_PARTIAL_HARD is set for
- pcre_dfa_exec(), it returns PCRE_ERROR_PARTIAL if the end of the sub-
- ject is reached and there is still at least one matching possibility
+ These have the same general effect as they do for pcre_exec(), but the
+ details are slightly different. When PCRE_PARTIAL_HARD is set for
+ pcre_dfa_exec(), it returns PCRE_ERROR_PARTIAL if the end of the sub-
+ ject is reached and there is still at least one matching possibility
that requires additional characters. This happens even if some complete
matches have also been found. When PCRE_PARTIAL_SOFT is set, the return
code PCRE_ERROR_NOMATCH is converted into PCRE_ERROR_PARTIAL if the end
- of the subject is reached, there have been no complete matches, but
- there is still at least one matching possibility. The portion of the
- string that was inspected when the longest partial match was found is
- set as the first matching string in both cases. There is a more
- detailed discussion of partial and multi-segment matching, with exam-
- ples, in the pcrepartial documentation.
+ of the subject is reached, there have been no complete matches, but
+ there is still at least one matching possibility. The portion of the
+ string that was inspected when the longest partial match was found is
+ set as the first matching string in both cases. There is a more de-
+ tailed discussion of partial and multi-segment matching, with examples,
+ in the pcrepartial documentation.
PCRE_DFA_SHORTEST
- Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
+ Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to
stop as soon as it has found one match. Because of the way the alterna-
- tive algorithm works, this is necessarily the shortest possible match
+ tive algorithm works, this is necessarily the shortest possible match
at the first possible matching point in the subject string.
PCRE_DFA_RESTART
When pcre_dfa_exec() returns a partial match, it is possible to call it
- again, with additional subject characters, and have it continue with
- the same match. The PCRE_DFA_RESTART option requests this action; when
- it is set, the workspace and wscount options must reference the same
- vector as before because data about the match so far is left in them
+ again, with additional subject characters, and have it continue with
+ the same match. The PCRE_DFA_RESTART option requests this action; when
+ it is set, the workspace and wscount options must reference the same
+ vector as before because data about the match so far is left in them
after a partial match. There is more discussion of this facility in the
pcrepartial documentation.
Successful returns from pcre_dfa_exec()
- When pcre_dfa_exec() succeeds, it may have matched more than one sub-
+ When pcre_dfa_exec() succeeds, it may have matched more than one sub-
string in the subject. Note, however, that all the matches from one run
- of the function start at the same point in the subject. The shorter
- matches are all initial substrings of the longer matches. For example,
+ of the function start at the same point in the subject. The shorter
+ matches are all initial substrings of the longer matches. For example,
if the pattern
<.*>
@@ -4189,79 +4186,79 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
<something> <something else>
<something> <something else> <something further>
- On success, the yield of the function is a number greater than zero,
- which is the number of matched substrings. The substrings themselves
- are returned in ovector. Each string uses two elements; the first is
- the offset to the start, and the second is the offset to the end. In
- fact, all the strings have the same start offset. (Space could have
- been saved by giving this only once, but it was decided to retain some
- compatibility with the way pcre_exec() returns data, even though the
+ On success, the yield of the function is a number greater than zero,
+ which is the number of matched substrings. The substrings themselves
+ are returned in ovector. Each string uses two elements; the first is
+ the offset to the start, and the second is the offset to the end. In
+ fact, all the strings have the same start offset. (Space could have
+ been saved by giving this only once, but it was decided to retain some
+ compatibility with the way pcre_exec() returns data, even though the
meaning of the strings is different.)
The strings are returned in reverse order of length; that is, the long-
- est matching string is given first. If there were too many matches to
- fit into ovector, the yield of the function is zero, and the vector is
- filled with the longest matches. Unlike pcre_exec(), pcre_dfa_exec()
+ est matching string is given first. If there were too many matches to
+ fit into ovector, the yield of the function is zero, and the vector is
+ filled with the longest matches. Unlike pcre_exec(), pcre_dfa_exec()
can use the entire ovector for returning matched strings.
- NOTE: PCRE's "auto-possessification" optimization usually applies to
- character repeats at the end of a pattern (as well as internally). For
- example, the pattern "a\d+" is compiled as if it were "a\d++" because
+ NOTE: PCRE's "auto-possessification" optimization usually applies to
+ character repeats at the end of a pattern (as well as internally). For
+ example, the pattern "a\d+" is compiled as if it were "a\d++" because
there is no point even considering the possibility of backtracking into
- the repeated digits. For DFA matching, this means that only one possi-
- ble match is found. If you really do want multiple matches in such
- cases, either use an ungreedy repeat ("a\d+?") or set the
+ the repeated digits. For DFA matching, this means that only one possi-
+ ble match is found. If you really do want multiple matches in such
+ cases, either use an ungreedy repeat ("a\d+?") or set the
PCRE_NO_AUTO_POSSESS option when compiling.
Error returns from pcre_dfa_exec()
- The pcre_dfa_exec() function returns a negative number when it fails.
- Many of the errors are the same as for pcre_exec(), and these are
- described above. There are in addition the following errors that are
+ The pcre_dfa_exec() function returns a negative number when it fails.
+ Many of the errors are the same as for pcre_exec(), and these are de-
+ scribed above. There are in addition the following errors that are
specific to pcre_dfa_exec():
PCRE_ERROR_DFA_UITEM (-16)
- This return is given if pcre_dfa_exec() encounters an item in the pat-
- tern that it does not support, for instance, the use of \C or a back
+ This return is given if pcre_dfa_exec() encounters an item in the pat-
+ tern that it does not support, for instance, the use of \C or a back
reference.
PCRE_ERROR_DFA_UCOND (-17)
- This return is given if pcre_dfa_exec() encounters a condition item
- that uses a back reference for the condition, or a test for recursion
+ This return is given if pcre_dfa_exec() encounters a condition item
+ that uses a back reference for the condition, or a test for recursion
in a specific group. These are not supported.
PCRE_ERROR_DFA_UMLIMIT (-18)
- This return is given if pcre_dfa_exec() is called with an extra block
- that contains a setting of the match_limit or match_limit_recursion
- fields. This is not supported (these fields are meaningless for DFA
+ This return is given if pcre_dfa_exec() is called with an extra block
+ that contains a setting of the match_limit or match_limit_recursion
+ fields. This is not supported (these fields are meaningless for DFA
matching).
PCRE_ERROR_DFA_WSSIZE (-19)
- This return is given if pcre_dfa_exec() runs out of space in the
+ This return is given if pcre_dfa_exec() runs out of space in the
workspace vector.
PCRE_ERROR_DFA_RECURSE (-20)
- When a recursive subpattern is processed, the matching function calls
- itself recursively, using private vectors for ovector and workspace.
- This error is given if the output vector is not large enough. This
+ When a recursive subpattern is processed, the matching function calls
+ itself recursively, using private vectors for ovector and workspace.
+ This error is given if the output vector is not large enough. This
should be extremely rare, as a vector of size 1000 is used.
PCRE_ERROR_DFA_BADRESTART (-30)
- When pcre_dfa_exec() is called with the PCRE_DFA_RESTART option, some
- plausibility checks are made on the contents of the workspace, which
- should contain data about the previous partial match. If any of these
+ When pcre_dfa_exec() is called with the PCRE_DFA_RESTART option, some
+ plausibility checks are made on the contents of the workspace, which
+ should contain data about the previous partial match. If any of these
checks fail, this error is given.
SEE ALSO
- pcre16(3), pcre32(3), pcrebuild(3), pcrecallout(3), pcrecpp(3)(3),
+ pcre16(3), pcre32(3), pcrebuild(3), pcrecallout(3), pcrecpp(3)(3),
pcrematching(3), pcrepartial(3), pcreposix(3), pcreprecompile(3), pcre-
sample(3), pcrestack(3).
@@ -4307,16 +4304,15 @@ DESCRIPTION
the 16-bit library, pcre32_callout for the 32-bit library). By default,
this variable contains NULL, which disables all calling out.
- Within a regular expression, (?C) indicates the points at which the
- external function is to be called. Different callout points can be
- identified by putting a number less than 256 after the letter C. The
- default value is zero. For example, this pattern has two callout
- points:
+ Within a regular expression, (?C) indicates the points at which the ex-
+ ternal function is to be called. Different callout points can be iden-
+ tified by putting a number less than 256 after the letter C. The de-
+ fault value is zero. For example, this pattern has two callout points:
(?C1)abc(?C2)def
- If the PCRE_AUTO_CALLOUT option bit is set when a pattern is compiled,
- PCRE automatically inserts callouts, all with number 255, before each
+ If the PCRE_AUTO_CALLOUT option bit is set when a pattern is compiled,
+ PCRE automatically inserts callouts, all with number 255, before each
item in the pattern. For example, if PCRE_AUTO_CALLOUT is used with the
pattern
@@ -4326,21 +4322,21 @@ DESCRIPTION
(?C255)A(?C255)((?C255)\d{2}(?C255)|(?C255)-(?C255)-(?C255))(?C255)
- Notice that there is a callout before and after each parenthesis and
+ Notice that there is a callout before and after each parenthesis and
alternation bar. If the pattern contains a conditional group whose con-
- dition is an assertion, an automatic callout is inserted immediately
- before the condition. Such a callout may also be inserted explicitly,
+ dition is an assertion, an automatic callout is inserted immediately
+ before the condition. Such a callout may also be inserted explicitly,
for example:
(?(?C9)(?=a)ab|de)
- This applies only to assertion conditions (because they are themselves
+ This applies only to assertion conditions (because they are themselves
independent groups).
- Automatic callouts can be used for tracking the progress of pattern
- matching. The pcretest program has a pattern qualifier (/C) that sets
- automatic callouts; when it is used, the output indicates how the pat-
- tern is being matched. This is useful information when you are trying
+ Automatic callouts can be used for tracking the progress of pattern
+ matching. The pcretest program has a pattern qualifier (/C) that sets
+ automatic callouts; when it is used, the output indicates how the pat-
+ tern is being matched. This is useful information when you are trying
to optimize the performance of a particular pattern.
@@ -4350,10 +4346,10 @@ MISSING CALLOUTS
piles and matches patterns, callouts sometimes do not happen exactly as
you might expect.
- At compile time, PCRE "auto-possessifies" repeated items when it knows
- that what follows cannot be part of the repeat. For example, a+[bc] is
- compiled as if it were a++[bc]. The pcretest output when this pattern
- is anchored and then applied with automatic callouts to the string
+ At compile time, PCRE "auto-possessifies" repeated items when it knows
+ that what follows cannot be part of the repeat. For example, a+[bc] is
+ compiled as if it were a++[bc]. The pcretest output when this pattern
+ is anchored and then applied with automatic callouts to the string
"aaaa" is:
--->aaaa
@@ -4362,11 +4358,11 @@ MISSING CALLOUTS
+3 ^ ^ [bc]
No match
- This indicates that when matching [bc] fails, there is no backtracking
- into a+ and therefore the callouts that would be taken for the back-
- tracks do not occur. You can disable the auto-possessify feature by
+ This indicates that when matching [bc] fails, there is no backtracking
+ into a+ and therefore the callouts that would be taken for the back-
+ tracks do not occur. You can disable the auto-possessify feature by
passing PCRE_NO_AUTO_POSSESS to pcre_compile(), or starting the pattern
- with (*NO_AUTO_POSSESS). If this is done in pcretest (using the /O
+ with (*NO_AUTO_POSSESS). If this is done in pcretest (using the /O
qualifier), the output changes to this:
--->aaaa
@@ -4381,34 +4377,34 @@ MISSING CALLOUTS
This time, when matching [bc] fails, the matcher backtracks into a+ and
tries again, repeatedly, until a+ itself fails.
- Other optimizations that provide fast "no match" results also affect
+ Other optimizations that provide fast "no match" results also affect
callouts. For example, if the pattern is
ab(?C4)cd
PCRE knows that any matching string must contain the letter "d". If the
- subject string is "abyz", the lack of "d" means that matching doesn't
- ever start, and the callout is never reached. However, with "abyd",
+ subject string is "abyz", the lack of "d" means that matching doesn't
+ ever start, and the callout is never reached. However, with "abyd",
though the result is still no match, the callout is obeyed.
- If the pattern is studied, PCRE knows the minimum length of a matching
- string, and will immediately give a "no match" return without actually
- running a match if the subject is not long enough, or, for unanchored
+ If the pattern is studied, PCRE knows the minimum length of a matching
+ string, and will immediately give a "no match" return without actually
+ running a match if the subject is not long enough, or, for unanchored
patterns, if it has been scanned far enough.
- You can disable these optimizations by passing the PCRE_NO_START_OPTI-
- MIZE option to the matching function, or by starting the pattern with
- (*NO_START_OPT). This slows down the matching process, but does ensure
+ You can disable these optimizations by passing the PCRE_NO_START_OPTI-
+ MIZE option to the matching function, or by starting the pattern with
+ (*NO_START_OPT). This slows down the matching process, but does ensure
that callouts such as the example above are obeyed.
THE CALLOUT INTERFACE
- During matching, when PCRE reaches a callout point, the external func-
+ During matching, when PCRE reaches a callout point, the external func-
tion defined by pcre_callout or pcre[16|32]_callout is called (if it is
- set). This applies to both normal and DFA matching. The only argument
- to the callout function is a pointer to a pcre_callout or
- pcre[16|32]_callout block. These structures contains the following
+ set). This applies to both normal and DFA matching. The only argument
+ to the callout function is a pointer to a pcre_callout or
+ pcre[16|32]_callout block. These structures contains the following
fields:
int version;
@@ -4429,93 +4425,92 @@ THE CALLOUT INTERFACE
const PCRE_UCHAR16 *mark; (16-bit version)
const PCRE_UCHAR32 *mark; (32-bit version)
- The version field is an integer containing the version number of the
- block format. The initial version was 0; the current version is 2. The
- version number will change again in future if additional fields are
+ The version field is an integer containing the version number of the
+ block format. The initial version was 0; the current version is 2. The
+ version number will change again in future if additional fields are
added, but the intention is never to remove any of the existing fields.
- The callout_number field contains the number of the callout, as com-
- piled into the pattern (that is, the number after ?C for manual call-
+ The callout_number field contains the number of the callout, as com-
+ piled into the pattern (that is, the number after ?C for manual call-
outs, and 255 for automatically generated callouts).
- The offset_vector field is a pointer to the vector of offsets that was
- passed by the caller to the matching function. When pcre_exec() or
- pcre[16|32]_exec() is used, the contents can be inspected, in order to
- extract substrings that have been matched so far, in the same way as
- for extracting substrings after a match has completed. For the DFA
+ The offset_vector field is a pointer to the vector of offsets that was
+ passed by the caller to the matching function. When pcre_exec() or
+ pcre[16|32]_exec() is used, the contents can be inspected, in order to
+ extract substrings that have been matched so far, in the same way as
+ for extracting substrings after a match has completed. For the DFA
matching functions, this field is not useful.
The subject and subject_length fields contain copies of the values that
were passed to the matching function.
- The start_match field normally contains the offset within the subject
- at which the current match attempt started. However, if the escape
- sequence \K has been encountered, this value is changed to reflect the
- modified starting point. If the pattern is not anchored, the callout
+ The start_match field normally contains the offset within the subject
+ at which the current match attempt started. However, if the escape se-
+ quence \K has been encountered, this value is changed to reflect the
+ modified starting point. If the pattern is not anchored, the callout
function may be called several times from the same point in the pattern
for different starting points in the subject.
- The current_position field contains the offset within the subject of
+ The current_position field contains the offset within the subject of
the current match pointer.
- When the pcre_exec() or pcre[16|32]_exec() is used, the capture_top
- field contains one more than the number of the highest numbered cap-
- tured substring so far. If no substrings have been captured, the value
- of capture_top is one. This is always the case when the DFA functions
+ When the pcre_exec() or pcre[16|32]_exec() is used, the capture_top
+ field contains one more than the number of the highest numbered cap-
+ tured substring so far. If no substrings have been captured, the value
+ of capture_top is one. This is always the case when the DFA functions
are used, because they do not support captured substrings.
- The capture_last field contains the number of the most recently cap-
- tured substring. However, when a recursion exits, the value reverts to
- what it was outside the recursion, as do the values of all captured
- substrings. If no substrings have been captured, the value of cap-
- ture_last is -1. This is always the case for the DFA matching func-
+ The capture_last field contains the number of the most recently cap-
+ tured substring. However, when a recursion exits, the value reverts to
+ what it was outside the recursion, as do the values of all captured
+ substrings. If no substrings have been captured, the value of cap-
+ ture_last is -1. This is always the case for the DFA matching func-
tions.
- The callout_data field contains a value that is passed to a matching
- function specifically so that it can be passed back in callouts. It is
- passed in the callout_data field of a pcre_extra or pcre[16|32]_extra
- data structure. If no such data was passed, the value of callout_data
- in a callout block is NULL. There is a description of the pcre_extra
+ The callout_data field contains a value that is passed to a matching
+ function specifically so that it can be passed back in callouts. It is
+ passed in the callout_data field of a pcre_extra or pcre[16|32]_extra
+ data structure. If no such data was passed, the value of callout_data
+ in a callout block is NULL. There is a description of the pcre_extra
structure in the pcreapi documentation.
- The pattern_position field is present from version 1 of the callout
+ The pattern_position field is present from version 1 of the callout
structure. It contains the offset to the next item to be matched in the
pattern string.
- The next_item_length field is present from version 1 of the callout
+ The next_item_length field is present from version 1 of the callout
structure. It contains the length of the next item to be matched in the
- pattern string. When the callout immediately precedes an alternation
- bar, a closing parenthesis, or the end of the pattern, the length is
- zero. When the callout precedes an opening parenthesis, the length is
+ pattern string. When the callout immediately precedes an alternation
+ bar, a closing parenthesis, or the end of the pattern, the length is
+ zero. When the callout precedes an opening parenthesis, the length is
that of the entire subpattern.
- The pattern_position and next_item_length fields are intended to help
- in distinguishing between different automatic callouts, which all have
+ The pattern_position and next_item_length fields are intended to help
+ in distinguishing between different automatic callouts, which all have
the same callout number. However, they are set for all callouts.
- The mark field is present from version 2 of the callout structure. In
- callouts from pcre_exec() or pcre[16|32]_exec() it contains a pointer
- to the zero-terminated name of the most recently passed (*MARK),
- (*PRUNE), or (*THEN) item in the match, or NULL if no such items have
- been passed. Instances of (*PRUNE) or (*THEN) without a name do not
- obliterate a previous (*MARK). In callouts from the DFA matching func-
+ The mark field is present from version 2 of the callout structure. In
+ callouts from pcre_exec() or pcre[16|32]_exec() it contains a pointer
+ to the zero-terminated name of the most recently passed (*MARK),
+ (*PRUNE), or (*THEN) item in the match, or NULL if no such items have
+ been passed. Instances of (*PRUNE) or (*THEN) without a name do not
+ obliterate a previous (*MARK). In callouts from the DFA matching func-
tions this field always contains NULL.
RETURN VALUES
- The external callout function returns an integer to PCRE. If the value
- is zero, matching proceeds as normal. If the value is greater than
- zero, matching fails at the current point, but the testing of other
+ The external callout function returns an integer to PCRE. If the value
+ is zero, matching proceeds as normal. If the value is greater than
+ zero, matching fails at the current point, but the testing of other
matching possibilities goes ahead, just as if a lookahead assertion had
- failed. If the value is less than zero, the match is abandoned, the
+ failed. If the value is less than zero, the match is abandoned, the
matching function returns the negative value.
- Negative values should normally be chosen from the set of
- PCRE_ERROR_xxx values. In particular, PCRE_ERROR_NOMATCH forces a stan-
- dard "no match" failure. The error number PCRE_ERROR_CALLOUT is
- reserved for use by callout functions; it will never be used by PCRE
- itself.
+ Negative values should normally be chosen from the set of PCRE_ER-
+ ROR_xxx values. In particular, PCRE_ERROR_NOMATCH forces a standard "no
+ match" failure. The error number PCRE_ERROR_CALLOUT is reserved for
+ use by callout functions; it will never be used by PCRE itself.
AUTHOR
@@ -4542,8 +4537,8 @@ NAME
DIFFERENCES BETWEEN PCRE AND PERL
This document describes the differences in the ways that PCRE and Perl
- handle regular expressions. The differences described here are with
- respect to Perl versions 5.10 and above.
+ handle regular expressions. The differences described here are with re-
+ spect to Perl versions 5.10 and above.
1. PCRE has only a subset of Perl's Unicode support. Details of what it
does have are given in the pcreunicode page.
@@ -4614,8 +4609,8 @@ DIFFERENCES BETWEEN PCRE AND PERL
the section on recursion differences from Perl in the pcrepattern page.
10. If any of the backtracking control verbs are used in a subpattern
- that is called as a subroutine (whether or not recursively), their
- effect is confined to that subpattern; it does not extend to the sur-
+ that is called as a subroutine (whether or not recursively), their ef-
+ fect is confined to that subpattern; it does not extend to the sur-
rounding pattern. This is not always the case in Perl. In particular,
if (*THEN) is present in a group that is called as a subroutine, its
action is limited to that group, even if the group does not contain any
@@ -4633,8 +4628,8 @@ DIFFERENCES BETWEEN PCRE AND PERL
13. There are some differences that are concerned with the settings of
captured strings when part of a pattern is repeated. For example,
- matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2
- unset, but in PCRE it is set to "b".
+ matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2 un-
+ set, but in PCRE it is set to "b".
14. PCRE's handling of duplicate subpattern numbers and duplicate sub-
pattern names is not as general as Perl's. This is a consequence of the
@@ -4647,11 +4642,11 @@ DIFFERENCES BETWEEN PCRE AND PERL
turing subpattern number 1. To avoid this confusing situation, an error
is given at compile time.
- 15. Perl recognizes comments in some places that PCRE does not, for
- example, between the ( and ? at the start of a subpattern. If the /x
- modifier is set, Perl allows white space between ( and ? (though cur-
- rent Perls warn that this is deprecated) but PCRE never does, even if
- the PCRE_EXTENDED option is set.
+ 15. Perl recognizes comments in some places that PCRE does not, for ex-
+ ample, between the ( and ? at the start of a subpattern. If the /x mod-
+ ifier is set, Perl allows white space between ( and ? (though current
+ Perls warn that this is deprecated) but PCRE never does, even if the
+ PCRE_EXTENDED option is set.
16. Perl, when in warning mode, gives warnings for character classes
such as [A-\d] or [a-[:digit:]]. It then treats the hyphens as liter-
@@ -4746,10 +4741,10 @@ PCRE REGULAR EXPRESSION DETAILS
Perl's regular expressions are described in its own documentation, and
regular expressions in general are covered in a number of books, some
- of which have copious examples. Jeffrey Friedl's "Mastering Regular
- Expressions", published by O'Reilly, covers regular expressions in
- great detail. This description of PCRE's regular expressions is
- intended as reference material.
+ of which have copious examples. Jeffrey Friedl's "Mastering Regular Ex-
+ pressions", published by O'Reilly, covers regular expressions in great
+ detail. This description of PCRE's regular expressions is intended as
+ reference material.
This document discusses the patterns that are supported by PCRE when
one its main matching functions, pcre_exec() (8-bit) or
@@ -4768,8 +4763,8 @@ SPECIAL START-OF-PATTERN ITEMS
set by special items at the start of a pattern. These are not Perl-com-
patible, but are provided to make these options accessible to pattern
writers who are not able to change the program that processes the pat-
- tern. Any number of these items may appear, but they must all be
- together right at the start of the pattern string, and the letters must
+ tern. Any number of these items may appear, but they must all be to-
+ gether right at the start of the pattern string, and the letters must
be in upper case.
UTF support
@@ -4788,16 +4783,16 @@ SPECIAL START-OF-PATTERN ITEMS
(*UTF32)
(*UTF)
- (*UTF) is a generic sequence that can be used with any of the
- libraries. Starting a pattern with such a sequence is equivalent to
- setting the relevant option. How setting a UTF mode affects pattern
- matching is mentioned in several places below. There is also a summary
- of features in the pcreunicode page.
+ (*UTF) is a generic sequence that can be used with any of the li-
+ braries. Starting a pattern with such a sequence is equivalent to set-
+ ting the relevant option. How setting a UTF mode affects pattern match-
+ ing is mentioned in several places below. There is also a summary of
+ features in the pcreunicode page.
Some applications that allow their users to supply patterns may wish to
restrict them to non-UTF data for security reasons. If the
- PCRE_NEVER_UTF option is set at compile time, (*UTF) etc. are not
- allowed, and their appearance causes an error.
+ PCRE_NEVER_UTF option is set at compile time, (*UTF) etc. are not al-
+ lowed, and their appearance causes an error.
Unicode property support
@@ -4841,8 +4836,8 @@ SPECIAL START-OF-PATTERN ITEMS
(*ANY) all Unicode newline sequences
These override the default and the options given to the compiling func-
- tion. For example, on a Unix system where LF is the default newline
- sequence, the pattern
+ tion. For example, on a Unix system where LF is the default newline se-
+ quence, the pattern
(*CR)a.b
@@ -4909,8 +4904,8 @@ CHARACTERS AND METACHARACTERS
matching for characters 128 and above, you must ensure that PCRE is
compiled with Unicode property support as well as with UTF support.
- The power of regular expressions comes from the ability to include
- alternatives and repetitions in the pattern. These are encoded in the
+ The power of regular expressions comes from the ability to include al-
+ ternatives and repetitions in the pattern. These are encoded in the
pattern by the use of metacharacters, which do not stand for themselves
but instead are interpreted in some special way.
@@ -4974,9 +4969,9 @@ BACKSLASH
If you want to remove the special meaning from a sequence of charac-
ters, you can do so by putting them between \Q and \E. This is differ-
- ent from Perl in that $ and @ are handled as literals in \Q...\E
- sequences in PCRE, whereas in Perl, $ and @ cause variable interpola-
- tion. Note the following examples:
+ ent from Perl in that $ and @ are handled as literals in \Q...\E se-
+ quences in PCRE, whereas in Perl, $ and @ cause variable interpolation.
+ Note the following examples:
Pattern PCRE matches Perl matches
@@ -4998,8 +4993,8 @@ BACKSLASH
acters in patterns in a visible manner. There is no restriction on the
appearance of non-printing characters, apart from the binary zero that
terminates a pattern, but when a pattern is being prepared by text
- editing, it is often easier to use one of the following escape
- sequences than the binary character it represents. In an ASCII or Uni-
+ editing, it is often easier to use one of the following escape se-
+ quences than the binary character it represents. In an ASCII or Uni-
code environment, these escapes are as follows:
\a alarm, that is, the BEL character (hex 07)
@@ -5028,8 +5023,8 @@ BACKSLASH
ate the appropriate EBCDIC code values. The \c escape is processed as
specified for Perl in the perlebcdic document. The only characters that
are allowed after \c are A-Z, a-z, or one of @, [, \, ], ^, _, or ?.
- Any other character provokes a compile-time error. The sequence \c@
- encodes character code 0; after \c the letters (in either case) encode
+ Any other character provokes a compile-time error. The sequence \c@ en-
+ codes character code 0; after \c the letters (in either case) encode
characters 1-26 (hex 01 to hex 1A); [, \, ], ^, and _ encode characters
27-31 (hex 1B to hex 1F), and \c? becomes either 255 (hex FF) or 95
(hex 5F).
@@ -5048,8 +5043,8 @@ BACKSLASH
95; otherwise it generates 255.
After \0 up to two further octal digits are read. If there are fewer
- than two digits, just those that are present are used. Thus the
- sequence \0\x\015 specifies two binary zeros followed by a CR character
+ than two digits, just those that are present are used. Thus the se-
+ quence \0\x\015 specifies two binary zeros followed by a CR character
(code value 13). Make sure you supply two digits after the initial zero
if the pattern character that follows is itself an octal digit.
@@ -5140,15 +5135,15 @@ BACKSLASH
\N is not allowed in a character class. \B, \R, and \X are not special
inside a character class. Like other unrecognized escape sequences,
- they are treated as the literal characters "B", "R", and "X" by
- default, but cause an error if the PCRE_EXTRA option is set. Outside a
+ they are treated as the literal characters "B", "R", and "X" by de-
+ fault, but cause an error if the PCRE_EXTRA option is set. Outside a
character class, these sequences have different meanings.
Unsupported escape sequences
In Perl, the sequences \l, \L, \u, and \U are recognized by its string
- handler and used to modify the case of following characters. By
- default, PCRE does not support these escape sequences. However, if the
+ handler and used to modify the case of following characters. By de-
+ fault, PCRE does not support these escape sequences. However, if the
PCRE_JAVASCRIPT_COMPAT option is set, \U matches a "U" character, and
\u can be used to define a character by code point, as described in the
previous section.
@@ -5199,13 +5194,13 @@ BACKSLASH
For compatibility with Perl, \s did not used to match the VT character
(code 11), which made it different from the the POSIX "space" class.
- However, Perl added VT at release 5.18, and PCRE followed suit at
- release 8.34. The default \s characters are now HT (9), LF (10), VT
- (11), FF (12), CR (13), and space (32), which are defined as white
- space in the "C" locale. This list may vary if locale-specific matching
- is taking place. For example, in some locales the "non-breaking space"
- character (\xA0) is recognized as white space, and in others the VT
- character is not.
+ However, Perl added VT at release 5.18, and PCRE followed suit at re-
+ lease 8.34. The default \s characters are now HT (9), LF (10), VT (11),
+ FF (12), CR (13), and space (32), which are defined as white space in
+ the "C" locale. This list may vary if locale-specific matching is tak-
+ ing place. For example, in some locales the "non-breaking space" char-
+ acter (\xA0) is recognized as white space, and in others the VT charac-
+ ter is not.
A "word" character is an underscore or any character that is a letter
or digit. By default, the definition of letters and digits is con-
@@ -5282,8 +5277,8 @@ BACKSLASH
(?>\r\n|\n|\x0b|\f|\r|\x85)
- This is an example of an "atomic group", details of which are given
- below. This particular group matches either the two-character sequence
+ This is an example of an "atomic group", details of which are given be-
+ low. This particular group matches either the two-character sequence
CR followed by LF, or one of the single characters LF (linefeed,
U+000A), VT (vertical tab, U+000B), FF (form feed, U+000C), CR (car-
riage return, U+000D), or NEL (next line, U+0085). The two-character
@@ -5298,10 +5293,10 @@ BACKSLASH
the complete set of Unicode line endings) by setting the option
PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched.
(BSR is an abbrevation for "backslash R".) This can be made the default
- when PCRE is built; if this is the case, the other behaviour can be
- requested via the PCRE_BSR_UNICODE option. It is also possible to
- specify these settings by starting a pattern string with one of the
- following sequences:
+ when PCRE is built; if this is the case, the other behaviour can be re-
+ quested via the PCRE_BSR_UNICODE option. It is also possible to spec-
+ ify these settings by starting a pattern string with one of the follow-
+ ing sequences:
(*BSR_ANYCRLF) CR, LF, or CRLF only
(*BSR_UNICODE) any Unicode newline sequence
@@ -5318,8 +5313,8 @@ BACKSLASH
They can also be combined with the (*UTF8), (*UTF16), (*UTF32), (*UTF)
or (*UCP) special sequences. Inside a character class, \R is treated as
- an unrecognized escape sequence, and so matches the letter "R" by
- default, but causes an error if PCRE_EXTRA is set.
+ an unrecognized escape sequence, and so matches the letter "R" by de-
+ fault, but causes an error if PCRE_EXTRA is set.
Unicode character properties
@@ -5335,10 +5330,10 @@ BACKSLASH
The property names represented by xx above are limited to the Unicode
script names, the general category properties, "Any", which matches any
- character (including newline), and some special PCRE properties
- (described in the next section). Other Perl properties such as "InMu-
- sicalSymbols" are not currently supported by PCRE. Note that \P{Any}
- does not match any characters, so always causes a match failure.
+ character (including newline), and some special PCRE properties (de-
+ scribed in the next section). Other Perl properties such as "InMusi-
+ calSymbols" are not currently supported by PCRE. Note that \P{Any} does
+ not match any characters, so always causes a match failure.
Sets of Unicode characters are defined as belonging to certain scripts.
A character from one of these sets can be matched using a script name.
@@ -5355,16 +5350,16 @@ BACKSLASH
ian, Caucasian_Albanian, Chakma, Cham, Cherokee, Common, Coptic, Cunei-
form, Cypriot, Cyrillic, Deseret, Devanagari, Duployan, Egyptian_Hiero-
glyphs, Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, Grantha,
- Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana,
- Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
+ Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, Im-
+ perial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin-
ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic,
- Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive,
- Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean,
- New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian,
- Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya,
- Pahawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician,
+ Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive, Meroitic_Hi-
+ eroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean, New_Tai_Lue,
+ Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian, Old_Permic,
+ Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya, Pa-
+ hawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician,
Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha-
vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac,
Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu,
@@ -5477,9 +5472,9 @@ BACKSLASH
This simple definition was extended in Unicode to include more compli-
cated kinds of composite character by giving each character a grapheme
- breaking property, and creating rules that use these properties to
- define the boundaries of extended grapheme clusters. In releases of
- PCRE later than 8.31, \X matches one of these clusters.
+ breaking property, and creating rules that use these properties to de-
+ fine the boundaries of extended grapheme clusters. In releases of PCRE
+ later than 8.31, \X matches one of these clusters.
\X always matches at least one character. Then it decides whether to
add additional characters according to the following rules for ending a
@@ -5507,8 +5502,8 @@ BACKSLASH
PCRE's additional properties
As well as the standard Unicode properties described above, PCRE sup-
- ports four more that make it possible to convert traditional escape
- sequences such as \w and \s to use Unicode properties. PCRE uses these
+ ports four more that make it possible to convert traditional escape se-
+ quences such as \w and \s to use Unicode properties. PCRE uses these
non-standard, non-Perl properties internally when PCRE_UCP is set. How-
ever, they may also be used explicitly. These properties are:
@@ -5522,8 +5517,8 @@ BACKSLASH
form feed, or carriage return, and any other character that has the Z
(separator) property. Xsp is the same as Xps; it used to exclude ver-
tical tab, for Perl compatibility, but Perl changed, and so PCRE fol-
- lowed at release 8.34. Xwd matches the same characters as Xan, plus
- underscore.
+ lowed at release 8.34. Xwd matches the same characters as Xan, plus un-
+ derscore.
There is another non-standard property, Xuc, which matches any charac-
ter that can be represented by a Universal Character Name in C++ and
@@ -5553,11 +5548,11 @@ BACKSLASH
matches "foobar", the first substring is still set to "foo".
- Perl documents that the use of \K within assertions is "not well
- defined". In PCRE, \K is acted upon when it occurs inside positive
- assertions, but is ignored in negative assertions. Note that when a
- pattern such as (?=ab\K) matches, the reported start of the match can
- be greater than the end of the match.
+ Perl documents that the use of \K within assertions is "not well de-
+ fined". In PCRE, \K is acted upon when it occurs inside positive asser-
+ tions, but is ignored in negative assertions. Note that when a pattern
+ such as (?=ab\K) matches, the reported start of the match can be
+ greater than the end of the match.
Simple assertions
@@ -5578,9 +5573,9 @@ BACKSLASH
Inside a character class, \b has a different meaning; it matches the
backspace character. If any other of these assertions appears in a
character class, by default it matches the corresponding literal char-
- acter (for example, \B matches the letter B). However, if the
- PCRE_EXTRA option is set, an "invalid escape sequence" error is gener-
- ated instead.
+ acter (for example, \B matches the letter B). However, if the PCRE_EX-
+ TRA option is set, an "invalid escape sequence" error is generated in-
+ stead.
A word boundary is a position in the subject string where the current
character and the previous character do not both match \w or \W (i.e.
@@ -5644,8 +5639,8 @@ CIRCUMFLEX AND DOLLAR
constructs that can cause a pattern to be anchored.)
The dollar character is an assertion that is true only if the current
- matching point is at the end of the subject string, or immediately
- before a newline at the end of the string (by default). Note, however,
+ matching point is at the end of the subject string, or immediately be-
+ fore a newline at the end of the string (by default). Note, however,
that it does not actually match the newline. Dollar need not be the
last character of the pattern if a number of alternatives are involved,
but it should be the last item in any branch in which it appears. Dol-
@@ -5692,18 +5687,18 @@ FULL STOP (PERIOD, DOT) AND \N
any of the other line ending characters.
The behaviour of dot with regard to newlines can be changed. If the
- PCRE_DOTALL option is set, a dot matches any one character, without
- exception. If the two-character sequence CRLF is present in the subject
+ PCRE_DOTALL option is set, a dot matches any one character, without ex-
+ ception. If the two-character sequence CRLF is present in the subject
string, it takes two dots to match it.
The handling of dot is entirely independent of the handling of circum-
flex and dollar, the only relationship being that they both involve
newlines. Dot has no special meaning in a character class.
- The escape sequence \N behaves like a dot, except that it is not
- affected by the PCRE_DOTALL option. In other words, it matches any
- character except one that signifies the end of a line. Perl also uses
- \N to match characters by name; PCRE does not support this.
+ The escape sequence \N behaves like a dot, except that it is not af-
+ fected by the PCRE_DOTALL option. In other words, it matches any char-
+ acter except one that signifies the end of a line. Perl also uses \N to
+ match characters by name; PCRE does not support this.
MATCHING A SINGLE DATA UNIT
@@ -5738,11 +5733,11 @@ MATCHING A SINGLE DATA UNIT
(?=[\x{10000}-\x{1fffff}])(\C)(\C)(\C)(\C))
A group that starts with (?| resets the capturing parentheses numbers
- in each alternative (see "Duplicate Subpattern Numbers" below). The
- assertions at the start of each branch check the next UTF-8 character
- for values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The
- character's individual bytes are then captured by the appropriate num-
- ber of groups.
+ in each alternative (see "Duplicate Subpattern Numbers" below). The as-
+ sertions at the start of each branch check the next UTF-8 character for
+ values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The char-
+ acter's individual bytes are then captured by the appropriate number of
+ groups.
SQUARE BRACKETS AND CHARACTER CLASSES
@@ -5788,80 +5783,79 @@ SQUARE BRACKETS AND CHARACTER CLASSES
with UTF support.
Characters that might indicate line breaks are never treated in any
- special way when matching character classes, whatever line-ending
- sequence is in use, and whatever setting of the PCRE_DOTALL and
- PCRE_MULTILINE options is used. A class such as [^a] always matches one
- of these characters.
+ special way when matching character classes, whatever line-ending se-
+ quence is in use, and whatever setting of the PCRE_DOTALL and PCRE_MUL-
+ TILINE options is used. A class such as [^a] always matches one of
+ these characters.
The minus (hyphen) character can be used to specify a range of charac-
- ters in a character class. For example, [d-m] matches any letter
- between d and m, inclusive. If a minus character is required in a
- class, it must be escaped with a backslash or appear in a position
- where it cannot be interpreted as indicating a range, typically as the
- first or last character in the class, or immediately after a range. For
- example, [b-d-z] matches letters in the range b to d, a hyphen charac-
- ter, or z.
+ ters in a character class. For example, [d-m] matches any letter be-
+ tween d and m, inclusive. If a minus character is required in a class,
+ it must be escaped with a backslash or appear in a position where it
+ cannot be interpreted as indicating a range, typically as the first or
+ last character in the class, or immediately after a range. For example,
+ [b-d-z] matches letters in the range b to d, a hyphen character, or z.
It is not possible to have the literal character "]" as the end charac-
- ter of a range. A pattern such as [W-]46] is interpreted as a class of
- two characters ("W" and "-") followed by a literal string "46]", so it
- would match "W46]" or "-46]". However, if the "]" is escaped with a
- backslash it is interpreted as the end of range, so [W-\]46] is inter-
- preted as a class containing a range followed by two other characters.
- The octal or hexadecimal representation of "]" can also be used to end
+ ter of a range. A pattern such as [W-]46] is interpreted as a class of
+ two characters ("W" and "-") followed by a literal string "46]", so it
+ would match "W46]" or "-46]". However, if the "]" is escaped with a
+ backslash it is interpreted as the end of range, so [W-\]46] is inter-
+ preted as a class containing a range followed by two other characters.
+ The octal or hexadecimal representation of "]" can also be used to end
a range.
- An error is generated if a POSIX character class (see below) or an
- escape sequence other than one that defines a single character appears
- at a point where a range ending character is expected. For example,
+ An error is generated if a POSIX character class (see below) or an es-
+ cape sequence other than one that defines a single character appears at
+ a point where a range ending character is expected. For example,
[z-\xff] is valid, but [A-\d] and [A-[:digit:]] are not.
- Ranges operate in the collating sequence of character values. They can
- also be used for characters specified numerically, for example
- [\000-\037]. Ranges can include any characters that are valid for the
+ Ranges operate in the collating sequence of character values. They can
+ also be used for characters specified numerically, for example
+ [\000-\037]. Ranges can include any characters that are valid for the
current mode.
If a range that includes letters is used when caseless matching is set,
it matches the letters in either case. For example, [W-c] is equivalent
- to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
- character tables for a French locale are in use, [\xc8-\xcb] matches
- accented E characters in both cases. In UTF modes, PCRE supports the
- concept of case for characters with values greater than 128 only when
+ to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
+ character tables for a French locale are in use, [\xc8-\xcb] matches
+ accented E characters in both cases. In UTF modes, PCRE supports the
+ concept of case for characters with values greater than 128 only when
it is compiled with Unicode property support.
- The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
+ The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
\w, and \W may appear in a character class, and add the characters that
- they match to the class. For example, [\dABCDEF] matches any hexadeci-
- mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
- \d, \s, \w and their upper case partners, just as it does when they
- appear outside a character class, as described in the section entitled
+ they match to the class. For example, [\dABCDEF] matches any hexadeci-
+ mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
+ \d, \s, \w and their upper case partners, just as it does when they ap-
+ pear outside a character class, as described in the section entitled
"Generic character types" above. The escape sequence \b has a different
- meaning inside a character class; it matches the backspace character.
- The sequences \B, \N, \R, and \X are not special inside a character
- class. Like any other unrecognized escape sequences, they are treated
- as the literal characters "B", "N", "R", and "X" by default, but cause
+ meaning inside a character class; it matches the backspace character.
+ The sequences \B, \N, \R, and \X are not special inside a character
+ class. Like any other unrecognized escape sequences, they are treated
+ as the literal characters "B", "N", "R", and "X" by default, but cause
an error if the PCRE_EXTRA option is set.
- A circumflex can conveniently be used with the upper case character
- types to specify a more restricted set of characters than the matching
- lower case type. For example, the class [^\W_] matches any letter or
+ A circumflex can conveniently be used with the upper case character
+ types to specify a more restricted set of characters than the matching
+ lower case type. For example, the class [^\W_] matches any letter or
digit, but not underscore, whereas [\w] includes underscore. A positive
character class should be read as "something OR something OR ..." and a
negative class as "NOT something AND NOT something AND NOT ...".
- The only metacharacters that are recognized in character classes are
- backslash, hyphen (only where it can be interpreted as specifying a
- range), circumflex (only at the start), opening square bracket (only
- when it can be interpreted as introducing a POSIX class name, or for a
- special compatibility feature - see the next two sections), and the
- terminating closing square bracket. However, escaping other non-
- alphanumeric characters does no harm.
+ The only metacharacters that are recognized in character classes are
+ backslash, hyphen (only where it can be interpreted as specifying a
+ range), circumflex (only at the start), opening square bracket (only
+ when it can be interpreted as introducing a POSIX class name, or for a
+ special compatibility feature - see the next two sections), and the
+ terminating closing square bracket. However, escaping other non-al-
+ phanumeric characters does no harm.
POSIX CHARACTER CLASSES
Perl supports the POSIX notation for character classes. This uses names
- enclosed by [: and :] within the enclosing square brackets. PCRE also
+ enclosed by [: and :] within the enclosing square brackets. PCRE also
supports this notation. For example,
[01[:alpha:]%]
@@ -5884,28 +5878,28 @@ POSIX CHARACTER CLASSES
word "word" characters (same as \w)
xdigit hexadecimal digits
- The default "space" characters are HT (9), LF (10), VT (11), FF (12),
- CR (13), and space (32). If locale-specific matching is taking place,
- the list of space characters may be different; there may be fewer or
+ The default "space" characters are HT (9), LF (10), VT (11), FF (12),
+ CR (13), and space (32). If locale-specific matching is taking place,
+ the list of space characters may be different; there may be fewer or
more of them. "Space" used to be different to \s, which did not include
VT, for Perl compatibility. However, Perl changed at release 5.18, and
- PCRE followed at release 8.34. "Space" and \s now match the same set
+ PCRE followed at release 8.34. "Space" and \s now match the same set
of characters.
- The name "word" is a Perl extension, and "blank" is a GNU extension
- from Perl 5.8. Another Perl extension is negation, which is indicated
+ The name "word" is a Perl extension, and "blank" is a GNU extension
+ from Perl 5.8. Another Perl extension is negation, which is indicated
by a ^ character after the colon. For example,
[12[:^digit:]]
- matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
+ matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
POSIX syntax [.ch.] and [=ch=] where "ch" is a "collating element", but
these are not supported, and an error is given if they are encountered.
By default, characters with values greater than 128 do not match any of
- the POSIX character classes. However, if the PCRE_UCP option is passed
- to pcre_compile(), some of the classes are changed so that Unicode
- character properties are used. This is achieved by replacing certain
+ the POSIX character classes. However, if the PCRE_UCP option is passed
+ to pcre_compile(), some of the classes are changed so that Unicode
+ character properties are used. This is achieved by replacing certain
POSIX classes by other sequences, as follows:
[:alnum:] becomes \p{Xan}
@@ -5917,10 +5911,10 @@ POSIX CHARACTER CLASSES
[:upper:] becomes \p{Lu}
[:word:] becomes \p{Xwd}
- Negated versions, such as [:^alpha:] use \P instead of \p. Three other
+ Negated versions, such as [:^alpha:] use \P instead of \p. Three other
POSIX classes are handled specially in UCP mode:
- [:graph:] This matches characters that have glyphs that mark the page
+ [:graph:] This matches characters that have glyphs that mark the page
when printed. In Unicode property terms, it matches all char-
acters with the L, M, N, P, S, or Cf properties, except for:
@@ -5929,59 +5923,59 @@ POSIX CHARACTER CLASSES
U+2066 - U+2069 Various "isolate"s
- [:print:] This matches the same characters as [:graph:] plus space
- characters that are not controls, that is, characters with
+ [:print:] This matches the same characters as [:graph:] plus space
+ characters that are not controls, that is, characters with
the Zs property.
[:punct:] This matches all characters that have the Unicode P (punctua-
- tion) property, plus those characters whose code points are
+ tion) property, plus those characters whose code points are
less than 128 that have the S (Symbol) property.
- The other POSIX classes are unchanged, and match only characters with
+ The other POSIX classes are unchanged, and match only characters with
code points less than 128.
COMPATIBILITY FEATURE FOR WORD BOUNDARIES
- In the POSIX.2 compliant library that was included in 4.4BSD Unix, the
- ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"
+ In the POSIX.2 compliant library that was included in 4.4BSD Unix, the
+ ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"
and "end of word". PCRE treats these items as follows:
[[:<:]] is converted to \b(?=\w)
[[:>:]] is converted to \b(?<=\w)
Only these exact character sequences are recognized. A sequence such as
- [a[:<:]b] provokes error for an unrecognized POSIX class name. This
- support is not compatible with Perl. It is provided to help migrations
+ [a[:<:]b] provokes error for an unrecognized POSIX class name. This
+ support is not compatible with Perl. It is provided to help migrations
from other environments, and is best not used in any new patterns. Note
- that \b matches at the start and the end of a word (see "Simple asser-
- tions" above), and in a Perl-style pattern the preceding or following
- character normally shows which is wanted, without the need for the
- assertions that are used above in order to give exactly the POSIX be-
- haviour.
+ that \b matches at the start and the end of a word (see "Simple asser-
+ tions" above), and in a Perl-style pattern the preceding or following
+ character normally shows which is wanted, without the need for the as-
+ sertions that are used above in order to give exactly the POSIX behav-
+ iour.
VERTICAL BAR
- Vertical bar characters are used to separate alternative patterns. For
+ Vertical bar characters are used to separate alternative patterns. For
example, the pattern
gilbert|sullivan
- matches either "gilbert" or "sullivan". Any number of alternatives may
- appear, and an empty alternative is permitted (matching the empty
+ matches either "gilbert" or "sullivan". Any number of alternatives may
+ appear, and an empty alternative is permitted (matching the empty
string). The matching process tries each alternative in turn, from left
- to right, and the first one that succeeds is used. If the alternatives
- are within a subpattern (defined below), "succeeds" means matching the
+ to right, and the first one that succeeds is used. If the alternatives
+ are within a subpattern (defined below), "succeeds" means matching the
rest of the main pattern as well as the alternative in the subpattern.
INTERNAL OPTION SETTING
- The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
- PCRE_EXTENDED options (which are Perl-compatible) can be changed from
- within the pattern by a sequence of Perl option letters enclosed
- between "(?" and ")". The option letters are
+ The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
+ PCRE_EXTENDED options (which are Perl-compatible) can be changed from
+ within the pattern by a sequence of Perl option letters enclosed be-
+ tween "(?" and ")". The option letters are
i for PCRE_CASELESS
m for PCRE_MULTILINE
@@ -5990,48 +5984,48 @@ INTERNAL OPTION SETTING
For example, (?im) sets caseless, multiline matching. It is also possi-
ble to unset these options by preceding the letter with a hyphen, and a
- combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
- LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
- is also permitted. If a letter appears both before and after the
- hyphen, the option is unset.
+ combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
+ LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
+ is also permitted. If a letter appears both before and after the hy-
+ phen, the option is unset.
- The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
- can be changed in the same way as the Perl-compatible options by using
+ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
+ can be changed in the same way as the Perl-compatible options by using
the characters J, U and X respectively.
- When one of these option changes occurs at top level (that is, not
- inside subpattern parentheses), the change applies to the remainder of
- the pattern that follows. An option change within a subpattern (see
- below for a description of subpatterns) affects only that part of the
+ When one of these option changes occurs at top level (that is, not in-
+ side subpattern parentheses), the change applies to the remainder of
+ the pattern that follows. An option change within a subpattern (see be-
+ low for a description of subpatterns) affects only that part of the
subpattern that follows it, so
(a(?i)b)c
matches abc and aBc and no other strings (assuming PCRE_CASELESS is not
- used). By this means, options can be made to have different settings
- in different parts of the pattern. Any changes made in one alternative
- do carry on into subsequent branches within the same subpattern. For
+ used). By this means, options can be made to have different settings
+ in different parts of the pattern. Any changes made in one alternative
+ do carry on into subsequent branches within the same subpattern. For
example,
(a(?i)b|c)
- matches "ab", "aB", "c", and "C", even though when matching "C" the
- first branch is abandoned before the option setting. This is because
- the effects of option settings happen at compile time. There would be
+ matches "ab", "aB", "c", and "C", even though when matching "C" the
+ first branch is abandoned before the option setting. This is because
+ the effects of option settings happen at compile time. There would be
some very weird behaviour otherwise.
- Note: There are other PCRE-specific options that can be set by the
- application when the compiling or matching functions are called. In
- some cases the pattern can contain special leading sequences such as
- (*CRLF) to override what the application has set or what has been
- defaulted. Details are given in the section entitled "Newline
- sequences" above. There are also the (*UTF8), (*UTF16),(*UTF32), and
- (*UCP) leading sequences that can be used to set UTF and Unicode prop-
- erty modes; they are equivalent to setting the PCRE_UTF8, PCRE_UTF16,
- PCRE_UTF32 and the PCRE_UCP options, respectively. The (*UTF) sequence
- is a generic version that can be used with any of the libraries. How-
- ever, the application can set the PCRE_NEVER_UTF option, which locks
- out the use of the (*UTF) sequences.
+ Note: There are other PCRE-specific options that can be set by the ap-
+ plication when the compiling or matching functions are called. In some
+ cases the pattern can contain special leading sequences such as (*CRLF)
+ to override what the application has set or what has been defaulted.
+ Details are given in the section entitled "Newline sequences" above.
+ There are also the (*UTF8), (*UTF16),(*UTF32), and (*UCP) leading se-
+ quences that can be used to set UTF and Unicode property modes; they
+ are equivalent to setting the PCRE_UTF8, PCRE_UTF16, PCRE_UTF32 and the
+ PCRE_UCP options, respectively. The (*UTF) sequence is a generic ver-
+ sion that can be used with any of the libraries. However, the applica-
+ tion can set the PCRE_NEVER_UTF option, which locks out the use of the
+ (*UTF) sequences.
SUBPATTERNS
@@ -6043,18 +6037,18 @@ SUBPATTERNS
cat(aract|erpillar|)
- matches "cataract", "caterpillar", or "cat". Without the parentheses,
+ matches "cataract", "caterpillar", or "cat". Without the parentheses,
it would match "cataract", "erpillar" or an empty string.
- 2. It sets up the subpattern as a capturing subpattern. This means
- that, when the whole pattern matches, that portion of the subject
+ 2. It sets up the subpattern as a capturing subpattern. This means
+ that, when the whole pattern matches, that portion of the subject
string that matched the subpattern is passed back to the caller via the
- ovector argument of the matching function. (This applies only to the
- traditional matching functions; the DFA matching functions do not sup-
+ ovector argument of the matching function. (This applies only to the
+ traditional matching functions; the DFA matching functions do not sup-
port capturing.)
Opening parentheses are counted from left to right (starting from 1) to
- obtain numbers for the capturing subpatterns. For example, if the
+ obtain numbers for the capturing subpatterns. For example, if the
string "the red king" is matched against the pattern
the ((red|white) (king|queen))
@@ -6062,12 +6056,12 @@ SUBPATTERNS
the captured substrings are "red king", "red", and "king", and are num-
bered 1, 2, and 3, respectively.
- The fact that plain parentheses fulfil two functions is not always
- helpful. There are often times when a grouping subpattern is required
- without a capturing requirement. If an opening parenthesis is followed
- by a question mark and a colon, the subpattern does not do any captur-
- ing, and is not counted when computing the number of any subsequent
- capturing subpatterns. For example, if the string "the white queen" is
+ The fact that plain parentheses fulfil two functions is not always
+ helpful. There are often times when a grouping subpattern is required
+ without a capturing requirement. If an opening parenthesis is followed
+ by a question mark and a colon, the subpattern does not do any captur-
+ ing, and is not counted when computing the number of any subsequent
+ capturing subpatterns. For example, if the string "the white queen" is
matched against the pattern
the ((?:red|white) (king|queen))
@@ -6075,37 +6069,37 @@ SUBPATTERNS
the captured substrings are "white queen" and "queen", and are numbered
1 and 2. The maximum number of capturing subpatterns is 65535.
- As a convenient shorthand, if any option settings are required at the
- start of a non-capturing subpattern, the option letters may appear
- between the "?" and the ":". Thus the two patterns
+ As a convenient shorthand, if any option settings are required at the
+ start of a non-capturing subpattern, the option letters may appear be-
+ tween the "?" and the ":". Thus the two patterns
(?i:saturday|sunday)
(?:(?i)saturday|sunday)
match exactly the same set of strings. Because alternative branches are
- tried from left to right, and options are not reset until the end of
- the subpattern is reached, an option setting in one branch does affect
- subsequent branches, so the above patterns match "SUNDAY" as well as
+ tried from left to right, and options are not reset until the end of
+ the subpattern is reached, an option setting in one branch does affect
+ subsequent branches, so the above patterns match "SUNDAY" as well as
"Saturday".
DUPLICATE SUBPATTERN NUMBERS
Perl 5.10 introduced a feature whereby each alternative in a subpattern
- uses the same numbers for its capturing parentheses. Such a subpattern
- starts with (?| and is itself a non-capturing subpattern. For example,
+ uses the same numbers for its capturing parentheses. Such a subpattern
+ starts with (?| and is itself a non-capturing subpattern. For example,
consider this pattern:
(?|(Sat)ur|(Sun))day
- Because the two alternatives are inside a (?| group, both sets of cap-
- turing parentheses are numbered one. Thus, when the pattern matches,
- you can look at captured substring number one, whichever alternative
- matched. This construct is useful when you want to capture part, but
+ Because the two alternatives are inside a (?| group, both sets of cap-
+ turing parentheses are numbered one. Thus, when the pattern matches,
+ you can look at captured substring number one, whichever alternative
+ matched. This construct is useful when you want to capture part, but
not all, of one of a number of alternatives. Inside a (?| group, paren-
- theses are numbered as usual, but the number is reset at the start of
- each branch. The numbers of any capturing parentheses that follow the
- subpattern start after the highest number used in any branch. The fol-
+ theses are numbered as usual, but the number is reset at the start of
+ each branch. The numbers of any capturing parentheses that follow the
+ subpattern start after the highest number used in any branch. The fol-
lowing example is taken from the Perl documentation. The numbers under-
neath show in which buffer the captured content will be stored.
@@ -6113,58 +6107,58 @@ DUPLICATE SUBPATTERN NUMBERS
/ ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
# 1 2 2 3 2 3 4
- A back reference to a numbered subpattern uses the most recent value
- that is set for that number by any subpattern. The following pattern
+ A back reference to a numbered subpattern uses the most recent value
+ that is set for that number by any subpattern. The following pattern
matches "abcabc" or "defdef":
/(?|(abc)|(def))\1/
- In contrast, a subroutine call to a numbered subpattern always refers
- to the first one in the pattern with the given number. The following
+ In contrast, a subroutine call to a numbered subpattern always refers
+ to the first one in the pattern with the given number. The following
pattern matches "abcabc" or "defabc":
/(?|(abc)|(def))(?1)/
- If a condition test for a subpattern's having matched refers to a non-
- unique number, the test is true if any of the subpatterns of that num-
+ If a condition test for a subpattern's having matched refers to a non-
+ unique number, the test is true if any of the subpatterns of that num-
ber have matched.
- An alternative approach to using this "branch reset" feature is to use
+ An alternative approach to using this "branch reset" feature is to use
duplicate named subpatterns, as described in the next section.
NAMED SUBPATTERNS
- Identifying capturing parentheses by number is simple, but it can be
- very hard to keep track of the numbers in complicated regular expres-
- sions. Furthermore, if an expression is modified, the numbers may
- change. To help with this difficulty, PCRE supports the naming of sub-
+ Identifying capturing parentheses by number is simple, but it can be
+ very hard to keep track of the numbers in complicated regular expres-
+ sions. Furthermore, if an expression is modified, the numbers may
+ change. To help with this difficulty, PCRE supports the naming of sub-
patterns. This feature was not added to Perl until release 5.10. Python
- had the feature earlier, and PCRE introduced it at release 4.0, using
- the Python syntax. PCRE now supports both the Perl and the Python syn-
- tax. Perl allows identically numbered subpatterns to have different
+ had the feature earlier, and PCRE introduced it at release 4.0, using
+ the Python syntax. PCRE now supports both the Perl and the Python syn-
+ tax. Perl allows identically numbered subpatterns to have different
names, but PCRE does not.
- In PCRE, a subpattern can be named in one of three ways: (?<name>...)
- or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
- to capturing parentheses from other parts of the pattern, such as back
- references, recursion, and conditions, can be made by name as well as
+ In PCRE, a subpattern can be named in one of three ways: (?<name>...)
+ or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
+ to capturing parentheses from other parts of the pattern, such as back
+ references, recursion, and conditions, can be made by name as well as
by number.
- Names consist of up to 32 alphanumeric characters and underscores, but
- must start with a non-digit. Named capturing parentheses are still
- allocated numbers as well as names, exactly as if the names were not
- present. The PCRE API provides function calls for extracting the name-
- to-number translation table from a compiled pattern. There is also a
+ Names consist of up to 32 alphanumeric characters and underscores, but
+ must start with a non-digit. Named capturing parentheses are still al-
+ located numbers as well as names, exactly as if the names were not
+ present. The PCRE API provides function calls for extracting the name-
+ to-number translation table from a compiled pattern. There is also a
convenience function for extracting a captured substring by name.
- By default, a name must be unique within a pattern, but it is possible
+ By default, a name must be unique within a pattern, but it is possible
to relax this constraint by setting the PCRE_DUPNAMES option at compile
- time. (Duplicate names are also always permitted for subpatterns with
- the same number, set up as described in the previous section.) Dupli-
- cate names can be useful for patterns where only one instance of the
- named parentheses can match. Suppose you want to match the name of a
- weekday, either as a 3-letter abbreviation or as the full name, and in
+ time. (Duplicate names are also always permitted for subpatterns with
+ the same number, set up as described in the previous section.) Dupli-
+ cate names can be useful for patterns where only one instance of the
+ named parentheses can match. Suppose you want to match the name of a
+ weekday, either as a 3-letter abbreviation or as the full name, and in
both cases you want to extract the abbreviation. This pattern (ignoring
the line breaks) does the job:
@@ -6174,18 +6168,18 @@ NAMED SUBPATTERNS
(?<DN>Thu)(?:rsday)?|
(?<DN>Sat)(?:urday)?
- There are five capturing substrings, but only one is ever set after a
+ There are five capturing substrings, but only one is ever set after a
match. (An alternative way of solving this problem is to use a "branch
reset" subpattern, as described in the previous section.)
- The convenience function for extracting the data by name returns the
- substring for the first (and in this example, the only) subpattern of
- that name that matched. This saves searching to find which numbered
+ The convenience function for extracting the data by name returns the
+ substring for the first (and in this example, the only) subpattern of
+ that name that matched. This saves searching to find which numbered
subpattern it was.
- If you make a back reference to a non-unique named subpattern from
- elsewhere in the pattern, the subpatterns to which the name refers are
- checked in the order in which they appear in the overall pattern. The
+ If you make a back reference to a non-unique named subpattern from
+ elsewhere in the pattern, the subpatterns to which the name refers are
+ checked in the order in which they appear in the overall pattern. The
first one that is set is used for the reference. For example, this pat-
tern matches both "foofoo" and "barbar" but not "foobar" or "barfoo":
@@ -6193,29 +6187,29 @@ NAMED SUBPATTERNS
If you make a subroutine call to a non-unique named subpattern, the one
- that corresponds to the first occurrence of the name is used. In the
+ that corresponds to the first occurrence of the name is used. In the
absence of duplicate numbers (see the previous section) this is the one
with the lowest number.
If you use a named reference in a condition test (see the section about
conditions below), either to check whether a subpattern has matched, or
- to check for recursion, all subpatterns with the same name are tested.
- If the condition is true for any one of them, the overall condition is
- true. This is the same behaviour as testing by number. For further
- details of the interfaces for handling named subpatterns, see the
- pcreapi documentation.
+ to check for recursion, all subpatterns with the same name are tested.
+ If the condition is true for any one of them, the overall condition is
+ true. This is the same behaviour as testing by number. For further de-
+ tails of the interfaces for handling named subpatterns, see the pcreapi
+ documentation.
Warning: You cannot use different names to distinguish between two sub-
- patterns with the same number because PCRE uses only the numbers when
+ patterns with the same number because PCRE uses only the numbers when
matching. For this reason, an error is given at compile time if differ-
- ent names are given to subpatterns with the same number. However, you
+ ent names are given to subpatterns with the same number. However, you
can always give the same name to subpatterns with the same number, even
when PCRE_DUPNAMES is not set.
REPETITION
- Repetition is specified by quantifiers, which can follow any of the
+ Repetition is specified by quantifiers, which can follow any of the
following items:
a literal data character
@@ -6229,17 +6223,17 @@ REPETITION
a parenthesized subpattern (including assertions)
a subroutine call to a subpattern (recursive or otherwise)
- The general repetition quantifier specifies a minimum and maximum num-
- ber of permitted matches, by giving the two numbers in curly brackets
- (braces), separated by a comma. The numbers must be less than 65536,
+ The general repetition quantifier specifies a minimum and maximum num-
+ ber of permitted matches, by giving the two numbers in curly brackets
+ (braces), separated by a comma. The numbers must be less than 65536,
and the first must be less than or equal to the second. For example:
z{2,4}
- matches "zz", "zzz", or "zzzz". A closing brace on its own is not a
- special character. If the second number is omitted, but the comma is
- present, there is no upper limit; if the second number and the comma
- are both omitted, the quantifier specifies an exact number of required
+ matches "zz", "zzz", or "zzzz". A closing brace on its own is not a
+ special character. If the second number is omitted, but the comma is
+ present, there is no upper limit; if the second number and the comma
+ are both omitted, the quantifier specifies an exact number of required
matches. Thus
[aeiou]{3,}
@@ -6248,50 +6242,50 @@ REPETITION
\d{8}
- matches exactly 8 digits. An opening curly bracket that appears in a
- position where a quantifier is not allowed, or one that does not match
- the syntax of a quantifier, is taken as a literal character. For exam-
+ matches exactly 8 digits. An opening curly bracket that appears in a
+ position where a quantifier is not allowed, or one that does not match
+ the syntax of a quantifier, is taken as a literal character. For exam-
ple, {,6} is not a quantifier, but a literal string of four characters.
In UTF modes, quantifiers apply to characters rather than to individual
- data units. Thus, for example, \x{100}{2} matches two characters, each
+ data units. Thus, for example, \x{100}{2} matches two characters, each
of which is represented by a two-byte sequence in a UTF-8 string. Simi-
- larly, \X{3} matches three Unicode extended grapheme clusters, each of
- which may be several data units long (and they may be of different
+ larly, \X{3} matches three Unicode extended grapheme clusters, each of
+ which may be several data units long (and they may be of different
lengths).
The quantifier {0} is permitted, causing the expression to behave as if
the previous item and the quantifier were not present. This may be use-
- ful for subpatterns that are referenced as subroutines from elsewhere
+ ful for subpatterns that are referenced as subroutines from elsewhere
in the pattern (but see also the section entitled "Defining subpatterns
- for use by reference only" below). Items other than subpatterns that
+ for use by reference only" below). Items other than subpatterns that
have a {0} quantifier are omitted from the compiled pattern.
- For convenience, the three most common quantifiers have single-charac-
+ For convenience, the three most common quantifiers have single-charac-
ter abbreviations:
* is equivalent to {0,}
+ is equivalent to {1,}
? is equivalent to {0,1}
- It is possible to construct infinite loops by following a subpattern
+ It is possible to construct infinite loops by following a subpattern
that can match no characters with a quantifier that has no upper limit,
for example:
(a?)*
Earlier versions of Perl and PCRE used to give an error at compile time
- for such patterns. However, because there are cases where this can be
- useful, such patterns are now accepted, but if any repetition of the
- subpattern does in fact match no characters, the loop is forcibly bro-
+ for such patterns. However, because there are cases where this can be
+ useful, such patterns are now accepted, but if any repetition of the
+ subpattern does in fact match no characters, the loop is forcibly bro-
ken.
- By default, the quantifiers are "greedy", that is, they match as much
- as possible (up to the maximum number of permitted times), without
- causing the rest of the pattern to fail. The classic example of where
+ By default, the quantifiers are "greedy", that is, they match as much
+ as possible (up to the maximum number of permitted times), without
+ causing the rest of the pattern to fail. The classic example of where
this gives problems is in trying to match comments in C programs. These
- appear between /* and */ and within the comment, individual * and /
- characters may appear. An attempt to match C comments by applying the
+ appear between /* and */ and within the comment, individual * and /
+ characters may appear. An attempt to match C comments by applying the
pattern
/\*.*\*/
@@ -6300,19 +6294,19 @@ REPETITION
/* first comment */ not comment /* second comment */
- fails, because it matches the entire string owing to the greediness of
+ fails, because it matches the entire string owing to the greediness of
the .* item.
- However, if a quantifier is followed by a question mark, it ceases to
+ However, if a quantifier is followed by a question mark, it ceases to
be greedy, and instead matches the minimum number of times possible, so
the pattern
/\*.*?\*/
- does the right thing with the C comments. The meaning of the various
- quantifiers is not otherwise changed, just the preferred number of
- matches. Do not confuse this use of question mark with its use as a
- quantifier in its own right. Because it has two uses, it can sometimes
+ does the right thing with the C comments. The meaning of the various
+ quantifiers is not otherwise changed, just the preferred number of
+ matches. Do not confuse this use of question mark with its use as a
+ quantifier in its own right. Because it has two uses, it can sometimes
appear doubled, as in
\d??\d
@@ -6320,45 +6314,45 @@ REPETITION
which matches one digit by preference, but can match two if that is the
only way the rest of the pattern matches.
- If the PCRE_UNGREEDY option is set (an option that is not available in
- Perl), the quantifiers are not greedy by default, but individual ones
- can be made greedy by following them with a question mark. In other
+ If the PCRE_UNGREEDY option is set (an option that is not available in
+ Perl), the quantifiers are not greedy by default, but individual ones
+ can be made greedy by following them with a question mark. In other
words, it inverts the default behaviour.
- When a parenthesized subpattern is quantified with a minimum repeat
- count that is greater than 1 or with a limited maximum, more memory is
- required for the compiled pattern, in proportion to the size of the
+ When a parenthesized subpattern is quantified with a minimum repeat
+ count that is greater than 1 or with a limited maximum, more memory is
+ required for the compiled pattern, in proportion to the size of the
minimum or maximum.
If a pattern starts with .* or .{0,} and the PCRE_DOTALL option (equiv-
- alent to Perl's /s) is set, thus allowing the dot to match newlines,
- the pattern is implicitly anchored, because whatever follows will be
- tried against every character position in the subject string, so there
- is no point in retrying the overall match at any position after the
- first. PCRE normally treats such a pattern as though it were preceded
+ alent to Perl's /s) is set, thus allowing the dot to match newlines,
+ the pattern is implicitly anchored, because whatever follows will be
+ tried against every character position in the subject string, so there
+ is no point in retrying the overall match at any position after the
+ first. PCRE normally treats such a pattern as though it were preceded
by \A.
- In cases where it is known that the subject string contains no new-
- lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
+ In cases where it is known that the subject string contains no new-
+ lines, it is worth setting PCRE_DOTALL in order to obtain this opti-
mization, or alternatively using ^ to indicate anchoring explicitly.
- However, there are some cases where the optimization cannot be used.
+ However, there are some cases where the optimization cannot be used.
When .* is inside capturing parentheses that are the subject of a back
reference elsewhere in the pattern, a match at the start may fail where
a later one succeeds. Consider, for example:
(.*)abc\1
- If the subject is "xyz123abc123" the match point is the fourth charac-
+ If the subject is "xyz123abc123" the match point is the fourth charac-
ter. For this reason, such a pattern is not implicitly anchored.
- Another case where implicit anchoring is not applied is when the lead-
- ing .* is inside an atomic group. Once again, a match at the start may
+ Another case where implicit anchoring is not applied is when the lead-
+ ing .* is inside an atomic group. Once again, a match at the start may
fail where a later one succeeds. Consider this pattern:
(?>.*?a)b
- It matches "ab" in the subject "aab". The use of the backtracking con-
+ It matches "ab" in the subject "aab". The use of the backtracking con-
trol verbs (*PRUNE) and (*SKIP) also disable this optimization.
When a capturing subpattern is repeated, the value captured is the sub-
@@ -6367,8 +6361,8 @@ REPETITION
(tweedle[dume]{3}\s*)+
has matched "tweedledum tweedledee" the value of the captured substring
- is "tweedledee". However, if there are nested capturing subpatterns,
- the corresponding captured values may have been set in previous itera-
+ is "tweedledee". However, if there are nested capturing subpatterns,
+ the corresponding captured values may have been set in previous itera-
tions. For example, after
/(a|(b))+/
@@ -6378,53 +6372,53 @@ REPETITION
ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
- With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
- repetition, failure of what follows normally causes the repeated item
- to be re-evaluated to see if a different number of repeats allows the
- rest of the pattern to match. Sometimes it is useful to prevent this,
- either to change the nature of the match, or to cause it fail earlier
- than it otherwise might, when the author of the pattern knows there is
+ With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
+ repetition, failure of what follows normally causes the repeated item
+ to be re-evaluated to see if a different number of repeats allows the
+ rest of the pattern to match. Sometimes it is useful to prevent this,
+ either to change the nature of the match, or to cause it fail earlier
+ than it otherwise might, when the author of the pattern knows there is
no point in carrying on.
- Consider, for example, the pattern \d+foo when applied to the subject
+ Consider, for example, the pattern \d+foo when applied to the subject
line
123456bar
After matching all 6 digits and then failing to match "foo", the normal
- action of the matcher is to try again with only 5 digits matching the
- \d+ item, and then with 4, and so on, before ultimately failing.
- "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides
- the means for specifying that once a subpattern has matched, it is not
+ action of the matcher is to try again with only 5 digits matching the
+ \d+ item, and then with 4, and so on, before ultimately failing.
+ "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides
+ the means for specifying that once a subpattern has matched, it is not
to be re-evaluated in this way.
- If we use atomic grouping for the previous example, the matcher gives
- up immediately on failing to match "foo" the first time. The notation
+ If we use atomic grouping for the previous example, the matcher gives
+ up immediately on failing to match "foo" the first time. The notation
is a kind of special parenthesis, starting with (?> as in this example:
(?>\d+)foo
- This kind of parenthesis "locks up" the part of the pattern it con-
- tains once it has matched, and a failure further into the pattern is
- prevented from backtracking into it. Backtracking past it to previous
+ This kind of parenthesis "locks up" the part of the pattern it con-
+ tains once it has matched, and a failure further into the pattern is
+ prevented from backtracking into it. Backtracking past it to previous
items, however, works as normal.
- An alternative description is that a subpattern of this type matches
- the string of characters that an identical standalone pattern would
+ An alternative description is that a subpattern of this type matches
+ the string of characters that an identical standalone pattern would
match, if anchored at the current point in the subject string.
Atomic grouping subpatterns are not capturing subpatterns. Simple cases
such as the above example can be thought of as a maximizing repeat that
- must swallow everything it can. So, while both \d+ and \d+? are pre-
- pared to adjust the number of digits they match in order to make the
+ must swallow everything it can. So, while both \d+ and \d+? are pre-
+ pared to adjust the number of digits they match in order to make the
rest of the pattern match, (?>\d+) can only match an entire sequence of
digits.
- Atomic groups in general can of course contain arbitrarily complicated
- subpatterns, and can be nested. However, when the subpattern for an
+ Atomic groups in general can of course contain arbitrarily complicated
+ subpatterns, and can be nested. However, when the subpattern for an
atomic group is just a single repeated item, as in the example above, a
- simpler notation, called a "possessive quantifier" can be used. This
- consists of an additional + character following a quantifier. Using
+ simpler notation, called a "possessive quantifier" can be used. This
+ consists of an additional + character following a quantifier. Using
this notation, the previous example can be rewritten as
\d++foo
@@ -6434,46 +6428,46 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
(abc|xyz){2,3}+
- Possessive quantifiers are always greedy; the setting of the
- PCRE_UNGREEDY option is ignored. They are a convenient notation for the
- simpler forms of atomic group. However, there is no difference in the
- meaning of a possessive quantifier and the equivalent atomic group,
- though there may be a performance difference; possessive quantifiers
+ Possessive quantifiers are always greedy; the setting of the PCRE_UN-
+ GREEDY option is ignored. They are a convenient notation for the sim-
+ pler forms of atomic group. However, there is no difference in the
+ meaning of a possessive quantifier and the equivalent atomic group,
+ though there may be a performance difference; possessive quantifiers
should be slightly faster.
- The possessive quantifier syntax is an extension to the Perl 5.8 syn-
- tax. Jeffrey Friedl originated the idea (and the name) in the first
+ The possessive quantifier syntax is an extension to the Perl 5.8 syn-
+ tax. Jeffrey Friedl originated the idea (and the name) in the first
edition of his book. Mike McCloskey liked it, so implemented it when he
- built Sun's Java package, and PCRE copied it from there. It ultimately
+ built Sun's Java package, and PCRE copied it from there. It ultimately
found its way into Perl at release 5.10.
PCRE has an optimization that automatically "possessifies" certain sim-
- ple pattern constructs. For example, the sequence A+B is treated as
- A++B because there is no point in backtracking into a sequence of A's
+ ple pattern constructs. For example, the sequence A+B is treated as
+ A++B because there is no point in backtracking into a sequence of A's
when B must follow.
- When a pattern contains an unlimited repeat inside a subpattern that
- can itself be repeated an unlimited number of times, the use of an
- atomic group is the only way to avoid some failing matches taking a
+ When a pattern contains an unlimited repeat inside a subpattern that
+ can itself be repeated an unlimited number of times, the use of an
+ atomic group is the only way to avoid some failing matches taking a
very long time indeed. The pattern
(\D+|<\d+>)*[!?]
- matches an unlimited number of substrings that either consist of non-
- digits, or digits enclosed in <>, followed by either ! or ?. When it
+ matches an unlimited number of substrings that either consist of non-
+ digits, or digits enclosed in <>, followed by either ! or ?. When it
matches, it runs quickly. However, if it is applied to
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- it takes a long time before reporting failure. This is because the
- string can be divided between the internal \D+ repeat and the external
- * repeat in a large number of ways, and all have to be tried. (The
- example uses [!?] rather than a single character at the end, because
- both PCRE and Perl have an optimization that allows for fast failure
- when a single character is used. They remember the last single charac-
- ter that is required for a match, and fail early if it is not present
- in the string.) If the pattern is changed so that it uses an atomic
- group, like this:
+ it takes a long time before reporting failure. This is because the
+ string can be divided between the internal \D+ repeat and the external
+ * repeat in a large number of ways, and all have to be tried. (The ex-
+ ample uses [!?] rather than a single character at the end, because both
+ PCRE and Perl have an optimization that allows for fast failure when a
+ single character is used. They remember the last single character that
+ is required for a match, and fail early if it is not present in the
+ string.) If the pattern is changed so that it uses an atomic group,
+ like this:
((?>\D+)|<\d+>)*[!?]
@@ -6484,28 +6478,28 @@ BACK REFERENCES
Outside a character class, a backslash followed by a digit greater than
0 (and possibly further digits) is a back reference to a capturing sub-
- pattern earlier (that is, to its left) in the pattern, provided there
+ pattern earlier (that is, to its left) in the pattern, provided there
have been that many previous capturing left parentheses.
However, if the decimal number following the backslash is less than 10,
- it is always taken as a back reference, and causes an error only if
- there are not that many capturing left parentheses in the entire pat-
- tern. In other words, the parentheses that are referenced need not be
- to the left of the reference for numbers less than 10. A "forward back
- reference" of this type can make sense when a repetition is involved
- and the subpattern to the right has participated in an earlier itera-
+ it is always taken as a back reference, and causes an error only if
+ there are not that many capturing left parentheses in the entire pat-
+ tern. In other words, the parentheses that are referenced need not be
+ to the left of the reference for numbers less than 10. A "forward back
+ reference" of this type can make sense when a repetition is involved
+ and the subpattern to the right has participated in an earlier itera-
tion.
- It is not possible to have a numerical "forward back reference" to a
- subpattern whose number is 10 or more using this syntax because a
- sequence such as \50 is interpreted as a character defined in octal.
- See the subsection entitled "Non-printing characters" above for further
- details of the handling of digits following a backslash. There is no
- such problem when named parentheses are used. A back reference to any
- subpattern is possible using named parentheses (see below).
+ It is not possible to have a numerical "forward back reference" to a
+ subpattern whose number is 10 or more using this syntax because a se-
+ quence such as \50 is interpreted as a character defined in octal. See
+ the subsection entitled "Non-printing characters" above for further de-
+ tails of the handling of digits following a backslash. There is no such
+ problem when named parentheses are used. A back reference to any sub-
+ pattern is possible using named parentheses (see below).
- Another way of avoiding the ambiguity inherent in the use of digits
- following a backslash is to use the \g escape sequence. This escape
+ Another way of avoiding the ambiguity inherent in the use of digits
+ following a backslash is to use the \g escape sequence. This escape
must be followed by an unsigned number or a negative number, optionally
enclosed in braces. These examples are all identical:
@@ -6513,7 +6507,7 @@ BACK REFERENCES
(ring), \g1
(ring), \g{1}
- An unsigned number specifies an absolute reference without the ambigu-
+ An unsigned number specifies an absolute reference without the ambigu-
ity that is present in the older syntax. It is also useful when literal
digits follow the reference. A negative number is a relative reference.
Consider this example:
@@ -6522,126 +6516,126 @@ BACK REFERENCES
The sequence \g{-1} is a reference to the most recently started captur-
ing subpattern before \g, that is, is it equivalent to \2 in this exam-
- ple. Similarly, \g{-2} would be equivalent to \1. The use of relative
- references can be helpful in long patterns, and also in patterns that
- are created by joining together fragments that contain references
+ ple. Similarly, \g{-2} would be equivalent to \1. The use of relative
+ references can be helpful in long patterns, and also in patterns that
+ are created by joining together fragments that contain references
within themselves.
- A back reference matches whatever actually matched the capturing sub-
- pattern in the current subject string, rather than anything matching
+ A back reference matches whatever actually matched the capturing sub-
+ pattern in the current subject string, rather than anything matching
the subpattern itself (see "Subpatterns as subroutines" below for a way
of doing that). So the pattern
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
- not "sense and responsibility". If caseful matching is in force at the
- time of the back reference, the case of letters is relevant. For exam-
+ matches "sense and sensibility" and "response and responsibility", but
+ not "sense and responsibility". If caseful matching is in force at the
+ time of the back reference, the case of letters is relevant. For exam-
ple,
((?i)rah)\s+\1
- matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
+ matches "rah rah" and "RAH RAH", but not "RAH rah", even though the
original capturing subpattern is matched caselessly.
- There are several different ways of writing back references to named
- subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
- \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
+ There are several different ways of writing back references to named
+ subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or
+ \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's
unified back reference syntax, in which \g can be used for both numeric
- and named references, is also supported. We could rewrite the above
- example in any of the following ways:
+ and named references, is also supported. We could rewrite the above ex-
+ ample in any of the following ways:
(?<p1>(?i)rah)\s+\k<p1>
(?'p1'(?i)rah)\s+\k{p1}
(?P<p1>(?i)rah)\s+(?P=p1)
(?<p1>(?i)rah)\s+\g{p1}
- A subpattern that is referenced by name may appear in the pattern
- before or after the reference.
+ A subpattern that is referenced by name may appear in the pattern be-
+ fore or after the reference.
- There may be more than one back reference to the same subpattern. If a
- subpattern has not actually been used in a particular match, any back
+ There may be more than one back reference to the same subpattern. If a
+ subpattern has not actually been used in a particular match, any back
references to it always fail by default. For example, the pattern
(a|(bc))\2
- always fails if it starts to match "a" rather than "bc". However, if
+ always fails if it starts to match "a" rather than "bc". However, if
the PCRE_JAVASCRIPT_COMPAT option is set at compile time, a back refer-
ence to an unset value matches an empty string.
- Because there may be many capturing parentheses in a pattern, all dig-
- its following a backslash are taken as part of a potential back refer-
- ence number. If the pattern continues with a digit character, some
- delimiter must be used to terminate the back reference. If the
- PCRE_EXTENDED option is set, this can be white space. Otherwise, the
- \g{ syntax or an empty comment (see "Comments" below) can be used.
+ Because there may be many capturing parentheses in a pattern, all dig-
+ its following a backslash are taken as part of a potential back refer-
+ ence number. If the pattern continues with a digit character, some de-
+ limiter must be used to terminate the back reference. If the PCRE_EX-
+ TENDED option is set, this can be white space. Otherwise, the \g{ syn-
+ tax or an empty comment (see "Comments" below) can be used.
Recursive back references
- A back reference that occurs inside the parentheses to which it refers
- fails when the subpattern is first used, so, for example, (a\1) never
- matches. However, such references can be useful inside repeated sub-
+ A back reference that occurs inside the parentheses to which it refers
+ fails when the subpattern is first used, so, for example, (a\1) never
+ matches. However, such references can be useful inside repeated sub-
patterns. For example, the pattern
(a|b\1)+
matches any number of "a"s and also "aba", "ababbaa" etc. At each iter-
- ation of the subpattern, the back reference matches the character
- string corresponding to the previous iteration. In order for this to
- work, the pattern must be such that the first iteration does not need
- to match the back reference. This can be done using alternation, as in
+ ation of the subpattern, the back reference matches the character
+ string corresponding to the previous iteration. In order for this to
+ work, the pattern must be such that the first iteration does not need
+ to match the back reference. This can be done using alternation, as in
the example above, or by a quantifier with a minimum of zero.
- Back references of this type cause the group that they reference to be
- treated as an atomic group. Once the whole group has been matched, a
- subsequent matching failure cannot cause backtracking into the middle
+ Back references of this type cause the group that they reference to be
+ treated as an atomic group. Once the whole group has been matched, a
+ subsequent matching failure cannot cause backtracking into the middle
of the group.
ASSERTIONS
- An assertion is a test on the characters following or preceding the
- current matching point that does not actually consume any characters.
- The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are
- described above.
+ An assertion is a test on the characters following or preceding the
+ current matching point that does not actually consume any characters.
+ The simple assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are de-
+ scribed above.
- More complicated assertions are coded as subpatterns. There are two
- kinds: those that look ahead of the current position in the subject
- string, and those that look behind it. An assertion subpattern is
- matched in the normal way, except that it does not cause the current
+ More complicated assertions are coded as subpatterns. There are two
+ kinds: those that look ahead of the current position in the subject
+ string, and those that look behind it. An assertion subpattern is
+ matched in the normal way, except that it does not cause the current
matching position to be changed.
- Assertion subpatterns are not capturing subpatterns. If such an asser-
- tion contains capturing subpatterns within it, these are counted for
- the purposes of numbering the capturing subpatterns in the whole pat-
- tern. However, substring capturing is carried out only for positive
- assertions. (Perl sometimes, but not always, does do capturing in nega-
+ Assertion subpatterns are not capturing subpatterns. If such an asser-
+ tion contains capturing subpatterns within it, these are counted for
+ the purposes of numbering the capturing subpatterns in the whole pat-
+ tern. However, substring capturing is carried out only for positive as-
+ sertions. (Perl sometimes, but not always, does do capturing in nega-
tive assertions.)
- WARNING: If a positive assertion containing one or more capturing sub-
- patterns succeeds, but failure to match later in the pattern causes
+ WARNING: If a positive assertion containing one or more capturing sub-
+ patterns succeeds, but failure to match later in the pattern causes
backtracking over this assertion, the captures within the assertion are
- reset only if no higher numbered captures are already set. This is,
- unfortunately, a fundamental limitation of the current implementation,
- and as PCRE1 is now in maintenance-only status, it is unlikely ever to
+ reset only if no higher numbered captures are already set. This is, un-
+ fortunately, a fundamental limitation of the current implementation,
+ and as PCRE1 is now in maintenance-only status, it is unlikely ever to
change.
- For compatibility with Perl, assertion subpatterns may be repeated;
- though it makes no sense to assert the same thing several times, the
- side effect of capturing parentheses may occasionally be useful. In
+ For compatibility with Perl, assertion subpatterns may be repeated;
+ though it makes no sense to assert the same thing several times, the
+ side effect of capturing parentheses may occasionally be useful. In
practice, there only three cases:
- (1) If the quantifier is {0}, the assertion is never obeyed during
- matching. However, it may contain internal capturing parenthesized
+ (1) If the quantifier is {0}, the assertion is never obeyed during
+ matching. However, it may contain internal capturing parenthesized
groups that are called from elsewhere via the subroutine mechanism.
- (2) If quantifier is {0,n} where n is greater than zero, it is treated
- as if it were {0,1}. At run time, the rest of the pattern match is
+ (2) If quantifier is {0,n} where n is greater than zero, it is treated
+ as if it were {0,1}. At run time, the rest of the pattern match is
tried with and without the assertion, the order depending on the greed-
iness of the quantifier.
- (3) If the minimum repetition is greater than zero, the quantifier is
- ignored. The assertion is obeyed just once when encountered during
+ (3) If the minimum repetition is greater than zero, the quantifier is
+ ignored. The assertion is obeyed just once when encountered during
matching.
Lookahead assertions
@@ -6651,38 +6645,38 @@ ASSERTIONS
\w+(?=;)
- matches a word followed by a semicolon, but does not include the semi-
+ matches a word followed by a semicolon, but does not include the semi-
colon in the match, and
foo(?!bar)
- matches any occurrence of "foo" that is not followed by "bar". Note
+ matches any occurrence of "foo" that is not followed by "bar". Note
that the apparently similar pattern
(?!foo)bar
- does not find an occurrence of "bar" that is preceded by something
- other than "foo"; it finds any occurrence of "bar" whatsoever, because
+ does not find an occurrence of "bar" that is preceded by something
+ other than "foo"; it finds any occurrence of "bar" whatsoever, because
the assertion (?!foo) is always true when the next three characters are
"bar". A lookbehind assertion is needed to achieve the other effect.
If you want to force a matching failure at some point in a pattern, the
- most convenient way to do it is with (?!) because an empty string
- always matches, so an assertion that requires there not to be an empty
+ most convenient way to do it is with (?!) because an empty string al-
+ ways matches, so an assertion that requires there not to be an empty
string must always fail. The backtracking control verb (*FAIL) or (*F)
is a synonym for (?!).
Lookbehind assertions
- Lookbehind assertions start with (?<= for positive assertions and (?<!
+ Lookbehind assertions start with (?<= for positive assertions and (?<!
for negative assertions. For example,
(?<!foo)bar
- does find an occurrence of "bar" that is not preceded by "foo". The
- contents of a lookbehind assertion are restricted such that all the
+ does find an occurrence of "bar" that is not preceded by "foo". The
+ contents of a lookbehind assertion are restricted such that all the
strings it matches must have a fixed length. However, if there are sev-
- eral top-level alternatives, they do not all have to have the same
+ eral top-level alternatives, they do not all have to have the same
fixed length. Thus
(?<=bullock|donkey)
@@ -6691,62 +6685,62 @@ ASSERTIONS
(?<!dogs?|cats?)
- causes an error at compile time. Branches that match different length
- strings are permitted only at the top level of a lookbehind assertion.
+ causes an error at compile time. Branches that match different length
+ strings are permitted only at the top level of a lookbehind assertion.
This is an extension compared with Perl, which requires all branches to
match the same length of string. An assertion such as
(?<=ab(c|de))
- is not permitted, because its single top-level branch can match two
+ is not permitted, because its single top-level branch can match two
different lengths, but it is acceptable to PCRE if rewritten to use two
top-level branches:
(?<=abc|abde)
- In some cases, the escape sequence \K (see above) can be used instead
+ In some cases, the escape sequence \K (see above) can be used instead
of a lookbehind assertion to get round the fixed-length restriction.
- The implementation of lookbehind assertions is, for each alternative,
- to temporarily move the current position back by the fixed length and
+ The implementation of lookbehind assertions is, for each alternative,
+ to temporarily move the current position back by the fixed length and
then try to match. If there are insufficient characters before the cur-
rent position, the assertion fails.
- In a UTF mode, PCRE does not allow the \C escape (which matches a sin-
- gle data unit even in a UTF mode) to appear in lookbehind assertions,
- because it makes it impossible to calculate the length of the lookbe-
- hind. The \X and \R escapes, which can match different numbers of data
+ In a UTF mode, PCRE does not allow the \C escape (which matches a sin-
+ gle data unit even in a UTF mode) to appear in lookbehind assertions,
+ because it makes it impossible to calculate the length of the lookbe-
+ hind. The \X and \R escapes, which can match different numbers of data
units, are also not permitted.
- "Subroutine" calls (see below) such as (?2) or (?&X) are permitted in
- lookbehinds, as long as the subpattern matches a fixed-length string.
+ "Subroutine" calls (see below) such as (?2) or (?&X) are permitted in
+ lookbehinds, as long as the subpattern matches a fixed-length string.
Recursion, however, is not supported.
- Possessive quantifiers can be used in conjunction with lookbehind
- assertions to specify efficient matching of fixed-length strings at the
+ Possessive quantifiers can be used in conjunction with lookbehind as-
+ sertions to specify efficient matching of fixed-length strings at the
end of subject strings. Consider a simple pattern such as
abcd$
- when applied to a long string that does not match. Because matching
+ when applied to a long string that does not match. Because matching
proceeds from left to right, PCRE will look for each "a" in the subject
- and then see if what follows matches the rest of the pattern. If the
+ and then see if what follows matches the rest of the pattern. If the
pattern is specified as
^.*abcd$
- the initial .* matches the entire string at first, but when this fails
+ the initial .* matches the entire string at first, but when this fails
(because there is no following "a"), it backtracks to match all but the
- last character, then all but the last two characters, and so on. Once
- again the search for "a" covers the entire string, from right to left,
+ last character, then all but the last two characters, and so on. Once
+ again the search for "a" covers the entire string, from right to left,
so we are no better off. However, if the pattern is written as
^.*+(?<=abcd)
- there can be no backtracking for the .*+ item; it can match only the
- entire string. The subsequent lookbehind assertion does a single test
- on the last four characters. If it fails, the match fails immediately.
- For long strings, this approach makes a significant difference to the
+ there can be no backtracking for the .*+ item; it can match only the
+ entire string. The subsequent lookbehind assertion does a single test
+ on the last four characters. If it fails, the match fails immediately.
+ For long strings, this approach makes a significant difference to the
processing time.
Using multiple assertions
@@ -6755,18 +6749,18 @@ ASSERTIONS
(?<=\d{3})(?<!999)foo
- matches "foo" preceded by three digits that are not "999". Notice that
- each of the assertions is applied independently at the same point in
- the subject string. First there is a check that the previous three
- characters are all digits, and then there is a check that the same
+ matches "foo" preceded by three digits that are not "999". Notice that
+ each of the assertions is applied independently at the same point in
+ the subject string. First there is a check that the previous three
+ characters are all digits, and then there is a check that the same
three characters are not "999". This pattern does not match "foo" pre-
- ceded by six characters, the first of which are digits and the last
- three of which are not "999". For example, it doesn't match "123abc-
+ ceded by six characters, the first of which are digits and the last
+ three of which are not "999". For example, it doesn't match "123abc-
foo". A pattern to do that is
(?<=\d{3}...)(?<!999)foo
- This time the first assertion looks at the preceding six characters,
+ This time the first assertion looks at the preceding six characters,
checking that the first three are digits, and then the second assertion
checks that the preceding three characters are not "999".
@@ -6774,99 +6768,99 @@ ASSERTIONS
(?<=(?<!foo)bar)baz
- matches an occurrence of "baz" that is preceded by "bar" which in turn
+ matches an occurrence of "baz" that is preceded by "bar" which in turn
is not preceded by "foo", while
(?<=\d{3}(?!999)...)foo
- is another pattern that matches "foo" preceded by three digits and any
+ is another pattern that matches "foo" preceded by three digits and any
three characters that are not "999".
CONDITIONAL SUBPATTERNS
- It is possible to cause the matching process to obey a subpattern con-
- ditionally or to choose between two alternative subpatterns, depending
- on the result of an assertion, or whether a specific capturing subpat-
- tern has already been matched. The two possible forms of conditional
+ It is possible to cause the matching process to obey a subpattern con-
+ ditionally or to choose between two alternative subpatterns, depending
+ on the result of an assertion, or whether a specific capturing subpat-
+ tern has already been matched. The two possible forms of conditional
subpattern are:
(?(condition)yes-pattern)
(?(condition)yes-pattern|no-pattern)
- If the condition is satisfied, the yes-pattern is used; otherwise the
- no-pattern (if present) is used. If there are more than two alterna-
- tives in the subpattern, a compile-time error occurs. Each of the two
+ If the condition is satisfied, the yes-pattern is used; otherwise the
+ no-pattern (if present) is used. If there are more than two alterna-
+ tives in the subpattern, a compile-time error occurs. Each of the two
alternatives may itself contain nested subpatterns of any form, includ-
- ing conditional subpatterns; the restriction to two alternatives
- applies only at the level of the condition. This pattern fragment is an
+ ing conditional subpatterns; the restriction to two alternatives ap-
+ plies only at the level of the condition. This pattern fragment is an
example where the alternatives are complex:
(?(1) (A|B|C) | (D | (?(2)E|F) | E) )
- There are four kinds of condition: references to subpatterns, refer-
+ There are four kinds of condition: references to subpatterns, refer-
ences to recursion, a pseudo-condition called DEFINE, and assertions.
Checking for a used subpattern by number
- If the text between the parentheses consists of a sequence of digits,
+ If the text between the parentheses consists of a sequence of digits,
the condition is true if a capturing subpattern of that number has pre-
- viously matched. If there is more than one capturing subpattern with
- the same number (see the earlier section about duplicate subpattern
- numbers), the condition is true if any of them have matched. An alter-
- native notation is to precede the digits with a plus or minus sign. In
- this case, the subpattern number is relative rather than absolute. The
- most recently opened parentheses can be referenced by (?(-1), the next
- most recent by (?(-2), and so on. Inside loops it can also make sense
+ viously matched. If there is more than one capturing subpattern with
+ the same number (see the earlier section about duplicate subpattern
+ numbers), the condition is true if any of them have matched. An alter-
+ native notation is to precede the digits with a plus or minus sign. In
+ this case, the subpattern number is relative rather than absolute. The
+ most recently opened parentheses can be referenced by (?(-1), the next
+ most recent by (?(-2), and so on. Inside loops it can also make sense
to refer to subsequent groups. The next parentheses to be opened can be
- referenced as (?(+1), and so on. (The value zero in any of these forms
+ referenced as (?(+1), and so on. (The value zero in any of these forms
is not used; it provokes a compile-time error.)
- Consider the following pattern, which contains non-significant white
+ Consider the following pattern, which contains non-significant white
space to make it more readable (assume the PCRE_EXTENDED option) and to
divide it into three parts for ease of discussion:
( \( )? [^()]+ (?(1) \) )
- The first part matches an optional opening parenthesis, and if that
+ The first part matches an optional opening parenthesis, and if that
character is present, sets it as the first captured substring. The sec-
- ond part matches one or more characters that are not parentheses. The
- third part is a conditional subpattern that tests whether or not the
- first set of parentheses matched. If they did, that is, if subject
- started with an opening parenthesis, the condition is true, and so the
- yes-pattern is executed and a closing parenthesis is required. Other-
- wise, since no-pattern is not present, the subpattern matches nothing.
- In other words, this pattern matches a sequence of non-parentheses,
- optionally enclosed in parentheses.
-
- If you were embedding this pattern in a larger one, you could use a
+ ond part matches one or more characters that are not parentheses. The
+ third part is a conditional subpattern that tests whether or not the
+ first set of parentheses matched. If they did, that is, if subject
+ started with an opening parenthesis, the condition is true, and so the
+ yes-pattern is executed and a closing parenthesis is required. Other-
+ wise, since no-pattern is not present, the subpattern matches nothing.
+ In other words, this pattern matches a sequence of non-parentheses, op-
+ tionally enclosed in parentheses.
+
+ If you were embedding this pattern in a larger one, you could use a
relative reference:
...other stuff... ( \( )? [^()]+ (?(-1) \) ) ...
- This makes the fragment independent of the parentheses in the larger
+ This makes the fragment independent of the parentheses in the larger
pattern.
Checking for a used subpattern by name
- Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
- used subpattern by name. For compatibility with earlier versions of
- PCRE, which had this facility before Perl, the syntax (?(name)...) is
+ Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
+ used subpattern by name. For compatibility with earlier versions of
+ PCRE, which had this facility before Perl, the syntax (?(name)...) is
also recognized.
Rewriting the above example to use a named subpattern gives this:
(?<OPEN> \( )? [^()]+ (?(<OPEN>) \) )
- If the name used in a condition of this kind is a duplicate, the test
- is applied to all subpatterns of the same name, and is true if any one
+ If the name used in a condition of this kind is a duplicate, the test
+ is applied to all subpatterns of the same name, and is true if any one
of them has matched.
Checking for pattern recursion
If the condition is the string (R), and there is no subpattern with the
- name R, the condition is true if a recursive call to the whole pattern
+ name R, the condition is true if a recursive call to the whole pattern
or any subpattern has been made. If digits or a name preceded by amper-
sand follow the letter R, for example:
@@ -6874,51 +6868,51 @@ CONDITIONAL SUBPATTERNS
the condition is true if the most recent recursion is into a subpattern
whose number or name is given. This condition does not check the entire
- recursion stack. If the name used in a condition of this kind is a
- duplicate, the test is applied to all subpatterns of the same name, and
+ recursion stack. If the name used in a condition of this kind is a du-
+ plicate, the test is applied to all subpatterns of the same name, and
is true if any one of them is the most recent recursion.
- At "top level", all these recursion test conditions are false. The
+ At "top level", all these recursion test conditions are false. The
syntax for recursive patterns is described below.
Defining subpatterns for use by reference only
- If the condition is the string (DEFINE), and there is no subpattern
- with the name DEFINE, the condition is always false. In this case,
- there may be only one alternative in the subpattern. It is always
- skipped if control reaches this point in the pattern; the idea of
- DEFINE is that it can be used to define subroutines that can be refer-
- enced from elsewhere. (The use of subroutines is described below.) For
- example, a pattern to match an IPv4 address such as "192.168.23.245"
+ If the condition is the string (DEFINE), and there is no subpattern
+ with the name DEFINE, the condition is always false. In this case,
+ there may be only one alternative in the subpattern. It is always
+ skipped if control reaches this point in the pattern; the idea of DE-
+ FINE is that it can be used to define subroutines that can be refer-
+ enced from elsewhere. (The use of subroutines is described below.) For
+ example, a pattern to match an IPv4 address such as "192.168.23.245"
could be written like this (ignore white space and line breaks):
(?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
\b (?&byte) (\.(?&byte)){3} \b
- The first part of the pattern is a DEFINE group inside which a another
- group named "byte" is defined. This matches an individual component of
- an IPv4 address (a number less than 256). When matching takes place,
- this part of the pattern is skipped because DEFINE acts like a false
- condition. The rest of the pattern uses references to the named group
- to match the four dot-separated components of an IPv4 address, insist-
+ The first part of the pattern is a DEFINE group inside which a another
+ group named "byte" is defined. This matches an individual component of
+ an IPv4 address (a number less than 256). When matching takes place,
+ this part of the pattern is skipped because DEFINE acts like a false
+ condition. The rest of the pattern uses references to the named group
+ to match the four dot-separated components of an IPv4 address, insist-
ing on a word boundary at each end.
Assertion conditions
- If the condition is not in any of the above formats, it must be an
- assertion. This may be a positive or negative lookahead or lookbehind
- assertion. Consider this pattern, again containing non-significant
+ If the condition is not in any of the above formats, it must be an as-
+ sertion. This may be a positive or negative lookahead or lookbehind
+ assertion. Consider this pattern, again containing non-significant
white space, and with the two alternatives on the second line:
(?(?=[^a-z]*[a-z])
\d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
- The condition is a positive lookahead assertion that matches an
- optional sequence of non-letters followed by a letter. In other words,
- it tests for the presence of at least one letter in the subject. If a
- letter is found, the subject is matched against the first alternative;
- otherwise it is matched against the second. This pattern matches
- strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
+ The condition is a positive lookahead assertion that matches an op-
+ tional sequence of non-letters followed by a letter. In other words, it
+ tests for the presence of at least one letter in the subject. If a let-
+ ter is found, the subject is matched against the first alternative;
+ otherwise it is matched against the second. This pattern matches
+ strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
letters and dd are digits.
@@ -6927,41 +6921,41 @@ COMMENTS
There are two ways of including comments in patterns that are processed
by PCRE. In both cases, the start of the comment must not be in a char-
acter class, nor in the middle of any other sequence of related charac-
- ters such as (?: or a subpattern name or number. The characters that
+ ters such as (?: or a subpattern name or number. The characters that
make up a comment play no part in the pattern matching.
- The sequence (?# marks the start of a comment that continues up to the
- next closing parenthesis. Nested parentheses are not permitted. If the
+ The sequence (?# marks the start of a comment that continues up to the
+ next closing parenthesis. Nested parentheses are not permitted. If the
PCRE_EXTENDED option is set, an unescaped # character also introduces a
- comment, which in this case continues to immediately after the next
- newline character or character sequence in the pattern. Which charac-
+ comment, which in this case continues to immediately after the next
+ newline character or character sequence in the pattern. Which charac-
ters are interpreted as newlines is controlled by the options passed to
- a compiling function or by a special sequence at the start of the pat-
+ a compiling function or by a special sequence at the start of the pat-
tern, as described in the section entitled "Newline conventions" above.
Note that the end of this type of comment is a literal newline sequence
- in the pattern; escape sequences that happen to represent a newline do
- not count. For example, consider this pattern when PCRE_EXTENDED is
+ in the pattern; escape sequences that happen to represent a newline do
+ not count. For example, consider this pattern when PCRE_EXTENDED is
set, and the default newline convention is in force:
abc #comment \n still comment
- On encountering the # character, pcre_compile() skips along, looking
- for a newline in the pattern. The sequence \n is still literal at this
- stage, so it does not terminate the comment. Only an actual character
+ On encountering the # character, pcre_compile() skips along, looking
+ for a newline in the pattern. The sequence \n is still literal at this
+ stage, so it does not terminate the comment. Only an actual character
with the code value 0x0a (the default newline) does so.
RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses, allowing for
- unlimited nested parentheses. Without the use of recursion, the best
- that can be done is to use a pattern that matches up to some fixed
- depth of nesting. It is not possible to handle an arbitrary nesting
+ Consider the problem of matching a string in parentheses, allowing for
+ unlimited nested parentheses. Without the use of recursion, the best
+ that can be done is to use a pattern that matches up to some fixed
+ depth of nesting. It is not possible to handle an arbitrary nesting
depth.
For some time, Perl has provided a facility that allows regular expres-
- sions to recurse (amongst other things). It does this by interpolating
- Perl code in the expression at run time, and the code can refer to the
+ sions to recurse (amongst other things). It does this by interpolating
+ Perl code in the expression at run time, and the code can refer to the
expression itself. A Perl pattern using code interpolation to solve the
parentheses problem can be created like this:
@@ -6971,201 +6965,201 @@ RECURSIVE PATTERNS
refers recursively to the pattern in which it appears.
Obviously, PCRE cannot support the interpolation of Perl code. Instead,
- it supports special syntax for recursion of the entire pattern, and
- also for individual subpattern recursion. After its introduction in
- PCRE and Python, this kind of recursion was subsequently introduced
+ it supports special syntax for recursion of the entire pattern, and
+ also for individual subpattern recursion. After its introduction in
+ PCRE and Python, this kind of recursion was subsequently introduced
into Perl at release 5.10.
- A special item that consists of (? followed by a number greater than
- zero and a closing parenthesis is a recursive subroutine call of the
- subpattern of the given number, provided that it occurs inside that
- subpattern. (If not, it is a non-recursive subroutine call, which is
- described in the next section.) The special item (?R) or (?0) is a
- recursive call of the entire regular expression.
+ A special item that consists of (? followed by a number greater than
+ zero and a closing parenthesis is a recursive subroutine call of the
+ subpattern of the given number, provided that it occurs inside that
+ subpattern. (If not, it is a non-recursive subroutine call, which is
+ described in the next section.) The special item (?R) or (?0) is a re-
+ cursive call of the entire regular expression.
- This PCRE pattern solves the nested parentheses problem (assume the
+ This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
\( ( [^()]++ | (?R) )* \)
- First it matches an opening parenthesis. Then it matches any number of
- substrings which can either be a sequence of non-parentheses, or a
- recursive match of the pattern itself (that is, a correctly parenthe-
- sized substring). Finally there is a closing parenthesis. Note the use
- of a possessive quantifier to avoid backtracking into sequences of non-
+ First it matches an opening parenthesis. Then it matches any number of
+ substrings which can either be a sequence of non-parentheses, or a re-
+ cursive match of the pattern itself (that is, a correctly parenthesized
+ substring). Finally there is a closing parenthesis. Note the use of a
+ possessive quantifier to avoid backtracking into sequences of non-
parentheses.
- If this were part of a larger pattern, you would not want to recurse
+ If this were part of a larger pattern, you would not want to recurse
the entire pattern, so instead you could use this:
( \( ( [^()]++ | (?1) )* \) )
- We have put the pattern into parentheses, and caused the recursion to
+ We have put the pattern into parentheses, and caused the recursion to
refer to them instead of the whole pattern.
- In a larger pattern, keeping track of parenthesis numbers can be
- tricky. This is made easier by the use of relative references. Instead
+ In a larger pattern, keeping track of parenthesis numbers can be
+ tricky. This is made easier by the use of relative references. Instead
of (?1) in the pattern above you can write (?-2) to refer to the second
- most recently opened parentheses preceding the recursion. In other
- words, a negative number counts capturing parentheses leftwards from
+ most recently opened parentheses preceding the recursion. In other
+ words, a negative number counts capturing parentheses leftwards from
the point at which it is encountered.
- It is also possible to refer to subsequently opened parentheses, by
- writing references such as (?+2). However, these cannot be recursive
- because the reference is not inside the parentheses that are refer-
- enced. They are always non-recursive subroutine calls, as described in
+ It is also possible to refer to subsequently opened parentheses, by
+ writing references such as (?+2). However, these cannot be recursive
+ because the reference is not inside the parentheses that are refer-
+ enced. They are always non-recursive subroutine calls, as described in
the next section.
- An alternative approach is to use named parentheses instead. The Perl
- syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
+ An alternative approach is to use named parentheses instead. The Perl
+ syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
supported. We could rewrite the above example as follows:
(?<pn> \( ( [^()]++ | (?&pn) )* \) )
- If there is more than one subpattern with the same name, the earliest
+ If there is more than one subpattern with the same name, the earliest
one is used.
- This particular example pattern that we have been looking at contains
+ This particular example pattern that we have been looking at contains
nested unlimited repeats, and so the use of a possessive quantifier for
matching strings of non-parentheses is important when applying the pat-
- tern to strings that do not match. For example, when this pattern is
+ tern to strings that do not match. For example, when this pattern is
applied to
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
- it yields "no match" quickly. However, if a possessive quantifier is
- not used, the match runs for a very long time indeed because there are
- so many different ways the + and * repeats can carve up the subject,
+ it yields "no match" quickly. However, if a possessive quantifier is
+ not used, the match runs for a very long time indeed because there are
+ so many different ways the + and * repeats can carve up the subject,
and all have to be tested before failure can be reported.
- At the end of a match, the values of capturing parentheses are those
- from the outermost level. If you want to obtain intermediate values, a
- callout function can be used (see below and the pcrecallout documenta-
+ At the end of a match, the values of capturing parentheses are those
+ from the outermost level. If you want to obtain intermediate values, a
+ callout function can be used (see below and the pcrecallout documenta-
tion). If the pattern above is matched against
(ab(cd)ef)
- the value for the inner capturing parentheses (numbered 2) is "ef",
- which is the last value taken on at the top level. If a capturing sub-
- pattern is not matched at the top level, its final captured value is
- unset, even if it was (temporarily) set at a deeper level during the
+ the value for the inner capturing parentheses (numbered 2) is "ef",
+ which is the last value taken on at the top level. If a capturing sub-
+ pattern is not matched at the top level, its final captured value is
+ unset, even if it was (temporarily) set at a deeper level during the
matching process.
- If there are more than 15 capturing parentheses in a pattern, PCRE has
- to obtain extra memory to store data during a recursion, which it does
+ If there are more than 15 capturing parentheses in a pattern, PCRE has
+ to obtain extra memory to store data during a recursion, which it does
by using pcre_malloc, freeing it via pcre_free afterwards. If no memory
can be obtained, the match fails with the PCRE_ERROR_NOMEMORY error.
- Do not confuse the (?R) item with the condition (R), which tests for
- recursion. Consider this pattern, which matches text in angle brack-
- ets, allowing for arbitrary nesting. Only digits are allowed in nested
- brackets (that is, when recursing), whereas any characters are permit-
+ Do not confuse the (?R) item with the condition (R), which tests for
+ recursion. Consider this pattern, which matches text in angle brack-
+ ets, allowing for arbitrary nesting. Only digits are allowed in nested
+ brackets (that is, when recursing), whereas any characters are permit-
ted at the outer level.
< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >
- In this pattern, (?(R) is the start of a conditional subpattern, with
- two different alternatives for the recursive and non-recursive cases.
+ In this pattern, (?(R) is the start of a conditional subpattern, with
+ two different alternatives for the recursive and non-recursive cases.
The (?R) item is the actual recursive call.
Differences in recursion processing between PCRE and Perl
- Recursion processing in PCRE differs from Perl in two important ways.
- In PCRE (like Python, but unlike Perl), a recursive subpattern call is
+ Recursion processing in PCRE differs from Perl in two important ways.
+ In PCRE (like Python, but unlike Perl), a recursive subpattern call is
always treated as an atomic group. That is, once it has matched some of
the subject string, it is never re-entered, even if it contains untried
- alternatives and there is a subsequent matching failure. This can be
- illustrated by the following pattern, which purports to match a palin-
- dromic string that contains an odd number of characters (for example,
+ alternatives and there is a subsequent matching failure. This can be
+ illustrated by the following pattern, which purports to match a palin-
+ dromic string that contains an odd number of characters (for example,
"a", "aba", "abcba", "abcdcba"):
^(.|(.)(?1)\2)$
The idea is that it either matches a single character, or two identical
- characters surrounding a sub-palindrome. In Perl, this pattern works;
- in PCRE it does not if the pattern is longer than three characters.
+ characters surrounding a sub-palindrome. In Perl, this pattern works;
+ in PCRE it does not if the pattern is longer than three characters.
Consider the subject string "abcba":
- At the top level, the first character is matched, but as it is not at
+ At the top level, the first character is matched, but as it is not at
the end of the string, the first alternative fails; the second alterna-
tive is taken and the recursion kicks in. The recursive call to subpat-
- tern 1 successfully matches the next character ("b"). (Note that the
+ tern 1 successfully matches the next character ("b"). (Note that the
beginning and end of line tests are not part of the recursion).
- Back at the top level, the next character ("c") is compared with what
- subpattern 2 matched, which was "a". This fails. Because the recursion
- is treated as an atomic group, there are now no backtracking points,
- and so the entire match fails. (Perl is able, at this point, to re-
- enter the recursion and try the second alternative.) However, if the
- pattern is written with the alternatives in the other order, things are
+ Back at the top level, the next character ("c") is compared with what
+ subpattern 2 matched, which was "a". This fails. Because the recursion
+ is treated as an atomic group, there are now no backtracking points,
+ and so the entire match fails. (Perl is able, at this point, to re-en-
+ ter the recursion and try the second alternative.) However, if the pat-
+ tern is written with the alternatives in the other order, things are
different:
^((.)(?1)\2|.)$
- This time, the recursing alternative is tried first, and continues to
- recurse until it runs out of characters, at which point the recursion
- fails. But this time we do have another alternative to try at the
- higher level. That is the big difference: in the previous case the
- remaining alternative is at a deeper recursion level, which PCRE cannot
+ This time, the recursing alternative is tried first, and continues to
+ recurse until it runs out of characters, at which point the recursion
+ fails. But this time we do have another alternative to try at the
+ higher level. That is the big difference: in the previous case the re-
+ maining alternative is at a deeper recursion level, which PCRE cannot
use.
- To change the pattern so that it matches all palindromic strings, not
- just those with an odd number of characters, it is tempting to change
+ To change the pattern so that it matches all palindromic strings, not
+ just those with an odd number of characters, it is tempting to change
the pattern to this:
^((.)(?1)\2|.?)$
- Again, this works in Perl, but not in PCRE, and for the same reason.
- When a deeper recursion has matched a single character, it cannot be
- entered again in order to match an empty string. The solution is to
- separate the two cases, and write out the odd and even cases as alter-
+ Again, this works in Perl, but not in PCRE, and for the same reason.
+ When a deeper recursion has matched a single character, it cannot be
+ entered again in order to match an empty string. The solution is to
+ separate the two cases, and write out the odd and even cases as alter-
natives at the higher level:
^(?:((.)(?1)\2|)|((.)(?3)\4|.))
- If you want to match typical palindromic phrases, the pattern has to
+ If you want to match typical palindromic phrases, the pattern has to
ignore all non-word characters, which can be done like this:
^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$
If run with the PCRE_CASELESS option, this pattern matches phrases such
as "A man, a plan, a canal: Panama!" and it works well in both PCRE and
- Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
- ing into sequences of non-word characters. Without this, PCRE takes a
- great deal longer (ten times or more) to match typical phrases, and
+ Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
+ ing into sequences of non-word characters. Without this, PCRE takes a
+ great deal longer (ten times or more) to match typical phrases, and
Perl takes so long that you think it has gone into a loop.
- WARNING: The palindrome-matching patterns above work only if the sub-
- ject string does not start with a palindrome that is shorter than the
- entire string. For example, although "abcba" is correctly matched, if
- the subject is "ababa", PCRE finds the palindrome "aba" at the start,
- then fails at top level because the end of the string does not follow.
- Once again, it cannot jump back into the recursion to try other alter-
+ WARNING: The palindrome-matching patterns above work only if the sub-
+ ject string does not start with a palindrome that is shorter than the
+ entire string. For example, although "abcba" is correctly matched, if
+ the subject is "ababa", PCRE finds the palindrome "aba" at the start,
+ then fails at top level because the end of the string does not follow.
+ Once again, it cannot jump back into the recursion to try other alter-
natives, so the entire match fails.
- The second way in which PCRE and Perl differ in their recursion pro-
- cessing is in the handling of captured values. In Perl, when a subpat-
- tern is called recursively or as a subpattern (see the next section),
- it has no access to any values that were captured outside the recur-
- sion, whereas in PCRE these values can be referenced. Consider this
+ The second way in which PCRE and Perl differ in their recursion pro-
+ cessing is in the handling of captured values. In Perl, when a subpat-
+ tern is called recursively or as a subpattern (see the next section),
+ it has no access to any values that were captured outside the recur-
+ sion, whereas in PCRE these values can be referenced. Consider this
pattern:
^(.)(\1|a(?2))
- In PCRE, this pattern matches "bab". The first capturing parentheses
- match "b", then in the second group, when the back reference \1 fails
- to match "b", the second alternative matches "a" and then recurses. In
- the recursion, \1 does now match "b" and so the whole match succeeds.
- In Perl, the pattern fails to match because inside the recursive call
+ In PCRE, this pattern matches "bab". The first capturing parentheses
+ match "b", then in the second group, when the back reference \1 fails
+ to match "b", the second alternative matches "a" and then recurses. In
+ the recursion, \1 does now match "b" and so the whole match succeeds.
+ In Perl, the pattern fails to match because inside the recursive call
\1 cannot access the externally set value.
SUBPATTERNS AS SUBROUTINES
- If the syntax for a recursive subpattern call (either by number or by
- name) is used outside the parentheses to which it refers, it operates
- like a subroutine in a programming language. The called subpattern may
- be defined before or after the reference. A numbered reference can be
+ If the syntax for a recursive subpattern call (either by number or by
+ name) is used outside the parentheses to which it refers, it operates
+ like a subroutine in a programming language. The called subpattern may
+ be defined before or after the reference. A numbered reference can be
absolute or relative, as in these examples:
(...(absolute)...)...(?2)...
@@ -7176,79 +7170,79 @@ SUBPATTERNS AS SUBROUTINES
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
+ matches "sense and sensibility" and "response and responsibility", but
not "sense and responsibility". If instead the pattern
(sens|respons)e and (?1)ibility
- is used, it does match "sense and responsibility" as well as the other
- two strings. Another example is given in the discussion of DEFINE
+ is used, it does match "sense and responsibility" as well as the other
+ two strings. Another example is given in the discussion of DEFINE
above.
- All subroutine calls, whether recursive or not, are always treated as
- atomic groups. That is, once a subroutine has matched some of the sub-
+ All subroutine calls, whether recursive or not, are always treated as
+ atomic groups. That is, once a subroutine has matched some of the sub-
ject string, it is never re-entered, even if it contains untried alter-
- natives and there is a subsequent matching failure. Any capturing
- parentheses that are set during the subroutine call revert to their
+ natives and there is a subsequent matching failure. Any capturing
+ parentheses that are set during the subroutine call revert to their
previous values afterwards.
- Processing options such as case-independence are fixed when a subpat-
- tern is defined, so if it is used as a subroutine, such options cannot
+ Processing options such as case-independence are fixed when a subpat-
+ tern is defined, so if it is used as a subroutine, such options cannot
be changed for different calls. For example, consider this pattern:
(abc)(?i:(?-1))
- It matches "abcabc". It does not match "abcABC" because the change of
+ It matches "abcabc". It does not match "abcABC" because the change of
processing option does not affect the called subpattern.
ONIGURUMA SUBROUTINE SYNTAX
- For compatibility with Oniguruma, the non-Perl syntax \g followed by a
+ For compatibility with Oniguruma, the non-Perl syntax \g followed by a
name or a number enclosed either in angle brackets or single quotes, is
- an alternative syntax for referencing a subpattern as a subroutine,
- possibly recursively. Here are two of the examples used above, rewrit-
+ an alternative syntax for referencing a subpattern as a subroutine,
+ possibly recursively. Here are two of the examples used above, rewrit-
ten using this syntax:
(?<pn> \( ( (?>[^()]+) | \g<pn> )* \) )
(sens|respons)e and \g'1'ibility
- PCRE supports an extension to Oniguruma: if a number is preceded by a
+ PCRE supports an extension to Oniguruma: if a number is preceded by a
plus or a minus sign it is taken as a relative reference. For example:
(abc)(?i:\g<-1>)
- Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
- synonymous. The former is a back reference; the latter is a subroutine
+ Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
+ synonymous. The former is a back reference; the latter is a subroutine
call.
CALLOUTS
Perl has a feature whereby using the sequence (?{...}) causes arbitrary
- Perl code to be obeyed in the middle of matching a regular expression.
+ Perl code to be obeyed in the middle of matching a regular expression.
This makes it possible, amongst other things, to extract different sub-
strings that match the same pair of parentheses when there is a repeti-
tion.
PCRE provides a similar feature, but of course it cannot obey arbitrary
Perl code. The feature is called "callout". The caller of PCRE provides
- an external function by putting its entry point in the global variable
- pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
- library). By default, this variable contains NULL, which disables all
+ an external function by putting its entry point in the global variable
+ pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
+ library). By default, this variable contains NULL, which disables all
calling out.
- Within a regular expression, (?C) indicates the points at which the
- external function is to be called. If you want to identify different
- callout points, you can put a number less than 256 after the letter C.
- The default value is zero. For example, this pattern has two callout
+ Within a regular expression, (?C) indicates the points at which the ex-
+ ternal function is to be called. If you want to identify different
+ callout points, you can put a number less than 256 after the letter C.
+ The default value is zero. For example, this pattern has two callout
points:
(?C1)abc(?C2)def
- If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
- outs are automatically installed before each item in the pattern. They
- are all numbered 255. If there is a conditional group in the pattern
+ If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
+ outs are automatically installed before each item in the pattern. They
+ are all numbered 255. If there is a conditional group in the pattern
whose condition is an assertion, an additional callout is inserted just
before the condition. An explicit callout may also be set at this posi-
tion, as in this example:
@@ -7258,120 +7252,120 @@ CALLOUTS
Note that this applies only to assertion conditions, not to other types
of condition.
- During matching, when PCRE reaches a callout point, the external func-
- tion is called. It is provided with the number of the callout, the
- position in the pattern, and, optionally, one item of data originally
- supplied by the caller of the matching function. The callout function
+ During matching, when PCRE reaches a callout point, the external func-
+ tion is called. It is provided with the number of the callout, the po-
+ sition in the pattern, and, optionally, one item of data originally
+ supplied by the caller of the matching function. The callout function
may cause matching to proceed, to backtrack, or to fail altogether.
- By default, PCRE implements a number of optimizations at compile time
- and matching time, and one side-effect is that sometimes callouts are
- skipped. If you need all possible callouts to happen, you need to set
- options that disable the relevant optimizations. More details, and a
- complete description of the interface to the callout function, are
+ By default, PCRE implements a number of optimizations at compile time
+ and matching time, and one side-effect is that sometimes callouts are
+ skipped. If you need all possible callouts to happen, you need to set
+ options that disable the relevant optimizations. More details, and a
+ complete description of the interface to the callout function, are
given in the pcrecallout documentation.
BACKTRACKING CONTROL
- Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
- which are still described in the Perl documentation as "experimental
- and subject to change or removal in a future version of Perl". It goes
- on to say: "Their usage in production code should be noted to avoid
- problems during upgrades." The same remarks apply to the PCRE features
+ Perl 5.10 introduced a number of "Special Backtracking Control Verbs",
+ which are still described in the Perl documentation as "experimental
+ and subject to change or removal in a future version of Perl". It goes
+ on to say: "Their usage in production code should be noted to avoid
+ problems during upgrades." The same remarks apply to the PCRE features
described in this section.
- The new verbs make use of what was previously invalid syntax: an open-
+ The new verbs make use of what was previously invalid syntax: an open-
ing parenthesis followed by an asterisk. They are generally of the form
- (*VERB) or (*VERB:NAME). Some may take either form, possibly behaving
- differently depending on whether or not a name is present. A name is
+ (*VERB) or (*VERB:NAME). Some may take either form, possibly behaving
+ differently depending on whether or not a name is present. A name is
any sequence of characters that does not include a closing parenthesis.
The maximum length of name is 255 in the 8-bit library and 65535 in the
- 16-bit and 32-bit libraries. If the name is empty, that is, if the
- closing parenthesis immediately follows the colon, the effect is as if
- the colon were not there. Any number of these verbs may occur in a
+ 16-bit and 32-bit libraries. If the name is empty, that is, if the
+ closing parenthesis immediately follows the colon, the effect is as if
+ the colon were not there. Any number of these verbs may occur in a
pattern.
- Since these verbs are specifically related to backtracking, most of
- them can be used only when the pattern is to be matched using one of
- the traditional matching functions, because these use a backtracking
- algorithm. With the exception of (*FAIL), which behaves like a failing
- negative assertion, the backtracking control verbs cause an error if
+ Since these verbs are specifically related to backtracking, most of
+ them can be used only when the pattern is to be matched using one of
+ the traditional matching functions, because these use a backtracking
+ algorithm. With the exception of (*FAIL), which behaves like a failing
+ negative assertion, the backtracking control verbs cause an error if
encountered by a DFA matching function.
- The behaviour of these verbs in repeated groups, assertions, and in
+ The behaviour of these verbs in repeated groups, assertions, and in
subpatterns called as subroutines (whether or not recursively) is docu-
mented below.
Optimizations that affect backtracking verbs
- PCRE contains some optimizations that are used to speed up matching by
+ PCRE contains some optimizations that are used to speed up matching by
running some checks at the start of each match attempt. For example, it
- may know the minimum length of matching subject, or that a particular
+ may know the minimum length of matching subject, or that a particular
character must be present. When one of these optimizations bypasses the
- running of a match, any included backtracking verbs will not, of
+ running of a match, any included backtracking verbs will not, of
course, be processed. You can suppress the start-of-match optimizations
- by setting the PCRE_NO_START_OPTIMIZE option when calling pcre_com-
+ by setting the PCRE_NO_START_OPTIMIZE option when calling pcre_com-
pile() or pcre_exec(), or by starting the pattern with (*NO_START_OPT).
There is more discussion of this option in the section entitled "Option
bits for pcre_exec()" in the pcreapi documentation.
- Experiments with Perl suggest that it too has similar optimizations,
+ Experiments with Perl suggest that it too has similar optimizations,
sometimes leading to anomalous results.
Verbs that act immediately
- The following verbs act as soon as they are encountered. They may not
+ The following verbs act as soon as they are encountered. They may not
be followed by a name.
(*ACCEPT)
- This verb causes the match to end successfully, skipping the remainder
- of the pattern. However, when it is inside a subpattern that is called
- as a subroutine, only that subpattern is ended successfully. Matching
+ This verb causes the match to end successfully, skipping the remainder
+ of the pattern. However, when it is inside a subpattern that is called
+ as a subroutine, only that subpattern is ended successfully. Matching
then continues at the outer level. If (*ACCEPT) in triggered in a posi-
- tive assertion, the assertion succeeds; in a negative assertion, the
+ tive assertion, the assertion succeeds; in a negative assertion, the
assertion fails.
- If (*ACCEPT) is inside capturing parentheses, the data so far is cap-
+ If (*ACCEPT) is inside capturing parentheses, the data so far is cap-
tured. For example:
A((?:A|B(*ACCEPT)|C)D)
- This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is cap-
+ This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is cap-
tured by the outer parentheses.
(*FAIL) or (*F)
- This verb causes a matching failure, forcing backtracking to occur. It
- is equivalent to (?!) but easier to read. The Perl documentation notes
- that it is probably useful only when combined with (?{}) or (??{}).
- Those are, of course, Perl features that are not present in PCRE. The
- nearest equivalent is the callout feature, as for example in this pat-
+ This verb causes a matching failure, forcing backtracking to occur. It
+ is equivalent to (?!) but easier to read. The Perl documentation notes
+ that it is probably useful only when combined with (?{}) or (??{}).
+ Those are, of course, Perl features that are not present in PCRE. The
+ nearest equivalent is the callout feature, as for example in this pat-
tern:
a+(?C)(*FAIL)
- A match with the string "aaaa" always fails, but the callout is taken
+ A match with the string "aaaa" always fails, but the callout is taken
before each backtrack happens (in this example, 10 times).
Recording which path was taken
- There is one verb whose main purpose is to track how a match was
- arrived at, though it also has a secondary use in conjunction with
- advancing the match starting point (see (*SKIP) below).
+ There is one verb whose main purpose is to track how a match was ar-
+ rived at, though it also has a secondary use in conjunction with ad-
+ vancing the match starting point (see (*SKIP) below).
(*MARK:NAME) or (*:NAME)
- A name is always required with this verb. There may be as many
- instances of (*MARK) as you like in a pattern, and their names do not
+ A name is always required with this verb. There may be as many in-
+ stances of (*MARK) as you like in a pattern, and their names do not
have to be unique.
- When a match succeeds, the name of the last-encountered (*MARK:NAME),
- (*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to
- the caller as described in the section entitled "Extra data for
- pcre_exec()" in the pcreapi documentation. Here is an example of
- pcretest output, where the /K modifier requests the retrieval and out-
+ When a match succeeds, the name of the last-encountered (*MARK:NAME),
+ (*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to
+ the caller as described in the section entitled "Extra data for
+ pcre_exec()" in the pcreapi documentation. Here is an example of
+ pcretest output, where the /K modifier requests the retrieval and out-
putting of (*MARK) data:
re> /X(*MARK:A)Y|X(*MARK:B)Z/K
@@ -7383,73 +7377,73 @@ BACKTRACKING CONTROL
MK: B
The (*MARK) name is tagged with "MK:" in this output, and in this exam-
- ple it indicates which of the two alternatives matched. This is a more
- efficient way of obtaining this information than putting each alterna-
+ ple it indicates which of the two alternatives matched. This is a more
+ efficient way of obtaining this information than putting each alterna-
tive in its own capturing parentheses.
- If a verb with a name is encountered in a positive assertion that is
- true, the name is recorded and passed back if it is the last-encoun-
+ If a verb with a name is encountered in a positive assertion that is
+ true, the name is recorded and passed back if it is the last-encoun-
tered. This does not happen for negative assertions or failing positive
assertions.
- After a partial match or a failed match, the last encountered name in
+ After a partial match or a failed match, the last encountered name in
the entire match process is returned. For example:
re> /X(*MARK:A)Y|X(*MARK:B)Z/K
data> XP
No match, mark = B
- Note that in this unanchored example the mark is retained from the
+ Note that in this unanchored example the mark is retained from the
match attempt that started at the letter "X" in the subject. Subsequent
match attempts starting at "P" and then with an empty string do not get
as far as the (*MARK) item, but nevertheless do not reset it.
- If you are interested in (*MARK) values after failed matches, you
- should probably set the PCRE_NO_START_OPTIMIZE option (see above) to
+ If you are interested in (*MARK) values after failed matches, you
+ should probably set the PCRE_NO_START_OPTIMIZE option (see above) to
ensure that the match is always attempted.
Verbs that act after backtracking
The following verbs do nothing when they are encountered. Matching con-
- tinues with what follows, but if there is no subsequent match, causing
- a backtrack to the verb, a failure is forced. That is, backtracking
- cannot pass to the left of the verb. However, when one of these verbs
+ tinues with what follows, but if there is no subsequent match, causing
+ a backtrack to the verb, a failure is forced. That is, backtracking
+ cannot pass to the left of the verb. However, when one of these verbs
appears inside an atomic group or an assertion that is true, its effect
- is confined to that group, because once the group has been matched,
- there is never any backtracking into it. In this situation, backtrack-
- ing can "jump back" to the left of the entire atomic group or asser-
- tion. (Remember also, as stated above, that this localization also
- applies in subroutine calls.)
-
- These verbs differ in exactly what kind of failure occurs when back-
- tracking reaches them. The behaviour described below is what happens
- when the verb is not in a subroutine or an assertion. Subsequent sec-
+ is confined to that group, because once the group has been matched,
+ there is never any backtracking into it. In this situation, backtrack-
+ ing can "jump back" to the left of the entire atomic group or asser-
+ tion. (Remember also, as stated above, that this localization also ap-
+ plies in subroutine calls.)
+
+ These verbs differ in exactly what kind of failure occurs when back-
+ tracking reaches them. The behaviour described below is what happens
+ when the verb is not in a subroutine or an assertion. Subsequent sec-
tions cover these special cases.
(*COMMIT)
- This verb, which may not be followed by a name, causes the whole match
+ This verb, which may not be followed by a name, causes the whole match
to fail outright if there is a later matching failure that causes back-
- tracking to reach it. Even if the pattern is unanchored, no further
- attempts to find a match by advancing the starting point take place. If
- (*COMMIT) is the only backtracking verb that is encountered, once it
+ tracking to reach it. Even if the pattern is unanchored, no further at-
+ tempts to find a match by advancing the starting point take place. If
+ (*COMMIT) is the only backtracking verb that is encountered, once it
has been passed pcre_exec() is committed to finding a match at the cur-
rent starting point, or not at all. For example:
a+(*COMMIT)b
- This matches "xxaab" but not "aacaab". It can be thought of as a kind
+ This matches "xxaab" but not "aacaab". It can be thought of as a kind
of dynamic anchor, or "I've started, so I must finish." The name of the
- most recently passed (*MARK) in the path is passed back when (*COMMIT)
+ most recently passed (*MARK) in the path is passed back when (*COMMIT)
forces a match failure.
- If there is more than one backtracking verb in a pattern, a different
- one that follows (*COMMIT) may be triggered first, so merely passing
+ If there is more than one backtracking verb in a pattern, a different
+ one that follows (*COMMIT) may be triggered first, so merely passing
(*COMMIT) during a match does not always guarantee that a match must be
at this starting point.
- Note that (*COMMIT) at the start of a pattern is not the same as an
- anchor, unless PCRE's start-of-match optimizations are turned off, as
+ Note that (*COMMIT) at the start of a pattern is not the same as an an-
+ chor, unless PCRE's start-of-match optimizations are turned off, as
shown in this output from pcretest:
re> /(*COMMIT)abc/
@@ -7460,207 +7454,207 @@ BACKTRACKING CONTROL
For this pattern, PCRE knows that any match must start with "a", so the
optimization skips along the subject to "a" before applying the pattern
- to the first set of data. The match attempt then succeeds. In the sec-
- ond set of data, the escape sequence \Y is interpreted by the pcretest
- program. It causes the PCRE_NO_START_OPTIMIZE option to be set when
+ to the first set of data. The match attempt then succeeds. In the sec-
+ ond set of data, the escape sequence \Y is interpreted by the pcretest
+ program. It causes the PCRE_NO_START_OPTIMIZE option to be set when
pcre_exec() is called. This disables the optimization that skips along
to the first character. The pattern is now applied starting at "x", and
- so the (*COMMIT) causes the match to fail without trying any other
+ so the (*COMMIT) causes the match to fail without trying any other
starting points.
(*PRUNE) or (*PRUNE:NAME)
- This verb causes the match to fail at the current starting position in
+ This verb causes the match to fail at the current starting position in
the subject if there is a later matching failure that causes backtrack-
- ing to reach it. If the pattern is unanchored, the normal "bumpalong"
- advance to the next starting character then happens. Backtracking can
- occur as usual to the left of (*PRUNE), before it is reached, or when
- matching to the right of (*PRUNE), but if there is no match to the
- right, backtracking cannot cross (*PRUNE). In simple cases, the use of
- (*PRUNE) is just an alternative to an atomic group or possessive quan-
+ ing to reach it. If the pattern is unanchored, the normal "bumpalong"
+ advance to the next starting character then happens. Backtracking can
+ occur as usual to the left of (*PRUNE), before it is reached, or when
+ matching to the right of (*PRUNE), but if there is no match to the
+ right, backtracking cannot cross (*PRUNE). In simple cases, the use of
+ (*PRUNE) is just an alternative to an atomic group or possessive quan-
tifier, but there are some uses of (*PRUNE) that cannot be expressed in
- any other way. In an anchored pattern (*PRUNE) has the same effect as
+ any other way. In an anchored pattern (*PRUNE) has the same effect as
(*COMMIT).
The behaviour of (*PRUNE:NAME) is the not the same as
- (*MARK:NAME)(*PRUNE). It is like (*MARK:NAME) in that the name is
- remembered for passing back to the caller. However, (*SKIP:NAME)
- searches only for names set with (*MARK).
+ (*MARK:NAME)(*PRUNE). It is like (*MARK:NAME) in that the name is re-
+ membered for passing back to the caller. However, (*SKIP:NAME) searches
+ only for names set with (*MARK).
(*SKIP)
- This verb, when given without a name, is like (*PRUNE), except that if
- the pattern is unanchored, the "bumpalong" advance is not to the next
+ This verb, when given without a name, is like (*PRUNE), except that if
+ the pattern is unanchored, the "bumpalong" advance is not to the next
character, but to the position in the subject where (*SKIP) was encoun-
- tered. (*SKIP) signifies that whatever text was matched leading up to
+ tered. (*SKIP) signifies that whatever text was matched leading up to
it cannot be part of a successful match. Consider:
a+(*SKIP)b
- If the subject is "aaaac...", after the first match attempt fails
- (starting at the first character in the string), the starting point
+ If the subject is "aaaac...", after the first match attempt fails
+ (starting at the first character in the string), the starting point
skips on to start the next attempt at "c". Note that a possessive quan-
- tifer does not have the same effect as this example; although it would
- suppress backtracking during the first match attempt, the second
- attempt would start at the second character instead of skipping on to
+ tifer does not have the same effect as this example; although it would
+ suppress backtracking during the first match attempt, the second at-
+ tempt would start at the second character instead of skipping on to
"c".
(*SKIP:NAME)
When (*SKIP) has an associated name, its behaviour is modified. When it
is triggered, the previous path through the pattern is searched for the
- most recent (*MARK) that has the same name. If one is found, the
+ most recent (*MARK) that has the same name. If one is found, the
"bumpalong" advance is to the subject position that corresponds to that
(*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with
a matching name is found, the (*SKIP) is ignored.
- Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It
+ Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It
ignores names that are set by (*PRUNE:NAME) or (*THEN:NAME).
(*THEN) or (*THEN:NAME)
- This verb causes a skip to the next innermost alternative when back-
- tracking reaches it. That is, it cancels any further backtracking
- within the current alternative. Its name comes from the observation
+ This verb causes a skip to the next innermost alternative when back-
+ tracking reaches it. That is, it cancels any further backtracking
+ within the current alternative. Its name comes from the observation
that it can be used for a pattern-based if-then-else block:
( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
- If the COND1 pattern matches, FOO is tried (and possibly further items
- after the end of the group if FOO succeeds); on failure, the matcher
- skips to the second alternative and tries COND2, without backtracking
- into COND1. If that succeeds and BAR fails, COND3 is tried. If subse-
- quently BAZ fails, there are no more alternatives, so there is a back-
- track to whatever came before the entire group. If (*THEN) is not
- inside an alternation, it acts like (*PRUNE).
-
- The behaviour of (*THEN:NAME) is the not the same as
- (*MARK:NAME)(*THEN). It is like (*MARK:NAME) in that the name is
- remembered for passing back to the caller. However, (*SKIP:NAME)
- searches only for names set with (*MARK).
-
- A subpattern that does not contain a | character is just a part of the
- enclosing alternative; it is not a nested alternation with only one
- alternative. The effect of (*THEN) extends beyond such a subpattern to
- the enclosing alternative. Consider this pattern, where A, B, etc. are
- complex pattern fragments that do not contain any | characters at this
+ If the COND1 pattern matches, FOO is tried (and possibly further items
+ after the end of the group if FOO succeeds); on failure, the matcher
+ skips to the second alternative and tries COND2, without backtracking
+ into COND1. If that succeeds and BAR fails, COND3 is tried. If subse-
+ quently BAZ fails, there are no more alternatives, so there is a back-
+ track to whatever came before the entire group. If (*THEN) is not in-
+ side an alternation, it acts like (*PRUNE).
+
+ The behaviour of (*THEN:NAME) is the not the same as
+ (*MARK:NAME)(*THEN). It is like (*MARK:NAME) in that the name is re-
+ membered for passing back to the caller. However, (*SKIP:NAME) searches
+ only for names set with (*MARK).
+
+ A subpattern that does not contain a | character is just a part of the
+ enclosing alternative; it is not a nested alternation with only one al-
+ ternative. The effect of (*THEN) extends beyond such a subpattern to
+ the enclosing alternative. Consider this pattern, where A, B, etc. are
+ complex pattern fragments that do not contain any | characters at this
level:
A (B(*THEN)C) | D
- If A and B are matched, but there is a failure in C, matching does not
+ If A and B are matched, but there is a failure in C, matching does not
backtrack into A; instead it moves to the next alternative, that is, D.
- However, if the subpattern containing (*THEN) is given an alternative,
+ However, if the subpattern containing (*THEN) is given an alternative,
it behaves differently:
A (B(*THEN)C | (*FAIL)) | D
- The effect of (*THEN) is now confined to the inner subpattern. After a
+ The effect of (*THEN) is now confined to the inner subpattern. After a
failure in C, matching moves to (*FAIL), which causes the whole subpat-
- tern to fail because there are no more alternatives to try. In this
+ tern to fail because there are no more alternatives to try. In this
case, matching does now backtrack into A.
- Note that a conditional subpattern is not considered as having two
- alternatives, because only one is ever used. In other words, the |
- character in a conditional subpattern has a different meaning. Ignoring
+ Note that a conditional subpattern is not considered as having two al-
+ ternatives, because only one is ever used. In other words, the | char-
+ acter in a conditional subpattern has a different meaning. Ignoring
white space, consider:
^.*? (?(?=a) a | b(*THEN)c )
- If the subject is "ba", this pattern does not match. Because .*? is
- ungreedy, it initially matches zero characters. The condition (?=a)
- then fails, the character "b" is matched, but "c" is not. At this
- point, matching does not backtrack to .*? as might perhaps be expected
- from the presence of the | character. The conditional subpattern is
- part of the single alternative that comprises the whole pattern, and so
- the match fails. (If there was a backtrack into .*?, allowing it to
- match "b", the match would succeed.)
+ If the subject is "ba", this pattern does not match. Because .*? is un-
+ greedy, it initially matches zero characters. The condition (?=a) then
+ fails, the character "b" is matched, but "c" is not. At this point,
+ matching does not backtrack to .*? as might perhaps be expected from
+ the presence of the | character. The conditional subpattern is part of
+ the single alternative that comprises the whole pattern, and so the
+ match fails. (If there was a backtrack into .*?, allowing it to match
+ "b", the match would succeed.)
- The verbs just described provide four different "strengths" of control
+ The verbs just described provide four different "strengths" of control
when subsequent matching fails. (*THEN) is the weakest, carrying on the
- match at the next alternative. (*PRUNE) comes next, failing the match
- at the current starting position, but allowing an advance to the next
- character (for an unanchored pattern). (*SKIP) is similar, except that
+ match at the next alternative. (*PRUNE) comes next, failing the match
+ at the current starting position, but allowing an advance to the next
+ character (for an unanchored pattern). (*SKIP) is similar, except that
the advance may be more than one character. (*COMMIT) is the strongest,
causing the entire match to fail.
More than one backtracking verb
- If more than one backtracking verb is present in a pattern, the one
- that is backtracked onto first acts. For example, consider this pat-
+ If more than one backtracking verb is present in a pattern, the one
+ that is backtracked onto first acts. For example, consider this pat-
tern, where A, B, etc. are complex pattern fragments:
(A(*COMMIT)B(*THEN)C|ABD)
- If A matches but B fails, the backtrack to (*COMMIT) causes the entire
+ If A matches but B fails, the backtrack to (*COMMIT) causes the entire
match to fail. However, if A and B match, but C fails, the backtrack to
- (*THEN) causes the next alternative (ABD) to be tried. This behaviour
- is consistent, but is not always the same as Perl's. It means that if
- two or more backtracking verbs appear in succession, all the the last
+ (*THEN) causes the next alternative (ABD) to be tried. This behaviour
+ is consistent, but is not always the same as Perl's. It means that if
+ two or more backtracking verbs appear in succession, all the the last
of them has no effect. Consider this example:
...(*COMMIT)(*PRUNE)...
If there is a matching failure to the right, backtracking onto (*PRUNE)
- causes it to be triggered, and its action is taken. There can never be
+ causes it to be triggered, and its action is taken. There can never be
a backtrack onto (*COMMIT).
Backtracking verbs in repeated groups
- PCRE differs from Perl in its handling of backtracking verbs in
- repeated groups. For example, consider:
+ PCRE differs from Perl in its handling of backtracking verbs in re-
+ peated groups. For example, consider:
/(a(*COMMIT)b)+ac/
- If the subject is "abac", Perl matches, but PCRE fails because the
+ If the subject is "abac", Perl matches, but PCRE fails because the
(*COMMIT) in the second repeat of the group acts.
Backtracking verbs in assertions
- (*FAIL) in an assertion has its normal effect: it forces an immediate
+ (*FAIL) in an assertion has its normal effect: it forces an immediate
backtrack.
(*ACCEPT) in a positive assertion causes the assertion to succeed with-
- out any further processing. In a negative assertion, (*ACCEPT) causes
+ out any further processing. In a negative assertion, (*ACCEPT) causes
the assertion to fail without any further processing.
- The other backtracking verbs are not treated specially if they appear
- in a positive assertion. In particular, (*THEN) skips to the next
- alternative in the innermost enclosing group that has alternations,
+ The other backtracking verbs are not treated specially if they appear
+ in a positive assertion. In particular, (*THEN) skips to the next al-
+ ternative in the innermost enclosing group that has alternations,
whether or not this is within the assertion.
- Negative assertions are, however, different, in order to ensure that
- changing a positive assertion into a negative assertion changes its
- result. Backtracking into (*COMMIT), (*SKIP), or (*PRUNE) causes a neg-
- ative assertion to be true, without considering any further alternative
+ Negative assertions are, however, different, in order to ensure that
+ changing a positive assertion into a negative assertion changes its re-
+ sult. Backtracking into (*COMMIT), (*SKIP), or (*PRUNE) causes a nega-
+ tive assertion to be true, without considering any further alternative
branches in the assertion. Backtracking into (*THEN) causes it to skip
- to the next enclosing alternative within the assertion (the normal be-
- haviour), but if the assertion does not have such an alternative,
+ to the next enclosing alternative within the assertion (the normal be-
+ haviour), but if the assertion does not have such an alternative,
(*THEN) behaves like (*PRUNE).
Backtracking verbs in subroutines
- These behaviours occur whether or not the subpattern is called recur-
+ These behaviours occur whether or not the subpattern is called recur-
sively. Perl's treatment of subroutines is different in some cases.
- (*FAIL) in a subpattern called as a subroutine has its normal effect:
+ (*FAIL) in a subpattern called as a subroutine has its normal effect:
it forces an immediate backtrack.
- (*ACCEPT) in a subpattern called as a subroutine causes the subroutine
- match to succeed without any further processing. Matching then contin-
+ (*ACCEPT) in a subpattern called as a subroutine causes the subroutine
+ match to succeed without any further processing. Matching then contin-
ues after the subroutine call.
(*COMMIT), (*SKIP), and (*PRUNE) in a subpattern called as a subroutine
cause the subroutine match to fail.
- (*THEN) skips to the next alternative in the innermost enclosing group
- within the subpattern that has alternatives. If there is no such group
+ (*THEN) skips to the next alternative in the innermost enclosing group
+ within the subpattern that has alternatives. If there is no such group
within the subpattern, (*THEN) causes the subroutine match to fail.
SEE ALSO
- pcreapi(3), pcrecallout(3), pcrematching(3), pcresyntax(3), pcre(3),
+ pcreapi(3), pcrecallout(3), pcrematching(3), pcresyntax(3), pcre(3),
pcre16(3), pcre32(3).
@@ -7814,16 +7808,16 @@ SCRIPT NAMES FOR \p AND \P
ian, Caucasian_Albanian, Chakma, Cham, Cherokee, Common, Coptic, Cunei-
form, Cypriot, Cyrillic, Deseret, Devanagari, Duployan, Egyptian_Hiero-
glyphs, Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, Grantha,
- Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana,
- Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
+ Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, Im-
+ perial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin-
ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic,
- Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive,
- Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean,
- New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian,
- Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya,
- Pahawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician,
+ Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive, Meroitic_Hi-
+ eroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean, New_Tai_Lue,
+ Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian, Old_Permic,
+ Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya, Pa-
+ hawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician,
Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha-
vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac,
Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu,
@@ -7938,9 +7932,9 @@ OPTION SETTING
(?x) extended (ignore white space)
(?-...) unset option(s)
- The following are recognized only at the very start of a pattern or
- after one of the newline or \R options with similar syntax. More than
- one of them may appear.
+ The following are recognized only at the very start of a pattern or af-
+ ter one of the newline or \R options with similar syntax. More than one
+ of them may appear.
(*LIMIT_MATCH=d) set the match limit to d (decimal number)
(*LIMIT_RECURSION=d) set the recursion limit to d (decimal number)
@@ -7958,8 +7952,8 @@ OPTION SETTING
NEWLINE CONVENTION
- These are recognized only at the very start of the pattern or after
- option settings with a similar syntax.
+ These are recognized only at the very start of the pattern or after op-
+ tion settings with a similar syntax.
(*CR) carriage return only
(*LF) linefeed only
@@ -7970,8 +7964,8 @@ NEWLINE CONVENTION
WHAT \R MATCHES
- These are recognized only at the very start of the pattern or after
- option setting with a similar syntax.
+ These are recognized only at the very start of the pattern or after op-
+ tion setting with a similar syntax.
(*BSR_ANYCRLF) CR, LF, or CRLF
(*BSR_UNICODE) any Unicode newline sequence
@@ -8161,8 +8155,8 @@ UNICODE PROPERTY SUPPORT
UTF-16, where they are used in pairs to encode codepoints with values
greater than 0xFFFF. The code points that are encoded by UTF-16 pairs
are available independently in the UTF-8 and UTF-32 encodings. (In
- other words, the whole surrogate thing is a fudge for UTF-16 which
- unfortunately messes up UTF-8 and UTF-32.)
+ other words, the whole surrogate thing is a fudge for UTF-16 which un-
+ fortunately messes up UTF-8 and UTF-32.)
If an invalid UTF-8 string is passed to PCRE, an error return is given.
At compile time, the only additional information is the offset to the
@@ -8263,8 +8257,8 @@ UNICODE PROPERTY SUPPORT
test characters of any code value, but, by default, the characters that
PCRE recognizes as digits, spaces, or word characters remain the same
set as in non-UTF mode, all with values less than 256. This remains
- true even when PCRE is built to include Unicode property support,
- because to do otherwise would slow down PCRE in many common cases. Note
+ true even when PCRE is built to include Unicode property support, be-
+ cause to do otherwise would slow down PCRE in many common cases. Note
in particular that this applies to \b and \B, because they are defined
in terms of \w and \W. If you really want to test for a wider sense of,
say, "digit", you can use explicit Unicode property tests such as
@@ -8354,27 +8348,26 @@ AVAILABILITY OF JIT SUPPORT
If --enable-jit is set on an unsupported platform, compilation fails.
A program that is linked with PCRE 8.20 or later can tell if JIT sup-
- port is available by calling pcre_config() with the PCRE_CONFIG_JIT
- option. The result is 1 when JIT is available, and 0 otherwise. How-
- ever, a simple program does not need to check this in order to use JIT.
- The normal API is implemented in a way that falls back to the interpre-
- tive code if JIT is not available. For programs that need the best pos-
- sible performance, there is also a "fast path" API that is JIT-spe-
- cific.
-
- If your program may sometimes be linked with versions of PCRE that are
- older than 8.20, but you want to use JIT when it is available, you can
+ port is available by calling pcre_config() with the PCRE_CONFIG_JIT op-
+ tion. The result is 1 when JIT is available, and 0 otherwise. However,
+ a simple program does not need to check this in order to use JIT. The
+ normal API is implemented in a way that falls back to the interpretive
+ code if JIT is not available. For programs that need the best possible
+ performance, there is also a "fast path" API that is JIT-specific.
+
+ If your program may sometimes be linked with versions of PCRE that are
+ older than 8.20, but you want to use JIT when it is available, you can
test the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT
- macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
- Also beware that the pcre_jit_exec() function was not available at all
- before 8.32, and may not be available at all if PCRE isn't compiled
- with --enable-jit. See the "JIT FAST PATH API" section below for
- details.
+ macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
+ Also beware that the pcre_jit_exec() function was not available at all
+ before 8.32, and may not be available at all if PCRE isn't compiled
+ with --enable-jit. See the "JIT FAST PATH API" section below for de-
+ tails.
SIMPLE USE OF JIT
- You have to do two things to make use of the JIT support in the sim-
+ You have to do two things to make use of the JIT support in the sim-
plest way:
(1) Call pcre_study() with the PCRE_STUDY_JIT_COMPILE option for
@@ -8382,18 +8375,18 @@ SIMPLE USE OF JIT
pcre_exec().
(2) Use pcre_free_study() to free the pcre_extra block when it is
- no longer needed, instead of just freeing it yourself. This
- ensures that
+ no longer needed, instead of just freeing it yourself. This en-
+ sures that
any JIT data is also freed.
- For a program that may be linked with pre-8.20 versions of PCRE, you
+ For a program that may be linked with pre-8.20 versions of PCRE, you
can insert
#ifndef PCRE_STUDY_JIT_COMPILE
#define PCRE_STUDY_JIT_COMPILE 0
#endif
- so that no option is passed to pcre_study(), and then use something
+ so that no option is passed to pcre_study(), and then use something
like this to free the study data:
#ifdef PCRE_CONFIG_JIT
@@ -8402,11 +8395,11 @@ SIMPLE USE OF JIT
pcre_free(study_ptr);
#endif
- PCRE_STUDY_JIT_COMPILE requests the JIT compiler to generate code for
- complete matches. If you want to run partial matches using the
- PCRE_PARTIAL_HARD or PCRE_PARTIAL_SOFT options of pcre_exec(), you
- should set one or both of the following options in addition to, or
- instead of, PCRE_STUDY_JIT_COMPILE when you call pcre_study():
+ PCRE_STUDY_JIT_COMPILE requests the JIT compiler to generate code for
+ complete matches. If you want to run partial matches using the
+ PCRE_PARTIAL_HARD or PCRE_PARTIAL_SOFT options of pcre_exec(), you
+ should set one or both of the following options in addition to, or in-
+ stead of, PCRE_STUDY_JIT_COMPILE when you call pcre_study():
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
@@ -8420,44 +8413,44 @@ SIMPLE USE OF JIT
pcre_exec(...)
#endif
- but as described in the "JIT FAST PATH API" section below this assumes
+ but as described in the "JIT FAST PATH API" section below this assumes
version 8.32 and later are compiled with --enable-jit, which may break.
- The JIT compiler generates different optimized code for each of the
- three modes (normal, soft partial, hard partial). When pcre_exec() is
- called, the appropriate code is run if it is available. Otherwise, the
+ The JIT compiler generates different optimized code for each of the
+ three modes (normal, soft partial, hard partial). When pcre_exec() is
+ called, the appropriate code is run if it is available. Otherwise, the
pattern is matched using interpretive code.
- In some circumstances you may need to call additional functions. These
- are described in the section entitled "Controlling the JIT stack"
- below.
-
- If JIT support is not available, PCRE_STUDY_JIT_COMPILE etc. are
- ignored, and no JIT data is created. Otherwise, the compiled pattern is
- passed to the JIT compiler, which turns it into machine code that exe-
- cutes much faster than the normal interpretive code. When pcre_exec()
- is passed a pcre_extra block containing a pointer to JIT code of the
- appropriate mode (normal or hard/soft partial), it obeys that code
- instead of running the interpreter. The result is identical, but the
- compiled JIT code runs much faster.
-
- There are some pcre_exec() options that are not supported for JIT exe-
- cution. There are also some pattern items that JIT cannot handle.
- Details are given below. In both cases, execution automatically falls
- back to the interpretive code. If you want to know whether JIT was
- actually used for a particular match, you should arrange for a JIT
- callback function to be set up as described in the section entitled
- "Controlling the JIT stack" below, even if you do not need to supply a
- non-default JIT stack. Such a callback function is called whenever JIT
- code is about to be obeyed. If the execution options are not right for
- JIT execution, the callback function is not obeyed.
-
- If the JIT compiler finds an unsupported item, no JIT data is gener-
- ated. You can find out if JIT execution is available after studying a
- pattern by calling pcre_fullinfo() with the PCRE_INFO_JIT option. A
- result of 1 means that JIT compilation was successful. A result of 0
+ In some circumstances you may need to call additional functions. These
+ are described in the section entitled "Controlling the JIT stack" be-
+ low.
+
+ If JIT support is not available, PCRE_STUDY_JIT_COMPILE etc. are ig-
+ nored, and no JIT data is created. Otherwise, the compiled pattern is
+ passed to the JIT compiler, which turns it into machine code that exe-
+ cutes much faster than the normal interpretive code. When pcre_exec()
+ is passed a pcre_extra block containing a pointer to JIT code of the
+ appropriate mode (normal or hard/soft partial), it obeys that code in-
+ stead of running the interpreter. The result is identical, but the com-
+ piled JIT code runs much faster.
+
+ There are some pcre_exec() options that are not supported for JIT exe-
+ cution. There are also some pattern items that JIT cannot handle. De-
+ tails are given below. In both cases, execution automatically falls
+ back to the interpretive code. If you want to know whether JIT was ac-
+ tually used for a particular match, you should arrange for a JIT call-
+ back function to be set up as described in the section entitled "Con-
+ trolling the JIT stack" below, even if you do not need to supply a non-
+ default JIT stack. Such a callback function is called whenever JIT code
+ is about to be obeyed. If the execution options are not right for JIT
+ execution, the callback function is not obeyed.
+
+ If the JIT compiler finds an unsupported item, no JIT data is gener-
+ ated. You can find out if JIT execution is available after studying a
+ pattern by calling pcre_fullinfo() with the PCRE_INFO_JIT option. A re-
+ sult of 1 means that JIT compilation was successful. A result of 0
means that JIT support is not available, or the pattern was not studied
- with PCRE_STUDY_JIT_COMPILE etc., or the JIT compiler was not able to
+ with PCRE_STUDY_JIT_COMPILE etc., or the JIT compiler was not able to
handle the pattern.
Once a pattern has been studied, with or without JIT, it can be used as
@@ -8466,77 +8459,77 @@ SIMPLE USE OF JIT
UNSUPPORTED OPTIONS AND PATTERN ITEMS
- The only pcre_exec() options that are supported for JIT execution are
+ The only pcre_exec() options that are supported for JIT execution are
PCRE_NO_UTF8_CHECK, PCRE_NO_UTF16_CHECK, PCRE_NO_UTF32_CHECK, PCRE_NOT-
- BOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART, PCRE_PAR-
+ BOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART, PCRE_PAR-
TIAL_HARD, and PCRE_PARTIAL_SOFT.
- The only unsupported pattern items are \C (match a single data unit)
- when running in a UTF mode, and a callout immediately before an asser-
+ The only unsupported pattern items are \C (match a single data unit)
+ when running in a UTF mode, and a callout immediately before an asser-
tion condition in a conditional group.
RETURN VALUES FROM JIT EXECUTION
- When a pattern is matched using JIT execution, the return values are
- the same as those given by the interpretive pcre_exec() code, with the
- addition of one new error code: PCRE_ERROR_JIT_STACKLIMIT. This means
- that the memory used for the JIT stack was insufficient. See "Control-
+ When a pattern is matched using JIT execution, the return values are
+ the same as those given by the interpretive pcre_exec() code, with the
+ addition of one new error code: PCRE_ERROR_JIT_STACKLIMIT. This means
+ that the memory used for the JIT stack was insufficient. See "Control-
ling the JIT stack" below for a discussion of JIT stack usage. For com-
- patibility with the interpretive pcre_exec() code, no more than two-
- thirds of the ovector argument is used for passing back captured sub-
+ patibility with the interpretive pcre_exec() code, no more than two-
+ thirds of the ovector argument is used for passing back captured sub-
strings.
- The error code PCRE_ERROR_MATCHLIMIT is returned by the JIT code if
- searching a very large pattern tree goes on for too long, as it is in
- the same circumstance when JIT is not used, but the details of exactly
- what is counted are not the same. The PCRE_ERROR_RECURSIONLIMIT error
+ The error code PCRE_ERROR_MATCHLIMIT is returned by the JIT code if
+ searching a very large pattern tree goes on for too long, as it is in
+ the same circumstance when JIT is not used, but the details of exactly
+ what is counted are not the same. The PCRE_ERROR_RECURSIONLIMIT error
code is never returned by JIT execution.
SAVING AND RESTORING COMPILED PATTERNS
- The code that is generated by the JIT compiler is architecture-spe-
- cific, and is also position dependent. For those reasons it cannot be
- saved (in a file or database) and restored later like the bytecode and
- other data of a compiled pattern. Saving and restoring compiled pat-
- terns is not something many people do. More detail about this facility
- is given in the pcreprecompile documentation. It should be possible to
- run pcre_study() on a saved and restored pattern, and thereby recreate
- the JIT data, but because JIT compilation uses significant resources,
- it is probably not worth doing this; you might as well recompile the
+ The code that is generated by the JIT compiler is architecture-spe-
+ cific, and is also position dependent. For those reasons it cannot be
+ saved (in a file or database) and restored later like the bytecode and
+ other data of a compiled pattern. Saving and restoring compiled pat-
+ terns is not something many people do. More detail about this facility
+ is given in the pcreprecompile documentation. It should be possible to
+ run pcre_study() on a saved and restored pattern, and thereby recreate
+ the JIT data, but because JIT compilation uses significant resources,
+ it is probably not worth doing this; you might as well recompile the
original pattern.
CONTROLLING THE JIT STACK
When the compiled JIT code runs, it needs a block of memory to use as a
- stack. By default, it uses 32K on the machine stack. However, some
- large or complicated patterns need more than this. The error
- PCRE_ERROR_JIT_STACKLIMIT is given when there is not enough stack.
- Three functions are provided for managing blocks of memory for use as
- JIT stacks. There is further discussion about the use of JIT stacks in
- the section entitled "JIT stack FAQ" below.
-
- The pcre_jit_stack_alloc() function creates a JIT stack. Its arguments
- are a starting size and a maximum size, and it returns a pointer to an
- opaque structure of type pcre_jit_stack, or NULL if there is an error.
- The pcre_jit_stack_free() function can be used to free a stack that is
- no longer needed. (For the technically minded: the address space is
- allocated by mmap or VirtualAlloc.)
-
- JIT uses far less memory for recursion than the interpretive code, and
- a maximum stack size of 512K to 1M should be more than enough for any
+ stack. By default, it uses 32K on the machine stack. However, some
+ large or complicated patterns need more than this. The error PCRE_ER-
+ ROR_JIT_STACKLIMIT is given when there is not enough stack. Three func-
+ tions are provided for managing blocks of memory for use as JIT stacks.
+ There is further discussion about the use of JIT stacks in the section
+ entitled "JIT stack FAQ" below.
+
+ The pcre_jit_stack_alloc() function creates a JIT stack. Its arguments
+ are a starting size and a maximum size, and it returns a pointer to an
+ opaque structure of type pcre_jit_stack, or NULL if there is an error.
+ The pcre_jit_stack_free() function can be used to free a stack that is
+ no longer needed. (For the technically minded: the address space is al-
+ located by mmap or VirtualAlloc.)
+
+ JIT uses far less memory for recursion than the interpretive code, and
+ a maximum stack size of 512K to 1M should be more than enough for any
pattern.
- The pcre_assign_jit_stack() function specifies which stack JIT code
+ The pcre_assign_jit_stack() function specifies which stack JIT code
should use. Its arguments are as follows:
pcre_extra *extra
pcre_jit_callback callback
void *data
- The extra argument must be the result of studying a pattern with
+ The extra argument must be the result of studying a pattern with
PCRE_STUDY_JIT_COMPILE etc. There are three cases for the values of the
other two options:
@@ -8553,29 +8546,29 @@ CONTROLLING THE JIT STACK
return value must be a valid JIT stack, the result of calling
pcre_jit_stack_alloc().
- A callback function is obeyed whenever JIT code is about to be run; it
- is not obeyed when pcre_exec() is called with options that are incom-
+ A callback function is obeyed whenever JIT code is about to be run; it
+ is not obeyed when pcre_exec() is called with options that are incom-
patible for JIT execution. A callback function can therefore be used to
- determine whether a match operation was executed by JIT or by the
- interpreter.
+ determine whether a match operation was executed by JIT or by the in-
+ terpreter.
You may safely use the same JIT stack for more than one pattern (either
- by assigning directly or by callback), as long as the patterns are all
- matched sequentially in the same thread. In a multithread application,
- if you do not specify a JIT stack, or if you assign or pass back NULL
- from a callback, that is thread-safe, because each thread has its own
- machine stack. However, if you assign or pass back a non-NULL JIT
- stack, this must be a different stack for each thread so that the
- application is thread-safe.
-
- Strictly speaking, even more is allowed. You can assign the same non-
- NULL stack to any number of patterns as long as they are not used for
- matching by multiple threads at the same time. For example, you can
- assign the same stack to all compiled patterns, and use a global mutex
- in the callback to wait until the stack is available for use. However,
+ by assigning directly or by callback), as long as the patterns are all
+ matched sequentially in the same thread. In a multithread application,
+ if you do not specify a JIT stack, or if you assign or pass back NULL
+ from a callback, that is thread-safe, because each thread has its own
+ machine stack. However, if you assign or pass back a non-NULL JIT
+ stack, this must be a different stack for each thread so that the ap-
+ plication is thread-safe.
+
+ Strictly speaking, even more is allowed. You can assign the same non-
+ NULL stack to any number of patterns as long as they are not used for
+ matching by multiple threads at the same time. For example, you can as-
+ sign the same stack to all compiled patterns, and use a global mutex in
+ the callback to wait until the stack is available for use. However,
this is an inefficient solution, and not recommended.
- This is a suggestion for how a multithreaded program that needs to set
+ This is a suggestion for how a multithreaded program that needs to set
up non-default JIT stacks might operate:
During thread initalization
@@ -8587,83 +8580,83 @@ CONTROLLING THE JIT STACK
Use a one-line callback function
return thread_local_var
- All the functions described in this section do nothing if JIT is not
- available, and pcre_assign_jit_stack() does nothing unless the extra
- argument is non-NULL and points to a pcre_extra block that is the
- result of a successful study with PCRE_STUDY_JIT_COMPILE etc.
+ All the functions described in this section do nothing if JIT is not
+ available, and pcre_assign_jit_stack() does nothing unless the extra
+ argument is non-NULL and points to a pcre_extra block that is the re-
+ sult of a successful study with PCRE_STUDY_JIT_COMPILE etc.
JIT STACK FAQ
(1) Why do we need JIT stacks?
- PCRE (and JIT) is a recursive, depth-first engine, so it needs a stack
- where the local data of the current node is pushed before checking its
+ PCRE (and JIT) is a recursive, depth-first engine, so it needs a stack
+ where the local data of the current node is pushed before checking its
child nodes. Allocating real machine stack on some platforms is diffi-
cult. For example, the stack chain needs to be updated every time if we
- extend the stack on PowerPC. Although it is possible, its updating
+ extend the stack on PowerPC. Although it is possible, its updating
time overhead decreases performance. So we do the recursion in memory.
(2) Why don't we simply allocate blocks of memory with malloc()?
- Modern operating systems have a nice feature: they can reserve an
- address space instead of allocating memory. We can safely allocate mem-
- ory pages inside this address space, so the stack could grow without
- moving memory data (this is important because of pointers). Thus we can
- allocate 1M address space, and use only a single memory page (usually
- 4K) if that is enough. However, we can still grow up to 1M anytime if
+ Modern operating systems have a nice feature: they can reserve an ad-
+ dress space instead of allocating memory. We can safely allocate memory
+ pages inside this address space, so the stack could grow without moving
+ memory data (this is important because of pointers). Thus we can allo-
+ cate 1M address space, and use only a single memory page (usually 4K)
+ if that is enough. However, we can still grow up to 1M anytime if
needed.
(3) Who "owns" a JIT stack?
The owner of the stack is the user program, not the JIT studied pattern
- or anything else. The user program must ensure that if a stack is used
- by pcre_exec(), (that is, it is assigned to the pattern currently run-
+ or anything else. The user program must ensure that if a stack is used
+ by pcre_exec(), (that is, it is assigned to the pattern currently run-
ning), that stack must not be used by any other threads (to avoid over-
writing the same memory area). The best practice for multithreaded pro-
- grams is to allocate a stack for each thread, and return this stack
+ grams is to allocate a stack for each thread, and return this stack
through the JIT callback function.
(4) When should a JIT stack be freed?
You can free a JIT stack at any time, as long as it will not be used by
- pcre_exec() again. When you assign the stack to a pattern, only a
- pointer is set. There is no reference counting or any other magic. You
- can free the patterns and stacks in any order, anytime. Just do not
- call pcre_exec() with a pattern pointing to an already freed stack, as
- that will cause SEGFAULT. (Also, do not free a stack currently used by
- pcre_exec() in another thread). You can also replace the stack for a
- pattern at any time. You can even free the previous stack before
- assigning a replacement.
-
- (5) Should I allocate/free a stack every time before/after calling
+ pcre_exec() again. When you assign the stack to a pattern, only a
+ pointer is set. There is no reference counting or any other magic. You
+ can free the patterns and stacks in any order, anytime. Just do not
+ call pcre_exec() with a pattern pointing to an already freed stack, as
+ that will cause SEGFAULT. (Also, do not free a stack currently used by
+ pcre_exec() in another thread). You can also replace the stack for a
+ pattern at any time. You can even free the previous stack before as-
+ signing a replacement.
+
+ (5) Should I allocate/free a stack every time before/after calling
pcre_exec()?
- No, because this is too costly in terms of resources. However, you
- could implement some clever idea which release the stack if it is not
- used in let's say two minutes. The JIT callback can help to achieve
+ No, because this is too costly in terms of resources. However, you
+ could implement some clever idea which release the stack if it is not
+ used in let's say two minutes. The JIT callback can help to achieve
this without keeping a list of the currently JIT studied patterns.
- (6) OK, the stack is for long term memory allocation. But what happens
- if a pattern causes stack overflow with a stack of 1M? Is that 1M kept
+ (6) OK, the stack is for long term memory allocation. But what happens
+ if a pattern causes stack overflow with a stack of 1M? Is that 1M kept
until the stack is freed?
- Especially on embedded sytems, it might be a good idea to release mem-
- ory sometimes without freeing the stack. There is no API for this at
- the moment. Probably a function call which returns with the currently
- allocated memory for any stack and another which allows releasing mem-
+ Especially on embedded sytems, it might be a good idea to release mem-
+ ory sometimes without freeing the stack. There is no API for this at
+ the moment. Probably a function call which returns with the currently
+ allocated memory for any stack and another which allows releasing mem-
ory (shrinking the stack) would be a good idea if someone needs this.
(7) This is too much of a headache. Isn't there any better solution for
JIT stack handling?
- No, thanks to Windows. If POSIX threads were used everywhere, we could
+ No, thanks to Windows. If POSIX threads were used everywhere, we could
throw out this complicated API.
EXAMPLE CODE
- This is a single-threaded example that specifies a JIT stack without
+ This is a single-threaded example that specifies a JIT stack without
using a callback.
int rc;
@@ -8687,56 +8680,56 @@ EXAMPLE CODE
JIT FAST PATH API
- Because the API described above falls back to interpreted execution
+ Because the API described above falls back to interpreted execution
when JIT is not available, it is convenient for programs that are writ-
- ten for general use in many environments. However, calling JIT via
- pcre_exec() does have a performance impact. Programs that are written
- for use where JIT is known to be available, and which need the best
- possible performance, can instead use a "fast path" API to call JIT
- execution directly instead of calling pcre_exec() (obviously only for
+ ten for general use in many environments. However, calling JIT via
+ pcre_exec() does have a performance impact. Programs that are written
+ for use where JIT is known to be available, and which need the best
+ possible performance, can instead use a "fast path" API to call JIT ex-
+ ecution directly instead of calling pcre_exec() (obviously only for
patterns that have been successfully studied by JIT).
- The fast path function is called pcre_jit_exec(), and it takes exactly
- the same arguments as pcre_exec(), plus one additional argument that
- must point to a JIT stack. The JIT stack arrangements described above
+ The fast path function is called pcre_jit_exec(), and it takes exactly
+ the same arguments as pcre_exec(), plus one additional argument that
+ must point to a JIT stack. The JIT stack arrangements described above
do not apply. The return values are the same as for pcre_exec().
- When you call pcre_exec(), as well as testing for invalid options, a
+ When you call pcre_exec(), as well as testing for invalid options, a
number of other sanity checks are performed on the arguments. For exam-
- ple, if the subject pointer is NULL, or its length is negative, an
- immediate error is given. Also, unless PCRE_NO_UTF[8|16|32] is set, a
- UTF subject string is tested for validity. In the interests of speed,
- these checks do not happen on the JIT fast path, and if invalid data is
+ ple, if the subject pointer is NULL, or its length is negative, an im-
+ mediate error is given. Also, unless PCRE_NO_UTF[8|16|32] is set, a UTF
+ subject string is tested for validity. In the interests of speed, these
+ checks do not happen on the JIT fast path, and if invalid data is
passed, the result is undefined.
- Bypassing the sanity checks and the pcre_exec() wrapping can give
+ Bypassing the sanity checks and the pcre_exec() wrapping can give
speedups of more than 10%.
- Note that the pcre_jit_exec() function is not available in versions of
- PCRE before 8.32 (released in November 2012). If you need to support
+ Note that the pcre_jit_exec() function is not available in versions of
+ PCRE before 8.32 (released in November 2012). If you need to support
versions that old you must either use the slower pcre_exec(), or switch
- between the two codepaths by checking the values of PCRE_MAJOR and
+ between the two codepaths by checking the values of PCRE_MAJOR and
PCRE_MINOR.
- Due to an unfortunate implementation oversight, even in versions 8.32
- and later there will be no pcre_jit_exec() stub function defined when
- PCRE is compiled with --disable-jit, which is the default, and there's
- no way to detect whether PCRE was compiled with --enable-jit via a
+ Due to an unfortunate implementation oversight, even in versions 8.32
+ and later there will be no pcre_jit_exec() stub function defined when
+ PCRE is compiled with --disable-jit, which is the default, and there's
+ no way to detect whether PCRE was compiled with --enable-jit via a
macro.
- If you need to support versions older than 8.32, or versions that may
- not build with --enable-jit, you must either use the slower
+ If you need to support versions older than 8.32, or versions that may
+ not build with --enable-jit, you must either use the slower
pcre_exec(), or switch between the two codepaths by checking the values
of PCRE_MAJOR and PCRE_MINOR.
- Switching between the two by checking the version assumes that all the
- versions being targeted are built with --enable-jit. To also support
+ Switching between the two by checking the version assumes that all the
+ versions being targeted are built with --enable-jit. To also support
builds that may use --disable-jit either pcre_exec() must be used, or a
compile-time check for JIT via pcre_config() (which assumes the runtime
- environment will be the same), or as the Git project decided to do,
+ environment will be the same), or as the Git project decided to do,
simply assume that pcre_jit_exec() is present in 8.32 or later unless a
- compile-time flag is provided, see the "grep: un-break building with
- PCRE >= 8.32 without --enable-jit" commit in git.git for an example of
+ compile-time flag is provided, see the "grep: un-break building with
+ PCRE >= 8.32 without --enable-jit" commit in git.git for an example of
that.
@@ -8782,11 +8775,11 @@ PARTIAL MATCHING IN PCRE
If the application sees the user's keystrokes one by one, and can check
that what has been typed so far is potentially valid, it is able to
- raise an error as soon as a mistake is made, by beeping and not
- reflecting the character that has been typed, for example. This immedi-
- ate feedback is likely to be a better user interface than a check that
- is delayed until the entire string has been entered. Partial matching
- can also be useful when the subject string is very long and is not all
+ raise an error as soon as a mistake is made, by beeping and not re-
+ flecting the character that has been typed, for example. This immediate
+ feedback is likely to be a better user interface than a check that is
+ delayed until the entire string has been entered. Partial matching can
+ also be useful when the subject string is very long and is not all
available at once.
PCRE supports partial matching by means of the PCRE_PARTIAL_SOFT and
@@ -8862,8 +8855,8 @@ PARTIAL MATCHING USING pcre_exec() OR pcre[16|32]_exec()
If PCRE_PARTIAL_SOFT is set when pcre_exec() or pcre[16|32]_exec()
identifies a partial match, the partial match is remembered, but match-
ing continues as normal, and other alternatives in the pattern are
- tried. If no complete match can be found, PCRE_ERROR_PARTIAL is
- returned instead of PCRE_ERROR_NOMATCH.
+ tried. If no complete match can be found, PCRE_ERROR_PARTIAL is re-
+ turned instead of PCRE_ERROR_NOMATCH.
This option is "soft" because it prefers a complete match over a par-
tial match. All the various matching items in a pattern behave as if
@@ -8949,8 +8942,8 @@ PARTIAL MATCHING USING pcre_dfa_exec() OR pcre[16|32]_dfa_exec()
Because the DFA functions always search for all possible matches, and
there is no difference between greedy and ungreedy repetition, their
behaviour is different from the standard functions when PCRE_PAR-
- TIAL_HARD is set. Consider the string "dog" matched against the
- ungreedy pattern shown above:
+ TIAL_HARD is set. Consider the string "dog" matched against the un-
+ greedy pattern shown above:
/dog(sbody)??/
@@ -9029,9 +9022,9 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec() OR pcre[16|32]_dfa_exec()
and calling the function again with the same compiled regular expres-
sion, this time setting the PCRE_DFA_RESTART option. You must pass the
same working space as before, because this is where details of the pre-
- vious partial match are stored. Here is an example using pcretest,
- using the \R escape sequence to set the PCRE_DFA_RESTART option (\D
- specifies the use of the DFA matching function):
+ vious partial match are stored. Here is an example using pcretest, us-
+ ing the \R escape sequence to set the PCRE_DFA_RESTART option (\D spec-
+ ifies the use of the DFA matching function):
re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
data> 23ja\P\D
@@ -9047,11 +9040,11 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec() OR pcre[16|32]_dfa_exec()
to.
That means that, for an unanchored pattern, if a continued match fails,
- it is not possible to try again at a new starting point. All this
- facility is capable of doing is continuing with the previous match
- attempt. In the previous example, if the second set of data is "ug23"
- the result is no match, even though there would be a match for "aug23"
- if the entire string were given at once. Depending on the application,
+ it is not possible to try again at a new starting point. All this fa-
+ cility is capable of doing is continuing with the previous match at-
+ tempt. In the previous example, if the second set of data is "ug23" the
+ result is no match, even though there would be a match for "aug23" if
+ the entire string were given at once. Depending on the application,
this may or may not be what you want. The only way to allow for start-
ing again at the next character is to retain the matched part of the
subject and try a new complete match.
@@ -9100,8 +9093,8 @@ ISSUES WITH MULTI-SEGMENT MATCHING
1. If the pattern contains a test for the beginning of a line, you need
to pass the PCRE_NOTBOL option when the subject string for any call
- does start at the beginning of a line. There is also a PCRE_NOTEOL
- option, but in practice when doing multi-segment matching you should be
+ does start at the beginning of a line. There is also a PCRE_NOTEOL op-
+ tion, but in practice when doing multi-segment matching you should be
using PCRE_PARTIAL_HARD, which includes the effect of PCRE_NOTEOL.
2. Lookbehind assertions that have already been obeyed are catered for
@@ -9213,8 +9206,8 @@ ISSUES WITH MULTI-SEGMENT MATCHING
1234|ABCD
where no string can be a partial match for both alternatives. This is
- not a problem if a standard matching function is used, because the
- entire match has to be rerun each time:
+ not a problem if a standard matching function is used, because the en-
+ tire match has to be rerun each time:
re> /1234|3789/
data> ABC123\P\P
@@ -9264,10 +9257,10 @@ SAVING AND RE-USING PRECOMPILED PCRE PATTERNS
If you save compiled patterns to a file, you can copy them to a differ-
ent host and run them there. If the two hosts have different endianness
- (byte order), you should run the pcre[16|32]_pat-
- tern_to_host_byte_order() function on the new host before trying to
- match the pattern. The matching functions return PCRE_ERROR_BADENDIAN-
- NESS if they detect a pattern with the wrong endianness.
+ (byte order), you should run the pcre[16|32]_pattern_to_host_byte_or-
+ der() function on the new host before trying to match the pattern. The
+ matching functions return PCRE_ERROR_BADENDIANNESS if they detect a
+ pattern with the wrong endianness.
Compiling regular expressions with one version of PCRE for use with a
different version is not guaranteed to work and may cause crashes, and
@@ -9282,8 +9275,8 @@ SAVING A COMPILED PATTERN
find the length of this block in bytes by calling
pcre[16|32]_fullinfo() with an argument of PCRE_INFO_SIZE. You can then
save the data in any appropriate manner. Here is sample code for the
- 8-bit library that compiles a pattern and writes it to a file. It
- assumes that the variable fd refers to a file that is open for output:
+ 8-bit library that compiles a pattern and writes it to a file. It as-
+ sumes that the variable fd refers to a file that is open for output:
int erroroffset, rc, size;
char *error;
@@ -9298,14 +9291,14 @@ SAVING A COMPILED PATTERN
In this example, the bytes that comprise the compiled pattern are
copied exactly. Note that this is binary data that may contain any of
- the 256 possible byte values. On systems that make a distinction
- between binary and non-binary data, be sure that the file is opened for
+ the 256 possible byte values. On systems that make a distinction be-
+ tween binary and non-binary data, be sure that the file is opened for
binary output.
If you want to write more than one pattern to a file, you will have to
devise a way of separating them. For binary data, preceding each pat-
- tern with its length is probably the most straightforward approach.
- Another possibility is to write out the data in hexadecimal instead of
+ tern with its length is probably the most straightforward approach. An-
+ other possibility is to write out the data in hexadecimal instead of
binary, one pattern to a line.
Saving compiled patterns in a file is only one possible way of storing
@@ -9324,8 +9317,8 @@ SAVING A COMPILED PATTERN
study data, and this is what you must save (not the pcre[16|32]_extra
block itself). The length of the study data can be obtained by calling
pcre[16|32]_fullinfo() with an argument of PCRE_INFO_STUDYSIZE. Remem-
- ber to check that pcre[16|32]_study() did return a non-NULL value
- before trying to save the study data.
+ ber to check that pcre[16|32]_study() did return a non-NULL value be-
+ fore trying to save the study data.
RE-USING A PRECOMPILED PATTERN
@@ -9354,18 +9347,18 @@ RE-USING A PRECOMPILED PATTERN
If you saved study data with the compiled pattern, you need to create
your own pcre[16|32]_extra data block and set the study_data field to
- point to the reloaded study data. You must also set the
- PCRE_EXTRA_STUDY_DATA bit in the flags field to indicate that study
- data is present. Then pass the pcre[16|32]_extra block to the matching
- function in the usual way. If the pattern was studied for just-in-time
- optimization, that data cannot be saved, and so is lost by a
- save/restore cycle.
+ point to the reloaded study data. You must also set the PCRE_EX-
+ TRA_STUDY_DATA bit in the flags field to indicate that study data is
+ present. Then pass the pcre[16|32]_extra block to the matching function
+ in the usual way. If the pattern was studied for just-in-time optimiza-
+ tion, that data cannot be saved, and so is lost by a save/restore cy-
+ cle.
COMPATIBILITY WITH DIFFERENT PCRE RELEASES
- In general, it is safest to recompile all saved patterns when you
- update to a new PCRE release, though not all updates actually require
+ In general, it is safest to recompile all saved patterns when you up-
+ date to a new PCRE release, though not all updates actually require
this.
@@ -9454,8 +9447,8 @@ STACK USAGE AT RUN TIME
stack. In some environments the default process stack is quite small,
and if it runs out the result is often SIGSEGV. This issue is probably
the most frequently raised problem with PCRE. Rewriting your pattern
- can often help. The pcrestack documentation discusses this issue in
- detail.
+ can often help. The pcrestack documentation discusses this issue in de-
+ tail.
PROCESSING TIME
@@ -9466,8 +9459,8 @@ PROCESSING TIME
(a|e|i|o|u). In general, the simplest construction that provides the
required behaviour is usually the most efficient. Jeffrey Friedl's book
contains a lot of useful general discussion about optimizing regular
- expressions for efficient performance. This document contains a few
- observations about PCRE.
+ expressions for efficient performance. This document contains a few ob-
+ servations about PCRE.
Using Unicode character properties (the \p, \P, and \X escapes) is
slow, because PCRE has to use a multi-stage table lookup whenever it
@@ -9516,8 +9509,8 @@ PROCESSING TIME
2, 3, or 4 times, and for each of those cases other than 0 or 4, the +
repeats can match different numbers of times.) When the remainder of
the pattern is such that the entire match is going to fail, PCRE has in
- principle to try every possible variation, and this can take an
- extremely long time, even for relatively short strings.
+ principle to try every possible variation, and this can take an ex-
+ tremely long time, even for relatively short strings.
An optimization catches some of the more simple cases such as
@@ -9580,8 +9573,8 @@ DESCRIPTION
This set of functions provides a POSIX-style API for the PCRE regular
expression 8-bit library. See the pcreapi documentation for a descrip-
tion of PCRE's native API, which contains much additional functional-
- ity. There is no POSIX-style wrapper for PCRE's 16-bit and 32-bit
- library.
+ ity. There is no POSIX-style wrapper for PCRE's 16-bit and 32-bit li-
+ brary.
The functions described here are just wrapper functions that ultimately
call the PCRE native API. Their prototypes are defined in the
@@ -9610,12 +9603,12 @@ DESCRIPTION
even less compatible.
The header for these functions is supplied as pcreposix.h to avoid any
- potential clash with other POSIX libraries. It can, of course, be
- renamed or aliased as regex.h, which is the "correct" name. It provides
+ potential clash with other POSIX libraries. It can, of course, be re-
+ named or aliased as regex.h, which is the "correct" name. It provides
two structure types, regex_t for compiled internal forms, and reg-
match_t for returning captured substrings. It also defines some con-
- stants whose names start with "REG_"; these are used for setting
- options and identifying error codes.
+ stants whose names start with "REG_"; these are used for setting op-
+ tions and identifying error codes.
COMPILING A PATTERN
@@ -9676,8 +9669,8 @@ COMPILING A PATTERN
Note that REG_UTF8 is not part of the POSIX standard.
In the absence of these flags, no options are passed to the native
- function. This means the the regex is compiled with PCRE default
- semantics. In particular, the way it handles newline characters in the
+ function. This means the the regex is compiled with PCRE default se-
+ mantics. In particular, the way it handles newline characters in the
subject string is the Perl way, not the POSIX way. Note that setting
PCRE_MULTILINE has only some of the effects specified for REG_NEWLINE.
It does not affect the way newlines are matched by . (they are not) or
@@ -9780,9 +9773,9 @@ MATCHING A PATTERN
relate to the capturing subpatterns of the regular expression. Unused
entries in the array have both structure members set to -1.
- A successful match yields a zero return; various error codes are
- defined in the header file, of which REG_NOMATCH is the "expected"
- failure code.
+ A successful match yields a zero return; various error codes are de-
+ fined in the header file, of which REG_NOMATCH is the "expected" fail-
+ ure code.
ERROR MESSAGES
@@ -9790,9 +9783,9 @@ ERROR MESSAGES
The regerror() function maps a non-zero errorcode from either regcomp()
or regexec() to a printable message. If preg is not NULL, the error
should have arisen from the use of that structure. A message terminated
- by a binary zero is placed in errbuf. The length of the message,
- including the zero, is limited to errbuf_size. The yield of the func-
- tion is the size of buffer needed to hold the whole message.
+ by a binary zero is placed in errbuf. The length of the message, in-
+ cluding the zero, is limited to errbuf_size. The yield of the function
+ is the size of buffer needed to hold the whole message.
MEMORY USAGE
@@ -9909,15 +9902,15 @@ MATCHING INTERFACE
ignored.
CAVEAT: An optional sub-pattern that does not exist in the matched
- string is assigned the empty string. Therefore, the following will
- return false (because the empty string is not a valid number):
+ string is assigned the empty string. Therefore, the following will re-
+ turn false (because the empty string is not a valid number):
int number;
pcrecpp::RE::FullMatch("abc", "[a-z]+(\\d+)?", &number);
The matching interface supports at most 16 arguments per call. If you
- need more, consider using the more general interface
- pcrecpp::RE::DoMatch. See pcrecpp.h for the signature for DoMatch.
+ need more, consider using the more general interface pcrecpp::RE::Do-
+ Match. See pcrecpp.h for the signature for DoMatch.
NOTE: Do not use no_arg, which is used internally to mark the end of a
list of optional arguments, as a placeholder for missing arguments, as
@@ -9982,10 +9975,10 @@ UTF-8 AND THE MATCHING INTERFACE
PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE
- PCRE defines some modifiers to change the behavior of the regular
- expression engine. The C++ wrapper defines an auxiliary class,
- RE_Options, as a vehicle to pass such modifiers to a RE class. Cur-
- rently, the following modifiers are supported:
+ PCRE defines some modifiers to change the behavior of the regular ex-
+ pression engine. The C++ wrapper defines an auxiliary class, RE_Op-
+ tions, as a vehicle to pass such modifiers to a RE class. Currently,
+ the following modifiers are supported:
modifier description Perl corresponding
@@ -10007,8 +10000,8 @@ PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE
API reference page.
For each modifier, there are two member functions whose name is made
- out of the modifier in lowercase, without the "PCRE_" prefix. For
- instance, PCRE_CASELESS is handled by
+ out of the modifier in lowercase, without the "PCRE_" prefix. For in-
+ stance, PCRE_CASELESS is handled by
bool caseless()
@@ -10089,12 +10082,12 @@ SCANNING TEXT INCREMENTALLY
...;
}
- Each successful call to "Consume" will set "var/value", and also
- advance "input" so it points past the matched text.
+ Each successful call to "Consume" will set "var/value", and also ad-
+ vance "input" so it points past the matched text.
- The "FindAndConsume" operation is similar to "Consume" but does not
- anchor your match at the beginning of the string. For example, you
- could extract all words from a string by repeatedly calling
+ The "FindAndConsume" operation is similar to "Consume" but does not an-
+ chor your match at the beginning of the string. For example, you could
+ extract all words from a string by repeatedly calling
pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
@@ -10138,8 +10131,8 @@ REPLACING PARTS OF STRINGS
string s = "yabba dabba doo";
pcrecpp::RE("b+").GlobalReplace("d", &s);
- will leave "s" containing "yada dada doo". It returns the number of
- replacements made.
+ will leave "s" containing "yada dada doo". It returns the number of re-
+ placements made.
Extract is like Replace, except that if the pattern matches, "rewrite"
is copied into "out" (an additional argument) with substitutions. The
@@ -10196,8 +10189,8 @@ PCRE SAMPLE PROGRAM
If PCRE is installed elsewhere, you may need to add additional options
to the command line. For example, on a Unix-like system that has PCRE
- installed in /usr/local, you can compile the demonstration program
- using a command like this:
+ installed in /usr/local, you can compile the demonstration program us-
+ ing a command like this:
gcc -o pcredemo -I/usr/local/include pcredemo.c \
-L/usr/local/lib -lpcre
@@ -10205,8 +10198,8 @@ PCRE SAMPLE PROGRAM
In a Windows environment, if you want to statically link the program
against a non-dll pcre.a file, you must uncomment the line that defines
PCRE_STATIC before including pcre.h, because otherwise the pcre_mal-
- loc() and pcre_free() exported functions will be declared
- __declspec(dllimport), with unwanted results.
+ loc() and pcre_free() exported functions will be declared __de-
+ clspec(dllimport), with unwanted results.
Once you have compiled and linked the demonstration program, you can
run simple tests like this:
@@ -10215,16 +10208,16 @@ PCRE SAMPLE PROGRAM
./pcredemo -g 'cat|dog' 'the dog sat on the cat'
Note that there is a much more comprehensive test program, called
- pcretest, which supports many more facilities for testing regular
- expressions and both PCRE libraries. The pcredemo program is provided
- as a simple coding example.
+ pcretest, which supports many more facilities for testing regular ex-
+ pressions and both PCRE libraries. The pcredemo program is provided as
+ a simple coding example.
If you try to run pcredemo when PCRE is not installed in the standard
library directory, you may get an error like this on some operating
systems (e.g. Solaris):
- ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or
- directory
+ ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or di-
+ rectory
This is caused by the way shared library support works on those sys-
tems. You need to add
@@ -10259,8 +10252,8 @@ SIZE AND OTHER LIMITATIONS
never in practice be relevant.
The maximum length of a compiled pattern is approximately 64K data
- units (bytes for the 8-bit library, 16-bit units for the 16-bit
- library, and 32-bit units for the 32-bit library) if PCRE is compiled
+ units (bytes for the 8-bit library, 16-bit units for the 16-bit li-
+ brary, and 32-bit units for the 32-bit library) if PCRE is compiled
with the default internal linkage size, which is 2 bytes for the 8-bit
and 16-bit libraries, and 4 bytes for the 32-bit library. If you want
to process regular expressions that are truly enormous, you can compile
@@ -10280,10 +10273,10 @@ SIZE AND OTHER LIMITATIONS
the default is 250.
There is a limit to the number of forward references to subsequent sub-
- patterns of around 200,000. Repeated forward references with fixed
- upper limits, for example, (?2){0,100} when subpattern number 2 is to
- the right, are included in the count. There is no limit to the number
- of backward references.
+ patterns of around 200,000. Repeated forward references with fixed up-
+ per limits, for example, (?2){0,100} when subpattern number 2 is to the
+ right, are included in the count. There is no limit to the number of
+ backward references.
The maximum length of name for a named subpattern is 32 characters, and
the maximum number of named subpatterns is 10000.
@@ -10329,8 +10322,8 @@ PCRE DISCUSSION OF STACK USAGE
back up and try a different alternative if the first one fails. As
matching proceeds deeper and deeper into the tree of possibilities, the
recursion depth increases. The match() function is also called in other
- circumstances, for example, whenever a parenthesized sub-pattern is
- entered, and in certain cases of repetition.
+ circumstances, for example, whenever a parenthesized sub-pattern is en-
+ tered, and in certain cases of repetition.
Not all calls of match() increase the recursion depth; for an item such
as a* it may be called several times at the same level, after matching
@@ -10344,8 +10337,8 @@ PCRE DISCUSSION OF STACK USAGE
PCRE_STUDY_JIT_COMPILE option, and just-in-time compiling was success-
ful, and the options passed to pcre[16|32]_exec() were not incompati-
ble, the matching process uses the JIT-compiled code instead of the
- match() function. In this case, the memory requirements are handled
- entirely differently. See the pcrejit documentation for details.
+ match() function. In this case, the memory requirements are handled en-
+ tirely differently. See the pcrejit documentation for details.
The pcre[16|32]_dfa_exec() function operates in an entirely different
way, and uses recursion only when there is a regular expression recur-
@@ -10376,8 +10369,8 @@ PCRE DISCUSSION OF STACK USAGE
end of the data, and is the kind of pattern that might be used when
processing an XML file. Each iteration of the outer parentheses matches
either one character that is not "<" or a "<" that is not followed by
- "inet". However, each time a parenthesis is processed, a recursion
- occurs, so this formulation uses a stack frame for each matched charac-
+ "inet". However, each time a parenthesis is processed, a recursion oc-
+ curs, so this formulation uses a stack frame for each matched charac-
ter. For a long string, a lot of stack is required. Consider now this
rewritten pattern, which matches exactly the same strings:
@@ -10434,11 +10427,11 @@ PCRE DISCUSSION OF STACK USAGE
Obtaining an estimate of stack usage
- The actual amount of stack used per recursion can vary quite a lot,
- depending on the compiler that was used to build PCRE and the optimiza-
+ The actual amount of stack used per recursion can vary quite a lot, de-
+ pending on the compiler that was used to build PCRE and the optimiza-
tion or debugging options that were set for it. The rule of thumb value
- of 500 bytes mentioned above may be larger or smaller than what is
- actually needed. A better approximation can be obtained by running this
+ of 500 bytes mentioned above may be larger or smaller than what is ac-
+ tually needed. A better approximation can be obtained by running this
command:
pcretest -m -C
@@ -10452,9 +10445,9 @@ PCRE DISCUSSION OF STACK USAGE
The value is approximate because some recursions need a bit more (up to
perhaps 16 more bytes).
- If the above command is given when PCRE is compiled to use the heap
- instead of the stack for recursion, the value that is output is the
- size of each block that is obtained from the heap.
+ If the above command is given when PCRE is compiled to use the heap in-
+ stead of the stack for recursion, the value that is output is the size
+ of each block that is obtained from the heap.
Changing stack size in Unix-like systems
@@ -10482,8 +10475,8 @@ PCRE DISCUSSION OF STACK USAGE
Using setrlimit(), as described above, should also work on Mac OS X. It
is also possible to set a stack size when linking a program. There is a
- discussion about stack sizes in Mac OS X at this web site:
- http://developer.apple.com/qa/qa2005/qa1419.html.
+ discussion about stack sizes in Mac OS X at this web site: http://de-
+ veloper.apple.com/qa/qa2005/qa1419.html.
AUTHOR
diff --git a/pcre/doc/pcreapi.3 b/pcre/doc/pcreapi.3
index 6e7c7c6e3ce..d79217818a6 100644
--- a/pcre/doc/pcreapi.3
+++ b/pcre/doc/pcreapi.3
@@ -1227,7 +1227,7 @@ the following negative numbers:
PCRE_ERROR_BADOPTION the value of \fIwhat\fP was invalid
PCRE_ERROR_UNSET the requested field is not set
.sp
-The "magic number" is placed at the start of each compiled pattern as an simple
+The "magic number" is placed at the start of each compiled pattern as a simple
check against passing an arbitrary memory pointer. The endianness error can
occur if a compiled pattern is saved and reloaded on a different host. Here is
a typical call of \fBpcre_fullinfo()\fP, to obtain the length of the compiled
@@ -1294,7 +1294,7 @@ returned. For anchored patterns, -2 is returned.
.sp
Return the value of the first data unit (non-UTF character) of any matched
string in the situation where PCRE_INFO_FIRSTCHARACTERFLAGS returns 1;
-otherwise return 0. The fourth argument should point to an \fBuint_t\fP
+otherwise return 0. The fourth argument should point to a \fBuint_t\fP
variable.
.P
In the 8-bit library, the value is always less than 256. In the 16-bit library
@@ -1560,7 +1560,7 @@ returned value 1 (with "z" returned from PCRE_INFO_REQUIREDCHAR), but for
.sp
Return the value of the rightmost literal data unit that must exist in any
matched string, other than at its start, if such a value has been recorded. The
-fourth argument should point to an \fBuint32_t\fP variable. If there is no such
+fourth argument should point to a \fBuint32_t\fP variable. If there is no such
value, 0 is returned.
.
.
diff --git a/pcre/doc/pcregrep.txt b/pcre/doc/pcregrep.txt
index 97d9a7bd379..0c873c7a863 100644
--- a/pcre/doc/pcregrep.txt
+++ b/pcre/doc/pcregrep.txt
@@ -26,8 +26,8 @@ DESCRIPTION
If you attempt to use delimiters (for example, by surrounding a pattern
with slashes, as is common in Perl scripts), they are interpreted as
part of the pattern. Quotes can of course be used to delimit patterns
- on the command line because they are interpreted by the shell, and
- indeed quotes are required if a pattern contains white space or shell
+ on the command line because they are interpreted by the shell, and in-
+ deed quotes are required if a pattern contains white space or shell
metacharacters.
The first argument that follows any option settings is treated as the
@@ -37,8 +37,8 @@ DESCRIPTION
or an argument pattern must be provided.
If no files are specified, pcregrep reads the standard input. The stan-
- dard input can also be referenced by a name consisting of a single
- hyphen. For example:
+ dard input can also be referenced by a name consisting of a single hy-
+ phen. For example:
pcregrep some-pattern /file1 - /file3
@@ -47,8 +47,8 @@ DESCRIPTION
the start of each line, followed by a colon. However, there are options
that can change how pcregrep behaves. In particular, the -M option
makes it possible to search for patterns that span line boundaries.
- What defines a line boundary is controlled by the -N (--newline)
- option.
+ What defines a line boundary is controlled by the -N (--newline) op-
+ tion.
The amount of memory used for buffering files that are being scanned is
controlled by a parameter that can be set by the --buffer-size option.
@@ -66,12 +66,12 @@ DESCRIPTION
By default, as soon as one pattern matches a line, no further patterns
are considered. However, if --colour (or --color) is used to colour the
matching substrings, or if --only-matching, --file-offsets, or --line-
- offsets is used to output only the part of the line that matched
- (either shown literally, or as an offset), scanning resumes immediately
+ offsets is used to output only the part of the line that matched (ei-
+ ther shown literally, or as an offset), scanning resumes immediately
following the match, so that further matches on the same line can be
- found. If there are multiple patterns, they are all tried on the
- remainder of the line, but patterns that follow the one that matched
- are not tried on the earlier part of the line.
+ found. If there are multiple patterns, they are all tried on the re-
+ mainder of the line, but patterns that follow the one that matched are
+ not tried on the earlier part of the line.
This behaviour means that the order in which multiple patterns are
specified can affect the output when one of the above options is used.
@@ -80,11 +80,11 @@ DESCRIPTION
overlap).
Patterns that can match an empty string are accepted, but empty string
- matches are never recognized. An example is the pattern
- "(super)?(man)?", in which all components are optional. This pattern
- finds all occurrences of both "super" and "man"; the output differs
- from matching with "super|man" when only the matching substrings are
- being shown.
+ matches are never recognized. An example is the pattern "(su-
+ per)?(man)?", in which all components are optional. This pattern finds
+ all occurrences of both "super" and "man"; the output differs from
+ matching with "super|man" when only the matching substrings are being
+ shown.
If the LC_ALL or LC_CTYPE environment variable is set, pcregrep uses
the value to set a locale when calling the PCRE library. The --locale
@@ -105,9 +105,9 @@ BINARY FILES
By default, a file that contains a binary zero byte within the first
1024 bytes is identified as a binary file, and is processed specially.
- (GNU grep also identifies binary files in this manner.) See the
- --binary-files option for a means of changing the way binary files are
- handled.
+ (GNU grep also identifies binary files in this manner.) See the --bi-
+ nary-files option for a means of changing the way binary files are han-
+ dled.
OPTIONS
@@ -151,16 +151,16 @@ OPTIONS
--binary-files=word
Specify how binary files are to be processed. If the word is
- "binary" (the default), pattern matching is performed on
- binary files, but the only output is "Binary file <name>
+ "binary" (the default), pattern matching is performed on bi-
+ nary files, but the only output is "Binary file <name>
matches" when a match succeeds. If the word is "text", which
is equivalent to the -a or --text option, binary files are
processed in the same way as any other file. In this case,
when a match succeeds, the output may be binary garbage,
which can have nasty effects if sent to a terminal. If the
- word is "without-match", which is equivalent to the -I
- option, binary files are not processed at all; they are
- assumed not to be of interest.
+ word is "without-match", which is equivalent to the -I op-
+ tion, binary files are not processed at all; they are assumed
+ not to be of interest.
--buffer-size=number
Set the parameter that controls how much memory is used for
@@ -201,15 +201,15 @@ OPTIONS
ronment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value
of this variable should be a string of two numbers, separated
by a semicolon. They are copied directly into the control
- string for setting colour on a terminal, so it is your
- responsibility to ensure that they make sense. If neither of
+ string for setting colour on a terminal, so it is your re-
+ sponsibility to ensure that they make sense. If neither of
the environment variables is set, the default is "1;31",
which gives red.
-D action, --devices=action
- If an input path is not a regular file or a directory,
- "action" specifies how it is to be processed. Valid values
- are "read" (the default) or "skip" (silently skip the path).
+ If an input path is not a regular file or a directory, "ac-
+ tion" specifies how it is to be processed. Valid values are
+ "read" (the default) or "skip" (silently skip the path).
-d action, --directories=action
If an input path is a directory, "action" specifies how it is
@@ -218,8 +218,8 @@ OPTIONS
"recurse" (equivalent to the -r option), or "skip" (silently
skip the path, the default in Windows environments). In the
"read" case, directories are read as if they were ordinary
- files. In some operating systems the effect of reading a
- directory like this is an immediate end-of-file; in others it
+ files. In some operating systems the effect of reading a di-
+ rectory like this is an immediate end-of-file; in others it
may provoke an error.
-e pattern, --regex=pattern, --regexp=pattern
@@ -249,8 +249,8 @@ OPTIONS
whether listed on the command line, obtained from --file-
list, or by scanning a directory. The pattern is a PCRE regu-
lar expression, and is matched against the final component of
- the file name, not the entire path. The -F, -w, and -x
- options do not apply to this pattern. The option may be given
+ the file name, not the entire path. The -F, -w, and -x op-
+ tions do not apply to this pattern. The option may be given
any number of times in order to specify multiple patterns. If
a file name matches both an --include and an --exclude pat-
tern, it is excluded. There is no short form for this option.
@@ -264,29 +264,29 @@ OPTIONS
--exclude-dir=pattern
Directories whose names match the pattern are skipped without
- being processed, whatever the setting of the --recursive
- option. This applies to all directories, whether listed on
- the command line, obtained from --file-list, or by scanning a
+ being processed, whatever the setting of the --recursive op-
+ tion. This applies to all directories, whether listed on the
+ command line, obtained from --file-list, or by scanning a
parent directory. The pattern is a PCRE regular expression,
and is matched against the final component of the directory
name, not the entire path. The -F, -w, and -x options do not
apply to this pattern. The option may be given any number of
times in order to specify more than one pattern. If a direc-
- tory matches both --include-dir and --exclude-dir, it is
- excluded. There is no short form for this option.
+ tory matches both --include-dir and --exclude-dir, it is ex-
+ cluded. There is no short form for this option.
-F, --fixed-strings
Interpret each data-matching pattern as a list of fixed
- strings, separated by newlines, instead of as a regular
- expression. What constitutes a newline for this purpose is
- controlled by the --newline option. The -w (match as a word)
- and -x (match whole line) options can be used with -F. They
- apply to each of the fixed strings. A line is selected if any
+ strings, separated by newlines, instead of as a regular ex-
+ pression. What constitutes a newline for this purpose is con-
+ trolled by the --newline option. The -w (match as a word) and
+ -x (match whole line) options can be used with -F. They ap-
+ ply to each of the fixed strings. A line is selected if any
of the fixed strings are found in it (subject to -w or -x, if
present). This option applies only to the patterns that are
matched against the contents of files; it does not apply to
- patterns specified by any of the --include or --exclude
- options.
+ patterns specified by any of the --include or --exclude op-
+ tions.
-f filename, --file=filename
Read patterns from the file, one per line, and match them
@@ -358,16 +358,16 @@ OPTIONS
--include=pattern
If any --include patterns are specified, the only files that
are processed are those that match one of the patterns (and
- do not match an --exclude pattern). This option does not
- affect directories, but it applies to all files, whether
- listed on the command line, obtained from --file-list, or by
- scanning a directory. The pattern is a PCRE regular expres-
- sion, and is matched against the final component of the file
- name, not the entire path. The -F, -w, and -x options do not
- apply to this pattern. The option may be given any number of
- times. If a file name matches both an --include and an
- --exclude pattern, it is excluded. There is no short form
- for this option.
+ do not match an --exclude pattern). This option does not af-
+ fect directories, but it applies to all files, whether listed
+ on the command line, obtained from --file-list, or by scan-
+ ning a directory. The pattern is a PCRE regular expression,
+ and is matched against the final component of the file name,
+ not the entire path. The -F, -w, and -x options do not apply
+ to this pattern. The option may be given any number of times.
+ If a file name matches both an --include and an --exclude
+ pattern, it is excluded. There is no short form for this op-
+ tion.
--include-from=filename
Treat each non-empty line of the file as the data for an
@@ -381,8 +381,8 @@ OPTIONS
tories that are processed are those that match one of the
patterns (and do not match an --exclude-dir pattern). This
applies to all directories, whether listed on the command
- line, obtained from --file-list, or by scanning a parent
- directory. The pattern is a PCRE regular expression, and is
+ line, obtained from --file-list, or by scanning a parent di-
+ rectory. The pattern is a PCRE regular expression, and is
matched against the final component of the directory name,
not the entire path. The -F, -w, and -x options do not apply
to this pattern. The option may be given any number of times.
@@ -413,9 +413,9 @@ OPTIONS
--line-buffered
When this option is given, input is read and processed line
- by line, and the output is flushed after each write. By
- default, input is read in large chunks, unless pcregrep can
- determine that it is reading from a terminal (which is cur-
+ by line, and the output is flushed after each write. By de-
+ fault, input is read in large chunks, unless pcregrep can de-
+ termine that it is reading from a terminal (which is cur-
rently possible only in Unix-like environments). Output to
terminal is normally automatically flushed by the operating
system. This option can be useful when the input or output is
@@ -437,9 +437,9 @@ OPTIONS
--locale=locale-name
This option specifies a locale to be used for pattern match-
ing. It overrides the value in the LC_ALL or LC_CTYPE envi-
- ronment variables. If no locale is specified, the PCRE
- library's default (usually the "C" locale) is used. There is
- no short form for this option.
+ ronment variables. If no locale is specified, the PCRE li-
+ brary's default (usually the "C" locale) is used. There is no
+ short form for this option.
--match-limit=number
Processing some regular expression patterns can require a
@@ -447,26 +447,26 @@ OPTIONS
gram crash if not enough is available. Other patterns may
take a very long time to search for all possible matching
strings. The pcre_exec() function that is called by pcregrep
- to do the matching has two parameters that can limit the
- resources that it uses.
+ to do the matching has two parameters that can limit the re-
+ sources that it uses.
- The --match-limit option provides a means of limiting
- resource usage when processing patterns that are not going to
+ The --match-limit option provides a means of limiting re-
+ source usage when processing patterns that are not going to
match, but which have a very large number of possibilities in
their search trees. The classic example is a pattern that
uses nested unlimited repeats. Internally, PCRE uses a func-
- tion called match() which it calls repeatedly (sometimes
- recursively). The limit set by --match-limit is imposed on
- the number of times this function is called during a match,
- which has the effect of limiting the amount of backtracking
- that can take place.
+ tion called match() which it calls repeatedly (sometimes re-
+ cursively). The limit set by --match-limit is imposed on the
+ number of times this function is called during a match, which
+ has the effect of limiting the amount of backtracking that
+ can take place.
The --recursion-limit option is similar to --match-limit, but
instead of limiting the total number of times that match() is
called, it limits the depth of recursive calls, which in turn
limits the amount of memory that can be used. The recursion
- depth is a smaller number than the total number of calls,
- because not all calls to match() are recursive. This limit is
+ depth is a smaller number than the total number of calls, be-
+ cause not all calls to match() are recursive. This limit is
of use only if it is set smaller than --match-limit.
There are no short forms for these options. The default set-
@@ -494,30 +494,30 @@ OPTIONS
is read line by line (see --line-buffered.)
-N newline-type, --newline=newline-type
- The PCRE library supports five different conventions for
- indicating the ends of lines. They are the single-character
- sequences CR (carriage return) and LF (linefeed), the two-
- character sequence CRLF, an "anycrlf" convention, which rec-
- ognizes any of the preceding three types, and an "any" con-
- vention, in which any Unicode line ending sequence is assumed
- to end a line. The Unicode sequences are the three just men-
+ The PCRE library supports five different conventions for in-
+ dicating the ends of lines. They are the single-character se-
+ quences CR (carriage return) and LF (linefeed), the two-char-
+ acter sequence CRLF, an "anycrlf" convention, which recog-
+ nizes any of the preceding three types, and an "any" conven-
+ tion, in which any Unicode line ending sequence is assumed to
+ end a line. The Unicode sequences are the three just men-
tioned, plus VT (vertical tab, U+000B), FF (form feed,
U+000C), NEL (next line, U+0085), LS (line separator,
U+2028), and PS (paragraph separator, U+2029).
- When the PCRE library is built, a default line-ending
- sequence is specified. This is normally the standard
- sequence for the operating system. Unless otherwise specified
- by this option, pcregrep uses the library's default. The
- possible values for this option are CR, LF, CRLF, ANYCRLF, or
- ANY. This makes it possible to use pcregrep to scan files
- that have come from other environments without having to mod-
- ify their line endings. If the data that is being scanned
- does not agree with the convention set by this option, pcre-
- grep may behave in strange ways. Note that this option does
- not apply to files specified by the -f, --exclude-from, or
- --include-from options, which are expected to use the operat-
- ing system's standard newline sequence.
+ When the PCRE library is built, a default line-ending se-
+ quence is specified. This is normally the standard sequence
+ for the operating system. Unless otherwise specified by this
+ option, pcregrep uses the library's default. The possible
+ values for this option are CR, LF, CRLF, ANYCRLF, or ANY.
+ This makes it possible to use pcregrep to scan files that
+ have come from other environments without having to modify
+ their line endings. If the data that is being scanned does
+ not agree with the convention set by this option, pcregrep
+ may behave in strange ways. Note that this option does not
+ apply to files specified by the -f, --exclude-from, or --in-
+ clude-from options, which are expected to use the operating
+ system's standard newline sequence.
-n, --line-number
Precede each output line by its line number in the file, fol-
@@ -538,12 +538,12 @@ OPTIONS
is, the -A, -B, and -C options are ignored. If there is more
than one match in a line, each of them is shown separately.
If -o is combined with -v (invert the sense of the match to
- find non-matching lines), no output is generated, but the
- return code is set appropriately. If the matched portion of
- the line is empty, nothing is output unless the file name or
- line number are being printed, in which case they are shown
- on an otherwise empty line. This option is mutually exclusive
- with --file-offsets and --line-offsets.
+ find non-matching lines), no output is generated, but the re-
+ turn code is set appropriately. If the matched portion of the
+ line is empty, nothing is output unless the file name or line
+ number are being printed, in which case they are shown on an
+ otherwise empty line. This option is mutually exclusive with
+ --file-offsets and --line-offsets.
-onumber, --only-matching=number
Show only the part of the line that matched the capturing
@@ -579,8 +579,8 @@ OPTIONS
it contains, taking note of any --include and --exclude set-
tings. By default, a directory is read as a normal file; in
some operating systems this gives an immediate end-of-file.
- This option is a shorthand for setting the -d option to
- "recurse".
+ This option is a shorthand for setting the -d option to "re-
+ curse".
--recursion-limit=number
See --match-limit above.
@@ -626,10 +626,10 @@ OPTIONS
ENVIRONMENT VARIABLES
- The environment variables LC_ALL and LC_CTYPE are examined, in that
- order, for a locale. The first one that is set is used. This can be
- overridden by the --locale option. If no locale is set, the PCRE
- library's default (usually the "C" locale) is used.
+ The environment variables LC_ALL and LC_CTYPE are examined, in that or-
+ der, for a locale. The first one that is set is used. This can be over-
+ ridden by the --locale option. If no locale is set, the PCRE library's
+ default (usually the "C" locale) is used.
NEWLINES
@@ -640,8 +640,8 @@ NEWLINES
ever newline sequences they have in the input. However, the setting of
this option does not affect the interpretation of files specified by
the -f, --exclude-from, or --include-from options, which are assumed to
- use the operating system's standard newline sequence, nor does it
- affect the way in which pcregrep writes informational messages to the
+ use the operating system's standard newline sequence, nor does it af-
+ fect the way in which pcregrep writes informational messages to the
standard error and output streams. For these it uses the string "\n" to
indicate newlines, relying on the C I/O library to convert this to an
appropriate sequence.
@@ -687,13 +687,13 @@ OPTIONS WITH DATA
--file /some/file
Note, however, that if you want to supply a file name beginning with ~
- as data in a shell command, and have the shell expand ~ to a home
- directory, you must separate the file name from the option, because the
+ as data in a shell command, and have the shell expand ~ to a home di-
+ rectory, you must separate the file name from the option, because the
shell does not treat ~ specially unless it is at the start of an item.
The exceptions to the above are the --colour (or --color) and --only-
- matching options, for which the data is optional. If one of these
- options does have data, it must be given in the first form, using an
+ matching options, for which the data is optional. If one of these op-
+ tions does have data, it must be given in the first form, using an
equals character. Otherwise pcregrep will assume that it has no data.
@@ -702,14 +702,14 @@ MATCHING ERRORS
It is possible to supply a regular expression that takes a very long
time to fail to match certain lines. Such patterns normally involve
nested indefinite repeats, for example: (a+)*\d when matched against a
- line of a's with no final digit. The PCRE matching function has a
- resource limit that causes it to abort in these circumstances. If this
+ line of a's with no final digit. The PCRE matching function has a re-
+ source limit that causes it to abort in these circumstances. If this
happens, pcregrep outputs an error message and the line that caused the
problem to the standard error stream. If there are more than 20 such
errors, pcregrep gives up.
- The --match-limit option of pcregrep can be used to set the overall
- resource limit; there is a second option called --recursion-limit that
+ The --match-limit option of pcregrep can be used to set the overall re-
+ source limit; there is a second option called --recursion-limit that
sets a limit on the amount of memory (usually stack) that is used (see
the discussion of these options above).
diff --git a/pcre/doc/pcretest.1 b/pcre/doc/pcretest.1
index ea7457c03d0..fec964d782a 100644
--- a/pcre/doc/pcretest.1
+++ b/pcre/doc/pcretest.1
@@ -1,4 +1,4 @@
-.TH PCRETEST 1 "23 February 2017" "PCRE 8.41"
+.TH PCRETEST 1 "10 February 2020" "PCRE 8.44"
.SH NAME
pcretest - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@@ -78,21 +78,19 @@ the 16-bit library, or \fBpcre32_xx\fP when using the 32-bit library".
.rs
.TP 10
\fB-8\fP
-If both the 8-bit library has been built, this option causes the 8-bit library
-to be used (which is the default); if the 8-bit library has not been built,
-this option causes an error.
+If the 8-bit library has been built, this option causes it to be used (this is
+the default). If the 8-bit library has not been built, this option causes an
+error.
.TP 10
\fB-16\fP
-If both the 8-bit or the 32-bit, and the 16-bit libraries have been built, this
-option causes the 16-bit library to be used. If only the 16-bit library has been
-built, this is the default (so has no effect). If only the 8-bit or the 32-bit
-library has been built, this option causes an error.
+If the 16-bit library has been built, this option causes it to be used. If only
+the 16-bit library has been built, this is the default. If the 16-bit library
+has not been built, this option causes an error.
.TP 10
\fB-32\fP
-If both the 8-bit or the 16-bit, and the 32-bit libraries have been built, this
-option causes the 32-bit library to be used. If only the 32-bit library has been
-built, this is the default (so has no effect). If only the 8-bit or the 16-bit
-library has been built, this option causes an error.
+If the 32-bit library has been built, this option causes it to be used. If only
+the 32-bit library has been built, this is the default. If the 32-bit library
+has not been built, this option causes an error.
.TP 10
\fB-b\fP
Behave as if each pattern has the \fB/B\fP (show byte code) modifier; the
@@ -1155,6 +1153,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 23 February 2017
-Copyright (c) 1997-2017 University of Cambridge.
+Last updated: 10 February 2020
+Copyright (c) 1997-2020 University of Cambridge.
.fi
diff --git a/pcre/doc/pcretest.txt b/pcre/doc/pcretest.txt
index 6d7305cfe82..835ee58a46d 100644
--- a/pcre/doc/pcretest.txt
+++ b/pcre/doc/pcretest.txt
@@ -47,15 +47,15 @@ INPUT DATA FORMAT
PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
From release 8.30, two separate PCRE libraries can be built. The origi-
- nal one supports 8-bit character strings, whereas the newer 16-bit
- library supports character strings encoded in 16-bit units. From
- release 8.32, a third library can be built, supporting character
- strings encoded in 32-bit units. The pcretest program can be used to
- test all three libraries. However, it is itself still an 8-bit program,
- reading 8-bit input and writing 8-bit output. When testing the 16-bit
- or 32-bit library, the patterns and data strings are converted to 16-
- or 32-bit format before being passed to the PCRE library functions.
- Results are converted to 8-bit for output.
+ nal one supports 8-bit character strings, whereas the newer 16-bit li-
+ brary supports character strings encoded in 16-bit units. From release
+ 8.32, a third library can be built, supporting character strings en-
+ coded in 32-bit units. The pcretest program can be used to test all
+ three libraries. However, it is itself still an 8-bit program, reading
+ 8-bit input and writing 8-bit output. When testing the 16-bit or
+ 32-bit library, the patterns and data strings are converted to 16- or
+ 32-bit format before being passed to the PCRE library functions. Re-
+ sults are converted to 8-bit for output.
References to functions and structures of the form pcre[16|32]_xx below
mean "pcre_xx when using the 8-bit library, pcre16_xx when using the
@@ -64,34 +64,31 @@ PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
COMMAND LINE OPTIONS
- -8 If both the 8-bit library has been built, this option causes
- the 8-bit library to be used (which is the default); if the
- 8-bit library has not been built, this option causes an
- error.
+ -8 If the 8-bit library has been built, this option causes it to
+ be used (this is the default). If the 8-bit library has not
+ been built, this option causes an error.
- -16 If both the 8-bit or the 32-bit, and the 16-bit libraries
- have been built, this option causes the 16-bit library to be
- used. If only the 16-bit library has been built, this is the
- default (so has no effect). If only the 8-bit or the 32-bit
- library has been built, this option causes an error.
+ -16 If the 16-bit library has been built, this option causes it
+ to be used. If only the 16-bit library has been built, this
+ is the default. If the 16-bit library has not been built,
+ this option causes an error.
- -32 If both the 8-bit or the 16-bit, and the 32-bit libraries
- have been built, this option causes the 32-bit library to be
- used. If only the 32-bit library has been built, this is the
- default (so has no effect). If only the 8-bit or the 16-bit
- library has been built, this option causes an error.
+ -32 If the 32-bit library has been built, this option causes it
+ to be used. If only the 32-bit library has been built, this
+ is the default. If the 32-bit library has not been built,
+ this option causes an error.
- -b Behave as if each pattern has the /B (show byte code) modi-
+ -b Behave as if each pattern has the /B (show byte code) modi-
fier; the internal form is output after compilation.
-C Output the version number of the PCRE library, and all avail-
- able information about the optional features that are
- included, and then exit with zero exit code. All other
- options are ignored.
+ able information about the optional features that are in-
+ cluded, and then exit with zero exit code. All other options
+ are ignored.
- -C option Output information about a specific build-time option, then
- exit. This functionality is intended for use in scripts such
- as RunTest. The following options output the value and set
+ -C option Output information about a specific build-time option, then
+ exit. This functionality is intended for use in scripts such
+ as RunTest. The following options output the value and set
the exit code as indicated:
ebcdic-nl the code for LF (= NL) in an EBCDIC environment:
@@ -107,7 +104,7 @@ COMMAND LINE OPTIONS
ANYCRLF or ANY
exit code is always 0
- The following options output 1 for true or 0 for false, and
+ The following options output 1 for true or 0 for false, and
set the exit code to the same value:
ebcdic compiled for an EBCDIC environment
@@ -119,61 +116,61 @@ COMMAND LINE OPTIONS
utf UTF-8 and/or UTF-16 and/or UTF-32 support
is available
- If an unknown option is given, an error message is output;
+ If an unknown option is given, an error message is output;
the exit code is 0.
- -d Behave as if each pattern has the /D (debug) modifier; the
- internal form and information about the compiled pattern is
+ -d Behave as if each pattern has the /D (debug) modifier; the
+ internal form and information about the compiled pattern is
output after compilation; -d is equivalent to -b -i.
- -dfa Behave as if each data line contains the \D escape sequence;
+ -dfa Behave as if each data line contains the \D escape sequence;
this causes the alternative matching function,
- pcre[16|32]_dfa_exec(), to be used instead of the standard
+ pcre[16|32]_dfa_exec(), to be used instead of the standard
pcre[16|32]_exec() function (more detail is given below).
-help Output a brief summary these options and then exit.
- -i Behave as if each pattern has the /I modifier; information
+ -i Behave as if each pattern has the /I modifier; information
about the compiled pattern is given after compilation.
- -M Behave as if each data line contains the \M escape sequence;
- this causes PCRE to discover the minimum MATCH_LIMIT and
- MATCH_LIMIT_RECURSION settings by calling pcre[16|32]_exec()
+ -M Behave as if each data line contains the \M escape sequence;
+ this causes PCRE to discover the minimum MATCH_LIMIT and
+ MATCH_LIMIT_RECURSION settings by calling pcre[16|32]_exec()
repeatedly with different limits.
- -m Output the size of each compiled pattern after it has been
- compiled. This is equivalent to adding /M to each regular
- expression. The size is given in bytes for both libraries.
+ -m Output the size of each compiled pattern after it has been
+ compiled. This is equivalent to adding /M to each regular ex-
+ pression. The size is given in bytes for both libraries.
- -O Behave as if each pattern has the /O modifier, that is dis-
+ -O Behave as if each pattern has the /O modifier, that is dis-
able auto-possessification for all patterns.
- -o osize Set the number of elements in the output vector that is used
- when calling pcre[16|32]_exec() or pcre[16|32]_dfa_exec() to
- be osize. The default value is 45, which is enough for 14
+ -o osize Set the number of elements in the output vector that is used
+ when calling pcre[16|32]_exec() or pcre[16|32]_dfa_exec() to
+ be osize. The default value is 45, which is enough for 14
capturing subexpressions for pcre[16|32]_exec() or 22 differ-
- ent matches for pcre[16|32]_dfa_exec(). The vector size can
- be changed for individual matching calls by including \O in
+ ent matches for pcre[16|32]_dfa_exec(). The vector size can
+ be changed for individual matching calls by including \O in
the data line (see below).
- -p Behave as if each pattern has the /P modifier; the POSIX
- wrapper API is used to call PCRE. None of the other options
- has any effect when -p is set. This option can be used only
+ -p Behave as if each pattern has the /P modifier; the POSIX
+ wrapper API is used to call PCRE. None of the other options
+ has any effect when -p is set. This option can be used only
with the 8-bit library.
- -q Do not output the version number of pcretest at the start of
+ -q Do not output the version number of pcretest at the start of
execution.
- -S size On Unix-like systems, set the size of the run-time stack to
+ -S size On Unix-like systems, set the size of the run-time stack to
size megabytes.
- -s or -s+ Behave as if each pattern has the /S modifier; in other
- words, force each pattern to be studied. If -s+ is used, all
- the JIT compile options are passed to pcre[16|32]_study(),
- causing just-in-time optimization to be set up if it is
- available, for both full and partial matching. Specific JIT
+ -s or -s+ Behave as if each pattern has the /S modifier; in other
+ words, force each pattern to be studied. If -s+ is used, all
+ the JIT compile options are passed to pcre[16|32]_study(),
+ causing just-in-time optimization to be set up if it is
+ available, for both full and partial matching. Specific JIT
compile options can be selected by following -s+ with a digit
- in the range 1 to 7, which selects the JIT compile modes as
+ in the range 1 to 7, which selects the JIT compile modes as
follows:
1 normal match only
@@ -183,119 +180,119 @@ COMMAND LINE OPTIONS
6 soft and hard partial match
7 all three modes (default)
- If -s++ is used instead of -s+ (with or without a following
- digit), the text "(JIT)" is added to the first output line
+ If -s++ is used instead of -s+ (with or without a following
+ digit), the text "(JIT)" is added to the first output line
after a match or no match when JIT-compiled code was actually
used.
- Note that there are pattern options that can override -s,
- either specifying no studying at all, or suppressing JIT com-
- pilation.
-
- If the /I or /D option is present on a pattern (requesting
- output about the compiled pattern), information about the
- result of studying is not included when studying is caused
- only by -s and neither -i nor -d is present on the command
- line. This behaviour means that the output from tests that
- are run with and without -s should be identical, except when
- options that output information about the actual running of a
- match are set.
-
- The -M, -t, and -tm options, which give information about
- resources used, are likely to produce different output with
- and without -s. Output may also differ if the /C option is
+ Note that there are pattern options that can override -s, ei-
+ ther specifying no studying at all, or suppressing JIT compi-
+ lation.
+
+ If the /I or /D option is present on a pattern (requesting
+ output about the compiled pattern), information about the re-
+ sult of studying is not included when studying is caused only
+ by -s and neither -i nor -d is present on the command line.
+ This behaviour means that the output from tests that are run
+ with and without -s should be identical, except when options
+ that output information about the actual running of a match
+ are set.
+
+ The -M, -t, and -tm options, which give information about re-
+ sources used, are likely to produce different output with and
+ without -s. Output may also differ if the /C option is
present on an individual pattern. This uses callouts to trace
- the the matching process, and this may be different between
- studied and non-studied patterns. If the pattern contains
- (*MARK) items there may also be differences, for the same
+ the the matching process, and this may be different between
+ studied and non-studied patterns. If the pattern contains
+ (*MARK) items there may also be differences, for the same
reason. The -s command line option can be overridden for spe-
- cific patterns that should never be studied (see the /S pat-
+ cific patterns that should never be studied (see the /S pat-
tern modifier below).
- -t Run each compile, study, and match many times with a timer,
- and output the resulting times per compile, study, or match
- (in milliseconds). Do not set -m with -t, because you will
+ -t Run each compile, study, and match many times with a timer,
+ and output the resulting times per compile, study, or match
+ (in milliseconds). Do not set -m with -t, because you will
then get the size output a zillion times, and the timing will
- be distorted. You can control the number of iterations that
+ be distorted. You can control the number of iterations that
are used for timing by following -t with a number (as a sepa-
- rate item on the command line). For example, "-t 1000" iter-
+ rate item on the command line). For example, "-t 1000" iter-
ates 1000 times. The default is to iterate 500000 times.
-tm This is like -t except that it times only the matching phase,
not the compile or study phases.
- -T -TM These behave like -t and -tm, but in addition, at the end of
+ -T -TM These behave like -t and -tm, but in addition, at the end of
a run, the total times for all compiles, studies, and matches
are output.
DESCRIPTION
- If pcretest is given two filename arguments, it reads from the first
+ If pcretest is given two filename arguments, it reads from the first
and writes to the second. If it is given only one filename argument, it
- reads from that file and writes to stdout. Otherwise, it reads from
- stdin and writes to stdout, and prompts for each line of input, using
+ reads from that file and writes to stdout. Otherwise, it reads from
+ stdin and writes to stdout, and prompts for each line of input, using
"re>" to prompt for regular expressions, and "data>" to prompt for data
lines.
- When pcretest is built, a configuration option can specify that it
- should be linked with the libreadline library. When this is done, if
+ When pcretest is built, a configuration option can specify that it
+ should be linked with the libreadline library. When this is done, if
the input is from a terminal, it is read using the readline() function.
- This provides line-editing and history facilities. The output from the
+ This provides line-editing and history facilities. The output from the
-help option states whether or not readline() will be used.
The program handles any number of sets of input on a single input file.
- Each set starts with a regular expression, and continues with any num-
+ Each set starts with a regular expression, and continues with any num-
ber of data lines to be matched against that pattern.
- Each data line is matched separately and independently. If you want to
+ Each data line is matched separately and independently. If you want to
do multi-line matches, you have to use the \n escape sequence (or \r or
\r\n, etc., depending on the newline setting) in a single line of input
- to encode the newline sequences. There is no limit on the length of
- data lines; the input buffer is automatically extended if it is too
+ to encode the newline sequences. There is no limit on the length of
+ data lines; the input buffer is automatically extended if it is too
small.
- An empty line signals the end of the data lines, at which point a new
- regular expression is read. The regular expressions are given enclosed
+ An empty line signals the end of the data lines, at which point a new
+ regular expression is read. The regular expressions are given enclosed
in any non-alphanumeric delimiters other than backslash, for example:
/(a|bc)x+yz/
- White space before the initial delimiter is ignored. A regular expres-
- sion may be continued over several input lines, in which case the new-
- line characters are included within it. It is possible to include the
+ White space before the initial delimiter is ignored. A regular expres-
+ sion may be continued over several input lines, in which case the new-
+ line characters are included within it. It is possible to include the
delimiter within the pattern by escaping it, for example
/abc\/def/
- If you do so, the escape and the delimiter form part of the pattern,
- but since delimiters are always non-alphanumeric, this does not affect
- its interpretation. If the terminating delimiter is immediately fol-
+ If you do so, the escape and the delimiter form part of the pattern,
+ but since delimiters are always non-alphanumeric, this does not affect
+ its interpretation. If the terminating delimiter is immediately fol-
lowed by a backslash, for example,
/abc/\
- then a backslash is added to the end of the pattern. This is done to
- provide a way of testing the error condition that arises if a pattern
+ then a backslash is added to the end of the pattern. This is done to
+ provide a way of testing the error condition that arises if a pattern
finishes with a backslash, because
/abc\/
- is interpreted as the first line of a pattern that starts with "abc/",
+ is interpreted as the first line of a pattern that starts with "abc/",
causing pcretest to read the next line as a continuation of the regular
expression.
PATTERN MODIFIERS
- A pattern may be followed by any number of modifiers, which are mostly
- single characters, though some of these can be qualified by further
- characters. Following Perl usage, these are referred to below as, for
- example, "the /i modifier", even though the delimiter of the pattern
- need not always be a slash, and no slash is used when writing modi-
- fiers. White space may appear between the final pattern delimiter and
- the first modifier, and between the modifiers themselves. For refer-
- ence, here is a complete list of modifiers. They fall into several
+ A pattern may be followed by any number of modifiers, which are mostly
+ single characters, though some of these can be qualified by further
+ characters. Following Perl usage, these are referred to below as, for
+ example, "the /i modifier", even though the delimiter of the pattern
+ need not always be a slash, and no slash is used when writing modi-
+ fiers. White space may appear between the final pattern delimiter and
+ the first modifier, and between the modifiers themselves. For refer-
+ ence, here is a complete list of modifiers. They fall into several
groups that are described in detail in the following sections.
/8 set UTF mode
@@ -347,8 +344,8 @@ PATTERN MODIFIERS
Perl-compatible modifiers
The /i, /m, /s, and /x modifiers set the PCRE_CASELESS, PCRE_MULTILINE,
- PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when
- pcre[16|32]_compile() is called. These four modifier letters have the
+ PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when
+ pcre[16|32]_compile() is called. These four modifier letters have the
same effect as they do in Perl. For example:
/caseless/i
@@ -356,7 +353,7 @@ PATTERN MODIFIERS
Modifiers for other PCRE options
- The following table shows additional modifiers for setting PCRE com-
+ The following table shows additional modifiers for setting PCRE com-
pile-time options that do not correspond to anything in Perl:
/8 PCRE_UTF8 ) when using the 8-bit
@@ -389,145 +386,145 @@ PATTERN MODIFIERS
/<bsr_unicode> PCRE_BSR_UNICODE
/<JS> PCRE_JAVASCRIPT_COMPAT
- The modifiers that are enclosed in angle brackets are literal strings
- as shown, including the angle brackets, but the letters within can be
- in either case. This example sets multiline matching with CRLF as the
+ The modifiers that are enclosed in angle brackets are literal strings
+ as shown, including the angle brackets, but the letters within can be
+ in either case. This example sets multiline matching with CRLF as the
line ending sequence:
/^abc/m<CRLF>
- As well as turning on the PCRE_UTF8/16/32 option, the /8 modifier
- causes all non-printing characters in output strings to be printed
- using the \x{hh...} notation. Otherwise, those less than 0x100 are out-
- put in hex without the curly brackets.
+ As well as turning on the PCRE_UTF8/16/32 option, the /8 modifier
+ causes all non-printing characters in output strings to be printed us-
+ ing the \x{hh...} notation. Otherwise, those less than 0x100 are output
+ in hex without the curly brackets.
- Full details of the PCRE options are given in the pcreapi documenta-
+ Full details of the PCRE options are given in the pcreapi documenta-
tion.
Finding all matches in a string
- Searching for all possible matches within each subject string can be
- requested by the /g or /G modifier. After finding a match, PCRE is
+ Searching for all possible matches within each subject string can be
+ requested by the /g or /G modifier. After finding a match, PCRE is
called again to search the remainder of the subject string. The differ-
ence between /g and /G is that the former uses the startoffset argument
- to pcre[16|32]_exec() to start searching at a new point within the
- entire string (which is in effect what Perl does), whereas the latter
- passes over a shortened substring. This makes a difference to the
- matching process if the pattern begins with a lookbehind assertion
- (including \b or \B).
-
- If any call to pcre[16|32]_exec() in a /g or /G sequence matches an
- empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
- PCRE_ANCHORED flags set in order to search for another, non-empty,
- match at the same point. If this second match fails, the start offset
- is advanced, and the normal match is retried. This imitates the way
+ to pcre[16|32]_exec() to start searching at a new point within the en-
+ tire string (which is in effect what Perl does), whereas the latter
+ passes over a shortened substring. This makes a difference to the
+ matching process if the pattern begins with a lookbehind assertion (in-
+ cluding \b or \B).
+
+ If any call to pcre[16|32]_exec() in a /g or /G sequence matches an
+ empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
+ PCRE_ANCHORED flags set in order to search for another, non-empty,
+ match at the same point. If this second match fails, the start offset
+ is advanced, and the normal match is retried. This imitates the way
Perl handles such cases when using the /g modifier or the split() func-
- tion. Normally, the start offset is advanced by one character, but if
- the newline convention recognizes CRLF as a newline, and the current
+ tion. Normally, the start offset is advanced by one character, but if
+ the newline convention recognizes CRLF as a newline, and the current
character is CR followed by LF, an advance of two is used.
Other modifiers
There are yet more modifiers for controlling the way pcretest operates.
- The /+ modifier requests that as well as outputting the substring that
- matched the entire pattern, pcretest should in addition output the
- remainder of the subject string. This is useful for tests where the
- subject contains multiple copies of the same substring. If the + modi-
- fier appears twice, the same action is taken for captured substrings.
- In each case the remainder is output on the following line with a plus
- character following the capture number. Note that this modifier must
- not immediately follow the /S modifier because /S+ and /S++ have other
+ The /+ modifier requests that as well as outputting the substring that
+ matched the entire pattern, pcretest should in addition output the re-
+ mainder of the subject string. This is useful for tests where the sub-
+ ject contains multiple copies of the same substring. If the + modifier
+ appears twice, the same action is taken for captured substrings. In
+ each case the remainder is output on the following line with a plus
+ character following the capture number. Note that this modifier must
+ not immediately follow the /S modifier because /S+ and /S++ have other
meanings.
- The /= modifier requests that the values of all potential captured
- parentheses be output after a match. By default, only those up to the
+ The /= modifier requests that the values of all potential captured
+ parentheses be output after a match. By default, only those up to the
highest one actually used in the match are output (corresponding to the
return code from pcre[16|32]_exec()). Values in the offsets vector cor-
- responding to higher numbers should be set to -1, and these are output
- as "<unset>". This modifier gives a way of checking that this is hap-
+ responding to higher numbers should be set to -1, and these are output
+ as "<unset>". This modifier gives a way of checking that this is hap-
pening.
- The /B modifier is a debugging feature. It requests that pcretest out-
- put a representation of the compiled code after compilation. Normally
- this information contains length and offset values; however, if /Z is
- also present, this data is replaced by spaces. This is a special fea-
- ture for use in the automatic test scripts; it ensures that the same
+ The /B modifier is a debugging feature. It requests that pcretest out-
+ put a representation of the compiled code after compilation. Normally
+ this information contains length and offset values; however, if /Z is
+ also present, this data is replaced by spaces. This is a special fea-
+ ture for use in the automatic test scripts; it ensures that the same
output is generated for different internal link sizes.
- The /D modifier is a PCRE debugging feature, and is equivalent to /BI,
+ The /D modifier is a PCRE debugging feature, and is equivalent to /BI,
that is, both the /B and the /I modifiers.
- The /F modifier causes pcretest to flip the byte order of the 2-byte
+ The /F modifier causes pcretest to flip the byte order of the 2-byte
and 4-byte fields in the compiled pattern. This facility is for testing
- the feature in PCRE that allows it to execute patterns that were com-
+ the feature in PCRE that allows it to execute patterns that were com-
piled on a host with a different endianness. This feature is not avail-
- able when the POSIX interface to PCRE is being used, that is, when the
+ able when the POSIX interface to PCRE is being used, that is, when the
/P pattern modifier is specified. See also the section about saving and
reloading compiled patterns below.
- The /I modifier requests that pcretest output information about the
- compiled pattern (whether it is anchored, has a fixed first character,
- and so on). It does this by calling pcre[16|32]_fullinfo() after com-
- piling a pattern. If the pattern is studied, the results of that are
+ The /I modifier requests that pcretest output information about the
+ compiled pattern (whether it is anchored, has a fixed first character,
+ and so on). It does this by calling pcre[16|32]_fullinfo() after com-
+ piling a pattern. If the pattern is studied, the results of that are
also output. In this output, the word "char" means a non-UTF character,
- that is, the value of a single data item (8-bit, 16-bit, or 32-bit,
- depending on the library that is being tested).
-
- The /K modifier requests pcretest to show names from backtracking con-
- trol verbs that are returned from calls to pcre[16|32]_exec(). It
- causes pcretest to create a pcre[16|32]_extra block if one has not
- already been created by a call to pcre[16|32]_study(), and to set the
- PCRE_EXTRA_MARK flag and the mark field within it, every time that
- pcre[16|32]_exec() is called. If the variable that the mark field
- points to is non-NULL for a match, non-match, or partial match,
- pcretest prints the string to which it points. For a match, this is
- shown on a line by itself, tagged with "MK:". For a non-match it is
+ that is, the value of a single data item (8-bit, 16-bit, or 32-bit, de-
+ pending on the library that is being tested).
+
+ The /K modifier requests pcretest to show names from backtracking con-
+ trol verbs that are returned from calls to pcre[16|32]_exec(). It
+ causes pcretest to create a pcre[16|32]_extra block if one has not al-
+ ready been created by a call to pcre[16|32]_study(), and to set the
+ PCRE_EXTRA_MARK flag and the mark field within it, every time that
+ pcre[16|32]_exec() is called. If the variable that the mark field
+ points to is non-NULL for a match, non-match, or partial match,
+ pcretest prints the string to which it points. For a match, this is
+ shown on a line by itself, tagged with "MK:". For a non-match it is
added to the message.
- The /L modifier must be followed directly by the name of a locale, for
+ The /L modifier must be followed directly by the name of a locale, for
example,
/pattern/Lfr_FR
For this reason, it must be the last modifier. The given locale is set,
- pcre[16|32]_maketables() is called to build a set of character tables
- for the locale, and this is then passed to pcre[16|32]_compile() when
- compiling the regular expression. Without an /L (or /T) modifier, NULL
- is passed as the tables pointer; that is, /L applies only to the
- expression on which it appears.
-
- The /M modifier causes the size in bytes of the memory block used to
- hold the compiled pattern to be output. This does not include the size
- of the pcre[16|32] block; it is just the actual compiled data. If the
+ pcre[16|32]_maketables() is called to build a set of character tables
+ for the locale, and this is then passed to pcre[16|32]_compile() when
+ compiling the regular expression. Without an /L (or /T) modifier, NULL
+ is passed as the tables pointer; that is, /L applies only to the ex-
+ pression on which it appears.
+
+ The /M modifier causes the size in bytes of the memory block used to
+ hold the compiled pattern to be output. This does not include the size
+ of the pcre[16|32] block; it is just the actual compiled data. If the
pattern is successfully studied with the PCRE_STUDY_JIT_COMPILE option,
the size of the JIT compiled code is also output.
The /Q modifier is used to test the use of pcre_stack_guard. It must be
- followed by '0' or '1', specifying the return code to be given from an
- external function that is passed to PCRE and used for stack checking
+ followed by '0' or '1', specifying the return code to be given from an
+ external function that is passed to PCRE and used for stack checking
during compilation (see the pcreapi documentation for details).
- The /S modifier causes pcre[16|32]_study() to be called after the
- expression has been compiled, and the results used when the expression
- is matched. There are a number of qualifying characters that may follow
+ The /S modifier causes pcre[16|32]_study() to be called after the ex-
+ pression has been compiled, and the results used when the expression is
+ matched. There are a number of qualifying characters that may follow
/S. They may appear in any order.
If /S is followed by an exclamation mark, pcre[16|32]_study() is called
- with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
+ with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
pcre_extra block, even when studying discovers no useful information.
If /S is followed by a second S character, it suppresses studying, even
- if it was requested externally by the -s command line option. This
- makes it possible to specify that certain patterns are always studied,
+ if it was requested externally by the -s command line option. This
+ makes it possible to specify that certain patterns are always studied,
and others are never studied, independently of -s. This feature is used
in the test files in a few cases where the output is different when the
pattern is studied.
- If the /S modifier is followed by a + character, the call to
- pcre[16|32]_study() is made with all the JIT study options, requesting
- just-in-time optimization support if it is available, for both normal
- and partial matching. If you want to restrict the JIT compiling modes,
+ If the /S modifier is followed by a + character, the call to
+ pcre[16|32]_study() is made with all the JIT study options, requesting
+ just-in-time optimization support if it is available, for both normal
+ and partial matching. If you want to restrict the JIT compiling modes,
you can follow /S+ with a digit in the range 1 to 7:
1 normal match only
@@ -538,40 +535,40 @@ PATTERN MODIFIERS
7 all three modes (default)
If /S++ is used instead of /S+ (with or without a following digit), the
- text "(JIT)" is added to the first output line after a match or no
+ text "(JIT)" is added to the first output line after a match or no
match when JIT-compiled code was actually used.
- Note that there is also an independent /+ modifier; it must not be
+ Note that there is also an independent /+ modifier; it must not be
given immediately after /S or /S+ because this will be misinterpreted.
If JIT studying is successful, the compiled JIT code will automatically
- be used when pcre[16|32]_exec() is run, except when incompatible run-
- time options are specified. For more details, see the pcrejit documen-
- tation. See also the \J escape sequence below for a way of setting the
+ be used when pcre[16|32]_exec() is run, except when incompatible run-
+ time options are specified. For more details, see the pcrejit documen-
+ tation. See also the \J escape sequence below for a way of setting the
size of the JIT stack.
- Finally, if /S is followed by a minus character, JIT compilation is
- suppressed, even if it was requested externally by the -s command line
- option. This makes it possible to specify that JIT is never to be used
+ Finally, if /S is followed by a minus character, JIT compilation is
+ suppressed, even if it was requested externally by the -s command line
+ option. This makes it possible to specify that JIT is never to be used
for certain patterns.
- The /T modifier must be followed by a single digit. It causes a spe-
+ The /T modifier must be followed by a single digit. It causes a spe-
cific set of built-in character tables to be passed to pcre[16|32]_com-
- pile(). It is used in the standard PCRE tests to check behaviour with
+ pile(). It is used in the standard PCRE tests to check behaviour with
different character tables. The digit specifies the tables as follows:
0 the default ASCII tables, as distributed in
pcre_chartables.c.dist
1 a set of tables defining ISO 8859 characters
- In table 1, some characters whose codes are greater than 128 are iden-
+ In table 1, some characters whose codes are greater than 128 are iden-
tified as letters, digits, spaces, etc.
Using the POSIX wrapper API
- The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
- rather than its native API. This supports only the 8-bit library. When
- /P is set, the following modifiers set options for the regcomp() func-
+ The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
+ rather than its native API. This supports only the 8-bit library. When
+ /P is set, the following modifiers set options for the regcomp() func-
tion:
/i REG_ICASE
@@ -582,48 +579,48 @@ PATTERN MODIFIERS
/W REG_UCP ) the POSIX standard
/8 REG_UTF8 )
- The /+ modifier works as described above. All other modifiers are
- ignored.
+ The /+ modifier works as described above. All other modifiers are ig-
+ nored.
Locking out certain modifiers
- PCRE can be compiled with or without support for certain features such
- as UTF-8/16/32 or Unicode properties. Accordingly, the standard tests
- are split up into a number of different files that are selected for
- running depending on which features are available. When updating the
+ PCRE can be compiled with or without support for certain features such
+ as UTF-8/16/32 or Unicode properties. Accordingly, the standard tests
+ are split up into a number of different files that are selected for
+ running depending on which features are available. When updating the
tests, it is all too easy to put a new test into the wrong file by mis-
- take; for example, to put a test that requires UTF support into a file
- that is used when it is not available. To help detect such mistakes as
- early as possible, there is a facility for locking out specific modi-
+ take; for example, to put a test that requires UTF support into a file
+ that is used when it is not available. To help detect such mistakes as
+ early as possible, there is a facility for locking out specific modi-
fiers. If an input line for pcretest starts with the string "< forbid "
- the following sequence of characters is taken as a list of forbidden
+ the following sequence of characters is taken as a list of forbidden
modifiers. For example, in the test files that must not use UTF or Uni-
code property support, this line appears:
< forbid 8W
- This locks out the /8 and /W modifiers. An immediate error is given if
- they are subsequently encountered. If the character string contains <
- but not >, all the multi-character modifiers that begin with < are
- locked out. Otherwise, such modifiers must be explicitly listed, for
+ This locks out the /8 and /W modifiers. An immediate error is given if
+ they are subsequently encountered. If the character string contains <
+ but not >, all the multi-character modifiers that begin with < are
+ locked out. Otherwise, such modifiers must be explicitly listed, for
example:
< forbid <JS><cr>
There must be a single space between < and "forbid" for this feature to
- be recognised. If there is not, the line is interpreted either as a
- request to re-load a pre-compiled pattern (see "SAVING AND RELOADING
- COMPILED PATTERNS" below) or, if there is a another < character, as a
- pattern that uses < as its delimiter.
+ be recognised. If there is not, the line is interpreted either as a re-
+ quest to re-load a pre-compiled pattern (see "SAVING AND RELOADING COM-
+ PILED PATTERNS" below) or, if there is a another < character, as a pat-
+ tern that uses < as its delimiter.
DATA LINES
- Before each data line is passed to pcre[16|32]_exec(), leading and
- trailing white space is removed, and it is then scanned for \ escapes.
- Some of these are pretty esoteric features, intended for checking out
- some of the more complicated features of PCRE. If you are just testing
- "ordinary" regular expressions, you probably don't need any of these.
+ Before each data line is passed to pcre[16|32]_exec(), leading and
+ trailing white space is removed, and it is then scanned for \ escapes.
+ Some of these are pretty esoteric features, intended for checking out
+ some of the more complicated features of PCRE. If you are just testing
+ "ordinary" regular expressions, you probably don't need any of these.
The following escapes are recognized:
\a alarm (BEL, \x07)
@@ -684,7 +681,7 @@ DATA LINES
(any number of digits)
\R pass the PCRE_DFA_RESTART option to pcre[16|32]_dfa_exec()
\S output details of memory get/free calls during matching
- \Y pass the PCRE_NO_START_OPTIMIZE option to
+ \Y pass the PCRE_NO_START_OPTIMIZE option to
pcre[16|32]_exec()
or pcre[16|32]_dfa_exec()
\Z pass the PCRE_NOTEOL option to pcre[16|32]_exec()
@@ -693,7 +690,7 @@ DATA LINES
pcre[16|32]_exec() or pcre[16|32]_dfa_exec()
\>dd start the match at offset dd (optional "-"; then
any number of digits); this sets the startoffset
- argument for pcre[16|32]_exec() or
+ argument for pcre[16|32]_exec() or
pcre[16|32]_dfa_exec()
\<cr> pass the PCRE_NEWLINE_CR option to pcre[16|32]_exec()
or pcre[16|32]_dfa_exec()
@@ -706,103 +703,102 @@ DATA LINES
\<any> pass the PCRE_NEWLINE_ANY option to pcre[16|32]_exec()
or pcre[16|32]_dfa_exec()
- The use of \x{hh...} is not dependent on the use of the /8 modifier on
- the pattern. It is recognized always. There may be any number of hexa-
- decimal digits inside the braces; invalid values provoke error mes-
+ The use of \x{hh...} is not dependent on the use of the /8 modifier on
+ the pattern. It is recognized always. There may be any number of hexa-
+ decimal digits inside the braces; invalid values provoke error mes-
sages.
- Note that \xhh specifies one byte rather than one character in UTF-8
- mode; this makes it possible to construct invalid UTF-8 sequences for
- testing purposes. On the other hand, \x{hh} is interpreted as a UTF-8
- character in UTF-8 mode, generating more than one byte if the value is
- greater than 127. When testing the 8-bit library not in UTF-8 mode,
+ Note that \xhh specifies one byte rather than one character in UTF-8
+ mode; this makes it possible to construct invalid UTF-8 sequences for
+ testing purposes. On the other hand, \x{hh} is interpreted as a UTF-8
+ character in UTF-8 mode, generating more than one byte if the value is
+ greater than 127. When testing the 8-bit library not in UTF-8 mode,
\x{hh} generates one byte for values less than 256, and causes an error
for greater values.
In UTF-16 mode, all 4-digit \x{hhhh} values are accepted. This makes it
possible to construct invalid UTF-16 sequences for testing purposes.
- In UTF-32 mode, all 4- to 8-digit \x{...} values are accepted. This
- makes it possible to construct invalid UTF-32 sequences for testing
+ In UTF-32 mode, all 4- to 8-digit \x{...} values are accepted. This
+ makes it possible to construct invalid UTF-32 sequences for testing
purposes.
- The escapes that specify line ending sequences are literal strings,
- exactly as shown. No more than one newline setting should be present in
+ The escapes that specify line ending sequences are literal strings, ex-
+ actly as shown. No more than one newline setting should be present in
any data line.
- A backslash followed by anything else just escapes the anything else.
- If the very last character is a backslash, it is ignored. This gives a
- way of passing an empty line as data, since a real empty line termi-
+ A backslash followed by anything else just escapes the anything else.
+ If the very last character is a backslash, it is ignored. This gives a
+ way of passing an empty line as data, since a real empty line termi-
nates the data input.
- The \J escape provides a way of setting the maximum stack size that is
- used by the just-in-time optimization code. It is ignored if JIT opti-
- mization is not being used. Providing a stack that is larger than the
+ The \J escape provides a way of setting the maximum stack size that is
+ used by the just-in-time optimization code. It is ignored if JIT opti-
+ mization is not being used. Providing a stack that is larger than the
default 32K is necessary only for very complicated patterns.
If \M is present, pcretest calls pcre[16|32]_exec() several times, with
different values in the match_limit and match_limit_recursion fields of
- the pcre[16|32]_extra data structure, until it finds the minimum num-
+ the pcre[16|32]_extra data structure, until it finds the minimum num-
bers for each parameter that allow pcre[16|32]_exec() to complete with-
- out error. Because this is testing a specific feature of the normal
- interpretive pcre[16|32]_exec() execution, the use of any JIT optimiza-
- tion that might have been set up by the /S+ qualifier of -s+ option is
+ out error. Because this is testing a specific feature of the normal in-
+ terpretive pcre[16|32]_exec() execution, the use of any JIT optimiza-
+ tion that might have been set up by the /S+ qualifier of -s+ option is
disabled.
- The match_limit number is a measure of the amount of backtracking that
- takes place, and checking it out can be instructive. For most simple
- matches, the number is quite small, but for patterns with very large
- numbers of matching possibilities, it can become large very quickly
- with increasing length of subject string. The match_limit_recursion
- number is a measure of how much stack (or, if PCRE is compiled with
- NO_RECURSE, how much heap) memory is needed to complete the match
- attempt.
+ The match_limit number is a measure of the amount of backtracking that
+ takes place, and checking it out can be instructive. For most simple
+ matches, the number is quite small, but for patterns with very large
+ numbers of matching possibilities, it can become large very quickly
+ with increasing length of subject string. The match_limit_recursion
+ number is a measure of how much stack (or, if PCRE is compiled with
+ NO_RECURSE, how much heap) memory is needed to complete the match at-
+ tempt.
- When \O is used, the value specified may be higher or lower than the
+ When \O is used, the value specified may be higher or lower than the
size set by the -O command line option (or defaulted to 45); \O applies
- only to the call of pcre[16|32]_exec() for the line in which it
- appears.
+ only to the call of pcre[16|32]_exec() for the line in which it ap-
+ pears.
- If the /P modifier was present on the pattern, causing the POSIX wrap-
- per API to be used, the only option-setting sequences that have any
- effect are \B, \N, and \Z, causing REG_NOTBOL, REG_NOTEMPTY, and
- REG_NOTEOL, respectively, to be passed to regexec().
+ If the /P modifier was present on the pattern, causing the POSIX wrap-
+ per API to be used, the only option-setting sequences that have any ef-
+ fect are \B, \N, and \Z, causing REG_NOTBOL, REG_NOTEMPTY, and REG_NO-
+ TEOL, respectively, to be passed to regexec().
THE ALTERNATIVE MATCHING FUNCTION
- By default, pcretest uses the standard PCRE matching function,
- pcre[16|32]_exec() to match each data line. PCRE also supports an
- alternative matching function, pcre[16|32]_dfa_test(), which operates
- in a different way, and has some restrictions. The differences between
- the two functions are described in the pcrematching documentation.
+ By default, pcretest uses the standard PCRE matching function,
+ pcre[16|32]_exec() to match each data line. PCRE also supports an al-
+ ternative matching function, pcre[16|32]_dfa_test(), which operates in
+ a different way, and has some restrictions. The differences between the
+ two functions are described in the pcrematching documentation.
- If a data line contains the \D escape sequence, or if the command line
- contains the -dfa option, the alternative matching function is used.
+ If a data line contains the \D escape sequence, or if the command line
+ contains the -dfa option, the alternative matching function is used.
This function finds all possible matches at a given point. If, however,
- the \F escape sequence is present in the data line, it stops after the
+ the \F escape sequence is present in the data line, it stops after the
first match is found. This is always the shortest possible match.
DEFAULT OUTPUT FROM PCRETEST
- This section describes the output when the normal matching function,
+ This section describes the output when the normal matching function,
pcre[16|32]_exec(), is being used.
When a match succeeds, pcretest outputs the list of captured substrings
- that pcre[16|32]_exec() returns, starting with number 0 for the string
- that matched the whole pattern. Otherwise, it outputs "No match" when
- the return is PCRE_ERROR_NOMATCH, and "Partial match:" followed by the
- partially matching substring when pcre[16|32]_exec() returns
- PCRE_ERROR_PARTIAL. (Note that this is the entire substring that was
- inspected during the partial match; it may include characters before
- the actual match start if a lookbehind assertion, \K, \b, or \B was
- involved.) For any other return, pcretest outputs the PCRE negative
- error number and a short descriptive phrase. If the error is a failed
- UTF string check, the offset of the start of the failing character and
- the reason code are also output, provided that the size of the output
- vector is at least two. Here is an example of an interactive pcretest
- run.
+ that pcre[16|32]_exec() returns, starting with number 0 for the string
+ that matched the whole pattern. Otherwise, it outputs "No match" when
+ the return is PCRE_ERROR_NOMATCH, and "Partial match:" followed by the
+ partially matching substring when pcre[16|32]_exec() returns PCRE_ER-
+ ROR_PARTIAL. (Note that this is the entire substring that was inspected
+ during the partial match; it may include characters before the actual
+ match start if a lookbehind assertion, \K, \b, or \B was involved.) For
+ any other return, pcretest outputs the PCRE negative error number and a
+ short descriptive phrase. If the error is a failed UTF string check,
+ the offset of the start of the failing character and the reason code
+ are also output, provided that the size of the output vector is at
+ least two. Here is an example of an interactive pcretest run.
$ pcretest
PCRE version 8.13 2011-04-30
@@ -892,9 +888,9 @@ OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
(Using the normal matching function on this data finds only "tang".)
The longest matching string is always given first (and numbered zero).
After a PCRE_ERROR_PARTIAL return, the output is "Partial match:", fol-
- lowed by the partially matching substring. (Note that this is the
- entire substring that was inspected during the partial match; it may
- include characters before the actual match start if a lookbehind asser-
+ lowed by the partially matching substring. (Note that this is the en-
+ tire substring that was inspected during the partial match; it may in-
+ clude characters before the actual match start if a lookbehind asser-
tion, \K, \b, or \B was involved.)
If /g is present on the pattern, the search for further matches resumes
@@ -909,9 +905,9 @@ OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
1: tan
0: tan
- Since the matching function does not support substring capture, the
- escape sequences that are concerned with captured substrings are not
- relevant.
+ Since the matching function does not support substring capture, the es-
+ cape sequences that are concerned with captured substrings are not rel-
+ evant.
RESTARTING AFTER A PARTIAL MATCH
@@ -942,9 +938,9 @@ CALLOUTS
--->pqrabcdef
0 ^ ^ \d
- This output indicates that callout number 0 occurred for a match
- attempt starting at the fourth character of the subject string, when
- the pointer was at the seventh character of the data, and when the next
+ This output indicates that callout number 0 occurred for a match at-
+ tempt starting at the fourth character of the subject string, when the
+ pointer was at the seventh character of the data, and when the next
pattern item was \d. Just one circumflex is output if the start and
current positions are the same.
@@ -963,8 +959,8 @@ CALLOUTS
0: E*
If a pattern contains (*MARK) items, an additional line is output when-
- ever a change of latest mark is passed to the callout function. For
- example:
+ ever a change of latest mark is passed to the callout function. For ex-
+ ample:
re> /a(*MARK:X)bc/C
data> abc
@@ -999,8 +995,8 @@ NON-PRINTING CHARACTERS
When pcretest is outputting text that is a matched part of a subject
string, it behaves in the same way, unless a different locale has been
- set for the pattern (using the /L modifier). In this case, the
- isprint() function to distinguish printing and non-printing characters.
+ set for the pattern (using the /L modifier). In this case, the is-
+ print() function to distinguish printing and non-printing characters.
SAVING AND RELOADING COMPILED PATTERNS
@@ -1020,14 +1016,14 @@ SAVING AND RELOADING COMPILED PATTERNS
studied with JIT optimization, the JIT data cannot be saved.
The data that is written is binary. The first eight bytes are the
- length of the compiled pattern data followed by the length of the
- optional study data, each written as four bytes in big-endian order
- (most significant byte first). If there is no study data (either the
- pattern was not studied, or studying did not return any data), the sec-
- ond length is zero. The lengths are followed by an exact copy of the
- compiled pattern. If there is additional study data, this (excluding
- any JIT data) follows immediately after the compiled pattern. After
- writing the file, pcretest expects to read a new pattern.
+ length of the compiled pattern data followed by the length of the op-
+ tional study data, each written as four bytes in big-endian order (most
+ significant byte first). If there is no study data (either the pattern
+ was not studied, or studying did not return any data), the second
+ length is zero. The lengths are followed by an exact copy of the com-
+ piled pattern. If there is additional study data, this (excluding any
+ JIT data) follows immediately after the compiled pattern. After writing
+ the file, pcretest expects to read a new pattern.
A saved pattern can be reloaded into pcretest by specifying < and a
file name instead of a pattern. There must be no space between < and
@@ -1066,10 +1062,10 @@ SAVING AND RELOADING COMPILED PATTERNS
ing and experimentation. It is not intended for production use because
only a single pattern can be written to a file. Furthermore, there is
no facility for supplying custom character tables for use with a
- reloaded pattern. If the original pattern was compiled with custom
- tables, an attempt to match a subject string using a reloaded pattern
- is likely to cause pcretest to crash. Finally, if you attempt to load
- a file that is not in the correct format, the result is undefined.
+ reloaded pattern. If the original pattern was compiled with custom ta-
+ bles, an attempt to match a subject string using a reloaded pattern is
+ likely to cause pcretest to crash. Finally, if you attempt to load a
+ file that is not in the correct format, the result is undefined.
SEE ALSO
@@ -1087,5 +1083,5 @@ AUTHOR
REVISION
- Last updated: 23 February 2017
- Copyright (c) 1997-2017 University of Cambridge.
+ Last updated: 10 February 2020
+ Copyright (c) 1997-2020 University of Cambridge.
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index 734875de2fb..cc174044545 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2018 University of Cambridge
+ Copyright (c) 1997-2020 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ COMPILE_PCREx macro will already be appropriately set. */
/* Macro for setting individual bits in class bitmaps. */
-#define SETBIT(a,b) a[(b)/8] |= (1 << ((b)&7))
+#define SETBIT(a,b) a[(b)/8] |= (1U << ((b)&7))
/* Maximum length value to check against when making sure that the integer that
holds the compiled pattern length does not overflow. We make it a bit less than
@@ -129,8 +129,8 @@ overrun before it actually does run off the end of the data block. */
/* Private flags added to firstchar and reqchar. */
-#define REQ_CASELESS (1 << 0) /* Indicates caselessness */
-#define REQ_VARY (1 << 1) /* Reqchar followed non-literal item */
+#define REQ_CASELESS (1U << 0) /* Indicates caselessness */
+#define REQ_VARY (1U << 1) /* Reqchar followed non-literal item */
/* Negative values for the firstchar and reqchar flags */
#define REQ_UNSET (-2)
#define REQ_NONE (-1)
@@ -3612,7 +3612,7 @@ for(;;)
if (chr > 255) break;
class_bitset = (pcre_uint8 *)
((list_ptr == list ? code : base_end) - list_ptr[2]);
- if ((class_bitset[chr >> 3] & (1 << (chr & 7))) != 0) return FALSE;
+ if ((class_bitset[chr >> 3] & (1U << (chr & 7))) != 0) return FALSE;
break;
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
@@ -7133,17 +7133,19 @@ for (;; ptr++)
int n = 0;
ptr++;
while(IS_DIGIT(*ptr))
+ {
n = n * 10 + *ptr++ - CHAR_0;
+ if (n > 255)
+ {
+ *errorcodeptr = ERR38;
+ goto FAILED;
+ }
+ }
if (*ptr != CHAR_RIGHT_PARENTHESIS)
{
*errorcodeptr = ERR39;
goto FAILED;
}
- if (n > 255)
- {
- *errorcodeptr = ERR38;
- goto FAILED;
- }
*code++ = n;
PUT(code, 0, (int)(ptr - cd->start_pattern + 1)); /* Pattern offset */
PUT(code, LINK_SIZE, 0); /* Default length */
@@ -7459,7 +7461,7 @@ for (;; ptr++)
{
open_capitem *oc;
recno = GET2(slot, 0);
- cd->backref_map |= (recno < 32)? (1 << recno) : 1;
+ cd->backref_map |= (recno < 32)? (1U << recno) : 1;
if (recno > cd->top_backref) cd->top_backref = recno;
/* Check to see if this back reference is recursive, that it, it
@@ -8070,7 +8072,7 @@ for (;; ptr++)
item_hwm_offset = cd->hwm - cd->start_workspace;
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
PUT2INC(code, 0, recno);
- cd->backref_map |= (recno < 32)? (1 << recno) : 1;
+ cd->backref_map |= (recno < 32)? (1U << recno) : 1;
if (recno > cd->top_backref) cd->top_backref = recno;
/* Check to see if this back reference is recursive, that it, it
@@ -8683,7 +8685,7 @@ do {
op == OP_SCBRA || op == OP_SCBRAPOS)
{
int n = GET2(scode, 1+LINK_SIZE);
- int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
+ int new_map = bracket_map | ((n < 32)? (1U << n) : 1);
if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE;
}
@@ -8811,7 +8813,7 @@ do {
op == OP_SCBRA || op == OP_SCBRAPOS)
{
int n = GET2(scode, 1+LINK_SIZE);
- int new_map = bracket_map | ((n < 32)? (1 << n) : 1);
+ int new_map = bracket_map | ((n < 32)? (1U << n) : 1);
if (!is_startline(scode, new_map, cd, atomcount, inassert)) return FALSE;
}
diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c
index bc5f9c01433..4dcf8fc2189 100644
--- a/pcre/pcre_jit_compile.c
+++ b/pcre/pcre_jit_compile.c
@@ -3938,10 +3938,10 @@ static sljit_s32 character_to_int32(pcre_uchar chr)
sljit_s32 value = (sljit_s32)chr;
#if defined COMPILE_PCRE8
#define SSE2_COMPARE_TYPE_INDEX 0
-return (value << 24) | (value << 16) | (value << 8) | value;
+return ((unsigned int)value << 24) | ((unsigned int)value << 16) | ((unsigned int)value << 8) | (unsigned int)value;
#elif defined COMPILE_PCRE16
#define SSE2_COMPARE_TYPE_INDEX 1
-return (value << 16) | value;
+return ((unsigned int)value << 16) | value;
#elif defined COMPILE_PCRE32
#define SSE2_COMPARE_TYPE_INDEX 2
return value;
@@ -8507,7 +8507,7 @@ if (opcode == OP_ONCE)
/* We temporarily encode the needs_control_head in the lowest bit.
Note: on the target architectures of SLJIT the ((x << 1) >> 1) returns
the same value for small signed numbers (including negative numbers). */
- BACKTRACK_AS(bracket_backtrack)->u.framesize = (BACKTRACK_AS(bracket_backtrack)->u.framesize << 1) | (needs_control_head ? 1 : 0);
+ BACKTRACK_AS(bracket_backtrack)->u.framesize = ((unsigned int)BACKTRACK_AS(bracket_backtrack)->u.framesize << 1) | (needs_control_head ? 1 : 0);
}
return cc + repeat_length;
}
diff --git a/pcre/pcrecpp.cc b/pcre/pcrecpp.cc
index 77a2fedc4be..ce289afafb8 100644
--- a/pcre/pcrecpp.cc
+++ b/pcre/pcrecpp.cc
@@ -66,7 +66,8 @@ Arg RE::no_arg((void*)NULL);
// inclusive test if we ever needed it. (Note that not only the
// __attribute__ syntax, but also __USER_LABEL_PREFIX__, are
// gnu-specific.)
-#if defined(__GNUC__) && __GNUC__ >= 3 && defined(__ELF__) && !defined(__INTEL_COMPILER)
+#if defined(__GNUC__) && __GNUC__ >= 3 && defined(__ELF__) \
+ && !defined(__INTEL_COMPILER) && !defined(__LCC__)
# define ULP_AS_STRING(x) ULP_AS_STRING_INTERNAL(x)
# define ULP_AS_STRING_INTERNAL(x) #x
# define USER_LABEL_PREFIX_STR ULP_AS_STRING(__USER_LABEL_PREFIX__)
@@ -91,6 +92,7 @@ static const char *start_options[] = {
"(*LIMIT_RECURSION=",
"(*LIMIT_MATCH=",
"(*CRLF)",
+ "(*LF)",
"(*CR)",
"(*BSR_UNICODE)",
"(*BSR_ANYCRLF)",
diff --git a/pcre/pcreposix.c b/pcre/pcreposix.c
index a76d6bfca45..3042d763539 100644
--- a/pcre/pcreposix.c
+++ b/pcre/pcreposix.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2018 University of Cambridge
+ Copyright (c) 1997-2020 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -298,6 +298,7 @@ if (preg->re_pcre == NULL)
(void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT,
&re_nsub);
preg->re_nsub = (size_t)re_nsub;
+preg->re_erroffset = (size_t)(-1); /* No meaning after successful compile */
return 0;
}
@@ -335,8 +336,6 @@ if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
if ((eflags & REG_NOTEMPTY) != 0) options |= PCRE_NOTEMPTY;
-((regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
-
/* When no string data is being returned, or no vector has been passed in which
to put it, ensure that nmatch is zero. Otherwise, ensure the vector for holding
the return data is large enough. */
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index dcf1e2c6760..952de3a663e 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -500,7 +500,7 @@ enum {
#if (defined (SUPPORT_PCRE8) + defined (SUPPORT_PCRE16) + \
defined (SUPPORT_PCRE32)) >= 2
-#define CHAR_SIZE (1 << pcre_mode)
+#define CHAR_SIZE (1U << pcre_mode)
/* There doesn't seem to be an easy way of writing these macros that can cope
with the 3 pairs of bit sizes plus all three bit sizes. So just handle all the
@@ -4444,7 +4444,7 @@ while (!done)
/* If there is study data, write it. */
- if (extra != NULL)
+ if (extra != NULL && (extra->flags & PCRE_EXTRA_STUDY_DATA) != 0)
{
if (fwrite(extra->study_data, 1, true_study_size, f) <
true_study_size)
@@ -4736,7 +4736,7 @@ while (!done)
if (isdigit(*p)) /* Set copy string */
{
while(isdigit(*p)) n = n * 10 + *p++ - '0';
- copystrings |= 1 << n;
+ copystrings |= 1U << n;
}
else if (isalnum(*p))
{
@@ -4799,7 +4799,7 @@ while (!done)
if (isdigit(*p))
{
while(isdigit(*p)) n = n * 10 + *p++ - '0';
- getstrings |= 1 << n;
+ getstrings |= 1U << n;
}
else if (isalnum(*p))
{
@@ -5336,7 +5336,7 @@ while (!done)
for (i = 0; i < 32; i++)
{
- if ((copystrings & (1 << i)) != 0)
+ if ((copystrings & (1U << i)) != 0)
{
int rc;
char copybuffer[256];
@@ -5401,7 +5401,7 @@ while (!done)
for (i = 0; i < 32; i++)
{
- if ((getstrings & (1 << i)) != 0)
+ if ((getstrings & (1U << i)) != 0)
{
int rc;
const char *substring;
diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2
index 3528de153eb..53c9825ae08 100644
--- a/pcre/testdata/testinput2
+++ b/pcre/testdata/testinput2
@@ -1380,7 +1380,7 @@
1X
123456\P
-//KF>testsavedregex
+//S-KF>testsavedregex
/abc/IS>testsavedregex
<testsavedregex
diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2
index 4ccda272010..f5d32d6ad0d 100644
--- a/pcre/testdata/testoutput2
+++ b/pcre/testdata/testoutput2
@@ -5614,9 +5614,8 @@ No match
123456\P
No match
-//KF>testsavedregex
+//S-KF>testsavedregex
Compiled pattern written to testsavedregex
-Study data written to testsavedregex
/abc/IS>testsavedregex
Capturing subpattern count = 0
diff --git a/plugin/auth_gssapi/CMakeLists.txt b/plugin/auth_gssapi/CMakeLists.txt
index d2f854c2918..4d3718dd471 100644
--- a/plugin/auth_gssapi/CMakeLists.txt
+++ b/plugin/auth_gssapi/CMakeLists.txt
@@ -18,12 +18,17 @@ ELSE()
SET(GSSAPI_SERVER gssapi_server.cc)
SET(GSSAPI_ERRMSG gssapi_errmsg.cc)
+ IF(APPLE)
+ SET_SOURCE_FILES_PROPERTIES(
+ ${GSSAPI_CLIENT} ${GSSAPI_SERVER} ${GSSAPI_ERRMSG}
+ PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations")
+ ENDIF()
SET(CMAKE_REQUIRED_INCLUDES ${GSSAPI_INCS})
SET(CMAKE_REQUIRED_LIBRARIES ${GSSAPI_LIBS})
INCLUDE(CheckCXXSymbolExists)
- CHECK_CXX_SYMBOL_EXISTS(krb5_free_unparsed_name "krb5.h" HAVE_KRB5_FREE_UNPARSED_NAME)
- IF(HAVE_KRB5_FREE_UNPARSED_NAME)
- ADD_DEFINITIONS(-DHAVE_KRB5_FREE_UNPARSED_NAME=1)
+ CHECK_CXX_SYMBOL_EXISTS(krb5_xfree "krb5.h" HAVE_KRB5_XFREE)
+ IF(HAVE_KRB5_XFREE)
+ ADD_DEFINITIONS(-DHAVE_KRB5_XFREE=1)
ENDIF()
ELSE()
diff --git a/plugin/auth_gssapi/gssapi_errmsg.cc b/plugin/auth_gssapi/gssapi_errmsg.cc
index 8ea4cab5b02..9b3386fba08 100644
--- a/plugin/auth_gssapi/gssapi_errmsg.cc
+++ b/plugin/auth_gssapi/gssapi_errmsg.cc
@@ -26,7 +26,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#if defined(__FreeBSD__) || defined(SOLARIS) || defined(__sun)
+#include <gssapi/gssapi.h>
+#else
#include <gssapi.h>
+#endif
#include <string.h>
void gssapi_errmsg(OM_uint32 major, OM_uint32 minor, char *buf, size_t size)
{
diff --git a/plugin/auth_gssapi/gssapi_server.cc b/plugin/auth_gssapi/gssapi_server.cc
index 9197b3e06fc..2af87e820cf 100644
--- a/plugin/auth_gssapi/gssapi_server.cc
+++ b/plugin/auth_gssapi/gssapi_server.cc
@@ -31,7 +31,7 @@ static void log_error( OM_uint32 major, OM_uint32 minor, const char *msg)
Generate default principal service name formatted as principal name "mariadb/server.fqdn@REALM"
*/
#include <krb5.h>
-#ifndef HAVE_KRB5_FREE_UNPARSED_NAME
+#ifdef HAVE_KRB5_XFREE
#define krb5_free_unparsed_name(a,b) krb5_xfree(b)
#endif
static char* get_default_principal_name()
diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt
index 606fef002e7..dbb4701fbc4 100644
--- a/plugin/auth_pam/CMakeLists.txt
+++ b/plugin/auth_pam/CMakeLists.txt
@@ -1,14 +1,48 @@
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
+CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+
+# Check whether getgrouplist uses git_t for second and third arguments.
+SET(CMAKE_REQUIRED_FLAGS -Werror)
+CHECK_C_SOURCE_COMPILES(
+"
+#include <grp.h>
+#include <unistd.h>
+int main() {
+ char *arg_1;
+ gid_t arg_2, arg_3;
+ int arg_4;
+ (void)getgrouplist(arg_1,arg_2,&arg_3,&arg_4);
+ return 0;
+}
+"
+HAVE_POSIX_GETGROUPLIST
+)
+SET(CMAKE_REQUIRED_FLAGS)
+
+SET(CMAKE_REQUIRED_LIBRARIES pam)
+CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
+SET(CMAKE_REQUIRED_LIBRARIES)
+
IF(HAVE_PAM_APPL_H)
- IF(HAVE_STRNDUP)
- ADD_DEFINITIONS(-DHAVE_STRNDUP)
- ENDIF(HAVE_STRNDUP)
- FIND_LIBRARY(PAM_LIBRARY pam)
+ FIND_LIBRARY(PAM_LIBRARY pam) # for srpm build-depends detection
MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY)
+
+ IF(TARGET auth_pam)
+ ADD_LIBRARY(pam_user_map MODULE mapper/pam_user_map.c)
+ TARGET_LINK_LIBRARIES(pam_user_map pam)
+ SET_TARGET_PROPERTIES (pam_user_map PROPERTIES PREFIX "")
+ IF(INSTALL_PAMDIR)
+ INSTALL(TARGETS pam_user_map DESTINATION ${INSTALL_PAMDIR} COMPONENT Server)
+ INSTALL(FILES mapper/user_map.conf DESTINATION ${INSTALL_PAMDATADIR} COMPONENT Server)
+ ENDIF()
+ ENDIF()
ENDIF(HAVE_PAM_APPL_H)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/config_auth_pam.h)
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index fae73aea690..c80ec51b48d 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -16,6 +16,7 @@
#define _GNU_SOURCE 1 /* for strndup */
+#include <config_auth_pam.h>
#include <mysql/plugin_auth.h>
#include <stdio.h>
#include <string.h>
diff --git a/plugin/auth_pam/config.h.cmake b/plugin/auth_pam/config.h.cmake
new file mode 100644
index 00000000000..2a60e99d52c
--- /dev/null
+++ b/plugin/auth_pam/config.h.cmake
@@ -0,0 +1,5 @@
+#cmakedefine HAVE_POSIX_GETGROUPLIST 1
+#cmakedefine HAVE_PAM_SYSLOG 1
+#cmakedefine HAVE_PAM_EXT_H 1
+#cmakedefine HAVE_PAM_APPL_H 1
+#cmakedefine HAVE_STRNDUP 1
diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index e1d11acabb9..fa8d9ae08c1 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -2,7 +2,7 @@
Pam module to change user names arbitrarily in the pam stack.
Compile as
-
+
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
@@ -31,6 +31,7 @@ These comments are written to the syslog as 'authpriv.debug'
and usually end up in /var/log/secure file.
*/
+#include <config_auth_pam.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -39,19 +40,47 @@ and usually end up in /var/log/secure file.
#include <grp.h>
#include <pwd.h>
+#ifdef HAVE_PAM_EXT_H
#include <security/pam_ext.h>
+#endif
+
+#ifdef HAVE_PAM_APPL_H
+#include <unistd.h>
+#include <security/pam_appl.h>
+#endif
+
#include <security/pam_modules.h>
+#ifndef HAVE_PAM_SYSLOG
+#include <stdarg.h>
+static void
+pam_syslog (const pam_handle_t *pamh, int priority,
+ const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ vsyslog (priority, fmt, args);
+ va_end (args);
+}
+#endif
+
#define FILENAME "/etc/security/user_map.conf"
#define skip(what) while (*s && (what)) s++
+#define SYSLOG_DEBUG if (mode_debug) pam_syslog
#define GROUP_BUFFER_SIZE 100
+static const char debug_keyword[]= "debug";
+#ifdef HAVE_POSIX_GETGROUPLIST
+typedef gid_t my_gid_t;
+#else
+typedef int my_gid_t;
+#endif
-static int populate_user_groups(const char *user, gid_t **groups)
+static int populate_user_groups(const char *user, my_gid_t **groups)
{
- gid_t user_group_id;
- gid_t *loc_groups= *groups;
+ my_gid_t user_group_id;
+ my_gid_t *loc_groups= *groups;
int ng;
{
@@ -66,22 +95,23 @@ static int populate_user_groups(const char *user, gid_t **groups)
{
/* The rare case when the user is present in more than */
/* GROUP_BUFFER_SIZE groups. */
- loc_groups= (gid_t *) malloc(ng * sizeof (gid_t));
+ loc_groups= (my_gid_t *) malloc(ng * sizeof (my_gid_t));
+
if (!loc_groups)
return 0;
(void) getgrouplist(user, user_group_id, loc_groups, &ng);
- *groups= loc_groups;
+ *groups= (my_gid_t*)loc_groups;
}
return ng;
}
-static int user_in_group(const gid_t *user_groups, int ng,const char *group)
+static int user_in_group(const my_gid_t *user_groups, int ng,const char *group)
{
- gid_t group_id;
- const gid_t *groups_end = user_groups + ng;
+ my_gid_t group_id;
+ const my_gid_t *groups_end = user_groups + ng;
{
struct group *g= getgrnam(group);
@@ -100,7 +130,7 @@ static int user_in_group(const gid_t *user_groups, int ng,const char *group)
}
-static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
+static void print_groups(pam_handle_t *pamh, const my_gid_t *user_groups, int ng)
{
char buf[256];
char *c_buf= buf, *buf_end= buf+sizeof(buf)-2;
@@ -128,10 +158,6 @@ static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
ng, (ng == 1) ? "group" : "groups", buf+1);
}
-
-static const char debug_keyword[]= "debug";
-#define SYSLOG_DEBUG if (mode_debug) pam_syslog
-
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
@@ -140,8 +166,8 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
const char *username;
char buf[256];
FILE *f;
- gid_t group_buffer[GROUP_BUFFER_SIZE];
- gid_t *groups= group_buffer;
+ my_gid_t group_buffer[GROUP_BUFFER_SIZE];
+ my_gid_t *groups= group_buffer;
int n_groups= -1;
for (; argc > 0; argc--)
diff --git a/plugin/auth_pam/mapper/user_map.conf b/plugin/auth_pam/mapper/user_map.conf
new file mode 100644
index 00000000000..4af8fb0fe10
--- /dev/null
+++ b/plugin/auth_pam/mapper/user_map.conf
@@ -0,0 +1,13 @@
+#
+# Configuration file for pam_user_map.so
+#
+# defines mapping in the form
+#
+# orig_user_name: mapped_user_name
+#
+# or (to map all users in a specific group)
+#
+# @group_name: mapped_user_name
+#
+# comments and empty lines are ignored
+#
diff --git a/plugin/disks/information_schema_disks.cc b/plugin/disks/information_schema_disks.cc
index c4b558ba107..e3b0e96c2e7 100644
--- a/plugin/disks/information_schema_disks.cc
+++ b/plugin/disks/information_schema_disks.cc
@@ -32,9 +32,9 @@ ST_FIELD_INFO disks_table_fields[]=
{
{ "Disk", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
{ "Path", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
- { "Total", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Total amount available
- { "Used", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount of space used
- { "Available", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount available to users other than root.
+ { "Total", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Total amount available
+ { "Used", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Amount of space used
+ { "Available", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Amount available to users other than root.
{ 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
};
@@ -51,9 +51,10 @@ int disks_table_add_row(THD* pThd,
// f_bfree Total number of free blocks.
// f_bavail Number of free blocks available to non-privileged process.
- size_t total = (info.f_frsize * info.f_blocks) / 1024;
- size_t used = (info.f_frsize * (info.f_blocks - info.f_bfree)) / 1024;
- size_t avail = (info.f_frsize * info.f_bavail) / 1024;
+ ulonglong total = ((ulonglong)info.f_frsize * info.f_blocks) / 1024;
+ ulonglong used = ((ulonglong)info.f_frsize *
+ (info.f_blocks - info.f_bfree)) / 1024;
+ ulonglong avail = ((ulonglong)info.f_frsize * info.f_bavail) / 1024;
pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info);
pTable->field[1]->store(zPath, strlen(zPath), system_charset_info);
diff --git a/plugin/disks/mysql-test/disks/disks.result b/plugin/disks/mysql-test/disks/disks.result
index 65b1127d479..0b4ee6249aa 100644
--- a/plugin/disks/mysql-test/disks/disks.result
+++ b/plugin/disks/mysql-test/disks/disks.result
@@ -3,9 +3,9 @@ Table Create Table
DISKS CREATE TEMPORARY TABLE `DISKS` (
`Disk` varchar(4096) NOT NULL DEFAULT '',
`Path` varchar(4096) NOT NULL DEFAULT '',
- `Total` int(32) NOT NULL DEFAULT 0,
- `Used` int(32) NOT NULL DEFAULT 0,
- `Available` int(32) NOT NULL DEFAULT 0
+ `Total` bigint(32) NOT NULL DEFAULT 0,
+ `Used` bigint(32) NOT NULL DEFAULT 0,
+ `Available` bigint(32) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
diff --git a/plugin/handler_socket/client/hspool_test.pl b/plugin/handler_socket/client/hspool_test.pl
index 7fe073301b1..973913d4ee9 100755
--- a/plugin/handler_socket/client/hspool_test.pl
+++ b/plugin/handler_socket/client/hspool_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/plugin/handler_socket/client/hstest.pl b/plugin/handler_socket/client/hstest.pl
index 4d177b6cdc8..7651dddbc63 100755
--- a/plugin/handler_socket/client/hstest.pl
+++ b/plugin/handler_socket/client/hstest.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=8:ai:ts=8
diff --git a/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm b/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
index c51fe60d591..b6ea62651a3 100755
--- a/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
+++ b/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
package Net::HandlerSocket::HSPool;
diff --git a/plugin/handler_socket/regtest/test_01_lib/test01.pl b/plugin/handler_socket/regtest/test_01_lib/test01.pl
index d3a072fb3cc..0a3ad9e9b25 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test01.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test01.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test02.pl b/plugin/handler_socket/regtest/test_01_lib/test02.pl
index c69515d76e9..f9bdc8b6738 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test02.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test02.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test03.pl b/plugin/handler_socket/regtest/test_01_lib/test03.pl
index a081786c132..a51aaf3b257 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test03.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test03.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test04.pl b/plugin/handler_socket/regtest/test_01_lib/test04.pl
index 52fe11364c8..d922b713271 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test04.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test04.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test05.pl b/plugin/handler_socket/regtest/test_01_lib/test05.pl
index 10b1a0805a0..2993e7a9680 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test05.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test05.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test06.pl b/plugin/handler_socket/regtest/test_01_lib/test06.pl
index fb0549f2295..69dd107e1ff 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test06.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test06.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test07.pl b/plugin/handler_socket/regtest/test_01_lib/test07.pl
index fa9802366d8..2286aeba9fe 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test07.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test07.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test08.pl b/plugin/handler_socket/regtest/test_01_lib/test08.pl
index c33bf190d29..da736ef34c3 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test08.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test08.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test09.pl b/plugin/handler_socket/regtest/test_01_lib/test09.pl
index 14fd9c26641..7d6165ece1e 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test09.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test09.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test10.pl b/plugin/handler_socket/regtest/test_01_lib/test10.pl
index fd294fe8b78..560976ba9b2 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test10.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test10.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test11.pl b/plugin/handler_socket/regtest/test_01_lib/test11.pl
index 5cfe3e83614..cfaa940572c 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test11.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test11.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test12.pl b/plugin/handler_socket/regtest/test_01_lib/test12.pl
index 100a779de4e..0cae3798372 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test12.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test12.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test13.pl b/plugin/handler_socket/regtest/test_01_lib/test13.pl
index 1e1104d2a07..2068c4bc9b6 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test13.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test13.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test14.pl b/plugin/handler_socket/regtest/test_01_lib/test14.pl
index ff4e433ae8f..ab89073370b 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test14.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test14.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test15.pl b/plugin/handler_socket/regtest/test_01_lib/test15.pl
index 4c56d355708..2205be5b363 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test15.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test15.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test16.pl b/plugin/handler_socket/regtest/test_01_lib/test16.pl
index 6db8c576d7a..c0c3fc556ff 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test16.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test16.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test17.pl b/plugin/handler_socket/regtest/test_01_lib/test17.pl
index 1ffd7fa1242..7c150dab746 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test17.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test17.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test18.pl b/plugin/handler_socket/regtest/test_01_lib/test18.pl
index 87047bc9cba..7854642af15 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test18.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test18.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test19.pl b/plugin/handler_socket/regtest/test_01_lib/test19.pl
index 9870199c1a7..2e5363c8137 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test19.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test19.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test20.pl b/plugin/handler_socket/regtest/test_01_lib/test20.pl
index 139bbf9aba1..96307e0a5f0 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test20.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test20.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test21.pl b/plugin/handler_socket/regtest/test_01_lib/test21.pl
index 413ea636400..34e9d43972b 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test21.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test21.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test22.pl b/plugin/handler_socket/regtest/test_01_lib/test22.pl
index cf029944292..370d16d6027 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test22.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test22.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test23.pl b/plugin/handler_socket/regtest/test_01_lib/test23.pl
index 83c2194bfa6..d9bd0381251 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test23.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test23.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test24.pl b/plugin/handler_socket/regtest/test_01_lib/test24.pl
index 6cd95a995e5..f4e3bb3f10c 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test24.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test24.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index e21a0aedb85..a029b426ea1 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.7"
+#define PLUGIN_STR_VERSION "1.4.9"
#define _my_thread_var loc_thread_var
@@ -328,6 +328,10 @@ struct connection_info
char query_buffer[1024];
time_t query_time;
int log_always;
+ char proxy[64];
+ int proxy_length;
+ char proxy_host[64];
+ int proxy_host_length;
};
#define DEFAULT_FILENAME_LEN 16
@@ -761,7 +765,7 @@ static int user_coll_fill(struct user_coll *c, char *users,
if (cmp_user && take_over_cmp)
{
ADD_ATOMIC(internal_stop_logging, 1);
- CLIENT_ERROR(1, "User '%.*s' was removed from the"
+ CLIENT_ERROR(1, "User '%.*b' was removed from the"
" server_audit_excl_users.",
MYF(ME_JUST_WARNING), (int) cmp_length, users);
ADD_ATOMIC(internal_stop_logging, -1);
@@ -771,7 +775,7 @@ static int user_coll_fill(struct user_coll *c, char *users,
else if (cmp_user)
{
ADD_ATOMIC(internal_stop_logging, 1);
- CLIENT_ERROR(1, "User '%.*s' is in the server_audit_incl_users, "
+ CLIENT_ERROR(1, "User '%.*b' is in the server_audit_incl_users, "
"so wasn't added.", MYF(ME_JUST_WARNING), (int) cmp_length, users);
ADD_ATOMIC(internal_stop_logging, -1);
remove_user(users);
@@ -1128,9 +1132,13 @@ static void setup_connection_simple(struct connection_info *ci)
ci->ip_length= 0;
ci->query_length= 0;
ci->header= 0;
+ ci->proxy_length= 0;
}
+#define MAX_HOSTNAME 61
+#define USERNAME_LENGTH 384
+
static void setup_connection_connect(struct connection_info *cn,
const struct mysql_event_connection *event)
{
@@ -1147,6 +1155,29 @@ static void setup_connection_connect(struct connection_info *cn,
get_str_n(cn->ip, &cn->ip_length, sizeof(cn->ip),
event->ip, event->ip_length);
cn->header= 0;
+ if (event->proxy_user && event->proxy_user[0])
+ {
+ const char *priv_host= event->proxy_user +
+ sizeof(char[MAX_HOSTNAME+USERNAME_LENGTH+5]);
+ size_t priv_host_length;
+
+ if (mysql_57_started)
+ {
+ priv_host+= sizeof(size_t);
+ priv_host_length= *(size_t *) (priv_host + MAX_HOSTNAME);
+ }
+ else
+ priv_host_length= strlen(priv_host);
+
+
+ get_str_n(cn->proxy, &cn->proxy_length, sizeof(cn->proxy),
+ event->priv_user, event->priv_user_length);
+ get_str_n(cn->proxy_host, &cn->proxy_host_length,
+ sizeof(cn->proxy_host),
+ priv_host, priv_host_length);
+ }
+ else
+ cn->proxy_length= 0;
}
@@ -1346,6 +1377,31 @@ static size_t log_header(char *message, size_t message_len,
}
+static int log_proxy(const struct connection_info *cn,
+ const struct mysql_event_connection *event)
+
+{
+ time_t ctime;
+ size_t csize;
+ char message[1024];
+
+ (void) time(&ctime);
+ csize= log_header(message, sizeof(message)-1, &ctime,
+ servhost, servhost_len,
+ cn->user, cn->user_length,
+ cn->host, cn->host_length,
+ cn->ip, cn->ip_length,
+ event->thread_id, 0, "PROXY_CONNECT");
+ csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
+ ",%.*s,`%.*s`@`%.*s`,%d", cn->db_length, cn->db,
+ cn->proxy_length, cn->proxy,
+ cn->proxy_host_length, cn->proxy_host,
+ event->status);
+ message[csize]= '\n';
+ return write_log(message, csize + 1, 1);
+}
+
+
static int log_connection(const struct connection_info *cn,
const struct mysql_event_connection *event,
const char *type)
@@ -1428,7 +1484,6 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
const char *res_start= result;
const char *res_end= result + result_len - 2;
size_t d_len;
- char b_char;
while (len)
{
@@ -1466,27 +1521,28 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
if (*next_s)
{
- memmove(result + d_len, "*****", 5);
+ const char b_char= *next_s++;
+ memset(result + d_len, '*', 5);
result+= d_len + 5;
- b_char= *(next_s++);
- }
- else
- result+= d_len;
- while (*next_s)
- {
- if (*next_s == b_char)
- {
- ++next_s;
- break;
- }
- if (*next_s == '\\')
+ while (*next_s)
{
- if (next_s[1])
- next_s++;
+ if (*next_s == b_char)
+ {
+ ++next_s;
+ break;
+ }
+ if (*next_s == '\\')
+ {
+ if (next_s[1])
+ next_s++;
+ }
+ next_s++;
}
- next_s++;
}
+ else
+ result+= d_len;
+
len-= (uint)(next_s - str);
str= next_s;
continue;
@@ -1494,19 +1550,23 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
no_password:
if (result >= res_end)
break;
- if ((b_char= escaped_char(*str)))
+ else
{
- if (result+1 >= res_end)
- break;
- *(result++)= '\\';
- *(result++)= b_char;
+ const char b_char= escaped_char(*str);
+ if (b_char)
+ {
+ if (result+1 >= res_end)
+ break;
+ *(result++)= '\\';
+ *(result++)= b_char;
+ }
+ else if (is_space(*str))
+ *(result++)= ' ';
+ else
+ *(result++)= *str;
+ str++;
+ len--;
}
- else if (is_space(*str))
- *(result++)= ' ';
- else
- *(result++)= *str;
- str++;
- len--;
}
*result= 0;
return result - res_start;
@@ -2003,9 +2063,13 @@ static void update_connection_info(struct connection_info *cn,
{
case MYSQL_AUDIT_CONNECTION_CONNECT:
setup_connection_connect(cn, event);
+ if (event->status == 0 && event->proxy_user && event->proxy_user[0])
+ log_proxy(cn, event);
break;
case MYSQL_AUDIT_CONNECTION_CHANGE_USER:
*after_action= AA_CHANGE_USER;
+ if (event->proxy_user && event->proxy_user[0])
+ log_proxy(cn, event);
break;
default:;
}
@@ -2177,6 +2241,7 @@ struct mysql_event_general_v8
static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8)
{
+#ifdef __linux__
#ifdef DBUG_OFF
#ifdef __x86_64__
static const int cmd_off= 4200;
@@ -2198,6 +2263,7 @@ static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8)
static const int db_len_off= 68;
#endif /*x86_64*/
#endif /*DBUG_OFF*/
+#endif /*__linux*/
struct mysql_event_general event;
@@ -2259,6 +2325,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
{
+#ifdef __linux__
int db_off;
int db_len_off;
if (debug_server_started)
@@ -2282,7 +2349,6 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
#endif /*x86_64*/
}
-#ifdef __linux__
*name= *(char **) (((char *) thd) + db_off);
*len= *((int *) (((char*) thd) + db_len_off));
if (*name && (*name)[*len] != 0)
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
index 52c7789e9f7..c9d47e40d4b 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/my.cnf
@@ -11,6 +11,7 @@ wsrep_provider=@ENV.WSREP_PROVIDER
[mysqld.1]
#galera_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
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
@@ -18,6 +19,7 @@ wsrep_node_name=test-node-1
[mysqld.2]
#galera_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/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 1e63c9eb239..e2fd853ce13 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -283,6 +283,36 @@ ELSE()
SET(WSREP_SOURCE
wsrep_sst_common
)
+
+ SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${wsrep_sst_rsync_wan}
+ COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
+ wsrep_sst_rsync
+ wsrep_sst_rsync_wan
+ )
+ ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync
+ ALL
+ DEPENDS ${wsrep_sst_rsync_wan}
+ )
+ INSTALL(
+ FILES ${wsrep_sst_rsync_wan}
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT Server
+ )
+
+ FOREACH(file ${WSREP_SOURCE})
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ IF(NOT ${file}_COMPONENT)
+ SET(${file}_COMPONENT Server)
+ ENDIF()
+ INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}
+ DESTINATION ${INSTALL_BINDIR}
+ COMPONENT ${${file}_COMPONENT}
+ )
+ ENDFOREACH()
ENDIF()
IF (NOT WITHOUT_SERVER)
SET(SERVER_SCRIPTS
@@ -334,35 +364,6 @@ ELSE()
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
- SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${wsrep_sst_rsync_wan}
- COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
- wsrep_sst_rsync
- wsrep_sst_rsync_wan
- )
- ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync
- ALL
- DEPENDS ${wsrep_sst_rsync_wan}
- )
- INSTALL(
- FILES ${wsrep_sst_rsync_wan}
- DESTINATION ${INSTALL_BINDIR}
- COMPONENT Server
- )
-
- FOREACH(file ${WSREP_SOURCE})
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
- ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
- IF(NOT ${file}_COMPONENT)
- SET(${file}_COMPONENT Server)
- ENDIF()
- INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/${file}
- DESTINATION ${INSTALL_BINDIR}
- COMPONENT ${${file}_COMPONENT}
- )
- ENDFOREACH()
ENDIF()
# Install libgcc as mylibgcc.a
diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh
index 709c4b0eed5..8df2abc3fd5 100644
--- a/scripts/galera_recovery.sh
+++ b/scripts/galera_recovery.sh
@@ -101,8 +101,7 @@ wsrep_recover_position() {
# Safety checks
if [ -n "$log_file" -a -f "$log_file" ]; then
- [ "$euid" = "0" ] && chown $user $log_file
- chmod 600 $log_file
+ chmod 600 $log_file
else
log "WSREP: mktemp failed"
fi
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index b2e38ae6641..0326d4fcd7d 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -68,6 +68,7 @@ Usage: $0 [OPTIONS]
--cross-bootstrap For internal use. Used when building the MariaDB system
tables on a different host than the target.
--datadir=path The path to the MariaDB data directory.
+ --no-defaults Don't read default options from any option file.
--defaults-extra-file=name
Read this file after the global files are read.
--defaults-file=name Only read default options from the given file name.
@@ -80,8 +81,6 @@ Usage: $0 [OPTIONS]
--help Display this help and exit.
--ldata=path The path to the MariaDB data directory. Same as
--datadir.
- --no-defaults Don't read default options from any option file.
- --defaults-file=path Read only this configuration file.
--rpm For internal use. This option is used by RPM files
during the MariaDB installation process.
--skip-auth-anonymous-user
@@ -245,7 +244,7 @@ cannot_find_file()
echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation."
echo "If you don't want to do a full install, you can use the --srcdir"
- echo "option to only install the mysql database and privilege tables"
+ echo "option to only install the mysql database and privilege tables."
echo
echo "If you are using a binary release, you must either be at the top"
echo "level of the extracted archive, or pass the --basedir option"
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index a07a4c53d8b..8e0894c41b3 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -644,14 +644,14 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
-ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
- ADD authentication_string TEXT NOT NULL;
+ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL AFTER max_user_connections,
+ ADD authentication_string TEXT NOT NULL AFTER plugin;
ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
MODIFY authentication_string TEXT NOT NULL;
-ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
-ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
-ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL;
-ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
+ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER authentication_string;
+ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER password_expired;
+ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL AFTER is_role;
+ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL AFTER default_role;
-- Somewhere above, we ran ALTER TABLE user .... CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin.
-- we want password_expired column to have collation utf8_general_ci.
ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 2c3578834eb..0b33f61710e 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -308,9 +308,7 @@ sub report_mysqlds
sub start_mysqlds()
{
- my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $suffix_found, $info_sent);
-
- $suffix_found= 0;
+ my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
if (!$opt_no_log)
{
@@ -349,10 +347,6 @@ sub start_mysqlds()
$options[$j]= quote_shell_word($options[$j]);
$tmp.= " $options[$j]";
}
- elsif ("--defaults-group-suffix=" eq substr($options[$j], 0, 24))
- {
- $suffix_found= 1;
- }
else
{
$options[$j]= quote_shell_word($options[$j]);
@@ -369,12 +363,6 @@ sub start_mysqlds()
$info_sent= 1;
}
- if (!$suffix_found)
- {
- $com.= " --defaults-group-suffix=";
- $com.= substr($groups[$i],6);
- }
-
$com.= $tmp;
if ($opt_wsrep_new_cluster) {
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 290f43e9e84..0110653be90 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -263,7 +263,9 @@ wsrep_recover_position() {
fi
if [ -f $wr_logfile ]; then
- [ "$euid" = "0" ] && chown $user $wr_logfile
+ # NOTE! Do not change ownership of the temporary file, as on newer kernel
+ # versions fs.protected_regular is set to '2' and redirecting output with >
+ # as root to a file not owned by root will fail with "Permission denied"
chmod 600 $wr_logfile
else
log_error "WSREP: mktemp failed"
@@ -278,6 +280,11 @@ wsrep_recover_position() {
eval "$mysqld_cmd --wsrep_recover $wr_options 2> $wr_logfile"
+ if [ ! -s "$wr_logfile" ]; then
+ log_error "Log file $wr_logfile was empty, cannot proceed. Is system running fs.protected_regular?"
+ exit 1
+ fi
+
local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then
local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')"
@@ -449,25 +456,10 @@ mysqld_ld_preload_text() {
echo "$text"
}
-
-mysql_config=
-get_mysql_config() {
- if [ -z "$mysql_config" ]; then
- mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
- if [ ! -x "$mysql_config" ]; then
- log_error "Can not run mysql_config $@ from '$mysql_config'"
- exit 1
- fi
- fi
-
- "$mysql_config" "$@"
-}
-
-
# set_malloc_lib LIB
# - If LIB is empty, do nothing and return
-# - If LIB starts with 'tcmalloc' or 'jemalloc', look for the shared library in
-# /usr/lib, /usr/lib64 and then pkglibdir.
+# - If LIB starts with 'tcmalloc' or 'jemalloc', look for the shared library
+# using `ldconfig`.
# tcmalloc is part of the Google perftools project.
# - If LIB is an absolute path, assume it is a malloc shared library
#
@@ -475,28 +467,28 @@ get_mysql_config() {
# running mysqld. See ld.so for details.
set_malloc_lib() {
malloc_lib="$1"
-
if expr "$malloc_lib" : "\(tcmalloc\|jemalloc\)" > /dev/null ; then
- pkglibdir=`get_mysql_config --variable=pkglibdir`
- where=''
- # This list is kept intentionally simple. Simply set --malloc-lib
- # to a full path if another location is desired.
- for libdir in /usr/lib /usr/lib64 "$pkglibdir" "$pkglibdir/mysql"; do
- tmp=`echo "$libdir/lib$malloc_lib.so".[0-9]`
- where="$where $libdir"
- # log_notice "DEBUG: Checking for malloc lib '$tmp'"
- [ -r "$tmp" ] || continue
- malloc_lib="$tmp"
- where=''
- break
- done
+ if ! my_which ldconfig > /dev/null 2>&1
+ then
+ log_error "ldconfig command not found, required for ldconfig -p"
+ exit 1
+ fi
+ # format from ldconfig:
+ # "libjemalloc.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
+ libmalloc_path="$(ldconfig -p | sed -n "/lib${malloc_lib}/p" | cut -d '>' -f2)"
- if [ -n "$where" ]; then
- log_error "no shared library for lib$malloc_lib.so.[0-9] found in$where"
+ if [ -z "$libmalloc_path" ]; then
+ log_error "no shared library for lib$malloc_lib.so.[0-9] found."
exit 1
fi
- fi
+ for f in $libmalloc_path; do
+ if [ -f "$f" ]; then
+ malloc_lib=$f # get the first path if many
+ break
+ fi
+ done
+ fi
# Allow --malloc-lib='' to override other settings
[ -z "$malloc_lib" ] && return
@@ -513,7 +505,6 @@ set_malloc_lib() {
exit 1
;;
esac
-
add_mysqld_ld_preload "$malloc_lib"
}
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index 3ef0a59f27f..e7b9040c3a8 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
#
# $Id: mytop,v 1.91 2012/01/18 16:49:12 mgrennan Exp $
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index ee7817a1550..f5adf0b0fd8 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -45,28 +45,68 @@ case "$1" in
case "${WSREP_SST_OPT_ADDR}" in
\[*)
# IPv6
+ # Remove the starting and ending square brackets, if present:
addr_no_bracket=${WSREP_SST_OPT_ADDR#\[}
readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*}
+ # Square brackets are needed in most cases:
readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]"
+ # Some utilities and subsequent code require an address
+ # without square brackets:
readonly WSREP_SST_OPT_HOST_ESCAPED="\\[${WSREP_SST_OPT_HOST_UNESCAPED}\\]"
+ readonly WSREP_SST_OPT_HOST_IPv6=1
;;
*)
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
+ readonly WSREP_SST_OPT_HOST_IPv6=0
;;
esac
+ # Let's remove the leading part that contains the host address:
remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST_ESCAPED}}
+ # Let's remove the ":" character that separates the port number
+ # from the hostname:
remain=${remain#:}
+ # Extract the port number from the address - all characters
+ # up to "/" (if present):
readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*}
- remain=${remain#*/}
- readonly WSREP_SST_OPT_MODULE=${remain%%/*}
- readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/}
+ # If the "/" character is present, then the path is not empty:
+ if [ "${remain#*/}" != "${remain}" ]; then
+ # This operation removes everything up to the "/" character,
+ # effectively removing the port number from the string:
+ readonly WSREP_SST_OPT_PATH=${remain#*/}
+ else
+ readonly WSREP_SST_OPT_PATH=""
+ fi
+ # The rest of the string is the same as the path (for now):
+ remain=${WSREP_SST_OPT_PATH}
+ # If there is one more "/" in the string, then everything before
+ # it will be the module name, otherwise the module name is empty:
+ if [ "${remain%%/*}" != "${remain}" ]; then
+ # This operation removes the tail after the very first
+ # occurrence of the "/" character (inclusively):
+ readonly WSREP_SST_OPT_MODULE=${remain%%/*}
+ else
+ readonly WSREP_SST_OPT_MODULE=""
+ fi
+ # Remove the module name part from the string, which ends with "/":
remain=${WSREP_SST_OPT_PATH#*/}
+ # If the rest of the string does not match the original, then there
+ # was something else besides the module name:
if [ "$remain" != "${WSREP_SST_OPT_PATH}" ]; then
+ # Extract the part that matches the LSN by removing all
+ # characters starting from the very first "/":
readonly WSREP_SST_OPT_LSN=${remain%%/*}
+ # Exctract everything after the first occurrence of
+ # the "/" character in the string:
remain=${remain#*/}
+ # If the remainder does not match the original string,
+ # then there is something else (the version number in
+ # our case):
if [ "$remain" != "${WSREP_SST_OPT_LSN}" ]; then
+ # Let's extract the version number by removing the tail
+ # after the very first occurence of the "/" character
+ # (inclusively):
readonly WSREP_SST_OPT_SST_VER=${remain%%/*}
else
readonly WSREP_SST_OPT_SST_VER=""
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 55111b00ff9..231cf6e3702 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -1,6 +1,6 @@
#!/bin/bash -ue
# Copyright (C) 2013 Percona Inc
-# Copyright (C) 2017-2019 MariaDB
+# Copyright (C) 2017-2020 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
@@ -189,23 +189,48 @@ get_transfer()
if nc -h 2>&1 | grep -q ncat;then
# Ncat
tcmd="nc -l ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
+ elif nc -h 2>&1 | grep -qw -- '-d\>';then
# Debian netcat
- tcmd="nc -dl ${TSST_PORT}"
+ if [ $WSREP_SST_OPT_HOST_IPv6 -eq 1 ];then
+ # When host is not explicitly specified (when only the port
+ # is specified) netcat can only bind to an IPv4 address if
+ # the "-6" option is not explicitly specified:
+ tcmd="nc -dl -6 ${TSST_PORT}"
+ else
+ tcmd="nc -dl ${TSST_PORT}"
+ fi
else
# traditional netcat
tcmd="nc -l -p ${TSST_PORT}"
fi
else
+ # Check to see if netcat supports the '-N' flag.
+ # -N Shutdown the network socket after EOF on stdin
+ # If it supports the '-N' flag, then we need to use the '-N'
+ # flag, otherwise the transfer will stay open after the file
+ # transfer and cause the command to timeout.
+ # Older versions of netcat did not need this flag and will
+ # return an error if the flag is used.
+ #
+ tcmd_extra=""
+ if nc -h 2>&1 | grep -qw -- -N; then
+ tcmd_extra+="-N"
+ wsrep_log_info "Using nc -N"
+ fi
+
+ # netcat doesn't understand [] around IPv6 address
if nc -h 2>&1 | grep -q ncat;then
# Ncat
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
+ wsrep_log_info "Using Ncat as streamer"
+ tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
+ elif nc -h 2>&1 | grep -qw -- '-d\>';then
# Debian netcat
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
+ wsrep_log_info "Using Debian netcat as streamer"
+ tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
else
# traditional netcat
- tcmd="nc -q0 ${REMOTEIP} ${TSST_PORT}"
+ wsrep_log_info "Using traditional netcat as streamer"
+ tcmd="nc -q0 ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
fi
fi
else
@@ -359,7 +384,7 @@ read_cnf()
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)
+ stimeout=$(parse_cnf sst sst-initial-timeout 300)
ssyslog=$(parse_cnf sst sst-syslog 0)
ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}")
ssystag+="-"
@@ -386,8 +411,8 @@ read_cnf()
get_stream()
{
- if [[ $sfmt == 'xbstream' ]];then
- wsrep_log_info "Streaming with xbstream"
+ if [[ $sfmt == 'mbstream' || $sfmt == 'xbstream' ]];then
+ wsrep_log_info "Streaming with ${sfmt}"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
strmcmd="${XBSTREAM_BIN} -x"
else
@@ -523,25 +548,11 @@ kill_xtrabackup()
setup_ports()
{
+ SST_PORT=${WSREP_SST_OPT_ADDR_PORT}
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; 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
- if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; 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
+ REMOTEIP=${WSREP_SST_OPT_HOST}
+ lsn=${WSREP_SST_OPT_LSN}
+ sst_ver=${WSREP_SST_OPT_SST_VER}
fi
}
@@ -620,7 +631,8 @@ recv_joiner()
popd 1>/dev/null
if [[ ${RC[0]} -eq 124 ]];then
- wsrep_log_error "Possible timeout in receving first data from donor in gtid stage"
+ wsrep_log_error "Possible timeout in receiving first data from "
+ "donor in gtid stage: exit codes: ${RC[@]}"
exit 32
fi
@@ -700,9 +712,11 @@ if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; t
disver="--no-version-check"
fi
+iopts+=" --databases-exclude=\"lost+found\""
+
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 "
+ iopts+=" --no-backup-locks"
fi
INNOEXTRA=$WSREP_SST_OPT_MYSQLD
@@ -712,7 +726,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
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 no command line arg and INNODB_DATA_HOME_DIR environment 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
@@ -960,17 +975,25 @@ then
ib_home_dir=$INNODB_DATA_HOME_DIR
- # Try to set ib_log_dir from the command line:
- ib_log_dir=$INNODB_LOG_GROUP_HOME_ARG
- if [ -z "$ib_log_dir" ]; then
- ib_log_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir "")
+ WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
+ # Try to set WSREP_LOG_DIR from the command line:
+ if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
+ WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
+ fi
+ # if no command line arg and WSREP_LOG_DIR is not set,
+ # try to get it from my.cnf:
+ if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi
- if [ -z "$ib_log_dir" ]; then
- ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "")
+ if [ -z "$WSREP_LOG_DIR" ]; then
+ WSREP_LOG_DIR=$(parse_cnf --mysqld innodb-log-group-home-dir '')
fi
+ ib_log_dir=$WSREP_LOG_DIR
+
# Try to set ib_undo_dir from the command line:
- ib_undo_dir=$INNODB_UNDO_DIR_ARG
+ ib_undo_dir=${INNODB_UNDO_DIR_ARG:-""}
+ # if no command line arg then try to get it from my.cnf:
if [ -z "$ib_undo_dir" ]; then
ib_undo_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-undo-directory "")
fi
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index ef32e77e20d..f50f94d6560 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -150,10 +150,11 @@ fi
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# Try to set WSREP_LOG_DIR from the command line:
-if [ -z "$WSREP_LOG_DIR" ]; then
+if [ ! -z "$INNODB_LOG_GROUP_HOME_ARG" ]; then
WSREP_LOG_DIR=$INNODB_LOG_GROUP_HOME_ARG
fi
-# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
+# if no command line arg and WSREP_LOG_DIR is not set,
+# try to get it from my.cnf:
if [ -z "$WSREP_LOG_DIR" ]; then
WSREP_LOG_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir '')
fi
@@ -174,7 +175,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
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 no command line arg and INNODB_DATA_HOME_DIR environment 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
@@ -198,6 +200,7 @@ fi
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER="-f '- /lost+found'
+ -f '- /.zfs'
-f '- /.fseventsd'
-f '- /.Trashes'
-f '+ /wsrep_sst_binlog.tar'
@@ -354,7 +357,7 @@ EOF
[ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
[ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu)
- find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" \
+ find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -not -name ".zfs" \
-print0 | xargs -I{} -0 -P $count \
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
@@ -437,6 +440,7 @@ timeout = 300
$SILENT
[$MODULE]
path = $WSREP_SST_OPT_DATA
+ exclude = .zfs
[$MODULE-log_dir]
path = $WSREP_LOG_DIR
[$MODULE-data_dir]
diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
index 75601e5c180..8fbbeda170c 100644
--- a/scripts/wsrep_sst_xtrabackup-v2.sh
+++ b/scripts/wsrep_sst_xtrabackup-v2.sh
@@ -904,7 +904,8 @@ INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
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 no command line arg and INNODB_DATA_HOME_DIR environment 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
diff --git a/sql-bench/as3ap.sh b/sql-bench/as3ap.sh
index fd2b6ba3b25..8e4b3167429 100644
--- a/sql-bench/as3ap.sh
+++ b/sql-bench/as3ap.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/bench-count-distinct.sh b/sql-bench/bench-count-distinct.sh
index 9ce9b2fb168..b6465d0635f 100644
--- a/sql-bench/bench-count-distinct.sh
+++ b/sql-bench/bench-count-distinct.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index 1b6509cebcc..eeff8665cba 100644
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/compare-results.sh b/sql-bench/compare-results.sh
index f0658160db2..06e247bae8a 100644
--- a/sql-bench/compare-results.sh
+++ b/sql-bench/compare-results.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/copy-db.sh b/sql-bench/copy-db.sh
index 38a010e52ab..d70472feaff 100644
--- a/sql-bench/copy-db.sh
+++ b/sql-bench/copy-db.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index a7298c5f9a1..26f66f94735 100644
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- perl -*-
# Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/sql-bench/graph-compare-results.sh b/sql-bench/graph-compare-results.sh
index ddc9080acd6..d43f722cb14 100755
--- a/sql-bench/graph-compare-results.sh
+++ b/sql-bench/graph-compare-results.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
####
#### Hello ... this is a heavily hacked script by Luuk
#### instead of printing the result it makes a nice gif
diff --git a/sql-bench/innotest1.sh b/sql-bench/innotest1.sh
index 9e1ed32c273..1b99f601f42 100644
--- a/sql-bench/innotest1.sh
+++ b/sql-bench/innotest1.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest1a.sh b/sql-bench/innotest1a.sh
index 1e428e33dcf..7183c901831 100644
--- a/sql-bench/innotest1a.sh
+++ b/sql-bench/innotest1a.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest1b.sh b/sql-bench/innotest1b.sh
index 524a6e0e145..0a909d1a8f6 100644
--- a/sql-bench/innotest1b.sh
+++ b/sql-bench/innotest1b.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2.sh b/sql-bench/innotest2.sh
index fa0fd418968..941b0ac8b59 100644
--- a/sql-bench/innotest2.sh
+++ b/sql-bench/innotest2.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2a.sh b/sql-bench/innotest2a.sh
index 4a6e4b20a9a..e873d2b458c 100644
--- a/sql-bench/innotest2a.sh
+++ b/sql-bench/innotest2a.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/Innobase combined database
# (c) 2000 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2b.sh b/sql-bench/innotest2b.sh
index b94325ff39e..56b44eda561 100644
--- a/sql-bench/innotest2b.sh
+++ b/sql-bench/innotest2b.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/Innobase combined database
# (c) 2000 Innobase Oy & MySQL AB
diff --git a/sql-bench/run-all-tests.sh b/sql-bench/run-all-tests.sh
index 5d77c8c388d..ecab48e88fe 100644
--- a/sql-bench/run-all-tests.sh
+++ b/sql-bench/run-all-tests.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index fcdfe0b678f..6cc58f527af 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- perl -*-
# Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/sql-bench/test-ATIS.sh b/sql-bench/test-ATIS.sh
index d3c242db256..2e082012a8f 100644
--- a/sql-bench/test-ATIS.sh
+++ b/sql-bench/test-ATIS.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh
index 3a7f325b604..0602bd1f7fc 100644
--- a/sql-bench/test-alter-table.sh
+++ b/sql-bench/test-alter-table.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-big-tables.sh b/sql-bench/test-big-tables.sh
index e2cf983de1c..6be907d0ee6 100644
--- a/sql-bench/test-big-tables.sh
+++ b/sql-bench/test-big-tables.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-connect.sh b/sql-bench/test-connect.sh
index 1226301df9b..e3acb453a30 100644
--- a/sql-bench/test-connect.sh
+++ b/sql-bench/test-connect.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-create.sh b/sql-bench/test-create.sh
index 7af6fa13562..09961f0d698 100644
--- a/sql-bench/test-create.sh
+++ b/sql-bench/test-create.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index be57b04471a..0cb951d86c8 100644
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh
index 4c7147b57a4..e3020698cb8 100644
--- a/sql-bench/test-select.sh
+++ b/sql-bench/test-select.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-table-elimination.sh b/sql-bench/test-table-elimination.sh
index de440fc0633..c3a264492a4 100755
--- a/sql-bench/test-table-elimination.sh
+++ b/sql-bench/test-table-elimination.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Test of table elimination feature
use Cwd;
diff --git a/sql-bench/test-transactions.sh b/sql-bench/test-transactions.sh
index 4732658c529..334a6f0a385 100644
--- a/sql-bench/test-transactions.sh
+++ b/sql-bench/test-transactions.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-wisconsin.sh b/sql-bench/test-wisconsin.sh
index 47c9e050304..581db89712e 100644
--- a/sql-bench/test-wisconsin.sh
+++ b/sql-bench/test-wisconsin.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-common/client.c b/sql-common/client.c
index 4624c6e0f6c..ff36b757957 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -721,6 +721,8 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate);
goto end;
}
+ if (net->last_errno == ER_NET_ERROR_ON_WRITE && command == COM_BINLOG_DUMP)
+ goto end;
end_server(mysql);
if (mysql_reconnect(mysql) || stmt_skip)
goto end;
@@ -1405,9 +1407,23 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
{
if (field >= result + fields)
goto err;
+
+ /*
+ If any of the row->data[] below is NULL, it can result in a
+ crash. Error out early as it indicates a malformed packet.
+ For data[0], data[1] and data[5], strmake_root will handle
+ NULL values.
+ */
+ if (!row->data[2] || !row->data[3] || !row->data[4])
+ {
+ free_rows(data);
+ set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
+ DBUG_RETURN(0);
+ }
+
cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
- field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]);
- field->name= strdup_root(alloc,(char*) row->data[1]);
+ field->org_table= field->table= strmake_root(alloc,(char*) row->data[0], lengths[0]);
+ field->name= strmake_root(alloc,(char*) row->data[1], lengths[1]);
field->length= (uint) uint3korr(row->data[2]);
field->type= (enum enum_field_types) (uchar) row->data[3][0];
@@ -1432,7 +1448,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->flags|= NUM_FLAG;
if (default_value && row->data[5])
{
- field->def=strdup_root(alloc,(char*) row->data[5]);
+ field->def= strmake_root(alloc,(char*) row->data[5], lengths[5]);
field->def_length= lengths[5];
}
else
@@ -3279,7 +3295,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* New protocol with 16 bytes to describe server characteristics */
mysql->server_language=end[2];
mysql->server_status=uint2korr(end+3);
- mysql->server_capabilities|= uint2korr(end+5) << 16;
+ mysql->server_capabilities|= ((unsigned) uint2korr(end+5)) << 16;
pkt_scramble_len= end[7];
if (pkt_scramble_len < 0)
{
@@ -3348,7 +3364,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
scramble_data_len= pkt_scramble_len;
scramble_plugin= scramble_data + scramble_data_len;
if (scramble_data + scramble_data_len > pkt_end)
- scramble_data_len= (int)(pkt_end - scramble_data);
+ {
+ set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
+ goto error;
+ }
}
else
{
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index f7c97b23e87..17779adcff8 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -399,10 +399,13 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
- COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
+ OUTPUT initdb.dep
+ COMMAND ${CMAKE_COMMAND} -E remove_directory data
+ COMMAND ${CMAKE_COMMAND} -E make_directory data
+ COMMAND ${CMAKE_COMMAND} -E chdir data ${CMAKE_COMMAND}
+ ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
diff --git a/sql/compat56.cc b/sql/compat56.cc
index 1ae654338c0..8a17ae16ff3 100644
--- a/sql/compat56.cc
+++ b/sql/compat56.cc
@@ -290,7 +290,7 @@ uint my_datetime_binary_length(uint dec)
/*
On disk we store as unsigned number with DATETIMEF_INT_OFS offset,
- for HA_KETYPE_BINARY compatibilty purposes.
+ for HA_KETYPE_BINARY compatibility purposes.
*/
#define DATETIMEF_INT_OFS 0x8000000000LL
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index aafce9065e3..b1846bc48d5 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2009, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2013, 2020, 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
@@ -33,7 +34,7 @@
/*
Action to perform at a synchronization point.
NOTE: This structure is moved around in memory by realloc(), qsort(),
- and memmove(). Do not add objects with non-trivial constuctors
+ and memmove(). Do not add objects with non-trivial constructors
or destructors, which might prevent moving of this structure
with these functions.
*/
@@ -319,7 +320,8 @@ static char *debug_sync_bmove_len(char *to, char *to_end,
DBUG_ASSERT(to_end);
DBUG_ASSERT(!length || from);
set_if_smaller(length, (size_t) (to_end - to));
- memcpy(to, from, length);
+ if (length)
+ memcpy(to, from, length);
return (to + length);
}
@@ -542,7 +544,7 @@ static void debug_sync_reset(THD *thd)
@description
Removing an action mainly means to decrement the ds_active counter.
But if the action is between other active action in the array, then
- the array needs to be shrinked. The active actions above the one to
+ the array needs to be shrunk. The active actions above the one to
be removed have to be moved down by one slot.
*/
diff --git a/sql/derror.cc b/sql/derror.cc
index f5e63772d54..932c01b9dda 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (C) 2011 Monty Program Ab
+ Copyright (C) 2011, 2020, 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
@@ -69,6 +69,9 @@ bool init_errmessage(void)
{
const char **errmsgs;
bool error= FALSE;
+ const char *lang= my_default_lc_messages->errmsgs->language;
+ my_bool use_english;
+
DBUG_ENTER("init_errmessage");
free_error_messages();
@@ -77,35 +80,65 @@ bool init_errmessage(void)
error_message_charset_info= system_charset_info;
- /* Read messages from file. */
- if (read_texts(ERRMSG_FILE, my_default_lc_messages->errmsgs->language,
- &original_error_messages))
+ use_english= !strcmp(lang, "english");
+ if (!use_english)
{
- /*
- No error messages. Create a temporary empty error message so
- that we don't get a crash if some code wrongly tries to access
- a non existing error message.
- */
+ /* Read messages from file. */
+ use_english= read_texts(ERRMSG_FILE,lang, &original_error_messages);
+ error= use_english != FALSE;
+ if (error)
+ sql_print_error("Could not load error messages for %s",lang);
+ }
+
+ if (use_english)
+ {
+ static const struct
+ {
+ const char* name;
+ uint id;
+ const char* fmt;
+ }
+ english_msgs[]=
+ {
+ #include <mysqld_ername.h>
+ };
+
+ memset(errors_per_range, 0, sizeof(errors_per_range));
+ /* Calculate nr of messages per range. */
+ for (size_t i= 0; i < array_elements(english_msgs); i++)
+ {
+ uint id= english_msgs[i].id;
+
+ // We rely on the fact the array is sorted by id.
+ DBUG_ASSERT(i == 0 || english_msgs[i-1].id < id);
+
+ errors_per_range[id/ERRORS_PER_RANGE-1]= id%ERRORS_PER_RANGE + 1;
+ }
+
+ size_t all_errors= 0;
+ for (size_t i= 0; i < MAX_ERROR_RANGES; i++)
+ all_errors+= errors_per_range[i];
+
if (!(original_error_messages= (const char***)
- my_malloc(MAX_ERROR_RANGES * sizeof(char**) +
- (ERRORS_PER_RANGE * sizeof(char*)),
- MYF(0))))
+ my_malloc((all_errors + MAX_ERROR_RANGES)* sizeof(void*),
+ MYF(MY_ZEROFILL))))
DBUG_RETURN(TRUE);
- errmsgs= (const char**) (original_error_messages + MAX_ERROR_RANGES);
- for (uint i=0 ; i < MAX_ERROR_RANGES ; i++)
+ errmsgs= (const char**)(original_error_messages + MAX_ERROR_RANGES);
+
+ original_error_messages[0]= errmsgs;
+ for (uint i= 1; i < MAX_ERROR_RANGES; i++)
{
- original_error_messages[i]= errmsgs;
- errors_per_range[i]= ERRORS_PER_RANGE;
+ original_error_messages[i]=
+ original_error_messages[i-1] + errors_per_range[i-1];
}
- errors_per_range[2]= 0; // MYSYS error messages
-
- for (const char **ptr= errmsgs;
- ptr < errmsgs + ERRORS_PER_RANGE ;
- ptr++)
- *ptr= "";
- error= TRUE;
+ for (uint i= 0; i < array_elements(english_msgs); i++)
+ {
+ uint id= english_msgs[i].id;
+ original_error_messages[id/ERRORS_PER_RANGE-1][id%ERRORS_PER_RANGE]=
+ english_msgs[i].fmt;
+ }
}
/* Register messages for use with my_error(). */
@@ -203,7 +236,7 @@ static File open_error_msg_file(const char *file_name, const char *language,
MYF(0))) < 0)
{
/*
- Trying pre-5.4 sematics of the --language parameter.
+ Trying pre-5.4 semantics of the --language parameter.
It included the language-specific part, e.g.:
--language=/path/to/english/
*/
diff --git a/sql/encryption.cc b/sql/encryption.cc
index ad23c80b8ab..4fac36dc97e 100644
--- a/sql/encryption.cc
+++ b/sql/encryption.cc
@@ -75,8 +75,8 @@ int initialize_encryption_plugin(st_plugin_int *plugin)
(struct st_mariadb_encryption*) plugin->plugin->info;
/*
- Copmiler on Spark doesn't like the '?' operator here as it
- belives the (uint (*)...) implies the C++ call model.
+ Compiler on Spark doesn't like the '?' operator here as it
+ believes the (uint (*)...) implies the C++ call model.
*/
if (handle->crypt_ctx_size)
encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size;
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index dab09161ca0..4100a031c91 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -159,7 +159,7 @@ Event_creation_ctx::load_from_db(THD *thd,
/*************************************************************************/
/*
- Initiliazes dbname and name of an Event_queue_element_for_exec
+ Initializes dbname and name of an Event_queue_element_for_exec
object
SYNOPSIS
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 5188f86c01b..ea52f68acc9 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -669,7 +669,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
DBUG_PRINT("info", ("name: %.*s", (int) parse_data->name.length,
parse_data->name.str));
- DBUG_PRINT("info", ("check existance of an event with the same name"));
+ DBUG_PRINT("info", ("check existence of an event with the same name"));
if (!find_named_event(parse_data->dbname, parse_data->name, table))
{
if (thd->lex->create_info.or_replace())
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc
index e88ace53149..3606fdbdd3d 100644
--- a/sql/event_parse_data.cc
+++ b/sql/event_parse_data.cc
@@ -100,7 +100,7 @@ Event_parse_data::init_name(THD *thd, sp_name *spn)
ENDS or AT is in the past, we are trying to create an event that
will never be executed. If it has ON COMPLETION NOT PRESERVE
(default), then it would normally be dropped already, so on CREATE
- EVENT we give a warning, and do not create anyting. On ALTER EVENT
+ EVENT we give a warning, and do not create anything. On ALTER EVENT
we give a error, and do not change the event.
If the event has ON COMPLETION PRESERVE, then we see if the event is
@@ -359,7 +359,7 @@ wrong_value:
EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will
start at the date shown above. Expressions are possible :
- DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at
+ DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tomorrow at
same time.
RETURN VALUE
@@ -413,7 +413,7 @@ wrong_value:
EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that
the event will be executed every 5 minutes but this will
end at the date shown above. Expressions are possible :
- DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at
+ DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tomorrow at
same time.
RETURN VALUE
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index 6cc2179be5b..904efe26f36 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -357,7 +357,7 @@ Event_queue::drop_matching_events(THD *thd, LEX_STRING pattern,
We don't call mysql_cond_broadcast(&COND_queue_state);
If we remove the top event:
1. The queue is empty. The scheduler will wake up at some time and
- realize that the queue is empty. If create_event() comes inbetween
+ realize that the queue is empty. If create_event() comes in between
it will signal the scheduler
2. The queue is not empty, but the next event after the previous top,
won't be executed any time sooner than the element we removed. Hence,
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index f680163c49a..2a5399fb94a 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
+/* Copyright (c) 2006, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2020, 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
@@ -497,6 +498,7 @@ Event_scheduler::run(THD *thd)
DBUG_PRINT("info", ("job_data is NULL, the thread was killed"));
}
DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str));
+ free_root(thd->mem_root, MYF(0));
}
LOCK_DATA();
diff --git a/sql/events.cc b/sql/events.cc
index c189354d5eb..abac2833833 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -128,7 +128,7 @@ bool Events::check_if_system_tables_error()
/**
Reconstructs interval expression from interval type and expression
- value that is in form of a value of the smalles entity:
+ value that is in form of a value of the smallest entity:
For
YEAR_MONTH - expression is in months
DAY_MINUTE - expression is in minutes
@@ -1201,9 +1201,9 @@ Events::load_events_from_db(THD *thd)
#ifdef WITH_WSREP
/**
- IF SST is done from a galera node that is also acting as MASTER
- newly synced node in galera eco-system will also copy-over the event state
- enabling duplicate event in galera eco-system.
+ If SST is done from a galera node that is also acting as MASTER
+ newly synced node in galera eco-system will also copy-over the
+ event state enabling duplicate event in galera eco-system.
DISABLE such events if the current node is not event orginator.
(Also, make sure you skip disabling it if is already disabled to avoid
creation of redundant action)
@@ -1213,7 +1213,7 @@ Events::load_events_from_db(THD *thd)
Infact, based on galera use-case it seems like it recommends to have each
node with different server-id.
*/
- if (et->originator != thd->variables.server_id)
+ if (WSREP(thd) && et->originator != thd->variables.server_id)
{
if (et->status == Event_parse_data::SLAVESIDE_DISABLED)
continue;
diff --git a/sql/field.cc b/sql/field.cc
index 09e82acb009..bdaaecc2026 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB
+ Copyright (c) 2008, 2020, 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
@@ -47,7 +47,7 @@
#define MAX_EXPONENT 1024
/*****************************************************************************
- Instansiate templates and static variables
+ Instantiate templates and static variables
*****************************************************************************/
static const char *zero_timestamp="0000-00-00 00:00:00.000000";
@@ -70,7 +70,7 @@ const char field_separator=',';
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1))
-// Column marked for read or the field set to read out or record[0] or [1]
+// Column marked for read or the field set to read out of record[0]
#define ASSERT_COLUMN_MARKED_FOR_READ \
DBUG_ASSERT(!table || \
(!table->read_set || \
@@ -91,7 +91,7 @@ const char field_separator=',';
/*
Rules for merging different types of fields in UNION
- NOTE: to avoid 256*256 table, gap in table types numeration is skiped
+ NOTE: to avoid 256*256 table, gap in table types numeration is skipped
following #defines describe that gap and how to canculate number of fields
and index of field in this array.
*/
@@ -1438,7 +1438,7 @@ void Field::error_generated_column_function_is_not_allowed(THD *thd,
QT_ITEM_IDENT_SKIP_TABLE_NAMES));
my_error(ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED,
MYF(error ? 0 : ME_JUST_WARNING),
- tmp.c_ptr(), vcol_info->get_vcol_type_name(),
+ tmp.c_ptr_safe(), vcol_info->get_vcol_type_name(),
const_cast<const char*>(field_name));
}
@@ -1526,7 +1526,7 @@ Item *Field_num::get_equal_zerofill_const_item(THD *thd, const Context &ctx,
/**
- Contruct warning parameters using thd->no_errors
+Construct warning parameters using thd->no_errors
to determine whether to generate or suppress warnings.
We can get here in a query like this:
SELECT COUNT(@@basedir);
@@ -1574,7 +1574,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
if (filter.want_warning_edom())
{
/*
- We can use err.ptr() here as ErrConvString is guranteed to put an
+ We can use err.ptr() here as ErrConvString is guaranteed to put an
end \0 here.
*/
THD *wthd= thd ? thd : current_thd;
@@ -1606,7 +1606,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
- found garbage at the end of the string.
@param type Data type name (e.g. "decimal", "integer", "double")
- @param edom Indicates that the string-to-number routine retuned
+ @param edom Indicates that the string-to-number routine returned
an error code equivalent to EDOM (value out of domain),
i.e. the string fully consisted of garbage and the
conversion routine could not get any digits from it.
@@ -1670,7 +1670,7 @@ int Field_num::check_edom_and_truncation(const char *type, bool edom,
/*
- Conver a string to an integer then check bounds.
+ Convert a string to an integer then check bounds.
SYNOPSIS
Field_num::get_int
@@ -2671,7 +2671,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
We only have to generate warnings if count_cuted_fields is set.
This is to avoid extra checks of the number when they are not needed.
Even if this flag is not set, it's OK to increment warnings, if
- it makes the code easer to read.
+ it makes the code easier to read.
*/
if (get_thd()->count_cuted_fields)
@@ -2754,7 +2754,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
}
/*
- Now write the formated number
+ Now write the formatted number
First the digits of the int_% parts.
Do we have enough room to write these digits ?
@@ -3331,7 +3331,7 @@ int Field_new_decimal::store(const char *from, uint length,
If check_decimal() failed because of EDOM-alike error,
(e.g. E_DEC_BAD_NUM), we have to initialize decimal_value to zero.
Note: if check_decimal() failed because of truncation,
- decimal_value is alreay properly initialized.
+ decimal_value is already properly initialized.
*/
my_decimal_set_zero(&decimal_value);
/*
@@ -3507,10 +3507,9 @@ int Field_new_decimal::cmp(const uchar *a,const uchar*b)
}
-void Field_new_decimal::sort_string(uchar *buff,
- uint length __attribute__((unused)))
+void Field_new_decimal::sort_string(uchar *buff, uint length)
{
- memcpy(buff, ptr, bin_size);
+ memcpy(buff, ptr, length);
}
@@ -4836,11 +4835,12 @@ int truncate_double(double *nr, uint field_length, uint dec,
{
uint order= field_length - dec;
uint step= array_elements(log_10) - 1;
- max_value= 1.0;
+ double max_value_by_dec= 1.0;
for (; order > step; order-= step)
- max_value*= log_10[step];
- max_value*= log_10[order];
- max_value-= 1.0 / log_10[dec];
+ max_value_by_dec*= log_10[step];
+ max_value_by_dec*= log_10[order];
+ max_value_by_dec-= 1.0 / log_10[dec];
+ set_if_smaller(max_value, max_value_by_dec);
/* Check for infinity so we don't get NaN in calculations */
if (!std::isinf(res))
@@ -5135,7 +5135,7 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
{
/*
We mark the flag with TIMESTAMP_FLAG to indicate to the client that
- this field will be automaticly updated on insert.
+ this field will be automatically updated on insert.
*/
flags|= TIMESTAMP_FLAG;
if (unireg_check != TIMESTAMP_DN_FIELD)
@@ -7590,7 +7590,7 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end,
with the real type. Since all allowable types have 0xF as most
significant bits of the metadata word, lengths <256 will not affect
the real type at all, while all other values will result in a
- non-existant type in the range 17-244.
+ non-existent type in the range 17-244.
@see Field_string::unpack
@@ -7773,8 +7773,16 @@ my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
}
-int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
- uint max_len)
+#ifdef HAVE_valgrind_or_MSAN
+void Field_varstring::mark_unused_memory_as_defined()
+{
+ uint used_length= get_length();
+ MEM_MAKE_DEFINED(get_data() + used_length, field_length - used_length);
+}
+#endif
+
+
+int Field_varstring::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
uint a_length, b_length;
int diff;
@@ -7789,8 +7797,8 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
a_length= uint2korr(a_ptr);
b_length= uint2korr(b_ptr);
}
- set_if_smaller(a_length, max_len);
- set_if_smaller(b_length, max_len);
+ set_if_smaller(a_length, field_length);
+ set_if_smaller(b_length, field_length);
diff= field_charset->coll->strnncollsp(field_charset,
a_ptr+
length_bytes,
@@ -7802,6 +7810,43 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
}
+static int cmp_str_prefix(const uchar *ua, size_t alen, const uchar *ub,
+ size_t blen, size_t prefix, CHARSET_INFO *cs)
+{
+ const char *a= (char*)ua, *b= (char*)ub;
+ MY_STRCOPY_STATUS status;
+ prefix/= cs->mbmaxlen;
+ alen= cs->cset->well_formed_char_length(cs, a, a + alen, prefix, &status);
+ blen= cs->cset->well_formed_char_length(cs, b, b + blen, prefix, &status);
+ return cs->coll->strnncollsp(cs, ua, alen, ub, blen);
+}
+
+
+
+int Field_varstring::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
+ size_t prefix_len)
+{
+ /* avoid expensive well_formed_char_length if possible */
+ if (prefix_len == table->field[field_index]->field_length)
+ return Field_varstring::cmp(a_ptr, b_ptr);
+
+ size_t a_length, b_length;
+
+ if (length_bytes == 1)
+ {
+ a_length= *a_ptr;
+ b_length= *b_ptr;
+ }
+ else
+ {
+ a_length= uint2korr(a_ptr);
+ b_length= uint2korr(b_ptr);
+ }
+ return cmp_str_prefix(a_ptr+length_bytes, a_length, b_ptr+length_bytes,
+ b_length, prefix_len, field_charset);
+}
+
+
/**
@note
varstring and blob keys are ALWAYS stored with a 2 byte length prefix
@@ -8366,16 +8411,24 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
}
-int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
- uint max_length)
+int Field_blob::cmp(const uchar *a_ptr, const uchar *b_ptr)
{
uchar *blob1,*blob2;
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
memcpy(&blob2, b_ptr+packlength, sizeof(char*));
- uint a_len= get_length(a_ptr), b_len= get_length(b_ptr);
- set_if_smaller(a_len, max_length);
- set_if_smaller(b_len, max_length);
- return Field_blob::cmp(blob1,a_len,blob2,b_len);
+ size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr);
+ return cmp(blob1, a_len, blob2, b_len);
+}
+
+
+int Field_blob::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
+ size_t prefix_len)
+{
+ uchar *blob1,*blob2;
+ memcpy(&blob1, a_ptr+packlength, sizeof(char*));
+ memcpy(&blob2, b_ptr+packlength, sizeof(char*));
+ size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr);
+ return cmp_str_prefix(blob1, a_len, blob2, b_len, prefix_len, field_charset);
}
@@ -8841,18 +8894,26 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
{
const char *db= table->s->db.str;
const char *tab_name= table->s->table_name.str;
+ Geometry_buffer buffer;
+ Geometry *geom= NULL;
+ String wkt;
+ const char *dummy;
if (!db)
db= "";
if (!tab_name)
tab_name= "";
+ wkt.set_charset(&my_charset_latin1);
+ if (!(geom= Geometry::construct(&buffer, from, length)) ||
+ geom->as_wkt(&wkt, &dummy))
+ goto err;
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,
- db, tab_name, field_name,
+ wkt.c_ptr_safe(), db, tab_name, field_name,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
+
goto err_exit;
}
@@ -9693,7 +9754,7 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value)
The a and b pointer must be pointers to the field in a record
(not the table->record[0] necessarily)
*/
-int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
+int Field_bit::cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len)
{
my_ptrdiff_t a_diff= a - ptr;
my_ptrdiff_t b_diff= b - ptr;
@@ -10262,7 +10323,7 @@ bool Column_definition::check(THD *thd)
break;
case MYSQL_TYPE_VARCHAR:
/*
- Long VARCHAR's are automaticly converted to blobs in mysql_prepare_table
+ Long VARCHAR's are automatically converted to blobs in mysql_prepare_table
if they don't have a default value
*/
max_field_charlength= MAX_FIELD_VARCHARLENGTH;
@@ -11043,7 +11104,7 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
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,
- table->s, field_name);
+ table->s->db.str, table->s->table_name.str, field_name);
else
set_warning(level, code, cuted_increment);
}
diff --git a/sql/field.h b/sql/field.h
index fa27b0d10a6..fea40251587 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1,7 +1,7 @@
#ifndef FIELD_INCLUDED
#define FIELD_INCLUDED
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2020, 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
@@ -270,7 +270,7 @@ protected:
};
- // String-to-number convertion methods for the old code compatibility
+ // String-to-number conversion methods for the old code compatibility
longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
const char *end) const
{
@@ -351,7 +351,7 @@ public:
/*
Item context attributes.
Comparison functions pass their attributes to propagate_equal_fields().
- For exmple, for string comparison, the collation of the comparison
+ For example, for string comparison, the collation of the comparison
operation is important inside propagate_equal_fields().
*/
class Context
@@ -484,7 +484,7 @@ inline bool is_timestamp_type(enum_field_types type)
/**
- Convert temporal real types as retuned by field->real_type()
+ Convert temporal real types as returned by field->real_type()
to field type as returned by field->type().
@param real_type Real type.
@@ -850,6 +850,18 @@ public:
enum_check_fields check_level);
int store(const LEX_STRING *ls, CHARSET_INFO *cs)
{ return store(ls->str, (uint32) ls->length, cs); }
+#ifdef HAVE_valgrind_or_MSAN
+ /**
+ Mark unused memory in the field as defined. Mainly used to ensure
+ that if we write full field to disk (for example in
+ Count_distinct_field::add(), we don't write unitalized data to
+ disk which would confuse valgrind or MSAN.
+ */
+ virtual void mark_unused_memory_as_defined() {}
+#else
+ void mark_unused_memory_as_defined() {}
+#endif
+
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
/*
@@ -1043,9 +1055,13 @@ public:
return type();
}
inline int cmp(const uchar *str) { return cmp(ptr,str); }
- virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
- { return cmp(a, b); }
virtual int cmp(const uchar *,const uchar *)=0;
+ /*
+ The following method is used for comparing prefix keys.
+ Currently it's only used in partitioning.
+ */
+ virtual int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len)
+ { return cmp(a, b); }
virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U)
{ return memcmp(a,b,pack_length()); }
virtual int cmp_offset(uint row_offset)
@@ -1206,6 +1222,13 @@ public:
void make_sort_key(uchar *buff, uint length);
virtual void make_field(Send_field *);
+
+ /*
+ Some implementations actually may write up to 8 bytes regardless of what
+ size was requested. This is due to the minimum value of the system variable
+ max_sort_length.
+ */
+
virtual void sort_string(uchar *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part);
virtual void free() {}
@@ -1316,6 +1339,8 @@ public:
virtual uint max_packed_col_length(uint max_length)
{ return max_length;}
+ virtual bool is_packable() const { return false; }
+
uint offset(uchar *record) const
{
return (uint) (ptr - record);
@@ -1804,6 +1829,7 @@ public:
bool can_optimize_range(const Item_bool_func *cond,
const Item *item,
bool is_eq_func) const;
+ bool is_packable() const { return true; }
};
/* base class for float and double and decimal (old one) */
@@ -3242,15 +3268,15 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset);
int store(longlong nr, bool unsigned_val);
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
+#ifdef HAVE_valgrind_or_MSAN
+ void mark_unused_memory_as_defined();
+#endif /* HAVE_valgrind_or_MSAN */
double val_real(void);
longlong val_int(void);
String *val_str(String*,String *);
my_decimal *val_decimal(my_decimal *);
- int cmp_max(const uchar *, const uchar *, uint max_length);
- int cmp(const uchar *a,const uchar *b)
- {
- return cmp_max(a, b, ~0U);
- }
+ int cmp(const uchar *a,const uchar *b);
+ int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len);
void sort_string(uchar *buff,uint length);
uint get_key_image(uchar *buff,uint length, imagetype type);
void set_key_image(const uchar *buff,uint length);
@@ -3367,9 +3393,8 @@ public:
longlong val_int(void);
String *val_str(String*,String *);
my_decimal *val_decimal(my_decimal *);
- int cmp_max(const uchar *, const uchar *, uint max_length);
- int cmp(const uchar *a,const uchar *b)
- { return cmp_max(a, b, ~0U); }
+ int cmp(const uchar *a,const uchar *b);
+ int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len);
int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length);
int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U);
int key_cmp(const uchar *,const uchar*);
@@ -3703,7 +3728,7 @@ private:
This is the reason:
- Field_bit::cmp_binary() is only implemented in the base class
(Field::cmp_binary()).
- - Field::cmp_binary() currenly use pack_length() to calculate how
+ - Field::cmp_binary() currently uses pack_length() to calculate how
long the data is.
- pack_length() includes size of the bits stored in the NULL bytes
of the record.
@@ -3758,7 +3783,7 @@ public:
}
int cmp_binary_offset(uint row_offset)
{ return cmp_offset(row_offset); }
- int cmp_max(const uchar *a, const uchar *b, uint max_length);
+ int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len);
int key_cmp(const uchar *a, const uchar *b)
{ return cmp_binary((uchar *) a, (uchar *) b); }
int key_cmp(const uchar *str, uint length);
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index e92f1930a7c..39136b830ba 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -229,7 +229,7 @@ static void do_skip(Copy_field *copy __attribute__((unused)))
note: if the record we're copying from is NULL-complemetned (i.e.
from_field->table->null_row==1), it will also have all NULLable columns to be
- set to NULLs, so we dont need to check table->null_row here.
+ set to NULLs, so we don't need to check table->null_row here.
*/
static void do_copy_null(Copy_field *copy)
diff --git a/sql/filesort.cc b/sql/filesort.cc
index f6530124b60..96f9aa874da 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2015, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -248,7 +248,8 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
while (memory_available >= min_sort_memory)
{
ulonglong keys= memory_available / (param.rec_length + sizeof(char*));
- param.max_keys_per_buffer= (uint) MY_MIN(num_rows, keys);
+ param.max_keys_per_buffer= (uint) MY_MAX(MERGEBUFF2,
+ MY_MIN(num_rows, keys));
if (sort->alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length))
break;
size_t old_memory_available= memory_available;
@@ -321,6 +322,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
param.max_keys_per_buffer=((param.max_keys_per_buffer *
(param.rec_length + sizeof(char*))) /
param.rec_length - 1);
+ set_if_bigger(param.max_keys_per_buffer, 1);
maxbuffer--; // Offset from 0
if (merge_many_buff(&param,
(uchar*) sort->get_sort_keys(),
@@ -482,7 +484,14 @@ uint Filesort::make_sortorder(THD *thd, JOIN *join, table_map first_table_bit)
if (item->type() == Item::FIELD_ITEM)
pos->field= ((Item_field*) item)->field;
else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
- pos->field= ((Item_sum*) item)->get_tmp_table_field();
+ {
+ // Aggregate, or Item_aggregate_ref
+ DBUG_ASSERT(first->type() == Item::SUM_FUNC_ITEM ||
+ (first->type() == Item::REF_ITEM &&
+ static_cast<Item_ref*>(first)->ref_type() ==
+ Item_ref::AGGREGATE_REF));
+ pos->field= first->get_tmp_table_field();
+ }
else if (item->type() == Item::COPY_STR_ITEM)
{ // Blob patch
pos->item= ((Item_copy*) item)->get_item();
@@ -876,12 +885,12 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
}
if (!quick_select)
{
- (void) file->extra(HA_EXTRA_NO_CACHE); /* End cacheing of records */
+ (void) file->extra(HA_EXTRA_NO_CACHE); /* End caching of records */
if (!next_pos)
file->ha_rnd_end();
}
- /* Signal we should use orignal column read and write maps */
+ /* Signal we should use original column read and write maps */
sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set);
if (thd->is_error())
@@ -1962,7 +1971,14 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->field)
{
CHARSET_INFO *cs= sortorder->field->sort_charset();
+ sortorder->type= sortorder->field->is_packable() ?
+ SORT_FIELD_ATTR::VARIABLE_SIZE :
+ SORT_FIELD_ATTR::FIXED_SIZE;
+
sortorder->length= sortorder->field->sort_length();
+ if (sortorder->is_variable_sized())
+ set_if_smaller(sortorder->length, thd->variables.max_sort_length);
+
if (use_strnxfrm((cs=sortorder->field->sort_charset())))
{
*multi_byte_charset= true;
@@ -1973,6 +1989,10 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
+ sortorder->type= sortorder->item->type_handler()->is_packable() ?
+ SORT_FIELD_ATTR::VARIABLE_SIZE :
+ SORT_FIELD_ATTR::FIXED_SIZE;
+
sortorder->item->sortlength(thd, sortorder->item, sortorder);
if (use_strnxfrm(sortorder->item->collation.collation))
{
@@ -1981,7 +2001,8 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
if (sortorder->item->maybe_null)
length++; // Place for NULL marker
}
- set_if_smaller(sortorder->length, thd->variables.max_sort_length);
+ if (sortorder->is_variable_sized())
+ set_if_smaller(sortorder->length, thd->variables.max_sort_length);
length+=sortorder->length;
}
sortorder->field= (Field*) 0; // end marker
diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc
index 0546ba3374d..c36e355b091 100644
--- a/sql/filesort_utils.cc
+++ b/sql/filesort_utils.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2020, 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
@@ -106,7 +107,6 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records,
DBUG_SET("+d,simulate_out_of_memory"););
buff_size= ((size_t)num_records) * (record_length + sizeof(uchar*));
- set_if_bigger(buff_size, record_length * MERGEBUFF2);
if (!m_idx_array.is_null())
{
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index d42babebf85..f63a3e717b4 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -1877,7 +1877,7 @@ int Gcalc_scan_iterator::add_eq_node(Gcalc_heap::Info *node, point *sp)
if (!en)
GCALC_DBUG_RETURN(1);
- /* eq_node iserted after teh equal point. */
+ /* eq_node inserted after the equal point. */
en->next= node->get_next();
node->next= en;
diff --git a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h
index 54b12962d2a..b5188f29dfd 100644
--- a/sql/gcalc_slicescan.h
+++ b/sql/gcalc_slicescan.h
@@ -362,9 +362,9 @@ enum Gcalc_scan_events
/*
- Gcalc_scan_iterator incapsulates the slisescan algorithm.
- It takes filled Gcalc_heap as an datasource. Then can be
- iterated trought the vertexes and intersection points with
+ Gcalc_scan_iterator incapsulates the slicescan algorithm.
+ It takes filled Gcalc_heap as a datasource. Then can be
+ iterated through the vertexes and intersection points with
the step() method. After the 'step()' one usually observes
the current 'slice' to do the necessary calculations, like
looking for intersections, calculating the area, whatever.
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index 8bd6a45f7aa..134032b0ffe 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -1184,14 +1184,14 @@ int Gcalc_operation_reducer::connect_threads(
{
rp0->outer_poly= prev_range->thread_start;
tb->thread_start= prev_range->thread_start;
- /* Chack if needed */
+ /* Check if needed */
ta->thread_start= prev_range->thread_start;
}
else
{
rp0->outer_poly= 0;
ta->thread_start= rp0;
- /* Chack if needed */
+ /* Check if needed */
tb->thread_start= rp0;
}
GCALC_DBUG_RETURN(0);
diff --git a/sql/gen_win_tzname_data.ps1 b/sql/gen_win_tzname_data.ps1
index 13b6ce6ffd0..c0a37d21895 100644
--- a/sql/gen_win_tzname_data.ps1
+++ b/sql/gen_win_tzname_data.ps1
@@ -4,7 +4,7 @@
write-output "/* This file was generated using gen_win_tzname_data.ps1 */"
$xdoc = new-object System.Xml.XmlDocument
-$xdoc.load("https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml")
+$xdoc.load("https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml")
$nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001)
foreach ($node in $nodes) {
write-output ('{L"'+ $node.other + '","'+ $node.type+'"},')
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 15e3a765075..daac3f6a86d 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -546,7 +546,7 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
point.
If you do not implement this, the default delete_table() is called from
- handler.cc and it will delete all files with the file extentions returned
+ handler.cc and it will delete all files with the file extensions returned
by bas_ext().
Called from handler.cc by delete_table and ha_create_table(). Only used
@@ -578,7 +578,7 @@ int ha_partition::delete_table(const char *name)
Renames a table from one name to another from alter table call.
If you do not implement this, the default rename_table() is called from
- handler.cc and it will rename all files with the file extentions returned
+ handler.cc and it will rename all files with the file extensions returned
by bas_ext().
Called from sql_table.cc by mysql_rename_table().
@@ -1432,7 +1432,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
/**
- @brief Check and repair the table if neccesary
+ @brief Check and repair the table if necessary
@param thd Thread object
@@ -2183,7 +2183,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
sub_elem= subpart_it++;
DBUG_ASSERT(sub_elem);
part= i * num_subparts + j;
- DBUG_ASSERT(part < m_file_tot_parts && m_file[part]);
+ DBUG_ASSERT(part < m_file_tot_parts);
+ DBUG_ASSERT(m_file[part]);
dummy_info.data_file_name= dummy_info.index_file_name = NULL;
m_file[part]->update_create_info(&dummy_info);
sub_elem->data_file_name = (char*) dummy_info.data_file_name;
@@ -2911,7 +2912,7 @@ error_end:
/**
Read the .par file to get the partitions engines and names
- @param name Name of table file (without extention)
+ @param name Name of table file (without extension)
@return Operation status
@retval true Failure
@@ -3139,7 +3140,7 @@ static uchar *get_part_name(PART_NAME_DEF *part, size_t *length,
@return Operation status
@retval true Failure
- @retval false Sucess
+ @retval false Success
*/
bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
@@ -3265,7 +3266,7 @@ err:
@return Operation status
@retval true Failure
- @retval false Sucess
+ @retval false Success
*/
bool ha_partition::set_ha_share_ref(Handler_share **ha_share_arg)
@@ -3770,7 +3771,8 @@ int ha_partition::external_lock(THD *thd, int lock_type)
MY_BITMAP *used_partitions;
DBUG_ENTER("ha_partition::external_lock");
- DBUG_ASSERT(!auto_increment_lock && !auto_increment_safe_stmt_log_lock);
+ DBUG_ASSERT(!auto_increment_lock);
+ DBUG_ASSERT(!auto_increment_safe_stmt_log_lock);
if (lock_type == F_UNLCK)
used_partitions= &m_locked_partitions;
@@ -4034,8 +4036,8 @@ void ha_partition::unlock_row()
bool ha_partition::was_semi_consistent_read()
{
DBUG_ENTER("ha_partition::was_semi_consistent_read");
- DBUG_ASSERT(m_last_part < m_tot_parts &&
- bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
+ DBUG_ASSERT(m_last_part < m_tot_parts);
+ DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read());
}
@@ -4149,7 +4151,7 @@ int ha_partition::write_row(uchar * buf)
/*
If we have failed to set the auto-increment value for this row,
it is highly likely that we will not be able to insert it into
- the correct partition. We must check and fail if neccessary.
+ the correct partition. We must check and fail if necessary.
*/
if (error)
goto exit;
@@ -4219,7 +4221,7 @@ exit:
have the previous row record in it, while new_data will have the newest
data in it.
Keep in mind that the server can do updates based on ordering if an
- ORDER BY clause was used. Consecutive ordering is not guarenteed.
+ ORDER BY clause was used. Consecutive ordering is not guaranteed.
Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
new_data is always record[0]
@@ -4361,7 +4363,7 @@ exit:
(from either a previous rnd_xxx() or index_xxx() call).
If you keep a pointer to the last row or can access a primary key it will
make doing the deletion quite a bit easier.
- Keep in mind that the server does no guarentee consecutive deletions.
+ Keep in mind that the server does no guarantee consecutive deletions.
ORDER BY clauses can be used.
Called in sql_acl.cc and sql_udf.cc to manage internal table information.
@@ -4745,7 +4747,7 @@ int ha_partition::end_bulk_insert()
When scan is used we will scan one handler partition at a time.
When preparing for rnd_pos we will init all handler partitions.
- No extra cache handling is needed when scannning is not performed.
+ No extra cache handling is needed when scanning is not performed.
Before initialising we will call rnd_end to ensure that we clean up from
any previous incarnation of a table scan.
@@ -5841,7 +5843,7 @@ int ha_partition::read_range_next()
SYNOPSIS
ha_partition::partition_scan_set_up()
buf Buffer to later return record in (this function
- needs it to calculcate partitioning function
+ needs it to calculate partitioning function
values)
idx_read_flag TRUE <=> m_start_key has range start endpoint which
@@ -5910,8 +5912,8 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
m_ordered_scan_ongoing= m_ordered;
}
- DBUG_ASSERT(m_part_spec.start_part < m_tot_parts &&
- m_part_spec.end_part < m_tot_parts);
+ DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
+ DBUG_ASSERT(m_part_spec.end_part < m_tot_parts);
DBUG_RETURN(0);
}
@@ -6876,7 +6878,7 @@ static int end_keyread_cb(handler* h, void *unused)
function after completing a query.
3) It is called when deleting the QUICK_RANGE_SELECT object if the
QUICK_RANGE_SELECT object had its own handler object. It is called
- immediatley before close of this local handler object.
+ immediately before close of this local handler object.
HA_EXTRA_KEYREAD:
HA_EXTRA_NO_KEYREAD:
These parameters are used to provide an optimisation hint to the handler.
@@ -6913,7 +6915,7 @@ static int end_keyread_cb(handler* h, void *unused)
HA_EXTRA_IGNORE_DUP_KEY:
HA_EXTRA_NO_IGNORE_DUP_KEY:
Informs the handler to we will not stop the transaction if we get an
- duplicate key errors during insert/upate.
+ duplicate key errors during insert/update.
Always called in pair, triggered by INSERT IGNORE and other similar
SQL constructs.
Not used by MyISAM.
@@ -8332,7 +8334,7 @@ bool ha_partition::prepare_inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
- Non allowed changes would be catched in prep_alter_part_table().
+ Non allowed changes would be caught in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->flags == Alter_info::ALTER_PARTITION)
DBUG_RETURN(false);
@@ -8365,7 +8367,7 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
- Non allowed changes would be catched in prep_alter_part_table().
+ Non allowed changes would be caught in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->flags == Alter_info::ALTER_PARTITION)
DBUG_RETURN(false);
@@ -8410,7 +8412,7 @@ bool ha_partition::commit_inplace_alter_table(TABLE *altered_table,
/*
Changing to similar partitioning, only update metadata.
- Non allowed changes would be catched in prep_alter_part_table().
+ Non allowed changes would be caught in prep_alter_part_table().
*/
if (ha_alter_info->alter_info->flags == Alter_info::ALTER_PARTITION)
DBUG_RETURN(false);
@@ -8653,7 +8655,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
DBUG_PRINT("info", ("offset: %lu inc: %lu desired_values: %lu "
"first_value: %lu", (ulong) offset, (ulong) increment,
(ulong) nb_desired_values, (ulong) *first_value));
- DBUG_ASSERT(increment && nb_desired_values);
+ DBUG_ASSERT(increment);
+ DBUG_ASSERT(nb_desired_values);
*first_value= 0;
if (table->s->next_number_keypart)
{
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 1bd3209d82d..a48aa639237 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -285,7 +285,7 @@ public:
-------------------------------------------------------------------------
MODULE create/delete handler object
-------------------------------------------------------------------------
- Object create/delete methode. The normal called when a table object
+ Object create/delete method. Normally called when a table object
exists. There is also a method to create the handler object with only
partition information. This is used from mysql_create_table when the
table is to be created and the engine type is deduced to be the
@@ -583,7 +583,7 @@ public:
/**
@breif
- Positions an index cursor to the index specified in the hanlde. Fetches the
+ Positions an index cursor to the index specified in the handle. Fetches the
row if available. If the key value is null, begin at first key of the
index.
*/
@@ -800,7 +800,7 @@ public:
HA_REC_NOT_IN_SEQ:
This flag is set for handlers that cannot guarantee that the rows are
- returned accroding to incremental positions (0, 1, 2, 3...).
+ returned according to incremental positions (0, 1, 2, 3...).
This also means that rnd_next() should return HA_ERR_RECORD_DELETED
if it finds a deleted row.
(MyISAM (not fixed length row), HEAP, InnoDB)
diff --git a/sql/handler.cc b/sql/handler.cc
index 914a4dc07b1..d2408767530 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -724,7 +724,7 @@ int ha_end()
/*
- This should be eventualy based on the graceful shutdown flag.
+ This should be eventually based on the graceful shutdown flag.
So if flag is equal to HA_PANIC_CLOSE, the deallocate
the errors.
*/
@@ -1333,8 +1333,8 @@ int ha_commit_trans(THD *thd, bool all)
THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt;
/*
"real" is a nick name for a transaction for which a commit will
- make persistent changes. E.g. a 'stmt' transaction inside a 'all'
- transation is not 'real': even though it's possible to commit it,
+ make persistent changes. E.g. a 'stmt' transaction inside an 'all'
+ transaction is not 'real': even though it's possible to commit it,
the changes are not durable as they might be rolled back if the
enclosing 'all' transaction is rolled back.
*/
@@ -1806,29 +1806,33 @@ int ha_commit_or_rollback_by_xid(XID *xid, bool commit)
#ifndef DBUG_OFF
-/**
- @note
- This does not need to be multi-byte safe or anything
-*/
-static char* xid_to_str(char *buf, XID *xid)
+/** Converts XID to string.
+
+@param[out] buf output buffer
+@param[in] xid XID to convert
+
+@return pointer to converted string
+
+@note This does not need to be multi-byte safe or anything */
+char *xid_to_str(char *buf, const XID &xid)
{
int i;
char *s=buf;
*s++='\'';
- for (i=0; i < xid->gtrid_length+xid->bqual_length; i++)
+ for (i= 0; i < xid.gtrid_length + xid.bqual_length; i++)
{
- uchar c=(uchar)xid->data[i];
+ uchar c= (uchar) xid.data[i];
/* is_next_dig is set if next character is a number */
bool is_next_dig= FALSE;
if (i < XIDDATASIZE)
{
- char ch= xid->data[i+1];
+ char ch= xid.data[i + 1];
is_next_dig= (ch >= '0' && ch <='9');
}
- if (i == xid->gtrid_length)
+ if (i == xid.gtrid_length)
{
*s++='\'';
- if (xid->bqual_length)
+ if (xid.bqual_length)
{
*s++='.';
*s++='\'';
@@ -1949,7 +1953,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
{
#ifndef DBUG_OFF
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("ignore xid %s", xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("ignore xid %s", xid_to_str(buf, info->list[i])));
#endif
xid_cache_insert(info->list+i, XA_PREPARED);
info->found_foreign_xids++;
@@ -1979,7 +1984,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
if (rc == 0)
{
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("commit xid %s", xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("commit xid %s", xid_to_str(buf, info->list[i])));
}
#endif
}
@@ -1993,8 +1999,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
if (rc == 0)
{
char buf[XIDDATASIZE*4+6]; // see xid_to_str
- DBUG_PRINT("info", ("rollback xid %s",
- xid_to_str(buf, info->list+i)));
+ DBUG_PRINT("info",
+ ("rollback xid %s", xid_to_str(buf, info->list[i])));
}
#endif
}
@@ -2488,7 +2494,7 @@ handler *handler::clone(const char *name, MEM_ROOT *mem_root)
/*
TODO: Implement a more efficient way to have more than one index open for
- the same table instance. The ha_open call is not cachable for clone.
+ the same table instance. The ha_open call is not cacheable for clone.
This is not critical as the engines already have the table open
and should be able to use the original instance of the table.
@@ -3302,7 +3308,7 @@ int handler::update_auto_increment()
index_init() or rnd_init() and in any column_bitmaps_signal() call after
this.
- The handler is allowd to do changes to the bitmap after a index_init or
+ The handler is allowed to do changes to the bitmap after a index_init or
rnd_init() call is made as after this, MySQL will not use the bitmap
for any program logic checking.
*/
@@ -3365,7 +3371,7 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
{ // Autoincrement at key-start
error= ha_index_last(table->record[1]);
/*
- MySQL implicitely assumes such method does locking (as MySQL decides to
+ MySQL implicitly assumes such method does locking (as MySQL decides to
use nr+increment without checking again with the handler, in
handler::update_auto_increment()), so reserves to infinite.
*/
@@ -4159,6 +4165,19 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
/**
+ End bulk insert
+*/
+
+int handler::ha_end_bulk_insert()
+{
+ DBUG_ENTER("handler::ha_end_bulk_insert");
+ DBUG_EXECUTE_IF("crash_end_bulk_insert",
+ { extra(HA_EXTRA_FLUSH) ; DBUG_SUICIDE();});
+ estimation_rows_to_insert= 0;
+ DBUG_RETURN(end_bulk_insert());
+}
+
+/**
Bulk update row: public interface.
@sa handler::bulk_update_row()
@@ -5589,6 +5608,7 @@ extern "C" enum icp_result handler_index_cond_check(void* h_arg)
THD *thd= h->table->in_use;
enum icp_result res;
+ DEBUG_SYNC(thd, "handler_index_cond_check");
enum thd_kill_levels abort_at= h->has_transactions() ?
THD_ABORT_SOFTLY : THD_ABORT_ASAP;
if (thd_kill_level(thd) > abort_at)
diff --git a/sql/handler.h b/sql/handler.h
index a51d5dae01a..0aa56afe1a5 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -212,7 +212,7 @@ enum enum_alter_inplace_result {
this flag must implement start_read_removal() and end_read_removal().
The handler may return "fake" rows constructed from the key of the row
asked for. This is used to optimize UPDATE and DELETE by reducing the
- numer of roundtrips between handler and storage engine.
+ number of roundtrips between handler and storage engine.
Example:
UPDATE a=1 WHERE pk IN (<keys>)
@@ -485,7 +485,7 @@ enum enum_binlog_command {
/* Bits in used_fields */
#define HA_CREATE_USED_AUTO (1UL << 0)
-#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer availble
+#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer available
#define HA_CREATE_USED_UNION (1UL << 2)
#define HA_CREATE_USED_INSERT_METHOD (1UL << 3)
#define HA_CREATE_USED_MIN_ROWS (1UL << 4)
@@ -953,7 +953,7 @@ struct handler_iterator {
/*
Pointer to buffer for the iterator to use.
Should be allocated by function which created the iterator and
- destroied by freed by above "destroy" call
+ destroyed by freed by above "destroy" call
*/
void *buffer;
};
@@ -1169,7 +1169,7 @@ struct handlerton
"cookie".
The flush and call of commit_checkpoint_notify_ha() need not happen
- immediately - it can be scheduled and performed asynchroneously (ie. as
+ immediately - it can be scheduled and performed asynchronously (ie. as
part of next prepare(), or sync every second, or whatever), but should
not be postponed indefinitely. It is however also permissible to do it
immediately, before returning from commit_checkpoint_request().
@@ -1254,13 +1254,13 @@ struct handlerton
Used by open_table_error(), by the default rename_table and delete_table
handler methods, and by the default discovery implementation.
- For engines that have more than one file name extentions (separate
+ For engines that have more than one file name extensions (separate
metadata, index, and/or data files), the order of elements is relevant.
- First element of engine file name extentions array should be metadata
- file extention. This is implied by the open_table_error()
+ First element of engine file name extensions array should be metadata
+ file extension. This is implied by the open_table_error()
and the default discovery implementation.
- Second element - data file extention. This is implied
+ Second element - data file extension. This is implied
assumed by REPAIR TABLE ... USE_FRM implementation.
*/
const char **tablefile_extensions; // by default - empty list
@@ -1761,7 +1761,7 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
CONVERT TO CHARACTER SET DEFAULT
to
CONVERT TO CHARACTER SET <character-set-of-the-current-database>
- TODO: Should't we postpone resolution of DEFAULT until the
+ TODO: Shouldn't we postpone resolution of DEFAULT until the
character set of the table owner database is loaded from its db.opt?
*/
DBUG_ASSERT(cs);
@@ -2653,7 +2653,7 @@ public:
ha_statistics stats;
/** MultiRangeRead-related members: */
- range_seq_t mrr_iter; /* Interator to traverse the range sequence */
+ range_seq_t mrr_iter; /* Iterator to traverse the range sequence */
RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */
HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */
uint ranges_in_seq; /* Total number of ranges in the traversed sequence */
@@ -2911,13 +2911,7 @@ public:
start_bulk_insert(rows, flags);
DBUG_VOID_RETURN;
}
- int ha_end_bulk_insert()
- {
- DBUG_ENTER("handler::ha_end_bulk_insert");
- estimation_rows_to_insert= 0;
- int ret= end_bulk_insert();
- DBUG_RETURN(ret);
- }
+ int ha_end_bulk_insert();
int ha_bulk_update_row(const uchar *old_data, uchar *new_data,
uint *dup_key_found);
int ha_delete_all_rows();
@@ -3496,7 +3490,7 @@ public:
This method offers the storage engine, the possibility to store a reference
to a table name which is going to be used with query cache.
The method is called each time a statement is written to the cache and can
- be used to verify if a specific statement is cachable. It also offers
+ be used to verify if a specific statement is cacheable. It also offers
the possibility to register a generic (but static) call back function which
is called each time a statement is matched against the query cache.
@@ -4387,4 +4381,16 @@ void print_keydup_error(TABLE *table, KEY *key, myf errflag);
int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info);
int del_global_table_stat(THD *thd, LEX_STRING *db, LEX_STRING *table);
+#ifndef DBUG_OFF
+/** Converts XID to string.
+
+@param[out] buf output buffer
+@param[in] xid XID to convert
+
+@return pointer to converted string
+
+@note This does not need to be multi-byte safe or anything */
+char *xid_to_str(char *buf, const XID &xid);
+#endif // !DBUG_OFF
+
#endif /* HANDLER_INCLUDED */
diff --git a/sql/item.cc b/sql/item.cc
index 333d71ddf70..994d45a9dc3 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2010, 2018, MariaDB Corporation
+ Copyright (c) 2010, 2020, 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
@@ -158,6 +158,19 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
}
+longlong Item::val_datetime_packed_result()
+{
+ MYSQL_TIME ltime, tmp;
+ if (get_date_result(&ltime, TIME_FUZZY_DATES | TIME_INVALID_DATES))
+ return 0;
+ if (ltime.time_type != MYSQL_TIMESTAMP_TIME)
+ return pack_time(&ltime);
+ if ((null_value= time_to_datetime_with_warn(current_thd, &ltime, &tmp, 0)))
+ return 0;
+ return pack_time(&tmp);
+}
+
+
/**
Get date/time/datetime.
If DATETIME or DATE result is returned, it's converted to TIME.
@@ -1414,7 +1427,7 @@ err:
bool Item::make_zero_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
/*
- if the item was not null and convertion failed, we return a zero date
+ if the item was not null and conversion failed, we return a zero date
if allowed, otherwise - null.
*/
bzero((char*) ltime,sizeof(*ltime));
@@ -2312,22 +2325,13 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll,
bool res= FALSE;
uint i;
- /*
- In case we're in statement prepare, create conversion item
- in its memory: it will be reused on each execute.
- */
- Query_arena backup;
- Query_arena *arena= thd->stmt_arena->is_stmt_prepare() ?
- thd->activate_stmt_arena_if_needed(&backup) :
- NULL;
+ DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare());
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
{
Item* conv= (*arg)->safe_charset_converter(thd, coll.collation);
if (conv == *arg)
continue;
- if (!conv && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
- conv= new (thd->mem_root) Item_func_conv_charset(thd, *arg, coll.collation, 1);
if (!conv)
{
@@ -2341,20 +2345,8 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll,
res= TRUE;
break; // we cannot return here, we need to restore "arena".
}
- /*
- If in statement prepare, then we create a converter for two
- constant items, do it once and then reuse it.
- If we're in execution of a prepared statement, arena is NULL,
- and the conv was created in runtime memory. This can be
- the case only if the argument is a parameter marker ('?'),
- because for all true constants the charset converter has already
- been created in prepare. In this case register the change for
- rollback.
- */
- if (thd->stmt_arena->is_stmt_prepare())
- *arg= conv;
- else
- thd->change_item_tree(arg, conv);
+
+ thd->change_item_tree(arg, conv);
if (conv->fix_fields(thd, arg))
{
@@ -2362,8 +2354,6 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll,
break; // we cannot return here, we need to restore "arena".
}
}
- if (arena)
- thd->restore_active_arena(arena, &backup);
return res;
}
@@ -2376,37 +2366,40 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll,
@param mem_root part of the memory for the clone
@details
- This method gets copy of the current item and also
- build clones for its referencies. For the referencies
- build_copy is called again.
+ This method fisrt builds clones of the arguments. If it is successful with
+ buiding the clones then it constructs a copy of this Item_func_or_sum object
+ and attaches to it the built clones of the arguments.
@retval
- clone of the item
- 0 if an error occured
+ clone of the item on success
+ 0 on a failure
*/
Item* Item_func_or_sum::build_clone(THD *thd, MEM_ROOT *mem_root)
{
- Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd, mem_root);
- if (!copy)
- return 0;
+ Item *copy_tmp_args[2]= {0,0};
+ Item **copy_args= copy_tmp_args;
if (arg_count > 2)
{
- copy->args=
- (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count);
- if (!copy->args)
+ if (!(copy_args= (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count)))
return 0;
}
- else if (arg_count > 0)
- copy->args= copy->tmp_arg;
-
-
for (uint i= 0; i < arg_count; i++)
{
Item *arg_clone= args[i]->build_clone(thd, mem_root);
if (!arg_clone)
return 0;
- copy->args[i]= arg_clone;
+ copy_args[i]= arg_clone;
+ }
+ Item_func_or_sum *copy= (Item_func_or_sum *) get_copy(thd, mem_root);
+ if (!copy)
+ return 0;
+ if (arg_count > 2)
+ copy->args= copy_args;
+ else if (arg_count > 0)
+ {
+ copy->args= copy->tmp_arg;
+ memcpy(copy->args, copy_args, sizeof(Item *) * arg_count);
}
return copy;
}
@@ -2855,12 +2848,13 @@ bool Item_field::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
bool Item_field::get_date_result(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
- if (result_field->is_null() || result_field->get_date(ltime,fuzzydate))
+ if ((null_value= result_field->is_null()) ||
+ result_field->get_date(ltime, fuzzydate))
{
bzero((char*) ltime,sizeof(*ltime));
- return (null_value= 1);
+ return true;
}
- return (null_value= 0);
+ return false;
}
@@ -3673,7 +3667,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, 0);
+ &str, time_type, NULL, NULL, NULL);
set_zero_time(&value.time, time_type);
}
maybe_null= 0;
@@ -4723,7 +4717,7 @@ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
@note
We have to mark all items between current_sel (including) and
- last_select (excluding) as dependend (select before last_select should
+ last_select (excluding) as dependent (select before last_select should
be marked with actual table mask used by resolved item, all other with
OUTER_REF_TABLE_BIT) and also write dependence information to Item of
resolved identifier.
@@ -5099,7 +5093,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
bool upward_lookup= FALSE;
TABLE_LIST *table_list;
- /* Calulate the TABLE_LIST for the table */
+ /* Calculate the TABLE_LIST for the table */
table_list= (cached_table ? cached_table :
field_found && (*from_field) != view_ref_found ?
(*from_field)->table->pos_in_table_list : 0);
@@ -5828,7 +5822,7 @@ Item *Item_field::propagate_equal_fields(THD *thd,
but failed to create a valid DATE literal from the given string literal.
Do not do constant propagation in such cases and unlink
- "this" from the found Item_equal (as this equality not usefull).
+ "this" from the found Item_equal (as this equality not useful).
*/
item_equal= NULL;
return this;
@@ -6644,7 +6638,7 @@ Item_float::Item_float(THD *thd, const char *str_arg, uint length):
&error);
if (error)
{
- char tmp[NAME_LEN + 1];
+ char tmp[NAME_LEN + 2];
my_snprintf(tmp, sizeof(tmp), "%.*s", length, str_arg);
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", tmp);
}
@@ -7216,7 +7210,6 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
(item->type() == Item::REF_ITEM &&
((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF));
- Item *producing_item;
Item_field *field_item= NULL;
Item_equal *item_equal= item->get_item_equal();
table_map tab_map= sel->master_unit()->derived->table->map;
@@ -7238,6 +7231,7 @@ Item *find_producing_item(Item *item, st_select_lex *sel)
List_iterator_fast<Item> li(sel->item_list);
if (field_item)
{
+ Item *producing_item= NULL;
uint field_no= field_item->field->field_index;
for (uint i= 0; i <= field_no; i++)
producing_item= li++;
@@ -7618,7 +7612,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
/*
Due to cache, find_field_in_tables() can return field which
doesn't belong to provided outer_context. In this case we have
- to find proper field context in order to fix field correcly.
+ to find proper field context in order to fix field correctly.
*/
do
{
@@ -7803,9 +7797,9 @@ Item* Item_ref::transform(THD *thd, Item_transformer transformer, uchar *arg)
callback functions.
First the function applies the analyzer to the Item_ref object. Then
- if the analizer succeeeds we first applies the compile method to the
+ if the analyzer succeeds we first apply the compile method to the
object the Item_ref object is referencing. If this returns a new
- item the old item is substituted for a new one. After this the
+ item the old item is substituted for a new one. After this the
transformer is applied to the Item_ref object itself.
The compile function is not called if the analyzer returns NULL
in the parameter arg_p.
@@ -8014,7 +8008,7 @@ bool Item_ref::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
longlong Item_ref::val_datetime_packed()
{
DBUG_ASSERT(fixed);
- longlong tmp= (*ref)->val_datetime_packed();
+ longlong tmp= (*ref)->val_datetime_packed_result();
null_value= (*ref)->null_value;
return tmp;
}
@@ -8023,7 +8017,7 @@ longlong Item_ref::val_datetime_packed()
longlong Item_ref::val_time_packed()
{
DBUG_ASSERT(fixed);
- longlong tmp= (*ref)->val_time_packed();
+ longlong tmp= (*ref)->val_time_packed_result();
null_value= (*ref)->null_value;
return tmp;
}
@@ -8862,6 +8856,46 @@ bool Item_direct_view_ref::excl_dep_on_grouping_fields(st_select_lex *sel)
}
+double Item_direct_view_ref::val_result()
+{
+ double tmp=(*ref)->val_result();
+ null_value=(*ref)->null_value;
+ return tmp;
+}
+
+
+longlong Item_direct_view_ref::val_int_result()
+{
+ longlong tmp=(*ref)->val_int_result();
+ null_value=(*ref)->null_value;
+ return tmp;
+}
+
+
+String *Item_direct_view_ref::str_result(String* tmp)
+{
+ tmp=(*ref)->str_result(tmp);
+ null_value=(*ref)->null_value;
+ return tmp;
+}
+
+
+my_decimal *Item_direct_view_ref::val_decimal_result(my_decimal *val)
+{
+ my_decimal *tmp= (*ref)->val_decimal_result(val);
+ null_value=(*ref)->null_value;
+ return tmp;
+}
+
+
+bool Item_direct_view_ref::val_bool_result()
+{
+ bool tmp= (*ref)->val_bool_result();
+ null_value=(*ref)->null_value;
+ return tmp;
+}
+
+
bool Item_default_value::eq(const Item *item, bool binary_cmp) const
{
return item->type() == DEFAULT_VALUE_ITEM &&
@@ -8911,8 +8945,10 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) thd->alloc(field_arg->field->size_of())))
goto error;
+ cached_field= def_field;
memcpy((void *)def_field, (void *)field_arg->field,
field_arg->field->size_of());
+ def_field->reset_fields();
// If non-constant default value expression
if (def_field->default_value && def_field->default_value->flags)
{
@@ -8940,6 +8976,12 @@ error:
return TRUE;
}
+void Item_default_value::cleanup()
+{
+ delete cached_field; // Free cached blob data
+ cached_field= 0;
+ Item_field::cleanup();
+}
void Item_default_value::print(String *str, enum_query_type query_type)
{
@@ -10044,6 +10086,8 @@ bool Item_cache_str::cache_value()
value_buff.copy(*value);
value= &value_buff;
}
+ else
+ value_buff.copy();
return TRUE;
}
@@ -10483,7 +10527,7 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
}
/**
- Calculate lenth for merging result for given Item type.
+ Calculate length for merging result for given Item type.
@param item Item for length detection
diff --git a/sql/item.h b/sql/item.h
index ff4cfd6c1b8..a49f9e8e5e4 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -82,20 +82,19 @@ enum precedence {
XOR_PRECEDENCE, // XOR
AND_PRECEDENCE, // AND, &&
NOT_PRECEDENCE, // NOT (unless HIGH_NOT_PRECEDENCE)
- BETWEEN_PRECEDENCE, // BETWEEN, CASE, WHEN, THEN, ELSE
- CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN
+ CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS
+ BETWEEN_PRECEDENCE, // BETWEEN
+ IN_PRECEDENCE, // IN, LIKE, REGEXP
BITOR_PRECEDENCE, // |
BITAND_PRECEDENCE, // &
SHIFT_PRECEDENCE, // <<, >>
- ADDINTERVAL_PRECEDENCE, // first argument in +INTERVAL
+ INTERVAL_PRECEDENCE, // first argument in +INTERVAL
ADD_PRECEDENCE, // +, -
MUL_PRECEDENCE, // *, /, DIV, %, MOD
BITXOR_PRECEDENCE, // ^
PIPES_PRECEDENCE, // || (if PIPES_AS_CONCAT)
- NEG_PRECEDENCE, // unary -, ~
- BANG_PRECEDENCE, // !, NOT (if HIGH_NOT_PRECEDENCE)
+ NEG_PRECEDENCE, // unary -, ~, !, NOT (if HIGH_NOT_PRECEDENCE)
COLLATE_PRECEDENCE, // BINARY, COLLATE
- INTERVAL_PRECEDENCE, // INTERVAL
DEFAULT_PRECEDENCE,
HIGHEST_PRECEDENCE
};
@@ -244,7 +243,7 @@ void dummy_error_processor(THD *thd, void *data);
void view_error_processor(THD *thd, void *data);
/*
- Instances of Name_resolution_context store the information necesary for
+ Instances of Name_resolution_context store the information necessary for
name resolution of Items and other context analysis of a query made in
fix_fields().
@@ -402,7 +401,7 @@ public:
Monotonicity is defined only for Item* trees that represent table
partitioning expressions (i.e. have no subselects/user vars/PS parameters
etc etc). An Item* tree is assumed to have the same monotonicity properties
- as its correspoinding function F:
+ as its corresponding function F:
[signed] longlong F(field1, field2, ...) {
put values of field_i into table record buffer;
@@ -746,7 +745,7 @@ protected:
return rc;
}
/*
- This method is used if the item was not null but convertion to
+ This method is used if the item was not null but conversion to
TIME/DATE/DATETIME failed. We return a zero date if allowed,
otherwise - null.
*/
@@ -947,7 +946,7 @@ public:
/*
real_type() is the type of base item. This is same as type() for
most items, except Item_ref() and Item_cache_wrapper() where it
- shows the type for the underlaying item.
+ shows the type for the underlying item.
*/
virtual enum Type real_type() const { return type(); }
@@ -1054,7 +1053,7 @@ public:
The caller can modify the returned String, if it's not marked
"const" (with the String::mark_as_const() method). That means that
if the item returns its own internal buffer (e.g. tmp_value), it
- *must* be marked "const" [1]. So normally it's preferrable to
+ *must* be marked "const" [1]. So normally it's preferable to
return the result value in the String, that was passed as an
argument. But, for example, SUBSTR() returns a String that simply
points into the buffer of SUBSTR()'s args[0]->val_str(). Such a
@@ -1301,6 +1300,13 @@ public:
a constant expression. Used in the optimizer to propagate basic constants.
*/
virtual bool basic_const_item() const { return 0; }
+ /*
+ Determines if the expression is allowed as
+ a virtual column assignment source:
+ INSERT INTO t1 (vcol) VALUES (10) -> error
+ INSERT INTO t1 (vcol) VALUES (NULL) -> ok
+ */
+ virtual bool vcol_assignment_allowed_value() const { return false; }
/* cloning of constant items (0 if it is not const) */
virtual Item *clone_item(THD *thd) { return 0; }
virtual Item* build_clone(THD *thd, MEM_ROOT *mem_root) { return get_copy(thd, mem_root); }
@@ -1376,6 +1382,8 @@ public:
mysql_register_view().
*/
virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; }
+ enum precedence higher_precedence() const
+ { return (enum precedence)(precedence() + 1); }
void print_parenthesised(String *str, enum_query_type query_type,
enum precedence parent_prec);
/**
@@ -1424,7 +1432,7 @@ public:
@param cond_ptr[OUT] Store a replacement item here if the condition
can be simplified, e.g.:
WHERE part1 OR part2 OR part3
- with one of the partN evalutating to SEL_TREE::ALWAYS.
+ with one of the partN evaluating to SEL_TREE::ALWAYS.
*/
virtual SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr);
/*
@@ -1503,6 +1511,13 @@ public:
uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES | TIME_TIME_ONLY;
return get_date(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
}
+ longlong val_datetime_packed_result();
+ longlong val_time_packed_result()
+ {
+ MYSQL_TIME ltime;
+ uint fuzzydate= TIME_TIME_ONLY | TIME_INVALID_DATES | TIME_FUZZY_DATES;
+ return get_date_result(&ltime, fuzzydate) ? 0 : pack_time(&ltime);
+ }
// Get a temporal value in packed DATE/DATETIME or TIME format
longlong val_temporal_packed(enum_field_types f_type)
{
@@ -1997,7 +2012,7 @@ public:
virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; }
/**
- Checks if this item or any of its decendents contains a subquery.
+ Checks if this item or any of its descendents contains a subquery.
*/
virtual bool has_subquery() const { return with_subselect; }
@@ -2893,6 +2908,7 @@ public:
collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII);
}
enum Type type() const { return NULL_ITEM; }
+ bool vcol_assignment_allowed_value() const { return true; }
bool eq(const Item *item, bool binary_cmp) const { return null_eq(item); }
double val_real();
longlong val_int();
@@ -3075,6 +3091,25 @@ public:
*/
enum enum_indicator_type indicator;
+ bool vcol_assignment_allowed_value() const
+ {
+ switch (state) {
+ case NULL_VALUE:
+ case DEFAULT_VALUE:
+ case IGNORE_VALUE:
+ return true;
+ case NO_VALUE:
+ case INT_VALUE:
+ case REAL_VALUE:
+ case STRING_VALUE:
+ case TIME_VALUE:
+ case LONG_DATA_VALUE:
+ case DECIMAL_VALUE:
+ break;
+ }
+ return false;
+ }
+
/*
A buffer for string and long data values. Historically all allocated
values returned from val_str() were treated as eligible to
@@ -3106,7 +3141,6 @@ public:
enum Type type() const
{
- DBUG_ASSERT(fixed || state == NO_VALUE);
return item_type;
}
@@ -4508,7 +4542,11 @@ public:
{
(*ref)->restore_to_before_no_rows_in_result();
}
- virtual void print(String *str, enum_query_type query_type);
+ void print(String *str, enum_query_type query_type);
+ enum precedence precedence() const
+ {
+ return ref ? (*ref)->precedence() : DEFAULT_PRECEDENCE;
+ }
void cleanup();
Item_field *field_for_view_update()
{ return (*ref)->field_for_view_update(); }
@@ -4971,6 +5009,15 @@ public:
item_equal= NULL;
Item_direct_ref::cleanup();
}
+ /*
+ TODO move these val_*_result function to Item_dierct_ref (maybe)
+ */
+ double val_result();
+ longlong val_int_result();
+ String *str_result(String* tmp);
+ my_decimal *val_decimal_result(my_decimal *val);
+ bool val_bool_result();
+
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_direct_view_ref>(thd, mem_root, this); }
};
@@ -5167,7 +5214,7 @@ public:
This is the method that updates the cached value.
It must be explicitly called by the user of this class to store the value
- of the orginal item in the cache.
+ of the original item in the cache.
*/
virtual void copy() = 0;
@@ -5342,21 +5389,24 @@ class Item_default_value : public Item_field
void calculate();
public:
Item *arg;
+ Field *cached_field;
Item_default_value(THD *thd, Name_resolution_context *context_arg)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
- arg(NULL) {}
+ arg(NULL), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
- arg(a) {}
+ arg(a), cached_field(NULL) {}
Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a)
:Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL,
(const char *)NULL),
- arg(NULL) {}
+ arg(NULL),cached_field(NULL) {}
enum Type type() const { return DEFAULT_VALUE_ITEM; }
+ bool vcol_assignment_allowed_value() const { return arg == NULL; }
bool eq(const Item *item, bool binary_cmp) const;
bool fix_fields(THD *, Item **);
+ void cleanup();
void print(String *str, enum_query_type query_type);
String *val_str(String *str);
double val_real();
@@ -5758,6 +5808,13 @@ public:
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
int save_in_field(Field *field, bool no_conversions);
+ bool setup(THD *thd, Item *item)
+ {
+ if (Item_cache_int::setup(thd, item))
+ return true;
+ set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
+ return false;
+ }
Item_result cmp_type() const { return TIME_RESULT; }
void store_packed(longlong val_arg, Item *example);
/*
diff --git a/sql/item_buff.cc b/sql/item_buff.cc
index c0fcb93cbab..bc888c2b679 100644
--- a/sql/item_buff.cc
+++ b/sql/item_buff.cc
@@ -192,7 +192,7 @@ bool Cached_item_field::cmp(void)
/*
If value is not null and value changed (from null to not null or
- becasue of value change), then copy the new value to buffer.
+ because of value change), then copy the new value to buffer.
*/
if (! null_value && (tmp || (tmp= (field->cmp(buff) != 0))))
field->get_image(buff,length,field->charset());
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index a28daf36f05..2a0972216f8 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -891,6 +891,8 @@ int Arg_comparator::compare_decimal()
{
if (set_null)
owner->null_value= 0;
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val1, (*a)->decimals, 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val2, (*b)->decimals, 0);
return my_decimal_cmp(val1, val2);
}
}
@@ -915,7 +917,9 @@ int Arg_comparator::compare_e_decimal()
my_decimal *val2= (*b)->val_decimal(&decimal2);
if ((*a)->null_value || (*b)->null_value)
return MY_TEST((*a)->null_value && (*b)->null_value);
- return MY_TEST(my_decimal_cmp(val1, val2) == 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val1, (*a)->decimals, 0);
+ my_decimal_round_if_needed(E_DEC_FATAL_ERROR, val2, (*b)->decimals, 0);
+ return my_decimal_cmp(val1, val2) == 0;
}
@@ -1424,7 +1428,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
@note
Item_in_optimizer should work as pass-through for
- subqueries that were processed by ALL/ANY->MIN/MAX rewrite
- - subqueries taht were originally EXISTS subqueries (and were coverted by
+ - subqueries that were originally EXISTS subqueries (and were coinverted by
the EXISTS->IN rewrite)
When Item_in_optimizer is not not working as a pass-through, it
@@ -2017,8 +2021,8 @@ longlong Item_func_interval::val_int()
interval_range *range= intervals + mid;
my_bool cmp_result;
/*
- The values in the range intervall may have different types,
- Only do a decimal comparision of the first argument is a decimal
+ The values in the range interval may have different types,
+ Only do a decimal comparison if the first argument is a decimal
and we are comparing against a decimal
*/
if (dec && range->type == DECIMAL_RESULT)
@@ -2312,7 +2316,7 @@ longlong Item_func_between::val_int()
void Item_func_between::print(String *str, enum_query_type query_type)
{
- args[0]->print_parenthesised(str, query_type, precedence());
+ args[0]->print_parenthesised(str, query_type, higher_precedence());
if (negated)
str->append(STRING_WITH_LEN(" not"));
str->append(STRING_WITH_LEN(" between "));
@@ -2684,7 +2688,7 @@ Item_func_nullif::fix_length_and_dec()
Some examples of what NULLIF can end up with after argument
substitution (we don't mention args[1] in some cases for simplicity):
- 1. l_expr is not an aggragate function:
+ 1. l_expr is not an aggregate function:
a. No conversion happened.
args[0] and args[2] were not replaced to something else
@@ -2808,7 +2812,7 @@ Item_func_nullif::fix_length_and_dec()
In this case we remember and reuse m_arg0 during EXECUTE time as args[2].
QQ: How to make sure that m_args0 does not point
- to something temporary which will be destoyed between PREPARE and EXECUTE.
+ to something temporary which will be destroyed between PREPARE and EXECUTE.
The condition below should probably be more strict and somehow check that:
- change_item_tree() was called for the new args[0]
- m_args0 is referenced from inside args[0], e.g. as a function argument,
@@ -3243,7 +3247,7 @@ bool Item_func_case::fix_length_and_dec()
If we'll do string comparison, we also need to aggregate
character set and collation for first/WHEN items and
install converters for some of them to cmp_collation when necessary.
- This is done because cmp_item compatators cannot compare
+ This is done because cmp_item comparators cannot compare
strings in two different character sets.
Some examples when we install converters:
@@ -3375,15 +3379,15 @@ void Item_func_case::print(String *str, enum_query_type query_type)
for (uint i= first_expr_num + 1 ; i < nwhens + first_expr_num + 1; i++)
{
str->append(STRING_WITH_LEN("when "));
- args[i]->print_parenthesised(str, query_type, precedence());
+ args[i]->print(str, query_type);
str->append(STRING_WITH_LEN(" then "));
- args[i+nwhens]->print_parenthesised(str, query_type, precedence());
+ args[i+nwhens]->print(str, query_type);
str->append(' ');
}
if (else_expr_num != -1)
{
str->append(STRING_WITH_LEN("else "));
- args[else_expr_num]->print_parenthesised(str, query_type, precedence());
+ args[else_expr_num]->print(str, query_type);
str->append(' ');
}
str->append(STRING_WITH_LEN("end"));
@@ -4153,8 +4157,11 @@ void Item_func_in::fix_after_pullout(st_select_lex *new_parent, Item **ref,
eval_not_null_tables(NULL);
}
-static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
+static int srtcmp_in(const void *cs_, const void *x_, const void *y_)
{
+ const CHARSET_INFO *cs= static_cast<const CHARSET_INFO *>(cs_);
+ const String *x= static_cast<const String *>(x_);
+ const String *y= static_cast<const String *>(y_);
return cs->coll->strnncollsp(cs,
(uchar *) x->ptr(),x->length(),
(uchar *) y->ptr(),y->length());
@@ -5240,12 +5247,14 @@ void Item_func_like::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN(" not "));
str->append(func_name());
str->append(' ');
- args[1]->print_parenthesised(str, query_type, precedence());
if (escape_used_in_parsing)
{
+ args[1]->print_parenthesised(str, query_type, precedence());
str->append(STRING_WITH_LEN(" escape "));
- escape_item->print(str, query_type);
+ escape_item->print_parenthesised(str, query_type, higher_precedence());
}
+ else
+ args[1]->print_parenthesised(str, query_type, higher_precedence());
}
@@ -6959,7 +6968,7 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item)
and not ot2.col.
eliminate_item_equal() also has code that deals with equality substitution
- in presense of SJM nests.
+ in presence of SJM nests.
*/
TABLE_LIST *emb_nest;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index b4a905896db..22736339bf6 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -155,7 +155,7 @@ protected:
/*
Return the full select tree for "field_item" and "value":
- a single SEL_TREE if the field is not in a multiple equality, or
- - a conjuction of all SEL_TREEs for all fields from
+ - a conjunction of all SEL_TREEs for all fields from
the same multiple equality with "field_item".
*/
SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
@@ -574,7 +574,7 @@ public:
longlong val_int();
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
- enum precedence precedence() const { return BANG_PRECEDENCE; }
+ enum precedence precedence() const { return NEG_PRECEDENCE; }
Item *neg_transformer(THD *thd);
bool fix_fields(THD *, Item **);
virtual void print(String *str, enum_query_type query_type);
@@ -1590,7 +1590,6 @@ public:
uint decimal_precision() const;
table_map not_null_tables() const { return 0; }
const char *func_name() const { return "case"; }
- enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
virtual void print(String *str, enum_query_type query_type);
Item *find_item(String *str);
CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
@@ -1704,7 +1703,7 @@ public:
virtual void print(String *str, enum_query_type query_type);
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return "in"; }
- enum precedence precedence() const { return CMP_PRECEDENCE; }
+ enum precedence precedence() const { return IN_PRECEDENCE; }
bool eval_not_null_tables(void *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
bool count_sargable_conds(void *arg);
@@ -1915,7 +1914,7 @@ protected:
Item_func::Functype type, Item *value);
public:
int escape;
- bool negated;
+ bool negated;
Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used):
Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
@@ -1999,7 +1998,7 @@ public:
return this;
}
const char *func_name() const { return "like"; }
- enum precedence precedence() const { return CMP_PRECEDENCE; }
+ enum precedence precedence() const { return IN_PRECEDENCE; }
bool fix_fields(THD *thd, Item **ref);
bool fix_length_and_dec()
{
@@ -2127,7 +2126,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
bool fix_length_and_dec();
const char *func_name() const { return "regexp"; }
- enum precedence precedence() const { return CMP_PRECEDENCE; }
+ enum precedence precedence() const { return IN_PRECEDENCE; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
void print(String *str, enum_query_type query_type)
{
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 4b7400eb0c0..1cf5a06a3a4 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -7338,7 +7338,7 @@ Item *create_temporal_literal(THD *thd,
ErrConvString err(str, length, cs);
make_truncated_value_warning(thd,
Sql_condition::time_warn_level(status.warnings),
- &err, ltime.time_type, 0, 0);
+ &err, ltime.time_type, NULL, NULL, NULL);
}
return item;
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 6ca74a79b9c..4d03e209eab 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -110,7 +110,8 @@ Item_args::Item_args(THD *thd, const Item_args *other)
arg_count= 0;
return;
}
- memcpy(args, other->args, sizeof(Item*) * arg_count);
+ if (arg_count)
+ memcpy(args, other->args, sizeof(Item*) * arg_count);
}
@@ -365,7 +366,7 @@ Item *Item_func::transform(THD *thd, Item_transformer transformer, uchar *argume
callback functions.
First the function applies the analyzer to the root node of
- the Item_func object. Then if the analizer succeeeds (returns TRUE)
+ the Item_func object. Then if the analyzer succeeds (returns TRUE)
the function recursively applies the compile method to each argument
of the Item_func node.
If the call of the method for an argument item returns a new item
@@ -480,8 +481,7 @@ void Item_func::print_op(String *str, enum_query_type query_type)
str->append(func_name());
str->append(' ');
}
- args[arg_count-1]->print_parenthesised(str, query_type,
- (enum precedence)(precedence() + 1));
+ args[arg_count-1]->print_parenthesised(str, query_type, higher_precedence());
}
@@ -1768,7 +1768,7 @@ bool Item_func_div::fix_length_and_dec()
case TIME_RESULT:
DBUG_ASSERT(0);
}
- maybe_null= 1; // devision by zero
+ maybe_null= 1; // division by zero
DBUG_RETURN(FALSE);
}
@@ -1816,11 +1816,9 @@ longlong Item_func_int_div::val_int()
raise_integer_overflow();
return res;
}
-
- longlong val0=args[0]->val_int();
- longlong val1=args[1]->val_int();
- bool val0_negative, val1_negative, res_negative;
- ulonglong uval0, uval1, res;
+
+ Longlong_hybrid val0= args[0]->to_longlong_hybrid();
+ Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if ((null_value= (args[0]->null_value || args[1]->null_value)))
return 0;
if (val1 == 0)
@@ -1829,12 +1827,8 @@ longlong Item_func_int_div::val_int()
return 0;
}
- val0_negative= !args[0]->unsigned_flag && val0 < 0;
- val1_negative= !args[1]->unsigned_flag && val1 < 0;
- res_negative= val0_negative != val1_negative;
- uval0= (ulonglong) (val0_negative ? -val0 : val0);
- uval1= (ulonglong) (val1_negative ? -val1 : val1);
- res= uval0 / uval1;
+ bool res_negative= val0.neg() != val1.neg();
+ ulonglong res= val0.abs() / val1.abs();
if (res_negative)
{
if (res > (ulonglong) LONGLONG_MAX)
@@ -1848,7 +1842,7 @@ 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 */
+ /* use precision only 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);
@@ -1863,11 +1857,8 @@ bool Item_func_int_div::fix_length_and_dec()
longlong Item_func_mod::int_op()
{
DBUG_ASSERT(fixed == 1);
- longlong val0= args[0]->val_int();
- longlong val1= args[1]->val_int();
- bool val0_negative, val1_negative;
- ulonglong uval0, uval1;
- ulonglong res;
+ Longlong_hybrid val0= args[0]->to_longlong_hybrid();
+ Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if ((null_value= args[0]->null_value || args[1]->null_value))
return 0; /* purecov: inspected */
@@ -1882,13 +1873,9 @@ longlong Item_func_mod::int_op()
LONGLONG_MIN by -1 generates SIGFPE, we calculate using unsigned values and
then adjust the sign appropriately.
*/
- val0_negative= !args[0]->unsigned_flag && val0 < 0;
- val1_negative= !args[1]->unsigned_flag && val1 < 0;
- uval0= (ulonglong) (val0_negative ? -val0 : val0);
- uval1= (ulonglong) (val1_negative ? -val1 : val1);
- res= uval0 % uval1;
- return check_integer_overflow(val0_negative ? -(longlong) res : res,
- !val0_negative);
+ ulonglong res= val0.abs() % val1.abs();
+ return check_integer_overflow(val0.neg() ? -(longlong) res : res,
+ !val0.neg());
}
double Item_func_mod::real_op()
@@ -2338,6 +2325,9 @@ bool Item_func_int_val::fix_length_and_dec()
if ((args[0]->max_length - args[0]->decimals) >=
(DECIMAL_LONGLONG_DIGITS - 2))
{
+ fix_char_length(
+ my_decimal_precision_to_length_no_truncation(
+ args[0]->decimal_int_part(), 0, false));
set_handler_by_result_type(DECIMAL_RESULT);
}
else
@@ -2521,6 +2511,8 @@ bool Item_func_round::fix_length_and_dec()
precision-= decimals_delta - length_increase;
decimals= MY_MIN(decimals_to_set, DECIMAL_MAX_SCALE);
+ if (!precision)
+ precision= 1; // DECIMAL(0,0) -> DECIMAL(1,0)
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag);
@@ -2652,19 +2644,20 @@ void Item_func_rand::seed_random(Item *arg)
TODO: do not do reinit 'rand' for every execute of PS/SP if
args[0] is a constant.
*/
- uint32 tmp;
+ uint32 tmp= (uint32) arg->val_int();
#ifdef WITH_WSREP
- THD *thd= current_thd;
- if (WSREP(thd))
+ if (WSREP_ON)
{
- if (thd->wsrep_exec_mode==REPL_RECV)
- tmp= thd->wsrep_rand;
- else
- tmp= thd->wsrep_rand= (uint32) arg->val_int();
- }
- else
+ THD *thd= current_thd;
+ if (thd->variables.wsrep_on)
+ {
+ if (thd->wsrep_exec_mode==REPL_RECV)
+ tmp= thd->wsrep_rand;
+ else
+ thd->wsrep_rand= tmp;
+ }
+ }
#endif /* WITH_WSREP */
- tmp= (uint32) arg->val_int();
my_rnd_init(rand, (uint32) (tmp*0x10001L+55555555L),
(uint32) (tmp*0x10000001L));
@@ -4060,6 +4053,8 @@ int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex)
timeout= m_abs_timeout;
error= mysql_cond_timedwait(cond, mutex, &timeout);
+ if (m_thd->check_killed())
+ break;
if (error == ETIMEDOUT || error == ETIME)
{
/* Return error if timed out or connection is broken. */
@@ -4828,7 +4823,7 @@ bool Item_func_set_user_var::register_field_in_bitmap(void *arg)
@param type type of new value
@param cs charset info for new value
@param dv derivation for new value
- @param unsigned_arg indiates if a value of type INT_RESULT is unsigned
+ @param unsigned_arg indicates if a value of type INT_RESULT is unsigned
@note Sets error and fatal error if allocation fails.
@@ -6573,7 +6568,7 @@ void my_missing_function_error(const LEX_STRING &token, const char *func_name)
@brief Initialize the result field by creating a temporary dummy table
and assign it to a newly created field object. Meta data used to
create the field is fetched from the sp_head belonging to the stored
- proceedure found in the stored procedure functon cache.
+ procedure found in the stored procedure function cache.
@note This function should be called from fix_fields to init the result
field. It is some what related to Item_field.
@@ -6877,7 +6872,7 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
/*
Here we check privileges of the stored routine only during view
creation, in order to validate the view. A runtime check is
- perfomed in Item_func_sp::execute(), and this method is not
+ performed in Item_func_sp::execute(), and this method is not
called during context analysis. Notice, that during view
creation we do not infer into stored routine bodies and do not
check privileges of its statements, which would probably be a
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 645a3668ed8..1c3fafc0582 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
- Copyright (c) 2011, 2016, MariaDB
+ Copyright (c) 2011, 2020, 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
@@ -456,16 +456,18 @@ String *Item_func_boundary::val_str(String *str_value)
DBUG_ASSERT(fixed == 1);
String arg_val;
String *swkb= args[0]->val_str(&arg_val);
+
+ if ((null_value= args[0]->null_value))
+ DBUG_RETURN(0);
+
Geometry_buffer buffer;
- Geometry *g;
uint32 srid= 0;
Transporter trn(&res_receiver);
-
- if ((null_value=
- args[0]->null_value ||
- !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))
+
+ Geometry *g= Geometry::construct(&buffer, swkb->ptr(), swkb->length());
+ if (!g)
DBUG_RETURN(0);
-
+
if (g->store_shapes(&trn))
goto mem_error;
@@ -2389,12 +2391,15 @@ double Item_func_distance::val_real()
MBR mbr1, mbr2;
const char *c_end;
-
- if ((null_value= (args[0]->null_value || args[1]->null_value ||
- !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
- g1->get_mbr(&mbr1, &c_end) ||
- g2->get_mbr(&mbr2, &c_end))))
+ if (args[0]->null_value || args[1]->null_value)
+ goto mem_error;
+ g1= Geometry::construct(&buffer1, res1->ptr(), res1->length());
+ if (!g1)
+ goto mem_error;
+ g2= Geometry::construct(&buffer2, res2->ptr(), res2->length());
+ if (!g2)
+ goto mem_error;
+ if (g1->get_mbr(&mbr1, &c_end) || g2->get_mbr(&mbr2, &c_end))
goto mem_error;
mbr1.add_mbr(&mbr2);
@@ -2543,7 +2548,7 @@ String *Item_func_pointonsurface::val_str(String *str)
Geometry *g;
MBR mbr;
const char *c_end;
- double UNINIT_VAR(px), UNINIT_VAR(py), x0, y0;
+ double UNINIT_VAR(px), UNINIT_VAR(py), x0, UNINIT_VAR(y0);
String *result= 0;
const Gcalc_scan_iterator::point *pprev= NULL;
uint32 srid;
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc
index 3643daf903f..bb00ccf2771 100644
--- a/sql/item_inetfunc.cc
+++ b/sql/item_inetfunc.cc
@@ -206,7 +206,7 @@ String *Item_func_inet_str_base::val_str_ascii(String *buffer)
@return Completion status.
@retval false Given string does not represent an IPv4-address.
- @retval true The string has been converted sucessfully.
+ @retval true The string has been converted successfully.
@note The problem with inet_pton() is that it treats leading zeros in
IPv4-part differently on different platforms.
@@ -331,7 +331,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
@return Completion status.
@retval false Given string does not represent an IPv6-address.
- @retval true The string has been converted sucessfully.
+ @retval true The string has been converted successfully.
@note The problem with inet_pton() is that it treats leading zeros in
IPv4-part differently on different platforms.
@@ -677,7 +677,7 @@ static void ipv6_to_str(const in6_addr *ipv6, char *str)
@return Completion status.
@retval false Given string does not represent an IP-address.
- @retval true The string has been converted sucessfully.
+ @retval true The string has been converted successfully.
*/
bool Item_func_inet6_aton::calc_value(const String *arg, String *buffer)
@@ -717,7 +717,7 @@ bool Item_func_inet6_aton::calc_value(const String *arg, String *buffer)
@return Completion status.
@retval false The argument does not correspond to IP-address.
- @retval true The string has been converted sucessfully.
+ @retval true The string has been converted successfully.
*/
bool Item_func_inet6_ntoa::calc_value(const String *arg, String *buffer)
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 4db4c563d97..7db1ae1ffaf 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -962,6 +962,41 @@ double Item_func_json_extract::val_real()
}
+my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
+{
+ json_value_types type;
+ char *value;
+ int value_len;
+
+ if (read_json(NULL, &type, &value, &value_len) != NULL)
+ {
+ switch (type)
+ {
+ case JSON_VALUE_STRING:
+ case JSON_VALUE_NUMBER:
+ {
+ my_decimal *res= decimal_from_string_with_check(to, collation.collation,
+ value,
+ value + value_len);
+ null_value= res == NULL;
+ return res;
+ }
+ case JSON_VALUE_TRUE:
+ int2my_decimal(E_DEC_FATAL_ERROR, 1, false/*unsigned_flag*/, to);
+ return to;
+ case JSON_VALUE_OBJECT:
+ case JSON_VALUE_ARRAY:
+ case JSON_VALUE_FALSE:
+ case JSON_VALUE_NULL:
+ break;
+ };
+ }
+ int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
+ return to;
+}
+
+
+
bool Item_func_json_contains::fix_length_and_dec()
{
a2_constant= args[1]->const_item();
@@ -2394,6 +2429,8 @@ String *Item_func_json_merge_patch::val_str(String *str)
uint n_arg;
bool empty_result, merge_to_null;
+ /* To report errors properly if some JSON is invalid. */
+ je1.s.error= je2.s.error= 0;
merge_to_null= args[0]->null_value;
for (n_arg=1; n_arg < arg_count; n_arg++)
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index d7f804a1b60..0277cb15154 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -171,6 +171,7 @@ public:
String *val_str(String *);
longlong val_int();
double val_real();
+ my_decimal *val_decimal(my_decimal *);
uint get_n_paths() const { return arg_count - 1; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_json_extract>(thd, mem_root, this); }
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 000253ece07..6ae049dbfe5 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -166,17 +166,20 @@ void Item_row::bring_value()
Item* Item_row::build_clone(THD *thd, MEM_ROOT *mem_root)
{
- Item_row *copy= (Item_row *) get_copy(thd, mem_root);
- if (!copy)
+ Item **copy_args= 0;
+ if (!(copy_args= (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count)))
return 0;
- copy->args= (Item**) alloc_root(mem_root, sizeof(Item*) * arg_count);
for (uint i= 0; i < arg_count; i++)
{
Item *arg_clone= args[i]->build_clone(thd, mem_root);
if (!arg_clone)
return 0;
- copy->args[i]= arg_clone;
+ copy_args[i]= arg_clone;
}
+ Item_row *copy= (Item_row *) get_copy(thd, mem_root);
+ if (!copy)
+ return 0;
+ copy->args= copy_args;
return copy;
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 8738af7ac56..f5a8a649ac2 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -929,7 +929,7 @@ String *Item_func_concat_ws::val_str(String *str)
goto null; // Must be a blob
}
else if (res2 == &tmp_value)
- { // This can happend only 1 time
+ { // This can happen only 1 time
if (tmp_value.replace(0,0,*sep_str) || tmp_value.replace(0,0,*res))
goto null;
res= &tmp_value;
@@ -1079,7 +1079,7 @@ bool Item_func_reverse::fix_length_and_dec()
}
/**
- Replace all occurences of string2 in string1 with string3.
+ Replace all occurrences of string2 in string1 with string3.
Don't reallocate val_str() if not needed.
@@ -3944,7 +3944,7 @@ bool Item_func_export_set::fix_length_and_dec()
using in a SQL statement.
Adds a \\ before all characters that needs to be escaped in a SQL string.
- We also escape '^Z' (END-OF-FILE in windows) to avoid probelms when
+ We also escape '^Z' (END-OF-FILE in windows) to avoid problems when
running commands from a file in windows.
This function is very useful when you want to generate SQL statements.
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index df8761534a1..0bf21b63ac9 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1198,11 +1198,19 @@ public:
/*
Conversion from and to "binary" is safe.
Conversion to Unicode is safe.
+ Conversion from an expression with the ASCII repertoire
+ to any character set that can store characters U+0000..U+007F
+ is safe:
+ - All supported multibyte character sets can store U+0000..U+007F
+ - All supported 7bit character sets can store U+0000..U+007F
+ except those marked with MY_CS_NONASCII (e.g. swe7).
Other kind of conversions are potentially lossy.
*/
safe= (args[0]->collation.collation == &my_charset_bin ||
cs == &my_charset_bin ||
- (cs->state & MY_CS_UNICODE));
+ (cs->state & MY_CS_UNICODE) ||
+ (args[0]->collation.repertoire == MY_REPERTOIRE_ASCII &&
+ (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII))));
}
}
bool is_json_type() { return args[0]->is_json_type(); }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 2e023658baf..802bfca64b7 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1111,12 +1111,12 @@ void Item_singlerow_subselect::reset()
/**
@todo
- - We cant change name of Item_field or Item_ref, because it will
- prevent it's correct resolving, but we should save name of
+ - We can't change name of Item_field or Item_ref, because it will
+ prevent its correct resolving, but we should save name of
removed item => we do not make optimization if top item of
list is field or reference.
- switch off this optimization for prepare statement,
- because we do not rollback this changes.
+ because we do not rollback these changes.
Make rollback for it, or special name resolving mode in 5.0.
@param join Join object of the subquery (i.e. 'child' join).
@@ -1139,8 +1139,8 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
select_lex->item_list.elements == 1 &&
!select_lex->item_list.head()->with_sum_func &&
/*
- We cant change name of Item_field or Item_ref, because it will
- prevent it's correct resolving, but we should save name of
+ We can't change name of Item_field or Item_ref, because it will
+ prevent its correct resolving, but we should save name of
removed item => we do not make optimization if top item of
list is field or reference.
TODO: solve above problem
@@ -1631,7 +1631,7 @@ longlong Item_exists_subselect::val_int()
Return the result of EXISTS as a string value
Converts the true/false result into a string value.
- Note that currently this cannot be NULL, so if the query exection fails
+ Note that currently this cannot be NULL, so if the query execution fails
it will return 0.
@param decimal_value[out] buffer to hold the resulting string value
@@ -1654,7 +1654,7 @@ String *Item_exists_subselect::val_str(String *str)
Return the result of EXISTS as a decimal value
Converts the true/false result into a decimal value.
- Note that currently this cannot be NULL, so if the query exection fails
+ Note that currently this cannot be NULL, so if the query execution fails
it will return 0.
@param decimal_value[out] Buffer to hold the resulting decimal value
@@ -2038,7 +2038,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null.
*/
- subs= func->create_swap(thd, *(optimizer->get_cache()), subs);
+ subs= func->create_swap(thd, expr, subs);
thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true);
@@ -2158,10 +2158,13 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
}
else
{
+ /*
+ No need to use real_item for the item, as the ref items that are possible
+ in the subquery either belong to views or to the parent select.
+ For such case we need to refer to the reference and not to the original
+ item.
+ */
Item *item= (Item*) select_lex->item_list.head();
- if (item->type() != REF_ITEM ||
- ((Item_ref*)item)->ref_type() != Item_ref::VIEW_REF)
- item= item->real_item();
if (select_lex->table_list.elements)
{
@@ -2347,7 +2350,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
is_not_null_test(v3))
where is_not_null_test registers NULLs values but reject rows.
- in case when we do not need correct NULL, we have simplier construction:
+ in case when we do not need correct NULL, we have simpler construction:
EXISTS (SELECT ... WHERE where and
(l1 = v1) and
(l2 = v2) and
@@ -2750,6 +2753,8 @@ bool Item_exists_subselect::select_prepare_to_be_in()
Check if 'func' is an equality in form "inner_table.column = outer_expr"
@param func Expression to check
+ @param allow_subselect If true, the outer_expr part can have a subquery
+ If false, it cannot.
@param local_field OUT Return "inner_table.column" here
@param outer_expr OUT Return outer_expr here
@@ -2757,6 +2762,7 @@ bool Item_exists_subselect::select_prepare_to_be_in()
*/
static bool check_equality_for_exist2in(Item_func *func,
+ bool allow_subselect,
Item_ident **local_field,
Item **outer_exp)
{
@@ -2767,7 +2773,8 @@ static bool check_equality_for_exist2in(Item_func *func,
args= func->arguments();
if (args[0]->real_type() == Item::FIELD_ITEM &&
args[0]->all_used_tables() != OUTER_REF_TABLE_BIT &&
- args[1]->all_used_tables() == OUTER_REF_TABLE_BIT)
+ args[1]->all_used_tables() == OUTER_REF_TABLE_BIT &&
+ (allow_subselect || !args[1]->has_subquery()))
{
/* It is Item_field or Item_direct_view_ref) */
DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM ||
@@ -2778,7 +2785,8 @@ static bool check_equality_for_exist2in(Item_func *func,
}
else if (args[1]->real_type() == Item::FIELD_ITEM &&
args[1]->all_used_tables() != OUTER_REF_TABLE_BIT &&
- args[0]->all_used_tables() == OUTER_REF_TABLE_BIT)
+ args[0]->all_used_tables() == OUTER_REF_TABLE_BIT &&
+ (allow_subselect || !args[0]->has_subquery()))
{
/* It is Item_field or Item_direct_view_ref) */
DBUG_ASSERT(args[1]->type() == Item::FIELD_ITEM ||
@@ -2807,6 +2815,13 @@ typedef struct st_eq_field_outer
outer1=inner_tbl1.col1 AND ... AND outer2=inner_tbl1.col2 AND remainder_cond
+ if there is just one outer_expr=inner_expr pair, then outer_expr can have a
+ subselect in it. If there are many such pairs, then none of outer_expr can
+ have a subselect in it. If we allow this, the query will fail with an error:
+
+ This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left
+ expression of IN/ALL/ANY'
+
@param conds Condition to be checked
@parm result Array to collect EQ_FIELD_OUTER elements describing
inner-vs-outer equalities the function has found.
@@ -2824,14 +2839,17 @@ static bool find_inner_outer_equalities(Item **conds,
{
List_iterator<Item> li(*((Item_cond*)*conds)->argument_list());
Item *item;
+ bool allow_subselect= true;
while ((item= li++))
{
if (item->type() == Item::FUNC_ITEM &&
check_equality_for_exist2in((Item_func *)item,
+ allow_subselect,
&element.local_field,
&element.outer_exp))
{
found= TRUE;
+ allow_subselect= false;
element.eq_ref= li.ref();
if (result.append(element))
goto alloc_err;
@@ -2840,6 +2858,7 @@ static bool find_inner_outer_equalities(Item **conds,
}
else if ((*conds)->type() == Item::FUNC_ITEM &&
check_equality_for_exist2in((Item_func *)*conds,
+ true,
&element.local_field,
&element.outer_exp))
{
@@ -3202,7 +3221,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
/*
In some optimisation cases we will not need this Item_in_optimizer
object, but we can't know it here, but here we need address correct
- reference on left expresion.
+ reference on left expression.
note: we won't need Item_in_optimizer when handling degenerate cases
like "... IN (SELECT 1)"
@@ -3234,7 +3253,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
and all that items do not make permanent changes in current item arena
which allow to us call them with changed arena (if we do not know nature
of Item, we have to call fix_fields() for it only with original arena to
- avoid memory leack)
+ avoid memory leak)
*/
if (left_expr->cols() == 1)
trans_res= single_value_transformer(join);
@@ -3264,7 +3283,7 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN("<exists>"));
else
{
- left_expr->print(str, query_type);
+ left_expr->print_parenthesised(str, query_type, precedence());
str->append(STRING_WITH_LEN(" in "));
}
Item_subselect::print(str, query_type);
@@ -3397,7 +3416,7 @@ bool Item_in_subselect::setup_mat_engine()
/*
The select_engine (that executes transformed IN=>EXISTS subselects) is
- pre-created at parse time, and is stored in statment memory (preserved
+ pre-created at parse time, and is stored in statement memory (preserved
across PS executions).
*/
DBUG_ASSERT(engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE);
@@ -3868,7 +3887,7 @@ int subselect_single_select_engine::exec()
For at least one of the pushed predicates the following is true:
We should not apply optimizations based on the condition that was
pushed down into the subquery. Those optimizations are ref[_or_null]
- acceses. Change them to be full table scans.
+ accesses. Change them to be full table scans.
*/
JOIN_TAB *tab;
for (tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES);
@@ -6105,7 +6124,7 @@ int subselect_partial_match_engine::exec()
if (has_covering_null_row)
{
/*
- If there is a NULL-only row that coveres all columns the result of IN
+ If there is a NULL-only row that covers all columns the result of IN
is UNKNOWN.
*/
item_in->value= 0;
@@ -6305,7 +6324,7 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
for (uint i= (non_null_key ? 1 : 0); i < merge_keys_count; i++)
{
/*
- Check if the first and only indexed column contains NULL in the curent
+ Check if the first and only indexed column contains NULL in the current
row, and add the row number to the corresponding key.
*/
if (merge_keys[i]->get_field(0)->is_null())
@@ -6517,7 +6536,7 @@ bool subselect_rowid_merge_engine::partial_match()
}
/*
- If all nullable columns contain only NULLs, then there is a guranteed
+ If all nullable columns contain only NULLs, then there is a guaranteed
partial match, and we don't need to search for a matching row.
*/
if (has_covering_null_columns)
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 0ff7ee4997e..2292c22480f 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -145,6 +145,10 @@ public:
Item_subselect(THD *thd);
virtual subs_type substype() { return UNKNOWN_SUBS; }
+ bool is_exists_predicate()
+ {
+ return substype() == Item_subselect::EXISTS_SUBS;
+ }
bool is_in_predicate()
{
return (substype() == Item_subselect::IN_SUBS ||
@@ -560,7 +564,7 @@ public:
bool jtbm_const_row_found;
/*
- TRUE<=>this is a flattenable semi-join, false overwise.
+ TRUE<=>this is a flattenable semi-join, false otherwise.
*/
bool is_flattenable_semijoin;
@@ -624,7 +628,7 @@ public:
bool val_bool();
bool test_limit(st_select_lex_unit *unit);
void print(String *str, enum_query_type query_type);
- enum precedence precedence() const { return CMP_PRECEDENCE; }
+ enum precedence precedence() const { return IN_PRECEDENCE; }
bool fix_fields(THD *thd, Item **ref);
bool fix_length_and_dec();
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
@@ -987,7 +991,7 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
/* FALSE for 'ref', TRUE for 'ref-or-null'. */
bool check_null;
/*
- The "having" clause. This clause (further reffered to as "artificial
+ The "having" clause. This clause (further referred to as "artificial
having") was inserted by subquery transformation code. It contains
Item(s) that have a side-effect: they record whether the subquery has
produced a row with NULL certain components. We need to use it for cases
@@ -1008,7 +1012,7 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine
However, subqueries like the above are currently not handled by index
lookup-based subquery engines, the engine applicability check misses
them: it doesn't switch the engine for case of artificial having and
- [eq_]ref access (only for artifical having + ref_or_null or no having).
+ [eq_]ref access (only for artificial having + ref_or_null or no having).
The above example subquery is handled as a full-blown SELECT with eq_ref
access to one table.
@@ -1079,7 +1083,7 @@ public:
*/
JOIN *materialize_join;
/*
- A conjunction of all the equality condtions between all pairs of expressions
+ A conjunction of all the equality conditions between all pairs of expressions
that are arguments of an IN predicate. We need these to post-filter some
IN results because index lookups sometimes match values that are actually
not equal to the search key in SQL terms.
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 06c01c58948..e50822e71f2 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -697,7 +697,7 @@ int Aggregator_distinct::composite_key_cmp(void* arg, uchar* key1, uchar* key2)
C_MODE_START
-/* Declarations for auxilary C-callbacks */
+/* Declarations for auxiliary C-callbacks */
int simple_raw_key_cmp(void* arg, const void* key1, const void* key2)
{
@@ -729,7 +729,7 @@ C_MODE_END
@param thd Thread descriptor
@return status
@retval FALSE success
- @retval TRUE faliure
+ @retval TRUE failure
Prepares Aggregator_distinct to process the incoming stream.
Creates the temporary table and the Unique class if needed.
@@ -1184,7 +1184,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
};
if (!is_window_func_sum_expr())
setup_hybrid(thd, args[0], NULL);
- /* MIN/MAX can return NULL for empty set indepedent of the used column */
+ /* MIN/MAX can return NULL for empty set independent of the used column */
maybe_null= 1;
result_field=0;
null_value=1;
@@ -1660,7 +1660,7 @@ void Item_sum_count::cleanup()
/*
- Avgerage
+ Average
*/
bool Item_sum_avg::fix_length_and_dec()
{
@@ -1906,7 +1906,7 @@ bool Item_sum_variance::fix_length_and_dec()
/*
According to the SQL2003 standard (Part 2, Foundations; sec 10.9,
aggregate function; paragraph 7h of Syntax Rules), "the declared
- type of the result is an implementation-defined aproximate numeric
+ type of the result is an implementation-defined approximate numeric
type.
*/
@@ -1997,7 +1997,7 @@ double Item_sum_variance::val_real()
is one or zero. If it's zero, i.e. a population variance, then we only
set nullness when the count is zero.
- Another way to read it is that 'sample' is the numerical threshhold, at and
+ Another way to read it is that 'sample' is the numerical threshold, at and
below which a 'count' number of items is called NULL.
*/
DBUG_ASSERT((sample == 0) || (sample == 1));
@@ -3723,7 +3723,7 @@ bool Item_func_group_concat::setup(THD *thd)
{
/*
Force the create_tmp_table() to convert BIT columns to INT
- as we cannot compare two table records containg BIT fields
+ as we cannot compare two table records containing BIT fields
stored in the the tree used for distinct/order by.
Moreover we don't even save in the tree record null bits
where BIT fields store parts of their data.
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 290aa5c50e3..4be8ea58742 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -251,7 +251,7 @@ class Window_spec;
The field 'aggr_level' is to contain the nest level of the subquery
where the set function is aggregated.
- The field 'max_arg_level' is for the maximun of the nest levels of the
+ The field 'max_arg_level' is for the maximum of the nest levels of the
unbound column references occurred in the set function. A column reference
is unbound within a set function if it is not bound by any subquery
used as a subexpression in this function. A column reference is bound by
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 394552f219e..a40c2e18b91 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -430,7 +430,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
make_truncated_value_warning(current_thd,
Sql_condition::WARN_LEVEL_WARN,
val_begin, length,
- cached_timestamp_type, 0, NullS);
+ cached_timestamp_type, NULL, NULL, NULL);
break;
}
} while (++val != val_end);
@@ -452,7 +452,7 @@ err:
/**
- Create a formated date/time value in a string.
+ Create a formatted date/time value in a string.
*/
static bool make_date_time(const LEX_CSTRING &format, MYSQL_TIME *l_time,
@@ -1041,7 +1041,7 @@ uint week_mode(uint mode)
a date at start of january) In this case one can get 53 for the
first week of next year. This flag ensures that the week is
relevant for the given year. Note that this flag is only
- releveant if WEEK_JANUARY is not set.
+ relevant if WEEK_JANUARY is not set.
If set Week is in range 1-53.
@@ -1090,17 +1090,21 @@ longlong Item_func_yearweek::val_int()
}
-longlong Item_func_weekday::val_int()
+static uint weekday_from_item(Item *item, bool *null_value, bool week_starts_on_sunday)
{
- DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
-
- if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
+ if ((*null_value= item->get_date_with_conversion(&ltime, TIME_NO_ZERO_DATE |
+ TIME_NO_ZERO_IN_DATE)))
return 0;
+ return calc_weekday(calc_daynr(ltime.year, ltime.month, ltime.day), week_starts_on_sunday) +
+ MY_TEST(week_starts_on_sunday);
+}
- return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month,
- ltime.day),
- odbc_type) + MY_TEST(odbc_type);
+
+longlong Item_func_weekday::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ return (longlong) weekday_from_item(args[0], &null_value, odbc_type);
}
bool Item_func_dayname::fix_length_and_dec()
@@ -1119,7 +1123,7 @@ bool Item_func_dayname::fix_length_and_dec()
String* Item_func_dayname::val_str(String* str)
{
DBUG_ASSERT(fixed == 1);
- uint weekday=(uint) val_int(); // Always Item_func_weekday()
+ uint weekday= weekday_from_item(args[0], &null_value, false);
const char *day_name;
uint err;
@@ -1353,7 +1357,7 @@ bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval)
if (!(res= args->val_str_ascii(&str_value)))
return (1);
- /* record negative intervalls in interval->neg */
+ /* record negative intervals in interval->neg */
str=res->ptr();
cs= res->charset();
const char *end=str+res->length();
@@ -1604,7 +1608,7 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for local
+ Converts current time in my_time_t to MYSQL_TIME representation for local
time zone. Defines time zone (local) used for whole CURDATE function.
*/
void Item_func_curdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1615,7 +1619,7 @@ void Item_func_curdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
+ Converts current time in my_time_t to MYSQL_TIME representation for UTC
time zone. Defines time zone (UTC) used for whole UTC_DATE function.
*/
void Item_func_curdate_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1695,7 +1699,7 @@ static void set_sec_part(ulong sec_part, MYSQL_TIME *ltime, Item *item)
}
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for local
+ Converts current time in my_time_t to MYSQL_TIME representation for local
time zone. Defines time zone (local) used for whole CURTIME function.
*/
void Item_func_curtime_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1709,7 +1713,7 @@ void Item_func_curtime_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
+ Converts current time in my_time_t to MYSQL_TIME representation for UTC
time zone. Defines time zone (UTC) used for whole UTC_TIME function.
*/
void Item_func_curtime_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1764,7 +1768,7 @@ int Item_func_now_local::save_in_field(Field *field, bool no_conversions)
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for local
+ Converts current time in my_time_t to MYSQL_TIME representation for local
time zone. Defines time zone (local) used for whole NOW function.
*/
void Item_func_now_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1776,7 +1780,7 @@ void Item_func_now_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for UTC
+ Converts current time in my_time_t to MYSQL_TIME representation for UTC
time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function.
*/
void Item_func_now_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1807,7 +1811,7 @@ bool Item_func_now::get_date(MYSQL_TIME *res,
/**
- Converts current time in my_time_t to MYSQL_TIME represenatation for local
+ Converts current time in my_time_t to MYSQL_TIME representation for local
time zone. Defines time zone (local) used for whole SYSDATE function.
*/
void Item_func_sysdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
@@ -1866,13 +1870,13 @@ overflow:
{
ErrConvInteger err2(sec, unsigned_flag);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &err2, MYSQL_TIMESTAMP_TIME, 0, NullS);
+ &err2, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
}
else
{
ErrConvString err2(err);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &err2, MYSQL_TIMESTAMP_TIME, 0, NullS);
+ &err2, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
}
return 0;
}
@@ -2118,7 +2122,7 @@ bool Item_func_convert_tz::get_date(MYSQL_TIME *ltime,
uint not_used;
my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, &not_used);
ulong sec_part= ltime->second_part;
- /* my_time_tmp is guranteed to be in the allowed range */
+ /* my_time_tmp is guaranteed to be in the allowed range */
if (my_time_tmp)
to_tz->gmt_sec_to_TIME(ltime, my_time_tmp);
/* we rely on the fact that no timezone conversion can change sec_part */
@@ -2246,9 +2250,9 @@ static const char *interval_names[]=
void Item_date_add_interval::print(String *str, enum_query_type query_type)
{
- args[0]->print_parenthesised(str, query_type, ADDINTERVAL_PRECEDENCE);
+ args[0]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
str->append(date_sub_interval?" - interval ":" + interval ");
- args[1]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
+ args[1]->print(str, query_type);
str->append(' ');
str->append(interval_names[int_type]);
}
@@ -2555,7 +2559,7 @@ bool Item_char_typecast::fix_length_and_dec()
uint32 char_length;
/*
We always force character set conversion if cast_cs
- is a multi-byte character set. It garantees that the
+ is a multi-byte character set. It guarantees that the
result of CAST is a well-formed string.
For single-byte character sets we allow just to copy
from the argument. A single-byte character sets string
@@ -2890,7 +2894,7 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
buf, len, MYSQL_TIMESTAMP_TIME,
- 0, NullS);
+ NULL, NULL, NULL);
}
return (null_value= 0);
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index e37438947dd..5c2c2ebe1ac 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -410,26 +410,17 @@ public:
};
-class Item_func_weekday :public Item_func
+class Item_func_weekday :public Item_int_func
{
bool odbc_type;
public:
Item_func_weekday(THD *thd, Item *a, bool type_arg):
- Item_func(thd, a), odbc_type(type_arg) { collation.set_numeric(); }
+ Item_int_func(thd, a), odbc_type(type_arg) { }
longlong val_int();
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
- String *val_str(String *str)
- {
- DBUG_ASSERT(fixed == 1);
- str->set(val_int(), &my_charset_bin);
- return null_value ? 0 : str;
- }
const char *func_name() const
{
return (odbc_type ? "dayofweek" : "weekday");
}
- enum Item_result result_type () const { return INT_RESULT; }
- enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -447,21 +438,25 @@ public:
{ return get_item_copy<Item_func_weekday>(thd, mem_root, this); }
};
-class Item_func_dayname :public Item_func_weekday
+class Item_func_dayname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
+ Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "dayname"; }
String *val_str(String *str);
- enum Item_result result_type () const { return STRING_RESULT; }
- enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
bool fix_length_and_dec();
bool check_partition_func_processor(void *int_arg) {return TRUE;}
bool check_vcol_func_processor(void *arg)
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
+ bool check_valid_arguments_processor(void *int_arg)
+ {
+ return !has_date_args();
+ }
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_dayname>(thd, mem_root, this); }
};
@@ -872,6 +867,10 @@ class Item_func_from_unixtime :public Item_datetimefunc
const char *func_name() const { return "from_unixtime"; }
bool fix_length_and_dec();
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
+ bool check_vcol_func_processor(void *arg)
+ {
+ return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
+ }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_func_from_unixtime>(thd, mem_root, this); }
};
@@ -943,7 +942,7 @@ public:
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str, enum_query_type query_type);
- enum precedence precedence() const { return ADDINTERVAL_PRECEDENCE; }
+ enum precedence precedence() const { return INTERVAL_PRECEDENCE; }
bool need_parentheses_in_default() { return true; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_date_add_interval>(thd, mem_root, this); }
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 7cb07af440b..bb4a8a9f3af 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -234,9 +234,10 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
{
Item *item= args[i];
// 'item' can be changed during fix_fields
- if ((!item->fixed && item->fix_fields(thd, args)) ||
+ if ((!item->fixed && item->fix_fields(thd, args + i)) ||
(item= args[i])->check_cols(1))
return TRUE;
+ with_window_func|= item->with_window_func;
}
Type_std_attributes::set(args[0]);
for (uint i= 0; i < arg_count && !with_subselect; i++)
@@ -442,10 +443,8 @@ void Item_window_func::print(String *str, enum_query_type query_type)
{
window_func()->print(str, query_type);
str->append(" over ");
-#ifndef DBUG_OFF
- if (!window_spec) // one can call dbug_print_item() anytime in gdb
+ if (!window_spec)
str->append(window_name);
else
-#endif
- window_spec->print(str, query_type);
+ window_spec->print(str, query_type);
}
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index b9df1b7482b..36b0d087f12 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -618,7 +618,8 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
public:
Item_sum_ntile(THD* thd, Item* num_quantiles_expr) :
Item_sum_window_with_row_count(thd, num_quantiles_expr),
- current_row_count_(0) {};
+ current_row_count_(0),
+ n_old_val_(0) {};
double val_real()
{
@@ -635,11 +636,13 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
longlong num_quantiles= get_num_quantiles();
- if (num_quantiles <= 0) {
+ if (num_quantiles <= 0 ||
+ (static_cast<ulonglong>(num_quantiles) != n_old_val_ && n_old_val_ > 0))
+ {
my_error(ER_INVALID_NTILE_ARGUMENT, MYF(0));
return true;
}
-
+ n_old_val_= static_cast<ulonglong>(num_quantiles);
null_value= false;
ulonglong quantile_size = get_row_count() / num_quantiles;
ulonglong extra_rows = get_row_count() - quantile_size * num_quantiles;
@@ -665,6 +668,7 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
{
current_row_count_= 0;
set_row_count(0);
+ n_old_val_= 0;
}
const char*func_name() const
@@ -683,6 +687,7 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
private:
longlong get_num_quantiles() { return args[0]->val_int(); }
ulong current_row_count_;
+ ulonglong n_old_val_;
};
@@ -953,6 +958,7 @@ public:
bool fix_length_and_dec()
{
decimals = window_func()->decimals;
+ unsigned_flag= window_func()->unsigned_flag;
return FALSE;
}
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 0e62e29bfe2..f0d20b045d0 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -64,7 +64,7 @@ typedef struct my_xml_node_st
} MY_XML_NODE;
-/* Lexical analizer token */
+/* Lexical analyzer token */
typedef struct my_xpath_lex_st
{
int term; /* token type, see MY_XPATH_LEX_XXXXX below */
@@ -815,7 +815,6 @@ String *Item_nodeset_func_attributebyname::val_nodeset(String *nodeset)
String *Item_nodeset_func_predicate::val_nodeset(String *str)
{
Item_nodeset_func *nodeset_func= (Item_nodeset_func*) args[0];
- Item_func *comp_func= (Item_func*)args[1];
uint pos= 0, size;
prepare(str);
size= (uint)(fltend - fltbeg);
@@ -825,7 +824,7 @@ String *Item_nodeset_func_predicate::val_nodeset(String *str)
((XPathFilter*)(&nodeset_func->context_cache))->append_element(flt->num,
flt->pos,
size);
- if (comp_func->val_int())
+ if (args[1]->val_int())
((XPathFilter*)str)->append_element(flt->num, pos++);
}
return str;
@@ -997,11 +996,16 @@ static Item *create_comparator(MY_XPATH *xpath,
b->type() == Item::XPATH_NODESET)
{
uint len= (uint)(xpath->query.end - context->beg);
- set_if_smaller(len, 32);
- my_printf_error(ER_UNKNOWN_ERROR,
- "XPATH error: "
- "comparison of two nodesets is not supported: '%.*s'",
- MYF(0), len, context->beg);
+ if (len <= 32)
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "XPATH error: "
+ "comparison of two nodesets is not supported: '%.*s'",
+ MYF(0), len, context->beg);
+ else
+ my_printf_error(ER_UNKNOWN_ERROR,
+ "XPATH error: "
+ "comparison of two nodesets is not supported: '%.32T'",
+ MYF(0), context->beg);
return 0; // TODO: Comparison of two nodesets
}
@@ -1097,7 +1101,7 @@ static Item* nametestfunc(MY_XPATH *xpath,
/*
- Tokens consisting of one character, for faster lexical analizer.
+ Tokens consisting of one character, for faster lexical analyzer.
*/
static char simpletok[128]=
{
@@ -1417,7 +1421,7 @@ my_xpath_function(const char *beg, const char *end)
}
-/* Initialize a lex analizer token */
+/* Initialize a lex analyzer token */
static void
my_xpath_lex_init(MY_XPATH_LEX *lex,
const char *str, const char *strend)
@@ -1448,7 +1452,7 @@ my_xdigit(int c)
SYNOPSYS
Scan the next token from the input.
lex->term is set to the scanned token type.
- lex->beg and lex->end are set to the beginnig
+ lex->beg and lex->end are set to the beginning
and to the end of the token.
RETURN
N/A
@@ -1474,7 +1478,7 @@ my_xpath_lex_scan(MY_XPATH *xpath,
(const uchar*) end)) > 0 &&
((ctype & (_MY_L | _MY_U)) || *beg == '_'))
{
- // scan untill the end of the idenfitier
+ // scan until the end of the identifier
for (beg+= length;
(length= xpath->cs->cset->ctype(xpath->cs, &ctype,
(const uchar*) beg,
@@ -1603,7 +1607,7 @@ static int my_xpath_parse_AxisName(MY_XPATH *xpath)
** Grammar rules, according to http://www.w3.org/TR/xpath
** Implemented using recursive descendant method.
** All the following grammar processing functions accept
-** a signle "xpath" argument and return 1 on success and 0 on error.
+** a single "xpath" argument and return 1 on success and 0 on error.
** They also modify "xpath" argument by creating new items.
*/
@@ -2483,7 +2487,7 @@ static int my_xpath_parse_UnaryExpr(MY_XPATH *xpath)
as it is in conflict with abbreviated step.
1 + .123 does not work,
1 + 0.123 does.
- Perhaps it is better to move this code into lex analizer.
+ Perhaps it is better to move this code into lex analyzer.
RETURN
1 - success
@@ -2634,9 +2638,12 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
xpath->item= NULL;
DBUG_ASSERT(xpath->query.end > dollar_pos);
uint len= (uint)(xpath->query.end - dollar_pos);
- set_if_smaller(len, 32);
- my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'",
- MYF(0), len, dollar_pos);
+ if (len <= 32)
+ my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.*s'",
+ MYF(0), len, dollar_pos);
+ else
+ my_printf_error(ER_UNKNOWN_ERROR, "Unknown XPATH variable at: '%.32T'",
+ MYF(0), dollar_pos);
}
}
return xpath->item ? 1 : 0;
@@ -2767,9 +2774,13 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref)
if (!rc)
{
uint clen= (uint)(xpath.query.end - xpath.lasttok.beg);
- set_if_smaller(clen, 32);
- my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'",
- MYF(0), clen, xpath.lasttok.beg);
+ if (clen <= 32)
+ my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.*s'",
+ MYF(0), clen, xpath.lasttok.beg);
+ else
+ my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%.32T'",
+ MYF(0), xpath.lasttok.beg);
+
return true;
}
@@ -2827,7 +2838,7 @@ append_node(String *str, MY_XML_NODE *node)
SYNOPSYS
A call-back function executed when XML parser
- is entering a tag or an attribue.
+ is entering a tag or an attribute.
Appends the new node into data->pxml.
Increments data->level.
@@ -2863,7 +2874,7 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
SYNOPSYS
A call-back function executed when XML parser
- is entering into a tag or an attribue textual value.
+ is entering into a tag or an attribute textual value.
The value is appended into data->pxml.
RETURN
@@ -2891,7 +2902,7 @@ int xml_value(MY_XML_PARSER *st,const char *attr, size_t len)
SYNOPSYS
A call-back function executed when XML parser
- is leaving a tag or an attribue.
+ is leaving a tag or an attribute.
Decrements data->level.
RETURN
diff --git a/sql/key.cc b/sql/key.cc
index 0eeb256dd87..18806efc18f 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -228,7 +228,7 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info,
{
/*
This in fact never happens, as we have only partial BLOB
- keys yet anyway, so it's difficult to find any sence to
+ keys yet anyway, so it's difficult to find any sense to
restore the part of a record.
Maybe this branch is to be removed, but now we
have to ignore GCov compaining.
@@ -610,8 +610,8 @@ int key_rec_cmp(void *key_p, uchar *first_rec, uchar *second_rec)
max length. The exceptions are the BLOB and VARCHAR field types
that take the max length into account.
*/
- if ((result= field->cmp_max(field->ptr+first_diff, field->ptr+sec_diff,
- key_part->length)))
+ if ((result= field->cmp_prefix(field->ptr+first_diff, field->ptr+sec_diff,
+ key_part->length)))
DBUG_RETURN(result);
next_loop:
key_part++;
diff --git a/sql/lex.h b/sql/lex.h
index 8efaff665ac..ca7c6635329 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -23,7 +23,7 @@
#include "lex_symbol.h"
SYM_GROUP sym_group_common= {"", ""};
-SYM_GROUP sym_group_geom= {"Spatial extentions", "HAVE_SPATIAL"};
+SYM_GROUP sym_group_geom= {"Spatial extensions", "HAVE_SPATIAL"};
SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
/* We don't want to include sql_yacc.h into gen_lex_hash */
diff --git a/sql/lock.cc b/sql/lock.cc
index 92e1d2d80fd..c882a84f3b8 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -1099,7 +1099,7 @@ 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
+ If we didn't succeed lock_global_read_lock(), or if we already succeeded
make_global_read_lock_block_commit(), do nothing.
*/
diff --git a/sql/log.cc b/sql/log.cc
index 5fd384d55a0..54a8bd9552f 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2019, MariaDB Corporation
+ Copyright (c) 2009, 2020, 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
@@ -149,7 +149,7 @@ void setup_log_handling()
/**
purge logs, master and slave sides both, related error code
- convertor.
+ converter.
Called from @c purge_error_message(), @c MYSQL_BIN_LOG::reset_logs()
@param res an internal to purging routines error code
@@ -358,7 +358,7 @@ public:
never zero.
This is done while calling the constructor binlog_cache_mngr.
- We cannot set informaton in the constructor binlog_cache_data
+ We cannot set information in the constructor binlog_cache_data
because the space for binlog_cache_mngr is allocated through
a placement new.
@@ -448,6 +448,7 @@ private:
void truncate(my_off_t pos)
{
DBUG_PRINT("info", ("truncating to position %lu", (ulong) pos));
+ cache_log.error=0;
if (pending())
{
delete pending();
@@ -456,7 +457,7 @@ private:
reinit_io_cache(&cache_log, WRITE_CACHE, pos, 0, 0);
cache_log.end_of_file= saved_max_binlog_cache_size;
}
-
+
binlog_cache_data& operator=(const binlog_cache_data& info);
binlog_cache_data(const binlog_cache_data& info);
};
@@ -542,9 +543,11 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
{
switch (log_table_type) {
case QUERY_LOG_SLOW:
- return (table_log_handler != NULL) && global_system_variables.sql_log_slow;
+ return (table_log_handler != NULL) && global_system_variables.sql_log_slow
+ && (log_output_options & LOG_TABLE);
case QUERY_LOG_GENERAL:
- return (table_log_handler != NULL) && opt_log ;
+ return (table_log_handler != NULL) && opt_log
+ && (log_output_options & LOG_TABLE);
default:
DBUG_ASSERT(0);
return FALSE; /* make compiler happy */
@@ -1782,7 +1785,7 @@ binlog_commit_flush_stmt_cache(THD *thd, bool all,
#ifdef WITH_WSREP
if (thd->wsrep_mysql_replicated > 0)
{
- DBUG_ASSERT(WSREP_ON);
+ DBUG_ASSERT(WSREP(thd));
WSREP_DEBUG("avoiding binlog_commit_flush_trx_cache: %d",
thd->wsrep_mysql_replicated);
return 0;
@@ -2208,9 +2211,6 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
int error= 1;
DBUG_ENTER("binlog_savepoint_set");
- if (wsrep_emulate_bin_log)
- DBUG_RETURN(0);
-
char buf[1024];
String log_query(buf, sizeof(buf), &my_charset_bin);
@@ -2244,9 +2244,6 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
{
DBUG_ENTER("binlog_savepoint_rollback");
- if (wsrep_emulate_bin_log)
- DBUG_RETURN(0);
-
/*
Write ROLLBACK TO SAVEPOINT to the binlog cache if we have updated some
non-transactional table. Otherwise, truncate the binlog cache starting
@@ -2422,7 +2419,7 @@ static int find_uniq_filename(char *name, ulong next_log_number)
char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info;
struct fileinfo *file_info;
- ulong max_found, next, UNINIT_VAR(number);
+ ulong max_found= 0, next= 0, number= 0;
size_t buf_length, length;
char *start, *end;
int error= 0;
@@ -2448,7 +2445,7 @@ static int find_uniq_filename(char *name, ulong next_log_number)
if (strncmp(file_info->name, start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
{
- set_if_bigger(max_found,(ulong) number);
+ set_if_bigger(max_found, number);
}
}
my_dirend(dir_info);
@@ -2946,7 +2943,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
mysql_mutex_lock(&LOCK_log);
if (is_open())
- { // Safety agains reopen
+ { // Safety against reopen
int tmp_errno= 0;
char buff[80], *end;
char query_time_buff[22+7], lock_time_buff[22+7];
@@ -3210,7 +3207,7 @@ void MYSQL_BIN_LOG::cleanup()
DBUG_ASSERT(!binlog_xid_count_list.head());
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry "
"for %s (%lu)", b);
- my_free(b);
+ delete b;
}
mysql_mutex_destroy(&LOCK_log);
@@ -3227,7 +3224,7 @@ void MYSQL_BIN_LOG::cleanup()
/*
Free data for global binlog state.
- We can't do that automaticly as we need to do this before
+ We can't do that automatically as we need to do this before
safemalloc is shut down
*/
if (!is_relay_log)
@@ -3384,6 +3381,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
log_type_arg, io_cache_type_arg))
{
sql_print_error("MYSQL_BIN_LOG::open failed to generate new file name.");
+ if (!is_relay_log)
+ goto err;
DBUG_RETURN(1);
}
@@ -3574,18 +3573,9 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
*/
uint off= dirname_length(log_file_name);
uint len= strlen(log_file_name) - off;
- char *entry_mem, *name_mem;
- if (!(new_xid_list_entry = (xid_count_per_binlog *)
- my_multi_malloc(MYF(MY_WME),
- &entry_mem, sizeof(xid_count_per_binlog),
- &name_mem, len,
- NULL)))
+ new_xid_list_entry= new xid_count_per_binlog(log_file_name+off, (int)len);
+ if (!new_xid_list_entry)
goto err;
- memcpy(name_mem, log_file_name+off, len);
- new_xid_list_entry->binlog_name= name_mem;
- new_xid_list_entry->binlog_name_len= len;
- new_xid_list_entry->xid_count= 0;
- new_xid_list_entry->notify_count= 0;
/*
Find the name for the Initial binlog checkpoint.
@@ -3602,7 +3592,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
mysql_mutex_unlock(&LOCK_xid_list);
if (!b)
b= new_xid_list_entry;
- strmake(buf, b->binlog_name, b->binlog_name_len);
+ if (b->binlog_name)
+ strmake(buf, b->binlog_name, b->binlog_name_len);
+ else
+ goto err;
Binlog_checkpoint_log_event ev(buf, len);
DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
flush_io_cache(&log_file);
@@ -3706,7 +3699,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
{
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Removing xid_list_entry for "
"%s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_cond_broadcast(&COND_xid_list);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Adding new xid_list_entry for "
@@ -3751,9 +3744,9 @@ err:
sql_print_error("Could not use %s for logging (error %d). \
Turning logging off for the whole duration of the MySQL server process. \
To turn it on again: fix the cause, \
-shutdown the MySQL server and restart it.", name, errno);
+shutdown the MySQL server and restart it.", (name) ? name : log_name, errno);
if (new_xid_list_entry)
- my_free(new_xid_list_entry);
+ delete new_xid_list_entry;
if (file >= 0)
mysql_file_close(file, MYF(0));
close(LOG_CLOSE_INDEX);
@@ -4002,7 +3995,7 @@ err:
/**
- Delete all logs refered to in the index file.
+ Delete all logs referred to in the index file.
The new index file will only contain this file.
@@ -4247,7 +4240,7 @@ err:
DBUG_ASSERT(b->xid_count == 0);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing "
"xid_list_entry for %s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_cond_broadcast(&COND_xid_list);
reset_master_pending--;
@@ -5565,7 +5558,7 @@ binlog_cache_mngr *THD::binlog_setup_trx_data()
- Start a statement transaction to allow us to truncate the cache.
- - Save the currrent binlog position so that we can roll back the
+ - Save the current binlog position so that we can roll back the
statement by truncating the cache.
We only update the saved position if the old one was undefined,
@@ -6634,14 +6627,15 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
int error= 0;
DBUG_ENTER("MYSQL_BIN_LOG::rotate");
- if (wsrep_to_isolation)
+#ifdef WITH_WSREP
+ if (WSREP_ON && wsrep_to_isolation)
{
- DBUG_ASSERT(WSREP_ON);
*check_purge= false;
- WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
+ WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
wsrep_to_isolation);
DBUG_RETURN(0);
}
+#endif /* WITH_WSREP */
//todo: fix the macro def and restore safe_mutex_assert_owner(&LOCK_log);
*check_purge= false;
@@ -6762,7 +6756,7 @@ static const char* get_first_binlog(char* buf_arg)
}
if (normalize_binlog_name(buf_arg, fname, false))
{
- errmsg= "cound not normalize the first file name in the binlog index";
+ errmsg= "could not normalize the first file name in the binlog index";
goto end;
}
end:
@@ -9762,7 +9756,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
than compare all found against each other to find the one pointing to the
most recent binlog.
- Note also that we need to first release LOCK_xid_list, then aquire
+ Note also that we need to first release LOCK_xid_list, then acquire
LOCK_log, then re-aquire LOCK_xid_list. If we were to take LOCK_log while
holding LOCK_xid_list, we might deadlock with other threads that take the
locks in the opposite order.
@@ -9790,7 +9784,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
break;
WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing "
"xid_list_entry for %s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_mutex_unlock(&LOCK_xid_list);
@@ -9847,7 +9841,7 @@ TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie)
necessary stuff.
In the future, this thread could also be used to do log rotation in the
- background, which could elimiate all stalls around binlog rotations.
+ background, which could eliminate all stalls around binlog rotations.
*/
pthread_handler_t
binlog_background_thread(void *arg __attribute__((unused)))
@@ -10411,7 +10405,8 @@ binlog_checksum_update(MYSQL_THD thd, struct st_mysql_sys_var *var,
}
-static int show_binlog_vars(THD *thd, SHOW_VAR *var, char *buff)
+static int show_binlog_vars(THD *thd, SHOW_VAR *var, void *,
+ system_status_var *status_var, enum_var_type)
{
mysql_bin_log.set_status_variables(thd);
var->type= SHOW_ARRAY;
diff --git a/sql/log.h b/sql/log.h
index 391030db81f..0e6b2c895af 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB Corporation.
+ Copyright (c) 2009, 2020, 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
@@ -589,7 +589,18 @@ public:
long notify_count;
/* For linking in requests to the binlog background thread. */
xid_count_per_binlog *next_in_queue;
- xid_count_per_binlog(); /* Give link error if constructor used. */
+ xid_count_per_binlog(char *log_file_name, uint log_file_name_len)
+ :binlog_id(0), xid_count(0), notify_count(0)
+ {
+ binlog_name_len= log_file_name_len;
+ binlog_name= (char *) my_malloc(binlog_name_len, MYF(MY_ZEROFILL));
+ if (binlog_name)
+ memcpy(binlog_name, log_file_name, binlog_name_len);
+ }
+ ~xid_count_per_binlog()
+ {
+ my_free(binlog_name);
+ }
};
I_List<xid_count_per_binlog> binlog_xid_count_list;
mysql_mutex_t LOCK_binlog_background_thread;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 66f1d6bc790..097cbe8da9d 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2009, 2019, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -1040,9 +1040,14 @@ row_log_event_uncompress(const Format_description_log_event *description_event,
uint32 binlog_get_uncompress_len(const char *buf)
{
- DBUG_ASSERT((buf[0] & 0xe0) == 0x80);
- uint32 lenlen = buf[0] & 0x07;
uint32 len = 0;
+ uint32 lenlen = 0;
+
+ if ((buf == NULL) || ((buf[0] & 0xe0) != 0x80))
+ return len;
+
+ lenlen = buf[0] & 0x07;
+
switch(lenlen)
{
case 1:
@@ -2032,7 +2037,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
else
DBUG_RETURN(NULL);
#else
- *error= ER(ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE);
+ *error= ER_THD_OR_DEFAULT(current_thd, ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE);
sql_print_error("%s", *error);
DBUG_RETURN(NULL);
#endif
@@ -2994,13 +2999,20 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
"Not enough metadata to display the value. ");
break;
+ case MYSQL_TYPE_GEOMETRY:
+ strmake(typestr, "GEOMETRY", typestr_length);
+ if (!ptr)
+ goto return_null;
+
+ length= uint4korr(ptr);
+ my_b_write_quoted(file, ptr + meta, length);
+ return length + meta;
+
default:
{
- char tmp[5];
- my_snprintf(tmp, sizeof(tmp), "%04x", meta);
- my_b_printf(file,
- "!! Don't know how to handle column type=%d meta=%d (%s)",
- type, meta, tmp);
+ fprintf(stderr,
+ "\nError: Don't know how to handle column type: %d meta: %d (%04x)\n",
+ type, meta, meta);
}
break;
}
@@ -3179,7 +3191,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
Table_map_log_event *map;
table_def *td;
DYNAMIC_ARRAY rows_arr;
- uchar *swap_buff1, *swap_buff2;
+ uchar *swap_buff1;
uchar *rows_pos= rows_buff + m_rows_before_size;
if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
@@ -3228,7 +3240,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
}
value+= length2;
- swap_buff2= (uchar *) my_malloc(length2, MYF(0));
+ void *swap_buff2= my_malloc(length2, MYF(0));
if (!swap_buff2)
{
fprintf(stderr, "\nError: Out of memory. "
@@ -3236,21 +3248,14 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
exit(1);
}
memcpy(swap_buff2, start_pos + length1, length2); // WHERE part
- }
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- {
/* Swap SET and WHERE part */
memcpy(start_pos, swap_buff2, length2);
memcpy(start_pos + length2, swap_buff1, length1);
+ my_free(swap_buff2);
}
- /* Free tmp buffers */
my_free(swap_buff1);
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- my_free(swap_buff2);
/* Copying one row into a buff, and pushing into the array */
LEX_STRING one_row;
@@ -3581,7 +3586,7 @@ void Log_event::print_base64(IO_CACHE* file,
#ifdef WHEN_FLASHBACK_REVIEW_READY
ev->need_flashback_review= need_flashback_review;
if (print_event_info->verbose)
- ev->print_verbose(file, print_event_info);
+ ev->print_verbose(&print_event_info->tail_cache, print_event_info);
else
{
IO_CACHE tmp_cache;
@@ -3591,18 +3596,7 @@ void Log_event::print_base64(IO_CACHE* file,
}
#else
if (print_event_info->verbose)
- {
- /*
- Verbose event printout can't start before encoded data
- got enquoted. This is done at this point though multi-row
- statement remain vulnerable.
- TODO: fix MDEV-10362 to remove this workaround.
- */
- if (print_event_info->base64_output_mode !=
- BASE64_OUTPUT_DECODE_ROWS)
- my_b_printf(file, "'%s\n", print_event_info->delimiter);
- ev->print_verbose(file, print_event_info);
- }
+ ev->print_verbose(&print_event_info->tail_cache, print_event_info);
#endif
delete ev;
}
@@ -4207,7 +4201,7 @@ get_str_len_and_pointer(const Log_event::Byte **src,
const Log_event::Byte *end)
{
if (*src >= end)
- return -1; // Will be UINT_MAX in two-complement arithmetics
+ return -1; // Will be UINT_MAX in two-complement arithmetic
uint length= **src;
if (length > 0)
{
@@ -4255,6 +4249,18 @@ code_name(int code)
}
#endif
+#define VALIDATE_BYTES_READ(CUR_POS, START, EVENT_LEN) \
+ do { \
+ uchar *cur_pos= (uchar *)CUR_POS; \
+ uchar *start= (uchar *)START; \
+ uint len= EVENT_LEN; \
+ uint bytes_read= (uint)(cur_pos - start); \
+ DBUG_PRINT("info", ("Bytes read: %u event_len:%u.\n",\
+ bytes_read, len)); \
+ if (bytes_read >= len) \
+ DBUG_VOID_RETURN; \
+ } while (0)
+
/**
Macro to check that there is enough space to read from memory.
@@ -4265,7 +4271,6 @@ code_name(int code)
#define CHECK_SPACE(PTR,END,CNT) \
do { \
DBUG_PRINT("info", ("Read %s", code_name(pos[-1]))); \
- DBUG_ASSERT((PTR) + (CNT) <= (END)); \
if ((PTR) + (CNT) > (END)) { \
DBUG_PRINT("info", ("query= 0")); \
query= 0; \
@@ -4562,7 +4567,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
/* A 2nd variable part; this is common to all versions */
memcpy((char*) start, end, data_len); // Copy db and query
- start[data_len]= '\0'; // End query with \0 (For safetly)
+ start[data_len]= '\0'; // End query with \0 (For safety)
db= (char *)start;
query= (char *)(start + db_len + 1);
q_len= data_len - db_len -1;
@@ -4578,7 +4583,9 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
uint32 max_length= uint32(event_len - ((const char*)(end + db_len + 1) -
(buf - common_header_len)));
- if (q_len != max_length)
+ if (q_len != max_length ||
+ (event_len < uint((const char*)(end + db_len + 1) -
+ (buf - common_header_len))))
{
q_len= 0;
query= NULL;
@@ -5572,7 +5579,7 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
}
}
#ifdef WITH_WSREP
- else if (WSREP_ON && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
+ else if (WSREP(thd) && wsrep_mysql_replication_bundle && opt_slave_domain_parallel_threads == 0 &&
thd->wsrep_mysql_replicated > 0 &&
(is_begin() || is_commit()))
{
@@ -5586,7 +5593,7 @@ Query_log_event::do_shall_skip(rpl_group_info *rgi)
thd->wsrep_mysql_replicated = 0;
}
}
-#endif
+#endif /* WITH_WSREP */
DBUG_RETURN(Log_event::do_shall_skip(rgi));
}
@@ -6214,7 +6221,7 @@ int Format_description_log_event::do_update_pos(rpl_group_info *rgi)
If we do not skip stepping the group log position (and the
server id was changed when restarting the server), it might well
be that we start executing at a position that is invalid, e.g.,
- at a Rows_log_event or a Query_log_event preceeded by a
+ at a Rows_log_event or a Query_log_event preceded by a
Intvar_log_event instead of starting at a Table_map_log_event or
the Intvar_log_event respectively.
*/
@@ -6326,7 +6333,7 @@ Format_description_log_event::is_version_before_checksum(const master_version_sp
@return the version-safe checksum alg descriptor where zero
designates no checksum, 255 - the orginator is
- checksum-unaware (effectively no checksum) and the actuall
+ checksum-unaware (effectively no checksum) and the actual
[1-254] range alg descriptor.
*/
enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len)
@@ -6713,6 +6720,8 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
{
DBUG_ENTER("Load_log_event::copy_log_event");
uint data_len;
+ if ((int) event_len <= body_offset)
+ DBUG_RETURN(1);
char* buf_end = (char*)buf + event_len;
/* this is the beginning of the post-header */
const char* data_head = buf + description_event->common_header_len;
@@ -6722,9 +6731,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
table_name_len = (uint)data_head[L_TBL_LEN_OFFSET];
db_len = (uint)data_head[L_DB_LEN_OFFSET];
num_fields = uint4korr(data_head + L_NUM_FIELDS_OFFSET);
-
- if ((int) event_len < body_offset)
- DBUG_RETURN(1);
+
/*
Sql_ex.init() on success returns the pointer to the first byte after
the sql_ex structure, which is the start of field lengths array.
@@ -6733,7 +6740,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
buf_end,
(uchar)buf[EVENT_TYPE_OFFSET] != LOAD_EVENT)))
DBUG_RETURN(1);
-
+
data_len = event_len - body_offset;
if (num_fields > data_len) // simple sanity check against corruption
DBUG_RETURN(1);
@@ -7032,7 +7039,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
/*
When replication is running fine, if it was DUP_ERROR on the
master then we could choose IGNORE here, because if DUP_ERROR
- suceeded on master, and data is identical on the master and slave,
+ succeeded on master, and data is identical on the master and slave,
then there should be no uniqueness errors on slave, so IGNORE is
the same as DUP_ERROR. But in the unlikely case of uniqueness errors
(because the data on the master and slave happen to be different
@@ -7273,7 +7280,7 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
// The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
uint8 post_header_len= description_event->post_header_len[ROTATE_EVENT-1];
uint ident_offset;
- if (event_len < LOG_EVENT_MINIMAL_HEADER_LEN)
+ if (event_len < (uint)(LOG_EVENT_MINIMAL_HEADER_LEN + post_header_len))
DBUG_VOID_RETURN;
buf+= LOG_EVENT_MINIMAL_HEADER_LEN;
pos= post_header_len ? uint8korr(buf + R_POS_OFFSET) : 4;
@@ -7569,7 +7576,7 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
/*
Used to record GTID while sending binlog to slave, without having to
- fully contruct every Gtid_log_event() needlessly.
+ fully construct every Gtid_log_event() needlessly.
*/
bool
Gtid_log_event::peek(const char *event_start, size_t event_len,
@@ -8092,7 +8099,7 @@ Gtid_list_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
/*
Used to record gtid_list event while sending binlog to slave, without having to
- fully contruct the event object.
+ fully construct the event object.
*/
bool
Gtid_list_log_event::peek(const char *event_start, uint32 event_len,
@@ -8172,7 +8179,7 @@ Intvar_log_event::Intvar_log_event(const char* buf,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
{
- /* The Post-Header is empty. The Varible Data part begins immediately. */
+ /* The Post-Header is empty. The Variable Data part begins immediately. */
buf+= description_event->common_header_len +
description_event->post_header_len[INTVAR_EVENT-1];
type= buf[I_TYPE_OFFSET];
@@ -8549,8 +8556,16 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
res= trans_commit(thd); /* Automatically rolls back on error. */
thd->mdl_context.release_transactional_locks();
+#ifdef WITH_WSREP
+ if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
+ if ((!res || (WSREP(thd) && thd->wsrep_conflict_state == MUST_REPLAY)) && sub_id)
+#else
if (!res && sub_id)
+#endif /* WITH_WSREP */
rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, rgi);
+#ifdef WITH_WSREP
+ if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data);
+#endif /* WITH_WSREP */
/*
Increment the global status commit count variable
@@ -8571,7 +8586,7 @@ Xid_log_event::do_shall_skip(rpl_group_info *rgi)
DBUG_RETURN(Log_event::EVENT_SKIP_COUNT);
}
#ifdef WITH_WSREP
- else if (wsrep_mysql_replication_bundle && WSREP_ON &&
+ else if (WSREP(thd) && wsrep_mysql_replication_bundle &&
opt_slave_domain_parallel_threads == 0)
{
if (++thd->wsrep_mysql_replicated < (int)wsrep_mysql_replication_bundle)
@@ -8783,6 +8798,11 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
size_t bytes_read= (val + val_len) - buf_start;
+ if (bytes_read > event_len)
+ {
+ error= true;
+ goto err;
+ }
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@@ -9397,7 +9417,7 @@ void Create_file_log_event::pack_info(Protocol *protocol)
/**
Create_file_log_event::do_apply_event()
- Constructor for Create_file_log_event to intantiate an event
+ Constructor for Create_file_log_event to instantiate an event
from the relay log on the slave.
@retval
@@ -10204,6 +10224,8 @@ const char *sql_ex_info::init(const char *buf, const char *buf_end,
}
else
{
+ if (buf_end - buf < 7)
+ return 0; // Wrong data
field_term_len= enclosed_len= line_term_len= line_start_len= escaped_len=1;
field_term = buf++; // Use first byte in string
enclosed= buf++;
@@ -10346,9 +10368,16 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
uint8 const common_header_len= description_event->common_header_len;
Log_event_type event_type= (Log_event_type)(uchar)buf[EVENT_TYPE_OFFSET];
m_type= event_type;
-
+ m_cols_ai.bitmap= 0;
+
uint8 const post_header_len= description_event->post_header_len[event_type-1];
+ if (event_len < (uint)(common_header_len + post_header_len))
+ {
+ m_cols.bitmap= 0;
+ DBUG_VOID_RETURN;
+ }
+
DBUG_PRINT("enter",("event_len: %u common_header_len: %d "
"post_header_len: %d",
event_len, common_header_len,
@@ -10380,7 +10409,14 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
which includes length bytes
*/
var_header_len= uint2korr(post_start);
- assert(var_header_len >= 2);
+ /* Check length and also avoid out of buffer read */
+ if (var_header_len < 2 ||
+ event_len < static_cast<unsigned int>(var_header_len +
+ (post_start - buf)))
+ {
+ m_cols.bitmap= 0;
+ DBUG_VOID_RETURN;
+ }
var_header_len-= 2;
/* Iterate over var-len header, extracting 'chunks' */
@@ -10431,7 +10467,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_VOID_RETURN;
}
- /* if my_bitmap_init fails, catched in is_valid() */
+ /* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
@@ -10848,7 +10884,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
*/
{
- DBUG_PRINT("debug", ("Checking compability of tables to lock - tables_to_lock: %p",
+ DBUG_PRINT("debug", ("Checking compatibility of tables to lock - tables_to_lock: %p",
rgi->tables_to_lock));
/**
@@ -10903,7 +10939,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
ptr->table->s->table_name.str));
/*
We should not honour --slave-skip-errors at this point as we are
- having severe errors which should not be skiped.
+ having severe errors which should not be skipped.
*/
thd->is_slave_error= 1;
/* remove trigger's tables */
@@ -11284,7 +11320,7 @@ static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd)
/**
The method either increments the relay log position or
commits the current statement and increments the master group
- possition if the event is STMT_END_F flagged and
+ position if the event is STMT_END_F flagged and
the statement corresponds to the autocommit query (i.e replicated
without wrapping in BEGIN/COMMIT)
@@ -11430,7 +11466,7 @@ public:
/**
Print an event "body" cache to @c file possibly in two fragments.
- Each fragement is optionally per @c do_wrap to produce an SQL statement.
+ Each fragment is optionally per @c do_wrap to produce an SQL statement.
@param file a file to print to
@param body the "body" IO_CACHE of event
@@ -11498,11 +11534,8 @@ void copy_cache_to_string_wrapped(IO_CACHE *cache,
str_tmp.length= sprintf(str_tmp.str, fmt_frag, 1);
ret.append(&str_tmp);
ret.append(cache, uint32(cache->end_of_file - (cache_size/2 + 1)));
- if (!is_verbose)
- {
- str_tmp.length= sprintf(str_tmp.str, fmt_delim, delimiter);
- ret.append(&str_tmp);
- }
+ str_tmp.length= sprintf(str_tmp.str, fmt_delim, delimiter);
+ ret.append(&str_tmp);
str_tmp.length= sprintf(str_tmp.str, "BINLOG @binlog_fragment_0, @binlog_fragment_1%s\n",
delimiter);
ret.append(&str_tmp);
@@ -11512,11 +11545,8 @@ void copy_cache_to_string_wrapped(IO_CACHE *cache,
str_tmp.length= sprintf(str_tmp.str, str_binlog);
ret.append(&str_tmp);
ret.append(cache, (uint32) cache->end_of_file);
- if (!is_verbose)
- {
- str_tmp.length= sprintf(str_tmp.str, fmt_delim, delimiter);
- ret.append(&str_tmp);
- }
+ str_tmp.length= sprintf(str_tmp.str, fmt_delim, delimiter);
+ ret.append(&str_tmp);
}
to->length= ret.length();
@@ -11565,6 +11595,7 @@ void Rows_log_event::print_helper(FILE *file,
{
IO_CACHE *const head= &print_event_info->head_cache;
IO_CACHE *const body= &print_event_info->body_cache;
+ IO_CACHE *const tail= &print_event_info->tail_cache;
#ifdef WHEN_FLASHBACK_REVIEW_READY
IO_CACHE *const sql= &print_event_info->review_sql_cache;
#endif
@@ -11606,6 +11637,13 @@ void Rows_log_event::print_helper(FILE *file,
print_event_info->verbose);
output_buf.append(&tmp_str);
my_free(tmp_str.str);
+ if (copy_event_cache_to_string_and_reinit(tail, &tmp_str))
+ {
+ tail->error= -1;
+ return;
+ }
+ output_buf.append(&tmp_str);
+ my_free(tmp_str.str);
}
}
#endif
@@ -11942,14 +11980,12 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
m_data_size(0), m_field_metadata(0), m_field_metadata_size(0),
m_null_bits(0), m_meta_memory(NULL)
{
- unsigned int bytes_read= 0;
DBUG_ENTER("Table_map_log_event::Table_map_log_event(const char*,uint,...)");
uint8 common_header_len= description_event->common_header_len;
uint8 post_header_len= description_event->post_header_len[TABLE_MAP_EVENT-1];
DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d",
event_len, common_header_len, post_header_len));
-
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
@@ -11958,10 +11994,14 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
DBUG_DUMP("event buffer", (uchar*) buf, event_len);
#endif
+ if (event_len < (uint)(common_header_len + post_header_len))
+ DBUG_VOID_RETURN;
+
/* Read the post-header */
const char *post_start= buf + common_header_len;
post_start+= TM_MAPID_OFFSET;
+ VALIDATE_BYTES_READ(post_start, buf, event_len);
if (post_header_len == 6)
{
/* Master is of an intermediate source tree before 5.1.4. Id is 4 bytes */
@@ -11984,15 +12024,18 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
/* Extract the length of the various parts from the buffer */
uchar const *const ptr_dblen= (uchar const*)vpart + 0;
+ VALIDATE_BYTES_READ(ptr_dblen, buf, event_len);
m_dblen= *(uchar*) ptr_dblen;
/* Length of database name + counter + terminating null */
uchar const *const ptr_tbllen= ptr_dblen + m_dblen + 2;
+ VALIDATE_BYTES_READ(ptr_tbllen, buf, event_len);
m_tbllen= *(uchar*) ptr_tbllen;
/* Length of table name + counter + terminating null */
uchar const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2;
uchar *ptr_after_colcnt= (uchar*) ptr_colcnt;
+ VALIDATE_BYTES_READ(ptr_after_colcnt, buf, event_len);
m_colcnt= net_field_length(&ptr_after_colcnt);
DBUG_PRINT("info",("m_dblen: %lu off: %ld m_tbllen: %lu off: %ld m_colcnt: %lu off: %ld",
@@ -12015,23 +12058,27 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
memcpy(m_coltype, ptr_after_colcnt, m_colcnt);
ptr_after_colcnt= ptr_after_colcnt + m_colcnt;
- bytes_read= (uint) (ptr_after_colcnt - (uchar *)buf);
- DBUG_PRINT("info", ("Bytes read: %d.\n", bytes_read));
- if (bytes_read < event_len)
+ VALIDATE_BYTES_READ(ptr_after_colcnt, buf, event_len);
+ m_field_metadata_size= net_field_length(&ptr_after_colcnt);
+ if(m_field_metadata_size <= (m_colcnt * 2))
{
- m_field_metadata_size= net_field_length(&ptr_after_colcnt);
- DBUG_ASSERT(m_field_metadata_size <= (m_colcnt * 2));
uint num_null_bytes= (m_colcnt + 7) / 8;
m_meta_memory= (uchar *)my_multi_malloc(MYF(MY_WME),
- &m_null_bits, num_null_bytes,
- &m_field_metadata, m_field_metadata_size,
- NULL);
+ &m_null_bits, num_null_bytes,
+ &m_field_metadata, m_field_metadata_size,
+ NULL);
memcpy(m_field_metadata, ptr_after_colcnt, m_field_metadata_size);
ptr_after_colcnt= (uchar*)ptr_after_colcnt + m_field_metadata_size;
memcpy(m_null_bits, ptr_after_colcnt, num_null_bytes);
}
+ else
+ {
+ m_coltype= NULL;
+ my_free(m_memory);
+ m_memory= NULL;
+ DBUG_VOID_RETURN;
+ }
}
-
DBUG_VOID_RETURN;
}
#endif
@@ -13136,7 +13183,7 @@ record_compare_exit:
Find the best key to use when locating the row in @c find_row().
A primary key is preferred if it exists; otherwise a unique index is
- preferred. Else we pick the index with the smalles rec_per_key value.
+ preferred. Else we pick the index with the smallest rec_per_key value.
If a suitable key is found, set @c m_key, @c m_key_nr and @c m_key_info
member fields appropriately.
@@ -13269,7 +13316,7 @@ static int row_not_found_error(rpl_group_info *rgi)
Locate the current row in event's table.
The current row is pointed by @c m_curr_row. Member @c m_width tells
- how many columns are there in the row (this can be differnet from
+ how many columns are there in the row (this can be different from
the number of columns in the table). It is assumed that event's
table is already open and pointed by @c m_table.
@@ -13310,7 +13357,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
rpl_row_tabledefs.test specifies that
if the extra field on the slave does not have a default value
and this is okay with Delete or Update events.
- Todo: fix wl3228 hld that requires defauls for all types of events
+ Todo: fix wl3228 hld that requires defaults for all types of events
*/
prepare_record(table, m_width, FALSE);
@@ -13554,7 +13601,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
while (record_compare(table));
/*
- Note: above record_compare will take into accout all record fields
+ Note: above record_compare will take into account all record fields
which might be incorrect in case a partial row was given in the event
*/
@@ -13565,7 +13612,6 @@ end:
if (is_table_scan || is_index_scan)
issue_long_find_row_warning(get_general_type_code(), m_table->alias.c_ptr(),
is_index_scan, rgi);
- table->default_column_bitmaps();
DBUG_RETURN(error);
}
@@ -13797,9 +13843,12 @@ void Update_rows_log_event::init(MY_BITMAP const *cols)
Update_rows_log_event::~Update_rows_log_event()
{
- if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
- m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
- my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
+ if (m_cols_ai.bitmap)
+ {
+ if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
+ m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
+ my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
+ }
}
@@ -13876,6 +13925,12 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
#endif /* WSREP_PROC_INFO */
thd_proc_info(thd, message);
+ // Temporary fix to find out why it fails [/Matz]
+ memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
+ memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
+
+ m_table->mark_columns_per_binlog_row_image();
+
int error= find_row(rgi);
if (error)
{
@@ -13945,12 +14000,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)
error= HA_ERR_GENERIC; // in case if error is not set yet
goto err;
}
-
- // Temporary fix to find out why it fails [/Matz]
- memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8);
- memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8);
-
- m_table->mark_columns_per_binlog_row_image();
+
error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
if (error == HA_ERR_RECORD_IS_THE_SAME)
error= 0;
@@ -14264,6 +14314,7 @@ st_print_event_info::st_print_event_info()
myf const flags = MYF(MY_WME | MY_NABP);
open_cached_file(&head_cache, NULL, NULL, 0, flags);
open_cached_file(&body_cache, NULL, NULL, 0, flags);
+ open_cached_file(&tail_cache, NULL, NULL, 0, flags);
#ifdef WHEN_FLASHBACK_REVIEW_READY
open_cached_file(&review_sql_cache, NULL, NULL, 0, flags);
#endif
diff --git a/sql/log_event.h b/sql/log_event.h
index a15b2168dda..3fc44a9669f 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -455,7 +455,7 @@ class String;
/**
@def LOG_EVENT_ARTIFICIAL_F
- Artificial events are created arbitarily and not written to binary
+ Artificial events are created arbitrarily and not written to binary
log
These events should not update the master log position when slave
@@ -848,18 +848,19 @@ typedef struct st_print_event_info
~st_print_event_info() {
close_cached_file(&head_cache);
close_cached_file(&body_cache);
+ close_cached_file(&tail_cache);
#ifdef WHEN_FLASHBACK_REVIEW_READY
close_cached_file(&review_sql_cache);
#endif
}
bool init_ok() /* tells if construction was successful */
- { return my_b_inited(&head_cache) && my_b_inited(&body_cache)
+ { return my_b_inited(&head_cache) && my_b_inited(&body_cache) &&
+ my_b_inited(&tail_cache)
#ifdef WHEN_FLASHBACK_REVIEW_READY
&& my_b_inited(&review_sql_cache)
#endif
; }
-
/* Settings on how to print the events */
bool short_form;
enum_base64_output_mode base64_output_mode;
@@ -885,6 +886,7 @@ typedef struct st_print_event_info
*/
IO_CACHE head_cache;
IO_CACHE body_cache;
+ IO_CACHE tail_cache;
#ifdef WHEN_FLASHBACK_REVIEW_READY
/* Storing the SQL for reviewing */
IO_CACHE review_sql_cache;
@@ -932,13 +934,13 @@ private:
};
/**
- the struct aggregates two paramenters that identify an event
+ the struct aggregates two parameters that identify an event
uniquely in scope of communication of a particular master and slave couple.
I.e there can not be 2 events from the same staying connected master which
have the same coordinates.
@note
Such identifier is not yet unique generally as the event originating master
- is resetable. Also the crashed master can be replaced with some other.
+ is resettable. Also the crashed master can be replaced with some other.
*/
typedef struct event_coordinates
{
@@ -2193,7 +2195,15 @@ public:
****************************************************************************/
struct sql_ex_info
{
- sql_ex_info() {} /* Remove gcc warning */
+ sql_ex_info():
+ cached_new_format(-1),
+ field_term_len(0),
+ enclosed_len(0),
+ line_term_len(0),
+ line_start_len(0),
+ escaped_len(0),
+ empty_flags(0)
+ {} /* Remove gcc warning */
const char* field_term;
const char* enclosed;
const char* line_term;
@@ -2722,7 +2732,7 @@ public:
uint8 number_of_event_types;
/*
The list of post-headers' lengths followed
- by the checksum alg decription byte
+ by the checksum alg description byte
*/
uint8 *post_header_len;
struct master_version_split {
@@ -3062,7 +3072,7 @@ public:
*/
bool is_deferred() { return deferred; }
/*
- In case of the deffered applying the variable instance is flagged
+ In case of the deferred applying the variable instance is flagged
and the parsing time query id is stored to be used at applying time.
*/
void set_deferred(query_id_t qid) { deferred= true; query_id= qid; }
@@ -3556,7 +3566,7 @@ public:
bool write_data_header();
bool write_data_body();
/*
- Cut out Create_file extentions and
+ Cut out Create_file extensions and
write it as Load event - used on the slave
*/
bool write_base();
@@ -4930,7 +4940,7 @@ private:
/**
@class Incident_log_event
- Class representing an incident, an occurance out of the ordinary,
+ Class representing an incident, an occurence out of the ordinary,
that happened on the master.
The event is used to inform the slave that something out of the
@@ -4974,7 +4984,7 @@ public:
m_message.str= NULL; /* Just as a precaution */
m_message.length= 0;
set_direct_logging();
- /* Replicate the incident irregardless of @@skip_replication. */
+ /* Replicate the incident regardless of @@skip_replication. */
flags&= ~LOG_EVENT_SKIP_REPLICATION_F;
DBUG_VOID_RETURN;
}
@@ -4995,7 +5005,7 @@ public:
strmake(m_message.str, msg.str, msg.length);
m_message.length= msg.length;
set_direct_logging();
- /* Replicate the incident irregardless of @@skip_replication. */
+ /* Replicate the incident regardless of @@skip_replication. */
flags&= ~LOG_EVENT_SKIP_REPLICATION_F;
DBUG_VOID_RETURN;
}
@@ -5191,6 +5201,9 @@ bool event_that_should_be_ignored(const char *buf);
bool event_checksum_test(uchar *buf, ulong event_len, enum_binlog_checksum_alg alg);
enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len);
extern TYPELIB binlog_checksum_typelib;
+#ifdef WITH_WSREP
+enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size);
+#endif /* WITH_WSREP */
/**
@} (end of group Replication)
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 55d8660abad..2de316a4c55 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -848,7 +848,7 @@ int Write_rows_log_event_old::do_after_row_operations(TABLE *table, int error)
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
/*
- reseting the extra with
+ resetting the extra with
table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY);
fires bug#27077
todo: explain or fix
@@ -1240,7 +1240,7 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
DBUG_VOID_RETURN;
}
- /* if my_bitmap_init fails, catched in is_valid() */
+ /* if my_bitmap_init fails, caught in is_valid() */
if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
@@ -1859,6 +1859,7 @@ void Old_rows_log_event::print_helper(FILE *file,
{
IO_CACHE *const head= &print_event_info->head_cache;
IO_CACHE *const body= &print_event_info->body_cache;
+ IO_CACHE *const tail= &print_event_info->tail_cache;
bool do_print_encoded=
print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
!print_event_info->short_form;
@@ -1890,6 +1891,13 @@ void Old_rows_log_event::print_helper(FILE *file,
print_event_info->verbose);
output_buf.append(&tmp_str);
my_free(tmp_str.str);
+ if (copy_event_cache_to_string_and_reinit(tail, &tmp_str))
+ {
+ tail->error= -1;
+ return;
+ }
+ output_buf.append(&tmp_str);
+ my_free(tmp_str.str);
}
}
#endif
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index d741cf8b837..29d7074aeb1 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -71,6 +71,16 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_RETURN(1);
}
info->seek_not_done= 0;
+ if (info->next_file_user)
+ {
+ IO_CACHE *c;
+ for (c= info->next_file_user;
+ c!= info;
+ c= c->next_file_user)
+ {
+ c->seek_not_done= 1;
+ }
+ }
}
do
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index f318bcd1cd3..6a73cd54d50 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -304,6 +304,17 @@ bool my_decimal_is_zero(const my_decimal *decimal_value)
inline
+int my_decimal_round_if_needed(uint mask, my_decimal *dec, int scale,
+ bool truncate)
+{
+ if (scale >= dec->frac)
+ return E_DEC_OK;
+ return check_result(mask, decimal_round(dec, dec, scale,
+ (truncate ? TRUNCATE : HALF_UP)));
+}
+
+
+inline
int my_decimal_round(uint mask, const my_decimal *from, int scale,
bool truncate, my_decimal *to)
{
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index cadf080cad9..1352dfb2e45 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -406,8 +406,8 @@ static int register_service()
static void clean_directory(const char *dir)
{
- char dir2[MAX_PATH+2];
- *(strmake_buf(dir2, dir)+1)= 0;
+ char dir2[MAX_PATH + 4]= {};
+ snprintf(dir2, MAX_PATH+2, "%s\\*", dir);
SHFILEOPSTRUCT fileop;
fileop.hwnd= NULL; /* no status display */
@@ -558,7 +558,7 @@ static int create_db_instance()
DWORD cwd_len= MAX_PATH;
char cmdline[3*MAX_PATH];
FILE *in;
- bool cleanup_datadir= true;
+ bool created_datadir= false;
DWORD last_error;
verbose("Running bootstrap");
@@ -567,7 +567,11 @@ static int create_db_instance()
/* Create datadir and datadir/mysql, if they do not already exist. */
- if (!CreateDirectory(opt_datadir, NULL) && (GetLastError() != ERROR_ALREADY_EXISTS))
+ if (CreateDirectory(opt_datadir, NULL))
+ {
+ created_datadir= true;
+ }
+ else if (GetLastError() != ERROR_ALREADY_EXISTS)
{
last_error = GetLastError();
switch(last_error)
@@ -604,9 +608,11 @@ static int create_db_instance()
}
}
- if (PathIsDirectoryEmpty(opt_datadir))
+ if (!PathIsDirectoryEmpty(opt_datadir))
{
- cleanup_datadir= false;
+ fprintf(stderr,"ERROR : Data directory %s is not empty."
+ " Only new or empty existing directories are accepted for --datadir\n",opt_datadir);
+ exit(1);
}
if (!CreateDirectory("mysql",NULL))
@@ -735,10 +741,12 @@ static int create_db_instance()
}
end:
- if (ret && cleanup_datadir)
+ if (ret)
{
SetCurrentDirectory(cwd);
clean_directory(opt_datadir);
+ if (created_datadir)
+ RemoveDirectory(opt_datadir);
}
return ret;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 34e5704bcfe..d3e124e3405 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB Corporation.
+ Copyright (c) 2008, 2020, 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
@@ -365,7 +365,6 @@ 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;
uint kill_cached_threads;
static uint wake_thread;
@@ -2172,13 +2171,12 @@ static void mysqld_exit(int exit_code)
shutdown_performance_schema(); // we do it as late as possible
#endif
set_malloc_size_cb(NULL);
- if (opt_endinfo && global_status_var.global_memory_used)
- fprintf(stderr, "Warning: Memory not freed: %ld\n",
- (long) global_status_var.global_memory_used);
- if (!opt_debugging && !my_disable_leak_check && exit_code == 0 &&
- debug_assert_on_not_freed_memory)
+ if (global_status_var.global_memory_used)
{
- DBUG_ASSERT(global_status_var.global_memory_used == 0);
+ fprintf(stderr, "Warning: Memory not freed: %lld\n",
+ (longlong) global_status_var.global_memory_used);
+ if (exit_code == 0)
+ SAFEMALLOC_REPORT_MEMORY(0);
}
cleanup_tls();
DBUG_LEAVE;
@@ -2417,9 +2415,11 @@ static void set_ports()
*/
#if MYSQL_PORT_DEFAULT == 0
+# if !__has_feature(memory_sanitizer) // Work around MSAN deficiency
struct servent *serv_ptr;
if ((serv_ptr= getservbyname("mysql", "tcp")))
SYSVAR_AUTOSIZE(mysqld_port, ntohs((u_short) serv_ptr->s_port));
+# endif
#endif
if ((env = getenv("MYSQL_TCP_PORT")))
{
@@ -2687,6 +2687,67 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
DBUG_RETURN(ip_sock);
}
+#ifdef _WIN32
+/*
+ Create a security descriptor for pipe.
+ - Use low integrity level, so that it is possible to connect
+ from any process.
+ - Give current user read/write access to pipe.
+ - Give Everyone read/write access to pipe minus FILE_CREATE_PIPE_INSTANCE
+*/
+static void init_pipe_security_descriptor()
+{
+#define SDDL_FMT "S:(ML;; NW;;; LW) D:(A;; 0x%08x;;; WD)(A;; FRFW;;; %s)"
+#define EVERYONE_PIPE_ACCESS_MASK \
+ (FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES | READ_CONTROL | \
+ SYNCHRONIZE | FILE_WRITE_DATA | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
+
+#ifndef SECURITY_MAX_SID_STRING_CHARACTERS
+/* Old SDK does not have this constant */
+#define SECURITY_MAX_SID_STRING_CHARACTERS 187
+#endif
+
+ /*
+ Figure out SID of the user that runs the server, then create SDDL string
+ for pipe permissions, and convert it to the security descriptor.
+ */
+ char sddl_string[sizeof(SDDL_FMT) + 8 + SECURITY_MAX_SID_STRING_CHARACTERS];
+ struct
+ {
+ TOKEN_USER token_user;
+ BYTE buffer[SECURITY_MAX_SID_SIZE];
+ } token_buffer;
+ HANDLE token;
+ DWORD tmp;
+
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
+ goto fail;
+
+ if (!GetTokenInformation(token, TokenUser, &token_buffer,
+ (DWORD) sizeof(token_buffer), &tmp))
+ goto fail;
+
+ CloseHandle(token);
+
+ char *current_user_string_sid;
+ if (!ConvertSidToStringSid(token_buffer.token_user.User.Sid,
+ &current_user_string_sid))
+ goto fail;
+
+ snprintf(sddl_string, sizeof(sddl_string), SDDL_FMT,
+ EVERYONE_PIPE_ACCESS_MASK, current_user_string_sid);
+ LocalFree(current_user_string_sid);
+
+ if (ConvertStringSecurityDescriptorToSecurityDescriptor(sddl_string,
+ SDDL_REVISION_1, &saPipeSecurity.lpSecurityDescriptor, 0))
+ return;
+
+fail:
+ sql_perror("Can't start server : Initialize security descriptor");
+ unireg_abort(1);
+}
+#endif
+
static void network_init(void)
{
#ifdef HAVE_SYS_UN_H
@@ -2724,19 +2785,7 @@ static void network_init(void)
strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\",
mysqld_unix_port, NullS);
- /*
- Create a security descriptor for pipe.
- - Use low integrity level, so that it is possible to connect
- from any process.
- - Give Everyone read/write access to pipe.
- */
- if (!ConvertStringSecurityDescriptorToSecurityDescriptor(
- "S:(ML;; NW;;; LW) D:(A;; FRFW;;; WD)",
- SDDL_REVISION_1, &saPipeSecurity.lpSecurityDescriptor, NULL))
- {
- sql_perror("Can't start server : Initialize security descriptor");
- unireg_abort(1);
- }
+ init_pipe_security_descriptor();
saPipeSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
saPipeSecurity.bInheritHandle = FALSE;
if ((hPipe= CreateNamedPipe(pipe_name,
@@ -3357,7 +3406,6 @@ void init_signals(void)
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
- my_init_stacktrace();
#if defined(__amiga__)
sa.sa_handler=(void(*)())handle_fatal_signal;
#else
@@ -4081,7 +4129,8 @@ rpl_make_log_name(const char *opt,
const char *ext)
{
DBUG_ENTER("rpl_make_log_name");
- DBUG_PRINT("enter", ("opt: %s, def: %s, ext: %s", opt, def, ext));
+ DBUG_PRINT("enter", ("opt: %s, def: %s, ext: %s", opt ? opt : "(null)",
+ def, ext));
char buff[FN_REFLEN];
const char *base= opt ? opt : def;
unsigned int options=
@@ -4432,7 +4481,7 @@ static int init_common_variables()
min_connections= 10;
/* MyISAM requires two file handles per table. */
wanted_files= (extra_files + max_connections + extra_max_connections +
- tc_size * 2);
+ tc_size * 2 * tc_instances);
#if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__)
// add epoll or kevent fd for each threadpool group, in case pool of threads is used
wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size;
@@ -4461,6 +4510,14 @@ static int init_common_variables()
if (files < wanted_files && global_system_variables.log_warnings)
sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
+ /* If we required too much tc_instances than we reduce */
+ SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances,
+ (uint32) MY_MIN(MY_MAX((files - extra_files -
+ max_connections)/
+ 2/tc_size,
+ 1),
+ tc_instances),
+ uint32);
/*
If we have requested too much file handles than we bring
max_connections in supported bounds. Still leave at least
@@ -4468,7 +4525,7 @@ static int init_common_variables()
*/
SYSVAR_AUTOSIZE_IF_CHANGED(max_connections,
(ulong) MY_MAX(MY_MIN(files- extra_files-
- min_tc_size*2,
+ min_tc_size*2*tc_instances,
max_connections),
min_connections),
ulong);
@@ -4481,7 +4538,7 @@ static int init_common_variables()
*/
SYSVAR_AUTOSIZE_IF_CHANGED(tc_size,
(ulong) MY_MIN(MY_MAX((files - extra_files -
- max_connections) / 2,
+ max_connections) / 2 / tc_instances,
min_tc_size),
tc_size), ulong);
DBUG_PRINT("warning",
@@ -4666,8 +4723,10 @@ static int init_common_variables()
get corrupted if accesses with names of different case.
*/
DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
+ if(mysql_real_data_home_ptr == NULL || *mysql_real_data_home_ptr == 0)
+ mysql_real_data_home_ptr= mysql_real_data_home;
SYSVAR_AUTOSIZE(lower_case_file_system,
- test_if_case_insensitive(mysql_real_data_home));
+ test_if_case_insensitive(mysql_real_data_home_ptr));
if (!lower_case_table_names && lower_case_file_system == 1)
{
if (lower_case_table_names_used)
@@ -4684,7 +4743,7 @@ static int init_common_variables()
{
if (global_system_variables.log_warnings)
sql_print_warning("Setting lower_case_table_names=2 because file "
- "system for %s is case insensitive", mysql_real_data_home);
+ "system for %s is case insensitive", mysql_real_data_home_ptr);
SYSVAR_AUTOSIZE(lower_case_table_names, 2);
}
}
@@ -4695,7 +4754,7 @@ static int init_common_variables()
sql_print_warning("lower_case_table_names was set to 2, even though your "
"the file system '%s' is case sensitive. Now setting "
"lower_case_table_names to 0 to avoid future problems.",
- mysql_real_data_home);
+ mysql_real_data_home_ptr);
SYSVAR_AUTOSIZE(lower_case_table_names, 0);
}
else
@@ -5915,8 +5974,10 @@ int mysqld_main(int argc, char **argv)
set_user(mysqld_user, user_info);
}
+#ifdef WITH_WSREP
if (WSREP_ON && wsrep_check_opts())
global_system_variables.wsrep_on= 0;
+#endif
/*
The subsequent calls may take a long time : e.g. innodb log read.
@@ -6608,13 +6669,11 @@ void handle_connections_sockets()
MYSQL_SOCKET sock= mysql_socket_invalid();
MYSQL_SOCKET new_sock= mysql_socket_invalid();
uint error_count=0;
- CONNECT *connect;
struct sockaddr_storage cAddr;
int ip_flags __attribute__((unused))=0;
int socket_flags __attribute__((unused))= 0;
int extra_ip_flags __attribute__((unused))=0;
int flags=0,retval;
- bool is_unix_sock;
#ifdef HAVE_POLL
int socket_count= 0;
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
@@ -6814,41 +6873,37 @@ void handle_connections_sockets()
DBUG_PRINT("info", ("Creating CONNECT for new connection"));
- if ((connect= new CONNECT()))
+ if (CONNECT *connect= new CONNECT())
{
- is_unix_sock= (mysql_socket_getfd(sock) ==
- mysql_socket_getfd(unix_sock));
+ const bool is_unix_sock= (mysql_socket_getfd(sock) ==
+ mysql_socket_getfd(unix_sock));
- if (!(connect->vio=
- mysql_socket_vio_new(new_sock,
- is_unix_sock ? VIO_TYPE_SOCKET :
- VIO_TYPE_TCPIP,
- is_unix_sock ? VIO_LOCALHOST: 0)))
+ if ((connect->vio=
+ mysql_socket_vio_new(new_sock,
+ is_unix_sock ? VIO_TYPE_SOCKET :
+ VIO_TYPE_TCPIP,
+ is_unix_sock ? VIO_LOCALHOST: 0)))
{
- delete connect;
- connect= 0; // Error handling below
+ if (is_unix_sock)
+ connect->host= my_localhost;
+
+ if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
+ {
+ connect->extra_port= 1;
+ connect->scheduler= extra_thread_scheduler;
+ }
+ create_new_thread(connect);
+ continue;
}
- }
- if (!connect)
- {
- /* Connect failure */
- (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
- (void) mysql_socket_close(new_sock);
- statistic_increment(aborted_connects,&LOCK_status);
- statistic_increment(connection_errors_internal, &LOCK_status);
- continue;
+ delete connect;
}
- if (is_unix_sock)
- connect->host= my_localhost;
-
- if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
- {
- connect->extra_port= 1;
- connect->scheduler= extra_thread_scheduler;
- }
- create_new_thread(connect);
+ /* Connect failure */
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
+ statistic_increment(aborted_connects,&LOCK_status);
+ statistic_increment(connection_errors_internal, &LOCK_status);
}
sd_notify(0, "STOPPING=1\n"
"STATUS=Shutdown in progress\n");
@@ -8331,8 +8386,8 @@ show_ssl_get_server_not_after(THD *thd, SHOW_VAR *var, char *buff,
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
-static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
+static int show_default_keycache(THD *thd, SHOW_VAR *var, void *buff,
+ system_status_var *, enum_var_type)
{
struct st_data {
KEY_CACHE_STATISTICS stats;
@@ -8365,7 +8420,7 @@ static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff,
v->name= 0;
- DBUG_ASSERT((char*)(v+1) <= buff + SHOW_VAR_FUNC_BUFF_SIZE);
+ DBUG_ASSERT((char*)(v+1) <= static_cast<char*>(buff) + SHOW_VAR_FUNC_BUFF_SIZE);
#undef set_one_keycache_var
@@ -8389,8 +8444,8 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, char *buff,
#ifndef DBUG_OFF
-static int debug_status_func(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
+static int debug_status_func(THD *thd, SHOW_VAR *var, void *buff,
+ system_status_var *, enum_var_type)
{
#define add_var(X,Y,Z) \
v->name= X; \
@@ -8517,9 +8572,9 @@ SHOW_VAR status_vars[]= {
{"Key", (char*) &show_default_keycache, SHOW_FUNC},
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
{"Max_statement_time_exceeded", (char*) offsetof(STATUS_VAR, max_statement_time_exceeded), SHOW_LONG_STATUS},
- {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONGLONG_STATUS},
- {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONGLONG_STATUS},
- {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONGLONG_STATUS},
+ {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONG_STATUS},
+ {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONG_STATUS},
+ {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONG_STATUS},
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG},
{"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC},
{"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH},
@@ -8754,8 +8809,8 @@ static void usage(void)
"\nbecause execution stopped before plugins were initialized.");
}
- puts("\nTo see what values a running MySQL server is using, type"
- "\n'mysqladmin variables' instead of 'mysqld --verbose --help'.");
+ puts("\nTo see what variables a running MySQL server is using, type"
+ "\n'mysqladmin variables' instead of 'mysqld --verbose --help'.");
}
DBUG_VOID_RETURN;
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index f39eaaadf46..076d26dee3d 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2012, 2018, MariaDB Corporation.
+ Copyright (c) 2012, 2020, 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
@@ -45,6 +45,7 @@
#include <violite.h>
#include <signal.h>
#include "probes_mysql.h"
+#include <debug_sync.h>
#ifdef EMBEDDED_LIBRARY
#undef MYSQL_SERVER
@@ -486,6 +487,17 @@ net_write_command(NET *net,uchar command,
DBUG_ENTER("net_write_command");
DBUG_PRINT("enter",("length: %lu", (ulong) len));
+ DBUG_EXECUTE_IF("simulate_error_on_packet_write",
+ {
+ if (command == COM_BINLOG_DUMP)
+ {
+ net->last_errno = ER_NET_ERROR_ON_WRITE;
+ DBUG_ASSERT(!debug_sync_set_action(
+ (THD *)net->thd,
+ STRING_WITH_LEN("now SIGNAL parked WAIT_FOR continue")));
+ DBUG_RETURN(true);
+ }
+ };);
MYSQL_NET_WRITE_START(length);
buff[4]=command; /* For first packet */
@@ -592,7 +604,8 @@ net_write_buff(NET *net, const uchar *packet, ulong len)
return net_real_write(net, packet, len) ? 1 : 0;
/* Send out rest of the blocks as full sized blocks */
}
- memcpy((char*) net->write_pos,packet,len);
+ if (len)
+ memcpy((char*) net->write_pos,packet,len);
net->write_pos+= len;
return 0;
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 99508cf0b50..798b1f284bc 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2015, MariaDB
+ Copyright (c) 2008, 2020, 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
@@ -357,7 +357,7 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
uint mrr_buf_size, MEM_ROOT *alloc);
static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used,
- bool update_tbl_stats,
+ bool for_range_access,
double read_time);
static
TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree,
@@ -1852,6 +1852,9 @@ SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc()
next_key_part=arg.next_key_part;
max_part_no= arg.max_part_no;
use_count=1; elements=1;
+ next= 0;
+ if (next_key_part)
+ ++next_key_part->use_count;
}
@@ -4705,6 +4708,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
sizeof(TRP_RANGE*)*
n_child_scans)))
DBUG_RETURN(NULL);
+
/*
Collect best 'range' scan for each of disjuncts, and, while doing so,
analyze possibility of ROR scans. Also calculate some values needed by
@@ -4716,7 +4720,8 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
{
DBUG_EXECUTE("info", print_sel_tree(param, *ptree, &(*ptree)->keys_map,
"tree in SEL_IMERGE"););
- if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, read_time)))
+ if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE,
+ read_time)))
{
/*
One of index scans in this index_merge is more expensive than entire
@@ -5036,9 +5041,12 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
a random order
2. the functions that estimate the cost of a range scan and an
index merge retrievals are not well calibrated
+
+ As the best range access has been already chosen it does not
+ make sense to evaluate the one obtained from a degenerated
+ index merge.
*/
- trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE,
- read_time);
+ trp= 0;
}
DBUG_RETURN(trp);
@@ -6765,6 +6773,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
tree make range select for this SEL_TREE
index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes)
+ for_range_access if TRUE the function is called to get the best range
+ plan for range access, not for index merge access
read_time don't create read plans with cost > read_time.
RETURN
Best range read plan
@@ -6773,7 +6783,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used,
- bool update_tbl_stats,
+ bool for_range_access,
double read_time)
{
uint idx, UNINIT_VAR(best_idx);
@@ -6819,9 +6829,16 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
(bool) param->table->covering_keys.is_set(keynr);
found_records= check_quick_select(param, idx, read_index_only, key,
- update_tbl_stats, &mrr_flags,
+ for_range_access, &mrr_flags,
&buf_size, &cost);
+ if (!for_range_access && !param->is_ror_scan &&
+ !optimizer_flag(param->thd,OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
+ {
+ /* The scan is not a ROR-scan, just skip it */
+ continue;
+ }
+
if (found_records != HA_POS_ERROR && tree->index_scans &&
(index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root,
sizeof(INDEX_SCAN_INFO))))
@@ -7541,13 +7558,15 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
- Field::geometry_type sav_geom_type;
- const bool geometry= field_item->field->type() == MYSQL_TYPE_GEOMETRY;
- if (geometry)
+ Field::geometry_type sav_geom_type= Field::GEOM_GEOMETRY, *geom_type=
+ field_item->field->type() == MYSQL_TYPE_GEOMETRY
+ ? &(static_cast<Field_geom*>(field_item->field))->geom_type
+ : NULL;
+ if (geom_type)
{
- sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
+ sav_geom_type= *geom_type;
/* We have to be able to store all sorts of spatial features here */
- ((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
+ *geom_type= Field::GEOM_GEOMETRY;
}
#endif /*HAVE_SPATIAL*/
@@ -7578,9 +7597,9 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
#ifdef HAVE_SPATIAL
- if (geometry)
+ if (geom_type)
{
- ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
+ *geom_type= sav_geom_type;
}
#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
@@ -9069,7 +9088,7 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
if (key2->next_key_part)
{
key1->use_count--; // Incremented in and_all_keys
- return and_all_keys(param, key1, key2, clone_flag);
+ return and_all_keys(param, key1, key2->next_key_part, clone_flag);
}
key2->use_count--; // Key2 doesn't have a tree
}
@@ -9581,10 +9600,11 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
if (!tmp->next_key_part)
{
- if (key2->use_count)
+ SEL_ARG *key2_next= key2->next;
+ if (key2_shared)
{
SEL_ARG *key2_cpy= new SEL_ARG(*key2);
- if (key2_cpy)
+ if (!key2_cpy)
return 0;
key2= key2_cpy;
}
@@ -9605,7 +9625,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
Move on to next range in key2
*/
key2->increment_use_count(-1); // Free not used tree
- key2=key2->next;
+ key2=key2_next;
continue;
}
else
diff --git a/sql/opt_range.h b/sql/opt_range.h
index dff50252e1a..1e6aca540d8 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -656,6 +656,7 @@ public:
bool statement_should_be_aborted() const
{
return
+ thd->killed ||
thd->is_fatal_error ||
thd->is_error() ||
alloced_sel_args > SEL_ARG::MAX_SEL_ARGS;
diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc
index e3de12779d3..ef8ec028aec 100644
--- a/sql/opt_range_mrr.cc
+++ b/sql/opt_range_mrr.cc
@@ -74,6 +74,7 @@ range_seq_t sel_arg_range_seq_init(void *init_param, uint n_ranges, uint flags)
SEL_ARG_RANGE_SEQ *seq= (SEL_ARG_RANGE_SEQ*)init_param;
seq->param->range_count=0;
seq->at_start= TRUE;
+ seq->param->max_key_part= 0;
seq->stack[0].key_tree= NULL;
seq->stack[0].min_key= seq->param->min_key;
seq->stack[0].min_key_flag= 0;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 2fb5b88687f..fec4e8b2828 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2010, 2019, MariaDB
+ Copyright (c) 2010, 2020, 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
@@ -701,9 +701,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
{
DBUG_PRINT("info", ("Subquery can't be converted to merged semi-join"));
/* Test if the user has set a legal combination of optimizer switches. */
- if (!optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS) &&
- !optimizer_flag(thd, OPTIMIZER_SWITCH_MATERIALIZATION))
- my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0));
+ DBUG_ASSERT(optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS |
+ OPTIMIZER_SWITCH_MATERIALIZATION));
/*
Transform each subquery predicate according to its overloaded
transformer.
@@ -2635,16 +2634,11 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
do
{
uint key= keyuse->key;
- KEY *keyinfo;
key_part_map bound_parts= 0;
- bool is_excluded_key= keyuse->is_for_hash_join();
- if (!is_excluded_key)
- {
- keyinfo= table->key_info + key;
- is_excluded_key= !MY_TEST(keyinfo->flags & HA_NOSAME);
- }
- if (!is_excluded_key)
+ if (!keyuse->is_for_hash_join() &&
+ (table->key_info[key].flags & HA_NOSAME))
{
+ KEY *keyinfo= table->key_info + key;
do /* For all equalities on all key parts */
{
/*
diff --git a/sql/protocol.cc b/sql/protocol.cc
index aa795b9d12a..de6d1b96f76 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2020, 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
@@ -58,7 +58,8 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
packet->realloc(packet_length+9+length))
return 1;
uchar *to= net_store_length((uchar*) packet->ptr()+packet_length, length);
- memcpy(to,from,length);
+ if (length)
+ memcpy(to,from,length);
packet->length((uint) (to+length-(uchar*) packet->ptr()));
return 0;
}
@@ -715,7 +716,8 @@ void net_send_progress_packet(THD *thd)
uchar *net_store_data(uchar *to, const uchar *from, size_t length)
{
to=net_store_length_fast(to,length);
- memcpy(to,from,length);
+ if (length)
+ memcpy(to,from,length);
return to+length;
}
diff --git a/sql/records.cc b/sql/records.cc
index 6a611d46ca4..8a152cda4c2 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -320,12 +320,9 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
void end_read_record(READ_RECORD *info)
-{ /* free cache if used */
- if (info->cache)
- {
- my_free_lock(info->cache);
- info->cache=0;
- }
+{
+ /* free cache if used */
+ free_cache(info);
if (info->table)
{
if (info->table->is_created())
@@ -336,6 +333,17 @@ void end_read_record(READ_RECORD *info)
}
}
+
+void free_cache(READ_RECORD *info)
+{
+ if (info->cache)
+ {
+ my_free_lock(info->cache);
+ info->cache=0;
+ }
+}
+
+
static int rr_handle_error(READ_RECORD *info, int error)
{
if (info->thd->killed)
diff --git a/sql/records.h b/sql/records.h
index b5f04dbd161..dd63d3608bb 100644
--- a/sql/records.h
+++ b/sql/records.h
@@ -30,6 +30,7 @@ class SORT_INFO;
struct READ_RECORD;
void end_read_record(READ_RECORD *info);
+void free_cache(READ_RECORD *info);
/**
A context for reading through a single table using a chosen access method:
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index 4c4b56f591f..2548dc92d7b 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -349,14 +349,20 @@ Rpl_filter::set_do_table(const char* table_spec)
int status;
if (do_table_inited)
- my_hash_reset(&do_table);
+ {
+ my_hash_free(&do_table);
+ do_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
- if (!do_table.records)
+ if (do_table_inited && status)
{
- my_hash_free(&do_table);
- do_table_inited= 0;
+ if (!do_table.records)
+ {
+ my_hash_free(&do_table);
+ do_table_inited= 0;
+ }
}
return status;
@@ -369,14 +375,20 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status;
if (ignore_table_inited)
- my_hash_reset(&ignore_table);
+ {
+ my_hash_free(&ignore_table);
+ ignore_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
- if (!ignore_table.records)
+ if (ignore_table_inited && status)
{
- my_hash_free(&ignore_table);
- ignore_table_inited= 0;
+ if (!ignore_table.records)
+ {
+ my_hash_free(&ignore_table);
+ ignore_table_inited= 0;
+ }
}
return status;
@@ -411,14 +423,20 @@ Rpl_filter::set_wild_do_table(const char* table_spec)
int status;
if (wild_do_table_inited)
+ {
free_string_array(&wild_do_table);
+ wild_do_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_wild_do_table);
- if (!wild_do_table.elements)
+ if (wild_do_table_inited && status)
{
- delete_dynamic(&wild_do_table);
- wild_do_table_inited= 0;
+ if (!wild_do_table.elements)
+ {
+ delete_dynamic(&wild_do_table);
+ wild_do_table_inited= 0;
+ }
}
return status;
@@ -431,14 +449,20 @@ Rpl_filter::set_wild_ignore_table(const char* table_spec)
int status;
if (wild_ignore_table_inited)
+ {
free_string_array(&wild_ignore_table);
+ wild_ignore_table_inited= 0;
+ }
status= parse_filter_rule(table_spec, &Rpl_filter::add_wild_ignore_table);
- if (!wild_ignore_table.elements)
+ if (wild_ignore_table_inited && status)
{
- delete_dynamic(&wild_ignore_table);
- wild_ignore_table_inited= 0;
+ if (!wild_ignore_table.elements)
+ {
+ delete_dynamic(&wild_ignore_table);
+ wild_ignore_table_inited= 0;
+ }
}
return status;
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index cc6c169c0df..43fdeec9e6a 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2013, Kristian Nielsen and MariaDB Services Ab.
+ Copyright (c) 2020, 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
@@ -2226,7 +2227,8 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us)
/* fall through */
case 0:
status_var_add(thd->status_var.master_gtid_wait_time,
- microsecond_interval_timer() - before);
+ static_cast<ulong>
+ (microsecond_interval_timer() - before));
}
my_free(wait_pos);
return err;
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 027aa5f628c..4cf87ba73b7 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -75,18 +75,18 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev)
/* Do not update position if an earlier event group caused an error abort. */
DBUG_ASSERT(qev->typ == rpl_parallel_thread::queued_event::QUEUED_POS_UPDATE);
+ rli= qev->rgi->rli;
e= qev->entry_for_queued;
- if (e->stop_on_error_sub_id < (uint64)ULONGLONG_MAX || e->force_abort)
+ if (e->stop_on_error_sub_id < (uint64)ULONGLONG_MAX ||
+ (e->force_abort && !rli->stop_for_until))
return;
- rli= qev->rgi->rli;
mysql_mutex_lock(&rli->data_lock);
cmp= strcmp(rli->group_relay_log_name, qev->event_relay_log_name);
if (cmp < 0)
{
rli->group_relay_log_pos= qev->future_event_relay_log_pos;
strmake_buf(rli->group_relay_log_name, qev->event_relay_log_name);
- rli->notify_group_relay_log_name_update();
} else if (cmp == 0 &&
rli->group_relay_log_pos < qev->future_event_relay_log_pos)
rli->group_relay_log_pos= qev->future_event_relay_log_pos;
@@ -378,13 +378,14 @@ do_gco_wait(rpl_group_info *rgi, group_commit_orderer *gco,
}
-static void
+static bool
do_ftwrl_wait(rpl_group_info *rgi,
bool *did_enter_cond, PSI_stage_info *old_stage)
{
THD *thd= rgi->thd;
rpl_parallel_entry *entry= rgi->parallel_entry;
uint64 sub_id= rgi->gtid_sub_id;
+ bool aborted= false;
DBUG_ENTER("do_ftwrl_wait");
mysql_mutex_assert_owner(&entry->LOCK_parallel_entry);
@@ -407,7 +408,10 @@ do_ftwrl_wait(rpl_group_info *rgi,
do
{
if (entry->force_abort || rgi->worker_error)
+ {
+ aborted= true;
break;
+ }
if (thd->check_killed())
{
thd->send_kill_message();
@@ -427,7 +431,7 @@ do_ftwrl_wait(rpl_group_info *rgi,
if (sub_id > entry->largest_started_sub_id)
entry->largest_started_sub_id= sub_id;
- DBUG_VOID_RETURN;
+ DBUG_RETURN(aborted);
}
@@ -513,7 +517,22 @@ rpl_unpause_after_ftwrl(THD *thd)
mysql_mutex_lock(&e->LOCK_parallel_entry);
rpt->pause_for_ftwrl = false;
mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
- e->pause_sub_id= (uint64)ULONGLONG_MAX;
+ /*
+ Do not change pause_sub_id if force_abort is set.
+ force_abort is set in case of STOP SLAVE.
+
+ Reason: If pause_sub_id is not changed and force_abort_is set,
+ any parallel slave thread waiting in do_ftwrl_wait() will
+ on wakeup return from do_ftwrl_wait() with 1. This will set
+ skip_event_group to 1 in handle_rpl_parallel_thread() and the
+ parallel thread will abort at once.
+
+ If pause_sub_id is changed, the code in handle_rpl_parallel_thread()
+ would continue to execute the transaction in the queue, which would
+ cause some transactions to be lost.
+ */
+ if (!e->force_abort)
+ e->pause_sub_id= (uint64)ULONGLONG_MAX;
mysql_cond_broadcast(&e->COND_parallel_entry);
mysql_mutex_unlock(&e->LOCK_parallel_entry);
}
@@ -1197,7 +1216,7 @@ handle_rpl_parallel_thread(void *arg)
rgi->worker_error= 1;
}
if (likely(!skip_event_group))
- do_ftwrl_wait(rgi, &did_enter_cond, &old_stage);
+ skip_event_group= do_ftwrl_wait(rgi, &did_enter_cond, &old_stage);
/*
Register ourself to wait for the previous commit, if we need to do
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 3e1bb28f701..99f8da2c928 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB Corporation
+ Copyright (c) 2010, 2020, 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
@@ -60,6 +60,7 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
slave_running(MYSQL_SLAVE_NOT_RUN), until_condition(UNTIL_NONE),
until_log_pos(0), retried_trans(0), executed_entries(0),
sql_delay(0), sql_delay_end(0),
+ until_relay_log_names_defer(false),
m_flags(0)
{
DBUG_ENTER("Relay_log_info::Relay_log_info");
@@ -499,6 +500,8 @@ void Relay_log_info::clear_until_condition()
until_condition= Relay_log_info::UNTIL_NONE;
until_log_name[0]= 0;
until_log_pos= 0;
+ until_relay_log_names_defer= false;
+
DBUG_VOID_RETURN;
}
@@ -989,7 +992,6 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
{
group_relay_log_pos= rgi->future_event_relay_log_pos;
strmake_buf(group_relay_log_name, rgi->event_relay_log_name);
- notify_group_relay_log_name_update();
} else if (cmp == 0 && group_relay_log_pos < rgi->future_event_relay_log_pos)
group_relay_log_pos= rgi->future_event_relay_log_pos;
@@ -1279,29 +1281,78 @@ err:
autoincrement or if we have transactions).
Should be called ONLY if until_condition != UNTIL_NONE !
+
+ In the parallel execution mode and UNTIL_MASTER_POS the file name is
+ presented by future_event_master_log_name which may be ahead of
+ group_master_log_name. Log_event::log_pos does relate to it nevertheless
+ so the pair comprises a correct binlog coordinate.
+ Internal group events and events that have zero log_pos also
+ produce the zero for the local log_pos which may not lead to the
+ function falsely return true.
+ In UNTIL_RELAY_POS the original caching and notification are simplified
+ to straightforward files comparison when the current event can't be
+ a part of an event group.
+
RETURN VALUE
true - condition met or error happened (condition seems to have
bad log file name)
false - condition not met
*/
-bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
+bool Relay_log_info::is_until_satisfied(Log_event *ev)
{
const char *log_name;
ulonglong log_pos;
+ /* Prevents stopping within transaction; needed solely for Relay UNTIL. */
+ bool in_trans= false;
+
DBUG_ENTER("Relay_log_info::is_until_satisfied");
if (until_condition == UNTIL_MASTER_POS)
{
log_name= (mi->using_parallel() ? future_event_master_log_name
: group_master_log_name);
- log_pos= master_beg_pos;
+ log_pos= (get_flag(Relay_log_info::IN_TRANSACTION) || !ev || !ev->log_pos) ?
+ (mi->using_parallel() ? 0 : group_master_log_pos) :
+ ev->log_pos - ev->data_written;
}
else
{
DBUG_ASSERT(until_condition == UNTIL_RELAY_POS);
- log_name= group_relay_log_name;
- log_pos= group_relay_log_pos;
+ if (!mi->using_parallel())
+ {
+ log_name= group_relay_log_name;
+ log_pos= group_relay_log_pos;
+ }
+ else
+ {
+ log_name= event_relay_log_name;
+ log_pos= event_relay_log_pos;
+ in_trans= get_flag(Relay_log_info::IN_TRANSACTION);
+ /*
+ until_log_names_cmp_result is set to UNKNOWN either
+ - by a non-group event *and* only when it is in the middle of a group
+ - or by a group event when the preceding group made the above
+ non-group event to defer the resetting.
+ */
+ if ((ev && !Log_event::is_group_event(ev->get_type_code())))
+ {
+ if (in_trans)
+ {
+ until_relay_log_names_defer= true;
+ }
+ else
+ {
+ until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
+ until_relay_log_names_defer= false;
+ }
+ }
+ else if (!in_trans && until_relay_log_names_defer)
+ {
+ until_log_names_cmp_result= UNTIL_LOG_NAMES_CMP_UNKNOWN;
+ until_relay_log_names_defer= false;
+ }
+ }
}
DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%llu",
@@ -1355,8 +1406,8 @@ bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
}
DBUG_RETURN(((until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_EQUAL &&
- log_pos >= until_log_pos) ||
- until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_GREATER));
+ (log_pos >= until_log_pos && !in_trans)) ||
+ until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_GREATER));
}
@@ -1416,8 +1467,14 @@ bool Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
}
DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE(););
if (mi->using_gtid == Master_info::USE_GTID_NO)
+ {
+ if (rgi->is_parallel_exec)
+ mysql_mutex_lock(&data_lock);
if (flush())
error= 1;
+ if (rgi->is_parallel_exec)
+ mysql_mutex_unlock(&data_lock);
+ }
DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE(););
}
DBUG_RETURN(error);
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 4ec4821b67d..2bc0a80268a 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -219,7 +219,7 @@ public:
*/
char future_event_master_log_name[FN_REFLEN];
- /*
+ /*
Original log name and position of the group we're currently executing
(whose coordinates are group_relay_log_name/pos in the relay log)
in the master's binlog. These concern the *group*, because in the master's
@@ -419,7 +419,7 @@ public:
void close_temporary_tables();
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
- bool is_until_satisfied(my_off_t);
+ bool is_until_satisfied(Log_event *ev);
inline ulonglong until_pos()
{
DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
@@ -427,7 +427,13 @@ public:
return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
group_relay_log_pos);
}
-
+ inline char *until_name()
+ {
+ DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
+ until_condition == UNTIL_RELAY_POS);
+ return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_name :
+ group_relay_log_name);
+ }
/**
Helper function to do after statement completion.
@@ -564,6 +570,15 @@ private:
relay_log.info had 4 lines. Now it has 5 lines.
*/
static const int LINES_IN_RELAY_LOG_INFO_WITH_DELAY= 5;
+ /*
+ Hint for when to stop event distribution by sql driver thread.
+ The flag is set ON by a non-group event when this event is in the middle
+ of a group (e.g a transaction group) so it's too early
+ to refresh the current-relay-log vs until-log cached comparison result.
+ And it is checked and to decide whether it's a right time to do so
+ when the being processed group has been fully scheduled.
+ */
+ bool until_relay_log_names_defer;
/*
Holds the state of the data in the relay log.
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 4ca94b6cd60..4ef8cbfd706 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -772,8 +772,11 @@ my_bool Session_sysvars_tracker::store_variable(void *ptr, void *data_ptr)
show.name= svar->name.str;
show.value= (char *) svar;
+ mysql_mutex_lock(&LOCK_global_system_variables);
const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL,
&charset, val_buf, &val_length);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+
if (is_plugin)
mysql_mutex_unlock(&LOCK_plugin);
@@ -1693,18 +1696,27 @@ void Session_tracker::store(THD *thd, String *buf)
}
size_t length= buf->length() - start;
- uchar *data= (uchar *)(buf->ptr() + start);
+ uchar *data;
uint size;
if ((size= net_length_size(length)) != 1)
{
- if (buf->reserve(size - 1, EXTRA_ALLOC))
+ if (buf->reserve(size - 1, 0))
{
buf->length(start); // it is safer to have 0-length block in case of error
return;
}
+
+ /*
+ The 'buf->reserve()' can change the buf->ptr() so we cannot
+ calculate the 'data' earlier.
+ */
+ buf->length(buf->length() + (size - 1));
+ data= (uchar *)(buf->ptr() + start);
memmove(data + (size - 1), data, length);
}
+ else
+ data= (uchar *)(buf->ptr() + start);
net_store_length(data - 1, length);
}
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 036cc5f1d43..569362fb7bd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -971,8 +971,17 @@ int set_var_default_role::check(THD *thd)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
real_user= get_current_user(thd, user);
- int status= acl_check_set_default_role(thd, real_user->host.str, real_user->user.str);
- return status;
+ real_role= role.str;
+ if (role.str == current_role.str)
+ {
+ if (!thd->security_ctx->priv_role[0])
+ real_role= "NONE";
+ else
+ real_role= thd->security_ctx->priv_role;
+ }
+
+ return acl_check_set_default_role(thd, real_user->host.str,
+ real_user->user.str, real_role);
#else
return 0;
#endif
@@ -983,7 +992,8 @@ int set_var_default_role::update(THD *thd)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
thd->m_reprepare_observer= 0;
- int res= acl_set_default_role(thd, real_user->host.str, real_user->user.str, role.str);
+ int res= acl_set_default_role(thd, real_user->host.str, real_user->user.str,
+ real_role);
thd->m_reprepare_observer= save_reprepare_observer;
return res;
#else
diff --git a/sql/set_var.h b/sql/set_var.h
index a5439a27137..b43e8f96c59 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -350,6 +350,7 @@ class set_var_default_role: public set_var_base
{
LEX_USER *user, *real_user;
LEX_STRING role;
+ const char *real_role;
public:
set_var_default_role(LEX_USER *user_arg, LEX_STRING role_arg) :
user(user_arg), role(role_arg) {}
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 36e5fb9be1e..4bb1ae951af 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -1197,30 +1197,30 @@ ER_TABLE_EXISTS_ERROR 42S01
swe "Tabellen '%-.192s' finns redan"
ukr "Таблиця '%-.192s' вже існує"
ER_BAD_TABLE_ERROR 42S02
- cze "Neznámá tabulka '%-.100s'"
- dan "Ukendt tabel '%-.100s'"
- nla "Onbekende tabel '%-.100s'"
- eng "Unknown table '%-.100s'"
- est "Tundmatu tabel '%-.100s'"
- fre "Table '%-.100s' inconnue"
- ger "Unbekannte Tabelle '%-.100s'"
- greek "Αγνωστος πίνακας '%-.100s'"
- hindi "अज्ञात टेबल '%-.100s'"
- hun "Ervenytelen tabla: '%-.100s'"
- ita "Tabella '%-.100s' sconosciuta"
- jpn "'%-.100s' は不明な表です。"
- kor "테이블 '%-.100s'는 알수 없음"
- nor "Ukjent tabell '%-.100s'"
- norwegian-ny "Ukjent tabell '%-.100s'"
- pol "Nieznana tabela '%-.100s'"
- por "Tabela '%-.100s' desconhecida"
- rum "Tabela '%-.100s' este invalida"
- rus "Неизвестная таблица '%-.100s'"
- serbian "Nepoznata tabela '%-.100s'"
- slo "Neznáma tabuľka '%-.100s'"
- spa "Tabla '%-.100s' desconocida"
- swe "Okänd tabell '%-.100s'"
- ukr "Невідома таблиця '%-.100s'"
+ cze "Neznámá tabulka '%-.100T'"
+ dan "Ukendt tabel '%-.100T'"
+ nla "Onbekende tabel '%-.100T'"
+ eng "Unknown table '%-.100T'"
+ est "Tundmatu tabel '%-.100T'"
+ fre "Table '%-.100T' inconnue"
+ ger "Unbekannte Tabelle '%-.100T'"
+ greek "Αγνωστος πίνακας '%-.100T'"
+ hindi "अज्ञात टेबल '%-.100T'"
+ hun "Ervenytelen tabla: '%-.100T'"
+ ita "Tabella '%-.100T' sconosciuta"
+ jpn "'%-.100T' は不明な表です。"
+ kor "테이블 '%-.100T'는 알수 없음"
+ nor "Ukjent tabell '%-.100T'"
+ norwegian-ny "Ukjent tabell '%-.100T'"
+ pol "Nieznana tabela '%-.100T'"
+ por "Tabela '%-.100T' desconhecida"
+ rum "Tabela '%-.100T' este invalida"
+ rus "Неизвестная таблица '%-.100T'"
+ serbian "Nepoznata tabela '%-.100T'"
+ slo "Neznáma tabuľka '%-.100T'"
+ spa "Tabla '%-.100T' desconocida"
+ swe "Okänd tabell '%-.100T'"
+ ukr "Невідома таблиця '%-.100T'"
ER_NON_UNIQ_ERROR 23000
cze "Sloupec '%-.192s' v %-.192s není zcela jasný"
dan "Felt: '%-.192s' i tabel %-.192s er ikke entydigt"
@@ -1394,30 +1394,30 @@ ER_WRONG_VALUE_COUNT 21S01
swe "Antalet kolumner motsvarar inte antalet värden"
ukr "Кількість стовбців не співпадає з кількістю значень"
ER_TOO_LONG_IDENT 42000 S1009
- cze "Jméno identifikátoru '%-.100s' je příliš dlouhé"
- dan "Navnet '%-.100s' er for langt"
- nla "Naam voor herkenning '%-.100s' is te lang"
- eng "Identifier name '%-.100s' is too long"
- est "Identifikaatori '%-.100s' nimi on liiga pikk"
- fre "Le nom de l'identificateur '%-.100s' est trop long"
- ger "Name des Bezeichners '%-.100s' ist zu lang"
- greek "Το identifier name '%-.100s' είναι πολύ μεγάλο"
- hindi "पहचानकर्ता का नाम '%-.100s' बहुत लंबा है"
- hun "A(z) '%-.100s' azonositonev tul hosszu"
- ita "Il nome dell'identificatore '%-.100s' e` troppo lungo"
- jpn "識別子名 '%-.100s' は長すぎます。"
- kor "Identifier '%-.100s'는 너무 길군요."
- nor "Identifikator '%-.100s' er for lang"
- norwegian-ny "Identifikator '%-.100s' er for lang"
- pol "Nazwa identyfikatora '%-.100s' jest zbyt długa"
- por "Nome identificador '%-.100s' é longo demais"
- rum "Numele indentificatorului '%-.100s' este prea lung"
- rus "Слишком длинный идентификатор '%-.100s'"
- serbian "Ime '%-.100s' je predugačko"
- slo "Meno identifikátora '%-.100s' je príliš dlhé"
- spa "El nombre del identificador '%-.100s' es demasiado grande"
- swe "Kolumnnamn '%-.100s' är för långt"
- ukr "Ім'я ідентифікатора '%-.100s' задовге"
+ cze "Jméno identifikátoru '%-.100T' je příliš dlouhé"
+ dan "Navnet '%-.100T' er for langt"
+ nla "Naam voor herkenning '%-.100T' is te lang"
+ eng "Identifier name '%-.100T' is too long"
+ est "Identifikaatori '%-.100T' nimi on liiga pikk"
+ fre "Le nom de l'identificateur '%-.100T' est trop long"
+ ger "Name des Bezeichners '%-.100T' ist zu lang"
+ greek "Το identifier name '%-.100T' είναι πολύ μεγάλο"
+ hindi "पहचानकर्ता का नाम '%-.100T' बहुत लंबा है"
+ hun "A(z) '%-.100T' azonositonev tul hosszu"
+ ita "Il nome dell'identificatore '%-.100T' e` troppo lungo"
+ jpn "識別子名 '%-.100T' は長すぎます。"
+ kor "Identifier '%-.100T'는 너무 길군요."
+ nor "Identifikator '%-.100T' er for lang"
+ norwegian-ny "Identifikator '%-.100T' er for lang"
+ pol "Nazwa identyfikatora '%-.100T' jest zbyt długa"
+ por "Nome identificador '%-.100T' é longo demais"
+ rum "Numele indentificatorului '%-.100T' este prea lung"
+ rus "Слишком длинный идентификатор '%-.100T'"
+ serbian "Ime '%-.100T' je predugačko"
+ slo "Meno identifikátora '%-.100T' je príliš dlhé"
+ spa "El nombre del identificador '%-.100T' es demasiado grande"
+ swe "Kolumnnamn '%-.100T' är för långt"
+ ukr "Ім'я ідентифікатора '%-.100T' задовге"
ER_DUP_FIELDNAME 42S21 S1009
cze "Zdvojené jméno sloupce '%-.192s'"
dan "Feltnavnet '%-.192s' findes allerede"
@@ -1471,30 +1471,30 @@ ER_DUP_KEYNAME 42000 S1009
# When using this error code, please use ER(ER_DUP_ENTRY_WITH_KEY_NAME)
# for the message string. See, for example, code in handler.cc.
ER_DUP_ENTRY 23000 S1009
- cze "Zdvojený klíč '%-.192s' (číslo klíče %d)"
- dan "Ens værdier '%-.192s' for indeks %d"
- nla "Dubbele ingang '%-.192s' voor zoeksleutel %d"
- eng "Duplicate entry '%-.192s' for key %d"
- est "Kattuv väärtus '%-.192s' võtmele %d"
- fre "Duplicata du champ '%-.192s' pour la clef %d"
- ger "Doppelter Eintrag '%-.192s' für Schlüssel %d"
- greek "Διπλή εγγραφή '%-.192s' για το κλειδί %d"
- hindi "सामान प्रवेश '%-.192s' KEY %d के लिए"
- hun "Duplikalt bejegyzes '%-.192s' a %d kulcs szerint"
- ita "Valore duplicato '%-.192s' per la chiave %d"
- jpn "'%-.192s' は索引 %d で重複しています。"
- kor "중복된 입력 값 '%-.192s': key %d"
- nor "Like verdier '%-.192s' for nøkkel %d"
- norwegian-ny "Like verdiar '%-.192s' for nykkel %d"
- pol "Powtórzone wystąpienie '%-.192s' dla klucza %d"
- por "Entrada '%-.192s' duplicada para a chave %d"
- rum "Cimpul '%-.192s' e duplicat pentru cheia %d"
- rus "Дублирующаяся запись '%-.192s' по ключу %d"
- serbian "Dupliran unos '%-.192s' za ključ '%d'"
- slo "Opakovaný kľúč '%-.192s' (číslo kľúča %d)"
- spa "Entrada duplicada '%-.192s' para la clave %d"
- swe "Dublett '%-.192s' för nyckel %d"
- ukr "Дублюючий запис '%-.192s' для ключа %d"
+ cze "Zdvojený klíč '%-.192T' (číslo klíče %d)"
+ dan "Ens værdier '%-.192T' for indeks %d"
+ nla "Dubbele ingang '%-.192T' voor zoeksleutel %d"
+ eng "Duplicate entry '%-.192T' for key %d"
+ est "Kattuv väärtus '%-.192T' võtmele %d"
+ fre "Duplicata du champ '%-.192T' pour la clef %d"
+ ger "Doppelter Eintrag '%-.192T' für Schlüssel %d"
+ greek "Διπλή εγγραφή '%-.192T' για το κλειδί %d"
+ hindi "सामान प्रवेश '%-.192T' KEY %d के लिए"
+ hun "Duplikalt bejegyzes '%-.192T' a %d kulcs szerint"
+ ita "Valore duplicato '%-.192T' per la chiave %d"
+ jpn "'%-.192T' は索引 %d で重複しています。"
+ kor "중복된 입력 값 '%-.192T': key %d"
+ nor "Like verdier '%-.192T' for nøkkel %d"
+ norwegian-ny "Like verdiar '%-.192T' for nykkel %d"
+ pol "Powtórzone wystąpienie '%-.192T' dla klucza %d"
+ por "Entrada '%-.192T' duplicada para a chave %d"
+ rum "Cimpul '%-.192T' e duplicat pentru cheia %d"
+ rus "Дублирующаяся запись '%-.192T' по ключу %d"
+ serbian "Dupliran unos '%-.192T' za ključ '%d'"
+ slo "Opakovaný kľúč '%-.192T' (číslo kľúča %d)"
+ spa "Entrada duplicada '%-.192T' para la clave %d"
+ swe "Dublett '%-.192T' för nyckel %d"
+ ukr "Дублюючий запис '%-.192T' для ключа %d"
ER_WRONG_FIELD_SPEC 42000 S1009
cze "Chybná specifikace sloupce '%-.192s'"
dan "Forkert kolonnespecifikaton for felt '%-.192s'"
@@ -1521,30 +1521,30 @@ ER_WRONG_FIELD_SPEC 42000 S1009
swe "Felaktigt kolumntyp för kolumn '%-.192s'"
ukr "Невірний специфікатор стовбця '%-.192s'"
ER_PARSE_ERROR 42000 s1009
- cze "%s blízko '%-.80s' na řádku %d"
- dan "%s nær '%-.80s' på linje %d"
- nla "%s bij '%-.80s' in regel %d"
- eng "%s near '%-.80s' at line %d"
- est "%s '%-.80s' ligidal real %d"
- fre "%s près de '%-.80s' à la ligne %d"
- ger "%s bei '%-.80s' in Zeile %d"
- greek "%s πλησίον '%-.80s' στη γραμμή %d"
- hindi "%s के पास '%-.80s' लाइन %d में"
- hun "A %s a '%-.80s'-hez kozeli a %d sorban"
- ita "%s vicino a '%-.80s' linea %d"
- jpn "%s : '%-.80s' 付近 %d 行目"
- kor "'%s' 에러 같읍니다. ('%-.80s' 명령어 라인 %d)"
- nor "%s nær '%-.80s' på linje %d"
- norwegian-ny "%s attmed '%-.80s' på line %d"
- pol "%s obok '%-.80s' w linii %d"
- por "%s próximo a '%-.80s' na linha %d"
- rum "%s linga '%-.80s' pe linia %d"
- rus "%s около '%-.80s' на строке %d"
- serbian "'%s' u iskazu '%-.80s' na liniji %d"
- slo "%s blízko '%-.80s' na riadku %d"
- spa "%s cerca '%-.80s' en la linea %d"
- swe "%s nära '%-.80s' på rad %d"
- ukr "%s біля '%-.80s' в строці %d"
+ cze "%s blízko '%-.80T' na řádku %d"
+ dan "%s nær '%-.80T' på linje %d"
+ nla "%s bij '%-.80T' in regel %d"
+ eng "%s near '%-.80T' at line %d"
+ est "%s '%-.80T' ligidal real %d"
+ fre "%s près de '%-.80T' à la ligne %d"
+ ger "%s bei '%-.80T' in Zeile %d"
+ greek "%s πλησίον '%-.80T' στη γραμμή %d"
+ hindi "%s के पास '%-.80T' लाइन %d में"
+ hun "A %s a '%-.80T'-hez kozeli a %d sorban"
+ ita "%s vicino a '%-.80T' linea %d"
+ jpn "%s : '%-.80T' 付近 %d 行目"
+ kor "'%s' 에러 같읍니다. ('%-.80T' 명령어 라인 %d)"
+ nor "%s nær '%-.80T' på linje %d"
+ norwegian-ny "%s attmed '%-.80T' på line %d"
+ pol "%s obok '%-.80T' w linii %d"
+ por "%s próximo a '%-.80T' na linha %d"
+ rum "%s linga '%-.80T' pe linia %d"
+ rus "%s около '%-.80T' на строке %d"
+ serbian "'%s' u iskazu '%-.80T' na liniji %d"
+ slo "%s blízko '%-.80T' na riadku %d"
+ spa "%s cerca '%-.80T' en la linea %d"
+ swe "%s nära '%-.80T' på rad %d"
+ ukr "%s біля '%-.80T' в строці %d"
ER_EMPTY_QUERY 42000
cze "Výsledek dotazu je prázdný"
dan "Forespørgsel var tom"
@@ -1800,9 +1800,10 @@ ER_WRONG_AUTO_KEY 42000 S1009
slo "Môžete mať iba jedno AUTO pole a to musí byť definované ako kľúč"
spa "Puede ser solamente un campo automatico y este debe ser definido como una clave"
swe "Det får finnas endast ett AUTO_INCREMENT-fält och detta måste vara en nyckel"
- ukr "Невірне визначення таблиці; Може бути лише один автоматичний стовбець, що повинен бути визначений як ключ"
+ ukr "Хибне визначення таблиці; Може бути лише один автоматичний стовбець, що повинен бути визначений як ключ"
ER_BINLOG_CANT_DELETE_GTID_DOMAIN
eng "Could not delete gtid domain. Reason: %s."
+ ukr "Не можу видалити домен gtid. Причина: %s."
ER_NORMAL_SHUTDOWN
cze "%s (%s): normální ukončení"
dan "%s (%s): Normal nedlukning"
@@ -2203,6 +2204,7 @@ ER_INSERT_INFO
ER_UPDATE_TABLE_USED
eng "Table '%-.192s' is specified twice, both as a target for '%s' and as a separate source for data"
swe "Table '%-.192s' är använd två gånger. Både för '%s' och för att hämta data"
+ ukr "Таблиця '%-.192s' вказується двічі, як цільова для '%s', так і як окреме джерело даних"
ER_NO_SUCH_THREAD
cze "Neznámá identifikace threadu: %lu"
dan "Ukendt tråd id: %lu"
@@ -2380,30 +2382,30 @@ ER_TABLE_NOT_LOCKED
ER_UNUSED_17
eng "You should never see it"
ER_WRONG_DB_NAME 42000
- cze "Nepřípustné jméno databáze '%-.100s'"
- dan "Ugyldigt database navn '%-.100s'"
- nla "Databasenaam '%-.100s' is niet getoegestaan"
- eng "Incorrect database name '%-.100s'"
- est "Vigane andmebaasi nimi '%-.100s'"
- fre "Nom de base de donnée illégal: '%-.100s'"
- ger "Unerlaubter Datenbankname '%-.100s'"
- greek "Λάθος όνομα βάσης δεδομένων '%-.100s'"
- hindi "डेटाबेस नाम '%-.100s' गलत है"
- hun "Hibas adatbazisnev: '%-.100s'"
- ita "Nome database errato '%-.100s'"
- jpn "データベース名 '%-.100s' は不正です。"
- kor "'%-.100s' 데이타베이스의 이름이 부정확합니다."
- nor "Ugyldig database navn '%-.100s'"
- norwegian-ny "Ugyldig database namn '%-.100s'"
- pol "Niedozwolona nazwa bazy danych '%-.100s'"
- por "Nome de banco de dados '%-.100s' incorreto"
- rum "Numele bazei de date este incorect '%-.100s'"
- rus "Некорректное имя базы данных '%-.100s'"
- serbian "Pogrešno ime baze '%-.100s'"
- slo "Neprípustné meno databázy '%-.100s'"
- spa "Nombre de base de datos ilegal '%-.100s'"
- swe "Felaktigt databasnamn '%-.100s'"
- ukr "Невірне ім'я бази данних '%-.100s'"
+ cze "Nepřípustné jméno databáze '%-.100T'"
+ dan "Ugyldigt database navn '%-.100T'"
+ nla "Databasenaam '%-.100T' is niet getoegestaan"
+ eng "Incorrect database name '%-.100T'"
+ est "Vigane andmebaasi nimi '%-.100T'"
+ fre "Nom de base de donnée illégal: '%-.100T'"
+ ger "Unerlaubter Datenbankname '%-.100T'"
+ greek "Λάθος όνομα βάσης δεδομένων '%-.100T'"
+ hindi "डेटाबेस नाम '%-.100T' गलत है"
+ hun "Hibas adatbazisnev: '%-.100T'"
+ ita "Nome database errato '%-.100T'"
+ jpn "データベース名 '%-.100T' は不正です。"
+ kor "'%-.100T' 데이타베이스의 이름이 부정확합니다."
+ nor "Ugyldig database navn '%-.100T'"
+ norwegian-ny "Ugyldig database namn '%-.100T'"
+ pol "Niedozwolona nazwa bazy danych '%-.100T'"
+ por "Nome de banco de dados '%-.100T' incorreto"
+ rum "Numele bazei de date este incorect '%-.100T'"
+ rus "Некорректное имя базы данных '%-.100T'"
+ serbian "Pogrešno ime baze '%-.100T'"
+ slo "Neprípustné meno databázy '%-.100T'"
+ spa "Nombre de base de datos ilegal '%-.100T'"
+ swe "Felaktigt databasnamn '%-.100T'"
+ ukr "Невірне ім'я бази данних '%-.100T'"
ER_WRONG_TABLE_NAME 42000
cze "Nepřípustné jméno tabulky '%-.100s'"
dan "Ugyldigt tabel navn '%-.100s'"
@@ -2824,6 +2826,7 @@ ER_WRONG_OUTER_JOIN 42000
ER_NULL_COLUMN_IN_INDEX 42000
eng "Table handler doesn't support NULL in given index. Please change column '%-.192s' to be NOT NULL or use another handler"
swe "Tabell hanteraren kan inte indexera NULL kolumner för den givna index typen. Ändra '%-.192s' till NOT NULL eller använd en annan hanterare"
+ ukr "Вказівник таблиці не підтримує NULL у зазначенному індексі. Будь ласка, зменіть стовпчик '%-.192s' на NOT NULL або використайте інший вказівник таблиці."
ER_CANT_FIND_UDF
cze "Nemohu načíst funkci '%-.192s'"
dan "Kan ikke læse funktionen '%-.192s'"
@@ -3244,25 +3247,25 @@ ER_NONEXISTING_GRANT 42000
swe "Det finns inget privilegium definierat för användare '%-.48s' på '%-.64s'"
ukr "Повноважень не визначено для користувача '%-.48s' з хосту '%-.64s'"
ER_TABLEACCESS_DENIED_ERROR 42000
- cze "%-.32s příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku '%-.192s'"
- dan "%-.32s-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen '%-.192s'"
- nla "%-.32s commando geweigerd voor gebruiker: '%s'@'%s' voor tabel '%-.192s'"
- eng "%-.32s command denied to user '%s'@'%s' for table '%-.192s'"
- jps "コマンド %-.32s は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません",
- est "%-.32s käsk ei ole lubatud kasutajale '%s'@'%s' tabelis '%-.192s'"
- fre "La commande '%-.32s' est interdite à l'utilisateur: '%s'@'%s' sur la table '%-.192s'"
- ger "%-.32s Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle '%-.192s'"
- hun "%-.32s parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a '%-.192s' tablaban"
- ita "Comando %-.32s negato per l'utente: '%s'@'%s' sulla tabella '%-.192s'"
- jpn "コマンド %-.32s は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません"
- kor "'%-.32s' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 '%-.192s'"
- por "Comando '%-.32s' negado para o usuário '%s'@'%s' na tabela '%-.192s'"
- rum "Comanda %-.32s interzisa utilizatorului: '%s'@'%s' pentru tabela '%-.192s'"
- rus "Команда %-.32s запрещена пользователю '%s'@'%s' для таблицы '%-.192s'"
- serbian "%-.32s komanda zabranjena za korisnika '%s'@'%s' za tabelu '%-.192s'"
- spa "%-.32s comando negado para usuario: '%s'@'%s' para tabla '%-.192s'"
- swe "%-.32s ej tillåtet för '%s'@'%s' för tabell '%-.192s'"
- ukr "%-.32s команда заборонена користувачу: '%s'@'%s' у таблиці '%-.192s'"
+ cze "%-.100T příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku '%-.192s'"
+ dan "%-.100T-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen '%-.192s'"
+ nla "%-.100T commando geweigerd voor gebruiker: '%s'@'%s' voor tabel '%-.192s'"
+ eng "%-.100T command denied to user '%s'@'%s' for table '%-.192s'"
+ jps "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません",
+ est "%-.100T käsk ei ole lubatud kasutajale '%s'@'%s' tabelis '%-.192s'"
+ fre "La commande '%-.100T' est interdite à l'utilisateur: '%s'@'%s' sur la table '%-.192s'"
+ ger "%-.100T Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle '%-.192s'"
+ hun "%-.100T parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a '%-.192s' tablaban"
+ ita "Comando %-.100T negato per l'utente: '%s'@'%s' sulla tabella '%-.192s'"
+ jpn "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません"
+ kor "'%-.100T' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 '%-.192s'"
+ por "Comando '%-.100T' negado para o usuário '%s'@'%s' na tabela '%-.192s'"
+ rum "Comanda %-.100T interzisa utilizatorului: '%s'@'%s' pentru tabela '%-.192s'"
+ rus "Команда %-.100T запрещена пользователю '%s'@'%s' для таблицы '%-.192s'"
+ serbian "%-.100T komanda zabranjena za korisnika '%s'@'%s' za tabelu '%-.192s'"
+ spa "%-.100T comando negado para usuario: '%s'@'%s' para tabla '%-.192s'"
+ swe "%-.100T ej tillåtet för '%s'@'%s' för tabell '%-.192s'"
+ ukr "%-.100T команда заборонена користувачу: '%s'@'%s' у таблиці '%-.192s'"
ER_COLUMNACCESS_DENIED_ERROR 42000
cze "%-.32s příkaz nepřístupný pro uživatele: '%s'@'%s' pro sloupec '%-.192s' v tabulce '%-.192s'"
dan "%-.32s-kommandoen er ikke tilladt for brugeren '%s'@'%s' for kolonne '%-.192s' in tabellen '%-.192s'"
@@ -4314,6 +4317,7 @@ ER_MASTER_INFO
jpn "'master info '%.*s''構造体の初期化ができませんでした。MariaDBエラーログでエラーメッセージを確認してください。"
serbian "Nisam mogao da inicijalizujem informacionu strukturu glavnog servera, proverite da li imam privilegije potrebne za pristup file-u 'master.info' '%.*s'"
swe "Kunde inte initialisera replikationsstrukturerna för '%.*s'. See MariaDB fel fil för mera information"
+ ukr "Інформаційна структура з'єднання головного і підлеглого (master.info) для '%.*s' не може бути ініціалізована"
ER_SLAVE_THREAD
dan "Kunne ikke danne en slave-tråd; check systemressourcerne"
nla "Kon slave thread niet aanmaken, controleer systeem resources"
@@ -4478,6 +4482,7 @@ ER_UNION_TABLES_IN_DIFFERENT_DIR
serbian "Pogrešna definicija tabele; sve 'MERGE' tabele moraju biti u istoj bazi podataka"
spa "Incorrecta definición de la tabla; Todas las tablas MERGE deben estar en el mismo banco de datos"
swe "Felaktig tabelldefinition; alla tabeller i en MERGE-tabell måste vara i samma databas"
+ ukr "Хибне визначення таблиці; всі MERGE-таблиці повинні належити до однієї бази ланних."
ER_LOCK_DEADLOCK 40001
nla "Deadlock gevonden tijdens lock-aanvraag poging; Probeer herstart van de transactie"
eng "Deadlock found when trying to get lock; try restarting transaction"
@@ -4491,6 +4496,7 @@ ER_LOCK_DEADLOCK 40001
serbian "Unakrsno zaključavanje pronađeno kada sam pokušao da dobijem pravo na zaključavanje; Probajte da restartujete transakciju"
spa "Encontrado deadlock cuando tentando obtener el bloqueo; Tente recomenzar la transición"
swe "Fick 'DEADLOCK' vid låsförsök av block/rad. Försök att starta om transaktionen"
+ ukr "Взаємне блокування знайдено під час спроби отримати блокування; спробуйте перезапустити транзакцію."
ER_TABLE_CANT_HANDLE_FT
nla "Het gebruikte tabel type (%s) ondersteund geen FULLTEXT indexen"
eng "The storage engine %s doesn't support FULLTEXT indexes"
@@ -4517,6 +4523,7 @@ ER_CANNOT_ADD_FOREIGN
serbian "Ne mogu da dodam proveru spoljnog ključa"
spa "No puede adicionar clave extranjera constraint"
swe "Kan inte lägga till 'FOREIGN KEY constraint'"
+ ukr "Не можу додати обмеження зовнішнього ключа"
ER_NO_REFERENCED_ROW 23000
nla "Kan onderliggende rij niet toevoegen: foreign key beperking gefaald"
eng "Cannot add or update a child row: a foreign key constraint fails"
@@ -4531,6 +4538,7 @@ ER_NO_REFERENCED_ROW 23000
rus "Невозможно добавить или обновить дочернюю строку: проверка ограничений внешнего ключа не выполняется"
spa "No puede adicionar una línea hijo: falla de clave extranjera constraint"
swe "FOREIGN KEY-konflikt: Kan inte skriva barn"
+ ukr "Не вдається додати або оновити дочірній рядок: невдала перевірка обмеження зовнішнього ключа"
ER_ROW_IS_REFERENCED 23000
eng "Cannot delete or update a parent row: a foreign key constraint fails"
fre "Impossible de supprimer un enregistrement père : une constrainte externe l'empèche"
@@ -4688,15 +4696,15 @@ ER_NO_DEFAULT 42000
spa "Variable '%-.64s' no tiene un valor patrón"
swe "Variabel '%-.64s' har inte ett DEFAULT-värde"
ER_WRONG_VALUE_FOR_VAR 42000
- nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200s'"
- eng "Variable '%-.64s' can't be set to the value of '%-.200s'"
- ger "Variable '%-.64s' kann nicht auf '%-.200s' gesetzt werden"
- ita "Alla variabile '%-.64s' non puo' essere assegato il valore '%-.200s'"
- jpn "変数 '%-.64s' に値 '%-.200s' を設定できません。"
- por "Variável '%-.64s' não pode ser configurada para o valor de '%-.200s'"
- rus "Переменная '%-.64s' не может быть установлена в значение '%-.200s'"
- spa "Variable '%-.64s' no puede ser configurada para el valor de '%-.200s'"
- swe "Variabel '%-.64s' kan inte sättas till '%-.200s'"
+ nla "Variabele '%-.64s' kan niet worden gewijzigd naar de waarde '%-.200T'"
+ eng "Variable '%-.64s' can't be set to the value of '%-.200T'"
+ ger "Variable '%-.64s' kann nicht auf '%-.200T' gesetzt werden"
+ ita "Alla variabile '%-.64s' non puo' essere assegato il valore '%-.200T'"
+ jpn "変数 '%-.64s' に値 '%-.200T' を設定できません。"
+ por "Variável '%-.64s' não pode ser configurada para o valor de '%-.200T'"
+ rus "Переменная '%-.64s' не может быть установлена в значение '%-.200T'"
+ spa "Variable '%-.64s' no puede ser configurada para el valor de '%-.200T'"
+ swe "Variabel '%-.64s' kan inte sättas till '%-.200T'"
ER_WRONG_TYPE_FOR_VAR 42000
nla "Foutief argumenttype voor variabele '%-.64s'"
eng "Incorrect argument type to variable '%-.64s'"
@@ -5140,11 +5148,11 @@ ER_DUPLICATED_VALUE_IN_TYPE
por "Coluna '%-.100s' tem valor duplicado '%-.64s' em %s"
spa "Columna '%-.100s' tiene valor doblado '%-.64s' en %s"
ER_TRUNCATED_WRONG_VALUE 22007
- eng "Truncated incorrect %-.32s value: '%-.128s'"
- ger "Falscher %-.32s-Wert gekürzt: '%-.128s'"
- jpn "不正な %-.32s の値が切り捨てられました。: '%-.128s'"
- por "Truncado errado %-.32s valor: '%-.128s'"
- spa "Equivocado truncado %-.32s valor: '%-.128s'"
+ eng "Truncated incorrect %-.32T value: '%-.128T'"
+ ger "Falscher %-.32T-Wert gekürzt: '%-.128T'"
+ jpn "不正な %-.32T の値が切り捨てられました。: '%-.128T'"
+ por "Truncado errado %-.32T valor: '%-.128T'"
+ spa "Equivocado truncado %-.32T valor: '%-.128T'"
ER_TOO_MUCH_AUTO_TIMESTAMP_COLS
eng "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"
ger "Fehlerhafte Tabellendefinition. Es kann nur eine einzige TIMESTAMP-Spalte mit CURRENT_TIMESTAMP als DEFAULT oder in einer ON-UPDATE-Klausel geben"
@@ -5181,8 +5189,8 @@ ER_WARN_INVALID_TIMESTAMP
eng "Invalid TIMESTAMP value in column '%s' at row %lu"
ger "Ungültiger TIMESTAMP-Wert in Feld '%s', Zeile %lu"
ER_INVALID_CHARACTER_STRING
- eng "Invalid %s character string: '%.64s'"
- ger "Ungültiger %s-Zeichen-String: '%.64s'"
+ eng "Invalid %s character string: '%.64T'"
+ ger "Ungültiger %s-Zeichen-String: '%.64T'"
ER_WARN_ALLOWED_PACKET_OVERFLOWED
eng "Result of %s() was larger than max_allowed_packet (%ld) - truncated"
ger "Ergebnis von %s() war größer als max_allowed_packet (%ld) Bytes und wurde deshalb gekürzt"
@@ -5426,11 +5434,11 @@ 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`.`%.192s`.`%.192s` at row %lu"
- ger "Falscher %-.32s-Wert: '%-.128s' für Feld '`%.192s`.`%.192s`.`%.192s` in Zeile %lu"
+ eng "Incorrect %-.32s value: '%-.128T' for column `%.192s`.`%.192s`.`%.192s` at row %lu"
+ ger "Falscher %-.32s-Wert: '%-.128T' 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"
+ eng "Illegal %s '%-.192T' value found during parsing"
+ ger "Nicht zulässiger %s-Wert '%-.192T' beim Parsen gefunden"
ER_VIEW_NONUPD_CHECK
eng "CHECK OPTION on non-updatable view %`-.192s.%`-.192s"
ger "CHECK OPTION auf nicht-aktualisierbarem View %`-.192s.%`-.192s"
@@ -5576,8 +5584,8 @@ ER_CANT_CREATE_USER_WITH_GRANT 42000
eng "You are not allowed to create a user with GRANT"
ger "Sie dürfen keinen Benutzer mit GRANT anlegen"
ER_WRONG_VALUE_FOR_TYPE
- eng "Incorrect %-.32s value: '%-.128s' for function %-.32s"
- ger "Falscher %-.32s-Wert: '%-.128s' für Funktion %-.32s"
+ eng "Incorrect %-.32s value: '%-.128T' for function %-.32s"
+ ger "Falscher %-.32s-Wert: '%-.128T' für Funktion %-.32s"
ER_TABLE_DEF_CHANGED
eng "Table definition has changed, please retry transaction"
ger "Tabellendefinition wurde geändert, bitte starten Sie die Transaktion neu"
@@ -5756,8 +5764,8 @@ ER_HOSTNAME
ger "Hostname"
hindi "होस्ट का नाम"
ER_WRONG_STRING_LENGTH
- eng "String '%-.70s' is too long for %s (should be no longer than %d)"
- ger "String '%-.70s' ist zu lang für %s (sollte nicht länger sein als %d)"
+ eng "String '%-.70T' is too long for %s (should be no longer than %d)"
+ ger "String '%-.70T' ist zu lang für %s (sollte nicht länger sein als %d)"
ER_NON_INSERTABLE_TABLE
eng "The target table %-.100s of the %s is not insertable-into"
ger "Die Zieltabelle %-.100s von %s ist nicht einfügbar"
@@ -5964,8 +5972,8 @@ ER_PLUGIN_IS_NOT_LOADED
eng "Plugin '%-.192s' is not loaded"
ger "Plugin '%-.192s' ist nicht geladen"
ER_WRONG_VALUE
- eng "Incorrect %-.32s value: '%-.128s'"
- ger "Falscher %-.32s-Wert: '%-.128s'"
+ eng "Incorrect %-.32s value: '%-.128T'"
+ ger "Falscher %-.32s-Wert: '%-.128T'"
ER_NO_PARTITION_FOR_GIVEN_VALUE
eng "Table has no partition for value %-.64s"
ger "Tabelle hat für den Wert %-.64s keine Partition"
@@ -6108,8 +6116,8 @@ ER_WRONG_PARTITION_NAME
ER_CANT_CHANGE_TX_CHARACTERISTICS 25001
eng "Transaction characteristics can't be changed while a transaction is in progress"
ER_DUP_ENTRY_AUTOINCREMENT_CASE
- eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192s' for key '%-.192s'"
- ger "ALTER TABLE führt zur Neusequenzierung von auto_increment, wodurch der doppelte Eintrag '%-.192s' für Schlüssel '%-.192s' auftritt"
+ eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192T' for key '%-.192s'"
+ ger "ALTER TABLE führt zur Neusequenzierung von auto_increment, wodurch der doppelte Eintrag '%-.192T' für Schlüssel '%-.192s' auftritt"
ER_EVENT_MODIFY_QUEUE_ERROR
eng "Internal scheduler error %d"
ger "Interner Scheduler-Fehler %d"
@@ -6164,29 +6172,29 @@ ER_NATIVE_FCT_NAME_COLLISION
# When using this error message, use the ER_DUP_ENTRY error code. See, for
# example, code in handler.cc.
ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009
- cze "Zvojený klíč '%-.64s' (číslo klíče '%-.192s')"
- dan "Ens værdier '%-.64s' for indeks '%-.192s'"
- nla "Dubbele ingang '%-.64s' voor zoeksleutel '%-.192s'"
- eng "Duplicate entry '%-.64s' for key '%-.192s'"
- est "Kattuv väärtus '%-.64s' võtmele '%-.192s'"
- fre "Duplicata du champ '%-.64s' pour la clef '%-.192s'"
- ger "Doppelter Eintrag '%-.64s' für Schlüssel '%-.192s'"
- greek "Διπλή εγγραφή '%-.64s' για το κλειδί '%-.192s'"
- hun "Duplikalt bejegyzes '%-.64s' a '%-.192s' kulcs szerint"
- ita "Valore duplicato '%-.64s' per la chiave '%-.192s'"
- jpn "'%-.64s' は索引 '%-.192s' で重複しています。"
- kor "중복된 입력 값 '%-.64s': key '%-.192s'"
- nor "Like verdier '%-.64s' for nøkkel '%-.192s'"
- norwegian-ny "Like verdiar '%-.64s' for nykkel '%-.192s'"
- pol "Powtórzone wystąpienie '%-.64s' dla klucza '%-.192s'"
- por "Entrada '%-.64s' duplicada para a chave '%-.192s'"
- rum "Cimpul '%-.64s' e duplicat pentru cheia '%-.192s'"
- rus "Дублирующаяся запись '%-.64s' по ключу '%-.192s'"
- serbian "Dupliran unos '%-.64s' za ključ '%-.192s'"
- slo "Opakovaný kľúč '%-.64s' (číslo kľúča '%-.192s')"
- spa "Entrada duplicada '%-.64s' para la clave '%-.192s'"
- swe "Dublett '%-.64s' för nyckel '%-.192s'"
- ukr "Дублюючий запис '%-.64s' для ключа '%-.192s'"
+ cze "Zvojený klíč '%-.64T' (číslo klíče '%-.192s')"
+ dan "Ens værdier '%-.64T' for indeks '%-.192s'"
+ nla "Dubbele ingang '%-.64T' voor zoeksleutel '%-.192s'"
+ eng "Duplicate entry '%-.64T' for key '%-.192s'"
+ est "Kattuv väärtus '%-.64T' võtmele '%-.192s'"
+ fre "Duplicata du champ '%-.64T' pour la clef '%-.192s'"
+ ger "Doppelter Eintrag '%-.64T' für Schlüssel '%-.192s'"
+ greek "Διπλή εγγραφή '%-.64T' για το κλειδί '%-.192s'"
+ hun "Duplikalt bejegyzes '%-.64T' a '%-.192s' kulcs szerint"
+ ita "Valore duplicato '%-.64T' per la chiave '%-.192s'"
+ jpn "'%-.64T' は索引 '%-.192s' で重複しています。"
+ kor "중복된 입력 값 '%-.64T': key '%-.192s'"
+ nor "Like verdier '%-.64T' for nøkkel '%-.192s'"
+ norwegian-ny "Like verdiar '%-.64T' for nykkel '%-.192s'"
+ pol "Powtórzone wystąpienie '%-.64T' dla klucza '%-.192s'"
+ por "Entrada '%-.64T' duplicada para a chave '%-.192s'"
+ rum "Cimpul '%-.64T' e duplicat pentru cheia '%-.192s'"
+ rus "Дублирующаяся запись '%-.64T' по ключу '%-.192s'"
+ serbian "Dupliran unos '%-.64T' za ključ '%-.192s'"
+ slo "Opakovaný kľúč '%-.64T' (číslo kľúča '%-.192s')"
+ spa "Entrada duplicada '%-.64T' para la clave '%-.192s'"
+ swe "Dublett '%-.64T' för nyckel '%-.192s'"
+ ukr "Дублюючий запис '%-.64T' для ключа '%-.192s'"
ER_BINLOG_PURGE_EMFILE
eng "Too many files opened, please execute the command again"
ger "Zu viele offene Dateien, bitte führen Sie den Befehl noch einmal aus"
@@ -6467,8 +6475,8 @@ ER_SLAVE_CANT_CREATE_CONVERSION
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
eng "Cannot modify @@session.binlog_format inside a transaction"
ER_PATH_LENGTH
- eng "The path specified for %.64s is too long"
- hindi "%.64s के लिए निर्दिष्ट पथ बहुत लंबा है"
+ eng "The path specified for %.64T is too long"
+ hindi "%.64T के लिए निर्दिष्ट पथ बहुत लंबा है"
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT
eng "'%s' is deprecated and will be removed in a future release"
ger "'%s' ist veraltet und wird in einer zukünftigen Version entfernt werden"
@@ -6573,7 +6581,7 @@ ER_MULTI_UPDATE_KEY_CONFLICT
# When translating this error message make sure to include "ALTER TABLE" in the
# message as mysqlcheck parses the error message looking for ALTER TABLE.
ER_TABLE_NEEDS_REBUILD
- eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!"
+ eng "Table rebuild required. Please do \"ALTER TABLE `%-.32T` FORCE\" or dump/reload to fix it!"
WARN_OPTION_BELOW_LIMIT
eng "The value of '%s' should be no less than the value of '%s'"
@@ -7166,8 +7174,8 @@ ER_UNKNOWN_OPTION
eng "Unknown option '%-.64s'"
hindi "अज्ञात विकल्प '%-.64s'"
ER_BAD_OPTION_VALUE
- eng "Incorrect value '%-.64s' for option '%-.64s'"
- hindi "गलत मान '%-.64s' विकल्प '%-.64s' के लिए"
+ eng "Incorrect value '%-.64T' for option '%-.64s'"
+ hindi "गलत मान '%-.64T' विकल्प '%-.64s' के लिए"
ER_UNUSED_6
eng "You should never see it"
ER_UNUSED_7
@@ -7324,8 +7332,8 @@ ER_ROLE_DROP_EXISTS
ER_CANNOT_CONVERT_CHARACTER
eng "Cannot convert '%s' character 0x%-.64s to '%s'"
ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007
- eng "Incorrect default value '%-.128s' for column '%.192s'"
- hindi "गलत डिफ़ॉल्ट मान '%-.128s' कॉलम '%.192s' के लिए"
+ eng "Incorrect default value '%-.128T' for column '%.192s'"
+ hindi "गलत डिफ़ॉल्ट मान '%-.128T' कॉलम '%.192s' के लिए"
ER_KILL_QUERY_DENIED_ERROR
eng "You are not owner of query %lu"
ger "Sie sind nicht Eigentümer von Abfrage %lu"
@@ -7731,3 +7739,5 @@ ER_GEOJSON_EMPTY_COORDINATES
ER_MYROCKS_CANT_NOPAD_COLLATION
eng "MyRocks doesn't currently support collations with \"No pad\" attribute."
+ER_TRANSACTIONAL_ARIA_LOG_ENGINE
+ eng "Only non-transactional Aria table can be used for logging"
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index c20f9920b7e..c913a0477d7 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -277,7 +277,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
}
my_safe_printf_stderr("%s",
"The manual page at "
- "http://dev.mysql.com/doc/mysql/en/crashing.html contains\n"
+ "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains\n"
"information that should help you find out what is causing the crash.\n");
#endif /* HAVE_STACKTRACE */
diff --git a/sql/slave.cc b/sql/slave.cc
index 1bc21f8895b..87eacfcfd0a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB Corporation
+ Copyright (c) 2009, 2020, 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
@@ -304,6 +304,9 @@ handle_slave_background(void *arg __attribute__((unused)))
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
thd_proc_info(thd, "Loading slave GTID position from table");
if (rpl_load_gtid_slave_state(thd))
@@ -3294,7 +3297,8 @@ static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi,
in the future, we should do a better error analysis, but for
now we just fill up the error log :-)
*/
- if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
+ if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED ||
+ mysql_errno(mysql) == ER_NET_ERROR_ON_WRITE)
*suppress_warnings= TRUE; // Suppress reconnect warning
else
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs",
@@ -3564,14 +3568,34 @@ 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 (exec_res)
+ {
+ switch (thd->wsrep_conflict_state) {
+ case NO_CONFLICT: break;
+ case MUST_REPLAY:
+ WSREP_DEBUG("SQL apply failed for MUST_REPLAY, res %d", exec_res);
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ wsrep_replay_transaction(thd);
+ switch (thd->wsrep_conflict_state) {
+ case NO_CONFLICT:
+ exec_res = 0; /* replaying succeeded, and slave may continue */
+ break;
+ case ABORTED: break; /* replaying has failed, trx is rolled back */
+ default:
+ WSREP_WARN("unexpected result of slave transaction replaying: %lld, %d",
+ thd->thread_id, thd->wsrep_conflict_state);
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ break;
+ default:
WSREP_DEBUG("SQL apply failed, res %d conflict state: %d",
exec_res, thd->wsrep_conflict_state);
rli->abort_slave= 1;
rli->report(ERROR_LEVEL, ER_UNKNOWN_COM_ERROR, rgi->gtid_info(),
"Node has dropped from cluster");
+ break;
}
+ }
#endif
#ifndef DBUG_OFF
@@ -3898,12 +3922,8 @@ 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(ev))
{
- sql_print_information("Slave SQL thread stopped because it reached its"
- " UNTIL position %llu", rli->until_pos());
/*
Setting abort_slave flag because we do not want additional
message about error in query execution to be printed.
@@ -4309,7 +4329,9 @@ pthread_handler_t handle_slave_io(void *arg)
goto err;
}
-
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
@@ -4429,6 +4451,7 @@ connected:
goto err;
goto connected;
}
+ DBUG_EXECUTE_IF("fail_com_register_slave", goto err;);
}
DBUG_PRINT("info",("Starting reading binary log from master"));
@@ -5025,6 +5048,7 @@ pthread_handler_t handle_slave_sql(void *arg)
#ifdef WITH_WSREP
thd->wsrep_exec_mode= LOCAL_STATE;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
/* synchronize with wsrep replication */
if (WSREP_ON)
wsrep_ready_wait();
@@ -5109,10 +5133,14 @@ pthread_handler_t handle_slave_sql(void *arg)
}
if ((rli->until_condition == Relay_log_info::UNTIL_MASTER_POS ||
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
- rli->is_until_satisfied(rli->group_master_log_pos))
+ rli->is_until_satisfied(NULL))
{
sql_print_information("Slave SQL thread stopped because it reached its"
- " UNTIL position %llu", rli->until_pos());
+ " UNTIL position %llu in %s %s file",
+ rli->until_pos(), rli->until_name(),
+ rli->until_condition ==
+ Relay_log_info::UNTIL_MASTER_POS ?
+ "binlog" : "relaylog");
mysql_mutex_unlock(&rli->data_lock);
goto err;
}
@@ -5166,8 +5194,10 @@ pthread_handler_t handle_slave_sql(void *arg)
if (!sql_slave_killed(serial_rgi))
{
slave_output_error_info(serial_rgi, thd);
- if (WSREP_ON && rli->last_error().number == ER_UNKNOWN_COM_ERROR)
+ if (WSREP(thd) && rli->last_error().number == ER_UNKNOWN_COM_ERROR)
+ {
wsrep_node_dropped= TRUE;
+ }
}
goto err;
}
@@ -5176,7 +5206,24 @@ pthread_handler_t handle_slave_sql(void *arg)
err:
if (mi->using_parallel())
rli->parallel.wait_for_done(thd, rli);
+ /* Gtid_list_log_event::do_apply_event has already reported the GTID until */
+ if (rli->stop_for_until && rli->until_condition != Relay_log_info::UNTIL_GTID)
+ {
+ if (global_system_variables.log_warnings > 2)
+ sql_print_information("Slave SQL thread UNTIL stop was requested at position "
+ "%llu in %s %s file",
+ rli->until_log_pos, rli->until_log_name,
+ rli->until_condition ==
+ Relay_log_info::UNTIL_MASTER_POS ?
+ "binlog" : "relaylog");
+ sql_print_information("Slave SQL thread stopped because it reached its"
+ " UNTIL position %llu in %s %s file",
+ rli->until_pos(), rli->until_name(),
+ rli->until_condition ==
+ Relay_log_info::UNTIL_MASTER_POS ?
+ "binlog" : "relaylog");
+ };
/* Thread stopped. Print the current replication position to the log */
{
StringBuffer<100> tmp;
@@ -5300,7 +5347,7 @@ err_during_init:
If slave stopped due to node going non primary, we set global flag to
trigger automatic restart of slave when node joins back to cluster.
*/
- if (WSREP_ON && wsrep_node_dropped && wsrep_restart_slave)
+ if (WSREP(thd) && wsrep_node_dropped && wsrep_restart_slave)
{
if (wsrep_ready_get())
{
@@ -6093,7 +6140,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error= ER_SLAVE_HEARTBEAT_FAILURE;
error_msg.append(STRING_WITH_LEN("inconsistent heartbeat event content;"));
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
- error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
+ error_msg.append(hb.get_log_ident(), (uint) hb.get_ident_len());
error_msg.append(STRING_WITH_LEN(" log_pos "));
error_msg.append_ulonglong(hb.log_pos);
goto err;
@@ -6119,7 +6166,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
error= ER_SLAVE_HEARTBEAT_FAILURE;
error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local info;"));
error_msg.append(STRING_WITH_LEN("the event's data: log_file_name "));
- error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident()));
+ error_msg.append(hb.get_log_ident(), (uint) hb.get_ident_len());
error_msg.append(STRING_WITH_LEN(" log_pos "));
error_msg.append_ulonglong(hb.log_pos);
goto err;
@@ -7389,7 +7436,39 @@ err:
sql_print_error("Error reading relay log event: %s", errmsg);
DBUG_RETURN(0);
}
+#ifdef WITH_WSREP
+enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size)
+{
+ enum Log_event_type ev_type;
+
+ mysql_mutex_lock(&rgi->rli->data_lock);
+
+ unsigned long long event_pos= rgi->event_relay_log_pos;
+ unsigned long long orig_future_pos= rgi->future_event_relay_log_pos;
+ unsigned long long future_pos= rgi->future_event_relay_log_pos;
+
+ /* scan the log to read next event and we skip
+ annotate events. */
+ do {
+ my_b_seek(rgi->rli->cur_log, future_pos);
+ rgi->rli->event_relay_log_pos= future_pos;
+ rgi->event_relay_log_pos= future_pos;
+ Log_event* ev= next_event(rgi, event_size);
+ ev_type= (ev) ? ev->get_type_code() : UNKNOWN_EVENT;
+ delete ev;
+ future_pos+= *event_size;
+ } while (ev_type == ANNOTATE_ROWS_EVENT);
+
+ /* scan the log back and re-set the positions to original values */
+ rgi->rli->event_relay_log_pos= event_pos;
+ rgi->event_relay_log_pos= event_pos;
+ my_b_seek(rgi->rli->cur_log, orig_future_pos);
+ mysql_mutex_unlock(&rgi->rli->data_lock);
+
+ return ev_type;
+}
+#endif /* WITH_WSREP */
/*
Rotate a relay log (this is used only by FLUSH LOGS; the automatic rotation
because of size is simpler because when we do it we already have all relevant
diff --git a/sql/sp.cc b/sql/sp.cc
index 9ffc33486b5..b9757887e7a 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -754,7 +754,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
if (parse_sql(thd, & parser_state, creation_ctx) || thd->lex == NULL)
{
sp= thd->lex->sphead;
- delete sp;
+ sp_head::destroy(sp);
sp= 0;
}
else
@@ -1081,7 +1081,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
{
if (lex->create_info.or_replace())
{
- if ((ret= sp_drop_routine_internal(thd, type, lex->spname, table)))
+ if (sp_drop_routine_internal(thd, type, lex->spname, table))
goto done;
}
else if (lex->create_info.if_not_exists())
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index f99c0bd0b6e..bc91634eb32 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -284,7 +284,7 @@ uchar *hash_get_key_for_sp_head(const uchar *ptr, size_t *plen,
void hash_free_sp_head(void *p)
{
sp_head *sp= (sp_head *)p;
- delete sp;
+ sp_head::destroy(sp);
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0179214e508..6a650183fb8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -45,6 +45,9 @@
#include "transaction.h" // trans_commit_stmt
#include "sql_audit.h"
#include "debug_sync.h"
+#ifdef WITH_WSREP
+#include "wsrep_thd.h"
+#endif /* WITH_WSREP */
/*
Sufficient max length of printed destinations and frame offsets (all uints).
@@ -532,51 +535,40 @@ check_routine_name(LEX_STRING *ident)
}
-/*
- *
- * sp_head
- *
- */
-
-void *
-sp_head::operator new(size_t size) throw()
+sp_head* sp_head::create()
{
- DBUG_ENTER("sp_head::operator new");
MEM_ROOT own_root;
+ init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0));
sp_head *sp;
+ if (!(sp= new (&own_root) sp_head(&own_root)))
+ free_root(&own_root, MYF(0));
- init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC, MYF(0));
- sp= (sp_head *) alloc_root(&own_root, size);
- if (sp == NULL)
- DBUG_RETURN(NULL);
- sp->main_mem_root= own_root;
- DBUG_PRINT("info", ("mem_root %p", &sp->mem_root));
- DBUG_RETURN(sp);
+ return sp;
}
-void
-sp_head::operator delete(void *ptr, size_t size) throw()
-{
- DBUG_ENTER("sp_head::operator delete");
- MEM_ROOT own_root;
- if (ptr == NULL)
- DBUG_VOID_RETURN;
-
- sp_head *sp= (sp_head *) ptr;
-
- /* Make a copy of main_mem_root as free_root will free the sp */
- own_root= sp->main_mem_root;
- DBUG_PRINT("info", ("mem_root %p moved to %p",
- &sp->mem_root, &own_root));
- free_root(&own_root, MYF(0));
-
- DBUG_VOID_RETURN;
+void sp_head::destroy(sp_head *sp)
+{
+ if (sp)
+ {
+ /* Make a copy of main_mem_root as free_root will free the sp */
+ MEM_ROOT own_root= sp->main_mem_root;
+ DBUG_PRINT("info", ("mem_root %p moved to %p",
+ &sp->main_mem_root, &own_root));
+ delete sp;
+ free_root(&own_root, MYF(0));
+ }
}
+/*
+ *
+ * sp_head
+ *
+ */
-sp_head::sp_head()
- :Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP),
+sp_head::sp_head(MEM_ROOT *mem_root_arg)
+ :Query_arena(NULL, STMT_INITIALIZED_FOR_SP),
+ main_mem_root(*mem_root_arg), // todo: std::move operator.
m_flags(0),
m_sp_cache_version(0),
m_creation_ctx(0),
@@ -585,6 +577,8 @@ sp_head::sp_head()
m_next_cached_sp(0),
m_cont_level(0)
{
+ mem_root= &main_mem_root;
+
m_first_instance= this;
m_first_free_instance= this;
m_last_cached_sp= this;
@@ -831,7 +825,7 @@ sp_head::~sp_head()
my_hash_free(&m_sptabs);
my_hash_free(&m_sroutines);
- delete m_next_cached_sp;
+ sp_head::destroy(m_next_cached_sp);
DBUG_VOID_RETURN;
}
@@ -1132,6 +1126,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
backup_arena;
query_id_t old_query_id;
TABLE *old_derived_tables;
+ TABLE *old_rec_tables;
LEX *old_lex;
Item_change_list old_change_list;
String old_packet;
@@ -1207,6 +1202,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
old_query_id= thd->query_id;
old_derived_tables= thd->derived_tables;
thd->derived_tables= 0;
+ old_rec_tables= thd->rec_tables;
+ thd->rec_tables= 0;
save_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode= m_sql_mode;
save_abort_on_warning= thd->abort_on_warning;
@@ -1327,7 +1324,93 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->m_digest= NULL;
err_status= i->execute(thd, &ip);
+#ifdef WITH_WSREP
+ if (m_type == TYPE_ENUM_PROCEDURE)
+ {
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (thd->wsrep_conflict_state == MUST_REPLAY)
+ {
+ wsrep_replay_sp_transaction(thd);
+ err_status= thd->get_stmt_da()->is_set();
+ thd->wsrep_conflict_state= NO_CONFLICT;
+ }
+ else if (thd->wsrep_conflict_state == ABORTED ||
+ thd->wsrep_conflict_state == CERT_FAILURE)
+ {
+ /*
+ If the statement execution was BF aborted or was aborted
+ due to certification failure, clean up transaction here
+ and reset conflict state to NO_CONFLICT and thd->killed
+ to THD::NOT_KILLED. Error handling is done based on err_status
+ below. Error must have been raised by wsrep hton code before
+ entering here.
+ */
+ DBUG_ASSERT(err_status);
+ DBUG_ASSERT(thd->get_stmt_da()->is_error());
+ thd->wsrep_conflict_state= NO_CONFLICT;
+ thd->killed= NOT_KILLED;
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ }
+#endif /* WITH_WSREP */
+#ifdef WITH_WSREP_NO
+ if (WSREP(thd))
+ {
+ if (((thd->wsrep_trx().state() == wsrep::transaction::s_executing) &&
+ (thd->is_fatal_error || thd->killed)))
+ {
+ WSREP_DEBUG("SP abort err status %d in sub %d trx state %d",
+ err_status, thd->in_sub_stmt, thd->wsrep_trx().state());
+ err_status= 1;
+ thd->is_fatal_error= 1;
+ /*
+ 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
+ {
+ const bool must_replay= wsrep_must_replay(thd);
+ if (must_replay)
+ {
+ WSREP_DEBUG("MUST_REPLAY set after SP, err_status %d trx state: %d",
+ err_status, thd->wsrep_trx().state());
+ }
+ (void) wsrep_after_statement(thd);
+ /*
+ Reset the return code to zero if the transaction was
+ replayed succesfully.
+ */
+ if (must_replay && !wsrep_current_error(thd))
+ {
+ err_status= 0;
+ thd->get_stmt_da()->reset_diagnostics_area();
+ }
+ /*
+ Final wsrep error status for statement is known only after
+ wsrep_after_statement() call. If the error is set, override
+ error in thd diagnostics area and reset wsrep client_state error
+ so that the error does not get propagated via client-server protocol.
+ */
+ if (wsrep_current_error(thd))
+ {
+ wsrep_override_error(thd, wsrep_current_error(thd),
+ wsrep_current_error_status(thd));
+ thd->wsrep_cs().reset_error();
+ /* Reset also thd->killed if it has been set during BF abort. */
+ if (thd->killed == KILL_QUERY)
+ thd->killed= NOT_KILLED;
+ /* if failed transaction was not replayed, must return with error from here */
+ if (!must_replay) err_status = 1;
+ }
+ }
+ }
+#endif /* WITH_WSREP */
thd->m_digest= parent_digest;
if (i->free_list)
@@ -1388,6 +1471,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->set_query_id(old_query_id);
DBUG_ASSERT(!thd->derived_tables);
thd->derived_tables= old_derived_tables;
+ thd->rec_tables= old_rec_tables;
thd->variables.sql_mode= save_sql_mode;
thd->abort_on_warning= save_abort_on_warning;
thd->m_reprepare_observer= save_reprepare_observer;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index e4665360288..882ff32f5e6 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -139,7 +139,7 @@ public:
bool
check_routine_name(LEX_STRING *ident);
-class sp_head :private Query_arena
+class sp_head :private Query_arena, public Sql_alloc
{
sp_head(const sp_head &); /**< Prevent use of these */
void operator=(sp_head &);
@@ -298,14 +298,16 @@ public:
being opened is probably enough).
*/
SQL_I_List<Item_trigger_field> m_trg_table_fields;
+private:
+ // users must use sp= sp_head::create()
+ sp_head(MEM_ROOT *mem_root_arg);
- static void *
- operator new(size_t size) throw ();
-
- static void
- operator delete(void *ptr, size_t size) throw ();
+ // users must use sp_head::destroy(sp)
+ virtual ~sp_head();
- sp_head();
+public:
+ static sp_head* create();
+ static void destroy(sp_head *sp);
/// Initialize after we have reset mem_root
void
@@ -323,7 +325,6 @@ public:
void
set_stmt_end(THD *thd);
- virtual ~sp_head();
bool
execute_trigger(THD *thd,
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 7c78b0dcb71..83905fc9f3d 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -50,6 +50,98 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
#define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH
+int MBR::within(const MBR *mbr)
+{
+ /*
+ We have to take into account the 'dimension' of
+ the MBR, where the dimension of a single point is 0,
+ the dimesion of an vertical or horizontal line is 1,
+ and finally the dimension of the solid rectangle is 2.
+ */
+
+ int dim1= dimension();
+ int dim2= mbr->dimension();
+
+ DBUG_ASSERT(dim1 >= 0 && dim1 <= 2 && dim2 >= 0 && dim2 <= 2);
+
+ /*
+ Either/both of the two operands can degrade to a point or a
+ horizontal/vertical line segment, and we have to treat such cases
+ separately.
+ */
+ switch (dim1)
+ {
+ case 0:
+ DBUG_ASSERT(xmin == xmax && ymin == ymax);
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return equals(mbr);
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin > mbr->xmin && xmin < mbr->xmax && ymin == mbr->ymin) ||
+ (ymin > mbr->ymin && ymin < mbr->ymax && xmin == mbr->xmin));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return (xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin > mbr->ymin && ymax < mbr->ymax);
+ break;
+ }
+ break;
+ case 1:
+ DBUG_ASSERT((xmin == xmax && ymin != ymax) ||
+ (ymin == ymax && xmin != xmax));
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return 0;
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin == xmax && mbr->xmin == mbr->xmax && mbr->xmin == xmin &&
+ mbr->ymin <= ymin && mbr->ymax >= ymax) ||
+ (ymin == ymax && mbr->ymin == mbr->ymax && mbr->ymin == ymin &&
+ mbr->xmin <= xmin && mbr->xmax >= xmax));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((xmin == xmax && xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin >= mbr->ymin && ymax <= mbr->ymax) ||
+ (ymin == ymax && ymin > mbr->ymin && ymax < mbr->ymax &&
+ xmin >= mbr->xmin && xmax <= mbr->xmax));
+ break;
+ }
+ break;
+ case 2:
+ DBUG_ASSERT(xmin != xmax && ymin != ymax);
+ switch (dim2)
+ {
+ case 0:
+ case 1:
+ return 0;
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
+ (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
+ break;
+
+ }
+ break;
+ }
+
+ // Never reached.
+ DBUG_ASSERT(false);
+ return 0;
+}
+
+
/***************************** Gis_class_info *******************************/
String Geometry::bad_geometry_data("Bad object", &my_charset_bin);
diff --git a/sql/spatial.h b/sql/spatial.h
index 76dbd06fdf4..e78da6e615d 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -145,12 +145,7 @@ struct MBR
(mbr->xmax >= xmin && mbr->xmax <= xmax)));
}
- int within(const MBR *mbr)
- {
- /* The following should be safe, even if we compare doubles */
- return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
- (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
- }
+ int within(const MBR *mbr);
int contains(const MBR *mbr)
{
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index eb84368bf9f..641ab69c2a7 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2018, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -201,7 +201,6 @@ LEX_STRING current_user= { C_STRING_WITH_LEN("*current_user") };
LEX_STRING current_role= { C_STRING_WITH_LEN("*current_role") };
LEX_STRING current_user_and_current_role= { C_STRING_WITH_LEN("*current_user_and_current_role") };
-
#ifndef NO_EMBEDDED_ACCESS_CHECKS
static plugin_ref old_password_plugin;
#endif
@@ -354,8 +353,9 @@ static void update_hostname(acl_host_and_ip *host, const char *hostname);
static ulong get_sort(uint count,...);
static bool show_proxy_grants (THD *, const char *, const char *,
char *, size_t);
-static bool show_role_grants(THD *, const char *, const char *,
+static bool show_role_grants(THD *, const char *,
ACL_USER_BASE *, char *, size_t);
+static bool show_default_role(THD *, ACL_USER *, char *, size_t);
static bool show_global_privileges(THD *, ACL_USER_BASE *,
bool, char *, size_t);
static bool show_database_privileges(THD *, const char *, const char *,
@@ -2618,8 +2618,43 @@ bool acl_getroot(Security_context *sctx, char *user, char *host,
DBUG_RETURN(res);
}
-static int check_user_can_set_role(const char *user, const char *host,
- const char *ip, const char *rolename, ulonglong *access)
+static int check_role_is_granted_callback(ACL_USER_BASE *grantee, void *data)
+{
+ LEX_CSTRING *rolename= static_cast<LEX_CSTRING *>(data);
+ if (rolename->length == grantee->user.length &&
+ !strcmp(rolename->str, grantee->user.str))
+ return -1; // End search, we've found our role.
+
+ /* Keep looking, we haven't found our role yet. */
+ return 0;
+}
+
+/*
+ unlike find_user_exact and find_user_wild,
+ this function finds anonymous users too, it's when a
+ user is not empty, but priv_user (acl_user->user) is empty.
+*/
+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.str ||
+ !strcmp(user, acl_user_tmp->user.str)) &&
+ compare_hostname(&acl_user_tmp->host, host, ip))
+ {
+ result= acl_user_tmp;
+ break;
+ }
+ }
+ return result;
+}
+
+static int check_user_can_set_role(THD *thd, const char *user, const char *host,
+ const char *ip, const char *rolename,
+ ulonglong *access)
{
ACL_ROLE *role;
ACL_USER_BASE *acl_user_base;
@@ -2636,10 +2671,7 @@ static int check_user_can_set_role(const char *user, const char *host,
/* get the current user */
acl_user= find_user_wild(host, user, ip);
if (acl_user == NULL)
- {
- my_error(ER_INVALID_CURRENT_USER, MYF(0));
- result= -1;
- }
+ result= ER_INVALID_CURRENT_USER;
else if (access)
*access= acl_user->access;
@@ -2649,9 +2681,9 @@ static int check_user_can_set_role(const char *user, const char *host,
role= find_acl_role(rolename);
/* According to SQL standard, the same error message must be presented */
- if (role == NULL) {
- my_error(ER_INVALID_ROLE, MYF(0), rolename);
- result= -1;
+ if (role == NULL)
+ {
+ result= ER_INVALID_ROLE;
goto end;
}
@@ -2672,7 +2704,6 @@ static int check_user_can_set_role(const char *user, const char *host,
/* According to SQL standard, the same error message must be presented */
if (!is_granted)
{
- my_error(ER_INVALID_ROLE, MYF(0), rolename);
result= 1;
goto end;
}
@@ -2681,17 +2712,66 @@ static int check_user_can_set_role(const char *user, const char *host,
{
*access = acl_user->access | role->access;
}
+
end:
mysql_mutex_unlock(&acl_cache->lock);
- return result;
+ /* We present different error messages depending if the user has sufficient
+ privileges to know if the INVALID_ROLE exists. */
+ switch (result)
+ {
+ case ER_INVALID_CURRENT_USER:
+ my_error(ER_INVALID_CURRENT_USER, MYF(0), rolename);
+ break;
+ case ER_INVALID_ROLE:
+ /* Role doesn't exist at all */
+ my_error(ER_INVALID_ROLE, MYF(0), rolename);
+ break;
+ case 1:
+ StringBuffer<1024> c_usr;
+ LEX_CSTRING role_lex;
+ /* First, check if current user can see mysql database. */
+ bool read_access= !check_access(thd, SELECT_ACL, "mysql", NULL, NULL, 1, 1);
+
+ role_lex.str= rolename;
+ role_lex.length= strlen(rolename);
+ mysql_mutex_lock(&acl_cache->lock);
+ ACL_USER *cur_user= find_user_or_anon(thd->security_ctx->priv_host,
+ thd->security_ctx->priv_user,
+ thd->security_ctx->ip);
+
+ /* If the current user does not have select priv to mysql database,
+ see if the current user can discover the role if it was granted to him.
+ */
+ if (cur_user && (read_access ||
+ traverse_role_graph_down(cur_user, &role_lex,
+ check_role_is_granted_callback,
+ NULL) == -1))
+ {
+ /* Role is not granted but current user can see the role */
+ c_usr.append(user, strlen(user));
+ c_usr.append('@');
+ c_usr.append(host, strlen(host));
+ my_printf_error(ER_INVALID_ROLE, "User %`s has not been granted role %`s",
+ MYF(0), c_usr.c_ptr(), rolename);
+ }
+ else
+ {
+ /* Role is not granted and current user cannot see the role */
+ my_error(ER_INVALID_ROLE, MYF(0), rolename);
+ }
+ mysql_mutex_unlock(&acl_cache->lock);
+ break;
+ }
+
+ return result;
}
+
int acl_check_setrole(THD *thd, char *rolename, ulonglong *access)
{
- /* Yes! priv_user@host. Don't ask why - that's what check_access() does. */
- return check_user_can_set_role(thd->security_ctx->priv_user,
- thd->security_ctx->host, thd->security_ctx->ip, rolename, access);
+ return check_user_can_set_role(thd, thd->security_ctx->priv_user,
+ thd->security_ctx->host, thd->security_ctx->ip, rolename, access);
}
@@ -3471,9 +3551,12 @@ WSREP_ERROR_LABEL:
DBUG_RETURN(result);
}
-int acl_check_set_default_role(THD *thd, const char *host, const char *user)
+int acl_check_set_default_role(THD *thd, const char *host, const char *user,
+ const char *role)
{
- return check_alter_user(thd, host, user);
+ DBUG_ENTER("acl_check_set_default_role");
+ DBUG_RETURN(check_alter_user(thd, host, user) ||
+ check_user_can_set_role(thd, user, host, NULL, role, NULL));
}
int acl_set_default_role(THD *thd, const char *host, const char *user,
@@ -3494,16 +3577,6 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
DBUG_PRINT("enter",("host: '%s' user: '%s' rolename: '%s'",
safe_str(user), safe_str(host), safe_str(rolename)));
- if (rolename == current_role.str) {
- if (!thd->security_ctx->priv_role[0])
- rolename= "NONE";
- else
- rolename= thd->security_ctx->priv_role;
- }
-
- if (check_user_can_set_role(user, host, host, rolename, NULL))
- DBUG_RETURN(result);
-
if (!strcasecmp(rolename, "NONE"))
clear_role= TRUE;
@@ -3667,31 +3740,6 @@ bool is_acl_user(const char *host, const char *user)
return res;
}
-
-/*
- unlike find_user_exact and find_user_wild,
- this function finds anonymous users too, it's when a
- user is not empty, but priv_user (acl_user->user) is empty.
-*/
-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.str ||
- !strcmp(user, acl_user_tmp->user.str)) &&
- compare_hostname(&acl_user_tmp->host, host, ip))
- {
- result= acl_user_tmp;
- break;
- }
- }
- return result;
-}
-
-
/*
Find first entry that matches the specified user@host pair
*/
@@ -3997,7 +4045,7 @@ static bool test_if_create_new_users(THD *thd)
if (!(db_access & INSERT_ACL))
{
if (check_grant(thd, INSERT_ACL, &tl, FALSE, UINT_MAX, TRUE))
- create_new_users=0;
+ create_new_users=0;
}
}
return create_new_users;
@@ -4055,13 +4103,15 @@ static int replace_user_table(THD *thd, const User_table &user_table,
table->key_info->key_length);
if (table->file->ha_index_read_idx_map(table->record[0], 0, user_key,
- HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
+ HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
/* what == 'N' means revoke */
if (what == 'N')
{
- my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
+ if (combo.host.length)
+ my_error(ER_NONEXISTING_GRANT, MYF(0), combo.user.str, combo.host.str);
+ else
+ my_error(ER_INVALID_ROLE, MYF(0), combo.user.str);
goto end;
}
/*
@@ -5576,6 +5626,8 @@ static void propagate_role_grants(ACL_ROLE *role,
enum PRIVS_TO_MERGE::what what,
const char *db= 0, const char *name= 0)
{
+ if (!role)
+ return;
mysql_mutex_assert_owner(&acl_cache->lock);
PRIVS_TO_MERGE data= { what, db, name };
@@ -7749,6 +7801,21 @@ err:
}
+static void check_grant_column_int(GRANT_TABLE *grant_table, const char *name,
+ uint length, ulong *want_access)
+{
+ if (grant_table)
+ {
+ *want_access&= ~grant_table->privs;
+ if (*want_access & grant_table->cols)
+ {
+ GRANT_COLUMN *grant_column= column_hash_search(grant_table, name, length);
+ if (grant_column)
+ *want_access&= ~grant_column->rights;
+ }
+ }
+}
+
/*
Check column rights in given security context
@@ -7771,9 +7838,6 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant,
const char *db_name, const char *table_name,
const char *name, uint length, Security_context *sctx)
{
- GRANT_TABLE *grant_table;
- GRANT_TABLE *grant_table_role;
- GRANT_COLUMN *grant_column;
ulong want_access= grant->want_privilege & ~grant->privilege;
DBUG_ENTER("check_grant_column");
DBUG_PRINT("enter", ("table: %s want_access: %lu", table_name, want_access));
@@ -7798,45 +7862,18 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant,
grant->version= grant_version; /* purecov: inspected */
}
- grant_table= grant->grant_table_user;
- grant_table_role= grant->grant_table_role;
-
- if (!grant_table && !grant_table_role)
- goto err;
+ check_grant_column_int(grant->grant_table_user, name, length, &want_access);
+ check_grant_column_int(grant->grant_table_role, name, length, &want_access);
- if (grant_table)
- {
- grant_column= column_hash_search(grant_table, name, length);
- if (grant_column)
- {
- want_access&= ~grant_column->rights;
- }
- }
- if (grant_table_role)
- {
- grant_column= column_hash_search(grant_table_role, name, length);
- if (grant_column)
- {
- want_access&= ~grant_column->rights;
- }
- }
+ mysql_rwlock_unlock(&LOCK_grant);
if (!want_access)
- {
- mysql_rwlock_unlock(&LOCK_grant);
DBUG_RETURN(0);
- }
-err:
- mysql_rwlock_unlock(&LOCK_grant);
char command[128];
get_privilege_desc(command, sizeof(command), want_access);
/* TODO perhaps error should print current rolename aswell */
- my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
- command,
- sctx->priv_user,
- sctx->host_or_ip,
- name,
- table_name);
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), command, sctx->priv_user,
+ sctx->host_or_ip, name, table_name);
DBUG_RETURN(1);
}
@@ -8495,7 +8532,7 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
{
char buff[1024];
- if (show_role_grants(thd, role->user.str, "", role, buff, sizeof(buff)))
+ if (show_role_grants(thd, "", role, buff, sizeof(buff)))
return TRUE;
if (show_global_privileges(thd, role, TRUE, buff, sizeof(buff)))
@@ -8710,7 +8747,7 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
/* Show granted roles to acl_user */
- if (show_role_grants(thd, username, hostname, acl_user, buff, sizeof(buff)))
+ if (show_role_grants(thd, hostname, acl_user, buff, sizeof(buff)))
goto end;
/* Add first global access grants */
@@ -8759,6 +8796,14 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
}
+ if (username)
+ {
+ /* Show default role to acl_user */
+ if (show_default_role(thd, acl_user, buff, sizeof(buff)))
+ goto end;
+ }
+
+
error= 0;
end:
mysql_mutex_unlock(&acl_cache->lock);
@@ -8785,15 +8830,44 @@ static ROLE_GRANT_PAIR *find_role_grant_pair(const LEX_STRING *u,
my_hash_search(&acl_roles_mappings, (uchar*)pair_key.ptr(), key_length);
}
-static bool show_role_grants(THD *thd, const char *username,
- const char *hostname, ACL_USER_BASE *acl_entry,
+static bool show_default_role(THD *thd, ACL_USER *acl_entry,
+ char *buff, size_t buffsize)
+{
+ Protocol *protocol= thd->protocol;
+ LEX_STRING def_rolename= acl_entry->default_rolename;
+
+ if (def_rolename.length)
+ {
+ String def_str(buff, buffsize, system_charset_info);
+ def_str.length(0);
+ def_str.append(STRING_WITH_LEN("SET DEFAULT ROLE "));
+ def_str.append(&def_rolename);
+ def_str.append(" FOR '");
+ def_str.append(&acl_entry->user);
+ DBUG_ASSERT(!(acl_entry->flags & IS_ROLE));
+ def_str.append(STRING_WITH_LEN("'@'"));
+ def_str.append(acl_entry->host.hostname, acl_entry->hostname_length,
+ system_charset_info);
+ def_str.append('\'');
+ protocol->prepare_for_resend();
+ protocol->store(def_str.ptr(),def_str.length(),def_str.charset());
+ if (protocol->write())
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static bool show_role_grants(THD *thd, const char *hostname,
+ ACL_USER_BASE *acl_entry,
char *buff, size_t buffsize)
{
uint counter;
Protocol *protocol= thd->protocol;
LEX_STRING host= {const_cast<char*>(hostname), strlen(hostname)};
- String grant(buff,sizeof(buff),system_charset_info);
+ String grant(buff, buffsize, system_charset_info);
for (counter= 0; counter < acl_entry->role_grants.elements; counter++)
{
grant.length(0);
@@ -8837,7 +8911,7 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry,
ulong want_access;
Protocol *protocol= thd->protocol;
- String global(buff,sizeof(buff),system_charset_info);
+ String global(buff, buffsize, system_charset_info);
global.length(0);
global.append(STRING_WITH_LEN("GRANT "));
@@ -8916,7 +8990,7 @@ static bool show_database_privileges(THD *thd, const char *username,
want_access=acl_db->initial_access;
if (want_access)
{
- String db(buff,sizeof(buff),system_charset_info);
+ String db(buff, buffsize, system_charset_info);
db.length(0);
db.append(STRING_WITH_LEN("GRANT "));
@@ -9244,17 +9318,6 @@ void get_mqh(const char *user, const char *host, USER_CONN *uc)
mysql_mutex_unlock(&acl_cache->lock);
}
-static int check_role_is_granted_callback(ACL_USER_BASE *grantee, void *data)
-{
- LEX_CSTRING *rolename= static_cast<LEX_CSTRING *>(data);
- if (rolename->length == grantee->user.length &&
- !strcmp(rolename->str, grantee->user.str))
- return -1; // End search, we've found our role.
-
- /* Keep looking, we haven't found our role yet. */
- return 0;
-}
-
/*
Modify a privilege table.
@@ -11094,7 +11157,7 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
Security context in THD contains two pairs of (user,host):
1. (user,host) pair referring to inbound connection.
2. (priv_user,priv_host) pair obtained from mysql.user table after doing
- authnetication of incoming connection.
+ authentication of incoming connection.
Privileges should be checked wrt (priv_user, priv_host) tuple, because
(user,host) pair obtained from inbound connection may have different
values than what is actually stored in mysql.user table and while granting
@@ -11437,7 +11500,7 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
-static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
+static bool update_schema_privilege(THD *thd, TABLE *table, const char *buff,
const char* db, const char* t_name,
const char* column, uint col_length,
const char *priv, uint priv_length,
@@ -11461,6 +11524,21 @@ static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
#endif
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+class Grantee_str
+{
+ char m_buff[USER_HOST_BUFF_SIZE + 6 /* 4 quotes, @, '\0' */];
+public:
+ Grantee_str(const char *user, const char *host)
+ {
+ DBUG_ASSERT(strlen(user) + strlen(host) + 6 < sizeof(m_buff));
+ strxmov(m_buff, "'", user, "'@'", host, "'", NullS);
+ }
+ operator const char *() const { return m_buff; }
+};
+#endif
+
+
int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -11468,7 +11546,6 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint counter;
ACL_USER *acl_user;
ulong want_access;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -11495,10 +11572,10 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(want_access & GRANT_ACL))
is_grantable= "NO";
- strxmov(buff,"'",user,"'@'",host,"'",NullS);
+ Grantee_str grantee(user, host);
if (!(want_access & ~GRANT_ACL))
{
- if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0,
+ if (update_schema_privilege(thd, table, grantee, 0, 0, 0, 0,
STRING_WITH_LEN("USAGE"), is_grantable))
{
error= 1;
@@ -11511,9 +11588,9 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
ulong j,test_access= want_access & ~GRANT_ACL;
for (priv_id=0, j = SELECT_ACL;j <= GLOBAL_ACLS; priv_id++,j <<= 1)
{
- if (test_access & j)
+ if (test_access & j)
{
- if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0,
+ if (update_schema_privilege(thd, table, grantee, 0, 0, 0, 0,
command_array[priv_id],
command_lengths[priv_id], is_grantable))
{
@@ -11541,7 +11618,6 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint counter;
ACL_DB *acl_db;
ulong want_access;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -11572,10 +11648,10 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
is_grantable= "NO";
}
- strxmov(buff,"'",user,"'@'",host,"'",NullS);
+ Grantee_str grantee(user, host);
if (!(want_access & ~GRANT_ACL))
{
- if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0,
+ if (update_schema_privilege(thd, table, grantee, acl_db->db, 0, 0,
0, STRING_WITH_LEN("USAGE"), is_grantable))
{
error= 1;
@@ -11589,7 +11665,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
for (cnt=0, j = SELECT_ACL; j <= DB_ACLS; cnt++,j <<= 1)
if (test_access & j)
{
- if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, 0,
+ if (update_schema_privilege(thd, table,
+ grantee, acl_db->db, 0, 0, 0,
command_array[cnt], command_lengths[cnt],
is_grantable))
{
@@ -11615,7 +11692,6 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0;
uint index;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -11650,10 +11726,11 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_access & GRANT_ACL))
is_grantable= "NO";
- strxmov(buff, "'", user, "'@'", host, "'", NullS);
+ Grantee_str grantee(user, host);
if (!test_access)
{
- if (update_schema_privilege(thd, table, buff, grant_table->db,
+ if (update_schema_privilege(thd, table,
+ grantee, grant_table->db,
grant_table->tname, 0, 0,
STRING_WITH_LEN("USAGE"), is_grantable))
{
@@ -11669,7 +11746,8 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
if (test_access & j)
{
- if (update_schema_privilege(thd, table, buff, grant_table->db,
+ if (update_schema_privilege(thd, table,
+ grantee, grant_table->db,
grant_table->tname, 0, 0,
command_array[cnt],
command_lengths[cnt], is_grantable))
@@ -11697,7 +11775,6 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0;
uint index;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -11726,7 +11803,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
is_grantable= "NO";
ulong test_access= table_access & ~GRANT_ACL;
- strxmov(buff, "'", user, "'@'", host, "'", NullS);
+ Grantee_str grantee(user, host);
if (!test_access)
continue;
else
@@ -11745,7 +11822,9 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
my_hash_element(&grant_table->hash_columns,col_index);
if ((grant_column->rights & j) && (table_access & j))
{
- if (update_schema_privilege(thd, table, buff, grant_table->db,
+ if (update_schema_privilege(thd, table,
+ grantee,
+ grant_table->db,
grant_table->tname,
grant_column->column,
grant_column->key_length,
@@ -12201,6 +12280,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
int2store(end+5, thd->client_capabilities >> 16);
end[7]= data_len;
DBUG_EXECUTE_IF("poison_srv_handshake_scramble_len", end[7]= -100;);
+ DBUG_EXECUTE_IF("increase_srv_handshake_scramble_len", end[7]= 50;);
bzero(end + 8, 6);
int4store(end + 14, thd->client_capabilities >> 32);
end+= 18;
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 09a721936b9..e9063673b8e 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -409,7 +409,7 @@ bool acl_check_proxy_grant_access (THD *thd, const char *host, const char *user,
bool with_grant);
int acl_setrole(THD *thd, char *rolename, ulonglong access);
int acl_check_setrole(THD *thd, char *rolename, ulonglong *access);
-int acl_check_set_default_role(THD *thd, const char *host, const char *user);
+int acl_check_set_default_role(THD *thd, const char *host, const char *user, const char *role);
int acl_set_default_role(THD *thd, const char *host, const char *user,
const char *rolename);
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index ab95fdc340c..af4b9127f8f 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -765,35 +765,20 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
{
compl_result_code= result_code= HA_ADMIN_INVALID;
}
+
+ /*
+ The check for Alter_info::ALTER_ADMIN_PARTITION implements this logic:
+ do not collect EITS STATS for this syntax:
+ ALTER TABLE ... ANALYZE PARTITION p
+ EITS statistics is global (not per-partition). Collecting global stats
+ is much more expensive processing just one partition, so the most
+ appropriate action is to just not collect EITS stats for this command.
+ */
collect_eis=
(table->table->s->table_category == TABLE_CATEGORY_USER &&
+ !(lex->alter_info.flags & Alter_info::ALTER_ADMIN_PARTITION) &&
(get_use_stat_tables_mode(thd) > NEVER ||
lex->with_persistent_for_clause));
-
-
- if (!lex->index_list)
- {
- tab->keys_in_use_for_query.init(tab->s->keys);
- }
- else
- {
- int pos;
- LEX_STRING *index_name;
- List_iterator_fast<LEX_STRING> it(*lex->index_list);
-
- tab->keys_in_use_for_query.clear_all();
- while ((index_name= it++))
- {
- if (tab->s->keynames.type_names == 0 ||
- (pos= find_type(&tab->s->keynames, index_name->str,
- index_name->length, 1)) <= 0)
- {
- compl_result_code= result_code= HA_ADMIN_INVALID;
- break;
- }
- tab->keys_in_use_for_query.set_bit(--pos);
- }
- }
}
if (result_code == HA_ADMIN_OK)
@@ -878,6 +863,27 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
tab->file->column_bitmaps_signal();
}
+ if (!lex->index_list)
+ tab->keys_in_use_for_query.init(tab->s->keys);
+ else
+ {
+ int pos;
+ LEX_STRING *index_name;
+ List_iterator_fast<LEX_STRING> it(*lex->index_list);
+
+ tab->keys_in_use_for_query.clear_all();
+ while ((index_name= it++))
+ {
+ if (tab->s->keynames.type_names == 0 ||
+ (pos= find_type(&tab->s->keynames, index_name->str,
+ index_name->length, 1)) <= 0)
+ {
+ compl_result_code= result_code= HA_ADMIN_INVALID;
+ break;
+ }
+ tab->keys_in_use_for_query.set_bit(--pos);
+ }
+ }
if (!(compl_result_code=
alloc_statistics_for_table(thd, table->table)) &&
!(compl_result_code=
@@ -1091,7 +1097,7 @@ send_result_message:
}
/* Make sure this table instance is not reused after the operation. */
if (table->table)
- table->table->m_needs_reopen= true;
+ table->table->mark_table_for_reopen();
}
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
table->next_local= save_next_local;
@@ -1216,7 +1222,7 @@ err:
trans_rollback(thd);
if (table && table->table)
{
- table->table->m_needs_reopen= true;
+ table->table->mark_table_for_reopen();
table->table= 0;
}
close_thread_tables(thd); // Shouldn't be needed
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index ff0f049779f..03f2f3aca33 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -291,7 +291,9 @@ void mysql_audit_notify_connection_change_user(THD *thd)
}
static inline
-void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
+void mysql_audit_external_lock_ex(THD *thd, my_thread_id thread_id,
+ const char *user, const char *host, const char *ip, query_id_t query_id,
+ TABLE_SHARE *share, int lock)
{
if (lock != F_UNLCK && mysql_audit_table_enabled())
{
@@ -300,14 +302,14 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
event.event_subclass= MYSQL_AUDIT_TABLE_LOCK;
event.read_only= lock == F_RDLCK;
- event.thread_id= (unsigned long)thd->thread_id;
- event.user= sctx->user;
+ event.thread_id= (unsigned long)thread_id;
+ event.user= user;
event.priv_user= sctx->priv_user;
event.priv_host= sctx->priv_host;
event.external_user= sctx->external_user;
event.proxy_user= sctx->proxy_user;
- event.host= sctx->host;
- event.ip= sctx->ip;
+ event.host= host;
+ event.ip= ip;
event.database= share->db.str;
event.database_length= (unsigned int)share->db.length;
event.table= share->table_name.str;
@@ -316,13 +318,21 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
event.new_database_length= 0;
event.new_table= 0;
event.new_table_length= 0;
- event.query_id= thd->query_id;
+ event.query_id= query_id;
mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
}
}
static inline
+void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
+{
+ mysql_audit_external_lock_ex(thd, thd->thread_id, thd->security_ctx->user,
+ thd->security_ctx->host, thd->security_ctx->ip, thd->query_id,
+ share, lock);
+}
+
+static inline
void mysql_audit_create_table(TABLE *table)
{
if (mysql_audit_table_enabled())
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 761c4daa88b..635e17d1865 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2016, MariaDB
+ Copyright (c) 2010, 2020, 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
@@ -1233,7 +1233,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
FALSE);
/* extra() call must come only after all instances above are closed */
if (function != HA_EXTRA_NOT_USED)
- (void) table->file->extra(function);
+ DBUG_RETURN(table->file->extra(function));
DBUG_RETURN(FALSE);
}
@@ -1675,6 +1675,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
{
table= best_table;
table->query_id= thd->query_id;
+ table->init(thd, table_list);
DBUG_PRINT("info",("Using locked table"));
goto reset;
}
@@ -1858,7 +1859,12 @@ retry_share:
DBUG_RETURN(FALSE);
}
+#ifdef WITH_WSREP
+ if (!((flags & MYSQL_OPEN_IGNORE_FLUSH) ||
+ (thd->wsrep_applier)))
+#else
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
+#endif
{
if (share->tdc->flushed)
{
@@ -1959,12 +1965,13 @@ retry_share:
}
table->mdl_ticket= mdl_ticket;
+ table->reginfo.lock_type=TL_READ; /* Assume read */
+
+ table->init(thd, table_list);
table->next= thd->open_tables; /* Link into simple list */
thd->set_open_tables(table);
- table->reginfo.lock_type=TL_READ; /* Assume read */
-
reset:
/*
Check that there is no reference to a condition from an earlier query
@@ -1989,8 +1996,6 @@ retry_share:
}
#endif
- table->init(thd, table_list);
-
DBUG_RETURN(FALSE);
err_lock:
@@ -2161,9 +2166,9 @@ Locked_tables_list::init_locked_tables(THD *thd)
in reopen_tables(). reopen_tables() is a critical
path and we don't want to complicate it with extra allocations.
*/
- m_reopen_array= (TABLE**)alloc_root(&m_locked_tables_root,
- sizeof(TABLE*) *
- (m_locked_tables_count+1));
+ m_reopen_array= (TABLE_LIST**)alloc_root(&m_locked_tables_root,
+ sizeof(TABLE_LIST*) *
+ (m_locked_tables_count+1));
if (m_reopen_array == NULL)
{
reset();
@@ -2273,6 +2278,7 @@ void Locked_tables_list::reset()
m_locked_tables_last= &m_locked_tables;
m_reopen_array= NULL;
m_locked_tables_count= 0;
+ some_table_marked_for_reopen= 0;
}
@@ -2368,7 +2374,7 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
in reopen_tables() always links the opened table
to the beginning of the open_tables list.
*/
- DBUG_ASSERT(thd->open_tables == m_reopen_array[reopen_count]);
+ DBUG_ASSERT(thd->open_tables == m_reopen_array[reopen_count]->table);
thd->open_tables->pos_in_locked_tables->table= NULL;
thd->open_tables->pos_in_locked_tables= 0;
@@ -2398,10 +2404,36 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
}
+/*
+ Mark all instances of the table to be reopened
+
+ This is only needed when LOCK TABLES is active
+*/
+
+void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table)
+{
+ TABLE_SHARE *share= table->s;
+
+ for (TABLE_LIST *table_list= m_locked_tables;
+ table_list; table_list= table_list->next_global)
+ {
+ if (table_list->table->s == share)
+ table_list->table->internal_set_needs_reopen(true);
+ }
+ /* This is needed in the case where lock tables where not used */
+ table->internal_set_needs_reopen(true);
+ some_table_marked_for_reopen= 1;
+}
+
+
/**
Reopen the tables locked with LOCK TABLES and temporarily closed
by a DDL statement or FLUSH TABLES.
+ @param need_reopen If set, reopen open tables that are marked with
+ for reopen.
+ If not set, reopen tables that where closed.
+
@note This function is a no-op if we're not under LOCK TABLES.
@return TRUE if an error reopening the tables. May happen in
@@ -2419,6 +2451,12 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
MYSQL_LOCK *merged_lock;
DBUG_ENTER("Locked_tables_list::reopen_tables");
+ DBUG_ASSERT(some_table_marked_for_reopen || !need_reopen);
+
+
+ /* Reset flag that some table was marked for reopen */
+ some_table_marked_for_reopen= 0;
+
for (TABLE_LIST *table_list= m_locked_tables;
table_list; table_list= table_list->next_global)
{
@@ -2442,24 +2480,32 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
else
{
if (table_list->table) /* The table was not closed */
- continue;
- }
-
- /* Links into thd->open_tables upon success */
- if (open_table(thd, table_list, &ot_ctx))
- {
- unlink_all_closed_tables(thd, 0, reopen_count);
- DBUG_RETURN(TRUE);
+ continue;
}
- table_list->table->pos_in_locked_tables= table_list;
- /* See also the comment on lock type in init_locked_tables(). */
- table_list->table->reginfo.lock_type= table_list->lock_type;
DBUG_ASSERT(reopen_count < m_locked_tables_count);
- m_reopen_array[reopen_count++]= table_list->table;
+ m_reopen_array[reopen_count++]= table_list;
}
if (reopen_count)
{
+ TABLE **tables= (TABLE**) my_alloca(reopen_count * sizeof(TABLE*));
+
+ for (uint i= 0 ; i < reopen_count ; i++)
+ {
+ TABLE_LIST *table_list= m_reopen_array[i];
+ /* Links into thd->open_tables upon success */
+ if (open_table(thd, table_list, &ot_ctx))
+ {
+ unlink_all_closed_tables(thd, 0, i);
+ my_afree((void*) tables);
+ DBUG_RETURN(TRUE);
+ }
+ tables[i]= table_list->table;
+ table_list->table->pos_in_locked_tables= table_list;
+ /* See also the comment on lock type in init_locked_tables(). */
+ table_list->table->reginfo.lock_type= table_list->lock_type;
+ }
+
thd->in_lock_tables= 1;
/*
We re-lock all tables with mysql_lock_tables() at once rather
@@ -2472,7 +2518,7 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
works fine. Patching legacy code of thr_lock.c is risking to
break something else.
*/
- lock= mysql_lock_tables(thd, m_reopen_array, reopen_count,
+ lock= mysql_lock_tables(thd, tables, reopen_count,
MYSQL_OPEN_REOPEN);
thd->in_lock_tables= 0;
if (lock == NULL || (merged_lock=
@@ -2481,9 +2527,11 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
unlink_all_closed_tables(thd, lock, reopen_count);
if (! thd->killed)
my_error(ER_LOCK_DEADLOCK, MYF(0));
+ my_afree((void*) tables);
DBUG_RETURN(TRUE);
}
thd->lock= merged_lock;
+ my_afree((void*) tables);
}
DBUG_RETURN(FALSE);
}
@@ -4190,7 +4238,7 @@ restart:
}
}
- if (WSREP_ON &&
+ if (WSREP(thd) &&
wsrep_replicate_myisam &&
(*start) &&
(*start)->table &&
@@ -4445,10 +4493,19 @@ bool Lock_tables_prelocking_strategy::
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list, bool *need_prelocking)
{
+ TABLE_LIST **last= prelocking_ctx->query_tables_last;
+
if (DML_prelocking_strategy::handle_table(thd, prelocking_ctx, table_list,
need_prelocking))
return TRUE;
+ /*
+ normally we don't need to open FK-prelocked tables for RESTRICT,
+ MDL is enough. But under LOCK TABLES we have to open everything
+ */
+ for (TABLE_LIST *tl= *last; tl; tl= tl->next_global)
+ tl->open_strategy= TABLE_LIST::OPEN_NORMAL;
+
/* We rely on a caller to check that table is going to be changed. */
DBUG_ASSERT(table_list->lock_type >= TL_WRITE_ALLOW_WRITE);
@@ -4909,6 +4966,24 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table_list)
}
}
+int TABLE::fix_vcol_exprs(THD *thd)
+{
+ for (Field **vf= vfield; vf && *vf; vf++)
+ if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
+ return 1;
+
+ for (Field **df= default_field; df && *df; df++)
+ if ((*df)->default_value &&
+ fix_session_vcol_expr(thd, (*df)->default_value))
+ return 1;
+
+ for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++)
+ if (fix_session_vcol_expr(thd, (*cc)))
+ return 1;
+
+ return 0;
+}
+
static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
{
@@ -4916,36 +4991,27 @@ static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables)
TABLE_LIST *first_not_own= thd->lex->first_not_own_table();
DBUG_ENTER("fix_session_vcol_expr");
- for (TABLE_LIST *table= tables; table && table != first_not_own;
+ int error= 0;
+ for (TABLE_LIST *table= tables; table && table != first_not_own && !error;
table= table->next_global)
{
TABLE *t= table->table;
if (!table->placeholder() && t->s->vcols_need_refixing &&
table->lock_type >= TL_WRITE_ALLOW_WRITE)
{
+ Query_arena *stmt_backup= thd->stmt_arena;
+ if (thd->stmt_arena->is_conventional())
+ thd->stmt_arena= t->expr_arena;
if (table->security_ctx)
thd->security_ctx= table->security_ctx;
- for (Field **vf= t->vfield; vf && *vf; vf++)
- if (fix_session_vcol_expr(thd, (*vf)->vcol_info))
- goto err;
-
- for (Field **df= t->default_field; df && *df; df++)
- if ((*df)->default_value &&
- fix_session_vcol_expr(thd, (*df)->default_value))
- goto err;
-
- for (Virtual_column_info **cc= t->check_constraints; cc && *cc; cc++)
- if (fix_session_vcol_expr(thd, (*cc)))
- goto err;
+ error= t->fix_vcol_exprs(thd);
thd->security_ctx= save_security_ctx;
+ thd->stmt_arena= stmt_backup;
}
}
- DBUG_RETURN(0);
-err:
- thd->security_ctx= save_security_ctx;
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
@@ -7445,15 +7511,11 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
FALSE ok; In this case *map will include the chosen index
TRUE error
*/
-bool setup_tables_and_check_access(THD *thd,
- Name_resolution_context *context,
+bool setup_tables_and_check_access(THD *thd, Name_resolution_context *context,
List<TABLE_LIST> *from_clause,
- TABLE_LIST *tables,
- List<TABLE_LIST> &leaves,
- bool select_insert,
- ulong want_access_first,
- ulong want_access,
- bool full_table_list)
+ TABLE_LIST *tables, List<TABLE_LIST> &leaves,
+ bool select_insert, ulong want_access_first,
+ ulong want_access, bool full_table_list)
{
DBUG_ENTER("setup_tables_and_check_access");
@@ -8033,10 +8095,8 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
if (table->next_number_field &&
rfield->field_index == table->next_number_field->field_index)
table->auto_increment_field_not_null= TRUE;
- Item::Type type= value->type();
if (rfield->vcol_info &&
- type != Item::DEFAULT_VALUE_ITEM &&
- type != Item::NULL_ITEM &&
+ !value->vcol_assignment_allowed_value() &&
table->s->table_category != TABLE_CATEGORY_TEMPORARY)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -8280,18 +8340,14 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
value=v++;
if (field->field_index == autoinc_index)
table->auto_increment_field_not_null= TRUE;
- if (field->vcol_info)
+ if (field->vcol_info &&
+ !value->vcol_assignment_allowed_value() &&
+ table->s->table_category != TABLE_CATEGORY_TEMPORARY)
{
- Item::Type type= value->type();
- if (type != Item::DEFAULT_VALUE_ITEM &&
- type != Item::NULL_ITEM &&
- table->s->table_category != TABLE_CATEGORY_TEMPORARY)
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN,
- ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
- field->field_name, table->s->table_name.str);
- }
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN,
+ ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
+ field->field_name, table->s->table_name.str);
}
if (use_value)
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 5bc4c179721..59d7e9cb028 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -158,8 +158,9 @@ int binlog_defragment(THD *thd)
memcpy(thd->lex->comment.str + gathered_length, entry[k]->value,
entry[k]->length);
gathered_length += entry[k]->length;
- update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
}
+ for (uint k=0; k < 2; k++)
+ update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
DBUG_ASSERT(gathered_length == thd->lex->comment.length);
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index d8c78055d12..8555ae6ee3e 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3396,7 +3396,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
if (!insert_table(thd, key_length, key, (*block_table),
tables_used->view_db.length, 0,
HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE))
- DBUG_RETURN(0);
+ goto err_cleanup;
/*
We do not need to register view tables here because they are already
present in the global list.
@@ -3420,7 +3420,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
tables_used->callback_func,
tables_used->engine_data,
TRUE))
- DBUG_RETURN(0);
+ goto err_cleanup;
if (tables_used->table->file->
register_query_cache_dependant_tables(thd, this, block_table, &n))
@@ -3428,6 +3428,11 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
}
}
DBUG_RETURN(n - counter);
+err_cleanup:
+ // Mark failed
+ (*block_table)->next= (*block_table)->prev= NULL;
+ (*block_table)->parent= NULL;
+ DBUG_RETURN(0);
}
/*
@@ -3461,7 +3466,12 @@ my_bool Query_cache::register_all_tables(THD *thd,
for (Query_cache_block_table *tmp = block->table(0) ;
tmp != block_table;
tmp++)
- unlink_table(tmp);
+ {
+ if (tmp->prev) // not marked as failed and unuseable
+ unlink_table(tmp);
+ else
+ break;
+ }
if (block_table->parent)
unlink_table(block_table);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7364bd6788d..0a8c136e556 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, 2018, MariaDB Corporation.
+ Copyright (c) 2008, 2020, 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
@@ -71,6 +71,7 @@
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
#endif
+#include "repl_failsafe.h"
/*
The following is used to initialise Table_ident with a internal
@@ -604,6 +605,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
m_current_stage_key(0),
in_sub_stmt(0), log_all_errors(0),
binlog_unsafe_warning_flags(0),
+ current_stmt_binlog_format(BINLOG_FORMAT_MIXED),
binlog_table_maps(0),
bulk_param(0),
table_map_for_update(0),
@@ -727,7 +729,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
query_name_consts= 0;
semisync_info= 0;
db_charset= global_system_variables.collation_database;
- bzero(ha_data, sizeof(ha_data));
+ bzero((void*) ha_data, sizeof(ha_data));
mysys_var=0;
binlog_evt_union.do_union= FALSE;
enable_slow_log= 0;
@@ -1206,7 +1208,7 @@ void THD::init(void)
#ifdef WITH_WSREP
wsrep_exec_mode= wsrep_applier ? REPL_RECV : LOCAL_STATE;
wsrep_conflict_state= NO_CONFLICT;
- wsrep_query_state= QUERY_IDLE;
+ wsrep_thd_set_query_state(this, QUERY_IDLE);
wsrep_last_query_id= 0;
wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
@@ -1416,6 +1418,10 @@ void THD::cleanup(void)
DBUG_ASSERT(!mdl_context.has_locks());
apc_target.destroy();
+#ifdef HAVE_REPLICATION
+ unregister_slave(this, true, true);
+#endif
+
cleanup_done=1;
DBUG_VOID_RETURN;
}
@@ -3475,7 +3481,6 @@ void select_dumpvar::cleanup()
Query_arena::Type Query_arena::type() const
{
- DBUG_ASSERT(0); /* Should never be called */
return STATEMENT;
}
@@ -4524,6 +4529,7 @@ extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd)
@param buflen Length of the buffer
@return Length of the query
+ @retval 0 if LOCK_thd_data cannot be acquired without waiting
@note This function is thread safe as the query string is
accessed under mutex protection and the string is copied
@@ -4532,10 +4538,19 @@ 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)
{
- mysql_mutex_lock(&thd->LOCK_thd_data);
- size_t len= MY_MIN(buflen - 1, thd->query_length());
- memcpy(buf, thd->query(), len);
- mysql_mutex_unlock(&thd->LOCK_thd_data);
+ size_t len= 0;
+ /* InnoDB invokes this function while holding internal mutexes.
+ THD::awake() will hold LOCK_thd_data while invoking an InnoDB
+ function that would acquire the internal mutex. Because this
+ function is a non-essential part of information_schema view output,
+ we will break the deadlock by avoiding a mutex wait here
+ and returning the empty string if a wait would be needed. */
+ if (!mysql_mutex_trylock(&thd->LOCK_thd_data))
+ {
+ len= MY_MIN(buflen - 1, thd->query_length());
+ memcpy(buf, thd->query(), len);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ }
buf[len]= '\0';
return len;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index b35f9a93238..2727b4c84d5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -811,9 +811,9 @@ typedef struct system_status_var
ulong feature_window_functions; /* +1 when window functions are used */
/* From MASTER_GTID_WAIT usage */
- ulonglong master_gtid_wait_timeouts; /* Number of timeouts */
- ulonglong master_gtid_wait_time; /* Time in microseconds */
- ulonglong master_gtid_wait_count;
+ ulong master_gtid_wait_timeouts; /* Number of timeouts */
+ ulong master_gtid_wait_time; /* Time in microseconds */
+ ulong master_gtid_wait_count;
ulong empty_queries;
ulong access_denied_errors;
@@ -953,7 +953,7 @@ public:
/* We build without RTTI, so dynamic_cast can't be used. */
enum Type
{
- STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE
+ STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE, TABLE_ARENA
};
Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) :
@@ -1823,20 +1823,23 @@ private:
TABLE_LIST *m_locked_tables;
TABLE_LIST **m_locked_tables_last;
/** An auxiliary array used only in reopen_tables(). */
- TABLE **m_reopen_array;
+ TABLE_LIST **m_reopen_array;
/**
Count the number of tables in m_locked_tables list. We can't
rely on thd->lock->table_count because it excludes
non-transactional temporary tables. We need to know
an exact number of TABLE objects.
*/
- size_t m_locked_tables_count;
+ uint m_locked_tables_count;
public:
+ bool some_table_marked_for_reopen;
+
Locked_tables_list()
:m_locked_tables(NULL),
m_locked_tables_last(&m_locked_tables),
m_reopen_array(NULL),
- m_locked_tables_count(0)
+ m_locked_tables_count(0),
+ some_table_marked_for_reopen(0)
{
init_sql_alloc(&m_locked_tables_root, MEM_ROOT_BLOCK_SIZE, 0,
MYF(MY_THREAD_SPECIFIC));
@@ -1859,6 +1862,7 @@ public:
bool restore_lock(THD *thd, TABLE_LIST *dst_table_list, TABLE *table,
MYSQL_LOCK *lock);
void add_back_last_deleted_lock(TABLE_LIST *dst_table_list);
+ void mark_table_for_reopen(THD *thd, TABLE *table);
};
@@ -3650,13 +3654,20 @@ public:
return 0;
}
+
+ bool is_item_tree_change_register_required()
+ {
+ return !stmt_arena->is_conventional()
+ || stmt_arena->type() == Query_arena::TABLE_ARENA;
+ }
+
void change_item_tree(Item **place, Item *new_value)
{
DBUG_ENTER("THD::change_item_tree");
DBUG_PRINT("enter", ("Register: %p (%p) <- %p",
*place, place, new_value));
/* TODO: check for OOM condition here */
- if (!stmt_arena->is_conventional())
+ if (is_item_tree_change_register_required())
nocheck_register_item_tree_change(place, *place, mem_root);
*place= new_value;
DBUG_VOID_RETURN;
@@ -3725,7 +3736,8 @@ public:
The worst things that can happen is that we get
a suboptimal error message.
*/
- if ((killed_err= (err_info*) alloc(sizeof(*killed_err))))
+ killed_err= (err_info*) alloc_root(&main_mem_root, sizeof(*killed_err));
+ if (killed_err)
{
killed_err->no= killed_errno_arg;
::strmake((char*) killed_err->msg, killed_err_msg_arg,
@@ -5437,6 +5449,8 @@ struct SORT_FIELD_ATTR
{
uint length; /* Length of sort field */
uint suffix_length; /* Length suffix (0-4) */
+ enum Type { FIXED_SIZE, VARIABLE_SIZE } type;
+ bool is_variable_sized() { return type == VARIABLE_SIZE; }
};
@@ -5770,11 +5784,11 @@ public:
/**
SP Bulk execution safe
*/
-#define CF_SP_BULK_SAFE (1U << 20)
+#define CF_PS_ARRAY_BINDING_SAFE (1U << 20)
/**
SP Bulk execution optimized
*/
-#define CF_SP_BULK_OPTIMIZED (1U << 21)
+#define CF_PS_ARRAY_BINDING_OPTIMIZED (1U << 21)
/* Bits in server_command_flags */
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 3491796ba85..b2900a20b28 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1342,7 +1342,7 @@ void do_handle_one_connection(CONNECT *connect)
if (WSREP(thd))
{
mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXITING;
+ wsrep_thd_set_query_state(thd, QUERY_EXITING);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index d922a7a7551..fe8e0de71b4 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1099,6 +1099,7 @@ bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
{
derived= with_elem->spec;
if (derived != select_lex->master_unit() &&
+ !with_elem->is_recursive &&
!is_with_table_recursive_reference())
{
derived->move_as_slave(select_lex);
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 6785bf8e815..39499e6895f 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1054,7 +1054,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_ASSERT(derived->table && derived->table->is_created());
select_union *derived_result= derived->derived_result;
SELECT_LEX *save_current_select= lex->current_select;
- bool derived_recursive_is_filled= false;
if (derived_is_recursive)
{
@@ -1067,7 +1066,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
{
/* In this case all iteration are performed */
res= derived->fill_recursive(thd);
- derived_recursive_is_filled= true;
}
}
else if (unit->is_union())
@@ -1123,9 +1121,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
}
}
- if (res || (!lex->describe &&
- (!derived_is_recursive ||
- derived_recursive_is_filled)))
+ if (res || (!lex->describe && !derived_is_recursive))
unit->cleanup();
lex->current_select= save_current_select;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 550851bd215..0c50a251d26 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1748,15 +1748,13 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
}
if (table->vfield)
{
- my_bool abort_on_warning= thd->abort_on_warning;
/*
We have not yet called update_virtual_fields(VOL_UPDATE_FOR_READ)
in handler methods for the just read row in record[1].
*/
table->move_fields(table->field, table->record[1], table->record[0]);
- thd->abort_on_warning= 0;
- table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE);
- thd->abort_on_warning= abort_on_warning;
+ if (table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE))
+ goto err;
table->move_fields(table->field, table->record[0], table->record[1]);
}
if (info->handle_duplicates == DUP_UPDATE)
@@ -2020,11 +2018,15 @@ public:
ulong auto_increment_offset;
LEX_STRING query;
Time_zone *time_zone;
+ char *user, *host, *ip;
+ query_id_t query_id;
+ my_thread_id thread_id;
delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg,
bool ignore_arg, bool log_query_arg)
: record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg),
- forced_insert_id(0), query(query_arg), time_zone(0)
+ forced_insert_id(0), query(query_arg), time_zone(0),
+ user(0), host(0), ip(0)
{}
~delayed_row()
{
@@ -2072,7 +2074,6 @@ public:
passed from connection thread to the handler thread.
*/
MDL_request grl_protection;
-
Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), thd(next_thread_id()),
table(0),tables_in_use(0), stacked_inserts(0),
@@ -2081,6 +2082,8 @@ public:
DBUG_ENTER("Delayed_insert constructor");
thd.security_ctx->user=(char*) delayed_user;
thd.security_ctx->host=(char*) my_localhost;
+ thd.security_ctx->ip= NULL;
+ thd.query_id= 0;
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
@@ -2584,6 +2587,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
delayed_row *row= 0;
Delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc;
+ size_t user_len, host_len, ip_len;
DBUG_ENTER("write_delayed");
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length));
@@ -2617,11 +2621,45 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
goto err;
}
+ user_len= host_len= ip_len= 0;
+ row->user= row->host= row->ip= NULL;
+ if (thd->security_ctx)
+ {
+ if (thd->security_ctx->user)
+ user_len= strlen(thd->security_ctx->user) + 1;
+ if (thd->security_ctx->host)
+ host_len= strlen(thd->security_ctx->host) + 1;
+ if (thd->security_ctx->ip)
+ ip_len= strlen(thd->security_ctx->ip) + 1;
+ }
/* This can't be THREAD_SPECIFIC as it's freed in delayed thread */
- if (!(row->record= (char*) my_malloc(table->s->reclength,
+ if (!(row->record= (char*) my_malloc(table->s->reclength +
+ user_len + host_len + ip_len,
MYF(MY_WME))))
goto err;
memcpy(row->record, table->record[0], table->s->reclength);
+
+ if (thd->security_ctx)
+ {
+ if (thd->security_ctx->user)
+ {
+ row->user= row->record + table->s->reclength;
+ memcpy(row->user, thd->security_ctx->user, user_len);
+ }
+ if (thd->security_ctx->host)
+ {
+ row->host= row->record + table->s->reclength + user_len;
+ memcpy(row->host, thd->security_ctx->host, host_len);
+ }
+ if (thd->security_ctx->ip)
+ {
+ row->ip= row->record + table->s->reclength + user_len + host_len;
+ memcpy(row->ip, thd->security_ctx->ip, ip_len);
+ }
+ }
+ row->query_id= thd->query_id;
+ row->thread_id= thd->thread_id;
+
row->start_time= thd->start_time;
row->query_start_used= thd->query_start_used;
row->start_time_sec_part= thd->start_time_sec_part;
@@ -3040,6 +3078,20 @@ pthread_handler_t handle_delayed_insert(void *arg)
}
if (di->stacked_inserts)
{
+ delayed_row *row;
+ I_List_iterator<delayed_row> it(di->rows);
+ my_thread_id cur_thd= di->thd.thread_id;
+
+ while ((row= it++))
+ {
+ if (cur_thd != row->thread_id)
+ {
+ mysql_audit_external_lock_ex(&di->thd, row->thread_id,
+ row->user, row->host, row->ip, row->query_id,
+ di->table->s, F_WRLCK);
+ cur_thd= row->thread_id;
+ }
+ }
if (di->handle_inserts())
{
/* Some fatal error */
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index a6bc4e171da..e1e307330e3 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2018, MariaDB Corporation
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2020, 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
@@ -794,7 +794,7 @@ void lex_end_stage1(LEX *lex)
}
else
{
- delete lex->sphead;
+ sp_head::destroy(lex->sphead);
lex->sphead= NULL;
}
@@ -1190,17 +1190,27 @@ static inline uint int_token(const char *str,uint length)
*/
bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
{
+ // only one level of nested comments are allowed
+ DBUG_ASSERT(remaining_recursions_permitted == 0 ||
+ remaining_recursions_permitted == 1);
uchar c;
while (! lip->eof())
{
c= lip->yyGet();
- if (remaining_recursions_permitted > 0)
+ if (remaining_recursions_permitted == 1)
{
if ((c == '/') && (lip->yyPeek() == '*'))
{
+ lip->yyUnput('('); // Replace nested "/*..." with "(*..."
+ lip->yySkip(); // and skip "("
+
lip->yySkip(); /* Eat asterisk */
- consume_comment(lip, remaining_recursions_permitted-1);
+ if (consume_comment(lip, 0))
+ return true;
+
+ lip->yyUnput(')'); // Replace "...*/" with "...*)"
+ lip->yySkip(); // and skip ")"
continue;
}
}
@@ -2130,6 +2140,7 @@ void st_select_lex::init_query()
n_sum_items= 0;
n_child_sum_items= 0;
hidden_bit_fields= 0;
+ fields_in_window_functions= 0;
subquery_in_having= explicit_limit= 0;
is_item_list_lookup= 0;
changed_elements= 0;
@@ -2697,7 +2708,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
select_n_having_items +
select_n_where_fields +
order_group_num +
- hidden_bit_fields) * 5;
+ hidden_bit_fields +
+ fields_in_window_functions) * 5;
if (!ref_pointer_array.is_null())
{
/*
@@ -2843,7 +2855,7 @@ void LEX::cleanup_lex_after_parse_error(THD *thd)
if (thd->lex->sphead)
{
thd->lex->sphead->restore_thd_mem_root(thd);
- delete thd->lex->sphead;
+ sp_head::destroy(thd->lex->sphead);
thd->lex->sphead= NULL;
}
}
@@ -3856,7 +3868,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
sl->options|= SELECT_DESCRIBE;
inner_join->select_options|= SELECT_DESCRIBE;
}
- res= inner_join->optimize();
+ if ((res= inner_join->optimize()))
+ return TRUE;
if (!inner_join->cleaned)
sl->update_used_tables();
sl->update_correlated_cache();
@@ -4249,7 +4262,7 @@ void SELECT_LEX::update_used_tables()
}
Item *item;
- List_iterator_fast<Item> it(join->fields_list);
+ List_iterator_fast<Item> it(join->all_fields);
select_list_tables= 0;
while ((item= it++))
{
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 65bce5d2579..965c3f29834 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -871,6 +871,14 @@ public:
converted to a GROUP BY involving BIT fields.
*/
uint hidden_bit_fields;
+ /*
+ Number of fields used in the definition of all the windows functions.
+ This includes:
+ 1) Fields in the arguments
+ 2) Fields in the PARTITION BY clause
+ 3) Fields in the ORDER BY clause
+ */
+ uint fields_in_window_functions;
enum_parsing_place parsing_place; /* where we are parsing expression */
enum_parsing_place context_analysis_place; /* where we are in prepare */
bool with_sum_func; /* sum function indicator */
@@ -1180,10 +1188,7 @@ public:
SQL_I_List<ORDER> win_order_list,
Window_frame *win_frame);
List<Item_window_func> window_funcs;
- bool add_window_func(Item_window_func *win_func)
- {
- return window_funcs.push_back(win_func);
- }
+ bool add_window_func(Item_window_func *win_func);
bool have_window_funcs() const { return (window_funcs.elements !=0); }
@@ -1298,28 +1303,6 @@ public:
uint sroutines_list_own_elements;
/**
- Locking state of tables in this particular statement.
-
- If we under LOCK TABLES or in prelocked mode we consider tables
- for the statement to be "locked" if there was a call to lock_tables()
- (which called handler::start_stmt()) for tables of this statement
- and there was no matching close_thread_tables() call.
-
- As result this state may differ significantly from one represented
- by Open_tables_state::lock/locked_tables_mode more, which are always
- "on" under LOCK TABLES or in prelocked mode.
- */
- enum enum_lock_tables_state {
- LTS_NOT_LOCKED = 0,
- LTS_LOCKED
- };
- enum_lock_tables_state lock_tables_state;
- bool is_query_tables_locked()
- {
- return (lock_tables_state == LTS_LOCKED);
- }
-
- /**
Number of tables which were open by open_tables() and to be locked
by lock_tables().
Note that we set this member only in some cases, when this value
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4939e884c84..83100e743ad 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB
+ Copyright (c) 2008, 2020, 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
@@ -104,6 +104,8 @@
#include "my_json_writer.h"
+#define PRIV_LOCK_TABLES (SELECT_ACL | LOCK_TABLES_ACL)
+
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
#ifdef WITH_ARIA_STORAGE_ENGINE
@@ -577,19 +579,21 @@ void init_update_queries(void)
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
- CF_UPDATES_DATA | CF_SP_BULK_SAFE;
+ CF_UPDATES_DATA |
+ CF_PS_ARRAY_BINDING_SAFE;
sql_command_flags[SQLCOM_UPDATE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
- CF_UPDATES_DATA | CF_SP_BULK_SAFE;
+ CF_UPDATES_DATA |
+ CF_PS_ARRAY_BINDING_SAFE;
sql_command_flags[SQLCOM_INSERT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
CF_INSERTS_DATA |
- CF_SP_BULK_SAFE |
- CF_SP_BULK_OPTIMIZED;
+ CF_PS_ARRAY_BINDING_SAFE |
+ CF_PS_ARRAY_BINDING_OPTIMIZED;
sql_command_flags[SQLCOM_INSERT_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
@@ -599,7 +603,7 @@ void init_update_queries(void)
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
- CF_SP_BULK_SAFE;
+ CF_PS_ARRAY_BINDING_SAFE;
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
@@ -608,8 +612,9 @@ void init_update_queries(void)
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
- CF_INSERTS_DATA | CF_SP_BULK_SAFE |
- CF_SP_BULK_OPTIMIZED;
+ CF_INSERTS_DATA |
+ CF_PS_ARRAY_BINDING_SAFE |
+ CF_PS_ARRAY_BINDING_OPTIMIZED;
sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
@@ -913,11 +918,6 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
char *buf= thd->strmake(init_command->str, len);
mysql_rwlock_unlock(var_lock);
-#if defined(ENABLED_PROFILING)
- thd->profiling.start_new_query();
- thd->profiling.set_query_source(buf, len);
-#endif
-
THD_STAGE_INFO(thd, stage_execution_of_init_command);
save_client_capabilities= thd->client_capabilities;
thd->client_capabilities|= CLIENT_MULTI_QUERIES;
@@ -932,9 +932,6 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
thd->client_capabilities= save_client_capabilities;
thd->net.vio= save_vio;
-#if defined(ENABLED_PROFILING)
- thd->profiling.finish_current_query();
-#endif
}
@@ -1061,7 +1058,6 @@ static void handle_bootstrap_impl(THD *thd)
thd->reset_kill_query(); /* Ensure that killed_errmsg is released */
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
- free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC));
thd->lex->restore_set_statement_var();
}
@@ -1210,7 +1206,7 @@ bool do_command(THD *thd)
if (WSREP(thd))
{
mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_IDLE;
+ wsrep_thd_set_query_state(thd, QUERY_IDLE);
if (thd->wsrep_conflict_state==MUST_ABORT)
{
wsrep_client_rollback(thd);
@@ -1278,7 +1274,7 @@ bool do_command(THD *thd)
thd->store_globals();
}
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
#endif /* WITH_WSREP */
@@ -1295,7 +1291,8 @@ bool do_command(THD *thd)
mysql_mutex_lock(&thd->LOCK_thd_data);
if (thd->wsrep_conflict_state == MUST_ABORT)
{
- DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu", thd->real_id));
+ DBUG_PRINT("wsrep",("aborted for wsrep rollback: %lu",
+ (long unsigned int) thd->real_id));
wsrep_client_rollback(thd);
}
mysql_mutex_unlock(&thd->LOCK_thd_data);
@@ -1575,7 +1572,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
if (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT)
{
thd->wsrep_conflict_state= NO_CONFLICT;
@@ -1823,7 +1820,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (parser_state.init(thd, thd->query(), thd->query_length()))
break;
- if (WSREP_ON)
+ if (WSREP(thd))
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state,
is_com_multi, is_next_command);
else
@@ -1833,7 +1830,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) &&
! thd->is_error())
{
- thd->get_stmt_da()->set_skip_flush();
/*
Multiple queries exist, execute them individually
*/
@@ -1907,13 +1903,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
statistic_increment(thd->status_var.questions, &LOCK_status);
- if(!WSREP(thd))
+ if (!WSREP(thd))
thd->set_time(); /* Reset the query start time. */
parser_state.reset(beginning_of_next_stmt, length);
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
- if (WSREP_ON)
+ if (WSREP(thd))
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state,
is_com_multi, is_next_command);
else
@@ -2082,7 +2078,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos);
if (nlen < FN_REFLEN)
mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags);
- unregister_slave(thd,1,1);
+ unregister_slave(thd, true, true); // todo: can be extraneous
/* fake COM_QUIT -- if we get here, the thread needs to terminate */
error = TRUE;
break;
@@ -2885,6 +2881,36 @@ retry:
goto err;
}
}
+ /*
+ Check privileges of view tables here, after views were opened.
+ Either definer or invoker has to have PRIV_LOCK_TABLES to be able
+ to lock view and its tables. For mysqldump (that locks views
+ before dumping their structures) compatibility we allow locking
+ views that select from I_S or P_S tables, but downrade the lock
+ to TL_READ
+ */
+ if (table->belong_to_view &&
+ check_single_table_access(thd, PRIV_LOCK_TABLES, table, 1))
+ {
+ if (table->grant.m_internal.m_schema_access)
+ table->lock_type= TL_READ;
+ else
+ {
+ bool error= true;
+ if (Security_context *sctx= table->security_ctx)
+ {
+ table->security_ctx= 0;
+ error= check_single_table_access(thd, PRIV_LOCK_TABLES, table, 1);
+ table->security_ctx= sctx;
+ }
+ if (error)
+ {
+ my_error(ER_VIEW_INVALID, MYF(0), table->belong_to_view->view_db.str,
+ table->belong_to_view->view_name.str);
+ goto err;
+ }
+ }
+ }
}
if (lock_tables(thd, tables, counter, 0) ||
@@ -4862,7 +4888,7 @@ mysql_execute_command(THD *thd)
/* Don't do it, if we are inside a SP */
if (!thd->spcont)
{
- delete lex->sphead;
+ sp_head::destroy(lex->sphead);
lex->sphead= NULL;
}
/* lex->unit.cleanup() is called outside, no need to call it here */
@@ -5089,7 +5115,7 @@ mysql_execute_command(THD *thd)
if (first_table && lex->type & (REFRESH_READ_LOCK|REFRESH_FOR_EXPORT))
{
/* Check table-level privileges. */
- if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
+ if (check_table_access(thd, PRIV_LOCK_TABLES, all_tables,
FALSE, UINT_MAX, FALSE))
goto error;
@@ -5628,23 +5654,20 @@ mysql_execute_command(THD *thd)
! lex->spname->m_explicit_name)
{
/* DROP FUNCTION <non qualified name> */
- udf_func *udf = find_udf(lex->spname->m_name.str,
- lex->spname->m_name.length);
- if (udf)
+ enum drop_udf_result rc= mysql_drop_function(thd,
+ &lex->spname->m_name);
+ if (rc == UDF_DEL_RESULT_DELETED)
{
- if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0))
- goto error;
+ my_ok(thd);
+ break;
+ }
- if (!(res = mysql_drop_function(thd, &lex->spname->m_name)))
- {
- my_ok(thd);
- break;
- }
- my_error(ER_SP_DROP_FAILED, MYF(0),
- "FUNCTION (UDF)", lex->spname->m_name.str);
+ if (rc == UDF_DEL_RESULT_ERROR)
goto error;
- }
+ DBUG_ASSERT(rc == UDF_DEL_RESULT_ABSENT);
+
+ // If there was no current database, so it can not be SP
if (lex->spname->m_db.str == NULL)
{
if (lex->if_exists())
@@ -5998,7 +6021,8 @@ finish:
lex->unit.cleanup();
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
- if (! thd->lex->requires_prelocking())
+ if (unlikely(thd->locked_tables_list.some_table_marked_for_reopen) &&
+ !thd->lex->requires_prelocking())
thd->locked_tables_list.reopen_tables(thd, true);
if (! thd->in_sub_stmt)
@@ -6604,7 +6628,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
@param thd Thread handler
@param privilege requested privilege
- @param all_tables global table list of query
+ @param tables global table list of query
@param no_errors FALSE/TRUE - report/don't report error to
the client (using my_error() call).
@@ -6614,28 +6638,25 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
1 access denied, error is sent to client
*/
-bool check_single_table_access(THD *thd, ulong privilege,
- TABLE_LIST *all_tables, bool no_errors)
+bool check_single_table_access(THD *thd, ulong privilege, TABLE_LIST *tables,
+ bool no_errors)
{
- Switch_to_definer_security_ctx backup_sctx(thd, all_tables);
+ Switch_to_definer_security_ctx backup_sctx(thd, tables);
const char *db_name;
- if ((all_tables->view || all_tables->field_translation) &&
- !all_tables->schema_table)
- db_name= all_tables->view_db.str;
+ if ((tables->view || tables->field_translation) && !tables->schema_table)
+ db_name= tables->view_db.str;
else
- db_name= all_tables->db;
+ db_name= tables->db;
- if (check_access(thd, privilege, db_name,
- &all_tables->grant.privilege,
- &all_tables->grant.m_internal,
- 0, no_errors))
+ if (check_access(thd, privilege, db_name, &tables->grant.privilege,
+ &tables->grant.m_internal, 0, no_errors))
return 1;
/* Show only 1 table for check_grant */
- if (!(all_tables->belong_to_view &&
- (thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
- check_grant(thd, privilege, all_tables, FALSE, 1, no_errors))
+ if (!(tables->belong_to_view &&
+ (thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
+ check_grant(thd, privilege, tables, FALSE, 1, no_errors))
return 1;
return 0;
@@ -7758,8 +7779,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
thd->end_statement();
+ thd->Item_change_list::rollback_item_tree_changes();
thd->cleanup_after_query();
- DBUG_ASSERT(thd->Item_change_list::is_empty());
}
else
{
@@ -8563,6 +8584,11 @@ bool st_select_lex::add_window_def(THD *thd,
win_frame);
group_list= thd->lex->save_group_list;
order_list= thd->lex->save_order_list;
+ if (parsing_place != SELECT_LIST)
+ {
+ fields_in_window_functions+= win_part_list_ptr->elements +
+ win_order_list_ptr->elements;
+ }
return (win_def == NULL || window_specs.push_back(win_def));
}
@@ -8584,6 +8610,11 @@ bool st_select_lex::add_window_spec(THD *thd,
win_frame);
group_list= thd->lex->save_group_list;
order_list= thd->lex->save_order_list;
+ if (parsing_place != SELECT_LIST)
+ {
+ fields_in_window_functions+= win_part_list_ptr->elements +
+ win_order_list_ptr->elements;
+ }
thd->lex->win_spec= win_spec;
return (win_spec == NULL || window_specs.push_back(win_spec));
}
@@ -9637,7 +9668,7 @@ static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables)
if (is_temporary_table(table))
continue;
- if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, table,
+ if (check_table_access(thd, PRIV_LOCK_TABLES, table,
FALSE, 1, FALSE))
return TRUE;
}
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 4a200dd670b..2334286b039 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4592,7 +4592,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
{
*fast_alter_table= true;
/* Force table re-open for consistency with the main case. */
- table->m_needs_reopen= true;
+ table->mark_table_for_reopen();
}
else
{
@@ -4640,7 +4640,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
must be reopened.
*/
*fast_alter_table= true;
- table->m_needs_reopen= true;
+ table->mark_table_for_reopen();
}
else
{
@@ -5473,6 +5473,28 @@ the generated partition syntax in a correct manner.
*partition_changed= TRUE;
}
}
+ /*
+ Prohibit inplace when partitioned by primary key and the primary key is dropped.
+ */
+ if (!*partition_changed &&
+ tab_part_info->part_field_array &&
+ !tab_part_info->part_field_list.elements &&
+ table->s->primary_key != MAX_KEY)
+ {
+ KEY *primary_key= table->key_info + table->s->primary_key;
+ List_iterator_fast<Alter_drop> drop_it(alter_info->drop_list);
+ const char *primary_name= primary_key->name;
+ const Alter_drop *drop;
+ drop_it.rewind();
+ while ((drop= drop_it++))
+ {
+ if (drop->type == Alter_drop::KEY &&
+ 0 == my_strcasecmp(system_charset_info, primary_name, drop->name))
+ break;
+ }
+ if (drop)
+ *partition_changed= TRUE;
+ }
}
if (thd->work_part_info)
{
@@ -6418,7 +6440,7 @@ void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
THD *thd= lpt->thd;
TABLE *table= lpt->table;
DBUG_ENTER("handle_alter_part_error");
- DBUG_ASSERT(table->m_needs_reopen);
+ DBUG_ASSERT(table->needs_reopen());
if (close_table)
{
@@ -6637,7 +6659,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
bool frm_install= FALSE;
MDL_ticket *mdl_ticket= table->mdl_ticket;
DBUG_ENTER("fast_alter_partition_table");
- DBUG_ASSERT(table->m_needs_reopen);
+ DBUG_ASSERT(table->needs_reopen());
part_info= table->part_info;
lpt->thd= thd;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 44b2a8220b3..968ec6ac7d4 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1844,7 +1844,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
sql_print_error(ER_THD(new_thd, ER_GET_ERRNO), my_errno,
table->file->table_type());
end_read_record(&read_record_info);
- table->m_needs_reopen= TRUE; // Force close to free memory
+ table->mark_table_for_reopen();
close_mysql_tables(new_thd);
end:
delete new_thd;
@@ -2216,26 +2216,30 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)) ||
plugin->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DYING))
{
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
- return 1;
- }
- if (!plugin->plugin_dl)
- {
- my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
- return 1;
+ // maybe plugin is in mysql.plugin present so postpond the error
+ plugin= NULL;
}
- if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
+
+ if (plugin)
{
- my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
- return 1;
- }
+ if (!plugin->plugin_dl)
+ {
+ my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
+ return 1;
+ }
+ if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
+ {
+ my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
+ return 1;
+ }
- plugin->state= PLUGIN_IS_DELETED;
- if (plugin->ref_count)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
- else
- reap_needed= true;
+ plugin->state= PLUGIN_IS_DELETED;
+ if (plugin->ref_count)
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
+ else
+ reap_needed= true;
+ }
uchar user_key[MAX_KEY_LENGTH];
table->use_all_columns();
@@ -2260,6 +2264,11 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
return 1;
}
}
+ else if (!plugin)
+ {
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
+ return 1;
+ }
return 0;
}
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index 20113444b64..43fe540731e 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -184,7 +184,8 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_trx_order_before,
wsrep_unlock_rollback,
wsrep_set_data_home_dir,
- wsrep_thd_is_applier
+ wsrep_thd_is_applier,
+ wsrep_report_bf_lock_wait
};
static struct thd_specifics_service_st thd_specifics_handler=
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index cc78c324a2b..4bf8142959d 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -123,6 +123,9 @@ When one supplies long data for a placeholder:
#include "transaction.h" // trans_rollback_implicit
#include "wsrep_mysqld.h"
+/* Constants defining bits in parameter type flags. Flags are read from high byte of short value */
+static const uint PARAMETER_FLAG_UNSIGNED = 128U << 8;
+
/**
A result class used to send cursor rows using the binary protocol.
*/
@@ -903,6 +906,8 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
if (param->convert_str_value(thd))
DBUG_RETURN(1); /* out of memory */
+
+ param->sync_clones();
}
if (acc.finalize())
DBUG_RETURN(1);
@@ -1001,11 +1006,73 @@ static bool insert_bulk_params(Prepared_statement *stmt,
DBUG_RETURN(0);
}
-static bool set_conversion_functions(Prepared_statement *stmt,
- uchar **data, uchar *data_end)
+
+/**
+ Checking if parameter type and flags are valid
+
+ @param typecode ushort value with type in low byte, and flags in high byte
+
+ @retval true this parameter is wrong
+ @retval false this parameter is OK
+*/
+
+static bool
+parameter_type_sanity_check(ushort typecode)
+{
+ /* Checking if type in lower byte is valid */
+ switch (typecode & 0xff) {
+ case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_LONGLONG:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_YEAR:
+ case MYSQL_TYPE_BIT:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ case MYSQL_TYPE_NULL:
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ case MYSQL_TYPE_GEOMETRY:
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_NEWDATE:
+ break;
+ /*
+ This types normally cannot be sent by client, so maybe it'd be
+ better to treat them like an error here.
+ */
+ case MYSQL_TYPE_TIMESTAMP2:
+ case MYSQL_TYPE_TIME2:
+ case MYSQL_TYPE_DATETIME2:
+ default:
+ return true;
+ };
+
+ // In Flags in high byte only unsigned bit may be set
+ if (typecode & ((~PARAMETER_FLAG_UNSIGNED) & 0x0000ff00))
+ {
+ return true;
+ }
+ return false;
+}
+
+static bool
+set_conversion_functions(Prepared_statement *stmt, uchar **data)
{
uchar *read_pos= *data;
- const uint signed_bit= 1 << 15;
+
DBUG_ENTER("set_conversion_functions");
/*
First execute or types altered by the client, setup the
@@ -1018,12 +1085,17 @@ static bool set_conversion_functions(Prepared_statement *stmt,
{
ushort typecode;
- if (read_pos >= data_end)
- DBUG_RETURN(1);
-
+ /*
+ stmt_execute_packet_sanity_check has already verified, that there
+ are enough data in the packet for data types
+ */
typecode= sint2korr(read_pos);
read_pos+= 2;
- (**it).unsigned_flag= MY_TEST(typecode & signed_bit);
+ if (parameter_type_sanity_check(typecode))
+ {
+ DBUG_RETURN(1);
+ }
+ (**it).unsigned_flag= MY_TEST(typecode & PARAMETER_FLAG_UNSIGNED);
setup_one_conversion_function(thd, *it, (uchar) (typecode & 0xff));
(*it)->sync_clones();
}
@@ -1033,7 +1105,7 @@ static bool set_conversion_functions(Prepared_statement *stmt,
static bool setup_conversion_functions(Prepared_statement *stmt,
- uchar **data, uchar *data_end,
+ uchar **data,
bool bulk_protocol= 0)
{
/* skip null bits */
@@ -1046,7 +1118,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt,
if (*read_pos++) //types supplied / first execute
{
*data= read_pos;
- bool res= set_conversion_functions(stmt, data, data_end);
+ bool res= set_conversion_functions(stmt, data);
DBUG_RETURN(res);
}
*data= read_pos;
@@ -3123,7 +3195,10 @@ static void reset_stmt_params(Prepared_statement *stmt)
Item_param **item= stmt->param_array;
Item_param **end= item + stmt->param_count;
for (;item < end ; ++item)
+ {
(**item).reset();
+ (**item).sync_clones();
+ }
}
@@ -3154,11 +3229,19 @@ static void mysql_stmt_execute_common(THD *thd,
void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
{
+ const uint packet_min_lenght= 9;
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
+
+ DBUG_ENTER("mysqld_stmt_execute");
+
+ if (packet_length < packet_min_lenght)
+ {
+ my_error(ER_MALFORMED_PACKET, MYF(0));
+ DBUG_VOID_RETURN;
+ }
ulong stmt_id= uint4korr(packet);
ulong flags= (ulong) packet[4];
uchar *packet_end= packet + packet_length;
- DBUG_ENTER("mysqld_stmt_execute");
packet+= 9; /* stmt_id + 5 bytes of flags */
@@ -3188,10 +3271,19 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
void mysqld_stmt_bulk_execute(THD *thd, char *packet_arg, uint packet_length)
{
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
+ DBUG_ENTER("mysqld_stmt_execute_bulk");
+
+ const uint packet_header_lenght= 4 + 2; //ID & 2 bytes of flags
+
+ if (packet_length < packet_header_lenght)
+ {
+ my_error(ER_MALFORMED_PACKET, MYF(0));
+ DBUG_VOID_RETURN;
+ }
+
ulong stmt_id= uint4korr(packet);
uint flags= (uint) uint2korr(packet + 4);
uchar *packet_end= packet + packet_length;
- DBUG_ENTER("mysqld_stmt_execute_bulk");
if (!(thd->client_capabilities &
MARIADB_CLIENT_STMT_BULK_OPERATIONS))
@@ -3199,21 +3291,103 @@ void mysqld_stmt_bulk_execute(THD *thd, char *packet_arg, uint packet_length)
DBUG_PRINT("error",
("An attempt to execute bulk operation without support"));
my_error(ER_UNSUPPORTED_PS, MYF(0));
+ DBUG_VOID_RETURN;
}
/* Check for implemented parameters */
if (flags & (~STMT_BULK_FLAG_CLIENT_SEND_TYPES))
{
DBUG_PRINT("error", ("unsupported bulk execute flags %x", flags));
my_error(ER_UNSUPPORTED_PS, MYF(0));
+ DBUG_VOID_RETURN;
}
/* stmt id and two bytes of flags */
- packet+= 4 + 2;
+ packet+= packet_header_lenght;
mysql_stmt_execute_common(thd, stmt_id, packet, packet_end, 0, TRUE,
(flags & STMT_BULK_FLAG_CLIENT_SEND_TYPES));
DBUG_VOID_RETURN;
}
+/**
+ Additional packet checks for direct execution
+
+ @param thd THD handle
+ @param stmt prepared statement being directly executed
+ @param paket packet with parameters to bind
+ @param packet_end pointer to the byte after parameters end
+ @param bulk_op is it bulk operation
+ @param direct_exec is it direct execution
+ @param read_bytes need to read types (only with bulk_op)
+
+ @retval true this parameter is wrong
+ @retval false this parameter is OK
+*/
+
+static bool
+stmt_execute_packet_sanity_check(Prepared_statement *stmt,
+ uchar *packet, uchar *packet_end,
+ bool bulk_op, bool direct_exec,
+ bool read_types)
+{
+
+ DBUG_ASSERT((!read_types) || (read_types && bulk_op));
+ if (stmt->param_count > 0)
+ {
+ uint packet_length= static_cast<uint>(packet_end - packet);
+ uint null_bitmap_bytes= (bulk_op ? 0 : (stmt->param_count + 7)/8);
+ uint min_len_for_param_count = null_bitmap_bytes
+ + (bulk_op ? 0 : 1); /* sent types byte */
+
+ if (!bulk_op && packet_length >= min_len_for_param_count)
+ {
+ if ((read_types= packet[null_bitmap_bytes]))
+ {
+ /*
+ Should be 0 or 1. If the byte is not 1, that could mean,
+ e.g. that we read incorrect byte due to incorrect number
+ of sent parameters for direct execution (i.e. null bitmap
+ is shorter or longer, than it should be)
+ */
+ if (packet[null_bitmap_bytes] != '\1')
+ {
+ return true;
+ }
+ }
+ }
+
+ if (read_types)
+ {
+ /* 2 bytes per parameter of the type and flags */
+ min_len_for_param_count+= 2*stmt->param_count;
+ }
+ else
+ {
+ /*
+ If types are not sent, there is nothing to do here.
+ But for direct execution types should always be sent
+ */
+ return direct_exec;
+ }
+
+ /*
+ If true, the packet is guaranteed too short for the number of
+ parameters in the PS
+ */
+ return (packet_length < min_len_for_param_count);
+ }
+ else
+ {
+ /*
+ If there is no parameters, this should be normally already end
+ of the packet, but it is not a problem if something left (popular
+ mistake in protocol implementation) because we will not read anymore
+ from the buffer.
+ */
+ return false;
+ }
+ return false;
+}
+
/**
Common part of prepared statement execution
@@ -3253,6 +3427,22 @@ static void mysql_stmt_execute_common(THD *thd,
llstr(stmt_id, llbuf), "mysqld_stmt_execute");
DBUG_VOID_RETURN;
}
+
+ /*
+ In case of direct execution application decides how many parameters
+ to send.
+
+ Thus extra checks are required to prevent crashes caused by incorrect
+ interpretation of the packet data. Plus there can be always a broken
+ evil client.
+ */
+ if (stmt_execute_packet_sanity_check(stmt, packet, packet_end, bulk_op,
+ stmt_id == LAST_STMT_ID, read_types))
+ {
+ my_error(ER_MALFORMED_PACKET, MYF(0));
+ DBUG_VOID_RETURN;
+ }
+
stmt->read_types= read_types;
#if defined(ENABLED_PROFILING)
@@ -3877,7 +4067,7 @@ Prepared_statement::~Prepared_statement()
free_items();
if (lex)
{
- delete lex->sphead;
+ sp_head::destroy(lex->sphead);
delete lex->result;
delete (st_lex_local *) lex;
}
@@ -4163,7 +4353,7 @@ Prepared_statement::set_parameters(String *expanded_query,
{
#ifndef EMBEDDED_LIBRARY
uchar *null_array= packet;
- res= (setup_conversion_functions(this, &packet, packet_end) ||
+ res= (setup_conversion_functions(this, &packet) ||
set_params(this, null_array, packet, packet_end, expanded_query));
#else
/*
@@ -4385,7 +4575,7 @@ Prepared_statement::execute_bulk_loop(String *expanded_query,
return TRUE;
}
- if (!(sql_command_flags[lex->sql_command] & CF_SP_BULK_SAFE))
+ if (!(sql_command_flags[lex->sql_command] & CF_PS_ARRAY_BINDING_SAFE))
{
DBUG_PRINT("error", ("Command is not supported in bulk execution."));
my_error(ER_UNSUPPORTED_PS, MYF(0));
@@ -4395,7 +4585,7 @@ Prepared_statement::execute_bulk_loop(String *expanded_query,
#ifndef EMBEDDED_LIBRARY
if (read_types &&
- set_conversion_functions(this, &packet, packet_end))
+ set_conversion_functions(this, &packet))
#else
// bulk parameters are not supported for embedded, so it will an error
#endif
@@ -4427,7 +4617,7 @@ Prepared_statement::execute_bulk_loop(String *expanded_query,
Here we set parameters for not optimized commands,
optimized commands do it inside thier internal loop.
*/
- if (!(sql_command_flags[lex->sql_command] & CF_SP_BULK_OPTIMIZED))
+ if (!(sql_command_flags[lex->sql_command] & CF_PS_ARRAY_BINDING_OPTIMIZED))
{
if (set_bulk_parameters(TRUE))
{
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 294dcc61713..4af8ebc2dd8 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2038,9 +2038,13 @@ static int init_binlog_sender(binlog_send_info *info,
});
if (global_system_variables.log_warnings > 1)
+ {
sql_print_information(
- "Start binlog_dump to slave_server(%lu), pos(%s, %lu)",
- thd->variables.server_id, log_ident, (ulong)*pos);
+ "Start binlog_dump to slave_server(%lu), pos(%s, %lu), "
+ "using_gtid(%d), gtid('%s')", thd->variables.server_id,
+ log_ident, (ulong)*pos, info->using_gtid_state,
+ connect_gtid_state.c_ptr_quick());
+ }
#ifndef DBUG_OFF
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
@@ -3858,8 +3862,14 @@ bool mysql_show_binlog_events(THD* thd)
{
Protocol *protocol= thd->protocol;
List<Item> field_list;
+ char errmsg_buf[MYSYS_ERRMSG_SIZE];
const char *errmsg = 0;
bool ret = TRUE;
+ /*
+ Using checksum validate the correctness of event pos specified in show
+ binlog events command.
+ */
+ bool verify_checksum_once= false;
IO_CACHE log;
File file = -1;
MYSQL_BIN_LOG *binary_log= NULL;
@@ -3867,6 +3877,9 @@ bool mysql_show_binlog_events(THD* thd)
Master_info *mi= 0;
LOG_INFO linfo;
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
+ enum enum_binlog_checksum_alg checksum_alg;
+ my_off_t binlog_size;
+ MY_STAT s;
DBUG_ENTER("mysql_show_binlog_events");
@@ -3938,6 +3951,17 @@ bool mysql_show_binlog_events(THD* thd)
if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0)
goto err;
+ my_stat(linfo.log_file_name, &s, MYF(0));
+ binlog_size= s.st_size;
+ if (lex_mi->pos > binlog_size)
+ {
+ sprintf(errmsg_buf, "Invalid pos specified. Requested from pos:%llu is "
+ "greater than actual file size:%lu\n", lex_mi->pos,
+ (ulong)s.st_size);
+ errmsg= errmsg_buf;
+ goto err;
+ }
+
/*
to account binlog event header size
*/
@@ -3989,20 +4013,57 @@ bool mysql_show_binlog_events(THD* thd)
}
}
- my_b_seek(&log, pos);
+ if (lex_mi->pos > BIN_LOG_HEADER_SIZE)
+ {
+ checksum_alg= description_event->checksum_alg;
+ /* Validate user given position using checksum */
+ if (checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
+ checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
+ {
+ if (!opt_master_verify_checksum)
+ verify_checksum_once= true;
+ my_b_seek(&log, pos);
+ }
+ else
+ {
+ my_off_t cur_pos= my_b_tell(&log);
+ ulong next_event_len= 0;
+ uchar buff[IO_SIZE];
+ while (cur_pos < pos)
+ {
+ my_b_seek(&log, cur_pos + EVENT_LEN_OFFSET);
+ if (my_b_read(&log, (uchar *)buff, sizeof(next_event_len)))
+ {
+ mysql_mutex_unlock(log_lock);
+ errmsg = "Could not read event_length";
+ goto err;
+ }
+ next_event_len= uint4korr(buff);
+ cur_pos= cur_pos + next_event_len;
+ }
+ if (cur_pos > pos)
+ {
+ mysql_mutex_unlock(log_lock);
+ errmsg= "Invalid input pos specified please provide valid one.";
+ goto err;
+ }
+ my_b_seek(&log, cur_pos);
+ }
+ }
for (event_count = 0;
(ev = Log_event::read_log_event(&log, (mysql_mutex_t*) 0,
description_event,
- opt_master_verify_checksum)); )
+ (opt_master_verify_checksum ||
+ verify_checksum_once))); )
{
if (event_count >= limit_start &&
- ev->net_send(protocol, linfo.log_file_name, pos))
+ ev->net_send(protocol, linfo.log_file_name, pos))
{
- errmsg = "Net error";
- delete ev;
+ errmsg = "Net error";
+ delete ev;
mysql_mutex_unlock(log_lock);
- goto err;
+ goto err;
}
if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT)
@@ -4028,10 +4089,11 @@ bool mysql_show_binlog_events(THD* thd)
delete ev;
}
+ verify_checksum_once= false;
pos = my_b_tell(&log);
if (++event_count >= limit_end)
- break;
+ break;
}
if (event_count < limit_end && log.error)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b8f23cd135b..3b090093060 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -383,11 +383,14 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
If LIMIT ROWS EXAMINED interrupted query execution, issue a warning,
continue with normal processing and produce an incomplete query result.
*/
+ bool saved_abort_on_warning= thd->abort_on_warning;
+ thd->abort_on_warning= false;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT,
ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
+ thd->abort_on_warning= saved_abort_on_warning;
thd->reset_killed();
}
/* Disable LIMIT ROWS EXAMINED after query execution. */
@@ -1109,11 +1112,11 @@ int JOIN::optimize()
if (optimization_state != JOIN::NOT_OPTIMIZED)
return FALSE;
optimization_state= JOIN::OPTIMIZATION_IN_PROGRESS;
+ create_explain_query_if_not_exists(thd->lex, thd->mem_root);
int res= optimize_inner();
if (!res && have_query_plan != QEP_DELETED)
{
- create_explain_query_if_not_exists(thd->lex, thd->mem_root);
have_query_plan= QEP_AVAILABLE;
/*
@@ -1447,6 +1450,7 @@ JOIN::optimize_inner()
zero_result_cause= "Zero limit";
}
table_count= top_join_tab_count= 0;
+ handle_implicit_grouping_with_window_funcs();
error= 0;
goto setup_subq_exit;
}
@@ -1502,6 +1506,7 @@ JOIN::optimize_inner()
zero_result_cause= "No matching min/max row";
table_count= top_join_tab_count= 0;
error=0;
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
if (res > 1)
@@ -1517,6 +1522,7 @@ JOIN::optimize_inner()
tables_list= 0; // All tables resolved
select_lex->min_max_opt_list.empty();
const_tables= top_join_tab_count= table_count;
+ handle_implicit_grouping_with_window_funcs();
/*
Extract all table-independent conditions and replace the WHERE
clause with them. All other conditions were computed by opt_sum_query
@@ -1615,6 +1621,7 @@ JOIN::optimize_inner()
zero_result_cause= "no matching row in const table";
DBUG_PRINT("error",("Error: %s", zero_result_cause));
error= 0;
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
if (!(thd->variables.option_bits & OPTION_BIG_SELECTS) &&
@@ -1639,6 +1646,7 @@ JOIN::optimize_inner()
zero_result_cause=
"Impossible WHERE noticed after reading const tables";
select_lex->mark_const_derived(zero_result_cause);
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
@@ -1781,6 +1789,7 @@ JOIN::optimize_inner()
zero_result_cause=
"Impossible WHERE noticed after reading const tables";
select_lex->mark_const_derived(zero_result_cause);
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
@@ -2008,11 +2017,16 @@ JOIN::optimize_inner()
}
need_tmp= test_if_need_tmp_table();
- //TODO this could probably go in test_if_need_tmp_table.
- if (this->select_lex->window_specs.elements > 0) {
- need_tmp= TRUE;
+
+ /*
+ If window functions are present then we can't have simple_order set to
+ TRUE as the window function needs a temp table for computation.
+ ORDER BY is computed after the window function computation is done, so
+ the sort will be done on the temp table.
+ */
+ if (select_lex->have_window_funcs())
simple_order= FALSE;
- }
+
/*
If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table
@@ -2204,8 +2218,12 @@ JOIN::optimize_inner()
having_is_correlated= MY_TEST(having->used_tables() & OUTER_REF_TABLE_BIT);
tmp_having= having;
- if ((select_lex->options & OPTION_SCHEMA_TABLE))
- optimize_schema_tables_reads(this);
+ if ((select_lex->options & OPTION_SCHEMA_TABLE) &&
+ optimize_schema_tables_reads(this))
+ DBUG_RETURN(TRUE);
+
+ if (unlikely(thd->is_error()))
+ DBUG_RETURN(TRUE);
/*
The loose index scan access method guarantees that all grouping or
@@ -4593,7 +4611,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
for (i= 0; i < join->table_count ; i++)
if (double rr= join->best_positions[i].records_read)
records= COST_MULT(records, rr);
- ha_rows rows= records > HA_ROWS_MAX ? HA_ROWS_MAX : (ha_rows) records;
+ ha_rows rows= records > (double) HA_ROWS_MAX ? HA_ROWS_MAX : (ha_rows) records;
set_if_smaller(rows, unit->select_limit_cnt);
join->select_lex->increase_derived_records(rows);
}
@@ -5982,6 +6000,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
uint n_tables= my_count_bits(map);
if (n_tables == 1) // Only one table
{
+ DBUG_ASSERT(!(map & PSEUDO_TABLE_BITS)); // Must be a real table
Table_map_iterator it(map);
int tablenr= it.next_bit();
DBUG_ASSERT(tablenr != Table_map_iterator::BITMAP_END);
@@ -12375,24 +12394,7 @@ void JOIN::cleanup(bool full)
for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); tab;
tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
{
- if (!tab->table)
- continue;
- DBUG_PRINT("info", ("close index: %s.%s alias: %s",
- tab->table->s->db.str,
- tab->table->s->table_name.str,
- tab->table->alias.c_ptr()));
- if (tab->table->is_created())
- {
- tab->table->file->ha_index_or_rnd_end();
- if (tab->aggr)
- {
- int tmp= 0;
- if ((tmp= tab->table->file->extra(HA_EXTRA_NO_CACHE)))
- tab->table->file->print_error(tmp, MYF(0));
- }
- }
- delete tab->filesort_result;
- tab->filesort_result= NULL;
+ tab->partial_cleanup();
}
}
}
@@ -13857,12 +13859,15 @@ static int compare_fields_by_table_order(Item *field1,
{
int cmp= 0;
bool outer_ref= 0;
- Item_field *f1= (Item_field *) (field1->real_item());
- Item_field *f2= (Item_field *) (field2->real_item());
- if (field1->const_item() || f1->const_item())
+ Item *field1_real= field1->real_item();
+ Item *field2_real= field2->real_item();
+
+ if (field1->const_item() || field1_real->const_item())
return -1;
- if (field2->const_item() || f2->const_item())
+ if (field2->const_item() || field2_real->const_item())
return 1;
+ Item_field *f1= (Item_field *) field1_real;
+ Item_field *f2= (Item_field *) field2_real;
if (f1->used_tables() & OUTER_REF_TABLE_BIT)
{
outer_ref= 1;
@@ -14354,7 +14359,7 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
}
}
else if (cond->type() == Item::FUNC_ITEM &&
- ((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
+ ((Item_func*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
{
item_equal= (Item_equal *) cond;
item_equal->sort(&compare_fields_by_table_order, table_join_idx);
@@ -18225,7 +18230,8 @@ void set_postjoin_aggr_write_func(JOIN_TAB *tab)
}
}
else if (join->sort_and_group && !tmp_tbl->precomputed_group_by &&
- !join->sort_and_group_aggr_tab && join->tables_list)
+ !join->sort_and_group_aggr_tab && join->tables_list &&
+ join->top_join_tab_count)
{
DBUG_PRINT("info",("Using end_write_group"));
aggr->set_write_func(end_write_group);
@@ -19865,7 +19871,7 @@ join_read_last(JOIN_TAB *tab)
{
TABLE *table=tab->table;
int error= 0;
- DBUG_ENTER("join_read_first");
+ DBUG_ENTER("join_read_last");
DBUG_ASSERT(table->no_keyread ||
!table->covering_keys.is_set(tab->index) ||
@@ -21921,6 +21927,9 @@ check_reverse_order:
else if (select && select->quick)
select->quick->need_sorted_output();
+ tab->read_record.unlock_row= (tab->type == JT_EQ_REF) ?
+ join_read_key_unlock_row : rr_unlock_row;
+
} // QEP has been modified
/*
@@ -22689,10 +22698,13 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, List<Item> &all_fields, ORDER *order,
bool from_window_spec)
{
+ SELECT_LEX *select = thd->lex->current_select;
enum_parsing_place context_analysis_place=
thd->lex->current_select->context_analysis_place;
thd->where="order clause";
- for (; order; order=order->next)
+ const bool for_union = select->master_unit()->is_union() &&
+ select == select->master_unit()->fake_select_lex;
+ for (uint number = 1; order; order=order->next, number++)
{
if (find_order_in_list(thd, ref_pointer_array, tables, order, fields,
all_fields, false, true, from_window_spec))
@@ -22703,6 +22715,18 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0));
return 1;
}
+
+ /*
+ UNION queries cannot be used with an aggregate function in
+ an ORDER BY clause
+ */
+
+ if (for_union && (*order->item)->with_sum_func)
+ {
+ my_error(ER_AGGREGATE_ORDER_FOR_UNION, MYF(0), number);
+ return 1;
+ }
+
if (from_window_spec && (*order->item)->with_sum_func &&
(*order->item)->type() != Item::SUM_FUNC_ITEM)
(*order->item)->split_sum_func(thd, ref_pointer_array,
@@ -23624,7 +23648,8 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
for (uint i= 0; (item= it++); i++)
{
Field *field;
- if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
+ if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) ||
+ item->with_window_func)
item_field= item;
else if (item->type() == Item::FIELD_ITEM)
item_field= item->get_tmp_table_item(thd);
@@ -26924,6 +26949,62 @@ Item *remove_pushed_top_conjuncts(THD *thd, Item *cond)
return cond;
}
+/*
+ There are 5 cases in which we shortcut the join optimization process as we
+ conclude that the join would be a degenerate one
+ 1) IMPOSSIBLE WHERE
+ 2) MIN/MAX optimization (@see opt_sum_query)
+ 3) EMPTY CONST TABLE
+ If a window function is present in any of the above cases then to get the
+ result of the window function, we need to execute it. So we need to
+ create a temporary table for its execution. Here we need to take in mind
+ that aggregate functions and non-aggregate function need not be executed.
+
+*/
+
+
+void JOIN::handle_implicit_grouping_with_window_funcs()
+{
+ if (select_lex->have_window_funcs() && send_row_on_empty_set())
+ {
+ const_tables= top_join_tab_count= table_count= 0;
+ }
+}
+
+
+/*
+ @brief
+ Perform a partial cleanup for the JOIN_TAB structure
+
+ @note
+ this is used to cleanup resources for the re-execution of correlated
+ subqueries.
+*/
+void JOIN_TAB::partial_cleanup()
+{
+ if (!table)
+ return;
+
+ if (table->is_created())
+ {
+ table->file->ha_index_or_rnd_end();
+ DBUG_PRINT("info", ("close index: %s.%s alias: %s",
+ table->s->db.str,
+ table->s->table_name.str,
+ table->alias.c_ptr()));
+ if (aggr)
+ {
+ int tmp= 0;
+ if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE)))
+ table->file->print_error(tmp, MYF(0));
+ }
+ }
+ delete filesort_result;
+ filesort_result= NULL;
+ free_cache(&read_record);
+}
+
+
/**
@} (end of group Query_Optimizer)
*/
diff --git a/sql/sql_select.h b/sql/sql_select.h
index fe44f448446..4584460ca3f 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2020, 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
@@ -613,7 +613,7 @@ typedef struct st_join_table {
bool use_order() const; ///< Use ordering provided by chosen index?
bool sort_table();
bool remove_duplicates();
-
+ void partial_cleanup();
} JOIN_TAB;
@@ -1057,6 +1057,7 @@ protected:
void restore_query_plan(Join_plan_state *restore_from);
/* Choose a subquery plan for a table-less subquery. */
bool choose_tableless_subquery_plan();
+ void handle_implicit_grouping_with_window_funcs();
public:
JOIN_TAB *join_tab, **best_ref;
@@ -1553,6 +1554,9 @@ public:
void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr)
{
DBUG_ASSERT(dst_arr.size() >= src_arr.size());
+ if (src_arr.size() == 0)
+ return;
+
void *dest= dst_arr.array();
const void *src= src_arr.array();
memcpy(dest, src, src_arr.size() * src_arr.element_size());
@@ -1632,6 +1636,7 @@ public:
- We are using an ORDER BY or GROUP BY on fields not in the first table
- We are using different ORDER BY and GROUP BY orders
- The user wants us to buffer the result.
+ - We are using WINDOW functions.
When the WITH ROLLUP modifier is present, we cannot skip temporary table
creation for the DISTINCT clause just because there are only const tables.
*/
@@ -1641,7 +1646,8 @@ public:
((select_distinct || !simple_order || !simple_group) ||
(group_list && order) ||
MY_TEST(select_options & OPTION_BUFFER_RESULT))) ||
- (rollup.state != ROLLUP::STATE_NONE && select_distinct));
+ (rollup.state != ROLLUP::STATE_NONE && select_distinct) ||
+ select_lex->have_window_funcs());
}
bool choose_subquery_plan(table_map join_tables);
void get_partial_cost_and_fanout(int end_tab_idx,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index f54a9af5441..5544c765775 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -4430,7 +4430,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
Again we don't do this for SHOW COLUMNS/KEYS because
of backward compatibility.
*/
- if (!is_show_fields_or_keys && result &&
+ if (!is_show_fields_or_keys && result && thd->is_error() &&
(thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT))
{
@@ -5079,6 +5079,29 @@ bool store_schema_shemata(THD* thd, TABLE *table, LEX_STRING *db_name,
}
+/*
+ Check if the specified database exists on disk.
+
+ @param dbname - the database name
+ @retval true - on error, the database directory does not exists
+ @retval false - on success, the database directory exists
+*/
+static bool verify_database_directory_exists(const LEX_STRING &dbname)
+{
+ DBUG_ENTER("verify_database_directory_exists");
+ char path[FN_REFLEN + 16];
+ uint path_len;
+ MY_STAT stat_info;
+ if (!dbname.str[0])
+ DBUG_RETURN(true); // Empty database name: does not exist.
+ path_len= build_table_filename(path, sizeof(path) - 1, dbname.str, "", "", 0);
+ path[path_len - 1]= 0;
+ if (!mysql_file_stat(key_file_misc, path, &stat_info, MYF(0)))
+ DBUG_RETURN(true); // The database directory was not found: does not exist.
+ DBUG_RETURN(false); // The database directory was found.
+}
+
+
int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
{
/*
@@ -5107,19 +5130,10 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
If we have lookup db value we should check that the database exists
*/
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value &&
- db_names.at(0) != &INFORMATION_SCHEMA_NAME)
- {
- char path[FN_REFLEN+16];
- uint path_len;
- MY_STAT stat_info;
- if (!lookup_field_vals.db_value.str[0])
- DBUG_RETURN(0);
- path_len= build_table_filename(path, sizeof(path) - 1,
- lookup_field_vals.db_value.str, "", "", 0);
- path[path_len-1]= 0;
- if (!mysql_file_stat(key_file_misc, path, &stat_info, MYF(0)))
- DBUG_RETURN(0);
- }
+ (!db_names.elements() /* The database name was too long */||
+ (db_names.at(0) != &INFORMATION_SCHEMA_NAME &&
+ verify_database_directory_exists(lookup_field_vals.db_value))))
+ DBUG_RETURN(0);
for (size_t i=0; i < db_names.elements(); i++)
{
@@ -5600,15 +5614,21 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
rather than in SHOW COLUMNS
*/
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- thd->get_stmt_da()->sql_errno(),
- thd->get_stmt_da()->message());
- thd->clear_error();
+ if (thd->is_error())
+ {
+ /*
+ The the query was aborted because examined rows exceeded limit.
+ Don't send the warning here. It is done later, in handle_select().
+ */
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ thd->get_stmt_da()->sql_errno(),
+ thd->get_stmt_da()->message());
+ thd->clear_error();
+ }
res= 0;
}
DBUG_RETURN(res);
}
-
show_table= tables->table;
count= 0;
ptr= show_table->field;
@@ -5994,7 +6014,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
{
free_table_share(&share);
if (free_sp_head)
- delete sp;
+ sp_head::destroy(sp);
DBUG_RETURN(1);
}
}
@@ -6045,7 +6065,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
}
}
if (free_sp_head)
- delete sp;
+ sp_head::destroy(sp);
}
free_table_share(&share);
DBUG_RETURN(error);
@@ -6131,7 +6151,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
store_column_type(table, field, cs, 5);
free_table_share(&share);
if (free_sp_head)
- delete sp;
+ sp_head::destroy(sp);
}
}
@@ -6526,7 +6546,7 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
LEX_STRING *table_name)
{
DBUG_ENTER("get_check_constraints_record");
- if(res)
+ if (res)
{
if (thd->is_error())
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -6535,15 +6555,32 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
thd->clear_error();
DBUG_RETURN(0);
}
- if(!tables->view)
+ if (!tables->view)
{
StringBuffer<MAX_FIELD_WIDTH> str(system_charset_info);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ TABLE_LIST table_acl_check;
+ bzero((char*) &table_acl_check, sizeof(table_acl_check));
+#endif
for (uint i= 0; i < tables->table->s->table_check_constraints; i++)
{
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!(thd->col_access & TABLE_ACLS))
+ {
+ table_acl_check.db= db_name->str;
+ table_acl_check.db_length= db_name->length;
+ table_acl_check.table_name= table_name->str;
+ table_acl_check.table_name_length= table_name->length;
+ table_acl_check.grant.privilege= thd->col_access;
+ if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE))
+ continue;
+ }
+#endif
Virtual_column_info *check= tables->table->check_constraints[i];
table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
table->field[3]->store(check->name.str, check->name.length,
system_charset_info);
+ /* Make sure the string is empty between each print. */
str.length(0);
check->print(&str);
table->field[4]->store(str.ptr(), str.length(), system_charset_info);
@@ -6551,8 +6588,7 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
DBUG_RETURN(1);
}
}
-
- DBUG_RETURN(0);
+ DBUG_RETURN(res);
}
static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
@@ -8283,7 +8319,6 @@ end:
bool optimize_schema_tables_reads(JOIN *join)
{
THD *thd= join->thd;
- bool result= 0;
DBUG_ENTER("optimize_schema_tables_reads");
JOIN_TAB *tab;
@@ -8318,11 +8353,11 @@ bool optimize_schema_tables_reads(JOIN *join)
*/
cond= tab->cache_select->cond;
}
-
- optimize_for_get_all_tables(thd, table_list, cond);
+ if (optimize_for_get_all_tables(thd, table_list, cond))
+ DBUG_RETURN(TRUE); // Handle OOM
}
}
- DBUG_RETURN(result);
+ DBUG_RETURN(FALSE);
}
@@ -9370,11 +9405,14 @@ ST_FIELD_INFO spatial_ref_sys_fields_info[]=
ST_FIELD_INFO check_constraints_fields_info[]=
{
{"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE }
+ {"CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
+ {"CHECK_CLAUSE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
/*
@@ -9393,7 +9431,7 @@ ST_SCHEMA_TABLE schema_tables[]=
{"CHARACTER_SETS", charsets_fields_info, 0,
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
{"CHECK_CONSTRAINTS", check_constraints_fields_info, 0, get_all_tables, 0,
- get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
+ get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
{"COLLATIONS", collation_fields_info, 0,
fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index f8723a4f8ee..d22921ba1e2 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1671,6 +1671,7 @@ public:
*/
virtual bool add()
{
+ table_field->mark_unused_memory_as_defined();
return tree->unique_add(table_field->ptr);
}
@@ -2107,8 +2108,8 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
sizeof(Index_statistics) * keys);
uint key_parts= table->s->ext_key_parts;
- ulong *idx_avg_frequency= (ulong*) alloc_root(&table->mem_root,
- sizeof(ulong) * key_parts);
+ ulonglong *idx_avg_frequency= (ulonglong*) alloc_root(&table->mem_root,
+ sizeof(ulonglong) * key_parts);
uint columns= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
@@ -2153,7 +2154,7 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
}
}
- memset(idx_avg_frequency, 0, sizeof(ulong) * key_parts);
+ memset(idx_avg_frequency, 0, sizeof(ulonglong) * key_parts);
KEY *key_info, *end;
for (key_info= table->key_info, end= key_info + table->s->keys;
@@ -2215,27 +2216,13 @@ static int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share)
DBUG_ENTER("alloc_statistics_for_table_share");
- DEBUG_SYNC(thd, "statistics_mem_alloc_start1");
- DEBUG_SYNC(thd, "statistics_mem_alloc_start2");
-
- mysql_mutex_lock(&table_share->LOCK_share);
-
- if (stats_cb->stats_can_be_read)
- {
- mysql_mutex_unlock(&table_share->LOCK_share);
- DBUG_RETURN(0);
- }
-
Table_statistics *table_stats= stats_cb->table_stats;
if (!table_stats)
{
table_stats= (Table_statistics *) alloc_root(&stats_cb->mem_root,
sizeof(Table_statistics));
if (!table_stats)
- {
- mysql_mutex_unlock(&table_share->LOCK_share);
DBUG_RETURN(1);
- }
memset(table_stats, 0, sizeof(Table_statistics));
stats_cb->table_stats= table_stats;
}
@@ -2283,14 +2270,14 @@ static int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share)
}
uint key_parts= table_share->ext_key_parts;
- ulong *idx_avg_frequency= table_stats->idx_avg_frequency;
+ ulonglong *idx_avg_frequency= table_stats->idx_avg_frequency;
if (!idx_avg_frequency)
{
- idx_avg_frequency= (ulong*) alloc_root(&stats_cb->mem_root,
- sizeof(ulong) * key_parts);
+ idx_avg_frequency= (ulonglong*) alloc_root(&stats_cb->mem_root,
+ sizeof(ulonglong) * key_parts);
if (idx_avg_frequency)
{
- memset(idx_avg_frequency, 0, sizeof(ulong) * key_parts);
+ memset(idx_avg_frequency, 0, sizeof(ulonglong) * key_parts);
table_stats->idx_avg_frequency= idx_avg_frequency;
for (key_info= table_share->key_info, end= key_info + keys;
key_info < end;
@@ -2301,89 +2288,11 @@ static int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share)
}
}
}
-
- if (column_stats && index_stats && idx_avg_frequency)
- stats_cb->stats_can_be_read= TRUE;
-
- mysql_mutex_unlock(&table_share->LOCK_share);
-
- DBUG_RETURN(0);
+ DBUG_RETURN(column_stats && index_stats && idx_avg_frequency ? 0 : 1);
}
/**
- @brief
- Allocate memory for the histogram used by a table share
-
- @param
- thd Thread handler
- @param
- table_share Table share for which the memory for histogram data is allocated
- @param
- is_safe TRUE <-> at any time only one thread can perform the function
-
- @note
- The function allocates the memory for the histogram built for a table in the
- table's share memory with the intention to read the data there from the
- system persistent statistical table mysql.column_stats,
- The memory is allocated in the table_share's mem_root.
- If the parameter is_safe is TRUE then it is guaranteed that at any given time
- only one thread is executed the code of the function.
-
- @retval
- 0 If the memory for all statistical data has been successfully allocated
- @retval
- 1 Otherwise
-
- @note
- Currently the function always is called with the parameter is_safe set
- to FALSE.
-*/
-
-static
-int alloc_histograms_for_table_share(THD* thd, TABLE_SHARE *table_share,
- bool is_safe)
-{
- TABLE_STATISTICS_CB *stats_cb= &table_share->stats_cb;
-
- DBUG_ENTER("alloc_histograms_for_table_share");
-
- if (!is_safe)
- mysql_mutex_lock(&table_share->LOCK_share);
-
- if (stats_cb->histograms_can_be_read)
- {
- if (!is_safe)
- mysql_mutex_unlock(&table_share->LOCK_share);
- DBUG_RETURN(0);
- }
-
- Table_statistics *table_stats= stats_cb->table_stats;
- ulong total_hist_size= table_stats->total_hist_size;
-
- if (total_hist_size && !table_stats->histograms)
- {
- uchar *histograms= (uchar *) alloc_root(&stats_cb->mem_root,
- total_hist_size);
- if (!histograms)
- {
- if (!is_safe)
- mysql_mutex_unlock(&table_share->LOCK_share);
- DBUG_RETURN(1);
- }
- memset(histograms, 0, total_hist_size);
- table_stats->histograms= histograms;
- stats_cb->histograms_can_be_read= TRUE;
- }
-
- if (!is_safe)
- mysql_mutex_unlock(&table_share->LOCK_share);
-
- DBUG_RETURN(0);
-
-}
-
-/**
@brief
Initialize the aggregation fields to collect statistics on a column
@@ -2928,15 +2837,26 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
Field **field_ptr;
KEY *key_info, *key_info_end;
TABLE_SHARE *table_share= table->s;
- Table_statistics *read_stats= table_share->stats_cb.table_stats;
enum_check_fields old_check_level= thd->count_cuted_fields;
DBUG_ENTER("read_statistics_for_table");
+ DEBUG_SYNC(thd, "statistics_mem_alloc_start1");
+ DEBUG_SYNC(thd, "statistics_mem_alloc_start2");
+
+ if (!table_share->stats_cb.start_stats_load())
+ DBUG_RETURN(table_share->stats_cb.stats_are_ready() ? 0 : 1);
+
+ if (alloc_statistics_for_table_share(thd, table_share))
+ {
+ table_share->stats_cb.abort_stats_load();
+ DBUG_RETURN(1);
+ }
/* Don't write warnings for internal field conversions */
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
/* Read statistics from the statistical table table_stats */
+ Table_statistics *read_stats= table_share->stats_cb.table_stats;
stat_table= stat_tables[TABLE_STAT].table;
Table_stat table_stat(stat_table, table);
table_stat.set_key_fields();
@@ -2953,7 +2873,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
column_stat.get_stat_values();
total_hist_size+= table_field->read_stats->histogram.get_size();
}
- read_stats->total_hist_size= total_hist_size;
+ table_share->stats_cb.total_hist_size= total_hist_size;
/* Read statistics from the statistical table index_stats */
stat_table= stat_tables[INDEX_STAT].table;
@@ -3015,9 +2935,8 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
}
- table->stats_is_read= TRUE;
thd->count_cuted_fields= old_check_level;
-
+ table_share->stats_cb.end_stats_load();
DBUG_RETURN(0);
}
@@ -3057,71 +2976,6 @@ void delete_stat_values_for_table_share(TABLE_SHARE *table_share)
/**
@brief
- Check whether any statistics is to be read for tables from a table list
-
- @param
- thd The thread handle
- @param
- tables The tables list for whose tables the check is to be done
-
- @details
- The function checks whether for any of the tables opened and locked for
- a statement statistics from statistical tables is needed to be read.
-
- @retval
- TRUE statistics for any of the tables is needed to be read
- @retval
- FALSE Otherwise
-*/
-
-static
-bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
-{
- if (!tables)
- return FALSE;
-
- /*
- Do not read statistics for any query that explicity involves
- statistical tables, failure to to do so we may end up
- in a deadlock.
- */
-
- for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
- {
- if (!tl->is_view_or_derived() && !is_temporary_table(tl) && tl->table)
- {
- TABLE_SHARE *table_share= tl->table->s;
- if (table_share &&
- table_share->table_category != TABLE_CATEGORY_USER
- && is_stat_table(tl->db, tl->alias))
- return FALSE;
- }
- }
-
- for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
- {
- if (!tl->is_view_or_derived() && !is_temporary_table(tl) && tl->table)
- {
- TABLE_SHARE *table_share= tl->table->s;
- if (table_share &&
- table_share->stats_cb.stats_can_be_read &&
- (!table_share->stats_cb.stats_is_read ||
- (!table_share->stats_cb.histograms_are_read &&
- thd->variables.optimizer_use_condition_selectivity > 3)))
- return TRUE;
- if (table_share->stats_cb.stats_is_read)
- tl->table->stats_is_read= TRUE;
- if (table_share->stats_cb.histograms_are_read)
- tl->table->histograms_are_read= TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-/**
- @brief
Read histogram for a table from the persistent statistical tables
@param
@@ -3155,26 +3009,25 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
static
int read_histograms_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
{
- TABLE_SHARE *table_share= table->s;
-
+ TABLE_STATISTICS_CB *stats_cb= &table->s->stats_cb;
DBUG_ENTER("read_histograms_for_table");
- if (!table_share->stats_cb.histograms_can_be_read)
+ if (stats_cb->start_histograms_load())
{
- (void) alloc_histograms_for_table_share(thd, table_share, FALSE);
- }
- if (table_share->stats_cb.histograms_can_be_read &&
- !table_share->stats_cb.histograms_are_read)
- {
- Field **field_ptr;
- uchar *histogram= table_share->stats_cb.table_stats->histograms;
- TABLE *stat_table= stat_tables[COLUMN_STAT].table;
- Column_stat column_stat(stat_table, table);
- for (field_ptr= table_share->field; *field_ptr; field_ptr++)
+ uchar *histogram= (uchar *) alloc_root(&stats_cb->mem_root,
+ stats_cb->total_hist_size);
+ if (!histogram)
+ {
+ stats_cb->abort_histograms_load();
+ DBUG_RETURN(1);
+ }
+ memset(histogram, 0, stats_cb->total_hist_size);
+
+ Column_stat column_stat(stat_tables[COLUMN_STAT].table, table);
+ for (Field **field_ptr= table->s->field; *field_ptr; field_ptr++)
{
Field *table_field= *field_ptr;
- uint hist_size= table_field->read_stats->histogram.get_size();
- if (hist_size)
+ if (uint hist_size= table_field->read_stats->histogram.get_size())
{
column_stat.set_key_fields(table_field);
table_field->read_stats->histogram.set_values(histogram);
@@ -3182,8 +3035,9 @@ int read_histograms_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
histogram+= hist_size;
}
}
+ stats_cb->end_histograms_load();
}
-
+ table->histograms_are_read= true;
DBUG_RETURN(0);
}
@@ -3231,6 +3085,23 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
}
+static void dump_stats_from_share_to_table(TABLE *table)
+{
+ TABLE_SHARE *table_share= table->s;
+ KEY *key_info= table_share->key_info;
+ KEY *key_info_end= key_info + table_share->keys;
+ KEY *table_key_info= table->key_info;
+ for ( ; key_info < key_info_end; key_info++, table_key_info++)
+ table_key_info->read_stats= key_info->read_stats;
+
+ Field **field_ptr= table_share->field;
+ Field **table_field_ptr= table->field;
+ for ( ; *field_ptr; field_ptr++, table_field_ptr++)
+ (*table_field_ptr)->read_stats= (*field_ptr)->read_stats;
+ table->stats_is_read= true;
+}
+
+
int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
{
TABLE_LIST stat_tables[STATISTICS_TABLES];
@@ -3241,38 +3112,42 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
if (thd->bootstrap || thd->variables.use_stat_tables == NEVER)
DBUG_RETURN(0);
+ bool found_stat_table= false;
+ bool statistics_for_tables_is_needed= false;
+
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{
- if (tl->table)
+ TABLE_SHARE *table_share;
+ if (!tl->is_view_or_derived() && tl->table && (table_share= tl->table->s) &&
+ table_share->tmp_table == NO_TMP_TABLE)
{
- TABLE_SHARE *table_share= tl->table->s;
- if (table_share && table_share->table_category == TABLE_CATEGORY_USER &&
- table_share->tmp_table == NO_TMP_TABLE)
+ if (table_share->table_category == TABLE_CATEGORY_USER)
{
- if (table_share->stats_cb.stats_can_be_read ||
- !alloc_statistics_for_table_share(thd, table_share))
+ if (table_share->stats_cb.stats_are_ready())
{
- if (table_share->stats_cb.stats_can_be_read)
- {
- KEY *key_info= table_share->key_info;
- KEY *key_info_end= key_info + table_share->keys;
- KEY *table_key_info= tl->table->key_info;
- for ( ; key_info < key_info_end; key_info++, table_key_info++)
- table_key_info->read_stats= key_info->read_stats;
- Field **field_ptr= table_share->field;
- Field **table_field_ptr= tl->table->field;
- for ( ; *field_ptr; field_ptr++, table_field_ptr++)
- (*table_field_ptr)->read_stats= (*field_ptr)->read_stats;
- tl->table->stats_is_read= table_share->stats_cb.stats_is_read;
- }
+ if (!tl->table->stats_is_read)
+ dump_stats_from_share_to_table(tl->table);
+ tl->table->histograms_are_read=
+ table_share->stats_cb.histograms_are_ready();
+ if (table_share->stats_cb.histograms_are_ready() ||
+ thd->variables.optimizer_use_condition_selectivity <= 3)
+ continue;
}
+ statistics_for_tables_is_needed= true;
}
+ else if (is_stat_table(tl->db, tl->alias))
+ found_stat_table= true;
}
}
DEBUG_SYNC(thd, "statistics_read_start");
- if (!statistics_for_tables_is_needed(thd, tables))
+ /*
+ Do not read statistics for any query that explicity involves
+ statistical tables, failure to to do so we may end up
+ in a deadlock.
+ */
+ if (found_stat_table || !statistics_for_tables_is_needed)
DBUG_RETURN(0);
if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE))
@@ -3280,32 +3155,22 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{
- if (!tl->is_view_or_derived() && !is_temporary_table(tl) && tl->table)
- {
- TABLE_SHARE *table_share= tl->table->s;
- if (table_share && !(table_share->table_category == TABLE_CATEGORY_USER))
- continue;
-
- if (table_share &&
- table_share->stats_cb.stats_can_be_read &&
- !table_share->stats_cb.stats_is_read)
+ TABLE_SHARE *table_share;
+ if (!tl->is_view_or_derived() && tl->table && (table_share= tl->table->s) &&
+ table_share->tmp_table == NO_TMP_TABLE &&
+ table_share->table_category == TABLE_CATEGORY_USER)
+ {
+ if (!tl->table->stats_is_read)
{
- (void) read_statistics_for_table(thd, tl->table, stat_tables);
- table_share->stats_cb.stats_is_read= TRUE;
+ if (!read_statistics_for_table(thd, tl->table, stat_tables))
+ dump_stats_from_share_to_table(tl->table);
+ else
+ continue;
}
- if (table_share->stats_cb.stats_is_read)
- tl->table->stats_is_read= TRUE;
- if (thd->variables.optimizer_use_condition_selectivity > 3 &&
- table_share && table_share->stats_cb.stats_can_be_read &&
- !table_share->stats_cb.histograms_are_read)
- {
+ if (thd->variables.optimizer_use_condition_selectivity > 3)
(void) read_histograms_for_table(thd, tl->table, stat_tables);
- table_share->stats_cb.histograms_are_read= TRUE;
- }
- if (table_share->stats_cb.histograms_are_read)
- tl->table->histograms_are_read= TRUE;
}
- }
+ }
close_system_tables(thd, &open_tables_backup);
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 81b3f7ac165..fa3e8d6b894 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -279,8 +279,9 @@ public:
uchar *min_max_record_buffers; /* Record buffers for min/max values */
Column_statistics *column_stats; /* Array of statistical data for columns */
Index_statistics *index_stats; /* Array of statistical data for indexes */
- ulong *idx_avg_frequency; /* Array of records per key for index prefixes */
- ulong total_hist_size; /* Total size of all histograms */
+
+ /* Array of records per key for index prefixes */
+ ulonglong *idx_avg_frequency;
uchar *histograms; /* Sequence of histograms */
};
@@ -332,7 +333,7 @@ private:
CHAR values are stripped of trailing spaces.
Flexible values are stripped of their length prefixes.
*/
- ulong avg_length;
+ ulonglong avg_length;
/*
The ratio N/D multiplied by the scale factor Scale_factor_avg_frequency,
@@ -340,7 +341,7 @@ private:
N is the number of rows with not null value in the column,
D the number of distinct values among them
*/
- ulong avg_frequency;
+ ulonglong avg_frequency;
public:
@@ -390,12 +391,12 @@ public:
void set_avg_length (double val)
{
- avg_length= (ulong) (val * Scale_factor_avg_length);
+ avg_length= (ulonglong) (val * Scale_factor_avg_length);
}
void set_avg_frequency (double val)
{
- avg_frequency= (ulong) (val * Scale_factor_avg_frequency);
+ avg_frequency= (ulonglong) (val * Scale_factor_avg_frequency);
}
bool min_max_values_are_provided()
@@ -434,11 +435,11 @@ private:
in the first k components, and D is the number of distinct
k-component prefixes among them
*/
- ulong *avg_frequency;
+ ulonglong *avg_frequency;
public:
- void init_avg_frequency(ulong *ptr) { avg_frequency= ptr; }
+ void init_avg_frequency(ulonglong *ptr) { avg_frequency= ptr; }
bool avg_frequency_is_inited() { return avg_frequency != NULL; }
@@ -449,7 +450,7 @@ public:
void set_avg_frequency(uint i, double val)
{
- avg_frequency[i]= (ulong) (val * Scale_factor_avg_frequency);
+ avg_frequency[i]= (ulonglong) (val * Scale_factor_avg_frequency);
}
};
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 177d2a77d09..b79ca82698b 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -826,7 +826,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
int stringcmp(const String *s,const String *t)
{
uint32 s_len=s->length(),t_len=t->length(),len=MY_MIN(s_len,t_len);
- int cmp= memcmp(s->ptr(), t->ptr(), len);
+ int cmp= len ? memcmp(s->ptr(), t->ptr(), len) : 0;
return (cmp) ? cmp : (int) (s_len - t_len);
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index e1d64722898..512c5537840 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -3,7 +3,7 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2020, 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
@@ -79,6 +79,10 @@ public:
Well_formed_prefix(CHARSET_INFO *cs, const char *str, size_t length)
:Well_formed_prefix_status(cs, str, str + length, length), m_str(str)
{ }
+ Well_formed_prefix(CHARSET_INFO *cs, LEX_STRING str, size_t nchars)
+ :Well_formed_prefix_status(cs, str.str, str.str + str.length, nchars),
+ m_str(str.str)
+ { }
size_t length() const { return m_source_end_pos - m_str; }
};
@@ -551,7 +555,8 @@ public:
}
void q_append(const char *data, size_t data_len)
{
- memcpy(Ptr + str_length, data, data_len);
+ if (data_len)
+ memcpy(Ptr + str_length, data, data_len);
DBUG_ASSERT(str_length <= UINT_MAX32 - data_len);
str_length += (uint)data_len;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 4ad68d9d03b..57284272316 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2010, 2019, MariaDB
+ Copyright (c) 2010, 2020, 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
@@ -4196,10 +4196,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
continue;
{
- /* Check that there's no repeating constraint names. */
+ /* Check that there's no repeating table CHECK constraint names. */
List_iterator_fast<Virtual_column_info>
dup_it(alter_info->check_constraint_list);
- Virtual_column_info *dup_check;
+ const Virtual_column_info *dup_check;
while ((dup_check= dup_it++) && dup_check != check)
{
if (check->name.length == dup_check->name.length &&
@@ -4212,6 +4212,27 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
+ /* Check that there's no repeating key constraint names. */
+ List_iterator_fast<Key> key_it(alter_info->key_list);
+ while (const Key *key= key_it++)
+ {
+ /*
+ Not all keys considered to be the CONSTRAINT
+ Noly Primary Key UNIQUE and Foreign keys.
+ */
+ if (key->type != Key::PRIMARY && key->type != Key::UNIQUE &&
+ key->type != Key::FOREIGN_KEY)
+ continue;
+
+ if (check->name.length == key->name.length &&
+ my_strcasecmp(system_charset_info,
+ check->name.str, key->name.str) == 0)
+ {
+ my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
+ DBUG_RETURN(TRUE);
+ }
+ }
+
if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
@@ -4265,10 +4286,33 @@ bool validate_comment_length(THD *thd, LEX_STRING *comment, size_t max_len,
uint err_code, const char *name)
{
DBUG_ENTER("validate_comment_length");
- uint tmp_len= my_charpos(system_charset_info, comment->str,
- comment->str + comment->length, max_len);
+
+ if (comment->length == 0)
+ DBUG_RETURN(false);
+
+ size_t tmp_len=
+ Well_formed_prefix(system_charset_info, *comment, max_len).length();
if (tmp_len < comment->length)
{
+#if MARIADB_VERSION_ID < 100500
+ if (comment->length <= max_len)
+ {
+ if (thd->is_strict_mode())
+ {
+ my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
+ system_charset_info->csname, comment->str);
+ DBUG_RETURN(true);
+ }
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_INVALID_CHARACTER_STRING,
+ ER_THD(thd, ER_INVALID_CHARACTER_STRING),
+ system_charset_info->csname, comment->str);
+ comment->length= tmp_len;
+ DBUG_RETURN(false);
+ }
+#else
+#error do it in TEXT_STRING_sys
+#endif
if (thd->is_strict_mode())
{
my_error(err_code, MYF(0), name, static_cast<ulong>(max_len));
@@ -5393,7 +5437,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
DBUG_ENTER("mysql_create_like_table");
#ifdef WITH_WSREP
- if (WSREP_ON && !thd->wsrep_applier &&
+ if (WSREP(thd) && !thd->wsrep_applier &&
wsrep_create_like_table(thd, table, src_table, create_info))
DBUG_RETURN(res);
#endif
@@ -7758,7 +7802,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (field->default_value)
field->default_value->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
- table->m_needs_reopen= 1; // because new column name is on thd->mem_root
+ // Force reopen because new column name is on thd->mem_root
+ table->mark_table_for_reopen();
}
/* Check if field is changed */
@@ -8170,12 +8215,42 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
{
check->expr->walk(&Item::rename_fields_processor, 1,
&column_rename_param);
- table->m_needs_reopen= 1; // because new column name is on thd->mem_root
+ // Force reopen because new column name is on thd->mem_root
+ table->mark_table_for_reopen();
}
new_constraint_list.push_back(check, thd->mem_root);
}
}
}
+
+ if (!alter_info->check_constraint_list.is_empty())
+ {
+ /* Check the table FOREIGN KEYs for name duplications. */
+ List <FOREIGN_KEY_INFO> fk_child_key_list;
+ FOREIGN_KEY_INFO *f_key;
+ table->file->get_foreign_key_list(thd, &fk_child_key_list);
+ List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list);
+ while ((f_key= fk_key_it++))
+ {
+ List_iterator_fast<Virtual_column_info>
+ c_it(alter_info->check_constraint_list);
+ Virtual_column_info *check;
+ while ((check= c_it++))
+ {
+ if (!check->name.length || check->automatic_name)
+ continue;
+
+ if (check->name.length == f_key->foreign_id->length &&
+ my_strcasecmp(system_charset_info, f_key->foreign_id->str,
+ check->name.str) == 0)
+ {
+ my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
+ goto err;
+ }
+ }
+ }
+ }
+
/* Add new constraints */
new_constraint_list.append(&alter_info->check_constraint_list);
@@ -8850,6 +8925,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(true);
}
+ if (create_info->db_type == maria_hton &&
+ create_info->transactional != HA_CHOICE_NO)
+ {
+ my_error(ER_TRANSACTIONAL_ARIA_LOG_ENGINE, MYF(0));
+ DBUG_RETURN(true);
+ }
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (alter_info->flags & Alter_info::ALTER_PARTITION)
{
@@ -9870,7 +9952,8 @@ err_new_table_cleanup:
thd->abort_on_warning= true;
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
f_val, strlength(f_val), t_type,
- new_table->s,
+ alter_ctx.new_db,
+ alter_ctx.new_name,
alter_ctx.datetime_field->field_name);
thd->abort_on_warning= save_abort_on_warning;
}
@@ -9982,6 +10065,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
sql_mode_t save_sql_mode= thd->variables.sql_mode;
ulonglong prev_insert_id, time_to_report_progress;
Field **dfield_ptr= to->default_field;
+ uint save_to_s_default_fields= to->s->default_fields;
DBUG_ENTER("copy_data_between_tables");
/* Two or 3 stages; Sorting, copying data and update indexes */
@@ -10263,6 +10347,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
*copied= found_count;
*deleted=delete_count;
to->file->ha_release_auto_increment();
+ to->s->default_fields= save_to_s_default_fields;
if (!cleanup_done)
{
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index db52ce0aea1..4e68ec2ec2e 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -387,10 +387,10 @@ void print_sjm(SJ_MATERIALIZATION_INFO *sjm)
/*
Debugging help: force List<...>::elem function not be removed as unused.
*/
-Item* (List<Item>:: *dbug_list_item_elem_ptr)(int)= &List<Item>::elem;
-Item_equal* (List<Item_equal>:: *dbug_list_item_equal_elem_ptr)(int)=
+Item* (List<Item>::*dbug_list_item_elem_ptr)(int)= &List<Item>::elem;
+Item_equal* (List<Item_equal>::*dbug_list_item_equal_elem_ptr)(int)=
&List<Item_equal>::elem;
-TABLE_LIST* (List<TABLE_LIST>:: *dbug_list_table_list_elem_ptr)(int) =
+TABLE_LIST* (List<TABLE_LIST>::*dbug_list_table_list_elem_ptr)(int) =
&List<TABLE_LIST>::elem;
#endif
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 5a251cfd733..b92b35a3abb 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013 Monty Program Ab.
+ Copyright (c) 2009, 2020, 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
@@ -18,7 +18,6 @@
/* Functions to handle date and time */
#include <my_global.h>
-#include "sql_priv.h"
#include "sql_time.h"
#include "tztime.h" // struct Time_zone
#include "sql_class.h" // THD
@@ -223,7 +222,7 @@ check_date_with_warn(const MYSQL_TIME *ltime, ulonglong fuzzy_date,
{
ErrConvTime str(ltime);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &str, ts_type, 0, 0);
+ &str, ts_type, NULL, NULL, NULL);
return true;
}
return false;
@@ -240,7 +239,7 @@ adjust_time_range_with_warn(MYSQL_TIME *ltime, uint dec)
return true;
if (warnings)
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &str, MYSQL_TIMESTAMP_TIME, 0, NullS);
+ &str, MYSQL_TIMESTAMP_TIME, NULL, NULL, NULL);
return false;
}
@@ -329,7 +328,8 @@ str_to_datetime_with_warn(CHARSET_INFO *cs,
ret_val ? Sql_condition::WARN_LEVEL_WARN :
Sql_condition::time_warn_level(status.warnings),
str, length, flags & TIME_TIME_ONLY ?
- MYSQL_TIMESTAMP_TIME : l_time->time_type, 0, NullS);
+ MYSQL_TIMESTAMP_TIME : l_time->time_type,
+ NULL, NULL, NULL);
DBUG_EXECUTE_IF("str_to_datetime_warn",
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_YES, str););
@@ -358,7 +358,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
int was_cut;
longlong res;
enum_field_types f_type;
- bool have_warnings;
+ bool have_warnings= false;
if (fuzzydate & TIME_TIME_ONLY)
{
@@ -387,7 +387,8 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part,
Sql_condition::WARN_LEVEL_WARN, str,
res < 0 ? MYSQL_TIMESTAMP_ERROR
: mysql_type_to_time_type(f_type),
- s, field_name);
+ s ? s->db.str : NULL,
+ s ? s->table_name.str : NULL, field_name);
}
return res < 0;
}
@@ -403,7 +404,7 @@ bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
if (neg)
value= -value;
- if (value > LONGLONG_MAX)
+ if (value > static_cast<double>(LONGLONG_MAX))
value= static_cast<double>(LONGLONG_MAX);
longlong nr= static_cast<ulonglong>(floor(value));
@@ -859,7 +860,8 @@ void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level,
const ErrConv *sval,
timestamp_type time_type,
- const TABLE_SHARE *s, const char *field_name)
+ const char *db_name, const char *table_name,
+ const char *field_name)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
const char *type_str;
@@ -879,9 +881,6 @@ void make_truncated_value_warning(THD *thd,
}
if (field_name)
{
- const char *db_name= s->db.str;
- const char *table_name= s->table_name.str;
-
if (!db_name)
db_name= "";
if (!table_name)
@@ -1219,7 +1218,7 @@ make_date_with_warn(MYSQL_TIME *ltime, ulonglong fuzzy_date,
/* e.g. negative time */
ErrConvTime str(ltime);
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
- &str, ts_type, 0, 0);
+ &str, ts_type, NULL, NULL, NULL);
return true;
}
if ((ltime->time_type= ts_type) == MYSQL_TIMESTAMP_DATE)
@@ -1383,7 +1382,7 @@ time_to_datetime_with_warn(THD *thd,
{
ErrConvTime str(from);
make_truncated_value_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- &str, MYSQL_TIMESTAMP_DATETIME, 0, 0);
+ &str, MYSQL_TIMESTAMP_DATETIME, NULL, NULL, NULL);
return true;
}
return false;
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 1dafb9b783b..ebfb86cde61 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -120,15 +120,18 @@ 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);
+ const char *db_name, const char *table_name,
+ const char *field_name);
static inline void make_truncated_value_warning(THD *thd,
Sql_condition::enum_warning_level level, const char *str_val,
uint str_length, timestamp_type time_type,
- const TABLE_SHARE *s, const char *field_name)
+ const char *db_name, const char *table_name,
+ const char *field_name)
{
const ErrConvString str(str_val, str_length, &my_charset_bin);
- make_truncated_value_warning(thd, level, &str, time_type, s, field_name);
+ make_truncated_value_warning(thd, level, &str, time_type, db_name, table_name,
+ field_name);
}
extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index daea60c26bc..52817ef65ae 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -34,6 +34,9 @@
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sp_cache.h" // sp_invalidate_cache
#include <mysys_err.h>
+#ifdef WITH_WSREP
+#include "debug_sync.h"
+#endif /* WITH_WSREP */
LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, uint length,
MEM_ROOT *mem_root)
@@ -337,7 +340,7 @@ public:
Trigger::~Trigger()
{
- delete body;
+ sp_head::destroy(body);
}
@@ -517,7 +520,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, tables);
#endif
/* We should have only one table in table list. */
@@ -579,6 +582,16 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
goto end;
}
+#ifdef WITH_WSREP
+ DBUG_EXECUTE_IF("sync.mdev_20225",
+ {
+ const char act[]=
+ "now "
+ "wait_for signal.mdev_20225_continue";
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act)));
+ };);
+#endif /* WITH_WSREP */
result= (create ?
table->triggers->create_trigger(thd, tables, &stmt_query):
table->triggers->drop_trigger(thd, tables, &stmt_query));
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 42090037ead..046b42e4a83 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -92,6 +92,7 @@ public:
virtual void sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const= 0;
+ virtual bool is_packable() const { return false; }
};
@@ -169,6 +170,7 @@ public:
void sortlength(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const;
+ bool is_packable()const { return true; }
};
diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h
index 74e59b08385..5988a985a2d 100644
--- a/sql/sql_type_int.h
+++ b/sql/sql_type_int.h
@@ -67,6 +67,26 @@ public:
*/
return cmp_signed(other);
}
+ bool operator==(const Longlong_hybrid &nr) const
+ {
+ return cmp(nr) == 0;
+ }
+ bool operator==(ulonglong nr) const
+ {
+ return cmp(Longlong_hybrid((longlong) nr, true)) == 0;
+ }
+ bool operator==(uint nr) const
+ {
+ return cmp(Longlong_hybrid((longlong) nr, true)) == 0;
+ }
+ bool operator==(longlong nr) const
+ {
+ return cmp(Longlong_hybrid(nr, false)) == 0;
+ }
+ bool operator==(int nr) const
+ {
+ return cmp(Longlong_hybrid(nr, false)) == 0;
+ }
};
#endif // SQL_TYPE_INT_INCLUDED
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 2a72c86707c..2af12d94228 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -58,6 +58,8 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret,
char *dl, Item_udftype typ);
static void del_udf(udf_func *udf);
static void *find_udf_dl(const char *dl);
+static bool find_udf_everywhere(THD* thd, const char *name, uint len,
+ TABLE *table);
static char *init_syms(udf_func *tmp, char *nm)
{
@@ -255,7 +257,9 @@ void udf_init()
if (error > 0)
sql_print_error("Got unknown error: %d", my_errno);
end_read_record(&read_record_info);
- table->m_needs_reopen= TRUE; // Force close to free memory
+
+ // Force close to free memory
+ table->mark_table_for_reopen();
end:
close_mysql_tables(new_thd);
@@ -415,6 +419,45 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
return tmp;
}
+/**
+ Find record with the udf in the udf func table
+
+ @param exact_name_str udf name
+ @param exact_name_len udf name length
+ @param table table of mysql.func
+
+ @retval TRUE found
+ @retral FALSE not found
+*/
+
+static bool find_udf_in_table(const char *exact_name_str, uint exact_name_len,
+ TABLE *table)
+{
+ table->use_all_columns();
+ table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin);
+ return (!table->file->ha_index_read_idx_map(table->record[0], 0,
+ (uchar*) table->field[0]->ptr,
+ HA_WHOLE_KEY,
+ HA_READ_KEY_EXACT));
+}
+
+static bool remove_udf_in_table(const char *exact_name_str,
+ uint exact_name_len,
+ TABLE *table)
+{
+ if (find_udf_in_table(exact_name_str, exact_name_len, table))
+ {
+ int error;
+ if ((error= table->file->ha_delete_row(table->record[0])))
+ {
+ table->file->print_error(error, MYF(0));
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
/*
Drop user defined function.
@@ -445,18 +488,21 @@ static int mysql_drop_function_internal(THD *thd, udf_func *udf, TABLE *table)
if (!table)
DBUG_RETURN(1);
- table->use_all_columns();
- table->field[0]->store(exact_name_str, exact_name_len, &my_charset_bin);
- if (!table->file->ha_index_read_idx_map(table->record[0], 0,
- (uchar*) table->field[0]->ptr,
- HA_WHOLE_KEY,
- HA_READ_KEY_EXACT))
- {
- int error;
- if ((error= table->file->ha_delete_row(table->record[0])))
- table->file->print_error(error, MYF(0));
- }
- DBUG_RETURN(0);
+ bool ret= remove_udf_in_table(exact_name_str, exact_name_len, table);
+ DBUG_RETURN(ret);
+}
+
+
+static TABLE *open_udf_func_table(THD *thd)
+{
+ TABLE_LIST tables;
+ TABLE *table;
+
+ tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
+ "func", TL_WRITE);
+ table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
+
+ return table;
}
@@ -503,9 +549,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (check_ident_length(&udf->name))
DBUG_RETURN(1);
- tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
- "func", TL_WRITE);
- table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
+ table= open_udf_func_table(thd);
mysql_rwlock_wrlock(&THR_LOCK_udf);
DEBUG_SYNC(current_thd, "mysql_create_function_after_lock");
@@ -604,43 +648,65 @@ err:
}
-int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
+enum drop_udf_result mysql_drop_function(THD *thd, const LEX_STRING *udf_name)
{
TABLE *table;
- TABLE_LIST tables;
udf_func *udf;
DBUG_ENTER("mysql_drop_function");
+ if (thd->locked_tables_mode)
+ {
+ my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
+ DBUG_RETURN(UDF_DEL_RESULT_ERROR);
+ }
+
+ if (!(table= open_udf_func_table(thd)))
+ DBUG_RETURN(UDF_DEL_RESULT_ERROR);
+
+ // Fast pre-check
+ if (!mysql_rwlock_tryrdlock(&THR_LOCK_udf))
+ {
+ bool found=find_udf_everywhere(thd, udf_name->str, udf_name->length, table);
+ mysql_rwlock_unlock(&THR_LOCK_udf);
+ if (!found)
+ {
+ close_mysql_tables(thd);
+ DBUG_RETURN(UDF_DEL_RESULT_ABSENT);
+ }
+ }
+
if (!initialized)
{
+ close_mysql_tables(thd);
if (opt_noacl)
- my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
- else
- my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES),
- MYF(0));
- DBUG_RETURN(1);
- }
+ DBUG_RETURN(UDF_DEL_RESULT_ABSENT); // SP should be checked
- tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
- "func", TL_WRITE);
- table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
+ my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES), MYF(0));
+ DBUG_RETURN(UDF_DEL_RESULT_ERROR);
+ }
mysql_rwlock_wrlock(&THR_LOCK_udf);
+
+ // re-check under protection
+ if (!find_udf_everywhere(thd, udf_name->str, udf_name->length, table))
+ {
+ close_mysql_tables(thd);
+ mysql_rwlock_unlock(&THR_LOCK_udf);
+ DBUG_RETURN(UDF_DEL_RESULT_ABSENT);
+ }
+
+ if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0))
+ goto err;
+
+
DEBUG_SYNC(current_thd, "mysql_drop_function_after_lock");
+
if (!(udf= (udf_func*) my_hash_search(&udf_hash, (uchar*) udf_name->str,
(uint) udf_name->length)) )
{
- if (thd->lex->check_exists)
- {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
- ER_FUNCTION_NOT_DEFINED,
- ER_THD(thd, ER_FUNCTION_NOT_DEFINED),
- udf_name->str);
- goto done;
- }
-
- my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
- goto err;
+ if (remove_udf_in_table(udf_name->str, (uint) udf_name->length, table))
+ goto err;
+ goto done;
}
if (mysql_drop_function_internal(thd, udf, table))
@@ -654,13 +720,24 @@ done:
while binlogging, to avoid binlog inconsistency.
*/
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
- DBUG_RETURN(1);
+ DBUG_RETURN(UDF_DEL_RESULT_ERROR);
- DBUG_RETURN(0);
+ close_mysql_tables(thd);
+ DBUG_RETURN(UDF_DEL_RESULT_DELETED);
err:
+ close_mysql_tables(thd);
mysql_rwlock_unlock(&THR_LOCK_udf);
- DBUG_RETURN(1);
+ DBUG_RETURN(UDF_DEL_RESULT_ERROR);
+}
+
+static bool find_udf_everywhere(THD* thd, const char *name, uint len,
+ TABLE *table)
+{
+ if (initialized && my_hash_search(&udf_hash, (uchar*) name, len))
+ return true;
+
+ return find_udf_in_table(name, len, table);
}
#endif /* HAVE_DLOPEN */
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index a683b8a7554..bfa03dcce33 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -140,7 +140,13 @@ void udf_init(void),udf_free(void);
udf_func *find_udf(const char *name, uint len=0,bool mark_used=0);
void free_udf(udf_func *udf);
int mysql_create_function(THD *thd,udf_func *udf);
-int mysql_drop_function(THD *thd,const LEX_STRING *name);
+enum drop_udf_result
+{
+ UDF_DEL_RESULT_ABSENT,
+ UDF_DEL_RESULT_DELETED,
+ UDF_DEL_RESULT_ERROR
+};
+enum drop_udf_result mysql_drop_function(THD *thd,const LEX_STRING *name);
#else
static inline void udf_init(void) { }
static inline void udf_free(void) { }
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 7e4d06b03f2..8b1719c60cb 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -514,6 +514,25 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
found_rows_for_union= first_sl->options & OPTION_FOUND_ROWS;
is_union_select= is_union() || fake_select_lex;
+ /*
+ If we are reading UNION output and the UNION is in the
+ IN/ANY/ALL/EXISTS subquery, then ORDER BY is redundant and hence should
+ be removed.
+ Example:
+ select ... col IN (select col2 FROM t1 union select col3 from t2 ORDER BY 1)
+
+ (as for ORDER BY ... LIMIT, it currently not supported inside
+ IN/ALL/ANY subqueries)
+ (For non-UNION this removal of ORDER BY clause is done in
+ check_and_do_in_subquery_rewrites())
+ */
+ if (is_union() && item &&
+ (item->is_in_predicate() || item->is_exists_predicate()))
+ {
+ global_parameters()->order_list.first= NULL;
+ global_parameters()->order_list.elements= 0;
+ }
+
/* Global option */
if (is_union_select || is_recursive)
@@ -1540,6 +1559,19 @@ bool st_select_lex::cleanup()
delete join;
join= 0;
}
+ for (TABLE_LIST *tbl= get_table_list(); tbl; tbl= tbl->next_local)
+ {
+ if (tbl->is_recursive_with_table() &&
+ !tbl->is_with_table_recursive_reference())
+ {
+ /*
+ If query is killed before open_and_process_table() for tbl
+ is called then 'with' is already set, but 'derived' is not.
+ */
+ st_select_lex_unit *unit= tbl->with->spec;
+ error|= (bool) error | (uint) unit->cleanup();
+ }
+ }
for (SELECT_LEX_UNIT *lex_unit= first_inner_unit(); lex_unit ;
lex_unit= lex_unit->next_unit())
{
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 65a828147ae..5e40cd242a4 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -417,6 +417,8 @@ int mysql_update(THD *thd,
query_plan.set_no_partitions();
if (thd->lex->describe || thd->lex->analyze_stmt)
goto produce_explain_and_leave;
+ if (thd->is_error())
+ DBUG_RETURN(1);
my_ok(thd); // No matching records
DBUG_RETURN(0);
@@ -1104,8 +1106,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(TRUE);
if (setup_tables_and_check_access(thd, &select_lex->context,
- &select_lex->top_join_list,
- table_list,
+ &select_lex->top_join_list, table_list,
select_lex->leaf_tables,
FALSE, UPDATE_ACL, SELECT_ACL, TRUE) ||
setup_conds(thd, table_list, select_lex->leaf_tables, conds) ||
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index b1c5fd1d8aa..8bfe6896ea2 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -450,9 +450,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
if (thd->open_temporary_tables(lex->query_tables) ||
open_and_lock_tables(thd, lex->query_tables, TRUE, 0))
{
- view= lex->unlink_first_table(&link_to_local);
res= TRUE;
- goto err;
+ goto err_no_relink;
}
view= lex->unlink_first_table(&link_to_local);
@@ -703,10 +702,12 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
WSREP_ERROR_LABEL:
res= TRUE;
+ goto err_no_relink;
err:
THD_STAGE_INFO(thd, stage_end);
lex->link_first_table_back(view, link_to_local);
+err_no_relink:
unit->cleanup();
DBUG_RETURN(res || thd->is_error());
}
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index b258b8f56c9..612c6e692fe 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -2872,7 +2872,8 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel,
*/
ORDER *order= (ORDER *)alloc_root(thd->mem_root, sizeof(ORDER));
memset(order, 0, sizeof(*order));
- Item *item= new (thd->mem_root) Item_field(thd, join_tab->table->field[0]);
+ Item *item= new (thd->mem_root) Item_temptable_field(thd,
+ join_tab->table->field[0]);
order->item= (Item **)alloc_root(thd->mem_root, 2 * sizeof(Item *));
order->item[1]= NULL;
order->item[0]= item;
@@ -2968,6 +2969,14 @@ Window_funcs_computation::save_explain_plan(MEM_ROOT *mem_root,
return xpl;
}
+
+bool st_select_lex::add_window_func(Item_window_func *win_func)
+{
+ if (parsing_place != SELECT_LIST)
+ fields_in_window_functions+= win_func->window_func()->argument_count();
+ return window_funcs.push_back(win_func);
+}
+
/////////////////////////////////////////////////////////////////////////////
// Unneeded comments (will be removed when we develop a replacement for
// the feature that was attempted here
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ba349e478b8..2eabc4f0a6d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -149,6 +149,14 @@ void LEX::parse_error()
}
+static Item* escape(THD *thd)
+{
+ thd->lex->escape_used= false;
+ const char *esc= thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES ? "" : "\\";
+ return new (thd->mem_root) Item_string_ascii(thd, esc, MY_TEST(esc[0]));
+}
+
+
/**
@brief Bison callback to report a syntax/OOM error
@@ -226,7 +234,7 @@ static sp_head *make_sp_head(THD *thd, sp_name *name,
sp_head *sp;
/* Order is important here: new - reset - init */
- if ((sp= new sp_head()))
+ if ((sp= sp_head::create()))
{
sp->reset_thd_mem_root(thd);
sp->init(lex);
@@ -1022,10 +1030,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 102 shift/reduce conflicts.
+ Currently there are 105 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 101
+%expect 105
/*
Comments for TOKENS.
@@ -1721,17 +1729,19 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%left OR_OR_SYM OR_SYM OR2_SYM
%left XOR
%left AND_SYM AND_AND_SYM
-%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
-%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
+%nonassoc NOT_SYM
+%left '=' EQUAL_SYM GE '>' LE '<' NE
+%nonassoc IS
+%right BETWEEN_SYM
+%left LIKE REGEXP IN_SYM
%left '|'
%left '&'
%left SHIFT_LEFT SHIFT_RIGHT
%left '-' '+'
%left '*' '/' '%' DIV_SYM MOD_SYM
%left '^'
-%left NEG '~'
-%right NOT_SYM NOT2_SYM
-%right BINARY COLLATE_SYM
+%nonassoc NEG '~' NOT2_SYM BINARY
+%nonassoc COLLATE_SYM
%left INTERVAL_SYM
%type <lex_str>
@@ -1831,7 +1841,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
expr_or_default set_expr_or_default
geometry_function signed_literal expr_or_literal
- opt_escape
sp_opt_default
simple_ident_nospvar simple_ident_q
field_or_var limit_option
@@ -7294,10 +7303,10 @@ alter:
lex->server_options.reset($3);
} OPTIONS_SYM '(' server_options_list ')' { }
/* ALTER USER foo is allowed for MySQL compatibility. */
- | ALTER opt_if_exists USER_SYM clear_privileges grant_list
+ | ALTER USER_SYM opt_if_exists clear_privileges grant_list
opt_require_clause opt_resource_options
{
- Lex->create_info.set($2);
+ Lex->create_info.set($3);
Lex->sql_command= SQLCOM_ALTER_USER;
}
;
@@ -7692,6 +7701,8 @@ alter_list_item:
| ALTER opt_column field_ident SET DEFAULT column_default_expr
{
LEX *lex=Lex;
+ if (check_expression($6, $3.str, VCOL_DEFAULT))
+ MYSQL_YYABORT;
Alter_column *ac= new (thd->mem_root) Alter_column($3.str,$6);
if (ac == NULL)
MYSQL_YYABORT;
@@ -8913,59 +8924,59 @@ expr:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS TRUE_SYM %prec IS
+ | expr IS TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_istrue(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS not TRUE_SYM %prec IS
+ | expr IS not TRUE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS FALSE_SYM %prec IS
+ | expr IS FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isfalse(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS not FALSE_SYM %prec IS
+ | expr IS not FALSE_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS UNKNOWN_SYM %prec IS
+ | expr IS UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS not UNKNOWN_SYM %prec IS
+ | expr IS not UNKNOWN_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri
- ;
-
-bool_pri:
- bool_pri IS NULL_SYM %prec IS
+ | expr IS NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri IS not NULL_SYM %prec IS
+ | expr IS not NULL_SYM %prec IS
{
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
+ | bool_pri
+ ;
+
+bool_pri:
+ bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
{
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
if ($$ == NULL)
@@ -8987,13 +8998,13 @@ bool_pri:
;
predicate:
- bit_expr IN_SYM '(' subselect ')'
+ predicate IN_SYM '(' subselect ')'
{
$$= new (thd->mem_root) Item_in_subselect(thd, $1, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not IN_SYM '(' subselect ')'
+ | predicate not IN_SYM '(' subselect ')'
{
Item *item= new (thd->mem_root) Item_in_subselect(thd, $1, $5);
if (item == NULL)
@@ -9002,13 +9013,13 @@ predicate:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr IN_SYM '(' expr ')'
+ | predicate IN_SYM '(' expr ')'
{
$$= handle_sql2003_note184_exception(thd, $1, true, $4);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr IN_SYM '(' expr ',' expr_list ')'
+ | predicate IN_SYM '(' expr ',' expr_list ')'
{
$6->push_front($4, thd->mem_root);
$6->push_front($1, thd->mem_root);
@@ -9016,13 +9027,13 @@ predicate:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not IN_SYM '(' expr ')'
+ | predicate not IN_SYM '(' expr ')'
{
$$= handle_sql2003_note184_exception(thd, $1, false, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not IN_SYM '(' expr ',' expr_list ')'
+ | predicate not IN_SYM '(' expr ',' expr_list ')'
{
$7->push_front($5, thd->mem_root);
$7->push_front($1, thd->mem_root);
@@ -9031,13 +9042,13 @@ predicate:
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
- | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
+ | predicate BETWEEN_SYM predicate AND_SYM predicate %prec BETWEEN_SYM
{
$$= new (thd->mem_root) Item_func_between(thd, $1, $3, $5);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
+ | predicate not BETWEEN_SYM predicate AND_SYM predicate %prec BETWEEN_SYM
{
Item_func_between *item;
item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6);
@@ -9045,7 +9056,7 @@ predicate:
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
- | bit_expr SOUNDS_SYM LIKE bit_expr
+ | predicate SOUNDS_SYM LIKE predicate
{
Item *item1= new (thd->mem_root) Item_func_soundex(thd, $1);
Item *item4= new (thd->mem_root) Item_func_soundex(thd, $4);
@@ -9055,28 +9066,41 @@ predicate:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr LIKE simple_expr opt_escape
+ | predicate LIKE predicate
{
- $$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4,
- Lex->escape_used);
+ $$= new (thd->mem_root) Item_func_like(thd, $1, $3, escape(thd), false);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not LIKE simple_expr opt_escape
+ | predicate LIKE predicate ESCAPE_SYM predicate %prec LIKE
{
- Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $5,
- Lex->escape_used);
+ Lex->escape_used= true;
+ $$= new (thd->mem_root) Item_func_like(thd, $1, $3, $5, true);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | predicate not LIKE predicate
+ {
+ Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, escape(thd), false);
+ if (item == NULL)
+ MYSQL_YYABORT;
+ $$= item->neg_transformer(thd);
+ }
+ | predicate not LIKE predicate ESCAPE_SYM predicate %prec LIKE
+ {
+ Lex->escape_used= true;
+ Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $6, true);
if (item == NULL)
MYSQL_YYABORT;
$$= item->neg_transformer(thd);
}
- | bit_expr REGEXP bit_expr
+ | predicate REGEXP predicate
{
$$= new (thd->mem_root) Item_func_regex(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bit_expr not REGEXP bit_expr
+ | predicate not REGEXP predicate
{
Item *item= new (thd->mem_root) Item_func_regex(thd, $1, $4);
if (item == NULL)
@@ -11466,23 +11490,6 @@ opt_having_clause:
}
;
-opt_escape:
- ESCAPE_SYM simple_expr
- {
- Lex->escape_used= TRUE;
- $$= $2;
- }
- | /* empty */
- {
- Lex->escape_used= FALSE;
- $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
- new (thd->mem_root) Item_string_ascii(thd, "", 0) :
- new (thd->mem_root) Item_string_ascii(thd, "\\", 1));
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- ;
-
/*
group by statement in select
*/
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 8eb75e49d8e..2a582a098fb 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -323,7 +323,7 @@ static Sys_var_long Sys_pfs_digest_size(
"Size of the statement digest."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_digest_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 200),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
DEFAULT(-1),
BLOCK_SIZE(1));
@@ -2224,7 +2224,7 @@ static Sys_var_ulong Sys_max_sort_length(
"the first max_sort_length bytes of each value are used; the rest "
"are ignored)",
SESSION_VAR(max_sort_length), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(4, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
+ VALID_RANGE(8, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
static Sys_var_ulong Sys_max_sp_recursion_depth(
"max_sp_recursion_depth",
@@ -2471,12 +2471,23 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd,
"engine_condition_pushdown=on");
return false;
}
+static bool check_legal_optimizer_switch(sys_var *self, THD *thd,
+ set_var *var)
+{
+ if (var->save_result.ulonglong_value & (OPTIMIZER_SWITCH_MATERIALIZATION |
+ OPTIMIZER_SWITCH_IN_TO_EXISTS))
+ {
+ return false;
+ }
+ my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0));
+ return true;
+}
static Sys_var_flagset Sys_optimizer_switch(
"optimizer_switch",
"Fine-tune the optimizer behavior",
SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG),
optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_legal_optimizer_switch),
ON_UPDATE(fix_optimizer_switch));
static Sys_var_charptr Sys_pid_file(
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index a18440e550d..3c3cfb8c8a6 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -731,7 +731,11 @@ public:
{ DBUG_ASSERT(FALSE); }
void global_save_default(THD *thd, set_var *var)
- { DBUG_ASSERT(FALSE); }
+ {
+ char *ptr= (char*)(intptr)option.def_value;
+ var->save_result.string_value.str= ptr;
+ var->save_result.string_value.length= ptr ? strlen(ptr) : 0;
+ }
bool session_update(THD *thd, set_var *var)
{
@@ -1704,13 +1708,16 @@ public:
return false;
}
void session_save_default(THD *thd, set_var *var)
- { var->save_result.ulonglong_value= global_var(ulonglong) & bitmask; }
+ {
+ var->save_result.ulonglong_value=
+ (reverse_semantics == !(global_var(ulonglong) & bitmask));
+ }
void global_save_default(THD *thd, set_var *var)
{ var->save_result.ulonglong_value= option.def_value; }
uchar *valptr(THD *thd, ulonglong val)
{
- thd->sys_var_tmp.my_bool_value= reverse_semantics ^ ((val & bitmask) != 0);
+ thd->sys_var_tmp.my_bool_value= (reverse_semantics == !(val & bitmask));
return (uchar*) &thd->sys_var_tmp.my_bool_value;
}
uchar *session_value_ptr(THD *thd, const LEX_STRING *base)
diff --git a/sql/table.cc b/sql/table.cc
index bb6c35fecd2..e4492f21a30 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -47,6 +47,17 @@
#define MYSQL57_GENERATED_FIELD 128
#define MYSQL57_GCOL_HEADER_SIZE 4
+class Table_arena: public Query_arena
+{
+public:
+ Table_arena(MEM_ROOT *mem_root, enum enum_state state_arg) :
+ Query_arena(mem_root, state_arg){}
+ virtual Type type() const
+ {
+ return TABLE_ARENA;
+ }
+};
+
static Virtual_column_info * unpack_vcol_info_from_frm(THD *, MEM_ROOT *,
TABLE *, String *, Virtual_column_info **, bool *);
static bool check_vcol_forward_refs(Field *, Virtual_column_info *);
@@ -76,8 +87,11 @@ static int64 last_table_id;
/* Functions defined in this file */
-static void fix_type_pointers(const char ***array, TYPELIB *point_to_type,
- uint types, char **names);
+static bool fix_type_pointers(const char ***typelib_value_names,
+ uint **typelib_value_lengths,
+ TYPELIB *point_to_type, uint types,
+ char *names, size_t names_length);
+
static uint find_field(Field **fields, uchar *record, uint start, uint length);
inline bool is_system_table_name(const char *name, uint length);
@@ -437,10 +451,6 @@ void TABLE_SHARE::destroy()
delete_stat_values_for_table_share(this);
free_root(&stats_cb.mem_root, MYF(0));
- stats_cb.stats_can_be_read= FALSE;
- stats_cb.stats_is_read= FALSE;
- stats_cb.histograms_can_be_read= FALSE;
- stats_cb.histograms_are_read= FALSE;
/* The mutexes are initialized only for shares that are part of the TDC */
if (tmp_table == NO_TMP_TABLE)
@@ -694,7 +704,8 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
uint keys, KEY *keyinfo,
uint new_frm_ver, uint &ext_key_parts,
TABLE_SHARE *share, uint len,
- KEY *first_keyinfo, char* &keynames)
+ KEY *first_keyinfo,
+ LEX_STRING *keynames)
{
uint i, j, n_length;
KEY_PART_INFO *key_part= NULL;
@@ -837,10 +848,13 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
}
share->ext_key_parts+= keyinfo->ext_key_parts;
}
- keynames=(char*) key_part;
- strpos+= strnmov(keynames, (char *) strpos, frm_image_end - strpos) - keynames;
+ keynames->str= (char*) key_part;
+ keynames->length= strnmov(keynames->str, (char *) strpos,
+ frm_image_end - strpos) - keynames->str;
+ strpos+= keynames->length;
if (*strpos++) // key names are \0-terminated
return 1;
+ keynames->length++; // Include '\0', to make fix_type_pointers() happy.
//reading index comments
for (keyinfo= share->key_info, i=0; i < keys; i++, keyinfo++)
@@ -1017,8 +1031,9 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
We need to use CONVENTIONAL_EXECUTION here to ensure that
any new items created by fix_fields() are not reverted.
*/
- table->expr_arena= new (alloc_root(mem_root, sizeof(Query_arena)))
- Query_arena(mem_root, Query_arena::STMT_CONVENTIONAL_EXECUTION);
+ table->expr_arena= new (alloc_root(mem_root, sizeof(Table_arena)))
+ Table_arena(mem_root,
+ Query_arena::STMT_CONVENTIONAL_EXECUTION);
if (!table->expr_arena)
DBUG_RETURN(1);
@@ -1178,11 +1193,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
TABLE_SHARE *share= this;
uint new_frm_ver, field_pack_length, new_field_pack_flag;
uint interval_count, interval_parts, read_length, int_length;
+ uint total_typelib_value_count;
uint db_create_options, keys, key_parts, n_length;
uint com_length, null_bit_pos, UNINIT_VAR(mysql57_vcol_null_bit_pos), bitmap_count;
uint i;
bool use_hash, mysql57_null_bits= 0;
- char *keynames, *names, *comment_pos;
+ LEX_STRING keynames= {NULL, 0};
+ char *names, *comment_pos;
const uchar *forminfo, *extra2;
const uchar *frm_image_end = frm_image + frm_length;
uchar *record, *null_flags, *null_pos, *UNINIT_VAR(mysql57_vcol_null_pos);
@@ -1194,6 +1211,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
KEY_PART_INFO *key_part= NULL;
Field **field_ptr, *reg_field;
const char **interval_array;
+ uint *typelib_value_lengths= NULL;
enum legacy_db_type legacy_db_type;
my_bitmap_map *bitmaps;
bool null_bits_are_used;
@@ -1496,7 +1514,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (create_key_infos(disk_buff + 6, frm_image_end, keys, keyinfo,
new_frm_ver, ext_key_parts,
- share, len, &first_keyinfo, keynames))
+ share, len, &first_keyinfo, &keynames))
goto err;
if (next_chunk + 5 < buff_end)
@@ -1589,7 +1607,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
{
if (create_key_infos(disk_buff + 6, frm_image_end, keys, keyinfo,
new_frm_ver, ext_key_parts,
- share, len, &first_keyinfo, keynames))
+ share, len, &first_keyinfo, &keynames))
goto err;
}
@@ -1630,11 +1648,34 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d vcol_screen_length: %d", interval_count,interval_parts, keys,n_length,int_length, com_length, vcol_screen_length));
+ /*
+ We load the following things into TYPELIBs:
+ - One TYPELIB for field names
+ - interval_count TYPELIBs for ENUM/SET values
+ - One TYPELIB for key names
+ Every TYPELIB requires one extra value with a NULL pointer and zero length,
+ which is the end-of-values marker.
+ TODO-10.5+:
+ Note, we should eventually reuse this total_typelib_value_count
+ to allocate interval_array. The below code reserves less space
+ than total_typelib_value_count pointers. So it seems `interval_array`
+ and `names` overlap in the memory. Too dangerous to fix in 10.1.
+ */
+ total_typelib_value_count=
+ (share->fields + 1/*end-of-values marker*/) +
+ (interval_parts + interval_count/*end-of-values markers*/) +
+ (keys + 1/*end-of-values marker*/);
+
if (!multi_alloc_root(&share->mem_root,
&share->field, (uint)(share->fields+1)*sizeof(Field*),
&share->intervals, (uint)interval_count*sizeof(TYPELIB),
&share->check_constraints, (uint) share->table_check_constraints * sizeof(Virtual_column_info*),
+ /*
+ This looks wrong: shouldn't it be (+2+interval_count)
+ instread of (+3) ?
+ */
&interval_array, (uint) (share->fields+interval_parts+ keys+3)*sizeof(char *),
+ &typelib_value_lengths, total_typelib_value_count * sizeof(uint *),
&names, (uint) (n_length+int_length),
&comment_pos, (uint) com_length,
&vcol_screen_pos, vcol_screen_length,
@@ -1661,33 +1702,21 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
memcpy(vcol_screen_pos, disk_buff+read_length-vcol_screen_length,
vcol_screen_length);
- fix_type_pointers(&interval_array, &share->fieldnames, 1, &names);
- if (share->fieldnames.count != share->fields)
+ if (fix_type_pointers(&interval_array, &typelib_value_lengths,
+ &share->fieldnames, 1, names, n_length) ||
+ share->fieldnames.count != share->fields)
goto err;
- fix_type_pointers(&interval_array, share->intervals, interval_count, &names);
- {
- /* Set ENUM and SET lengths */
- TYPELIB *interval;
- for (interval= share->intervals;
- interval < share->intervals + interval_count;
- interval++)
- {
- uint count= (uint) (interval->count + 1) * sizeof(uint);
- if (!(interval->type_lengths= (uint *) alloc_root(&share->mem_root,
- count)))
- goto err;
- for (count= 0; count < interval->count; count++)
- {
- char *val= (char*) interval->type_names[count];
- interval->type_lengths[count]= strlen(val);
- }
- interval->type_lengths[count]= 0;
- }
- }
+ if (fix_type_pointers(&interval_array, &typelib_value_lengths,
+ share->intervals, interval_count,
+ names + n_length, int_length))
+ goto err;
- if (keynames)
- fix_type_pointers(&interval_array, &share->keynames, 1, &keynames);
+ if (keynames.length &&
+ (fix_type_pointers(&interval_array, &typelib_value_lengths,
+ &share->keynames, 1, keynames.str, keynames.length) ||
+ share->keynames.count != keys))
+ goto err;
/* Allocate handler */
if (!(handler_file= get_new_handler(share, thd->mem_root,
@@ -3622,37 +3651,81 @@ void open_table_error(TABLE_SHARE *share, enum open_frm_error error,
** with a '\0'
*/
-static void
-fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types,
- char **names)
+static bool
+fix_type_pointers(const char ***typelib_value_names,
+ uint **typelib_value_lengths,
+ TYPELIB *point_to_type, uint types,
+ char *ptr, size_t length)
{
- char *type_name, *ptr;
- char chr;
+ const char *end= ptr + length;
- ptr= *names;
while (types--)
{
+ char sep;
point_to_type->name=0;
- point_to_type->type_names= *array;
+ point_to_type->type_names= *typelib_value_names;
+ point_to_type->type_lengths= *typelib_value_lengths;
- if ((chr= *ptr)) /* Test if empty type */
+ /*
+ Typelib can be encoded as:
+ 1) 0x00 - empty typelib
+ 2) 0xFF 0x00 - empty typelib (index names)
+ 3) sep (value sep)... 0x00 - non-empty typelib (where sep is a separator)
+ */
+ if (length == 2 && ptr[0] == (char) 0xFF && ptr[1] == '\0')
+ {
+ /*
+ This is a special case #2.
+ If there are no indexes at all, index names can be encoded
+ as a two byte sequence: 0xFF 0x00
+ TODO: Check if it's a bug in the FRM packing routine.
+ It should probably write just 0x00 instead of 0xFF00.
+ */
+ ptr+= 2;
+ }
+ else if ((sep= *ptr++)) // A non-empty typelib
{
- while ((type_name=strchr(ptr+1,chr)) != NullS)
+ for ( ; ptr < end; )
{
- *((*array)++) = ptr+1;
- *type_name= '\0'; /* End string */
- ptr=type_name;
+ // Now scan the next value+sep pair
+ char *vend= (char*) memchr(ptr, sep, end - ptr);
+ if (!vend)
+ return true; // Bad format
+ *((*typelib_value_names)++)= ptr;
+ *((*typelib_value_lengths)++)= (uint) (vend - ptr);
+ *vend= '\0'; // Change sep to '\0'
+ ptr= vend + 1; // Shift from sep to the next byte
+ /*
+ Now we can have either:
+ - the end-of-typelib marker (0x00)
+ - more value+sep pairs
+ */
+ if (!*ptr)
+ {
+ /*
+ We have an ambiguity here. 0x00 can be an end-of-typelib marker,
+ but it can also be a part of the next value:
+ CREATE TABLE t1 (a ENUM(0x61, 0x0062) CHARACTER SET BINARY);
+ If this is the last ENUM/SET in the table and there is still more
+ packed data left after 0x00, then we know for sure that 0x00
+ is a part of the next value.
+ TODO-10.5+: we should eventually introduce a new unambiguous
+ typelib encoding for FRM.
+ */
+ if (!types && ptr + 1 < end)
+ continue; // A binary value starting with 0x00
+ ptr++; // Consume the end-of-typelib marker
+ break; // End of the current typelib
+ }
}
- ptr+=2; /* Skip end mark and last 0 */
}
- else
- ptr++;
- point_to_type->count= (uint) (*array - point_to_type->type_names);
+ point_to_type->count= (uint) (*typelib_value_names -
+ point_to_type->type_names);
point_to_type++;
- *((*array)++)= NullS; /* End of type */
+ *((*typelib_value_names)++)= NullS; /* End of type */
+ *((*typelib_value_lengths)++)= 0; /* End of type */
}
- *names=ptr; /* Update end */
- return;
+ return ptr != end;
} /* fix_type_pointers */
@@ -4136,7 +4209,6 @@ bool check_column_name(const char *name)
been opened.
@param[in] table The table to check
- @param[in] table_f_count Expected number of columns in the table
@param[in] table_def Expected structure of the table (column name
and type)
@@ -6471,6 +6543,12 @@ void TABLE::mark_columns_needed_for_update()
}
need_signal= true;
}
+ else
+ {
+ if (found_next_number_field)
+ mark_auto_increment_column();
+ }
+
if (file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_DELETE)
{
/*
@@ -7708,15 +7786,17 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
int TABLE::update_virtual_field(Field *vf)
{
- DBUG_ASSERT(!in_use->is_error());
- Query_arena backup_arena;
DBUG_ENTER("TABLE::update_virtual_field");
+ Query_arena backup_arena;
+ Counting_error_handler count_errors;
+ in_use->push_internal_handler(&count_errors);
in_use->set_n_backup_active_arena(expr_arena, &backup_arena);
bitmap_clear_all(&tmp_set);
vf->vcol_info->expr->walk(&Item::update_vcol_processor, 0, &tmp_set);
vf->vcol_info->expr->save_in_field(vf, 0);
in_use->restore_active_arena(expr_arena, &backup_arena);
- DBUG_RETURN(in_use->is_error());
+ in_use->pop_internal_handler();
+ DBUG_RETURN(count_errors.errors);
}
@@ -8577,3 +8657,14 @@ void TABLE::initialize_quick_structures()
bzero(quick_costs, sizeof(quick_costs));
bzero(quick_n_ranges, sizeof(quick_n_ranges));
}
+
+/*
+ Mark table to be reopened after query
+*/
+
+void TABLE::mark_table_for_reopen()
+{
+ THD *thd= in_use;
+ DBUG_ASSERT(thd);
+ thd->locked_tables_list.mark_table_for_reopen(thd, this);
+}
diff --git a/sql/table.h b/sql/table.h
index e0541ef3f2e..14ab0027a79 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -567,15 +567,94 @@ enum open_frm_error {
from persistent statistical tables
*/
-struct TABLE_STATISTICS_CB
+class TABLE_STATISTICS_CB
{
+ class Statistics_state
+ {
+ enum state_codes
+ {
+ EMPTY, /** data is not loaded */
+ LOADING, /** data is being loaded in some connection */
+ READY /** data is loaded and available for use */
+ };
+ int32 state;
+
+ public:
+ /** No state copy */
+ Statistics_state &operator=(const Statistics_state &) { return *this; }
+
+ /** Checks if data loading have been completed */
+ bool is_ready() const
+ {
+ return my_atomic_load32_explicit(const_cast<int32*>(&state),
+ MY_MEMORY_ORDER_ACQUIRE) == READY;
+ }
+
+ /**
+ Sets mutual exclusion for data loading
+
+ If stats are in LOADING state, waits until state change.
+
+ @return
+ @retval true atomic EMPTY -> LOADING transfer completed, ok to load
+ @retval false stats are in READY state, no need to load
+ */
+ bool start_load()
+ {
+ for (;;)
+ {
+ int32 expected= EMPTY;
+ if (my_atomic_cas32_weak_explicit(&state, &expected, LOADING,
+ MY_MEMORY_ORDER_RELAXED,
+ MY_MEMORY_ORDER_RELAXED))
+ return true;
+ if (expected == READY)
+ return false;
+ (void) LF_BACKOFF;
+ }
+ }
+
+ /** Marks data available for subsequent use */
+ void end_load()
+ {
+ DBUG_ASSERT(my_atomic_load32_explicit(&state, MY_MEMORY_ORDER_RELAXED) ==
+ LOADING);
+ my_atomic_store32_explicit(&state, READY, MY_MEMORY_ORDER_RELEASE);
+ }
+
+ /** Restores empty state on error (e.g. OOM) */
+ void abort_load()
+ {
+ DBUG_ASSERT(my_atomic_load32_explicit(&state, MY_MEMORY_ORDER_RELAXED) ==
+ LOADING);
+ my_atomic_store32_explicit(&state, EMPTY, MY_MEMORY_ORDER_RELAXED);
+ }
+ };
+
+ class Statistics_state stats_state;
+ class Statistics_state hist_state;
+
+public:
MEM_ROOT mem_root; /* MEM_ROOT to allocate statistical data for the table */
Table_statistics *table_stats; /* Structure to access the statistical data */
- bool stats_can_be_read; /* Memory for statistical data is allocated */
- bool stats_is_read; /* Statistical data for table has been read
- from statistical tables */
- bool histograms_can_be_read;
- bool histograms_are_read;
+ ulong total_hist_size; /* Total size of all histograms */
+
+ bool histograms_are_ready() const
+ {
+ return !total_hist_size || hist_state.is_ready();
+ }
+
+ bool start_histograms_load()
+ {
+ return total_hist_size && hist_state.start_load();
+ }
+
+ void end_histograms_load() { hist_state.end_load(); }
+ void abort_histograms_load() { hist_state.abort_load(); }
+ bool stats_are_ready() const { return stats_state.is_ready(); }
+ bool start_stats_load() { return stats_state.start_load(); }
+ void end_stats_load() { stats_state.end_load(); }
+ void abort_stats_load() { stats_state.abort_load(); }
};
@@ -1202,9 +1281,16 @@ public:
/* number of select if it is derived table */
uint derived_select_number;
/*
- 0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
- If maybe_null !=0, this table is inner w.r.t. some outer join operation,
- and null_row may be true.
+ Possible values:
+ - 0 by default
+ - JOIN_TYPE_{LEFT|RIGHT} if the table is inner w.r.t an outer join
+ operation
+ - 1 if the SELECT has mixed_implicit_grouping=1. example:
+ select max(col1), col2 from t1. In this case, the query produces
+ one row with all columns having NULL values.
+
+ Interpetation: If maybe_null!=0, all fields of the table are considered
+ NULLable (and have NULL values when null_row=true)
*/
uint maybe_null;
int current_lock; /* Type of lock on table */
@@ -1290,8 +1376,8 @@ public:
bool insert_or_update; /* Can be used by the handler */
bool alias_name_used; /* true if table_name is alias */
bool get_fields_in_item_tree; /* Signal to fix_field */
- bool m_needs_reopen;
private:
+ bool m_needs_reopen;
bool created; /* For tmp tables. TRUE <=> tmp table was actually created.*/
public:
#ifdef HAVE_REPLICATION
@@ -1401,6 +1487,16 @@ public:
/** Should this instance of the table be reopened? */
inline bool needs_reopen()
{ return !db_stat || m_needs_reopen; }
+ /*
+ Mark that all current connection instances of the table should be
+ reopen at end of statement
+ */
+ void mark_table_for_reopen();
+ /* Should only be called from Locked_tables_list::mark_table_for_reopen() */
+ void internal_set_needs_reopen(bool value)
+ {
+ m_needs_reopen= value;
+ }
bool alloc_keys(uint key_count);
bool check_tmp_key(uint key, uint key_parts,
@@ -1470,6 +1566,7 @@ public:
TABLE *tmp_table,
TMP_TABLE_PARAM *tmp_table_param,
bool with_cleanup);
+ int fix_vcol_exprs(THD *thd);
};
@@ -1818,6 +1915,9 @@ struct TABLE_LIST
open_type= routine ? OT_TEMPORARY_OR_BASE : OT_BASE_ONLY;
belong_to_view= belong_to_view_arg;
trg_event_map= trg_event_map_arg;
+ /* MDL is enough for read-only FK checks, we don't need the table */
+ if (prelocking_placeholder == FK && lock_type < TL_WRITE_ALLOW_WRITE)
+ open_strategy= OPEN_STUB;
**last_ptr= this;
prev_global= *last_ptr;
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index b97e0334f0d..005a520ff64 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -338,6 +338,13 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
DBUG_RETURN(false);
}
+ if (!tl->db)
+ {
+ DBUG_PRINT("info",
+ ("Table reference to a temporary table must have database set"));
+ DBUG_RETURN(false);
+ }
+
/*
Temporary tables are not safe for parallel replication. They were
designed to be visible to one thread only, so have no table locking.
@@ -1058,7 +1065,7 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length,
case TMP_TABLE_ANY: found= true; break;
}
}
- if (table && unlikely(table->m_needs_reopen))
+ if (table && unlikely(table->needs_reopen()))
{
share->all_tmp_tables.remove(table);
free_temporary_table(table);
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 0a374147e07..fc9a79432f0 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -45,7 +45,6 @@ static void threadpool_remove_connection(THD *thd);
static int threadpool_process_request(THD *thd);
static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data);
-extern "C" pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
extern bool do_command(THD*);
static inline TP_connection *get_TP_connection(THD *thd)
@@ -87,7 +86,7 @@ struct Worker_thread_context
#ifdef HAVE_PSI_THREAD_INTERFACE
psi_thread = PSI_THREAD_CALL(get_thread)();
#endif
- mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
+ mysys_var= my_thread_var;
}
void restore()
@@ -95,7 +94,7 @@ struct Worker_thread_context
#ifdef HAVE_PSI_THREAD_INTERFACE
PSI_THREAD_CALL(set_thread)(psi_thread);
#endif
- pthread_setspecific(THR_KEY_mysys,mysys_var);
+ set_mysys_var(mysys_var);
pthread_setspecific(THR_THD, 0);
}
};
@@ -141,7 +140,7 @@ static inline void set_thd_idle(THD *thd)
*/
static void thread_attach(THD* thd)
{
- pthread_setspecific(THR_KEY_mysys,thd->mysys_var);
+ set_mysys_var(thd->mysys_var);
thd->thread_stack=(char*)&thd;
thd->store_globals();
#ifdef HAVE_PSI_THREAD_INTERFACE
@@ -228,9 +227,9 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
Store them in THD.
*/
- pthread_setspecific(THR_KEY_mysys, 0);
+ set_mysys_var(NULL);
my_thread_init();
- st_my_thread_var* mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
+ st_my_thread_var* mysys_var= my_thread_var;
if (!mysys_var ||!(thd= connect->create_thd(NULL)))
{
/* Out of memory? */
@@ -325,6 +324,16 @@ static void handle_wait_timeout(THD *thd)
thd->net.error= 2;
}
+/** Check if some client data is cached in thd->net or thd->net.vio */
+static bool has_unread_data(THD* thd)
+{
+ NET *net= &thd->net;
+ if (net->compress && net->remain_in_buf)
+ return true;
+ Vio *vio= net->vio;
+ return vio->has_data(vio);
+}
+
/**
Process a single client request or a single batch.
@@ -359,7 +368,6 @@ static int threadpool_process_request(THD *thd)
*/
for(;;)
{
- Vio *vio;
thd->net.reading_or_writing= 0;
if (mysql_audit_release_required(thd))
mysql_audit_release(thd);
@@ -375,8 +383,7 @@ static int threadpool_process_request(THD *thd)
set_thd_idle(thd);
- vio= thd->net.vio;
- if (!vio->has_data(vio))
+ if (!has_unread_data(thd))
{
/* More info on this debug sync is in sql_parse.cc*/
DEBUG_SYNC(thd, "before_do_command_net_read");
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 434857447a4..78b57340a6b 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -1084,7 +1084,10 @@ void thread_group_destroy(thread_group_t *thread_group)
#endif
if (my_atomic_add32(&shutdown_group_count, -1) == 1)
+ {
my_free(all_groups);
+ all_groups= 0;
+ }
}
/**
@@ -1339,7 +1342,7 @@ void wait_begin(thread_group_t *thread_group)
DBUG_ASSERT(thread_group->connection_count > 0);
if ((thread_group->active_thread_count == 0) &&
- (is_queue_empty(thread_group) || !thread_group->listener))
+ (!is_queue_empty(thread_group) || !thread_group->listener))
{
/*
Group might stall while this thread waits, thus wake
@@ -1677,6 +1680,14 @@ TP_pool_generic::~TP_pool_generic()
{
thread_group_close(&all_groups[i]);
}
+
+ /*
+ Wait until memory occupied by all_groups is freed.
+ */
+ int timeout_ms=5000;
+ while(all_groups && timeout_ms--)
+ my_sleep(1000);
+
threadpool_started= false;
DBUG_VOID_RETURN;
}
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 7cb6e132932..72b7f8e6fe4 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -614,6 +614,9 @@ bool trans_savepoint(THD *thd, LEX_STRING name)
if (thd->transaction.xid_state.check_has_uncommitted_xa())
DBUG_RETURN(TRUE);
+ if (WSREP_ON)
+ wsrep_register_hton(thd, thd->in_multi_stmt_transaction_mode());
+
sv= find_savepoint(thd, name);
if (*sv) /* old savepoint of the same name exists */
@@ -690,6 +693,9 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name)
if (thd->transaction.xid_state.check_has_uncommitted_xa())
DBUG_RETURN(TRUE);
+ if (WSREP_ON)
+ wsrep_register_hton(thd, thd->in_multi_stmt_transaction_mode());
+
/**
Checking whether it is safe to release metadata locks acquired after
savepoint, if rollback to savepoint is successful.
diff --git a/sql/tztime.cc b/sql/tztime.cc
index f3d178c59a2..067348dccab 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1699,7 +1699,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
{
tl->table->use_all_columns();
/* Force close at the end of the function to free memory. */
- tl->table->m_needs_reopen= TRUE;
+ tl->table->mark_table_for_reopen();
}
/*
@@ -2441,7 +2441,7 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=InnoDB;\n"
"END IF|\n"
"\\d ;\n");
@@ -2461,7 +2461,7 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=MyISAM;\n"
"END IF|\n"
"\\d ;\n");
@@ -2713,42 +2713,45 @@ main(int argc, char **argv)
}
if (opt_skip_write_binlog)
+ {
/* If skip_write_binlog is set and wsrep is compiled in we disable
sql_log_bin and wsrep_on to avoid Galera replicating below
truncate table clauses. This will allow user to set different
time zones to nodes in Galera cluster. */
- printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
+ printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
"prepare set_wsrep_write_binlog from @prep1;\n"
"set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n");
-
- if (argc == 1 && !opt_leap)
+ }
+ else
{
- /* Argument is timezonedir */
-
- root_name_end= strmake_buf(fullname, argv[0]);
-
- if(!opt_skip_write_binlog)
- {
// Alter time zone tables to InnoDB if wsrep_on is enabled
// to allow changes to them to replicate with Galera
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_name ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_transition ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_transition_type ENGINE=InnoDB;\n"
"END IF|\n"
"\\d ;\n");
- }
+ }
+
+ if (argc == 1 && !opt_leap)
+ {
+ /* Argument is timezonedir */
+
+ root_name_end= strmake_buf(fullname, argv[0]);
printf("TRUNCATE TABLE time_zone;\n");
printf("TRUNCATE TABLE time_zone_name;\n");
printf("TRUNCATE TABLE time_zone_transition;\n");
printf("TRUNCATE TABLE time_zone_transition_type;\n");
+ printf("START TRANSACTION;\n");
if (scan_tz_dir(root_name_end, 0, opt_verbose))
{
+ printf("ROLLBACK;\n");
fflush(stdout);
fprintf(stderr,
"There were fatal errors during processing "
@@ -2756,6 +2759,7 @@ main(int argc, char **argv)
return 1;
}
+ printf("COMMIT;\n");
printf("ALTER TABLE time_zone_transition "
"ORDER BY Time_zone_id, Transition_time;\n");
printf("ALTER TABLE time_zone_transition_type "
@@ -2788,7 +2792,7 @@ main(int argc, char **argv)
// Fall back to MyISAM
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=MyISAM;\n"
"ALTER TABLE time_zone_name ENGINE=MyISAM;\n"
"ALTER TABLE time_zone_transition ENGINE=MyISAM;\n"
diff --git a/sql/uniques.cc b/sql/uniques.cc
index ddddc75cc59..4509cc8edaf 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -318,6 +318,9 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
max_elements_in_tree= ((size_t) max_in_memory_size /
ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
+ if (max_elements_in_tree == 0)
+ max_elements_in_tree= 1;
+
n_full_trees= nkeys / max_elements_in_tree;
last_tree_elems= nkeys % max_elements_in_tree;
@@ -786,7 +789,12 @@ bool Unique::get(TABLE *table)
/* Not enough memory; Save the result to file && free memory used by tree */
if (flush())
DBUG_RETURN(1);
- size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ /*
+ merge_buffer must fit at least MERGEBUFF2 + 1 keys, because
+ merge_index() can merge that many BUFFPEKs at once. The extra space for
+ one key for Sort_param::unique_buff
+ */
+ size_t buff_sz= MY_MAX(MERGEBUFF2+1, max_in_memory_size/full_size+1) * full_size;
if (!(sort_buffer= (uchar*) my_malloc(buff_sz,
MYF(MY_THREAD_SPECIFIC|MY_WME))))
DBUG_RETURN(1);
diff --git a/sql/uniques.h b/sql/uniques.h
index 654b3692aaa..a4f5b378fb0 100644
--- a/sql/uniques.h
+++ b/sql/uniques.h
@@ -29,14 +29,20 @@
class Unique :public Sql_alloc
{
DYNAMIC_ARRAY file_ptrs;
- ulong max_elements;
+ ulong max_elements; /* Total number of elements that will be stored in-memory */
size_t max_in_memory_size;
IO_CACHE file;
TREE tree;
+ /* Number of elements filtered out due to min_dupl_count when storing results
+ to table. See Unique::get */
ulong filtered_out_elems;
uint size;
- uint full_size;
- uint min_dupl_count; /* always 0 for unions, > 0 for intersections */
+
+ uint full_size; /* Size of element + space needed to store the number of
+ duplicates found for the element. */
+ uint min_dupl_count; /* Minimum number of occurences of element required for
+ it to be written to record_pointers.
+ always 0 for unions, > 0 for intersections */
bool with_counters;
bool merge(TABLE *table, uchar *buff, bool without_last_merge);
@@ -79,6 +85,9 @@ public:
{
size_t max_elems_in_tree=
max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
+
+ if (max_elems_in_tree == 0)
+ max_elems_in_tree= 1;
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
}
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 14c51a0de91..083960523c1 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -312,7 +312,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
pos+= reclength;
int2store(pos, create_info->connect_string.length);
pos+= 2;
- memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
+ if (create_info->connect_string.length)
+ memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
pos+= create_info->connect_string.length;
int2store(pos, str_db_type.length);
pos+= 2;
@@ -593,6 +594,18 @@ static bool pack_vcols(String *buf, List<Create_field> &create_fields,
}
+static uint typelib_values_packed_length(const TYPELIB *t)
+{
+ uint length= 0;
+ for (uint i= 0; t->type_names[i]; i++)
+ {
+ length+= t->type_lengths[i];
+ length++; /* Separator */
+ }
+ return length;
+}
+
+
/* Make formheader */
static bool pack_header(THD *thd, uchar *forminfo,
@@ -685,9 +698,8 @@ static bool pack_header(THD *thd, uchar *forminfo,
field->interval_id=get_interval_id(&int_count,create_fields,field);
if (old_int_count != int_count)
{
- for (const char **pos=field->interval->type_names ; *pos ; pos++)
- int_length+=(uint) strlen(*pos)+1; // field + suffix prefix
- int_parts+=field->interval->count+1;
+ int_length+= typelib_values_packed_length(field->interval);
+ int_parts+= field->interval->count + 1;
}
}
if (f_maybe_null(field->pack_flag))
@@ -776,11 +788,7 @@ static size_t packed_fields_length(List<Create_field> &create_fields)
{
int_count= field->interval_id;
length++;
- for (int i=0; field->interval->type_names[i]; i++)
- {
- length+= field->interval->type_lengths[i];
- length++;
- }
+ length+= typelib_values_packed_length(field->interval);
length++;
}
diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h
index 28a14ab7c11..03197227f8e 100644
--- a/sql/win_tzname_data.h
+++ b/sql/win_tzname_data.h
@@ -23,13 +23,13 @@
{L"Haiti Standard Time","America/Port-au-Prince"},
{L"Cuba Standard Time","America/Havana"},
{L"US Eastern Standard Time","America/Indianapolis"},
+{L"Turks And Caicos Standard Time","America/Grand_Turk"},
{L"Paraguay Standard Time","America/Asuncion"},
{L"Atlantic Standard Time","America/Halifax"},
{L"Venezuela Standard Time","America/Caracas"},
{L"Central Brazilian Standard Time","America/Cuiaba"},
{L"SA Western Standard Time","America/La_Paz"},
{L"Pacific SA Standard Time","America/Santiago"},
-{L"Turks And Caicos Standard Time","America/Grand_Turk"},
{L"Newfoundland Standard Time","America/St_Johns"},
{L"Tocantins Standard Time","America/Araguaina"},
{L"E. South America Standard Time","America/Sao_Paulo"},
@@ -46,11 +46,11 @@
{L"UTC","Etc/GMT"},
{L"GMT Standard Time","Europe/London"},
{L"Greenwich Standard Time","Atlantic/Reykjavik"},
+{L"Sao Tome Standard Time","Africa/Sao_Tome"},
+{L"Morocco Standard Time","Africa/Casablanca"},
{L"W. Europe Standard Time","Europe/Berlin"},
{L"Central Europe Standard Time","Europe/Budapest"},
{L"Romance Standard Time","Europe/Paris"},
-{L"Morocco Standard Time","Africa/Casablanca"},
-{L"Sao Tome Standard Time","Africa/Sao_Tome"},
{L"Central European Standard Time","Europe/Warsaw"},
{L"W. Central Africa Standard Time","Africa/Lagos"},
{L"Jordan Standard Time","Asia/Amman"},
@@ -81,11 +81,13 @@
{L"Mauritius Standard Time","Indian/Mauritius"},
{L"Saratov Standard Time","Europe/Saratov"},
{L"Georgian Standard Time","Asia/Tbilisi"},
+{L"Volgograd Standard Time","Europe/Volgograd"},
{L"Caucasus Standard Time","Asia/Yerevan"},
{L"Afghanistan Standard Time","Asia/Kabul"},
{L"West Asia Standard Time","Asia/Tashkent"},
{L"Ekaterinburg Standard Time","Asia/Yekaterinburg"},
{L"Pakistan Standard Time","Asia/Karachi"},
+{L"Qyzylorda Standard Time","Asia/Qyzylorda"},
{L"India Standard Time","Asia/Calcutta"},
{L"Sri Lanka Standard Time","Asia/Colombo"},
{L"Nepal Standard Time","Asia/Katmandu"},
diff --git a/sql/winservice.c b/sql/winservice.c
index ceab83f50ee..371a447c51d 100644
--- a/sql/winservice.c
+++ b/sql/winservice.c
@@ -116,6 +116,24 @@ BOOL exclude_service(mysqld_service_properties *props)
}
+static void get_datadir_from_ini(const char *ini, char *service_name, char *datadir, size_t sz)
+{
+ *datadir= 0;
+ const char *sections[]= {service_name, "mysqld", "server", "mariadb",
+ "mariadbd"};
+ for (int i= 0; i < sizeof(sections) / sizeof(sections[0]); i++)
+ {
+ if (sections[i])
+ {
+ GetPrivateProfileStringA(sections[i], "datadir", NULL, datadir,
+ (DWORD) sz, ini);
+ if (*datadir)
+ return;
+ }
+ }
+}
+
+
/*
Retrieve some properties from windows mysqld service binary path.
We're interested in ini file location and datadir, and also in version of
@@ -135,6 +153,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
wchar_t **args= NULL;
int retval= 1;
BOOL have_inifile;
+ char service_name[MAX_PATH];
props->datadir[0]= 0;
props->inifile[0]= 0;
@@ -148,12 +167,9 @@ int get_mysql_service_properties(const wchar_t *bin_path,
{
/*
There are rare cases where service config does not have
- --defaults-filein the binary parth . There services were registered with
+ --defaults-file in the binary parth . There services were registered with
plain mysqld --install, the data directory is next to "bin" in this case.
- Service name (second parameter) must be MySQL.
*/
- if(wcscmp(args[1], L"MySQL") != 0)
- goto end;
have_inifile= FALSE;
}
else if(numargs == 3)
@@ -165,6 +181,9 @@ int get_mysql_service_properties(const wchar_t *bin_path,
goto end;
}
+ /* Last parameter is the service name*/
+ wcstombs(service_name, args[numargs-1], MAX_PATH);
+
if(have_inifile && wcsncmp(args[1], L"--defaults-file=", 16) != 0)
goto end;
@@ -196,8 +215,8 @@ int get_mysql_service_properties(const wchar_t *bin_path,
normalize_path(props->inifile, MAX_PATH);
if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
{
- GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, MAX_PATH,
- props->inifile);
+ get_datadir_from_ini(props->inifile, service_name, props->datadir,
+ sizeof(props->datadir));
}
else
{
@@ -211,7 +230,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
}
}
- if(!have_inifile)
+ if(!have_inifile || props->datadir[0] == 0)
{
/*
Hard, although a rare case, we're guessing datadir and defaults-file.
@@ -235,22 +254,25 @@ int get_mysql_service_properties(const wchar_t *bin_path,
*p= 0;
}
- /* Look for my.ini, my.cnf in the install root */
- sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
- if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
+ if (!have_inifile)
{
- sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
- }
- if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
- {
- /* Ini file found, get datadir from there */
- GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir,
- MAX_PATH, props->inifile);
- }
- else
- {
- /* No ini file */
- props->inifile[0]= 0;
+ /* Look for my.ini, my.cnf in the install root */
+ sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
+ if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
+ {
+ sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
+ }
+ if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
+ {
+ /* Ini file found, get datadir from there */
+ get_datadir_from_ini(props->inifile, service_name, props->datadir,
+ sizeof(props->datadir));
+ }
+ else
+ {
+ /* No ini file */
+ props->inifile[0]= 0;
+ }
}
/* Try datadir in install directory.*/
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index f7bab7c5fc8..66335c412e2 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -98,7 +98,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
}
mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
if (thd->wsrep_conflict_state!= REPLAYING)
thd->wsrep_conflict_state= NO_CONFLICT;
mysql_mutex_unlock(&thd->LOCK_thd_data);
@@ -197,7 +197,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
error:
mysql_mutex_lock(&thd->LOCK_thd_data);
- thd->wsrep_query_state= QUERY_IDLE;
+ wsrep_thd_set_query_state(thd, QUERY_IDLE);
mysql_mutex_unlock(&thd->LOCK_thd_data);
assert(thd->wsrep_exec_mode== REPL_RECV);
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index 6e4e9f50e31..9602dd698eb 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -376,20 +376,6 @@ int wsrep_binlog_close_connection(THD* thd)
DBUG_RETURN(0);
}
-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);
- 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);
- return rcode;
-}
-
#if 0
void wsrep_dump_rbr_direct(THD* thd, IO_CACHE* cache)
{
diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h
index c2ccacdc180..ed8e19ed651 100644
--- a/sql/wsrep_binlog.h
+++ b/sql/wsrep_binlog.h
@@ -54,7 +54,5 @@ 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);
#endif /* WSREP_BINLOG_H */
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index b98dd1e5790..53941c06892 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 SkySQL Ab.
+/* Copyright (C) 2014, 2020, 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
@@ -148,5 +148,13 @@ void wsrep_unlock_rollback()
void wsrep_set_data_home_dir(const char *)
{ }
+void wsrep_log(void (*)(const char *, ...), const char *, ...)
+{
+}
+
my_bool wsrep_thd_is_applier(MYSQL_THD thd)
{ return false; }
+
+void wsrep_report_bf_lock_wait(MYSQL_THD thd,
+ unsigned long long id)
+{}
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index c34e14b7e1f..575c57c5d24 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -37,6 +37,8 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd);
void wsrep_cleanup_transaction(THD *thd)
{
if (!WSREP(thd)) return;
+ DBUG_ASSERT(thd->wsrep_conflict_state != MUST_REPLAY &&
+ thd->wsrep_conflict_state != REPLAYING);
if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd);
thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
@@ -137,7 +139,11 @@ void wsrep_post_commit(THD* thd, bool all)
/* non-InnoDB statements may have populated events in stmt cache
=> cleanup
*/
- WSREP_DEBUG("cleanup transaction for LOCAL_STATE");
+ if (thd->wsrep_conflict_state != MUST_REPLAY)
+ {
+ WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s",
+ WSREP_QUERY(thd));
+ }
/*
Run post-rollback hook to clean up in the case if
some keys were populated for the transaction in provider
@@ -146,13 +152,18 @@ void wsrep_post_commit(THD* thd, bool all)
rolls back to savepoint after first operation.
*/
if (all && thd->wsrep_conflict_state != MUST_REPLAY &&
- wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
+ thd->wsrep_conflict_state != REPLAYING &&
+ 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;
+ if (thd->wsrep_conflict_state != MUST_REPLAY &&
+ thd->wsrep_conflict_state != REPLAYING)
+ {
+ wsrep_cleanup_transaction(thd);
+ }
+ break;
}
default: break;
}
@@ -219,32 +230,20 @@ static int wsrep_prepare(handlerton *hton, THD *thd, bool all)
DBUG_RETURN(0);
}
+/*
+ Empty callbacks to support SAVEPOINT callbacks.
+*/
+
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);
+ DBUG_RETURN(0);
}
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);
+ DBUG_RETURN(0);
}
static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
@@ -439,7 +438,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
DBUG_RETURN(WSREP_TRX_CERT_FAIL);
}
- thd->wsrep_query_state = QUERY_COMMITTING;
+ wsrep_thd_set_query_state(thd, QUERY_COMMITTING);
mysql_mutex_unlock(&thd->LOCK_thd_data);
cache = get_trans_log(thd);
@@ -473,18 +472,35 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
{
WSREP_DEBUG("empty rbr buffer, query: %s", thd->query());
}
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, 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"
+ /*
+ Async replication slave may have applied some non-innodb workload,
+ and then has written replication "meta data" into gtid_slave_pos
+ innodb table. Writes to gtid_slave_pos must not be replicated,
+ but this activity has caused that innodb hton is registered for this
+ transaction, but no wsrep keys have been appended.
+ We enter in this code path, because IO cache has events for non-innodb
+ tables.
+ => we should not treat it an error if trx is not introduced for provider
+ */
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
+ {
+ WSREP_DEBUG("skipping wsrep replication for async slave, error not raised");
+ DBUG_RETURN(WSREP_TRX_OK);
+ }
+
+ WSREP_WARN("SQL statement was ineffective thd: %llu buf: %zu\n"
"schema: %s \n"
"QUERY: %s\n"
" => Skipping replication",
- (longlong) thd->thread_id, data_len,
+ (ulonglong) thd->thread_id, data_len,
(thd->db ? thd->db : "(null)"), thd->query());
+
rcode = WSREP_TRX_FAIL;
}
else if (!rcode)
@@ -561,10 +577,11 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
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);
+ WSREP_DEBUG("commit failed for reason: %d conf %d",
+ rcode, thd->wsrep_conflict_state);
DBUG_PRINT("wsrep", ("replicating commit fail"));
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
if (thd->wsrep_conflict_state == MUST_ABORT) {
thd->wsrep_conflict_state= ABORTED;
@@ -596,7 +613,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
DBUG_RETURN(WSREP_TRX_ERROR);
}
- thd->wsrep_query_state= QUERY_EXEC;
+ wsrep_thd_set_query_state(thd, QUERY_EXEC);
mysql_mutex_unlock(&thd->LOCK_thd_data);
DBUG_RETURN(WSREP_TRX_OK);
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 5e2e48fd15d..d392d1c2a61 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -37,7 +37,6 @@
#include <cstdio>
#include <cstdlib>
#include "log_event.h"
-#include <slave.h>
#include "sql_plugin.h" /* wsrep_plugins_pre_init() */
#include <vector>
@@ -260,6 +259,17 @@ static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) {
}
}
+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,
@@ -629,7 +639,6 @@ int wsrep_init()
{
// 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;
@@ -640,10 +649,15 @@ int wsrep_init()
{
DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
+ wsrep_ready_set(FALSE);
wsrep->free(wsrep);
free(wsrep);
wsrep = NULL;
}
+ else
+ {
+ wsrep_inited= 1;
+ }
return rcode;
}
else
@@ -1544,6 +1558,39 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
{
return false;
}
+ /*
+ If mariadb master has replicated a CTAS, we should not replicate the create table
+ part separately as TOI, but to replicate both create table and following inserts
+ as one write set.
+ Howver, if CTAS creates empty table, we should replicate the create table alone
+ as TOI. We have to do relay log event lookup to see if row events follow the
+ create table event.
+ */
+ if (thd->slave_thread && !(thd->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_STANDALONE))
+ {
+ /* this is CTAS, either empty or populated table */
+ ulonglong event_size = 0;
+ enum Log_event_type ev_type= wsrep_peak_event(thd->rgi_slave, &event_size);
+ switch (ev_type)
+ {
+ case QUERY_EVENT:
+ /* CTAS with empty table, we replicate create table as TOI */
+ break;
+
+ case TABLE_MAP_EVENT:
+ WSREP_DEBUG("replicating CTAS of empty table as TOI");
+ // fall through
+ case WRITE_ROWS_EVENT:
+ /* CTAS with populated table, we replicate later at commit time */
+ WSREP_DEBUG("skipping create table of CTAS replication");
+ return false;
+
+ default:
+ WSREP_WARN("unexpected async replication event: %d", ev_type);
+ }
+ return true;
+ }
+ /* no next async replication event */
return true;
case SQLCOM_CREATE_VIEW:
@@ -1565,7 +1612,6 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
case SQLCOM_CREATE_TRIGGER:
- DBUG_ASSERT(!table_list);
DBUG_ASSERT(first_table);
if (thd->find_temporary_table(first_table))
@@ -1574,6 +1620,14 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
}
return true;
+ case SQLCOM_DROP_TRIGGER:
+ DBUG_ASSERT(table_list);
+ if (thd->find_temporary_table(table_list))
+ {
+ return false;
+ }
+ return true;
+
default:
if (table && !thd->find_temporary_table(db, table))
{
@@ -1752,7 +1806,7 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
}
my_error(ER_LOCK_DEADLOCK, MYF(0));
- return(1);
+ return(-1);
}
wsrep_seqno_t seqno = wsrep->pause(wsrep);
@@ -2279,6 +2333,7 @@ static my_bool have_committing_connections()
if (is_committing_connection(tmp))
{
+ mysql_mutex_unlock(&LOCK_thread_count);
return TRUE;
}
}
@@ -2549,6 +2604,17 @@ 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)
{
+ /* async slave thread should never flag IDLE state, as it may
+ give rollbacker thread chance to interfere and rollback async slave
+ transaction.
+ in fact, async slave thread is never idle as it reads complete
+ transactions from relay log and applies them, as a whole.
+ BF abort happens voluntarily by async slave thread.
+ */
+ if (thd->slave_thread && state == QUERY_IDLE) {
+ WSREP_DEBUG("Skipping IDLE state change for slave SQL");
+ return;
+ }
thd->wsrep_query_state= state;
}
@@ -2858,7 +2924,12 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
definer_host.length= 0;
}
- stmt_query.append(STRING_WITH_LEN("CREATE "));
+ const LEX_STRING command[3]=
+ {{ C_STRING_WITH_LEN("CREATE ") },
+ { C_STRING_WITH_LEN("ALTER ") },
+ { C_STRING_WITH_LEN("CREATE OR REPLACE ") }};
+ stmt_query.append(command[thd->lex->create_view_mode].str,
+ command[thd->lex->create_view_mode].length);
append_definer(thd, &stmt_query, &definer_user, &definer_host);
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 96b3e63914b..3d68eda0d6b 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -131,8 +131,8 @@ extern const char* wsrep_provider_name;
extern const char* wsrep_provider_version;
extern const char* wsrep_provider_vendor;
-int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope);
+int wsrep_show_status(THD *thd, SHOW_VAR *var, void *buff,
+ system_status_var *status_var, enum_var_type scope);
int wsrep_init();
void wsrep_deinit(bool free_options);
@@ -181,13 +181,7 @@ 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_ON unlikely(global_system_variables.wsrep_on)
#define WSREP(thd) \
(WSREP_ON && thd->variables.wsrep_on)
@@ -203,13 +197,8 @@ extern wsrep_seqno_t wsrep_locked_seqno;
? wsrep_forced_binlog_format : (ulong)(my_format))
// prefix all messages with "WSREP"
-#define WSREP_LOG(fun, ...) \
- do { \
- char msg[1024] = {'\0'}; \
- snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \
- fun("WSREP: %s", msg); \
- } while(0)
-
+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 " \
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 9472d66f4d3..65a3f971c62 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-2020 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
@@ -1542,10 +1542,13 @@ static void* sst_donor_thread (void* a)
char out_buf[out_len];
wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED;
- wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST
+ // seqno of complete SST
+ wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED;
- wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can
- // operate with wsrep_ready == OFF
+ // We turn off wsrep_on for this THD so that it can
+ // operate with wsrep_ready == OFF
+ // We also set this SST thread THD as system thread
+ wsp::thd thd(FALSE, true);
wsp::process proc(arg->cmd, "r", arg->env);
err= proc.error();
@@ -1723,24 +1726,65 @@ static int sst_donate_other (const char* method,
return arg.err;
}
+/* return true if character can be a part of a filename */
+static bool filename_char(int const c)
+{
+ return isalnum(c) || (c == '-') || (c == '_') || (c == '.');
+}
+
+/* return true if character can be a part of an address string */
+static bool address_char(int const c)
+{
+ return filename_char(c) ||
+ (c == ':') || (c == '[') || (c == ']') || (c == '/');
+}
+
+static bool check_request_str(const char* const str,
+ bool (*check) (int c))
+{
+ for (size_t i(0); str[i] != '\0'; ++i)
+ {
+ if (!check(str[i]))
+ {
+ WSREP_WARN("Illegal character in state transfer request: %i (%c).",
+ str[i], str[i]);
+ return true;
+ }
+ }
+
+ return false;
+}
+
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)
{
- /* 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);
+
+ if (check_request_str(method, filename_char))
+ {
+ WSREP_ERROR("Bad SST method name. SST canceled.");
+ return WSREP_CB_FAILURE;
+ }
+
const char* data = method + method_len + 1;
+ if (check_request_str(data, address_char))
+ {
+ WSREP_ERROR("Bad SST address string. SST canceled.");
+ return WSREP_CB_FAILURE;
+ }
+
char uuid_str[37];
wsrep_uuid_print (&current_gtid->uuid, uuid_str, sizeof(uuid_str));
+ /* 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);
+
wsp::env env(NULL);
if (env.error())
{
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 413d7f97214..4dddb399bd1 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -93,10 +93,12 @@ void wsrep_client_rollback(THD *thd)
#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)
+static rpl_group_info* wsrep_relay_group_init(THD *thd, const char* log_fname)
{
Relay_log_info* rli= new Relay_log_info(false);
+ WSREP_DEBUG("wsrep_relay_group_init %s", log_fname);
+
if (!rli->relay_log.description_event_for_exec)
{
rli->relay_log.description_event_for_exec=
@@ -125,7 +127,7 @@ static rpl_group_info* wsrep_relay_group_init(const char* log_fname)
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;
+ rgi->thd= rli->sql_driver_thd= thd;
if ((rgi->deferred_events_collecting= rli->mi->rpl_filter->is_on()))
{
@@ -150,11 +152,12 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
else
thd->variables.option_bits&= ~(OPTION_BIN_LOG);
- if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init("wsrep_relay");
+ if (!thd->wsrep_rgi) thd->wsrep_rgi= wsrep_relay_group_init(thd, "wsrep_relay");
/* 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);
+ if (!thd->slave_thread)
+ 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;
@@ -181,7 +184,8 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->user_time = shadow->user_time;
thd->reset_db(shadow->db, shadow->db_length);
- delete thd->system_thread_info.rpl_sql_info;
+ if (!thd->slave_thread)
+ delete thd->system_thread_info.rpl_sql_info;
delete thd->wsrep_rgi->rli->mi;
delete thd->wsrep_rgi->rli;
@@ -191,6 +195,109 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->set_row_count_func(shadow->row_count_func);
}
+void wsrep_replay_sp_transaction(THD* thd)
+{
+ DBUG_ENTER("wsrep_replay_sp_transaction");
+ mysql_mutex_assert_owner(&thd->LOCK_thd_data);
+ DBUG_ASSERT(thd->wsrep_conflict_state == MUST_REPLAY);
+ DBUG_ASSERT(wsrep_thd_trx_seqno(thd) > 0);
+
+ WSREP_DEBUG("replaying SP transaction %llu", thd->thread_id);
+ close_thread_tables(thd);
+ if (thd->locked_tables_mode && thd->lock)
+ {
+ WSREP_DEBUG("releasing table lock for replaying (%u)",
+ thd->thread_id);
+ thd->locked_tables_list.unlock_locked_tables(thd);
+ thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
+ }
+ thd->mdl_context.release_transactional_locks();
+
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+ THD *replay_thd= new THD(true);
+ replay_thd->thread_stack= thd->thread_stack;
+
+ struct wsrep_thd_shadow shadow;
+ wsrep_prepare_bf_thd(replay_thd, &shadow);
+ WSREP_DEBUG("replaying set for %p rgi %p", replay_thd, replay_thd->wsrep_rgi); replay_thd->wsrep_trx_meta= thd->wsrep_trx_meta;
+ replay_thd->wsrep_ws_handle= thd->wsrep_ws_handle;
+ replay_thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID;
+ replay_thd->wsrep_conflict_state= REPLAYING;
+
+ replay_thd->variables.option_bits|= OPTION_BEGIN;
+ replay_thd->server_status|= SERVER_STATUS_IN_TRANS;
+
+ thd->reset_globals();
+ replay_thd->store_globals();
+ wsrep_status_t rcode= wsrep->replay_trx(wsrep,
+ &replay_thd->wsrep_ws_handle,
+ (void*) replay_thd);
+
+ wsrep_return_from_bf_mode(replay_thd, &shadow);
+ replay_thd->reset_globals();
+ delete replay_thd;
+
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+
+ thd->store_globals();
+
+ switch (rcode)
+ {
+ case WSREP_OK:
+ {
+ thd->wsrep_conflict_state= NO_CONFLICT;
+ thd->killed= NOT_KILLED;
+ wsrep_status_t rcode= wsrep->post_commit(wsrep, &thd->wsrep_ws_handle);
+ if (rcode != WSREP_OK)
+ {
+ WSREP_WARN("Post commit failed for SP replay: thd: %u error: %d",
+ thd->thread_id, rcode);
+ }
+ /* As replaying the transaction was successful, an error must not
+ be returned to client, so we need to reset the error state of
+ the diagnostics area */
+ thd->get_stmt_da()->reset_diagnostics_area();
+ break;
+ }
+ case WSREP_TRX_FAIL:
+ {
+ thd->wsrep_conflict_state= ABORTED;
+ wsrep_status_t rcode= wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle);
+ if (rcode != WSREP_OK)
+ {
+ WSREP_WARN("Post rollback failed for SP replay: thd: %u error: %d",
+ thd->thread_id, rcode);
+ }
+ if (thd->get_stmt_da()->is_set())
+ {
+ thd->get_stmt_da()->reset_diagnostics_area();
+ }
+ my_error(ER_LOCK_DEADLOCK, MYF(0));
+ break;
+ }
+ default:
+ WSREP_ERROR("trx_replay failed for: %d, schema: %s, query: %s",
+ rcode,
+ (thd->db ? thd->db : "(null)"),
+ WSREP_QUERY(thd));
+ /* we're now in inconsistent state, must abort */
+ 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: %u",
+ wsrep_replaying, thd->thread_id);
+ mysql_cond_broadcast(&COND_wsrep_replaying);
+ mysql_mutex_unlock(&LOCK_wsrep_replaying);
+
+ DBUG_VOID_RETURN;
+}
+
void wsrep_replay_transaction(THD *thd)
{
DBUG_ENTER("wsrep_replay_transaction");
@@ -416,29 +523,46 @@ static void wsrep_replication_process(THD *thd)
DBUG_VOID_RETURN;
}
-static bool create_wsrep_THD(wsrep_thread_args* args)
+static bool create_wsrep_THD(wsrep_thread_args* args, bool thread_count_lock)
{
- mysql_mutex_lock(&LOCK_thread_count);
+ if (!thread_count_lock)
+ mysql_mutex_lock(&LOCK_thread_count);
+
ulong old_wsrep_running_threads= wsrep_running_threads;
+
DBUG_ASSERT(args->thread_type == WSREP_APPLIER_THREAD ||
args->thread_type == WSREP_ROLLBACKER_THREAD);
+
bool res= mysql_thread_create(args->thread_type == WSREP_APPLIER_THREAD
? key_wsrep_applier : key_wsrep_rollbacker,
&args->thread_id, &connection_attrib,
start_wsrep_THD, (void*)args);
+
+ if (res)
+ {
+ WSREP_ERROR("Can't create wsrep thread");
+ }
+
/*
if starting a thread on server startup, wait until the this thread's THD
is fully initialized (otherwise a THD initialization code might
try to access a partially initialized server data structure - MDEV-8208).
*/
if (!mysqld_server_initialized)
+ {
while (old_wsrep_running_threads == wsrep_running_threads)
+ {
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
+ }
+ }
+
+ if (!thread_count_lock)
+ mysql_mutex_unlock(&LOCK_thread_count);
+
return res;
}
-void wsrep_create_appliers(long threads)
+bool wsrep_create_appliers(long threads, bool thread_count_lock)
{
if (!wsrep_connected)
{
@@ -450,26 +574,32 @@ void wsrep_create_appliers(long threads)
"connection at '%s'", wsrep_cluster_address);
assert(0);
}
- return;
+ return false;
}
- long wsrep_threads=0;
+ long wsrep_threads= 0;
+
while (wsrep_threads++ < threads) {
wsrep_thread_args* arg;
- if((arg = (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL) {
+
+ if((arg= (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL)
+ {
WSREP_ERROR("Can't allocate memory for wsrep replication thread %ld\n", wsrep_threads);
assert(0);
}
- arg->thread_type = WSREP_APPLIER_THREAD;
- arg->processor = wsrep_replication_process;
+ arg->thread_type= WSREP_APPLIER_THREAD;
+ arg->processor= wsrep_replication_process;
- if (create_wsrep_THD(arg)) {
- WSREP_WARN("Can't create thread to manage wsrep replication");
+ if (create_wsrep_THD(arg, thread_count_lock))
+ {
+ WSREP_ERROR("Can't create thread to manage wsrep replication");
my_free(arg);
- return;
+ return true;
}
}
+
+ return false;
}
static void wsrep_rollback_process(THD *thd)
@@ -565,7 +695,7 @@ void wsrep_create_rollbacker()
arg->processor = wsrep_rollback_process;
/* create rollbacker */
- if (create_wsrep_THD(arg)) {
+ if (create_wsrep_THD(arg, false)) {
WSREP_WARN("Can't create thread to manage wsrep rollback");
my_free(arg);
return;
@@ -746,3 +876,23 @@ bool wsrep_is_load_multi_commit(THD *thd)
{
return thd->wsrep_split_flag;
}
+
+void wsrep_report_bf_lock_wait(THD *thd,
+ unsigned long long trx_id)
+{
+ if (thd)
+ {
+ WSREP_ERROR("Thread %s trx_id: %llu thread: %ld "
+ "seqno: %lld query_state: %s conf_state: %s exec_mode: %s "
+ "applier: %d query: %s",
+ wsrep_thd_is_BF(thd, false) ? "BF" : "normal",
+ trx_id,
+ thd_get_thread_id(thd),
+ wsrep_thd_trx_seqno(thd),
+ wsrep_thd_query_state_str(thd),
+ wsrep_thd_conflict_state_str(thd),
+ wsrep_thd_exec_mode_str(thd),
+ thd->wsrep_applier,
+ wsrep_thd_query(thd));
+ }
+}
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index 6ce14a4eb0e..46bc08a466a 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -25,8 +25,9 @@
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_replay_sp_transaction(THD* thd);
void wsrep_replay_transaction(THD *thd);
-void wsrep_create_appliers(long threads);
+bool wsrep_create_appliers(long threads, bool thread_count_lock=false);
void wsrep_create_rollbacker();
int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
@@ -44,6 +45,9 @@ 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);
+extern void wsrep_report_bf_lock_wait(THD *thd,
+ unsigned long long trx_id);
+
#else /* WITH_WSREP */
#define wsrep_thd_is_BF(T, S) (0)
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index 599ece4cb40..e86be3e5d93 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -413,7 +413,7 @@ process::wait ()
return err_;
}
-thd::thd (my_bool won) : init(), ptr(new THD(0))
+thd::thd (my_bool won, bool system_thread) : init(), ptr(new THD(0))
{
if (ptr)
{
@@ -421,6 +421,8 @@ thd::thd (my_bool won) : init(), ptr(new THD(0))
ptr->store_globals();
ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog
ptr->variables.wsrep_on = won;
+ if (system_thread)
+ ptr->system_thread= SYSTEM_THREAD_GENERIC;
ptr->security_ctx->master_access= ~(ulong)0;
lex_start(ptr);
}
diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h
index 616a6d3f457..d4d9e62a620 100644
--- a/sql/wsrep_utils.h
+++ b/sql/wsrep_utils.h
@@ -298,7 +298,7 @@ class thd
public:
- thd(my_bool wsrep_on);
+ thd(my_bool wsrep_on, bool system_thread=false);
~thd();
THD* const ptr;
};
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 0f7f7ef2acf..45f929de9de 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -602,16 +602,22 @@ static void wsrep_slave_count_change_update ()
bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
{
+ mysql_mutex_lock(&LOCK_thread_count);
+ bool res= false;
+
wsrep_slave_count_change_update();
if (wsrep_slave_count_change > 0)
{
WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads);
- wsrep_create_appliers(wsrep_slave_count_change);
+ res= wsrep_create_appliers(wsrep_slave_count_change, true);
WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads);
wsrep_slave_count_change = 0;
}
- return false;
+
+ mysql_mutex_unlock(&LOCK_thread_count);
+
+ return res;
}
bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var)
@@ -720,8 +726,8 @@ static int show_var_cmp(const void *var1, const void *var2)
return strcasecmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
}
-int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
+int wsrep_show_status (THD *thd, SHOW_VAR *var, void *buff,
+ system_status_var *, enum_var_type scope)
{
uint i, maxi= SHOW_VAR_FUNC_BUFF_SIZE / sizeof(*var) - 1;
SHOW_VAR *v= (SHOW_VAR *)buff;
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index e34386ddf33..07275b8eec1 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -20,6 +20,7 @@
#include "thr_lock.h" /* THR_LOCK */
#include "handler.h" /* handler */
#include "table.h" /* TABLE_SHARE */
+#include "sql_const.h" /* MAX_KEY */
/*
Shared structure for correct LOCK operation
@@ -65,9 +66,9 @@ public:
HA_READ_ORDER | HA_KEYREAD_ONLY);
}
/* The following defines can be increased if necessary */
-#define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */
+#define BLACKHOLE_MAX_KEY MAX_KEY /* Max allowed keys */
#define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */
-#define BLACKHOLE_MAX_KEY_LENGTH 1000
+#define BLACKHOLE_MAX_KEY_LENGTH 3500 /* Like in InnoDB */
uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; }
uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index 5e04f65f748..eba9d0d8575 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -84,6 +84,7 @@ char* NextChr(PSZ s, char sep)
return p2;
} // end of NextChr
+#if 0
/***********************************************************************/
/* Allocate a VAL structure, make sure common field and Nd are zeroed. */
/***********************************************************************/
@@ -96,6 +97,7 @@ PVL AllocVal(PGLOBAL g, JTYP type)
vlp->Type = type;
return vlp;
} // end of AllocVal
+#endif // 0
/***********************************************************************/
/* Parse a json string. */
@@ -633,18 +635,22 @@ PJVAL JDOC::ParseValue(PGLOBAL g, int& i)
switch (s[i]) {
case '[':
jvp->Jsp = ParseArray(g, ++i);
+ jvp->DataType = TYPE_JSON;
break;
case '{':
jvp->Jsp = ParseObject(g, ++i);
+ jvp->DataType = TYPE_JSON;
break;
case '"':
- jvp->Val = AllocVal(g, TYPE_STRG);
- jvp->Val->Strp = ParseString(g, ++i);
+// jvp->Val = AllocVal(g, TYPE_STRG);
+ jvp->Strp = ParseString(g, ++i);
+ jvp->DataType = TYPE_STRG;
break;
case 't':
if (!strncmp(s + i, "true", 4)) {
- jvp->Val = AllocVal(g, TYPE_BOOL);
- jvp->Val->B = true;
+// jvp->Val = AllocVal(g, TYPE_BOOL);
+ jvp->B = true;
+ jvp->DataType = TYPE_BOOL;
i += 3;
} else
goto err;
@@ -652,24 +658,26 @@ PJVAL JDOC::ParseValue(PGLOBAL g, int& i)
break;
case 'f':
if (!strncmp(s + i, "false", 5)) {
- jvp->Val = AllocVal(g, TYPE_BOOL);
- jvp->Val->B = false;
+// jvp->Val = AllocVal(g, TYPE_BOOL);
+ jvp->B = false;
+ jvp->DataType = TYPE_BOOL;
i += 4;
} else
goto err;
break;
case 'n':
- if (!strncmp(s + i, "null", 4))
+ if (!strncmp(s + i, "null", 4)) {
+ jvp->DataType = TYPE_NULL;
i += 3;
- else
+ } else
goto err;
break;
case '-':
default:
if (s[i] == '-' || isdigit(s[i]))
- jvp->Val = ParseNumeric(g, i);
+ ParseNumeric(g, i, jvp);
else
goto err;
@@ -772,7 +780,7 @@ char *JDOC::ParseString(PGLOBAL g, int& i)
/***********************************************************************/
/* Parse a JSON numeric value. */
/***********************************************************************/
-PVL JDOC::ParseNumeric(PGLOBAL g, int& i)
+void JDOC::ParseNumeric(PGLOBAL g, int& i, PJVAL vlp)
{
char buf[50];
int n = 0;
@@ -780,7 +788,7 @@ PVL JDOC::ParseNumeric(PGLOBAL g, int& i)
bool has_dot = false;
bool has_e = false;
bool found_digit = false;
- PVL vlp = NULL;
+//PVL vlp = NULL;
for (; i < len; i++) {
switch (s[i]) {
@@ -829,24 +837,27 @@ PVL JDOC::ParseNumeric(PGLOBAL g, int& i)
if (has_dot || has_e) {
double dv = strtod(buf, NULL);
- vlp = AllocVal(g, TYPE_DBL);
+// vlp = AllocVal(g, TYPE_DBL);
vlp->F = dv;
vlp->Nd = nd;
+ vlp->DataType = TYPE_DBL;
} else {
long long iv = strtoll(buf, NULL, 10);
if (iv > INT_MAX32 || iv < INT_MIN32) {
- vlp = AllocVal(g, TYPE_BINT);
+// vlp = AllocVal(g, TYPE_BINT);
vlp->LLn = iv;
+ vlp->DataType = TYPE_BINT;
} else {
- vlp = AllocVal(g, TYPE_INTG);
+// vlp = AllocVal(g, TYPE_INTG);
vlp->N = (int)iv;
+ vlp->DataType = TYPE_INTG;
} // endif iv
} // endif has
i--; // Unstack following character
- return vlp;
+ return;
} else
throw("No digit found");
@@ -933,28 +944,28 @@ bool JDOC::SerializeValue(PJVAL jvp)
char buf[64];
PJAR jap;
PJOB jop;
- PVL vlp;
+ //PVL vlp;
if ((jap = jvp->GetArray()))
return SerializeArray(jap, false);
else if ((jop = jvp->GetObject()))
return SerializeObject(jop);
- else if (!(vlp = jvp->Val))
- return js->WriteStr("null");
- else switch (vlp->Type) {
+//else if (!(vlp = jvp->Val))
+// return js->WriteStr("null");
+ else switch (jvp->DataType) {
case TYPE_BOOL:
- return js->WriteStr(vlp->B ? "true" : "false");
+ return js->WriteStr(jvp->B ? "true" : "false");
case TYPE_STRG:
case TYPE_DTM:
- return js->Escape(vlp->Strp);
+ return js->Escape(jvp->Strp);
case TYPE_INTG:
- sprintf(buf, "%d", vlp->N);
+ sprintf(buf, "%d", jvp->N);
return js->WriteStr(buf);
case TYPE_BINT:
- sprintf(buf, "%lld", vlp->LLn);
+ sprintf(buf, "%lld", jvp->LLn);
return js->WriteStr(buf);
case TYPE_DBL:
- sprintf(buf, "%.*lf", vlp->Nd, vlp->F);
+ sprintf(buf, "%.*lf", jvp->Nd, jvp->F);
return js->WriteStr(buf);
case TYPE_NULL:
return js->WriteStr("null");
@@ -1382,11 +1393,24 @@ bool JARRAY::IsNull(void)
JVALUE::JVALUE(PJSON jsp) : JSON()
{
if (jsp->GetType() == TYPE_JVAL) {
- Jsp = jsp->GetJsp();
- Val = ((PJVAL)jsp)->GetVal();
+ PJVAL jvp = (PJVAL)jsp;
+
+// Val = ((PJVAL)jsp)->GetVal();
+ if (jvp->DataType == TYPE_JSON) {
+ Jsp = jvp->GetJsp();
+ DataType = TYPE_JSON;
+ Nd = 0;
+ } else {
+ LLn = jvp->LLn; // Must be LLn on 32 bit machines
+ Nd = jvp->Nd;
+ DataType = jvp->DataType;
+ } // endelse Jsp
+
} else {
Jsp = jsp;
- Val = NULL;
+// Val = NULL;
+ DataType = TYPE_JSON;
+ Nd = 0;
} // endif Type
Next = NULL;
@@ -1394,6 +1418,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON()
Type = TYPE_JVAL;
} // end of JVALUE constructor
+#if 0
/***********************************************************************/
/* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/
@@ -1405,13 +1430,14 @@ JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
Del = false;
Type = TYPE_JVAL;
} // end of JVALUE constructor
+#endif // 0
/***********************************************************************/
/* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON() {
Jsp = NULL;
- Val = NULL;
+//Val = NULL;
SetValue(g, valp);
Next = NULL;
Del = false;
@@ -1424,24 +1450,39 @@ JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON() {
JVALUE::JVALUE(PGLOBAL g, PCSZ strp) : JSON()
{
Jsp = NULL;
- Val = AllocVal(g, TYPE_STRG);
- Val->Strp = (char*)strp;
+//Val = AllocVal(g, TYPE_STRG);
+ Strp = (char*)strp;
+ DataType = TYPE_STRG;
+ Nd = 0;
Next = NULL;
Del = false;
Type = TYPE_JVAL;
} // end of JVALUE constructor
/***********************************************************************/
+/* Set or reset all Jvalue members. */
+/***********************************************************************/
+void JVALUE::Clear(void)
+{
+ Jsp = NULL;
+ Next = NULL;
+ Type = TYPE_JVAL;
+ Del = false;
+ Nd = 0;
+ DataType = TYPE_NULL;
+} // end of Clear
+
+/***********************************************************************/
/* Returns the type of the Value's value. */
/***********************************************************************/
JTYP JVALUE::GetValType(void)
{
- if (Jsp)
+ if (DataType == TYPE_JSON)
return Jsp->GetType();
- else if (Val)
- return Val->Type;
+//else if (Val)
+// return Val->Type;
else
- return TYPE_NULL;
+ return DataType;
} // end of GetValType
@@ -1450,7 +1491,7 @@ JTYP JVALUE::GetValType(void)
/***********************************************************************/
PJOB JVALUE::GetObject(void)
{
- if (Jsp && Jsp->GetType() == TYPE_JOB)
+ if (DataType == TYPE_JSON && Jsp->GetType() == TYPE_JOB)
return (PJOB)Jsp;
return NULL;
@@ -1461,7 +1502,7 @@ PJOB JVALUE::GetObject(void)
/***********************************************************************/
PJAR JVALUE::GetArray(void)
{
- if (Jsp && Jsp->GetType() == TYPE_JAR)
+ if (DataType == TYPE_JSON && Jsp->GetType() == TYPE_JAR)
return (PJAR)Jsp;
return NULL;
@@ -1474,11 +1515,11 @@ PVAL JVALUE::GetValue(PGLOBAL g)
{
PVAL valp = NULL;
- if (Val)
- if (Val->Type == TYPE_STRG)
- valp = AllocateValue(g, Val->Strp, Val->Type, Val->Nd);
+ if (DataType != TYPE_JSON)
+ if (DataType == TYPE_STRG)
+ valp = AllocateValue(g, Strp, DataType, Nd);
else
- valp = AllocateValue(g, Val, Val->Type, Val->Nd);
+ valp = AllocateValue(g, &LLn, DataType, Nd);
return valp;
} // end of GetValue
@@ -1489,15 +1530,13 @@ PVAL JVALUE::GetValue(PGLOBAL g)
int JVALUE::GetInteger(void) {
int n;
- if (!Val)
- n = 0;
- else switch (Val->Type) {
- case TYPE_INTG: n = Val->N; break;
- case TYPE_DBL: n = (int)Val->F; break;
+ switch (DataType) {
+ case TYPE_INTG: n = N; break;
+ case TYPE_DBL: n = (int)F; break;
case TYPE_DTM:
- case TYPE_STRG: n = atoi(Val->Strp); break;
- case TYPE_BOOL: n = (Val->B) ? 1 : 0; break;
- case TYPE_BINT: n = (int)Val->LLn; break;
+ case TYPE_STRG: n = atoi(Strp); break;
+ case TYPE_BOOL: n = (B) ? 1 : 0; break;
+ case TYPE_BINT: n = (int)LLn; break;
default:
n = 0;
} // endswitch Type
@@ -1512,15 +1551,13 @@ long long JVALUE::GetBigint(void)
{
long long lln;
- if (!Val)
- lln = 0;
- else switch (Val->Type) {
- case TYPE_BINT: lln = Val->LLn; break;
- case TYPE_INTG: lln = (long long)Val->N; break;
- case TYPE_DBL: lln = (long long)Val->F; break;
+ switch (DataType) {
+ case TYPE_BINT: lln = LLn; break;
+ case TYPE_INTG: lln = (long long)N; break;
+ case TYPE_DBL: lln = (long long)F; break;
case TYPE_DTM:
- case TYPE_STRG: lln = atoll(Val->Strp); break;
- case TYPE_BOOL: lln = (Val->B) ? 1 : 0; break;
+ case TYPE_STRG: lln = atoll(Strp); break;
+ case TYPE_BOOL: lln = (B) ? 1 : 0; break;
default:
lln = 0;
} // endswitch Type
@@ -1535,15 +1572,13 @@ double JVALUE::GetFloat(void)
{
double d;
- if (!Val)
- d = 0.0;
- else switch (Val->Type) {
- case TYPE_DBL: d = Val->F; break;
- case TYPE_BINT: d = (double)Val->LLn; break;
- case TYPE_INTG: d = (double)Val->N; break;
+ switch (DataType) {
+ case TYPE_DBL: d = F; break;
+ case TYPE_BINT: d = (double)LLn; break;
+ case TYPE_INTG: d = (double)N; break;
case TYPE_DTM:
- case TYPE_STRG: d = atof(Val->Strp); break;
- case TYPE_BOOL: d = (Val->B) ? 1.0 : 0.0; break;
+ case TYPE_STRG: d = atof(Strp); break;
+ case TYPE_BOOL: d = (B) ? 1.0 : 0.0; break;
default:
d = 0.0;
} // endswitch Type
@@ -1559,33 +1594,30 @@ PSZ JVALUE::GetString(PGLOBAL g, char *buff)
char buf[32];
char *p = (buff) ? buff : buf;
- if (Val) {
- switch (Val->Type) {
- case TYPE_DTM:
- case TYPE_STRG:
- p = Val->Strp;
- break;
- case TYPE_INTG:
- sprintf(p, "%d", Val->N);
- break;
- case TYPE_BINT:
- sprintf(p, "%lld", Val->LLn);
- break;
- case TYPE_DBL:
- sprintf(p, "%.*lf", Val->Nd, Val->F);
- break;
- case TYPE_BOOL:
- p = (char*)((Val->B) ? "true" : "false");
- break;
- case TYPE_NULL:
- p = (char*)"null";
- break;
- default:
- p = NULL;
- } // endswitch Type
-
- } else
+ switch (DataType) {
+ case TYPE_DTM:
+ case TYPE_STRG:
+ p = Strp;
+ break;
+ case TYPE_INTG:
+ sprintf(p, "%d", N);
+ break;
+ case TYPE_BINT:
+ sprintf(p, "%lld", LLn);
+ break;
+ case TYPE_DBL:
+ sprintf(p, "%.*lf", Nd, F);
+ break;
+ case TYPE_BOOL:
+ p = (char*)((B) ? "true" : "false");
+ break;
+ case TYPE_NULL:
+ p = (char*)"null";
+ break;
+ default:
p = NULL;
+ } // endswitch Type
+
return (p == buf) ? (char*)PlugDup(g, buf) : p;
} // end of GetString
@@ -1595,11 +1627,11 @@ PSZ JVALUE::GetString(PGLOBAL g, char *buff)
/***********************************************************************/
PSZ JVALUE::GetText(PGLOBAL g, PSTRG text)
{
- if (Jsp)
+ if (DataType == TYPE_JSON)
return Jsp->GetText(g, text);
char buff[32];
- PSZ s = (Val) ? GetString(g, buff) : NULL;
+ PSZ s = (DataType == TYPE_NULL) ? NULL : GetString(g, buff);
if (s)
text->Append(s);
@@ -1611,58 +1643,60 @@ PSZ JVALUE::GetText(PGLOBAL g, PSTRG text)
void JVALUE::SetValue(PJSON jsp)
{
- if (jsp && jsp->GetType() == TYPE_JVAL) {
+ if (DataType == TYPE_JSON && jsp->GetType() == TYPE_JVAL) {
Jsp = jsp->GetJsp();
- Val = ((PJVAL)jsp)->GetVal();
+ Nd = ((PJVAL)jsp)->Nd;
+ DataType = ((PJVAL)jsp)->DataType;
+ // Val = ((PJVAL)jsp)->GetVal();
} else {
Jsp = jsp;
- Val = NULL;
+ DataType = TYPE_JSON;
} // endif Type
} // end of SetValue;
void JVALUE::SetValue(PGLOBAL g, PVAL valp)
{
- if (!Val)
- Val = AllocVal(g, TYPE_VAL);
+//if (!Val)
+// Val = AllocVal(g, TYPE_VAL);
if (!valp || valp->IsNull()) {
- Val->Type = TYPE_NULL;
+ DataType = TYPE_NULL;
} else switch (valp->GetType()) {
- case TYPE_STRING:
+ case TYPE_DATE:
if (((DTVAL*)valp)->IsFormatted())
- Val->Strp = valp->GetCharValue();
+ Strp = valp->GetCharValue();
else {
char buf[32];
- Val->Strp = PlugDup(g, valp->GetCharString(buf));
+ Strp = PlugDup(g, valp->GetCharString(buf));
} // endif Formatted
- Val->Type = TYPE_DTM;
+ DataType = TYPE_DTM;
break;
- case TYPE_DATE:
- Val->Strp = valp->GetCharValue();
- Val->Type = TYPE_STRG;
+ case TYPE_STRING:
+ Strp = valp->GetCharValue();
+ DataType = TYPE_STRG;
break;
case TYPE_DOUBLE:
case TYPE_DECIM:
- Val->F = valp->GetFloatValue();
+ F = valp->GetFloatValue();
if (IsTypeNum(valp->GetType()))
- Val->Nd = valp->GetValPrec();
+ Nd = valp->GetValPrec();
- Val->Type = TYPE_DBL;
+ DataType = TYPE_DBL;
break;
case TYPE_TINY:
- Val->B = valp->GetTinyValue() != 0;
- Val->Type = TYPE_BOOL;
+ B = valp->GetTinyValue() != 0;
+ DataType = TYPE_BOOL;
case TYPE_INT:
- Val->N = valp->GetIntValue();
- Val->Type = TYPE_INTG;
+ N = valp->GetIntValue();
+ DataType = TYPE_INTG;
break;
case TYPE_BIGINT:
- Val->LLn = valp->GetBigintValue();
- Val->Type = TYPE_BINT;
+ LLn = valp->GetBigintValue();
+ DataType = TYPE_BINT;
break;
default:
sprintf(g->Message, "Unsupported typ %d\n", valp->GetType());
@@ -1676,9 +1710,8 @@ void JVALUE::SetValue(PGLOBAL g, PVAL valp)
/***********************************************************************/
void JVALUE::SetInteger(PGLOBAL g, int n)
{
- Val = AllocVal(g, TYPE_INTG);
- Val->N = n;
- Jsp = NULL;
+ N = n;
+ DataType = TYPE_INTG;
} // end of SetInteger
/***********************************************************************/
@@ -1686,9 +1719,8 @@ void JVALUE::SetInteger(PGLOBAL g, int n)
/***********************************************************************/
void JVALUE::SetBool(PGLOBAL g, bool b)
{
- Val = AllocVal(g, TYPE_BOOL);
- Val->B = b;
- Jsp = NULL;
+ B = b;
+ DataType = TYPE_BOOL;
} // end of SetTiny
/***********************************************************************/
@@ -1696,9 +1728,8 @@ void JVALUE::SetBool(PGLOBAL g, bool b)
/***********************************************************************/
void JVALUE::SetBigint(PGLOBAL g, long long ll)
{
- Val = AllocVal(g, TYPE_BINT);
- Val->LLn = ll;
- Jsp = NULL;
+ LLn = ll;
+ DataType = TYPE_BINT;
} // end of SetBigint
/***********************************************************************/
@@ -1706,10 +1737,9 @@ void JVALUE::SetBigint(PGLOBAL g, long long ll)
/***********************************************************************/
void JVALUE::SetFloat(PGLOBAL g, double f)
{
- Val = AllocVal(g, TYPE_DBL);
- Val->F = f;
- Val->Nd = 6;
- Jsp = NULL;
+ F = f;
+ Nd = 6;
+ DataType = TYPE_DBL;
} // end of SetFloat
/***********************************************************************/
@@ -1717,10 +1747,9 @@ void JVALUE::SetFloat(PGLOBAL g, double f)
/***********************************************************************/
void JVALUE::SetString(PGLOBAL g, PSZ s, int ci)
{
- Val = AllocVal(g, TYPE_STRG);
- Val->Strp = s;
- Val->Nd = ci;
- Jsp = NULL;
+ Strp = s;
+ Nd = ci;
+ DataType = TYPE_STRG;
} // end of SetString
/***********************************************************************/
@@ -1728,7 +1757,7 @@ void JVALUE::SetString(PGLOBAL g, PSZ s, int ci)
/***********************************************************************/
bool JVALUE::IsNull(void)
{
- return (Jsp) ? Jsp->IsNull() : (Val) ? Val->Type == TYPE_NULL : true;
+ return (DataType == TYPE_JSON) ? Jsp->IsNull() : DataType == TYPE_NULL;
} // end of IsNull
@@ -1751,7 +1780,7 @@ void SWAP::SwapJson(PJSON jsp, bool move)
/* Replace all pointers by offsets. */
/***********************************************************************/
size_t SWAP::MoffJson(PJSON jsp) {
- size_t res;
+ size_t res = NULL;
if (jsp)
switch (jsp->Type) {
@@ -1780,6 +1809,7 @@ size_t SWAP::MoffArray(PJAR jarp)
for (int i = 0; i < jarp->Size; i++)
jarp->Mvals[i] = (PJVAL)MakeOff(Base, jarp->Mvals[i]);
+ jarp->Mvals = (PJVAL*)MakeOff(Base, jarp->Mvals);
jarp->First = (PJVAL)MoffJValue(jarp->First);
jarp->Last = (PJVAL)MakeOff(Base, jarp->Last);
} // endif First
@@ -1819,11 +1849,13 @@ size_t SWAP::MoffPair(PJPR jpp) {
/***********************************************************************/
size_t SWAP::MoffJValue(PJVAL jvp) {
if (!jvp->Del) {
- if (jvp->Jsp)
+ if (jvp->DataType == TYPE_JSON)
jvp->Jsp = (PJSON)MoffJson(jvp->Jsp);
+ else if (jvp->DataType == TYPE_STRG)
+ jvp->Strp = (PSZ)MakeOff(Base, (jvp->Strp));
- if (jvp->Val)
- jvp->Val = (PVL)MoffVal(jvp->Val);
+// if (jvp->Val)
+// jvp->Val = (PVL)MoffVal(jvp->Val);
} // endif Del
@@ -1833,6 +1865,7 @@ size_t SWAP::MoffJValue(PJVAL jvp) {
return MakeOff(Base, jvp);
} // end of MoffJValue
+#if 0
/***********************************************************************/
/* Replace string pointers by offset. */
/***********************************************************************/
@@ -1842,6 +1875,7 @@ size_t SWAP::MoffVal(PVL vlp) {
return MakeOff(Base, vlp);
} // end of MoffVal
+#endif // 0
/***********************************************************************/
/* Replace all offsets by pointers. */
@@ -1876,6 +1910,8 @@ PJAR SWAP::MptrArray(PJAR ojar) {
jarp = (PJAR)new((long long)jarp) JARRAY(0);
if (jarp->First) {
+ jarp->Mvals = (PJVAL*)MakePtr(Base, (size_t)jarp->Mvals);
+
for (int i = 0; i < jarp->Size; i++)
jarp->Mvals[i] = (PJVAL)MakePtr(Base, (size_t)jarp->Mvals[i]);
@@ -1928,11 +1964,13 @@ PJVAL SWAP::MptrJValue(PJVAL ojv) {
jvp = (PJVAL)new((long long)jvp) JVALUE(0);
if (!jvp->Del) {
- if (jvp->Jsp)
+ if (jvp->DataType == TYPE_JSON)
jvp->Jsp = (PJSON)MptrJson(jvp->Jsp);
+ else if (jvp->DataType == TYPE_STRG)
+ jvp->Strp = (PSZ)MakePtr(Base, (size_t)jvp->Strp);
- if (jvp->Val)
- jvp->Val = (PVL)MptrVal(jvp->Val);
+// if (jvp->Val)
+// jvp->Val = (PVL)MptrVal(jvp->Val);
} // endif Del
@@ -1942,6 +1980,7 @@ PJVAL SWAP::MptrJValue(PJVAL ojv) {
return jvp;
} // end of MptrJValue
+#if 0
/***********************************************************************/
/* Replace string offsets by a pointer. */
/***********************************************************************/
@@ -1953,3 +1992,4 @@ PVL SWAP::MptrVal(PVL ovl) {
return vlp;
} // end of MptrValue
+#endif // 0
diff --git a/storage/connect/json.h b/storage/connect/json.h
index 31175777985..999b2cd8a1c 100644
--- a/storage/connect/json.h
+++ b/storage/connect/json.h
@@ -45,7 +45,7 @@ typedef class JARRAY *PJAR;
#define BMX 255
typedef struct BSON *PBSON;
typedef struct JPAIR *PJPR;
-typedef struct VAL *PVL;
+//typedef struct VAL *PVL;
/***********************************************************************/
/* Structure JPAIR. The pairs of a json Object. */
@@ -56,6 +56,7 @@ struct JPAIR {
PJPR Next; // To the next pair
}; // end of struct JPAIR
+#if 0
/***********************************************************************/
/* Structure VAL (string, int, float, bool or null) */
/***********************************************************************/
@@ -70,6 +71,7 @@ struct VAL {
int Nd; // Decimal number
JTYP Type; // The value type
}; // end of struct VAL
+#endif // 0
/***********************************************************************/
/* Structure used to return binary json to Json UDF functions. */
@@ -87,7 +89,7 @@ struct BSON {
}; // end of struct BSON
PBSON JbinAlloc(PGLOBAL g, UDF_ARGS* args, ulong len, PJSON jsp);
-PVL AllocVal(PGLOBAL g, JTYP type);
+//PVL AllocVal(PGLOBAL g, JTYP type);
char *NextChr(PSZ s, char sep);
char *GetJsonNull(void);
const char* GetFmt(int type, bool un);
@@ -112,7 +114,7 @@ public:
PJOB ParseObject(PGLOBAL g, int& i);
PJVAL ParseValue(PGLOBAL g, int& i);
char *ParseString(PGLOBAL g, int& i);
- PVL ParseNumeric(PGLOBAL g, int& i);
+ void ParseNumeric(PGLOBAL g, int& i, PJVAL jvp);
PJAR ParseAsArray(PGLOBAL g, int& i, int pretty, int *ptyp);
bool SerializeArray(PJAR jarp, bool b);
bool SerializeObject(PJOB jobp);
@@ -231,6 +233,7 @@ class JARRAY : public JSON {
class JVALUE : public JSON {
friend class JARRAY;
friend class JSNX;
+ friend class JSONDISC;
friend class JSONCOL;
friend class JSON;
friend class JDOC;
@@ -238,7 +241,7 @@ class JVALUE : public JSON {
public:
JVALUE(void) : JSON() { Type = TYPE_JVAL; Clear(); }
JVALUE(PJSON jsp);
- JVALUE(PGLOBAL g, PVL vlp);
+//JVALUE(PGLOBAL g, PVL vlp);
JVALUE(PGLOBAL g, PVAL valp);
JVALUE(PGLOBAL g, PCSZ strp);
JVALUE(int i) : JSON(i) {}
@@ -247,20 +250,19 @@ public:
//using JSON::SetVal;
// Methods
- virtual void Clear(void)
- {Jsp = NULL; Val = NULL; Next = NULL; Del = false;}
+ virtual void Clear(void);
//virtual JTYP GetType(void) {return TYPE_JVAL;}
virtual JTYP GetValType(void);
virtual PJOB GetObject(void);
virtual PJAR GetArray(void);
- virtual PJSON GetJsp(void) {return Jsp;}
+ virtual PJSON GetJsp(void) {return (DataType == TYPE_JSON ? Jsp : NULL);}
virtual PSZ GetText(PGLOBAL g, PSTRG text);
virtual bool IsNull(void);
// Specific
- inline PVL GetVal(void) { return Val; }
- inline void SetVal(PVL vlp) { Val = vlp; }
- inline PJSON GetJson(void) { return (Jsp ? Jsp : this); }
+ //inline PVL GetVal(void) { return Val; }
+ //inline void SetVal(PVL vlp) { Val = vlp; }
+ inline PJSON GetJson(void) { return (DataType == TYPE_JSON ? Jsp : this); }
PSZ GetString(PGLOBAL g, char* buff = NULL);
int GetInteger(void);
long long GetBigint(void);
@@ -275,10 +277,19 @@ public:
void SetBool(PGLOBAL g, bool b);
protected:
- PJSON Jsp; // To the json value
- PVL Val; // To the string or numeric value
- PJVAL Next; // Next value in array
- bool Del; // True when deleted
+ union {
+ PJSON Jsp; // To the json value
+ char *Strp; // Ptr to a string
+ int N; // An integer value
+ long long LLn; // A big integer value
+ double F; // A (double) float value
+ bool B; // True or false
+ };
+//PVL Val; // To the string or numeric value
+ PJVAL Next; // Next value in array
+ JTYP DataType; // The data value type
+ int Nd; // Decimal number
+ bool Del; // True when deleted
}; // end of class JVALUE
@@ -368,15 +379,15 @@ protected:
size_t MoffObject(PJOB jobp);
size_t MoffJValue(PJVAL jvp);
size_t MoffPair(PJPR jpp);
- size_t MoffVal(PVL vlp);
+//size_t MoffVal(PVL vlp);
PJSON MptrJson(PJSON jnp);
PJAR MptrArray(PJAR jarp);
PJOB MptrObject(PJOB jobp);
PJVAL MptrJValue(PJVAL jvp);
PJPR MptrPair(PJPR jpp);
- PVL MptrVal(PVL vlp);
+//PVL MptrVal(PVL vlp);
// Member
- PGLOBAL G, NG;
+ PGLOBAL G;
void *Base;
}; // end of class SWAP
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 3908e2a37a8..9ec70512823 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1018,12 +1018,12 @@ my_bool JSNX::CompareTree(PGLOBAL g, PJSON jp1, PJSON jp2)
my_bool found = true;
if (jp1->GetType() == TYPE_JVAL) {
- PVL v1 = ((PJVAL)jp1)->GetVal(), v2 = ((PJVAL)jp2)->GetVal();
+// PVL v1 = ((PJVAL)jp1)->GetVal(), v2 = ((PJVAL)jp2)->GetVal();
- if (v1 && v2)
- found = CompareValues(v1, v2);
- else
+ if (((PJVAL)jp1)->DataType == TYPE_JSON && ((PJVAL)jp2)->DataType == TYPE_JSON)
found = CompareTree(g, jp1->GetJsp(), jp2->GetJsp());
+ else
+ found = CompareValues(((PJVAL)jp1), ((PJVAL)jp2));
} else if (jp1->GetType() == TYPE_JAR) {
for (int i = 0; found && i < jp1->size(); i++)
@@ -1044,13 +1044,13 @@ my_bool JSNX::CompareTree(PGLOBAL g, PJSON jp1, PJSON jp2)
/*********************************************************************************/
/* Compare two VAL values and return true if they are equal. */
/*********************************************************************************/
-my_bool JSNX::CompareValues(PVL v1, PVL v2)
+my_bool JSNX::CompareValues(PJVAL v1, PJVAL v2)
{
my_bool b = false;
- switch (v1->Type) {
+ switch (v1->DataType) {
case TYPE_STRG:
- if (v2->Type == TYPE_STRG) {
+ if (v2->DataType == TYPE_STRG) {
if (v1->Nd || v2->Nd) // Case insensitive
b = (!stricmp(v1->Strp, v2->Strp));
else
@@ -1060,33 +1060,41 @@ my_bool JSNX::CompareValues(PVL v1, PVL v2)
break;
case TYPE_DTM:
- b = (!strcmp(v1->Strp, v2->Strp));
+ if (v2->DataType == TYPE_DTM)
+ b = (!strcmp(v1->Strp, v2->Strp));
+
break;
case TYPE_INTG:
- if (v2->Type == TYPE_INTG)
+ if (v2->DataType == TYPE_INTG)
b = (v1->N == v2->N);
- else if (v2->Type == TYPE_BINT)
+ else if (v2->DataType == TYPE_BINT)
b = (v1->N == v2->LLn);
break;
case TYPE_BINT:
- if (v2->Type == TYPE_INTG)
+ if (v2->DataType == TYPE_INTG)
b = (v1->LLn == v2->N);
- else if (v2->Type == TYPE_BINT)
+ else if (v2->DataType == TYPE_BINT)
b = (v1->LLn == v2->LLn);
break;
case TYPE_DBL:
- if (v2->Type == TYPE_DBL)
+ if (v2->DataType == TYPE_DBL)
b = (v1->F == v2->F);
break;
case TYPE_BOOL:
- if (v2->Type == TYPE_BOOL)
+ if (v2->DataType == TYPE_BOOL)
b = (v1->B == v2->B);
break;
- default: b = true; // both nulls
+ case TYPE_NULL:
+ if (v2->DataType == TYPE_NULL)
+ b = true;
+
+ break;
+ default:
+ break;
} // endswitch Type
return b;
@@ -1263,7 +1271,7 @@ static PJVAL JvalNew(PGLOBAL g, JTYP type, void *vp)
} // end try/catch
return jvp;
-} /* end of JsonNew */
+} /* end of JvalNew */
/*********************************************************************************/
/* Allocate and initialise the memory area. */
diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h
index 9b3d478b018..69d6c644d9c 100644
--- a/storage/connect/jsonudf.h
+++ b/storage/connect/jsonudf.h
@@ -296,7 +296,7 @@ protected:
PVAL MakeJson(PGLOBAL g, PJSON jsp);
void SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val);
PJSON GetRow(PGLOBAL g);
- my_bool CompareValues(PVL v1, PVL v2);
+ my_bool CompareValues(PJVAL v1, PJVAL v2);
my_bool LocateArray(PGLOBAL g, PJAR jarp);
my_bool LocateObject(PGLOBAL g, PJOB jobp);
my_bool LocateValue(PGLOBAL g, PJVAL jvp);
diff --git a/storage/connect/mysql-test/connect/r/xml.result b/storage/connect/mysql-test/connect/r/xml.result
index 09dac32a2a4..92e1abb615d 100644
--- a/storage/connect/mysql-test/connect/r/xml.result
+++ b/storage/connect/mysql-test/connect/r/xml.result
@@ -158,47 +158,47 @@ TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1998
SELECT LOAD_FILE('MYSQLD_DATADIR/test/xsample2.xml') AS xml;
-xml <?xml version="1.0" encoding="UTF-8"?>
-<BIBLIO SUBJECT="XML">
- <BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
- <AUTHOR>
- <FIRSTNAME>Jean-Christophe</FIRSTNAME>
- <LASTNAME>Bernadac</LASTNAME>
- </AUTHOR>
- <AUTHOR>
- <FIRSTNAME>François</FIRSTNAME>
- <LASTNAME>Knab</LASTNAME>
- </AUTHOR>
- <TITLE>Construire une application XML</TITLE>
- <PUBLISHER>
- <NAME>Eyrolles</NAME>
- <PLACE>Paris</PLACE>
- </PUBLISHER>
- <DATEPUB>1999</DATEPUB>
- </BOOK>
- <BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
- <AUTHOR>
- <FIRSTNAME>William J.</FIRSTNAME>
- <LASTNAME>Pardi</LASTNAME>
- </AUTHOR>
- <TRANSLATOR PREFIX="adapté de l'anglais par">
- <FIRSTNAME>James</FIRSTNAME>
- <LASTNAME>Guerin</LASTNAME>
- </TRANSLATOR>
- <TITLE>XML en Action</TITLE>
- <PUBLISHER>
- <NAME>Microsoft Press</NAME>
- <PLACE>Paris</PLACE>
- </PUBLISHER>
- <DATEPUB>1999</DATEPUB>
- </BOOK>
- <BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
- <AUTHOR>Alain Michard</AUTHOR>
- <TITLE>XML, Langage et Applications</TITLE>
- <PUBLISHER>Eyrolles Paris</PUBLISHER>
- <DATEPUB>1998</DATEPUB>
- </BOOK>
-</BIBLIO>
+xml <?xml version="1.0" encoding="UTF-8"?>
+<BIBLIO SUBJECT="XML">
+ <BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
+ <AUTHOR>
+ <FIRSTNAME>Jean-Christophe</FIRSTNAME>
+ <LASTNAME>Bernadac</LASTNAME>
+ </AUTHOR>
+ <AUTHOR>
+ <FIRSTNAME>François</FIRSTNAME>
+ <LASTNAME>Knab</LASTNAME>
+ </AUTHOR>
+ <TITLE>Construire une application XML</TITLE>
+ <PUBLISHER>
+ <NAME>Eyrolles</NAME>
+ <PLACE>Paris</PLACE>
+ </PUBLISHER>
+ <DATEPUB>1999</DATEPUB>
+ </BOOK>
+ <BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
+ <AUTHOR>
+ <FIRSTNAME>William J.</FIRSTNAME>
+ <LASTNAME>Pardi</LASTNAME>
+ </AUTHOR>
+ <TRANSLATOR PREFIX="adapté de l'anglais par">
+ <FIRSTNAME>James</FIRSTNAME>
+ <LASTNAME>Guerin</LASTNAME>
+ </TRANSLATOR>
+ <TITLE>XML en Action</TITLE>
+ <PUBLISHER>
+ <NAME>Microsoft Press</NAME>
+ <PLACE>Paris</PLACE>
+ </PUBLISHER>
+ <DATEPUB>1999</DATEPUB>
+ </BOOK>
+ <BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
+ <AUTHOR>Alain Michard</AUTHOR>
+ <TITLE>XML, Langage et Applications</TITLE>
+ <PUBLISHER>Eyrolles Paris</PUBLISHER>
+ <DATEPUB>1998</DATEPUB>
+ </BOOK>
+</BIBLIO>
DROP TABLE t1;
#
@@ -374,7 +374,7 @@ INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
Warnings:
Level Warning
Code 1105
-Message Com error: Impossible d'enregistrer le caractre dans le codage iso-8859-1.
+Message Com error: Unable to save character to 'iso-8859-1' encoding.
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
@@ -383,11 +383,11 @@ hex(node) 263C3E2227
DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
-CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- Created by the MariaDB CONNECT Storage Engine-->
-<t1>
- <line>
- <node>&amp;&lt;&gt;"'</node>
- </line>
-</t1>
+CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Created by the MariaDB CONNECT Storage Engine-->
+<t1>
+ <line>
+ <node>&amp;&lt;&gt;"'</node>
+ </line>
+</t1>
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 9ebece5d4e7..b0866ba1b18 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -152,6 +152,7 @@ JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
{
length = lg;
jcp = fjcp = pjcp = NULL;
+ tdp = NULL;
tjnp = NULL;
jpp = NULL;
tjsp = NULL;
@@ -392,16 +393,16 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
PJOB job;
PJAR jar;
- if ((vlp = jvp ? jvp->GetVal() : NULL)) {
+ if (jvp && jvp->DataType != TYPE_JSON) {
if (JsonAllPath() && !fmt[bf])
strcat(fmt, colname);
- jcol.Type = vlp->Type;
+ jcol.Type = jvp->DataType;
- switch (vlp->Type) {
+ switch (jvp->DataType) {
case TYPE_STRG:
case TYPE_DTM:
- jcol.Len = (int)strlen(vlp->Strp);
+ jcol.Len = (int)strlen(jvp->Strp);
break;
case TYPE_INTG:
case TYPE_BINT:
@@ -409,7 +410,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
break;
case TYPE_DBL:
jcol.Len = (int)strlen(jvp->GetString(g));
- jcol.Scale = vlp->Nd;
+ jcol.Scale = jvp->Nd;
break;
case TYPE_BOOL:
jcol.Len = 1;
@@ -419,8 +420,8 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
break;
} // endswitch Type
- jcol.Scale = vlp->Nd;
- jcol.Cbn = vlp->Type == TYPE_NULL;
+ jcol.Scale = jvp->Nd;
+ jcol.Cbn = jvp->DataType == TYPE_NULL;
} else if (!jvp || jvp->IsNull()) {
jcol.Type = TYPE_UNKNOWN;
jcol.Len = jcol.Scale = 0;
@@ -528,7 +529,7 @@ void JSONDISC::AddColumn(PGLOBAL g)
if (jcp->Type != jcol.Type) {
if (jcp->Type == TYPE_UNKNOWN)
jcp->Type = jcol.Type;
- else if (jcol.Type != TYPE_UNKNOWN)
+ else if (jcol.Type != TYPE_UNKNOWN && jcol.Type != TYPE_VOID)
jcp->Type = TYPE_STRING;
} // endif Type
@@ -1595,12 +1596,12 @@ PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp)
/***********************************************************************/
/* SetValue: Set a value from a JVALUE contains. */
/***********************************************************************/
-void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val)
+void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL jvp)
{
- if (val) {
+ if (jvp) {
vp->SetNull(false);
- switch (val->GetValType()) {
+ switch (jvp->GetValType()) {
case TYPE_STRG:
case TYPE_INTG:
case TYPE_BINT:
@@ -1609,21 +1610,21 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val)
switch (vp->GetType()) {
case TYPE_STRING:
case TYPE_DATE:
- vp->SetValue_psz(val->GetString(g));
+ vp->SetValue_psz(jvp->GetString(g));
break;
case TYPE_INT:
case TYPE_SHORT:
case TYPE_TINY:
- vp->SetValue(val->GetInteger());
+ vp->SetValue(jvp->GetInteger());
break;
case TYPE_BIGINT:
- vp->SetValue(val->GetBigint());
+ vp->SetValue(jvp->GetBigint());
break;
case TYPE_DOUBLE:
- vp->SetValue(val->GetFloat());
+ vp->SetValue(jvp->GetFloat());
- if (val->GetValType() == TYPE_DBL)
- vp->SetPrec(val->Val->Nd);
+ if (jvp->GetValType() == TYPE_DBL)
+ vp->SetPrec(jvp->Nd);
break;
default:
@@ -1634,18 +1635,18 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val)
break;
case TYPE_BOOL:
if (vp->IsTypeNum())
- vp->SetValue(val->GetInteger() ? 1 : 0);
+ vp->SetValue(jvp->GetInteger() ? 1 : 0);
else
- vp->SetValue_psz((PSZ)(val->GetInteger() ? "true" : "false"));
+ vp->SetValue_psz((PSZ)(jvp->GetInteger() ? "true" : "false"));
break;
case TYPE_JAR:
// SetJsonValue(g, vp, val->GetArray()->GetValue(0));
- vp->SetValue_psz(val->GetArray()->GetText(g, NULL));
+ vp->SetValue_psz(jvp->GetArray()->GetText(g, NULL));
break;
case TYPE_JOB:
// if (!vp->IsTypeNum() || !Strict) {
- vp->SetValue_psz(val->GetObject()->GetText(g, NULL));
+ vp->SetValue_psz(jvp->GetObject()->GetText(g, NULL));
break;
// } // endif Type
@@ -1808,9 +1809,9 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
if (jvrp->IsNull()) {
- jvrp->Val = AllocVal(g, TYPE_STRG);
- jvrp->Val->Strp = PlugDup(g, GetJsonNull());
- jvp = jvrp;
+ jvrp->Strp = PlugDup(g, GetJsonNull());
+ jvrp->DataType = TYPE_STRG;
+ jvp = jvrp;
} else if (n < Nod - 1 && jvrp->GetJson()) {
Tjp->NextSame = nextsame;
jval.SetValue(g, GetColumnValue(g, jvrp->GetJson(), n + 1));
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index f5d7b3153b2..de5115a4e09 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -58,7 +58,7 @@ public:
// Members
JCOL jcol;
PJCL jcp, fjcp, pjcp;
- PVL vlp;
+//PVL vlp;
PJDEF tdp;
TDBJSN *tjnp;
PJTDB tjsp;
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index ee3a289c2e3..ec8cd70cac3 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -1,8 +1,11 @@
/************** tabrest C++ Program Source Code File (.CPP) ************/
-/* PROGRAM NAME: tabrest Version 1.7 */
-/* (C) Copyright to the author Olivier BERTRAND 2018 - 2019 */
+/* PROGRAM NAME: tabrest Version 1.8 */
+/* (C) Copyright to the author Olivier BERTRAND 2018 - 2020 */
/* This program is the REST Web API support for MariaDB. */
/* When compiled without MARIADB defined, it is the EOM module code. */
+/* The way Connect handles NOSQL data returned by REST queries is */
+/* just by retrieving it as a file and then leave the existing data */
+/* type tables (JSON, XML or CSV) process it as usual. */
/***********************************************************************/
/***********************************************************************/
@@ -78,7 +81,7 @@ PTABDEF __stdcall GetREST(PGLOBAL g, void *memp)
#endif // !MARIADB
/***********************************************************************/
-/* Xcurl: retrieve the REST answer by executing curl. */
+/* Xcurl: retrieve the REST answer by executing cURL. */
/***********************************************************************/
int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
{
@@ -112,7 +115,7 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // end od Xcurl
/***********************************************************************/
-/* GetREST: get the external TABDEF from OEM module. */
+/* GetREST: load the Rest lib and get the Rest function. */
/***********************************************************************/
XGETREST GetRestFunction(PGLOBAL g)
{
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 1b5345cbddc..08e8e3ff5ab 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -28,6 +28,7 @@ SET(INNOBASE_SOURCES
btr/btr0scrub.cc
btr/btr0sea.cc
btr/btr0defragment.cc
+ buf/buf0block_hint.cc
buf/buf0buddy.cc
buf/buf0buf.cc
buf/buf0dblwr.cc
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index bb0b5c82f06..511ac66d58c 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -283,7 +283,7 @@ the index.
ulint
btr_height_get(
/*===========*/
- dict_index_t* index, /*!< in: index tree */
+ const dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint height=0;
@@ -592,7 +592,7 @@ Gets the number of pages in a B-tree.
ulint
btr_get_size(
/*=========*/
- dict_index_t* index, /*!< in: index */
+ const dict_index_t* index, /*!< in: index */
ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
mtr_t* mtr) /*!< in/out: mini-transaction where index
is s-latched */
@@ -723,8 +723,10 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
{
ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table));
#ifdef BTR_CUR_HASH_ADAPT
- ut_ad(!block->index || !blob);
- ut_ad(!block->index || page_is_leaf(block->frame));
+ if (block->index && !block->index->freed()) {
+ ut_ad(!blob);
+ ut_ad(page_is_leaf(block->frame));
+ }
#endif
ut_ad(index->space == block->page.id.space());
/* The root page is freed by btr_free_root(). */
@@ -751,7 +753,7 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
fseg_free_page(seg_header,
block->page.id.space(),
block->page.id.page_no(),
- block->index != NULL, mtr);
+ mtr);
/* The page was marked free in the allocation bitmap, but it
should remain exclusively latched until mtr_t::commit() or until it
@@ -777,7 +779,7 @@ btr_node_ptr_set_child_page_no(
rec_t* rec, /*!< in: node pointer record */
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
part will be updated, or NULL */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint page_no,/*!< in: child node address */
mtr_t* mtr) /*!< in: mtr */
{
@@ -812,7 +814,7 @@ btr_node_ptr_get_child(
/*===================*/
const rec_t* node_ptr,/*!< in: node pointer */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(rec_offs_validate(node_ptr, index, offsets));
@@ -830,10 +832,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an sx-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
-ulint*
+rec_offs*
btr_page_get_father_node_ptr_func(
/*==============================*/
- ulint* offsets,/*!< in: work area for the return value */
+ rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer record,
@@ -876,7 +878,7 @@ btr_page_get_father_node_ptr_func(
err = btr_cur_search_to_nth_level(
index, level + 1, tuple,
PAGE_CUR_LE, latch_mode, cursor, 0,
- file, line, mtr);
+ file, line, mtr, 0);
if (err != DB_SUCCESS) {
ib::warn() << " Error code: " << err
@@ -937,10 +939,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
-ulint*
+rec_offs*
btr_page_get_father_block(
/*======================*/
- ulint* offsets,/*!< in: work area for the return value */
+ rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@@ -1005,7 +1007,7 @@ static void btr_free_root(buf_block_t* block, mtr_t* mtr, bool invalidate)
BTR_FREED_INDEX_ID, mtr);
}
- while (!fseg_free_step(header, true, mtr)) {
+ while (!fseg_free_step(header, mtr)) {
/* Free the entire segment in small steps. */
}
}
@@ -1084,8 +1086,7 @@ btr_create(
if (type & DICT_IBUF) {
/* Allocate first the ibuf header page */
buf_block_t* ibuf_hdr_block = fseg_create(
- space, 0,
- IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
+ space, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
if (ibuf_hdr_block == NULL) {
return(FIL_NULL);
@@ -1116,7 +1117,7 @@ btr_create(
flst_init(block->frame + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
mtr);
} else {
- block = fseg_create(space, 0,
+ block = fseg_create(space,
PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
if (block == NULL) {
@@ -1125,8 +1126,9 @@ btr_create(
buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW);
- if (!fseg_create(space, block->page.id.page_no(),
- PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr)) {
+ if (!fseg_create(space,
+ PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr,
+ block)) {
/* Not enough space for new segment, free root
segment before return. */
btr_free_root(block, mtr,
@@ -1254,7 +1256,7 @@ leaf_loop:
fsp0fsp. */
finished = fseg_free_step(root + PAGE_HEADER + PAGE_BTR_SEG_LEAF,
- true, &mtr);
+ &mtr);
mtr_commit(&mtr);
if (!finished) {
@@ -1274,7 +1276,7 @@ top_loop:
#endif /* UNIV_BTR_DEBUG */
finished = fseg_free_step_not_header(
- root + PAGE_HEADER + PAGE_BTR_SEG_TOP, true, &mtr);
+ root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr);
mtr_commit(&mtr);
if (!finished) {
@@ -1814,7 +1816,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@@ -2125,7 +2127,7 @@ btr_page_get_split_rec(
rec_t* next_rec;
ulint n;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
page = btr_cur_get_page(cursor);
@@ -2231,7 +2233,7 @@ btr_page_insert_fits(
const rec_t* split_rec,/*!< in: suggestion for first record
on upper half-page, or NULL if
tuple to be inserted should be first */
- ulint** offsets,/*!< in: rec_get_offsets(
+ rec_offs** offsets,/*!< in: rec_get_offsets(
split_rec, cursor->index); out: garbage */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@@ -2331,8 +2333,8 @@ btr_insert_on_non_leaf_level_func(
dberr_t err;
rec_t* rec;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
rtr_info_t rtr_info;
@@ -2342,7 +2344,7 @@ btr_insert_on_non_leaf_level_func(
dberr_t err = btr_cur_search_to_nth_level(
index, level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE,
- &cursor, 0, file, line, mtr);
+ &cursor, 0, file, line, mtr, 0);
if (err != DB_SUCCESS) {
ib::warn() << " Error code: " << err
@@ -2363,7 +2365,7 @@ btr_insert_on_non_leaf_level_func(
btr_cur_search_to_nth_level(index, level, tuple,
PAGE_CUR_RTREE_INSERT,
BTR_CONT_MODIFY_TREE,
- &cursor, 0, file, line, mtr);
+ &cursor, 0, file, line, mtr, 0);
}
ut_ad(cursor.flag == BTR_CUR_BINARY);
@@ -2441,7 +2443,7 @@ btr_attach_half_pages(
if (direction == FSP_DOWN) {
btr_cur_t cursor;
- ulint* offsets;
+ rec_offs* offsets;
lower_page = buf_block_get_frame(new_block);
lower_page_no = new_block->page.id.page_no();
@@ -2564,7 +2566,7 @@ btr_page_tuple_smaller(
/*===================*/
btr_cur_t* cursor, /*!< in: b-tree cursor */
const dtuple_t* tuple, /*!< in: tuple to consider */
- ulint** offsets,/*!< in/out: temporary storage */
+ rec_offs** offsets,/*!< in/out: temporary storage */
ulint n_uniq, /*!< in: number of unique fields
in the index page records */
mem_heap_t** heap) /*!< in/out: heap for offsets */
@@ -2604,7 +2606,7 @@ rec_t*
btr_insert_into_right_sibling(
ulint flags,
btr_cur_t* cursor,
- ulint** offsets,
+ rec_offs** offsets,
mem_heap_t* heap,
const dtuple_t* tuple,
ulint n_ext,
@@ -2741,7 +2743,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@@ -3302,7 +3304,7 @@ btr_lift_page_up(
{
btr_cur_t cursor;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
mem_heap_t* heap = mem_heap_create(
sizeof(*offsets)
* (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields));
@@ -3487,7 +3489,7 @@ btr_compress(
page_t* page;
btr_cur_t father_cursor;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
ulint nth_rec = 0; /* remove bogus warning */
bool mbr_changed = false;
#ifdef UNIV_DEBUG
@@ -3631,7 +3633,7 @@ retry:
if (is_left) {
btr_cur_t cursor2;
rtr_mbr_t new_mbr;
- ulint* offsets2 = NULL;
+ rec_offs* offsets2 = NULL;
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
@@ -3829,7 +3831,7 @@ retry:
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
- ulint* offsets2;
+ rec_offs* offsets2;
ulint rec_info;
offsets2 = rec_get_offsets(
@@ -4276,7 +4278,7 @@ btr_print_recursive(
ulint width, /*!< in: print this many entries from start
and end */
mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */
- ulint** offsets,/*!< in/out: buffer for rec_get_offsets() */
+ rec_offs** offsets,/*!< in/out: buffer for rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
const page_t* page = buf_block_get_frame(block);
@@ -4340,8 +4342,8 @@ btr_print_index(
mtr_t mtr;
buf_block_t* root;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
fputs("--------------------------\n"
@@ -4375,7 +4377,7 @@ btr_check_node_ptr(
{
mem_heap_t* heap;
dtuple_t* tuple;
- ulint* offsets;
+ rec_offs* offsets;
btr_cur_t cursor;
page_t* page = buf_block_get_frame(block);
@@ -4457,8 +4459,8 @@ btr_index_rec_validate(
ulint i;
const page_t* page;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
page = page_align(rec);
@@ -4691,8 +4693,8 @@ btr_validate_level(
bool ret = true;
mtr_t mtr;
mem_heap_t* heap = mem_heap_create(256);
- ulint* offsets = NULL;
- ulint* offsets2= NULL;
+ rec_offs* offsets = NULL;
+ rec_offs* offsets2= NULL;
#ifdef UNIV_ZIP_DEBUG
page_zip_des_t* page_zip;
#endif /* UNIV_ZIP_DEBUG */
@@ -5026,11 +5028,13 @@ loop:
mtr_release_block_at_savepoint(
&mtr, savepoint, right_block);
- btr_block_get(
- page_id_t(index->space,
- parent_right_page_no),
- table_page_size,
- RW_SX_LATCH, index, &mtr);
+ if (parent_right_page_no != FIL_NULL) {
+ btr_block_get(
+ page_id_t(index->space,
+ parent_right_page_no),
+ table_page_size,
+ RW_SX_LATCH, index, &mtr);
+ }
right_block = btr_block_get(
page_id_t(index->space,
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 262709bc679..100e48cf537 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -29,6 +29,7 @@ Created 03/11/2014 Shaohua Wang
#include "btr0cur.h"
#include "btr0pcur.h"
#include "ibuf0ibuf.h"
+#include "page0page.h"
#include "trx0trx.h"
/** Innodb B-tree index fill factor for bulk load. */
@@ -143,7 +144,6 @@ PageBulk::init()
}
m_block = new_block;
- m_block->skip_flush_check = true;
m_page = new_page;
m_page_zip = new_page_zip;
m_page_no = new_page_no;
@@ -163,7 +163,9 @@ PageBulk::init()
UNIV_PAGE_SIZE - dict_index_zip_pad_optimal_page_size(m_index);
m_heap_top = page_header_get_ptr(new_page, PAGE_HEAP_TOP);
m_rec_no = page_header_get_field(new_page, PAGE_N_RECS);
-
+ ut_ad(page_header_get_field(m_page, PAGE_DIRECTION)
+ == PAGE_NO_DIRECTION);
+ page_header_set_field(m_page, NULL, PAGE_DIRECTION, 0);
ut_d(m_total_data = 0);
/* See page_copy_rec_list_end_to_created_page() */
ut_d(page_header_set_field(m_page, NULL, PAGE_HEAP_TOP,
@@ -178,7 +180,7 @@ PageBulk::init()
void
PageBulk::insert(
const rec_t* rec,
- ulint* offsets)
+ rec_offs* offsets)
{
ulint rec_size;
@@ -188,9 +190,9 @@ PageBulk::insert(
#ifdef UNIV_DEBUG
/* Check whether records are in order. */
- if (!page_rec_is_infimum(m_cur_rec)) {
+ if (!page_rec_is_infimum_low(page_offset(m_cur_rec))) {
rec_t* old_rec = m_cur_rec;
- ulint* old_offsets = rec_get_offsets(
+ rec_offs* old_offsets = rec_get_offsets(
old_rec, m_index, NULL, page_rec_is_leaf(old_rec),
ULINT_UNDEFINED, &m_heap);
@@ -206,18 +208,21 @@ PageBulk::insert(
rec_offs_make_valid(insert_rec, m_index, offsets);
/* 2. Insert the record in the linked list. */
- rec_t* next_rec = page_rec_get_next(m_cur_rec);
-
- page_rec_set_next(insert_rec, next_rec);
- page_rec_set_next(m_cur_rec, insert_rec);
-
/* 3. Set the n_owned field in the inserted record to zero,
and set the heap_no field. */
if (m_is_comp) {
+ ulint next_offs = rec_get_next_offs(m_cur_rec, TRUE);
+ rec_set_next_offs_new(insert_rec, next_offs);
+ rec_set_next_offs_new(m_cur_rec, page_offset(insert_rec));
+
rec_set_n_owned_new(insert_rec, NULL, 0);
rec_set_heap_no_new(insert_rec,
PAGE_HEAP_NO_USER_LOW + m_rec_no);
} else {
+ ulint next_offs = rec_get_next_offs(m_cur_rec, FALSE);
+ rec_set_next_offs_old(insert_rec, next_offs);
+ rec_set_next_offs_old(m_cur_rec, page_offset(insert_rec));
+
rec_set_n_owned_old(insert_rec, 0);
rec_set_heap_no_old(insert_rec,
PAGE_HEAP_NO_USER_LOW + m_rec_no);
@@ -245,17 +250,54 @@ PageBulk::insert(
m_cur_rec = insert_rec;
}
+inline bool PageBulk::needs_finish() const
+{
+ ut_ad(page_align(m_cur_rec) == m_block->frame);
+ ut_ad(m_page == m_block->frame);
+ ulint n_heap= page_header_get_field(m_page, PAGE_N_HEAP);
+ if (!n_heap || !page_header_get_field(m_page, PAGE_DIRECTION))
+ return true;
+ ulint heap_no;
+ if (n_heap & 0x8000)
+ {
+ n_heap&= 0x7fff;
+ heap_no= rec_get_heap_no_new(m_cur_rec);
+ if (heap_no == PAGE_HEAP_NO_INFIMUM &&
+ page_header_get_field(m_page, PAGE_HEAP_TOP) == PAGE_NEW_SUPREMUM_END)
+ return false;
+ }
+ else
+ {
+ heap_no= rec_get_heap_no_old(m_cur_rec);
+ if (heap_no == PAGE_HEAP_NO_INFIMUM &&
+ page_header_get_field(m_page, PAGE_HEAP_TOP) == PAGE_OLD_SUPREMUM_END)
+ return false;
+ }
+ return heap_no != n_heap - 1;
+}
+
/** Mark end of insertion to the page. Scan all records to set page dirs,
and set page header members.
Note: we refer to page_copy_rec_list_end_to_created_page. */
void
PageBulk::finish()
{
- ut_ad(m_rec_no > 0);
+ ut_ad(!dict_index_is_spatial(m_index));
+
+ if (!needs_finish()) {
+ return;
+ }
+
ut_ad(m_total_data + page_dir_calc_reserved_space(m_rec_no)
<= page_get_free_space_of_empty(m_is_comp));
+#ifdef UNIV_DEBUG
/* See page_copy_rec_list_end_to_created_page() */
- ut_d(page_dir_set_n_slots(m_page, NULL, srv_page_size / 2));
+ if (m_rec_no) {
+ page_dir_set_n_slots(m_page, NULL, srv_page_size / 2);
+ }
+ mach_write_to_2(PAGE_HEADER + PAGE_HEAP_TOP + m_page,
+ ulint(m_heap_top - m_page));
+#endif
ulint count = 0;
ulint n_recs = 0;
@@ -264,8 +306,7 @@ PageBulk::finish()
page_dir_slot_t* slot = NULL;
/* Set owner & dir. */
- do {
-
+ while (!page_rec_is_supremum(insert_rec)) {
count++;
n_recs++;
@@ -282,7 +323,7 @@ PageBulk::finish()
}
insert_rec = page_rec_get_next(insert_rec);
- } while (!page_rec_is_supremum(insert_rec));
+ }
if (slot_index > 0
&& (count + 1 + (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
@@ -305,9 +346,10 @@ PageBulk::finish()
page_dir_slot_set_rec(slot, page_get_supremum_rec(m_page));
page_dir_slot_set_n_owned(slot, NULL, count + 1);
- ut_ad(!dict_index_is_spatial(m_index));
-
- if (!m_flush_observer && !m_page_zip) {
+ if (!m_rec_no) {
+ page_header_set_field(m_page, NULL, PAGE_DIRECTION,
+ PAGE_NO_DIRECTION);
+ } else if (!m_flush_observer && !m_page_zip) {
mlog_write_ulint(PAGE_HEADER + PAGE_N_DIR_SLOTS + m_page,
2 + slot_index, MLOG_2BYTES, &m_mtr);
mlog_write_ulint(PAGE_HEADER + PAGE_HEAP_TOP + m_page,
@@ -344,26 +386,18 @@ PageBulk::finish()
mach_write_to_2(PAGE_HEADER + PAGE_N_DIRECTION + m_page, 0);
}
- m_block->skip_flush_check = false;
+ ut_ad(!needs_finish());
+ ut_ad(page_validate(m_page, m_index));
}
/** Commit inserts done to the page
@param[in] success Flag whether all inserts succeed. */
-void
-PageBulk::commit(
- bool success)
+void PageBulk::commit(bool success)
{
- if (success) {
- ut_ad(page_validate(m_page, m_index));
-
- /* Set no free space left and no buffered changes in ibuf. */
- if (!dict_index_is_clust(m_index) && page_is_leaf(m_page)) {
- ibuf_set_bitmap_for_bulk_load(
- m_block, innobase_fill_factor == 100);
- }
- }
-
- m_mtr.commit();
+ finish();
+ if (success && !dict_index_is_clust(m_index) && page_is_leaf(m_page))
+ ibuf_set_bitmap_for_bulk_load(m_block, innobase_fill_factor == 100);
+ m_mtr.commit();
}
/** Compress a page of compressed table
@@ -402,7 +436,7 @@ rec_t*
PageBulk::getSplitRec()
{
rec_t* rec;
- ulint* offsets;
+ rec_offs* offsets;
ulint total_used_size;
ulint total_recs_size;
ulint n_recs;
@@ -448,7 +482,7 @@ PageBulk::copyIn(
{
rec_t* rec = split_rec;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
ut_ad(m_rec_no == 0);
ut_ad(page_rec_is_user_rec(rec));
@@ -494,7 +528,7 @@ PageBulk::copyOut(
ut_ad(n > 0);
/* Set last record's next in page */
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
rec = page_rec_get_prev(split_rec);
offsets = rec_get_offsets(rec, m_index, offsets,
page_rec_is_leaf(split_rec),
@@ -604,9 +638,11 @@ the blob data is logged first, then the record is logged in bulk mode.
dberr_t
PageBulk::storeExt(
const big_rec_t* big_rec,
- ulint* offsets)
+ rec_offs* offsets)
{
- /* Note: not all fileds are initialized in btr_pcur. */
+ finish();
+
+ /* Note: not all fields are initialized in btr_pcur. */
btr_pcur_t btr_pcur;
btr_pcur.pos_state = BTR_PCUR_IS_POSITIONED;
btr_pcur.latch_mode = BTR_MODIFY_LEAF;
@@ -635,7 +671,7 @@ Note: log_free_check requires holding no lock/latch in current thread. */
void
PageBulk::release()
{
- ut_ad(!dict_index_is_spatial(m_index));
+ finish();
/* We fix the block because we will re-pin it soon. */
buf_block_buf_fix_inc(m_block, __FILE__, __LINE__);
@@ -659,6 +695,8 @@ PageBulk::latch()
m_mtr.set_named_space(m_index->space);
}
+ ut_ad(m_block->page.buf_fix_count);
+
/* In case the block is S-latched by page_cleaner. */
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
__FILE__, __LINE__, &m_mtr)) {
@@ -677,6 +715,8 @@ PageBulk::latch()
buf_block_buf_fix_dec(m_block);
+ ut_ad(m_block->page.buf_fix_count);
+
ut_ad(m_cur_rec > m_page && m_cur_rec < m_heap_top);
return (m_err);
@@ -693,12 +733,11 @@ BtrBulk::pageSplit(
{
ut_ad(page_bulk->getPageZip() != NULL);
- /* 1. Check if we have only one user record on the page. */
if (page_bulk->getRecNo() <= 1) {
return(DB_TOO_BIG_RECORD);
}
- /* 2. create a new page. */
+ /* Initialize a new page */
PageBulk new_page_bulk(m_index, m_trx->id, FIL_NULL,
page_bulk->getLevel(), m_flush_observer);
dberr_t err = new_page_bulk.init();
@@ -706,19 +745,18 @@ BtrBulk::pageSplit(
return(err);
}
- /* 3. copy the upper half to new page. */
+ /* Copy the upper half to the new page. */
rec_t* split_rec = page_bulk->getSplitRec();
new_page_bulk.copyIn(split_rec);
page_bulk->copyOut(split_rec);
- /* 4. commit the splitted page. */
+ /* Commit the pages after split. */
err = pageCommit(page_bulk, &new_page_bulk, true);
if (err != DB_SUCCESS) {
pageAbort(&new_page_bulk);
return(err);
}
- /* 5. commit the new page. */
err = pageCommit(&new_page_bulk, next_page_bulk, true);
if (err != DB_SUCCESS) {
pageAbort(&new_page_bulk);
@@ -864,7 +902,7 @@ BtrBulk::insert(
ulint rec_size = rec_get_converted_size(m_index, tuple, n_ext);
big_rec_t* big_rec = NULL;
rec_t* rec = NULL;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
if (page_bulk->needExt(tuple, rec_size)) {
/* The record is so big that we have to store some fields
@@ -944,11 +982,9 @@ BtrBulk::insert(
ut_ad(page_bulk->getLevel() == 0);
ut_ad(page_bulk == m_page_bulks.at(0));
- /* Release all latched but leaf node. */
+ /* Release all pages above the leaf level */
for (ulint level = 1; level <= m_root_level; level++) {
- PageBulk* page_bulk = m_page_bulks.at(level);
-
- page_bulk->release();
+ m_page_bulks.at(level)->release();
}
err = page_bulk->storeExt(big_rec, offsets);
@@ -1037,6 +1073,7 @@ BtrBulk::finish(dberr_t err)
return(err);
}
root_page_bulk.copyIn(first_rec);
+ root_page_bulk.finish();
/* Remove last page. */
btr_page_free(m_index, last_block, &mtr);
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 51552dcc513..7fd34c5d652 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -1,9 +1,9 @@
/*****************************************************************************
-Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -162,7 +162,7 @@ btr_cur_unmark_extern_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr); /*!< in: mtr, or NULL if not logged */
/*******************************************************************//**
Adds path information to the cursor for the current page, for which
@@ -187,7 +187,7 @@ btr_rec_free_updated_extern_fields(
rec_t* rec, /*!< in: record */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains
@@ -201,7 +201,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in: record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
bool rollback,/*!< in: performing rollback? */
@@ -415,6 +415,9 @@ btr_cur_optimistic_latch_leaves(
{
ulint mode;
ulint left_page_no;
+ ulint curr_page_no;
+ ut_ad(block->page.buf_fix_count);
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
switch (*latch_mode) {
case BTR_SEARCH_LEAF:
@@ -426,21 +429,13 @@ btr_cur_optimistic_latch_leaves(
mode = *latch_mode == BTR_SEARCH_PREV
? RW_S_LATCH : RW_X_LATCH;
- buf_page_mutex_enter(block);
- if (buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
- buf_page_mutex_exit(block);
- return(false);
- }
- /* pin the block not to be relocated */
- buf_block_buf_fix_inc(block, file, line);
- buf_page_mutex_exit(block);
-
rw_lock_s_lock(&block->lock);
if (block->modify_clock != modify_clock) {
rw_lock_s_unlock(&block->lock);
-
- goto unpin_failed;
+ return false;
}
+
+ curr_page_no = block->page.id.page_no();
left_page_no = btr_page_get_prev(
buf_block_get_frame(block));
rw_lock_s_unlock(&block->lock);
@@ -449,11 +444,26 @@ btr_cur_optimistic_latch_leaves(
const page_id_t page_id(
dict_index_get_space(cursor->index),
left_page_no);
+ dberr_t err = DB_SUCCESS;
- cursor->left_block = btr_block_get(
+ cursor->left_block = buf_page_get_gen(
page_id,
dict_table_page_size(cursor->index->table),
- mode, cursor->index, mtr);
+ mode, NULL, BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, mtr, &err);
+
+ if (err == DB_DECRYPTION_FAILED) {
+ cursor->index->table->file_unreadable = true;
+ }
+
+ if (btr_page_get_next(buf_block_get_frame(
+ cursor->left_block))
+ != curr_page_no) {
+ /* release the left block */
+ btr_leaf_page_release(
+ cursor->left_block, mode, mtr);
+ return false;
+ }
} else {
cursor->left_block = NULL;
}
@@ -462,23 +472,28 @@ btr_cur_optimistic_latch_leaves(
file, line, mtr)) {
if (btr_page_get_prev(buf_block_get_frame(block))
== left_page_no) {
- buf_block_buf_fix_dec(block);
+ /* block was already buffer-fixed while
+ entering the function and
+ buf_page_optimistic_get() buffer-fixes
+ it again. */
+ ut_ad(2 <= block->page.buf_fix_count);
*latch_mode = mode;
return(true);
} else {
- /* release the block */
+ /* release the block and decrement of
+ buf_fix_count which was incremented
+ in buf_page_optimistic_get() */
btr_leaf_page_release(block, mode, mtr);
}
}
+ ut_ad(block->page.buf_fix_count);
/* release the left block */
if (cursor->left_block != NULL) {
btr_leaf_page_release(cursor->left_block,
mode, mtr);
}
-unpin_failed:
- /* unpin the block */
- buf_block_buf_fix_dec(block);
+
return(false);
default:
@@ -583,46 +598,66 @@ btr_cur_will_modify_tree(
const ulint n_recs = page_get_n_recs(page);
if (lock_intention <= BTR_INTENTION_BOTH) {
- ulint margin;
+ compile_time_assert(BTR_INTENTION_DELETE < BTR_INTENTION_BOTH);
+ compile_time_assert(BTR_INTENTION_BOTH < BTR_INTENTION_INSERT);
- /* check delete will cause. (BTR_INTENTION_BOTH
- or BTR_INTENTION_DELETE) */
- /* first, 2nd, 2nd-last and last records are 4 records */
- if (n_recs < 5) {
- return(true);
+ if (!page_has_siblings(page)) {
+ return true;
}
- /* is first, 2nd or last record */
- if (page_rec_is_first(rec, page)
- || (page_has_next(page)
- && (page_rec_is_last(rec, page)
- || page_rec_is_second_last(rec, page)))
- || (page_has_prev(page)
- && page_rec_is_second(rec, page))) {
- return(true);
- }
+ ulint margin = rec_size;
if (lock_intention == BTR_INTENTION_BOTH) {
+ ulint level = btr_page_get_level(page, mtr);
+
+ /* This value is the worst expectation for the node_ptr
+ records to be deleted from this page. It is used to
+ expect whether the cursor position can be the left_most
+ record in this page or not. */
+ ulint max_nodes_deleted = 0;
+
+ /* By modifying tree operations from the under of this
+ level, logically (2 ^ (level - 1)) opportunities to
+ deleting records in maximum even unreally rare case. */
+ if (level > 7) {
+ /* TODO: adjust this practical limit. */
+ max_nodes_deleted = 64;
+ } else if (level > 0) {
+ max_nodes_deleted = (ulint)1 << (level - 1);
+ }
+ /* check delete will cause. (BTR_INTENTION_BOTH
+ or BTR_INTENTION_DELETE) */
+ if (n_recs <= max_nodes_deleted * 2
+ || page_rec_is_first(rec, page)) {
+ /* The cursor record can be the left most record
+ in this page. */
+ return true;
+ }
+
+ if (page_has_prev(page)
+ && page_rec_distance_is_at_most(
+ page_get_infimum_rec(page), rec,
+ max_nodes_deleted)) {
+ return true;
+ }
+
+ if (page_has_next(page)
+ && page_rec_distance_is_at_most(
+ rec, page_get_supremum_rec(page),
+ max_nodes_deleted)) {
+ return true;
+ }
+
/* Delete at leftmost record in a page causes delete
& insert at its parent page. After that, the delete
might cause btr_compress() and delete record at its
- parent page. Thus we should consider max 2 deletes. */
-
- margin = rec_size * 2;
- } else {
- ut_ad(lock_intention == BTR_INTENTION_DELETE);
-
- margin = rec_size;
+ parent page. Thus we should consider max deletes. */
+ margin *= max_nodes_deleted;
}
- /* NOTE: call mach_read_from_4() directly to avoid assertion
- failure. It is safe because we already have SX latch of the
- index tree */
+
+ /* Safe because we already have SX latch of the index tree */
if (page_get_data_size(page)
- < margin + BTR_CUR_PAGE_COMPRESS_LIMIT(index)
- || (mach_read_from_4(page + FIL_PAGE_NEXT)
- == FIL_NULL
- && mach_read_from_4(page + FIL_PAGE_PREV)
- == FIL_NULL)) {
+ < margin + BTR_CUR_PAGE_COMPRESS_LIMIT(index)) {
return(true);
}
}
@@ -844,8 +879,7 @@ search tuple should be performed in the B-tree. InnoDB does an insert
immediately after the cursor. Thus, the cursor may end up on a user record,
or on a page infimum record. */
dberr_t
-btr_cur_search_to_nth_level(
-/*========================*/
+btr_cur_search_to_nth_level_func(
dict_index_t* index, /*!< in: index */
ulint level, /*!< in: the tree level of search */
const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in
@@ -867,10 +901,12 @@ btr_cur_search_to_nth_level(
to protect the record! */
btr_cur_t* cursor, /*!< in/out: tree cursor; the cursor page is
s- or x-latched, but see also above! */
+#ifdef BTR_CUR_HASH_ADAPT
ulint has_search_latch,
/*!< in: info on the latch mode the
caller currently has on search system:
RW_S_LATCH, or 0 */
+#endif /* BTR_CUR_HASH_ADAPT */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr, /*!< in: mtr */
@@ -923,10 +959,10 @@ btr_cur_search_to_nth_level(
btr_search_t* info;
#endif /* BTR_CUR_ADAPT */
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
- ulint offsets2_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets2 = offsets2_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
+ rec_offs offsets2_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets2 = offsets2_;
rec_offs_init(offsets_);
rec_offs_init(offsets2_);
/* Currently, PAGE_CUR_LE is the only search mode used for searches
@@ -940,10 +976,12 @@ btr_cur_search_to_nth_level(
ut_ad(!(index->type & DICT_FTS));
ut_ad(index->page != FIL_NULL);
- UNIV_MEM_INVALID(&cursor->up_match, sizeof cursor->up_match);
- UNIV_MEM_INVALID(&cursor->up_bytes, sizeof cursor->up_bytes);
- UNIV_MEM_INVALID(&cursor->low_match, sizeof cursor->low_match);
- UNIV_MEM_INVALID(&cursor->low_bytes, sizeof cursor->low_bytes);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&cursor->up_match, sizeof cursor->up_match);
+ MEM_UNDEFINED(&cursor->up_bytes, sizeof cursor->up_bytes);
+ MEM_UNDEFINED(&cursor->low_match, sizeof cursor->low_match);
+ MEM_UNDEFINED(&cursor->low_bytes, sizeof cursor->low_bytes);
+#endif /* HAVE_valgrind_or_MSAN */
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
@@ -1025,14 +1063,10 @@ btr_cur_search_to_nth_level(
guess = NULL;
#else
info = btr_search_get_info(index);
-
- if (!buf_pool_is_obsolete(info->withdraw_clock)) {
- guess = info->root_guess;
- } else {
- guess = NULL;
- }
+ guess = info->root_guess;
#ifdef BTR_CUR_HASH_ADAPT
+ rw_lock_t* const search_latch = btr_get_search_latch(index);
# ifdef UNIV_SEARCH_PERF_STAT
info->n_searches++;
@@ -1053,8 +1087,7 @@ btr_cur_search_to_nth_level(
will have to check it again. */
&& btr_search_enabled
&& !modify_external
- && rw_lock_get_writer(btr_get_search_latch(index))
- == RW_LOCK_NOT_LOCKED
+ && rw_lock_get_writer(search_latch) == RW_LOCK_NOT_LOCKED
&& btr_search_guess_on_hash(index, info, tuple, mode,
latch_mode, cursor,
has_search_latch, mtr)) {
@@ -1078,10 +1111,12 @@ btr_cur_search_to_nth_level(
/* If the hash search did not succeed, do binary search down the
tree */
+#ifdef BTR_CUR_HASH_ADAPT
if (has_search_latch) {
/* Release possible search latch to obey latching order */
- btr_search_s_unlock(index);
+ rw_lock_s_unlock(search_latch);
}
+#endif /* BTR_CUR_HASH_ADAPT */
/* Store the position of the tree latch we push to mtr so that we
know how to release it when we have latched leaf node(s) */
@@ -1455,10 +1490,9 @@ retry_page_get:
node_seq_t root_seq_no;
root_seq_no = page_get_ssn_id(page);
-
- mutex_enter(&(index->rtr_ssn.mutex));
- index->rtr_ssn.seq_no = root_seq_no + 1;
- mutex_exit(&(index->rtr_ssn.mutex));
+ my_atomic_store32_explicit(
+ &index->rtr_ssn, root_seq_no + 1,
+ MY_MEMORY_ORDER_RELAXED);
}
/* Save the MBR */
@@ -1467,10 +1501,7 @@ retry_page_get:
}
#ifdef BTR_CUR_ADAPT
- if (block != guess) {
- info->root_guess = block;
- info->withdraw_clock = buf_withdraw_clock;
- }
+ info->root_guess = block;
#endif
}
@@ -1806,9 +1837,9 @@ need_opposite_intention:
offsets2 = rec_get_offsets(
first_rec, index, offsets2,
false, ULINT_UNDEFINED, &heap);
- cmp_rec_rec_with_match(node_ptr, first_rec,
- offsets, offsets2, index, FALSE,
- &matched_fields);
+ cmp_rec_rec(node_ptr, first_rec,
+ offsets, offsets2, index, false,
+ &matched_fields);
if (matched_fields
>= rec_offs_n_fields(offsets) - 1) {
@@ -1824,10 +1855,10 @@ need_opposite_intention:
offsets2 = rec_get_offsets(
last_rec, index, offsets2,
false, ULINT_UNDEFINED, &heap);
- cmp_rec_rec_with_match(
+ cmp_rec_rec(
node_ptr, last_rec,
offsets, offsets2, index,
- FALSE, &matched_fields);
+ false, &matched_fields);
if (matched_fields
>= rec_offs_n_fields(offsets) - 1) {
detected_same_key_root = true;
@@ -2136,9 +2167,11 @@ func_exit:
ut_free(prev_tree_savepoints);
}
+#ifdef BTR_CUR_HASH_ADAPT
if (has_search_latch) {
- btr_search_s_lock(index);
+ rw_lock_s_lock(search_latch);
}
+#endif /* BTR_CUR_HASH_ADAPT */
if (mbr_adj) {
/* remember that we will need to adjust parent MBR */
@@ -2178,8 +2211,8 @@ btr_cur_open_at_index_side_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
dberr_t err = DB_SUCCESS;
rec_offs_init(offsets_);
@@ -2548,8 +2581,8 @@ btr_cur_open_at_rnd_pos_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!dict_index_is_spatial(index));
@@ -2839,7 +2872,7 @@ btr_cur_insert_if_possible(
cursor stays valid */
const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not
have been stored to tuple */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */
@@ -3005,7 +3038,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@@ -3031,7 +3064,7 @@ btr_cur_optimistic_insert(
page_t* page;
rec_t* dummy;
ibool leaf;
- ibool reorg;
+ ibool reorg __attribute__((unused));
ibool inherit = TRUE;
ulint rec_size;
dberr_t err;
@@ -3051,12 +3084,12 @@ btr_cur_optimistic_insert(
const page_size_t& page_size = block->page.size;
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind_or_MSAN
if (page_size.is_compressed()) {
- UNIV_MEM_ASSERT_RW(page, page_size.logical());
- UNIV_MEM_ASSERT_RW(block->page.zip.data, page_size.physical());
+ MEM_CHECK_DEFINED(page, page_size.logical());
+ MEM_CHECK_DEFINED(block->page.zip.data, page_size.physical());
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind_or_MSAN */
leaf = page_is_leaf(page);
@@ -3101,7 +3134,7 @@ fail:
/* prefetch siblings of the leaf for the pessimistic
operation, if the page is leaf. */
- if (page_is_leaf(page)) {
+ if (page_is_leaf(page) && !index->is_ibuf()) {
btr_cur_prefetch_siblings(block);
}
fail_err:
@@ -3114,17 +3147,23 @@ fail_err:
}
ulint max_size = page_get_max_insert_size_after_reorganize(page, 1);
+ if (max_size < rec_size) {
+ goto fail;
+ }
+
+ const ulint n_recs = page_get_n_recs(page);
+ if (UNIV_UNLIKELY(n_recs >= 8189)) {
+ ut_ad(srv_page_size == 65536);
+ goto fail;
+ }
if (page_has_garbage(page)) {
- if ((max_size < rec_size
- || max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT)
- && page_get_n_recs(page) > 1
+ if (max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
+ && n_recs > 1
&& page_get_max_insert_size(page, 1) < rec_size) {
goto fail;
}
- } else if (max_size < rec_size) {
- goto fail;
}
/* If there have been many consecutive inserts to the
@@ -3294,7 +3333,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@@ -3460,7 +3499,7 @@ btr_cur_upd_lock_and_undo(
/*======================*/
ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: cursor on record to update */
- const ulint* offsets,/*!< in: rec_get_offsets() on cursor */
+ const rec_offs* offsets,/*!< in: rec_get_offsets() on cursor */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@@ -3591,7 +3630,7 @@ btr_cur_parse_update_in_place(
roll_ptr_t roll_ptr;
ulint rec_offset;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
if (end_ptr < ptr + 1) {
@@ -3676,7 +3715,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
- ulint* offsets,/*!< in/out: offsets of the cursor record */
+ rec_offs* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@@ -3757,7 +3796,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
- ulint* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+ rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@@ -3922,7 +3961,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
- ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@@ -3949,7 +3988,6 @@ btr_cur_optimistic_update(
dtuple_t* new_entry;
roll_ptr_t roll_ptr;
ulint i;
- ulint n_ext;
block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block);
@@ -3975,7 +4013,7 @@ btr_cur_optimistic_update(
ULINT_UNDEFINED, heap);
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
ut_a(!rec_offs_any_null_extern(rec, *offsets)
- || trx_is_recv(thr_get_trx(thr)));
+ || thr_get_trx(thr) == trx_roll_crash_recv_trx);
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
if (!row_upd_changes_field_size_or_external(index, *offsets, update)) {
@@ -3992,6 +4030,7 @@ btr_cur_optimistic_update(
if (rec_offs_any_extern(*offsets)) {
any_extern:
+ ut_ad(!index->is_ibuf());
/* Externally stored fields are treated in pessimistic
update */
@@ -4022,10 +4061,8 @@ any_extern:
+ DTUPLE_EST_ALLOC(rec_offs_n_fields(*offsets)));
}
- new_entry = row_rec_to_index_entry(rec, index, *offsets,
- &n_ext, *heap);
- /* We checked above that there are no externally stored fields. */
- ut_a(!n_ext);
+ new_entry = row_rec_to_index_entry(rec, index, *offsets, *heap);
+ ut_ad(!dtuple_get_n_ext(new_entry));
/* The page containing the clustered index record
corresponding to new_entry is latched in mtr.
@@ -4173,7 +4210,7 @@ func_exit:
}
}
- if (err != DB_SUCCESS) {
+ if (err != DB_SUCCESS && !index->is_ibuf()) {
/* prefetch siblings of the leaf for the pessimistic
operation. */
btr_cur_prefetch_siblings(block);
@@ -4240,7 +4277,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
- ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@@ -4273,7 +4310,6 @@ btr_cur_pessimistic_update(
roll_ptr_t roll_ptr;
ibool was_first;
ulint n_reserved = 0;
- ulint n_ext;
ulint max_ins_size = 0;
*offsets = NULL;
@@ -4338,7 +4374,7 @@ btr_cur_pessimistic_update(
ut_ad(rec_offs_validate(rec, index, *offsets));
dtuple_t* new_entry = row_rec_to_index_entry(
- rec, index, *offsets, &n_ext, entry_heap);
+ rec, index, *offsets, entry_heap);
/* The page containing the clustered index record
corresponding to new_entry is latched in mtr. If the
@@ -4354,7 +4390,6 @@ btr_cur_pessimistic_update(
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
ut_ad(rec_offs_validate(rec, index, *offsets));
- n_ext += btr_push_update_extern_fields(new_entry, update, entry_heap);
if ((flags & BTR_NO_UNDO_LOG_FLAG)
&& rec_offs_any_extern(*offsets)) {
@@ -4375,6 +4410,8 @@ btr_cur_pessimistic_update(
index, rec, page_zip, *offsets, update, true, mtr);
}
+ ulint n_ext = dtuple_get_n_ext(new_entry);
+
if (page_zip_rec_needs_ext(
rec_get_converted_size(index, new_entry, n_ext),
page_is_comp(page),
@@ -4762,7 +4799,7 @@ btr_cur_parse_del_mark_set_clust_rec(
clustered index fields. */
ut_ad(pos <= MAX_REF_PARTS);
- ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
+ rec_offs offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
rec_offs_init(offsets);
mem_heap_t* heap = NULL;
@@ -4805,7 +4842,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record, also
contains the virtual cols if there are any */
@@ -5092,8 +5129,8 @@ btr_cur_optimistic_delete_func(
buf_block_t* block;
rec_t* rec;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
ibool no_compress_needed;
rec_offs_init(offsets_);
@@ -5213,7 +5250,7 @@ btr_cur_pessimistic_delete(
bool success;
ibool ret = FALSE;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
#ifdef UNIV_DEBUG
bool parent_latched = false;
#endif /* UNIV_DEBUG */
@@ -5312,7 +5349,7 @@ btr_cur_pessimistic_delete(
rtr_mbr_t father_mbr;
rec_t* father_rec;
btr_cur_t father_cursor;
- ulint* offsets;
+ rec_offs* offsets;
bool upd_ret;
ulint len;
@@ -5730,7 +5767,7 @@ btr_estimate_n_rows_in_range_low(
btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, 0);
ut_ad(!page_rec_is_infimum(btr_cur_get_rec(&cursor)));
@@ -5784,7 +5821,7 @@ btr_estimate_n_rows_in_range_low(
btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
BTR_SEARCH_LEAF | BTR_ESTIMATE,
&cursor, 0,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, 0);
const rec_t* rec = btr_cur_get_rec(&cursor);
@@ -6073,7 +6110,7 @@ btr_record_not_null_field_in_rec(
ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine
an index entry */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
its size could be for all fields or
that of "n_unique" */
ib_uint64_t* n_not_null) /*!< in/out: array to record number of
@@ -6096,21 +6133,19 @@ btr_record_not_null_field_in_rec(
}
}
-/*******************************************************************//**
-Estimates the number of different key values in a given index, for
+/** Estimates the number of different key values in a given index, for
each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index).
The estimates are stored in the array index->stat_n_diff_key_vals[] (indexed
0..n_uniq-1) and the number of pages that were sampled is saved in
-index->stat_n_sample_sizes[].
+result.n_sample_sizes[].
If innodb_stats_method is nulls_ignored, we also record the number of
non-null values for each prefix and stored the estimates in
-array index->stat_n_non_null_key_vals.
-@return true if the index is available and we get the estimated numbers,
-false if the index is unavailable. */
-bool
-btr_estimate_number_of_different_key_vals(
-/*======================================*/
- dict_index_t* index) /*!< in: index */
+array result.n_non_null_key_vals.
+@param[in] index index
+@return vector with statistics information
+empty vector if the index is unavailable. */
+std::vector<index_field_stats_t>
+btr_estimate_number_of_different_key_vals(dict_index_t* index)
{
btr_cur_t cursor;
page_t* page;
@@ -6127,14 +6162,14 @@ btr_estimate_number_of_different_key_vals(
uintmax_t add_on;
mtr_t mtr;
mem_heap_t* heap = NULL;
- ulint* offsets_rec = NULL;
- ulint* offsets_next_rec = NULL;
+ rec_offs* offsets_rec = NULL;
+ rec_offs* offsets_next_rec = NULL;
+
+ std::vector<index_field_stats_t> result;
/* For spatial index, there is no such stats can be
fetched. */
- if (dict_index_is_spatial(index)) {
- return(false);
- }
+ ut_ad(!dict_index_is_spatial(index));
n_cols = dict_index_get_n_unique(index);
@@ -6243,7 +6278,7 @@ btr_estimate_number_of_different_key_vals(
mtr_commit(&mtr);
mem_heap_free(heap);
- return(false);
+ return result;
}
/* Count the number of different key values for each prefix of
@@ -6290,10 +6325,10 @@ btr_estimate_number_of_different_key_vals(
ULINT_UNDEFINED,
&heap);
- cmp_rec_rec_with_match(rec, next_rec,
- offsets_rec, offsets_next_rec,
- index, stats_null_not_equal,
- &matched_fields);
+ cmp_rec_rec(rec, next_rec,
+ offsets_rec, offsets_next_rec,
+ index, stats_null_not_equal,
+ &matched_fields);
for (j = matched_fields; j < n_cols; j++) {
/* We add one if this index record has
@@ -6316,7 +6351,7 @@ btr_estimate_number_of_different_key_vals(
and assign the old offsets_rec buffer to
offsets_next_rec. */
{
- ulint* offsets_tmp = offsets_rec;
+ rec_offs* offsets_tmp = offsets_rec;
offsets_rec = offsets_next_rec;
offsets_next_rec = offsets_tmp;
}
@@ -6349,8 +6384,12 @@ exit_loop:
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
+ result.reserve(n_cols);
+
for (j = 0; j < n_cols; j++) {
- index->stat_n_diff_key_vals[j]
+ index_field_stats_t stat;
+
+ stat.n_diff_key_vals
= BTR_TABLE_STATS_FROM_SAMPLE(
n_diff[j], index, n_sample_pages,
total_external_size, not_empty_flag);
@@ -6371,25 +6410,23 @@ exit_loop:
add_on = n_sample_pages;
}
- index->stat_n_diff_key_vals[j] += add_on;
+ stat.n_diff_key_vals += add_on;
- index->stat_n_sample_sizes[j] = n_sample_pages;
+ stat.n_sample_sizes = n_sample_pages;
- /* Update the stat_n_non_null_key_vals[] with our
- sampled result. stat_n_non_null_key_vals[] is created
- and initialized to zero in dict_index_add_to_cache(),
- along with stat_n_diff_key_vals[] array */
if (n_not_null != NULL) {
- index->stat_n_non_null_key_vals[j] =
+ stat.n_non_null_key_vals =
BTR_TABLE_STATS_FROM_SAMPLE(
n_not_null[j], index, n_sample_pages,
total_external_size, not_empty_flag);
}
+
+ result.push_back(stat);
}
mem_heap_free(heap);
- return(true);
+ return result;
}
/*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/
@@ -6401,7 +6438,7 @@ static
ulint
btr_rec_get_field_ref_offs(
/*=======================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: index of the external field */
{
ulint field_ref_offs;
@@ -6430,7 +6467,7 @@ btr_rec_get_field_ref_offs(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
ulint n_fields;
ulint total_extern_len = 0;
@@ -6469,7 +6506,7 @@ btr_cur_set_ownership_of_extern_field(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: clustered index record */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint i, /*!< in: field number */
ibool val, /*!< in: value to set */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
@@ -6519,7 +6556,7 @@ btr_cur_disown_inherited_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
@@ -6550,7 +6587,7 @@ btr_cur_unmark_extern_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
{
ulint n;
@@ -6574,84 +6611,6 @@ btr_cur_unmark_extern_fields(
}
/*******************************************************************//**
-Flags the data tuple fields that are marked as extern storage in the
-update vector. We use this function to remember which fields we must
-mark as extern storage in a record inserted for an update.
-@return number of flagged external columns */
-ulint
-btr_push_update_extern_fields(
-/*==========================*/
- dtuple_t* tuple, /*!< in/out: data tuple */
- const upd_t* update, /*!< in: update vector */
- mem_heap_t* heap) /*!< in: memory heap */
-{
- ulint n_pushed = 0;
- ulint n;
- const upd_field_t* uf;
-
- uf = update->fields;
- n = upd_get_n_fields(update);
-
- for (; n--; uf++) {
- if (dfield_is_ext(&uf->new_val)) {
- dfield_t* field
- = dtuple_get_nth_field(tuple, uf->field_no);
-
- if (!dfield_is_ext(field)) {
- dfield_set_ext(field);
- n_pushed++;
- }
-
- switch (uf->orig_len) {
- byte* data;
- ulint len;
- byte* buf;
- case 0:
- break;
- case BTR_EXTERN_FIELD_REF_SIZE:
- /* Restore the original locally stored
- part of the column. In the undo log,
- InnoDB writes a longer prefix of externally
- stored columns, so that column prefixes
- in secondary indexes can be reconstructed. */
- dfield_set_data(field,
- (byte*) dfield_get_data(field)
- + dfield_get_len(field)
- - BTR_EXTERN_FIELD_REF_SIZE,
- BTR_EXTERN_FIELD_REF_SIZE);
- dfield_set_ext(field);
- break;
- default:
- /* Reconstruct the original locally
- stored part of the column. The data
- will have to be copied. */
- ut_a(uf->orig_len > BTR_EXTERN_FIELD_REF_SIZE);
-
- data = (byte*) dfield_get_data(field);
- len = dfield_get_len(field);
-
- buf = (byte*) mem_heap_alloc(heap,
- uf->orig_len);
- /* Copy the locally stored prefix. */
- memcpy(buf, data,
- uf->orig_len
- - BTR_EXTERN_FIELD_REF_SIZE);
- /* Copy the BLOB pointer. */
- memcpy(buf + uf->orig_len
- - BTR_EXTERN_FIELD_REF_SIZE,
- data + len - BTR_EXTERN_FIELD_REF_SIZE,
- BTR_EXTERN_FIELD_REF_SIZE);
-
- dfield_set_data(field, buf, uf->orig_len);
- dfield_set_ext(field);
- }
- }
- }
-
- return(n_pushed);
-}
-
-/*******************************************************************//**
Returns the length of a BLOB part stored on the header page.
@return part length */
static
@@ -6688,29 +6647,19 @@ btr_blob_free(
mtr_t* mtr) /*!< in: mini-transaction to commit */
{
buf_pool_t* buf_pool = buf_pool_from_block(block);
- ulint space = block->page.id.space();
- ulint page_no = block->page.id.page_no();
-
+ const page_id_t page_id = block->page.id;
ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table));
-
mtr_commit(mtr);
buf_pool_mutex_enter(buf_pool);
- /* Only free the block if it is still allocated to
- the same file page. */
-
- if (buf_block_get_state(block)
- == BUF_BLOCK_FILE_PAGE
- && block->page.id.space() == space
- && block->page.id.page_no() == page_no) {
-
- if (!buf_LRU_free_page(&block->page, all)
- && all && block->page.zip.data) {
+ if (buf_page_t* bpage = buf_page_hash_get(buf_pool, page_id)) {
+ if (!buf_LRU_free_page(bpage, all)
+ && all && bpage->zip.data) {
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
- buf_LRU_free_page(&block->page, false);
+ buf_LRU_free_page(bpage, false);
}
}
@@ -6724,7 +6673,7 @@ struct btr_blob_log_check_t {
/** Mini transaction holding the latches for m_pcur */
mtr_t* m_mtr;
/** rec_get_offsets(rec, index); offset of clust_rec */
- const ulint* m_offsets;
+ const rec_offs* m_offsets;
/** The block containing clustered record */
buf_block_t** m_block;
/** The clustered record pointer */
@@ -6744,7 +6693,7 @@ struct btr_blob_log_check_t {
btr_blob_log_check_t(
btr_pcur_t* pcur,
mtr_t* mtr,
- const ulint* offsets,
+ const rec_offs* offsets,
buf_block_t** block,
rec_t** rec,
enum blob_op op)
@@ -6818,7 +6767,7 @@ struct btr_blob_log_check_t {
*m_rec = btr_pcur_get_rec(m_pcur);
ut_d(rec_offs_make_valid(
- *m_rec, index, const_cast<ulint*>(m_offsets)));
+ *m_rec, index, const_cast<rec_offs*>(m_offsets)));
ut_ad(m_mtr->memo_contains_page_flagged(
*m_rec,
@@ -6849,7 +6798,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
- ulint* offsets, /*!< in/out: rec_get_offsets() on
+ rec_offs* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@@ -6959,9 +6908,7 @@ btr_store_big_rec_extern_fields(
BTR_EXTERN_FIELD_REF_SIZE));
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
extern_len = big_rec_vec->fields[i].len;
- UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
- extern_len);
-
+ MEM_CHECK_DEFINED(big_rec_vec->fields[i].data, extern_len);
ut_a(extern_len > 0);
prev_page_no = FIL_NULL;
@@ -7109,33 +7056,6 @@ btr_store_big_rec_extern_fields(
/* Initialize the unused "prev page" pointer */
mlog_write_ulint(page + FIL_PAGE_PREV,
FIL_NULL, MLOG_4BYTES, &mtr);
- /* Write a back pointer to the record
- into the otherwise unused area. This
- information could be useful in
- debugging. Later, we might want to
- implement the possibility to relocate
- BLOB pages. Then, we would need to be
- able to adjust the BLOB pointer in the
- record. We do not store the heap
- number of the record, because it can
- change in page_zip_reorganize() or
- btr_page_reorganize(). However, also
- the page number of the record may
- change when B-tree nodes are split or
- merged.
- NOTE: FIL_PAGE_FILE_FLUSH_LSN space is
- used by R-tree index for a Split Sequence
- Number */
- ut_ad(!dict_index_is_spatial(index));
-
- mlog_write_ulint(page
- + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- space_id,
- MLOG_4BYTES, &mtr);
- mlog_write_ulint(page
- + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4,
- rec_page_no,
- MLOG_4BYTES, &mtr);
/* Zero out the unused part of the page. */
memset(page + page_zip_get_size(page_zip)
@@ -7361,7 +7281,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
page_zip_des_t* page_zip, /*!< in: compressed page corresponding
to rec, or NULL if rec == NULL */
@@ -7534,7 +7454,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in/out: record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
bool rollback,/*!< in: performing rollback? */
@@ -7575,7 +7495,7 @@ btr_rec_free_updated_extern_fields(
rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip,/*!< in: compressed page whose uncompressed
part will be updated, or NULL */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains
@@ -7655,7 +7575,7 @@ btr_copy_blob_prefix(
mtr_commit(&mtr);
if (page_no == FIL_NULL || copy_len != part_len) {
- UNIV_MEM_ASSERT_RW(buf, copied_len);
+ MEM_CHECK_DEFINED(buf, copied_len);
return(copied_len);
}
@@ -7811,7 +7731,7 @@ end_of_blob:
func_exit:
inflateEnd(&d_stream);
mem_heap_free(heap);
- UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
+ MEM_CHECK_DEFINED(buf, d_stream.total_out);
return(d_stream.total_out);
}
@@ -7973,7 +7893,7 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
const page_size_t& page_size,
ulint no,
ulint* len,
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 4646b3252a7..645334cbf4d 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -39,6 +39,9 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com
#include <list>
+using std::list;
+using std::min;
+
/* When there's no work, either because defragment is disabled, or because no
query is submitted, thread checks state every BTR_DEFRAGMENT_SLEEP_IN_USECS.*/
#define BTR_DEFRAGMENT_SLEEP_IN_USECS 1000000
@@ -154,8 +157,6 @@ synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async, /*!< whether this is an async
- defragmentation */
dberr_t* err) /*!< out: error code */
{
mtr_t mtr;
@@ -188,10 +189,7 @@ btr_defragment_add_index(
return NULL;
}
btr_pcur_t* pcur = btr_pcur_create_for_mysql();
- os_event_t event = NULL;
- if (!async) {
- event = os_event_create(0);
- }
+ os_event_t event = os_event_create(0);
btr_pcur_open_at_index_side(true, index, BTR_SEARCH_LEAF, pcur,
true, 0, &mtr);
btr_pcur_move_to_next(pcur, &mtr);
@@ -338,8 +336,8 @@ btr_defragment_calc_n_recs_for_size(
{
page_t* page = buf_block_get_frame(block);
ulint n_recs = 0;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
mem_heap_t* heap = NULL;
ulint size = 0;
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index cb5e18457f2..560774c715e 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, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -165,11 +165,10 @@ btr_pcur_store_position(
index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size);
- cursor->block_when_stored = block;
+ cursor->block_when_stored.store(block);
/* Function try to check if block is S/X latch. */
cursor->modify_clock = buf_block_get_modify_clock(block);
- cursor->withdraw_clock = buf_withdraw_clock;
}
/**************************************************************//**
@@ -199,6 +198,26 @@ btr_pcur_copy_stored_position(
pcur_receive->old_n_fields = pcur_donate->old_n_fields;
}
+/** Structure acts as functor to do the latching of leaf pages.
+It returns true if latching of leaf pages succeeded and false
+otherwise. */
+struct optimistic_latch_leaves
+{
+ btr_pcur_t *const cursor;
+ ulint *latch_mode;
+ mtr_t *const mtr;
+
+ optimistic_latch_leaves(btr_pcur_t *cursor, ulint *latch_mode, mtr_t *mtr)
+ :cursor(cursor), latch_mode(latch_mode), mtr(mtr) {}
+
+ bool operator() (buf_block_t *hint) const
+ {
+ return hint && btr_cur_optimistic_latch_leaves(
+ hint, cursor->modify_clock, latch_mode,
+ btr_pcur_get_btr_cur(cursor), __FILE__, __LINE__, mtr);
+ }
+};
+
/**************************************************************//**
Restores the stored position of a persistent cursor bufferfixing the page and
obtaining the specified latches. If the cursor position was saved when the
@@ -261,7 +280,7 @@ btr_pcur_restore_position_func(
cursor->latch_mode =
BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
- cursor->block_when_stored = btr_pcur_get_block(cursor);
+ cursor->block_when_stored.clear();
return(FALSE);
}
@@ -276,12 +295,9 @@ btr_pcur_restore_position_func(
case BTR_MODIFY_PREV:
/* Try optimistic restoration. */
- if (!buf_pool_is_obsolete(cursor->withdraw_clock)
- && btr_cur_optimistic_latch_leaves(
- cursor->block_when_stored, cursor->modify_clock,
- &latch_mode, btr_pcur_get_btr_cur(cursor),
- file, line, mtr)) {
-
+ if (cursor->block_when_stored.run_with_hint(
+ optimistic_latch_leaves(cursor, &latch_mode,
+ mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->latch_mode = latch_mode;
@@ -293,16 +309,21 @@ btr_pcur_restore_position_func(
if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG
const rec_t* rec;
- const ulint* offsets1;
- const ulint* offsets2;
+ rec_offs offsets1_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets2_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets1 = offsets1_;
+ rec_offs* offsets2 = offsets2_;
rec = btr_pcur_get_rec(cursor);
+ rec_offs_init(offsets1_);
+ rec_offs_init(offsets2_);
+
heap = mem_heap_create(256);
offsets1 = rec_get_offsets(
- cursor->old_rec, index, NULL, true,
+ cursor->old_rec, index, offsets1, true,
cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets(
- rec, index, NULL, true,
+ rec, index, offsets2, true,
cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec,
@@ -348,8 +369,11 @@ btr_pcur_restore_position_func(
mode = PAGE_CUR_UNSUPP;
}
- btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode,
- cursor, 0, file, line, mtr);
+ btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode, cursor,
+#ifdef BTR_CUR_HASH_ADAPT
+ 0,
+#endif /* BTR_CUR_HASH_ADAPT */
+ file, line, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
@@ -357,22 +381,23 @@ btr_pcur_restore_position_func(
ut_ad(cursor->rel_pos == BTR_PCUR_ON
|| cursor->rel_pos == BTR_PCUR_BEFORE
|| cursor->rel_pos == BTR_PCUR_AFTER);
+ rec_offs offsets[REC_OFFS_NORMAL_SIZE];
+ rec_offs_init(offsets);
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor)
&& !cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor),
- index, NULL, true,
+ index, offsets, true,
ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock,
since the cursor can now be on a different page!
But we can retain the value of old_rec */
- cursor->block_when_stored = btr_pcur_get_block(cursor);
+ cursor->block_when_stored.store(btr_pcur_get_block(cursor));
cursor->modify_clock = buf_block_get_modify_clock(
- cursor->block_when_stored);
+ cursor->block_when_stored.block());
cursor->old_stored = true;
- cursor->withdraw_clock = buf_withdraw_clock;
mem_heap_free(heap);
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 955a5bc0800..60d9c90c310 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -481,7 +481,7 @@ btr_pessimistic_scrub(
/* arguments to btr_page_split_and_insert */
mem_heap_t* heap = NULL;
dtuple_t* entry = NULL;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
ulint n_ext = 0;
ulint flags = BTR_MODIFY_TREE;
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 725190e7fee..79e6326ac1c 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -141,34 +141,32 @@ static
void
btr_search_check_free_space_in_heap(dict_index_t* index)
{
+ /* Note that we peek the value of heap->free_block without reserving
+ the latch: this is ok, because we will not guarantee that there will
+ be enough free space in the hash table. */
+
+ buf_block_t* block = buf_block_alloc(NULL);
+ rw_lock_t* latch = btr_get_search_latch(index);
hash_table_t* table;
mem_heap_t* heap;
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
+ rw_lock_x_lock(latch);
- table = btr_get_search_table(index);
+ if (!btr_search_enabled) {
+ goto func_exit;
+ }
+ table = btr_get_search_table(index);
heap = table->heap;
- /* Note that we peek the value of heap->free_block without reserving
- the latch: this is ok, because we will not guarantee that there will
- be enough free space in the hash table. */
-
if (heap->free_block == NULL) {
- buf_block_t* block = buf_block_alloc(NULL);
-
- btr_search_x_lock(index);
-
- if (btr_search_enabled
- && heap->free_block == NULL) {
- heap->free_block = block;
- } else {
- buf_block_free(block);
- }
-
- btr_search_x_unlock(index);
+ heap->free_block = block;
+ } else {
+func_exit:
+ buf_block_free(block);
}
+
+ rw_lock_x_unlock(latch);
}
/** Creates and initializes the adaptive search system at a database start.
@@ -197,87 +195,41 @@ btr_search_sys_create(ulint hash_size)
btr_search_sys = reinterpret_cast<btr_search_sys_t*>(
ut_malloc(sizeof(btr_search_sys_t), mem_key_ahi));
- btr_search_sys->hash_tables = reinterpret_cast<hash_table_t**>(
- ut_malloc(sizeof(hash_table_t*) * btr_ahi_parts, mem_key_ahi));
-
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
-
- btr_search_sys->hash_tables[i] =
- ib_create((hash_size / btr_ahi_parts),
- LATCH_ID_HASH_TABLE_MUTEX,
- 0, MEM_HEAP_FOR_BTR_SEARCH);
-
-#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- btr_search_sys->hash_tables[i]->adaptive = TRUE;
-#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- }
-}
-
-/** Resize hash index hash table.
-@param[in] hash_size hash index hash table size */
-void
-btr_search_sys_resize(ulint hash_size)
-{
- /* Step-1: Lock all search latches in exclusive mode. */
- btr_search_x_lock_all();
+ btr_search_sys->hash_tables = NULL;
if (btr_search_enabled) {
-
- btr_search_x_unlock_all();
-
- ib::error() << "btr_search_sys_resize failed because"
- " hash index hash table is not empty.";
- ut_ad(0);
- return;
- }
-
- /* Step-2: Recreate hash tables with new size. */
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
-
- mem_heap_free(btr_search_sys->hash_tables[i]->heap);
- hash_table_free(btr_search_sys->hash_tables[i]);
-
- btr_search_sys->hash_tables[i] =
- ib_create((hash_size / btr_ahi_parts),
- LATCH_ID_HASH_TABLE_MUTEX,
- 0, MEM_HEAP_FOR_BTR_SEARCH);
-
-#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- btr_search_sys->hash_tables[i]->adaptive = TRUE;
-#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ btr_search_enable();
}
-
- /* Step-3: Unlock all search latches from exclusive mode. */
- btr_search_x_unlock_all();
}
/** Frees the adaptive search system at a database shutdown. */
-void
-btr_search_sys_free()
+void btr_search_sys_free()
{
- ut_ad(btr_search_sys != NULL && btr_search_latches != NULL);
-
- /* Step-1: Release the hash tables. */
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
-
- mem_heap_free(btr_search_sys->hash_tables[i]->heap);
- hash_table_free(btr_search_sys->hash_tables[i]);
-
- }
-
- ut_free(btr_search_sys->hash_tables);
- ut_free(btr_search_sys);
- btr_search_sys = NULL;
-
- /* Step-2: Release all allocates latches. */
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
-
- rw_lock_free(btr_search_latches[i]);
- ut_free(btr_search_latches[i]);
- }
-
- ut_free(btr_search_latches);
- btr_search_latches = NULL;
+ ut_ad(btr_search_sys);
+ ut_ad(btr_search_latches);
+
+ if (btr_search_sys->hash_tables)
+ {
+ for (ulint i= 0; i < btr_ahi_parts; ++i)
+ {
+ mem_heap_free(btr_search_sys->hash_tables[i]->heap);
+ hash_table_free(btr_search_sys->hash_tables[i]);
+ }
+ ut_free(btr_search_sys->hash_tables);
+ }
+
+ ut_free(btr_search_sys);
+ btr_search_sys= NULL;
+
+ /* Free all latches. */
+ for (ulint i= 0; i < btr_ahi_parts; ++i)
+ {
+ rw_lock_free(btr_search_latches[i]);
+ ut_free(btr_search_latches[i]);
+ }
+
+ ut_free(btr_search_latches);
+ btr_search_latches= NULL;
}
/** Set index->ref_count = 0 on all indexes of a table.
@@ -289,38 +241,99 @@ btr_search_disable_ref_count(
{
dict_index_t* index;
- ut_ad(mutex_own(&dict_sys->mutex));
-
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
-
- ut_ad(rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
-
index->search_info->ref_count = 0;
}
}
-/** Disable the adaptive hash search system and empty the index.
-@param[in] need_mutex need to acquire dict_sys->mutex */
-void
-btr_search_disable(
- bool need_mutex)
+/** Lazily free detached metadata when removing the last reference. */
+ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index)
+{
+ ut_ad(index->freed());
+ dict_table_t *table= index->table;
+ /* Perform the skipped steps of dict_index_remove_from_cache_low(). */
+ UT_LIST_REMOVE(table->freed_indexes, index);
+ rw_lock_free(&index->lock);
+ dict_mem_index_free(index);
+
+ if (!UT_LIST_GET_LEN(table->freed_indexes) &&
+ !UT_LIST_GET_LEN(table->indexes))
+ {
+ ut_ad(table->id == 0);
+ dict_mem_table_free(table);
+ }
+}
+
+/** Clear the adaptive hash index on all pages in the buffer pool. */
+static void buf_pool_clear_hash_index()
+{
+ ut_ad(btr_search_own_all(RW_LOCK_X));
+ ut_ad(!btr_search_enabled);
+
+ std::set<dict_index_t*> garbage;
+
+ for (ulong p = 0; p < srv_buf_pool_instances; p++)
+ {
+ buf_pool_t *buf_pool= buf_pool_from_array(p);
+ buf_chunk_t *chunks= buf_pool->chunks;
+ buf_chunk_t *chunk= chunks + buf_pool->n_chunks;
+
+ while (--chunk >= chunks)
+ {
+ buf_block_t *block= chunk->blocks;
+ for (ulint i= chunk->size; i--; block++)
+ {
+ dict_index_t *index= block->index;
+ assert_block_ahi_valid(block);
+
+ /* We can clear block->index and block->n_pointers when
+ btr_search_own_all(RW_LOCK_X); see the comments in buf0buf.h */
+
+ if (!index)
+ {
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+ ut_a(!block->n_pointers);
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ continue;
+ }
+
+ ut_d(buf_page_state state= buf_block_get_state(block));
+ /* Another thread may have set the state to
+ BUF_BLOCK_REMOVE_HASH in buf_LRU_block_remove_hashed().
+
+ The state change in buf_page_realloc() is not observable here,
+ because in that case we would have !block->index.
+
+ In the end, the entire adaptive hash index will be removed. */
+ ut_ad(state == BUF_BLOCK_FILE_PAGE || state == BUF_BLOCK_REMOVE_HASH);
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+ block->n_pointers= 0;
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ if (index->freed())
+ garbage.insert(index);
+ block->index= NULL;
+ }
+ }
+ }
+
+ for (std::set<dict_index_t*>::iterator i= garbage.begin();
+ i != garbage.end(); i++)
+ btr_search_lazy_free(*i);
+}
+
+/** Disable the adaptive hash search system and empty the index. */
+void btr_search_disable()
{
dict_table_t* table;
- if (need_mutex) {
- mutex_enter(&dict_sys->mutex);
- }
+ mutex_enter(&dict_sys->mutex);
- ut_ad(mutex_own(&dict_sys->mutex));
btr_search_x_lock_all();
if (!btr_search_enabled) {
- if (need_mutex) {
- mutex_exit(&dict_sys->mutex);
- }
-
+ mutex_exit(&dict_sys->mutex);
btr_search_x_unlock_all();
return;
}
@@ -341,63 +354,59 @@ btr_search_disable(
btr_search_disable_ref_count(table);
}
- if (need_mutex) {
- mutex_exit(&dict_sys->mutex);
- }
+ mutex_exit(&dict_sys->mutex);
/* Set all block->index = NULL. */
buf_pool_clear_hash_index();
/* Clear the adaptive hash index. */
for (ulint i = 0; i < btr_ahi_parts; ++i) {
- hash_table_clear(btr_search_sys->hash_tables[i]);
- mem_heap_empty(btr_search_sys->hash_tables[i]->heap);
+ mem_heap_free(btr_search_sys->hash_tables[i]->heap);
+ hash_table_free(btr_search_sys->hash_tables[i]);
}
+ ut_free(btr_search_sys->hash_tables);
+ btr_search_sys->hash_tables = NULL;
btr_search_x_unlock_all();
}
-/** Enable the adaptive hash search system. */
+/** Enable the adaptive hash search system.
+@param[in] resize Flag to indicate call during buf_pool_resize() */
void
-btr_search_enable()
+btr_search_enable(bool resize)
{
- buf_pool_mutex_enter_all();
- if (srv_buf_pool_old_size != srv_buf_pool_size) {
+ if (!resize) {
+ buf_pool_mutex_enter_all();
+ if (srv_buf_pool_old_size != srv_buf_pool_size) {
+ buf_pool_mutex_exit_all();
+ return;
+ }
buf_pool_mutex_exit_all();
- return;
}
- buf_pool_mutex_exit_all();
+ ulint hash_size = buf_pool_get_curr_size() / sizeof(void *) / 64;
btr_search_x_lock_all();
- btr_search_enabled = true;
- btr_search_x_unlock_all();
-}
-
-/** Returns the value of ref_count. The value is protected by latch.
-@param[in] info search info
-@param[in] index index identifier
-@return ref_count value. */
-ulint
-btr_search_info_get_ref_count(
- btr_search_t* info,
- dict_index_t* index)
-{
- ulint ret = 0;
- if (!btr_search_enabled) {
- return(ret);
+ if (btr_search_sys->hash_tables) {
+ ut_ad(btr_search_enabled);
+ btr_search_x_unlock_all();
+ return;
}
- ut_ad(info);
-
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
-
- btr_search_s_lock(index);
- ret = info->ref_count;
- btr_search_s_unlock(index);
+ btr_search_sys->hash_tables = reinterpret_cast<hash_table_t**>(
+ ut_malloc(sizeof(hash_table_t*) * btr_ahi_parts, mem_key_ahi));
+ for (ulint i = 0; i < btr_ahi_parts; ++i) {
+ btr_search_sys->hash_tables[i] =
+ ib_create((hash_size / btr_ahi_parts),
+ LATCH_ID_HASH_TABLE_MUTEX,
+ 0, MEM_HEAP_FOR_BTR_SEARCH);
+#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+ btr_search_sys->hash_tables[i]->adaptive = TRUE;
+#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ }
- return(ret);
+ btr_search_enabled = true;
+ btr_search_x_unlock_all();
}
/** Updates the search info of an index about hash successes. NOTE that info
@@ -415,8 +424,8 @@ btr_search_info_update_hash(
ulint n_unique;
int cmp;
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
+ ut_ad(!rw_lock_own_flagged(btr_get_search_latch(index),
+ RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
if (dict_index_is_ibuf(index)) {
/* So many deletes are performed on an insert buffer tree
@@ -601,59 +610,60 @@ btr_search_update_hash_ref(
buf_block_t* block,
const btr_cur_t* cursor)
{
- dict_index_t* index;
- ulint fold;
- rec_t* rec;
-
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
- ut_ad(rw_lock_own(btr_get_search_latch(cursor->index), RW_LOCK_X));
+
ut_ad(rw_lock_own_flagged(&block->lock,
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
ut_ad(page_align(btr_cur_get_rec(cursor)) == block->frame);
ut_ad(page_is_leaf(block->frame));
assert_block_ahi_valid(block);
- index = block->index;
-
- if (!index) {
+ dict_index_t* index = block->index;
+ if (!index || !info->n_hash_potential) {
return;
}
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
- ut_a(!dict_index_is_ibuf(index));
+ ut_ad(!dict_index_is_ibuf(index));
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_x_lock(latch);
+ ut_ad(!block->index || block->index == index);
- if ((info->n_hash_potential > 0)
+ if (block->index
&& (block->curr_n_fields == info->n_fields)
&& (block->curr_n_bytes == info->n_bytes)
- && (block->curr_left_side == info->left_side)) {
+ && (block->curr_left_side == info->left_side)
+ && btr_search_enabled) {
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
- rec = btr_cur_get_rec(cursor);
+ const rec_t* rec = btr_cur_get_rec(cursor);
if (!page_rec_is_user_rec(rec)) {
-
- return;
+ goto func_exit;
}
- fold = rec_fold(rec,
- rec_get_offsets(rec, index, offsets_, true,
- ULINT_UNDEFINED, &heap),
- block->curr_n_fields,
- block->curr_n_bytes, index->id);
+ ulint fold = rec_fold(
+ rec,
+ rec_get_offsets(rec, index, offsets_, true,
+ ULINT_UNDEFINED, &heap),
+ block->curr_n_fields,
+ block->curr_n_bytes, index->id);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- ut_ad(rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
ha_insert_for_fold(btr_get_search_table(index), fold,
block, rec);
MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_ADDED);
}
+
+func_exit:
+ rw_lock_x_unlock(latch);
}
/** Updates the search info.
@@ -692,12 +702,7 @@ btr_search_info_update_slow(
#ifdef UNIV_SEARCH_PERF_STAT
btr_search_n_hash_fail++;
#endif /* UNIV_SEARCH_PERF_STAT */
-
- btr_search_x_lock(cursor->index);
-
btr_search_update_hash_ref(info, block, cursor);
-
- btr_search_x_unlock(cursor->index);
}
if (build_index) {
@@ -740,8 +745,8 @@ btr_search_check_guess(
ulint match;
int cmp;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
ibool success = FALSE;
rec_offs_init(offsets_);
@@ -898,7 +903,6 @@ btr_search_guess_on_hash(
ulint has_search_latch,
mtr_t* mtr)
{
- const rec_t* rec;
ulint fold;
index_id_t index_id;
#ifdef notdefined
@@ -944,33 +948,28 @@ btr_search_guess_on_hash(
cursor->fold = fold;
cursor->flag = BTR_CUR_HASH;
+ rw_lock_t* const latch = btr_get_search_latch(index);
+
if (!has_search_latch) {
- btr_search_s_lock(index);
+ rw_lock_s_lock(latch);
if (!btr_search_enabled) {
- btr_search_s_unlock(index);
-
+fail:
+ if (!has_search_latch) {
+ rw_lock_s_unlock(latch);
+ }
btr_search_failure(info, cursor);
-
return(FALSE);
}
}
- ut_ad(rw_lock_get_writer(btr_get_search_latch(index)) != RW_LOCK_X);
- ut_ad(rw_lock_get_reader_count(btr_get_search_latch(index)) > 0);
-
- rec = (rec_t*) ha_search_and_get_data(
- btr_get_search_table(index), fold);
-
- if (rec == NULL) {
-
- if (!has_search_latch) {
- btr_search_s_unlock(index);
- }
+ ut_ad(rw_lock_own(latch, RW_LOCK_S));
- btr_search_failure(info, cursor);
+ const rec_t* rec = static_cast<const rec_t*>(
+ ha_search_and_get_data(btr_get_search_table(index), fold));
- return(FALSE);
+ if (!rec) {
+ goto fail;
}
buf_block_t* block = buf_block_from_ahi(rec);
@@ -980,32 +979,33 @@ btr_search_guess_on_hash(
if (!buf_page_get_known_nowait(
latch_mode, block, BUF_MAKE_YOUNG,
__FILE__, __LINE__, mtr)) {
-
- if (!has_search_latch) {
- btr_search_s_unlock(index);
- }
-
- btr_search_failure(info, cursor);
-
- return(FALSE);
+ goto fail;
}
- btr_search_s_unlock(index);
+ const bool fail = index != block->index
+ && index_id == block->index->id;
+ ut_a(!fail || block->index->freed());
+ rw_lock_s_unlock(latch);
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
+ if (UNIV_UNLIKELY(fail)) {
+ goto fail_and_release_page;
+ }
+ } else if (UNIV_UNLIKELY(index != block->index
+ && index_id == block->index->id)) {
+ ut_a(block->index->freed());
+ goto fail_and_release_page;
}
if (buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
ut_ad(buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH);
-
+fail_and_release_page:
if (!has_search_latch) {
-
btr_leaf_page_release(block, latch_mode, mtr);
}
btr_search_failure(info, cursor);
-
return(FALSE);
}
@@ -1024,14 +1024,7 @@ btr_search_guess_on_hash(
|| !btr_search_check_guess(cursor,
has_search_latch,
tuple, mode, mtr)) {
-
- if (!has_search_latch) {
- btr_leaf_page_release(block, latch_mode, mtr);
- }
-
- btr_search_failure(info, cursor);
-
- return(FALSE);
+ goto fail_and_release_page;
}
if (info->n_hash_potential < BTR_SEARCH_BUILD_LIMIT + 5) {
@@ -1115,30 +1108,26 @@ btr_search_drop_page_hash_index(buf_block_t* block)
ulint* folds;
ulint i;
mem_heap_t* heap;
- const dict_index_t* index;
- ulint* offsets;
+ rec_offs* offsets;
rw_lock_t* latch;
- btr_search_t* info;
retry:
- /* Do a dirty check on block->index, return if the block is
- not in the adaptive hash index. */
- index = block->index;
/* This debug check uses a dirty read that could theoretically cause
false positives while buf_pool_clear_hash_index() is executing. */
assert_block_ahi_valid(block);
- if (index == NULL) {
+ if (!block->index) {
return;
}
ut_ad(block->page.buf_fix_count == 0
|| buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH
|| rw_lock_own_flagged(&block->lock,
- RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
+ RW_LOCK_FLAG_X | RW_LOCK_FLAG_S
+ | RW_LOCK_FLAG_SX));
ut_ad(page_is_leaf(block->frame));
- /* We must not dereference index here, because it could be freed
+ /* We must not dereference block->index here, because it could be freed
if (index->table->n_ref_count == 0 && !mutex_own(&dict_sys->mutex)).
Determine the ahi_slot based on the block contents. */
@@ -1156,18 +1145,12 @@ retry:
rw_lock_s_lock(latch);
assert_block_ahi_valid(block);
- if (block->index == NULL) {
+ if (!block->index || !btr_search_enabled) {
rw_lock_s_unlock(latch);
return;
}
- /* The index associated with a block must remain the
- same, because we are holding block->lock or the block is
- not accessible by other threads (BUF_BLOCK_REMOVE_HASH),
- or the index is not accessible to other threads
- (buf_fix_count == 0 when DROP TABLE or similar is executing
- buf_LRU_drop_page_hash_for_tablespace()). */
- ut_a(index == block->index);
+ dict_index_t* index = block->index;
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_ad(!index->disable_ahi);
#endif
@@ -1176,27 +1159,7 @@ retry:
ut_ad(index->space == FIL_NULL
|| block->page.id.space() == index->space);
ut_a(index_id == index->id);
- ut_a(!dict_index_is_ibuf(index));
-#ifdef UNIV_DEBUG
- switch (dict_index_get_online_status(index)) {
- case ONLINE_INDEX_CREATION:
- /* The index is being created (bulk loaded). */
- case ONLINE_INDEX_COMPLETE:
- /* The index has been published. */
- case ONLINE_INDEX_ABORTED:
- /* Either the index creation was aborted due to an
- error observed by InnoDB (in which case there should
- not be any adaptive hash index entries), or it was
- completed and then flagged aborted in
- rollback_inplace_alter_table(). */
- break;
- case ONLINE_INDEX_ABORTED_DROPPED:
- /* The index should have been dropped from the tablespace
- already, and the adaptive hash index entries should have
- been dropped as well. */
- ut_error;
- }
-#endif /* UNIV_DEBUG */
+ ut_ad(!dict_index_is_ibuf(index));
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
@@ -1281,9 +1244,14 @@ next_rec:
folds[i], page);
}
- info = btr_search_get_info(block->index);
- ut_a(info->ref_count > 0);
- info->ref_count--;
+ switch (index->search_info->ref_count--) {
+ case 0:
+ ut_error;
+ case 1:
+ if (index->freed()) {
+ btr_search_lazy_free(index);
+ }
+ }
block->index = NULL;
@@ -1370,8 +1338,8 @@ btr_search_build_page_hash_index(
rec_t** recs;
ulint i;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
#ifdef MYSQL_INDEX_DISABLE_AHI
if (index->disable_ahi) return;
@@ -1383,27 +1351,32 @@ btr_search_build_page_hash_index(
rec_offs_init(offsets_);
ut_ad(index);
ut_ad(block->page.id.space() == index->space);
- ut_a(!dict_index_is_ibuf(index));
+ ut_ad(!dict_index_is_ibuf(index));
ut_ad(page_is_leaf(block->frame));
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
ut_ad(rw_lock_own_flagged(&block->lock,
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
+ ut_ad(block->page.id.page_no() >= 3);
+
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_s_lock(latch);
- btr_search_s_lock(index);
+ if (!btr_search_enabled) {
+ rw_lock_s_unlock(latch);
+ return;
+ }
table = btr_get_search_table(index);
page = buf_block_get_frame(block);
- if (block->index && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_left_side != left_side))) {
-
- btr_search_s_unlock(index);
+ const bool must_drop = block->index
+ && ((block->curr_n_fields != n_fields)
+ || (block->curr_n_bytes != n_bytes)
+ || (block->curr_left_side != left_side));
+ rw_lock_s_unlock(latch);
+ if (must_drop) {
btr_search_drop_page_hash_index(block);
- } else {
- btr_search_s_unlock(index);
}
/* Check that the values for hash index build are sensible */
@@ -1495,12 +1468,13 @@ btr_search_build_page_hash_index(
btr_search_check_free_space_in_heap(index);
- btr_search_x_lock(index);
+ rw_lock_x_lock(latch);
if (!btr_search_enabled) {
goto exit_func;
}
+ table = btr_get_search_table(index);
if (block->index && ((block->curr_n_fields != n_fields)
|| (block->curr_n_bytes != n_bytes)
|| (block->curr_left_side != left_side))) {
@@ -1533,7 +1507,7 @@ btr_search_build_page_hash_index(
MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_ADDED, n_cached);
exit_func:
assert_block_ahi_valid(block);
- btr_search_x_unlock(index);
+ rw_lock_x_unlock(latch);
ut_free(folds);
ut_free(recs);
@@ -1566,21 +1540,19 @@ btr_search_move_or_delete_hash_entries(
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_X));
ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_X));
- btr_search_s_lock(index);
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_s_lock(latch);
ut_a(!new_block->index || new_block->index == index);
ut_a(!block->index || block->index == index);
- ut_a(!(new_block->index || block->index)
- || !dict_index_is_ibuf(index));
+ ut_ad(!(new_block->index || block->index)
+ || !dict_index_is_ibuf(index));
assert_block_ahi_valid(block);
assert_block_ahi_valid(new_block);
if (new_block->index) {
-
- btr_search_s_unlock(index);
-
+ rw_lock_s_unlock(latch);
btr_search_drop_page_hash_index(block);
-
return;
}
@@ -1593,7 +1565,7 @@ btr_search_move_or_delete_hash_entries(
new_block->n_bytes = block->curr_n_bytes;
new_block->left_side = left_side;
- btr_search_s_unlock(index);
+ rw_lock_s_unlock(latch);
ut_a(n_fields > 0 || n_bytes > 0);
@@ -1605,7 +1577,7 @@ btr_search_move_or_delete_hash_entries(
return;
}
- btr_search_s_unlock(index);
+ rw_lock_s_unlock(latch);
}
/** Updates the page hash index when a single record is deleted from a page.
@@ -1619,7 +1591,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
const rec_t* rec;
ulint fold;
dict_index_t* index;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@@ -1647,9 +1619,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
- ut_a(!dict_index_is_ibuf(index));
-
- table = btr_get_search_table(index);
+ ut_ad(!dict_index_is_ibuf(index));
rec = btr_cur_get_rec(cursor);
@@ -1660,9 +1630,16 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
mem_heap_free(heap);
}
- btr_search_x_lock(index);
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_x_lock(latch);
assert_block_ahi_valid(block);
+ if (!btr_search_enabled) {
+ rw_lock_x_unlock(latch);
+ return;
+ }
+
+ table = btr_get_search_table(index);
if (block->index) {
ut_a(block->index == index);
@@ -1676,7 +1653,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
assert_block_ahi_valid(block);
}
- btr_search_x_unlock(index);
+ rw_lock_x_unlock(latch);
}
/** Updates the page hash index when a single record is inserted on a page.
@@ -1712,11 +1689,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor)
}
ut_a(cursor->index == index);
- ut_a(!dict_index_is_ibuf(index));
+ ut_ad(!dict_index_is_ibuf(index));
- btr_search_x_lock(index);
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_x_lock(latch);
- if (!block->index) {
+ if (!block->index || !btr_search_enabled) {
goto func_exit;
}
@@ -1738,10 +1716,9 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor)
func_exit:
assert_block_ahi_valid(block);
- btr_search_x_unlock(index);
+ rw_lock_x_unlock(latch);
} else {
- btr_search_x_unlock(index);
-
+ rw_lock_x_unlock(latch);
btr_search_update_hash_on_insert(cursor);
}
}
@@ -1754,7 +1731,6 @@ func_exit:
void
btr_search_update_hash_on_insert(btr_cur_t* cursor)
{
- hash_table_t* table;
buf_block_t* block;
dict_index_t* index;
const rec_t* rec;
@@ -1765,11 +1741,9 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
ulint next_fold = 0; /* remove warning (??? bug ???) */
ulint n_fields;
ulint n_bytes;
- ibool left_side;
- ibool locked = FALSE;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(page_is_leaf(btr_cur_get_page(cursor)));
@@ -1795,19 +1769,17 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
ut_ad(block->page.id.space() == index->space);
btr_search_check_free_space_in_heap(index);
- table = btr_get_search_table(index);
-
rec = btr_cur_get_rec(cursor);
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_a(!index->disable_ahi);
#endif
ut_a(index == cursor->index);
- ut_a(!dict_index_is_ibuf(index));
+ ut_ad(!dict_index_is_ibuf(index));
n_fields = block->curr_n_fields;
n_bytes = block->curr_n_bytes;
- left_side = block->curr_left_side;
+ const bool left_side = block->curr_left_side;
ins_rec = page_rec_get_next_const(rec);
next_rec = page_rec_get_next_const(ins_rec);
@@ -1824,22 +1796,26 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
n_bytes, index->id);
}
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ /* We must not look up "table" before acquiring the latch. */
+ hash_table_t* table = NULL;
+ bool locked = false;
+
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(
rec, index, offsets, true,
btr_search_get_n_fields(n_fields, n_bytes), &heap);
fold = rec_fold(rec, offsets, n_fields, n_bytes, index->id);
} else {
- if (left_side) {
+ locked = left_side;
+ if (locked) {
+ rw_lock_x_lock(latch);
- btr_search_x_lock(index);
-
- locked = TRUE;
-
- if (!btr_search_enabled) {
+ if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+ table = btr_get_search_table(index);
ha_insert_for_fold(table, ins_fold, block, ins_rec);
}
@@ -1849,14 +1825,14 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (fold != ins_fold) {
if (!locked) {
+ locked = true;
+ rw_lock_x_lock(latch);
- btr_search_x_lock(index);
-
- locked = TRUE;
-
- if (!btr_search_enabled) {
+ if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
if (!left_side) {
@@ -1870,15 +1846,15 @@ check_next_rec:
if (page_rec_is_supremum(next_rec)) {
if (!left_side) {
-
if (!locked) {
- btr_search_x_lock(index);
+ locked = true;
+ rw_lock_x_lock(latch);
- locked = TRUE;
-
- if (!btr_search_enabled) {
+ if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
ha_insert_for_fold(table, ins_fold, block, ins_rec);
@@ -1888,16 +1864,15 @@ check_next_rec:
}
if (ins_fold != next_fold) {
-
if (!locked) {
+ locked = true;
+ rw_lock_x_lock(latch);
- btr_search_x_lock(index);
-
- locked = TRUE;
-
- if (!btr_search_enabled) {
+ if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
if (!left_side) {
@@ -1912,7 +1887,7 @@ function_exit:
mem_heap_free(heap);
}
if (locked) {
- btr_search_x_unlock(index);
+ rw_lock_x_unlock(latch);
}
}
@@ -1930,10 +1905,12 @@ btr_search_hash_table_validate(ulint hash_table_id)
ulint i;
ulint cell_count;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
+ btr_search_x_lock_all();
if (!btr_search_enabled) {
+ btr_search_x_unlock_all();
return(TRUE);
}
@@ -1943,7 +1920,6 @@ btr_search_hash_table_validate(ulint hash_table_id)
rec_offs_init(offsets_);
- btr_search_x_lock_all();
buf_pool_mutex_enter_all();
cell_count = hash_get_n_cells(
@@ -1960,6 +1936,12 @@ btr_search_hash_table_validate(ulint hash_table_id)
os_thread_yield();
btr_search_x_lock_all();
+
+ if (!btr_search_enabled) {
+ ok = true;
+ goto func_exit;
+ }
+
buf_pool_mutex_enter_all();
ulint curr_cell_count = hash_get_n_cells(
@@ -2019,7 +2001,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
== BUF_BLOCK_REMOVE_HASH);
}
- ut_a(!dict_index_is_ibuf(block->index));
+ ut_ad(!dict_index_is_ibuf(block->index));
ut_ad(block->page.id.space() == block->index->space);
page_index_id = btr_page_get_index_id(block->frame);
@@ -2077,6 +2059,12 @@ btr_search_hash_table_validate(ulint hash_table_id)
os_thread_yield();
btr_search_x_lock_all();
+
+ if (!btr_search_enabled) {
+ ok = true;
+ goto func_exit;
+ }
+
buf_pool_mutex_enter_all();
ulint curr_cell_count = hash_get_n_cells(
@@ -2101,6 +2089,7 @@ btr_search_hash_table_validate(ulint hash_table_id)
}
buf_pool_mutex_exit_all();
+func_exit:
btr_search_x_unlock_all();
if (UNIV_LIKELY_NULL(heap)) {
diff --git a/storage/innobase/buf/buf0block_hint.cc b/storage/innobase/buf/buf0block_hint.cc
new file mode 100644
index 00000000000..9f974e8304d
--- /dev/null
+++ b/storage/innobase/buf/buf0block_hint.cc
@@ -0,0 +1,78 @@
+/*****************************************************************************
+
+Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, MariaDB Corporation.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License, version 2.0, as published by the
+Free Software Foundation.
+
+This program is also distributed with certain software (including but not
+limited to OpenSSL) that is licensed under separate terms, as designated in a
+particular file or component or in included license documentation. The authors
+of MySQL hereby grant you an additional permission to link the program and
+your derivative works with the separately licensed software that they have
+included with MySQL.
+
+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, version 2.0,
+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 "buf0block_hint.h"
+namespace buf {
+
+void Block_hint::buffer_fix_block_if_still_valid()
+{
+ /* We need to check if m_block points to one of chunks. For this to be
+ meaningful we need to prevent freeing memory while we check, and until we
+ buffer-fix the block. For this purpose it is enough to latch any of the many
+ latches taken by buf_resize().
+ However, for buffer-fixing to be meaningful, the block has to contain a page
+ (as opposed to being already empty, which might mean that buf_pool_resize()
+ can proceed and free it once we free the s-latch), so we confirm that the
+ block contains a page. However, it is not sufficient to check that this is
+ just any page, because just after we check it could get freed, unless we
+ have a latch which prevents this. This is tricky because page_hash latches
+ are sharded by page_id and we don't know the page_id until we look into the
+ block. To solve this chicken-and-egg problem somewhat, we latch the shard
+ for the m_page_id and compare block->page.id to it - so if is equal then we
+ can be reasonably sure that we have the correct latch.
+ There is still a theoretical problem here, where other threads might try
+ to modify the m_block->page.id while we are comparing it, but the chance of
+ accidentally causing the old space_id == m_page_id.m_space and the new
+ page_no == m_page_id.m_page_no is minimal as compilers emit a single 8-byte
+ comparison instruction to compare both at the same time atomically, and f()
+ will probably double-check the block->page.id again, anyway.
+ Finally, assuming that we have correct hash bucket latched, we should check if
+ the state of the block is BUF_BLOCK_FILE_PAGE before buffer-fixing the block,
+ as otherwise we risk buffer-fixing and operating on a block, which is already
+ meant to be freed. In particular, buf_LRU_free_page() first calls
+ buf_LRU_block_remove_hashed() under hash bucket latch protection to change the
+ state to BUF_BLOCK_REMOVE_HASH and then releases the latch. Later it calls
+ buf_LRU_block_free_hashed_page() without any latch to change the state to
+ BUF_BLOCK_MEMORY and reset the page's id, which means buf_resize() can free it
+ regardless of our buffer-fixing. */
+ if (m_block)
+ {
+ const buf_pool_t *const buf_pool= buf_pool_get(m_page_id);
+ rw_lock_t *latch= buf_page_hash_lock_get(buf_pool, m_page_id);
+ rw_lock_s_lock(latch);
+ /* If not own buf_pool_mutex, page_hash can be changed. */
+ latch= buf_page_hash_lock_s_confirm(latch, buf_pool, m_page_id);
+ if (buf_pool->is_block_field(m_block) &&
+ m_page_id == m_block->page.id &&
+ buf_block_get_state(m_block) == BUF_BLOCK_FILE_PAGE)
+ buf_block_buf_fix_inc(m_block, __FILE__, __LINE__);
+ else
+ clear();
+ rw_lock_s_unlock(latch);
+ }
+}
+} // namespace buf
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index 0863facad52..80d82b9e78c 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -85,7 +85,6 @@ enum buf_buddy_state_t {
are in use */
};
-#ifdef UNIV_DEBUG_VALGRIND
/**********************************************************************//**
Invalidate memory area that we won't access while page is free */
UNIV_INLINE
@@ -95,15 +94,11 @@ buf_buddy_mem_invalid(
buf_buddy_free_t* buf, /*!< in: block to check */
ulint i) /*!< in: index of zip_free[] */
{
- const size_t size = BUF_BUDDY_LOW << i;
- ut_ad(i <= BUF_BUDDY_SIZES);
+ ut_ad(i <= BUF_BUDDY_SIZES);
- UNIV_MEM_ASSERT_W(buf, size);
- UNIV_MEM_INVALID(buf, size);
+ MEM_CHECK_ADDRESSABLE(buf, BUF_BUDDY_LOW << i);
+ MEM_UNDEFINED(buf, BUF_BUDDY_LOW << i);
}
-#else /* UNIV_DEBUG_VALGRIND */
-# define buf_buddy_mem_invalid(buf, i) ut_ad((i) <= BUF_BUDDY_SIZES)
-#endif /* UNIV_DEBUG_VALGRIND */
/**********************************************************************//**
Check if a buddy is stamped free.
@@ -351,7 +346,7 @@ buf_buddy_alloc_zip(
if (buf) {
buf_buddy_free_t* buddy =
reinterpret_cast<buf_buddy_free_t*>(
- buf->stamp.bytes
+ reinterpret_cast<byte*>(buf)
+ (BUF_BUDDY_LOW << i));
ut_ad(!buf_pool_contains_zip(buf_pool, buddy));
@@ -361,11 +356,10 @@ buf_buddy_alloc_zip(
if (buf) {
/* Trash the page other than the BUF_BUDDY_STAMP_NONFREE. */
- UNIV_MEM_TRASH((void*) buf, ~i, BUF_BUDDY_STAMP_OFFSET);
- UNIV_MEM_TRASH(BUF_BUDDY_STAMP_OFFSET + 4
- + buf->stamp.bytes, ~i,
- (BUF_BUDDY_LOW << i)
- - (BUF_BUDDY_STAMP_OFFSET + 4));
+ MEM_UNDEFINED(buf, BUF_BUDDY_STAMP_OFFSET);
+ MEM_UNDEFINED(BUF_BUDDY_STAMP_OFFSET + 4 + buf->stamp.bytes,
+ (BUF_BUDDY_LOW << i)
+ - (BUF_BUDDY_STAMP_OFFSET + 4));
ut_ad(mach_read_from_4(buf->stamp.bytes
+ BUF_BUDDY_STAMP_OFFSET)
== BUF_BUDDY_STAMP_NONFREE);
@@ -402,8 +396,10 @@ buf_buddy_block_free(
ut_d(bpage->in_zip_hash = FALSE);
HASH_DELETE(buf_page_t, hash, buf_pool->zip_hash, fold, bpage);
- ut_d(memset(buf, 0, UNIV_PAGE_SIZE));
- UNIV_MEM_INVALID(buf, UNIV_PAGE_SIZE);
+ ut_d(memset(buf, 0, srv_page_size));
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(buf, srv_page_size);
+#endif /* HAVE_valgrind_or_MSAN */
block = (buf_block_t*) bpage;
buf_page_mutex_enter(block);
@@ -559,17 +555,16 @@ buf_buddy_relocate(
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
- UNIV_MEM_ASSERT_W(dst, size);
+ MEM_CHECK_ADDRESSABLE(dst, size);
space = mach_read_from_4((const byte*) src
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
offset = mach_read_from_4((const byte*) src
+ FIL_PAGE_OFFSET);
- /* Suppress Valgrind warnings about conditional jump
- on uninitialized value. */
- UNIV_MEM_VALID(&space, sizeof space);
- UNIV_MEM_VALID(&offset, sizeof offset);
+ /* Suppress Valgrind or MSAN warnings. */
+ MEM_MAKE_DEFINED(&space, sizeof space);
+ MEM_MAKE_DEFINED(&offset, sizeof offset);
ut_ad(space != BUF_BUDDY_STAMP_FREE);
@@ -631,7 +626,7 @@ buf_buddy_relocate(
/* The block must have been allocated, but it may
contain uninitialized data. */
- UNIV_MEM_ASSERT_W(src, size);
+ MEM_CHECK_ADDRESSABLE(src, size);
BPageMutex* block_mutex = buf_page_get_mutex(bpage);
@@ -686,7 +681,7 @@ buf_buddy_free_low(
buf_pool->buddy_stat[i].used--;
recombine:
- UNIV_MEM_ALLOC(buf, BUF_BUDDY_LOW << i);
+ MEM_UNDEFINED(buf, BUF_BUDDY_LOW << i);
if (i == BUF_BUDDY_SIZES) {
buf_buddy_block_free(buf_pool, buf);
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index b5ca51c81dc..e2b68011077 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -83,6 +83,8 @@ Created 11/5/1995 Heikki Tuuri
#include "lzo/lzo1x.h"
#endif
+using st_::span;
+
#ifdef HAVE_LIBNUMA
#include <numa.h>
#include <numaif.h>
@@ -103,6 +105,7 @@ struct set_numa_interleave_t
" policy to MPOL_INTERLEAVE: "
<< strerror(errno);
}
+ numa_bitmask_free(numa_mems_allowed);
}
}
@@ -130,29 +133,6 @@ struct set_numa_interleave_t
#include "snappy-c.h"
#endif
-inline void* aligned_malloc(size_t size, size_t align) {
- void *result;
-#ifdef _MSC_VER
- result = _aligned_malloc(size, align);
-#elif defined (HAVE_POSIX_MEMALIGN)
- if(posix_memalign(&result, align, size)) {
- result = 0;
- }
-#else
- /* Use unaligned malloc as fallback */
- result = malloc(size);
-#endif
- return result;
-}
-
-inline void aligned_free(void *ptr) {
-#ifdef _MSC_VER
- _aligned_free(ptr);
-#else
- free(ptr);
-#endif
-}
-
/*
IMPLEMENTATION OF THE BUFFER POOL
=================================
@@ -359,14 +339,6 @@ buf_pool_t* buf_pool_ptr;
/** true when resizing buffer pool is in the critical path. */
volatile bool buf_pool_resizing;
-/** true when withdrawing buffer pool pages might cause page relocation */
-volatile bool buf_pool_withdrawing;
-
-/** the clock is incremented every time a pointer to a page may become obsolete;
-if the withdrwa clock has not changed, the pointer is still valid in buffer
-pool. if changed, the pointer might not be in buffer pool any more. */
-volatile ulint buf_withdraw_clock;
-
/** Map of buffer pool chunks by its first frame address
This is newly made by initialization of buffer pool and buf_resize_thread.
Currently, no need mutex protection for update. */
@@ -483,7 +455,7 @@ buf_pool_register_chunk(
@return true if temporary tablespace decrypted, false if not */
static bool buf_tmp_page_decrypt(byte* tmp_frame, byte* src_frame)
{
- if (buf_page_is_zeroes(src_frame, srv_page_size)) {
+ if (buf_is_zeroes(span<const byte>(src_frame, srv_page_size))) {
return true;
}
@@ -567,13 +539,13 @@ decompress:
decompress_with_slot:
ut_d(fil_page_type_validate(dst_frame));
- bpage->write_size = fil_page_decompress(slot->crypt_buf,
- dst_frame);
+ ulint write_size = fil_page_decompress(slot->crypt_buf,
+ dst_frame);
slot->release();
- ut_ad(!bpage->write_size || fil_page_type_validate(dst_frame));
+ ut_ad(!write_size || fil_page_type_validate(dst_frame));
ut_ad(space->n_pending_ios > 0);
- return bpage->write_size != 0;
+ return write_size != 0;
}
if (space->crypt_data
@@ -972,20 +944,14 @@ static uint32_t buf_page_check_crc32(const byte* page, uint32_t checksum)
# define buf_page_check_crc32(page, checksum) buf_calc_page_crc32(page)
#endif /* INNODB_BUG_ENDIAN_CRC32 */
-/** 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 */
-bool buf_page_is_zeroes(const void* read_buf, size_t page_size)
+
+/** Check if a buffer is all zeroes.
+@param[in] buf data to check
+@return whether the buffer is all zeroes */
+bool buf_is_zeroes(span<const byte> buf)
{
- const ulint* b = reinterpret_cast<const ulint*>(read_buf);
- const ulint* const e = b + page_size / sizeof *b;
- do {
- if (*b++) {
- return false;
- }
- } while (b != e);
- return true;
+ ut_ad(buf.size() <= sizeof field_ref_zero);
+ return memcmp(buf.data(), field_ref_zero, buf.size()) == 0;
}
/** Check if a page is corrupt.
@@ -1103,7 +1069,7 @@ buf_page_is_corrupted(
/* A page filled with NUL bytes is considered not corrupted.
The FIL_PAGE_FILE_FLUSH_LSN field may be written nonzero for
- the first page of each file of the system tablespace.
+ the first page of the system tablespace.
Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) {
/* Checksum fields can have valid value as zero.
@@ -1513,8 +1479,6 @@ buf_block_init(
buf_block_t* block, /*!< in: pointer to control block */
byte* frame) /*!< in: pointer to buffer frame */
{
- UNIV_MEM_DESC(frame, UNIV_PAGE_SIZE);
-
/* This function should only be executed at database startup or by
buf_pool_resize(). Either way, adaptive hash index must not exist. */
assert_block_ahi_empty_on_init(block);
@@ -1528,7 +1492,6 @@ buf_block_init(
block->page.io_fix = BUF_IO_NONE;
block->page.flush_observer = NULL;
block->page.real_size = 0;
- block->page.write_size = 0;
block->modify_clock = 0;
block->page.slot = NULL;
@@ -1537,8 +1500,6 @@ buf_block_init(
#ifdef BTR_CUR_HASH_ADAPT
block->index = NULL;
#endif /* BTR_CUR_HASH_ADAPT */
- block->skip_flush_check = false;
-
ut_d(block->page.in_page_hash = FALSE);
ut_d(block->page.in_zip_hash = FALSE);
ut_d(block->page.in_flush_list = FALSE);
@@ -1623,6 +1584,7 @@ buf_chunk_init(
" buffer pool page frames to MPOL_INTERLEAVE"
" (error: " << strerror(errno) << ").";
}
+ numa_bitmask_free(numa_mems_allowed);
}
#endif /* HAVE_LIBNUMA */
@@ -1661,7 +1623,7 @@ buf_chunk_init(
for (i = chunk->size; i--; ) {
buf_block_init(buf_pool, block, frame);
- UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
+ MEM_UNDEFINED(block->frame, srv_page_size);
/* Add the block to the free list */
UT_LIST_ADD_LAST(buf_pool->free, &block->page);
@@ -2098,8 +2060,6 @@ buf_pool_init(
NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE;
buf_pool_resizing = false;
- buf_pool_withdrawing = false;
- buf_withdraw_clock = 0;
buf_pool_ptr = (buf_pool_t*) ut_zalloc_nokey(
n_instances * sizeof *buf_pool_ptr);
@@ -2159,7 +2119,6 @@ buf_page_realloc(
{
buf_block_t* new_block;
- ut_ad(buf_pool_withdrawing);
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -2206,8 +2165,6 @@ buf_page_realloc(
if (block->page.zip.data != NULL) {
ut_ad(block->in_unzip_LRU_list);
ut_d(new_block->in_unzip_LRU_list = TRUE);
- UNIV_MEM_DESC(&new_block->page.zip.data,
- page_zip_get_size(&new_block->page.zip));
buf_block_t* prev_block = UT_LIST_GET_PREV(unzip_LRU, block);
UT_LIST_REMOVE(buf_pool->unzip_LRU, block);
@@ -2233,15 +2190,15 @@ buf_page_realloc(
ut_d(block->page.in_page_hash = FALSE);
ulint fold = block->page.id.fold();
ut_ad(fold == new_block->page.id.fold());
- HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, (&block->page));
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, (&new_block->page));
+ HASH_REPLACE(buf_page_t, hash, buf_pool->page_hash, fold,
+ &block->page, &new_block->page);
ut_ad(new_block->page.in_page_hash);
buf_block_modify_clock_inc(block);
memset(block->frame + FIL_PAGE_OFFSET, 0xff, 4);
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
- UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
+ MEM_UNDEFINED(block->frame, srv_page_size);
buf_block_set_state(block, BUF_BLOCK_REMOVE_HASH);
block->page.id
= page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
@@ -2583,9 +2540,6 @@ buf_pool_withdraw_blocks(
ib::info() << "buffer pool " << i << " : withdrawn target "
<< UT_LIST_GET_LEN(buf_pool->withdraw) << " blocks.";
- /* retry is not needed */
- ++buf_withdraw_clock;
-
return(false);
}
@@ -2669,23 +2623,6 @@ buf_pool_resize_hash(
buf_pool->zip_hash = new_hash_table;
}
-#ifndef DBUG_OFF
-/** This is a debug routine to inject an memory allocation failure error. */
-static
-void
-buf_pool_resize_chunk_make_null(buf_chunk_t** new_chunks)
-{
- static int count = 0;
-
- if (count == 1) {
- ut_free(*new_chunks);
- *new_chunks = NULL;
- }
-
- count++;
-}
-#endif // DBUG_OFF
-
/** Resize the buffer pool based on srv_buf_pool_size from
srv_buf_pool_old_size. */
static
@@ -2699,7 +2636,6 @@ buf_pool_resize()
NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE;
ut_ad(!buf_pool_resizing);
- ut_ad(!buf_pool_withdrawing);
ut_ad(srv_buf_pool_chunk_unit > 0);
new_instance_size = srv_buf_pool_size / srv_buf_pool_instances;
@@ -2741,7 +2677,7 @@ buf_pool_resize()
btr_search_s_unlock_all();
}
- btr_search_disable(true);
+ btr_search_disable();
if (btr_search_disabled) {
ib::info() << "disabled adaptive hash index.";
@@ -2766,7 +2702,6 @@ buf_pool_resize()
ut_ad(buf_pool->withdraw_target == 0);
buf_pool->withdraw_target = withdraw_target;
- buf_pool_withdrawing = true;
}
}
@@ -2791,7 +2726,6 @@ withdraw_retry:
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
/* abort to resize for shutdown. */
- buf_pool_withdrawing = false;
return;
}
@@ -2853,7 +2787,6 @@ withdraw_retry:
goto withdraw_retry;
}
- buf_pool_withdrawing = false;
buf_resize_status("Latching whole of buffer pool.");
@@ -2952,7 +2885,8 @@ withdraw_retry:
ut_zalloc_nokey_nofatal(new_chunks_size));
DBUG_EXECUTE_IF("buf_pool_resize_chunk_null",
- buf_pool_resize_chunk_make_null(&new_chunks););
+ ut_free(new_chunks);
+ new_chunks = NULL;);
if (new_chunks == NULL) {
ib::error() << "buffer pool " << i
@@ -3114,10 +3048,6 @@ calc_buf_pool_size:
srv_lock_table_size = 5 * (srv_buf_pool_size / UNIV_PAGE_SIZE);
lock_sys_resize(srv_lock_table_size);
- /* normalize btr_search_sys */
- btr_search_sys_resize(
- buf_pool_get_curr_size() / sizeof(void*) / 64);
-
/* normalize dict_sys */
dict_resize();
@@ -3142,7 +3072,7 @@ calc_buf_pool_size:
#ifdef BTR_CUR_HASH_ADAPT
/* enable AHI if needed */
if (btr_search_disabled) {
- btr_search_enable();
+ btr_search_enable(true);
ib::info() << "Re-enabled adaptive hash index.";
}
#endif /* BTR_CUR_HASH_ADAPT */
@@ -3207,66 +3137,6 @@ DECLARE_THREAD(buf_resize_thread)(void*)
OS_THREAD_DUMMY_RETURN;
}
-#ifdef BTR_CUR_HASH_ADAPT
-/** Clear the adaptive hash index on all pages in the buffer pool. */
-void
-buf_pool_clear_hash_index()
-{
- ulint p;
-
- ut_ad(btr_search_own_all(RW_LOCK_X));
- ut_ad(!buf_pool_resizing);
- ut_ad(!btr_search_enabled);
-
- for (p = 0; p < srv_buf_pool_instances; p++) {
- buf_pool_t* buf_pool = buf_pool_from_array(p);
- buf_chunk_t* chunks = buf_pool->chunks;
- buf_chunk_t* chunk = chunks + buf_pool->n_chunks;
-
- while (--chunk >= chunks) {
- buf_block_t* block = chunk->blocks;
- ulint i = chunk->size;
-
- for (; i--; block++) {
- dict_index_t* index = block->index;
- assert_block_ahi_valid(block);
-
- /* We can set block->index = NULL
- and block->n_pointers = 0
- when btr_search_own_all(RW_LOCK_X);
- see the comments in buf0buf.h */
-
- if (!index) {
-# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- ut_a(!block->n_pointers);
-# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- continue;
- }
-
- ut_d(buf_page_state state
- = buf_block_get_state(block));
- /* Another thread may have set the
- state to BUF_BLOCK_REMOVE_HASH in
- buf_LRU_block_remove_hashed().
-
- The state change in buf_page_realloc()
- is not observable here, because in
- that case we would have !block->index.
-
- In the end, the entire adaptive hash
- index will be removed. */
- ut_ad(state == BUF_BLOCK_FILE_PAGE
- || state == BUF_BLOCK_REMOVE_HASH);
-# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- block->n_pointers = 0;
-# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
- block->index = NULL;
- }
- }
- }
-}
-#endif /* BTR_CUR_HASH_ADAPT */
-
/********************************************************************//**
Relocate a buffer control block. Relocates the block on the LRU list
and in buf_pool->page_hash. Does not relocate bpage->list.
@@ -3350,8 +3220,8 @@ buf_relocate(
/* relocate buf_pool->page_hash */
ulint fold = bpage->id.fold();
ut_ad(fold == dpage->id.fold());
- HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage);
- HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, dpage);
+ HASH_REPLACE(buf_page_t, hash, buf_pool->page_hash, fold, bpage,
+ dpage);
}
/** Hazard Pointer implementation. */
@@ -3831,9 +3701,9 @@ lookup:
ut_ad(!hash_lock);
dberr_t err = buf_read_page(page_id, page_size);
- if (err != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << "Reading compressed page " << page_id
- << " failed with error: " << ut_strerr(err);
+ << " failed with error: " << err;
goto err_exit;
}
@@ -3932,7 +3802,6 @@ buf_block_init_low(
/*===============*/
buf_block_t* block) /*!< in: block to init */
{
- block->skip_flush_check = false;
#ifdef BTR_CUR_HASH_ADAPT
/* No adaptive hash index entries may point to a previously
unused (and now freshly allocated) block. */
@@ -3991,7 +3860,8 @@ buf_zip_decompress(
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
<< ", none: "
<< page_zip_calc_checksum(
- frame, size, SRV_CHECKSUM_ALGORITHM_NONE);
+ frame, size, SRV_CHECKSUM_ALGORITHM_NONE)
+ << " (algorithm: " << srv_checksum_algorithm << ")";
goto err_exit;
}
@@ -4095,37 +3965,6 @@ buf_block_from_ahi(const byte* ptr)
/********************************************************************//**
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
-the buf_block_t itself or a member of it. This functions checks one of
-the buffer pool instances.
-@return TRUE if ptr belongs to a buf_block_t struct */
-static
-ibool
-buf_pointer_is_block_field_instance(
-/*================================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- const void* ptr) /*!< in: pointer not dereferenced */
-{
- const buf_chunk_t* chunk = buf_pool->chunks;
- const buf_chunk_t* const echunk = chunk + ut_min(
- buf_pool->n_chunks, buf_pool->n_chunks_new);
-
- /* TODO: protect buf_pool->chunks with a mutex (the older pointer will
- currently remain while during buf_pool_resize()) */
- while (chunk < echunk) {
- if (ptr >= (void*) chunk->blocks
- && ptr < (void*) (chunk->blocks + chunk->size)) {
-
- return(TRUE);
- }
-
- chunk++;
- }
-
- return(FALSE);
-}
-
-/********************************************************************//**
-Find out if a pointer belongs to a buf_block_t. It can be a pointer to
the buf_block_t itself or a member of it
@return TRUE if ptr belongs to a buf_block_t struct */
ibool
@@ -4136,11 +3975,7 @@ buf_pointer_is_block_field(
ulint i;
for (i = 0; i < srv_buf_pool_instances; i++) {
- ibool found;
-
- found = buf_pointer_is_block_field_instance(
- buf_pool_from_array(i), ptr);
- if (found) {
+ if (buf_pool_from_array(i)->is_block_field(ptr)) {
return(TRUE);
}
}
@@ -4148,25 +3983,6 @@ buf_pointer_is_block_field(
return(FALSE);
}
-/********************************************************************//**
-Find out if a buffer block was created by buf_chunk_init().
-@return TRUE if "block" has been added to buf_pool->free by buf_chunk_init() */
-static
-ibool
-buf_block_is_uncompressed(
-/*======================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- const buf_block_t* block) /*!< in: pointer to block,
- not dereferenced */
-{
- if ((((ulint) block) % sizeof *block) != 0) {
- /* The pointer should be aligned. */
- return(FALSE);
- }
-
- return(buf_pointer_is_block_field_instance(buf_pool, (void*) block));
-}
-
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Return true if probe is enabled.
@@ -4230,7 +4046,94 @@ buf_wait_for_read(
}
}
-/** This is the general function used to get access to a database page.
+#ifdef BTR_CUR_HASH_ADAPT
+/** If a stale adaptive hash index exists on the block, drop it.
+Multiple executions of btr_search_drop_page_hash_index() on the
+same block must be prevented by exclusive page latch. */
+ATTRIBUTE_COLD
+static void buf_defer_drop_ahi(buf_block_t *block, mtr_memo_type_t fix_type)
+{
+ switch (fix_type) {
+ case MTR_MEMO_BUF_FIX:
+ /* We do not drop the adaptive hash index, because safely doing
+ so would require acquiring block->lock, and that is not safe
+ to acquire in some RW_NO_LATCH access paths. Those code paths
+ should have no business accessing the adaptive hash index anyway. */
+ break;
+ case MTR_MEMO_PAGE_S_FIX:
+ /* Temporarily release our S-latch. */
+ rw_lock_s_unlock(&block->lock);
+ rw_lock_x_lock(&block->lock);
+ if (dict_index_t *index= block->index)
+ if (index->freed())
+ btr_search_drop_page_hash_index(block);
+ rw_lock_x_unlock(&block->lock);
+ rw_lock_s_lock(&block->lock);
+ break;
+ case MTR_MEMO_PAGE_SX_FIX:
+ rw_lock_sx_unlock(&block->lock);
+ rw_lock_x_lock(&block->lock);
+ if (dict_index_t *index= block->index)
+ if (index->freed())
+ btr_search_drop_page_hash_index(block);
+ rw_lock_x_unlock(&block->lock);
+ rw_lock_sx_lock(&block->lock);
+ break;
+ default:
+ ut_ad(fix_type == MTR_MEMO_PAGE_X_FIX);
+ btr_search_drop_page_hash_index(block);
+ }
+}
+#endif /* BTR_CUR_HASH_ADAPT */
+
+/** Lock the page with the given latch type.
+@param[in,out] block block to be locked
+@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
+@param[in] mtr mini-transaction
+@param[in] file file name
+@param[in] line line where called
+@return pointer to locked block */
+static buf_block_t* buf_page_mtr_lock(buf_block_t *block,
+ ulint rw_latch,
+ mtr_t* mtr,
+ const char *file,
+ unsigned line)
+{
+ mtr_memo_type_t fix_type;
+ switch (rw_latch)
+ {
+ case RW_NO_LATCH:
+ fix_type= MTR_MEMO_BUF_FIX;
+ goto done;
+ case RW_S_LATCH:
+ rw_lock_s_lock_inline(&block->lock, 0, file, line);
+ fix_type= MTR_MEMO_PAGE_S_FIX;
+ break;
+ case RW_SX_LATCH:
+ rw_lock_sx_lock_inline(&block->lock, 0, file, line);
+ fix_type= MTR_MEMO_PAGE_SX_FIX;
+ break;
+ default:
+ ut_ad(rw_latch == RW_X_LATCH);
+ rw_lock_x_lock_inline(&block->lock, 0, file, line);
+ fix_type= MTR_MEMO_PAGE_X_FIX;
+ break;
+ }
+
+#ifdef BTR_CUR_HASH_ADAPT
+ {
+ dict_index_t *index= block->index;
+ if (index && index->freed())
+ buf_defer_drop_ahi(block, fix_type);
+ }
+#endif /* BTR_CUR_HASH_ADAPT */
+
+done:
+ mtr_memo_push(mtr, block, fix_type);
+ return block;
+}
+
+/** This is the low level function used to get access to a database page.
@param[in] page_id page id
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@param[in] guess guessed block or NULL
@@ -4241,7 +4144,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
@param[in] mtr mini-transaction
@return pointer to the block or NULL */
buf_block_t*
-buf_page_get_gen(
+buf_page_get_low(
const page_id_t page_id,
const page_size_t& page_size,
ulint rw_latch,
@@ -4318,7 +4221,7 @@ loop:
has been allocated by buf_page_alloc_descriptor(),
it may have been freed by buf_relocate(). */
- if (!buf_block_is_uncompressed(buf_pool, block)
+ if (!buf_pool->is_block_field(block)
|| page_id != block->page.id
|| buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
@@ -4543,6 +4446,7 @@ evict_from_pool:
buf_pool_mutex_exit(buf_pool);
return(NULL);
}
+
break;
case BUF_BLOCK_ZIP_PAGE:
@@ -4637,9 +4541,6 @@ evict_from_pool:
block->lock_hash_val = lock_rec_hash(page_id.space(),
page_id.page_no());
- UNIV_MEM_DESC(&block->page.zip.data,
- page_zip_get_size(&block->page.zip));
-
if (buf_page_get_state(&block->page) == BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_REMOVE(buf_pool->zip_clean, &block->page);
@@ -4661,7 +4562,7 @@ evict_from_pool:
buf_block_set_io_fix(block, BUF_IO_READ);
rw_lock_x_lock_inline(&block->lock, 0, file, line);
- UNIV_MEM_INVALID(bpage, sizeof *bpage);
+ MEM_UNDEFINED(bpage, sizeof *bpage);
rw_lock_x_unlock(hash_lock);
buf_pool->n_pend_unzip++;
@@ -4678,7 +4579,7 @@ evict_from_pool:
buf_pool->mutex or block->mutex. */
{
- bool success = buf_zip_decompress(block, TRUE);
+ bool success = buf_zip_decompress(block, false);
if (!success) {
buf_pool_mutex_enter(buf_pool);
@@ -4884,35 +4785,7 @@ evict_from_pool:
return NULL;
}
- mtr_memo_type_t fix_type;
-
- switch (rw_latch) {
- case RW_NO_LATCH:
-
- fix_type = MTR_MEMO_BUF_FIX;
- break;
-
- case RW_S_LATCH:
- rw_lock_s_lock_inline(&fix_block->lock, 0, file, line);
-
- fix_type = MTR_MEMO_PAGE_S_FIX;
- break;
-
- case RW_SX_LATCH:
- rw_lock_sx_lock_inline(&fix_block->lock, 0, file, line);
-
- fix_type = MTR_MEMO_PAGE_SX_FIX;
- break;
-
- default:
- ut_ad(rw_latch == RW_X_LATCH);
- rw_lock_x_lock_inline(&fix_block->lock, 0, file, line);
-
- fix_type = MTR_MEMO_PAGE_X_FIX;
- break;
- }
-
- mtr_memo_push(mtr, fix_block, fix_type);
+ fix_block = buf_page_mtr_lock(fix_block, rw_latch, mtr, file, line);
if (mode != BUF_PEEK_IF_IN_POOL && !access_time) {
/* In the case of a first access, try to apply linear
@@ -4927,6 +4800,42 @@ evict_from_pool:
return(fix_block);
}
+/** This is the general function used to get access to a database page.
+It does page initialization and applies the buffered redo logs.
+@param[in] page_id page id
+@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
+@param[in] guess guessed block or NULL
+@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
+BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
+@param[in] file file name
+@param[in] line line where called
+@param[in] mtr mini-transaction
+@param[out] err DB_SUCCESS or error code
+@return pointer to the block or NULL */
+buf_block_t*
+buf_page_get_gen(
+ const page_id_t page_id,
+ const page_size_t& page_size,
+ ulint rw_latch,
+ buf_block_t* guess,
+ ulint mode,
+ const char* file,
+ unsigned line,
+ mtr_t* mtr,
+ dberr_t* err)
+{
+ if (buf_block_t *block = recv_recovery_create_page(page_id))
+ {
+ buf_block_fix(block);
+ ut_ad(rw_lock_s_lock_nowait(&block->debug_latch, file, line));
+ block= buf_page_mtr_lock(block, rw_latch, mtr, file, line);
+ return block;
+ }
+
+ return buf_page_get_low(page_id, page_size, rw_latch,
+ guess, mode, file, line, mtr, err);
+}
+
/********************************************************************//**
This is the general function used to get optimistic access to a database
page.
@@ -5082,9 +4991,11 @@ buf_page_get_known_nowait(
buf_pool = buf_pool_from_block(block);
+#ifdef BTR_CUR_HASH_ADAPT
if (mode == BUF_MAKE_YOUNG) {
buf_page_make_young_if_needed(&block->page);
}
+#endif /* BTR_CUR_HASH_ADAPT */
ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
@@ -5127,9 +5038,12 @@ buf_page_get_known_nowait(
deleting a record from SYS_INDEXES. This check will be
skipped in recv_recover_page() as well. */
- buf_page_mutex_enter(block);
- ut_a(!block->page.file_page_was_freed);
- buf_page_mutex_exit(block);
+# ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!block->page.file_page_was_freed
+ || (block->index && block->index->freed()));
+# else /* BTR_CUR_HASH_ADAPT */
+ ut_ad(!block->page.file_page_was_freed);
+# endif /* BTR_CUR_HASH_ADAPT */
}
#endif /* UNIV_DEBUG */
@@ -5238,7 +5152,6 @@ buf_page_init_low(
bpage->access_time = 0;
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
- bpage->write_size = 0;
bpage->real_size = 0;
bpage->slot = NULL;
@@ -5273,15 +5186,6 @@ buf_page_init(
/* Set the state of the block */
buf_block_set_file_page(block, page_id);
-#ifdef UNIV_DEBUG_VALGRIND
- if (is_system_tablespace(page_id.space())) {
- /* Silence valid Valgrind warnings about uninitialized
- data being written to data files. There are some unused
- bytes on some pages that InnoDB does not initialize. */
- UNIV_MEM_VALID(block->frame, UNIV_PAGE_SIZE);
- }
-#endif /* UNIV_DEBUG_VALGRIND */
-
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(page_id.space(),
@@ -5295,7 +5199,8 @@ buf_page_init(
if (hash_page == NULL) {
/* Block not found in hash table */
- } else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
+ } else if (UNIV_LIKELY(buf_pool_watch_is_sentinel(buf_pool,
+ hash_page))) {
/* Preserve the reference count. */
ib_uint32_t buf_fix_count = hash_page->buf_fix_count;
@@ -5305,18 +5210,8 @@ buf_page_init(
buf_pool_watch_remove(buf_pool, hash_page);
} else {
-
- ib::error() << "Page " << page_id
- << " already found in the hash table: "
- << hash_page << ", " << block;
-
- ut_d(buf_page_mutex_exit(block));
- ut_d(buf_pool_mutex_exit(buf_pool));
- ut_d(buf_print());
- ut_d(buf_LRU_print());
- ut_d(buf_validate());
- ut_d(buf_LRU_validate());
- ut_error;
+ ib::fatal() << "Page already foudn in the hash table: "
+ << page_id;
}
ut_ad(!block->page.in_zip_hash);
@@ -5517,7 +5412,6 @@ buf_page_init_for_read(
bpage->size.copy_from(page_size);
mutex_enter(&buf_pool->zip_mutex);
- UNIV_MEM_DESC(bpage->zip.data, bpage->size.physical());
buf_page_init_low(bpage);
@@ -5598,14 +5492,13 @@ buf_page_create(
buf_frame_t* frame;
buf_block_t* block;
buf_block_t* free_block = NULL;
- buf_pool_t* buf_pool = buf_pool_get(page_id);
+ buf_pool_t* buf_pool= buf_pool_get(page_id);
rw_lock_t* hash_lock;
ut_ad(mtr->is_active());
ut_ad(page_id.space() != 0 || !page_size.is_compressed());
-
+loop:
free_block = buf_LRU_get_free_block(buf_pool);
-
buf_pool_mutex_enter(buf_pool);
hash_lock = buf_page_hash_lock_get(buf_pool, page_id);
@@ -5617,21 +5510,107 @@ buf_page_create(
&& buf_page_in_file(&block->page)
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
ut_d(block->page.file_page_was_freed = FALSE);
+ buf_page_state page_state = buf_block_get_state(block);
+#ifdef BTR_CUR_HASH_ADAPT
+ const dict_index_t *drop_hash_entry= NULL;
+#endif
+ switch (page_state) {
+ default:
+ ut_ad(0);
+ break;
+ case BUF_BLOCK_ZIP_PAGE:
+ case BUF_BLOCK_ZIP_DIRTY:
+ buf_block_init_low(free_block);
+ mutex_enter(&buf_pool->zip_mutex);
+
+ buf_page_mutex_enter(free_block);
+ if (buf_page_get_io_fix(&block->page) != BUF_IO_NONE) {
+ mutex_exit(&buf_pool->zip_mutex);
+ rw_lock_x_unlock(hash_lock);
+ buf_LRU_block_free_non_file_page(free_block);
+ buf_pool_mutex_exit(buf_pool);
+ buf_page_mutex_exit(free_block);
+
+ goto loop;
+ }
+
+ rw_lock_x_lock(&free_block->lock);
+
+ buf_relocate(&block->page, &free_block->page);
+ if (page_state == BUF_BLOCK_ZIP_DIRTY) {
+ ut_ad(block->page.in_flush_list);
+ ut_ad(block->page.oldest_modification > 0);
+ buf_flush_relocate_on_flush_list(
+ &block->page, &free_block->page);
+ } else {
+ ut_ad(block->page.oldest_modification == 0);
+ ut_ad(!block->page.in_flush_list);
+#ifdef UNIV_DEBUG
+ UT_LIST_REMOVE(
+ buf_pool->zip_clean, &block->page);
+#endif
+ }
+
+ free_block->page.state = BUF_BLOCK_FILE_PAGE;
+ mutex_exit(&buf_pool->zip_mutex);
+ free_block->lock_hash_val = lock_rec_hash(
+ page_id.space(), page_id.page_no());
+ buf_unzip_LRU_add_block(free_block, false);
+ buf_page_free_descriptor(&block->page);
+ block = free_block;
+ buf_block_fix(block);
+ buf_page_mutex_exit(free_block);
+ free_block = NULL;
+ break;
+ case BUF_BLOCK_FILE_PAGE:
+ buf_block_fix(block);
+ const int32_t num_fix_count =
+ mtr->get_fix_count(block) + 1;
+ buf_page_mutex_enter(block);
+ while (buf_block_get_io_fix(block) != BUF_IO_NONE
+ || (num_fix_count
+ != block->page.buf_fix_count)) {
+ buf_page_mutex_exit(block);
+ buf_pool_mutex_exit(buf_pool);
+ rw_lock_x_unlock(hash_lock);
+
+ os_thread_yield();
+ buf_pool_mutex_enter(buf_pool);
+ rw_lock_x_lock(hash_lock);
+ buf_page_mutex_enter(block);
+ }
+
+ rw_lock_x_lock(&block->lock);
+ buf_page_mutex_exit(block);
+#ifdef BTR_CUR_HASH_ADAPT
+ drop_hash_entry = block->index;
+#endif
+ break;
+ }
/* Page can be found in buf_pool */
buf_pool_mutex_exit(buf_pool);
rw_lock_x_unlock(hash_lock);
- buf_block_free(free_block);
+ if (free_block) {
+ buf_block_free(free_block);
+ }
+#ifdef BTR_CUR_HASH_ADAPT
+ if (drop_hash_entry) {
+ btr_search_drop_page_hash_index(block);
+ }
+#endif /* BTR_CUR_HASH_ADAPT */
- if (!recv_recovery_is_on()) {
- return buf_page_get_with_no_latch(page_id, page_size,
- mtr);
+#ifdef UNIV_DEBUG
+ if (!fsp_is_system_temporary(page_id.space())) {
+ rw_lock_s_lock_nowait(
+ &block->debug_latch,
+ __FILE__, __LINE__);
}
+#endif /* UNIV_DEBUG */
+
+ mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
- mutex_exit(&recv_sys->mutex);
- block = buf_page_get_with_no_latch(page_id, page_size, mtr);
- mutex_enter(&recv_sys->mutex);
return block;
}
@@ -5646,6 +5625,8 @@ buf_page_create(
buf_page_init(buf_pool, page_id, page_size, block);
+ rw_lock_x_lock(&block->lock);
+
rw_lock_x_unlock(hash_lock);
/* The block must be put to the LRU list */
@@ -5663,7 +5644,6 @@ buf_page_create(
by IO-fixing and X-latching the block. */
buf_page_set_io_fix(&block->page, BUF_IO_READ);
- rw_lock_x_lock(&block->lock);
buf_page_mutex_exit(block);
/* buf_pool->mutex may be released and reacquired by
@@ -5685,12 +5665,11 @@ buf_page_create(
buf_unzip_LRU_add_block(block, FALSE);
buf_page_set_io_fix(&block->page, BUF_IO_NONE);
- rw_lock_x_unlock(&block->lock);
}
buf_pool_mutex_exit(buf_pool);
- mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
+ mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
buf_page_set_accessed(&block->page);
@@ -6058,9 +6037,8 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict)
err = buf_page_check_corrupt(bpage, space);
-database_corrupted:
-
if (err != DB_SUCCESS) {
+database_corrupted:
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF(
@@ -6077,6 +6055,11 @@ database_corrupted:
goto page_not_corrupt;
);
+ if (uncompressed && bpage->zip.data) {
+ memset(reinterpret_cast<buf_block_t*>(bpage)
+ ->frame, 0, srv_page_size);
+ }
+
if (err == DB_PAGE_CORRUPTED) {
ib::error()
<< "Database page corruption on disk"
@@ -7288,6 +7271,7 @@ operator<<(
return(out);
}
+#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/** Print the given buf_pool_t object.
@param[in,out] out the output stream
@param[in] buf_pool the buf_pool_t object to be printed
@@ -7315,6 +7299,7 @@ operator<<(
<< ", written=" << buf_pool.stat.n_pages_written << "]";
return(out);
}
+#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
/** Encrypt a buffer of temporary tablespace
@param[in] offset Page offset
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 93201c3793f..30f24d57391 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, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -34,6 +34,8 @@ Created 2011/12/19
#include "fil0crypt.h"
#include "fil0pagecompress.h"
+using st_::span;
+
/** The doublewrite buffer */
buf_dblwr_t* buf_dblwr = NULL;
@@ -168,6 +170,7 @@ buf_dblwr_create()
{
buf_block_t* block2;
buf_block_t* new_block;
+ buf_block_t* trx_sys_block;
byte* doublewrite;
byte* fseg_header;
ulint page_no;
@@ -207,9 +210,14 @@ start_again:
}
}
- block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
+ trx_sys_block = buf_page_get(
+ page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO),
+ page_size_t(srv_page_size, srv_page_size, 0), RW_X_LATCH,
+ &mtr);
+
+ block2 = fseg_create(TRX_SYS_SPACE,
TRX_SYS_DOUBLEWRITE
- + TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
+ + TRX_SYS_DOUBLEWRITE_FSEG, &mtr, trx_sys_block);
if (block2 == NULL) {
too_small:
@@ -530,30 +538,54 @@ buf_dblwr_init_or_load_pages(
void
buf_dblwr_process()
{
+ ut_ad(recv_sys->parse_start_lsn);
+
ulint page_no_dblwr = 0;
byte* read_buf;
- byte* unaligned_read_buf;
recv_dblwr_t& recv_dblwr = recv_sys->dblwr;
if (!buf_dblwr) {
return;
}
- unaligned_read_buf = static_cast<byte*>(
- ut_malloc_nokey(3 * UNIV_PAGE_SIZE));
-
read_buf = static_cast<byte*>(
- ut_align(unaligned_read_buf, UNIV_PAGE_SIZE));
- byte* const buf = read_buf + UNIV_PAGE_SIZE;
+ aligned_malloc(3 * srv_page_size, srv_page_size));
+ byte* const buf = read_buf + srv_page_size;
for (recv_dblwr_t::list::iterator i = recv_dblwr.pages.begin();
i != recv_dblwr.pages.end();
++i, ++page_no_dblwr) {
- byte* page = *i;
- ulint space_id = page_get_space_id(page);
- fil_space_t* space = fil_space_get(space_id);
+ byte* page = *i;
+ const ulint page_no = page_get_page_no(page);
+
+ if (!page_no) {
+ /* page 0 should have been recovered
+ already via Datafile::restore_from_doublewrite() */
+ continue;
+ }
- if (space == NULL) {
+ const ulint space_id = page_get_space_id(page);
+ const lsn_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
+
+ if (recv_sys->parse_start_lsn > lsn) {
+ /* Pages written before the checkpoint are
+ not useful for recovery. */
+ continue;
+ }
+
+ const page_id_t page_id(space_id, page_no);
+
+ if (recv_sys->scanned_lsn < lsn) {
+ ib::warn() << "Ignoring a doublewrite copy of page "
+ << page_id
+ << " with future log sequence number "
+ << lsn;
+ continue;
+ }
+
+ fil_space_t* space = fil_space_acquire_for_io(space_id);
+
+ if (!space) {
/* Maybe we have dropped the tablespace
and this page once belonged to it: do nothing */
continue;
@@ -561,10 +593,7 @@ buf_dblwr_process()
fil_space_open_if_needed(space);
- const ulint page_no = page_get_page_no(page);
- const page_id_t page_id(space_id, page_no);
-
- if (page_no >= space->size) {
+ if (UNIV_UNLIKELY(page_no >= space->size)) {
/* Do not report the warning if the tablespace
is scheduled for truncation or was truncated
@@ -572,16 +601,21 @@ buf_dblwr_process()
if (!srv_is_tablespace_truncated(space_id)
&& !srv_was_tablespace_truncated(space)
&& !srv_is_undo_tablespace(space_id)) {
- ib::warn() << "A copy of page " << page_id
+ ib::warn() << "A copy of page " << page_no
<< " in the doublewrite buffer slot "
<< page_no_dblwr
- << " is not within space bounds";
+ << " is beyond the end of tablespace "
+ << space->name
+ << " (" << space->size << " pages)";
}
+next_page:
+ fil_space_release_for_io(space);
continue;
}
const page_size_t page_size(space->flags);
- ut_ad(!buf_page_is_zeroes(page, page_size.physical()));
+ ut_ad(!buf_is_zeroes(span<const byte>(page,
+ page_size.physical())));
/* We want to ensure that for partial reads the
unread portion of the page is NUL. */
@@ -597,83 +631,34 @@ buf_dblwr_process()
page_id, page_size,
0, page_size.physical(), read_buf, NULL);
- if (err != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::warn()
<< "Double write buffer recovery: "
<< page_id << " read failed with "
- << "error: " << ut_strerr(err);
+ << "error: " << err;
}
- const bool is_all_zero = buf_page_is_zeroes(
- read_buf, page_size.physical());
- const bool expect_encrypted = space->crypt_data
- && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED;
-
- if (is_all_zero) {
+ if (buf_is_zeroes(span<const byte>(read_buf,
+ page_size.physical()))) {
/* We will check if the copy in the
doublewrite buffer is valid. If not, we will
ignore this page (there should be redo log
records to initialize it). */
+ } else if (recv_dblwr.validate_page(
+ page_id, read_buf, space, buf)) {
+ goto next_page;
} else {
- /* Decompress the page before
- validating the checksum. */
- ulint decomp = fil_page_decompress(buf, read_buf);
- if (!decomp || (decomp != srv_page_size
- && page_size.is_compressed())) {
- goto bad;
- }
-
- 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;
- }
-
-bad:
/* We intentionally skip this message for
- is_all_zero pages. */
+ all-zero pages. */
ib::info()
<< "Trying to recover page " << page_id
<< " from the doublewrite buffer.";
}
- ulint decomp = fil_page_decompress(buf, page);
- if (!decomp || (decomp != srv_page_size
- && page_size.is_compressed())) {
- continue;
- }
-
- 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)) {
- /* Theoretically we could have another good
- copy for this page in the doublewrite
- buffer. If not, we will report a fatal error
- for a corrupted page somewhere else if that
- page was truly needed. */
- continue;
- }
+ page = recv_dblwr.find_page(page_id, space, buf);
- if (page_no == 0) {
- /* Check the FSP_SPACE_FLAGS. */
- ulint flags = fsp_header_get_flags(page);
- if (!fsp_flags_is_valid(flags, space_id)
- && fsp_flags_convert_from_101(flags)
- == ULINT_UNDEFINED) {
- ib::warn() << "Ignoring a doublewrite copy"
- " of page " << page_id
- << " due to invalid flags "
- << ib::hex(flags);
- continue;
- }
- /* The flags on the page should be converted later. */
+ if (!page) {
+ goto next_page;
}
/* Write the good page from the doublewrite buffer to
@@ -682,17 +667,18 @@ bad:
IORequest write_request(IORequest::WRITE);
fil_io(write_request, true, page_id, page_size,
- 0, page_size.physical(),
- const_cast<byte*>(page), NULL);
+ 0, page_size.physical(), page, NULL);
ib::info() << "Recovered page " << page_id
<< " from the doublewrite buffer.";
+
+ goto next_page;
}
recv_dblwr.pages.clear();
fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
- ut_free(unaligned_read_buf);
+ aligned_free(read_buf);
}
/****************************************************************//**
@@ -849,10 +835,6 @@ buf_dblwr_check_block(
{
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
- if (block->skip_flush_check) {
- return;
- }
-
switch (fil_page_get_type(block->frame)) {
case FIL_PAGE_INDEX:
case FIL_PAGE_RTREE:
@@ -992,6 +974,7 @@ try_again:
int64_t sig_count = os_event_reset(buf_dblwr->b_event);
mutex_exit(&buf_dblwr->mutex);
+ os_aio_simulated_wake_handler_threads();
os_event_wait_low(buf_dblwr->b_event, sig_count);
goto try_again;
}
@@ -1121,6 +1104,7 @@ try_again:
checkpoint. */
int64_t sig_count = os_event_reset(buf_dblwr->b_event);
mutex_exit(&buf_dblwr->mutex);
+ os_aio_simulated_wake_handler_threads();
os_event_wait_low(buf_dblwr->b_event, sig_count);
goto try_again;
@@ -1142,7 +1126,7 @@ try_again:
void * frame = buf_page_get_frame(bpage);
if (bpage->size.is_compressed()) {
- UNIV_MEM_ASSERT_RW(bpage->zip.data, bpage->size.physical());
+ MEM_CHECK_DEFINED(bpage->zip.data, bpage->size.physical());
/* Copy the compressed page and clear the rest. */
memcpy(p, frame, bpage->size.physical());
@@ -1151,10 +1135,7 @@ try_again:
univ_page_size.physical() - bpage->size.physical());
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
-
- UNIV_MEM_ASSERT_RW(frame,
- bpage->size.logical());
-
+ MEM_CHECK_DEFINED(frame, bpage->size.logical());
memcpy(p, frame, bpage->size.logical());
}
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 3e01b66eb76..b3ef58ecb55 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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,6 +25,7 @@ Created April 08, 2011 Vasil Dimov
*******************************************************/
#include "my_global.h"
+#include "mysqld.h"
#include "my_sys.h"
#include "mysql/psi/mysql_stage.h"
@@ -185,7 +186,7 @@ get_buf_dump_dir()
/* The dump file should be created in the default data directory if
innodb_data_home_dir is set as an empty string. */
- if (strcmp(srv_data_home, "") == 0) {
+ if (!*srv_data_home) {
dump_dir = fil_path_to_mysql_datadir;
} else {
dump_dir = srv_data_home;
@@ -197,16 +198,14 @@ get_buf_dump_dir()
/** Generate the path to the buffer pool dump/load file.
@param[out] path generated path
@param[in] path_size size of 'path', used as in snprintf(3). */
-static
-void
-buf_dump_generate_path(
- char* path,
- size_t path_size)
+static void buf_dump_generate_path(char *path, size_t path_size)
{
char buf[FN_REFLEN];
+ mysql_mutex_lock(&LOCK_global_system_variables);
snprintf(buf, sizeof(buf), "%s%c%s", get_buf_dump_dir(),
OS_PATH_SEPARATOR, srv_buf_dump_filename);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
os_file_type_t type;
bool exists = false;
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 3c3cc99de72..26610337d0d 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
@@ -449,18 +449,9 @@ buf_flush_insert_into_flush_list(
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 */
-
+ MEM_CHECK_DEFINED(block->page.size.is_compressed()
+ ? block->page.zip.data : block->frame,
+ block->page.size.physical());
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_skip(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -510,17 +501,9 @@ buf_flush_insert_sorted_into_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 */
+ MEM_CHECK_DEFINED(block->page.size.is_compressed()
+ ? block->page.zip.data : block->frame,
+ block->page.size.physical());
prev_b = NULL;
@@ -578,18 +561,11 @@ buf_flush_ready_for_replace(
#endif /* UNIV_DEBUG */
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_LRU_list);
+ ut_a(buf_page_in_file(bpage));
- if (buf_page_in_file(bpage)) {
-
- return(bpage->oldest_modification == 0
- && bpage->buf_fix_count == 0
- && buf_page_get_io_fix(bpage) == BUF_IO_NONE);
- }
-
- ib::fatal() << "Buffer block " << bpage << " state " << bpage->state
- << " in the LRU list!";
-
- return(FALSE);
+ return bpage->oldest_modification == 0
+ && bpage->buf_fix_count == 0
+ && buf_page_get_io_fix(bpage) == BUF_IO_NONE;
}
/********************************************************************//**
@@ -1069,10 +1045,8 @@ buf_flush_write_block_low(
case BUF_BLOCK_ZIP_DIRTY:
frame = bpage->zip.data;
- mach_write_to_8(frame + FIL_PAGE_LSN,
- bpage->newest_modification);
-
- ut_a(page_zip_verify_checksum(frame, bpage->size.physical()));
+ buf_flush_update_zip_checksum(frame, bpage->size.physical(),
+ bpage->newest_modification);
break;
case BUF_BLOCK_FILE_PAGE:
frame = bpage->zip.data;
@@ -1417,9 +1391,11 @@ buf_flush_try_neighbors(
}
}
- const ulint space_size = fil_space_get_size(page_id.space());
- if (high > space_size) {
- high = space_size;
+ if (fil_space_t *s = fil_space_acquire_for_io(page_id.space())) {
+ high = s->max_page_number_for_io(high);
+ fil_space_release_for_io(s);
+ } else {
+ return 0;
}
DBUG_PRINT("ib_buf", ("flush %u:%u..%u",
@@ -3159,7 +3135,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
ulint last_activity = srv_get_activity_count();
ulint last_pages = 0;
- while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
ulint curr_time = ut_time_ms();
/* The page_cleaner skips sleep if the server is
@@ -3177,7 +3153,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
ret_sleep = 0;
}
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
break;
}
@@ -3344,7 +3320,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
ut_d(buf_flush_page_cleaner_disabled_loop());
}
- ut_ad(srv_shutdown_state > 0);
+ ut_ad(srv_shutdown_state > SRV_SHUTDOWN_INITIATED);
if (srv_fast_shutdown == 2
|| srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
/* In very fast shutdown or when innodb failed to start, we
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 8673c8d9d72..290bb1a737e 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -62,6 +62,7 @@ static const ulint BUF_LRU_OLD_TOLERANCE = 20;
# error "BUF_LRU_NON_OLD_MIN_LEN >= BUF_LRU_OLD_MIN_LEN"
#endif
+#ifdef BTR_CUR_HASH_ADAPT
/** When dropping the search hash index entries before deleting an ibd
file, we build a local array of pages belonging to that tablespace
in the buffer pool. Following is the size of that array.
@@ -70,6 +71,7 @@ flush_list when dropping a table. This is to ensure that other threads
are not blocked for extended period of time when using very large
buffer pools. */
static const ulint BUF_LRU_DROP_SEARCH_SIZE = 1024;
+#endif /* BTR_CUR_HASH_ADAPT */
/** We scan these many blocks when looking for a clean page to evict
during LRU eviction. */
@@ -220,167 +222,6 @@ buf_LRU_evict_from_unzip_LRU(
}
#ifdef BTR_CUR_HASH_ADAPT
-/** Attempts to drop page hash index on a batch of pages belonging to a
-particular space id.
-@param[in] space_id space id
-@param[in] arr array of page_no
-@param[in] count number of entries in array */
-static
-void
-buf_LRU_drop_page_hash_batch(ulint space_id, const ulint* arr, ulint count)
-{
- ut_ad(count <= BUF_LRU_DROP_SEARCH_SIZE);
-
- for (const ulint* const end = arr + count; arr != end; ) {
- /* While our only caller
- buf_LRU_drop_page_hash_for_tablespace()
- is being executed for DROP TABLE or similar,
- the table cannot be evicted from the buffer pool. */
- btr_search_drop_page_hash_when_freed(
- page_id_t(space_id, *arr++));
- }
-}
-
-/******************************************************************//**
-When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page
-hash index entries belonging to that table. This function tries to
-do that in batch. Note that this is a 'best effort' attempt and does
-not guarantee that ALL hash entries will be removed. */
-static
-void
-buf_LRU_drop_page_hash_for_tablespace(
-/*==================================*/
- buf_pool_t* buf_pool, /*!< in: buffer pool instance */
- ulint id) /*!< in: space id */
-{
- ulint* page_arr = static_cast<ulint*>(ut_malloc_nokey(
- sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE));
-
- ulint num_entries = 0;
-
- buf_pool_mutex_enter(buf_pool);
-
-scan_again:
- for (buf_page_t* bpage = UT_LIST_GET_LAST(buf_pool->LRU);
- bpage != NULL;
- /* No op */) {
-
- buf_page_t* prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
-
- ut_a(buf_page_in_file(bpage));
-
- if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE
- || bpage->id.space() != id
- || bpage->io_fix != BUF_IO_NONE) {
- /* Compressed pages are never hashed.
- Skip blocks of other tablespaces.
- Skip I/O-fixed blocks (to be dealt with later). */
-next_page:
- bpage = prev_bpage;
- continue;
- }
-
- buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
-
- mutex_enter(&block->mutex);
-
- /* This debug check uses a dirty read that could
- theoretically cause false positives while
- buf_pool_clear_hash_index() is executing.
- (Other conflicting access paths to the adaptive hash
- index should not be possible, because when a
- tablespace is being discarded or dropped, there must
- be no concurrect access to the contained tables.) */
- assert_block_ahi_valid(block);
-
- bool skip = bpage->buf_fix_count > 0 || !block->index;
-
- mutex_exit(&block->mutex);
-
- if (skip) {
- /* Skip this block, because there are
- no adaptive hash index entries
- pointing to it, or because we cannot
- drop them due to the buffer-fix. */
- goto next_page;
- }
-
- /* Store the page number so that we can drop the hash
- index in a batch later. */
- page_arr[num_entries] = bpage->id.page_no();
- ut_a(num_entries < BUF_LRU_DROP_SEARCH_SIZE);
- ++num_entries;
-
- if (num_entries < BUF_LRU_DROP_SEARCH_SIZE) {
- goto next_page;
- }
-
- /* Array full. We release the buf_pool->mutex to obey
- the latching order. */
- buf_pool_mutex_exit(buf_pool);
-
- buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
-
- num_entries = 0;
-
- buf_pool_mutex_enter(buf_pool);
-
- /* Note that we released the buf_pool mutex above
- after reading the prev_bpage during processing of a
- page_hash_batch (i.e.: when the array was full).
- Because prev_bpage could belong to a compressed-only
- block, it may have been relocated, and thus the
- pointer cannot be trusted. Because bpage is of type
- buf_block_t, it is safe to dereference.
-
- bpage can change in the LRU list. This is OK because
- this function is a 'best effort' to drop as many
- search hash entries as possible and it does not
- guarantee that ALL such entries will be dropped. */
-
- /* If, however, bpage has been removed from LRU list
- to the free list then we should restart the scan.
- bpage->state is protected by buf_pool mutex. */
- if (bpage != NULL
- && buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
-
- goto scan_again;
- }
- }
-
- buf_pool_mutex_exit(buf_pool);
-
- /* Drop any remaining batch of search hashed pages. */
- buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
- ut_free(page_arr);
-}
-
-/** Try to drop the adaptive hash index for a tablespace.
-@param[in,out] table table
-@return whether anything was dropped */
-bool buf_LRU_drop_page_hash_for_tablespace(dict_table_t* table)
-{
- for (dict_index_t* index = dict_table_get_first_index(table);
- index != NULL;
- index = dict_table_get_next_index(index)) {
- if (btr_search_info_get_ref_count(btr_search_get_info(index),
- index)) {
- goto drop_ahi;
- }
- }
-
- return false;
-drop_ahi:
- ulint id = table->space;
- for (ulint i = 0; i < srv_buf_pool_instances; i++) {
- buf_LRU_drop_page_hash_for_tablespace(buf_pool_from_array(i),
- id);
- }
-
- return true;
-}
-#endif /* BTR_CUR_HASH_ADAPT */
-
/******************************************************************//**
While flushing (or removing dirty) pages from a tablespace we don't
want to hog the CPU and resources. Release the buffer pool and block
@@ -468,6 +309,7 @@ buf_flush_try_yield(
return(false);
}
+#endif /* BTR_CUR_HASH_ADAPT */
/******************************************************************//**
Removes a single page from a given tablespace inside a specific
@@ -643,6 +485,7 @@ rescan:
goto rescan;
}
+#ifdef BTR_CUR_HASH_ADAPT
++processed;
/* Yield if we have hogged the CPU and mutexes for too long. */
@@ -652,6 +495,7 @@ rescan:
processed = 0;
}
+#endif /* BTR_CUR_HASH_ADAPT */
/* The check for trx is interrupted is expensive, we want
to check every N iterations. */
@@ -965,7 +809,7 @@ buf_LRU_get_free_only(
assert_block_ahi_empty(block);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
- UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE);
+ MEM_UNDEFINED(block->frame, srv_page_size);
ut_ad(buf_pool_from_block(block) == buf_pool);
@@ -1020,7 +864,7 @@ buf_LRU_check_size_of_non_data_objects(
+ UT_LIST_GET_LEN(buf_pool->LRU))
< buf_pool->curr_size / 3) {
- if (!buf_lru_switched_on_innodb_mon) {
+ if (!buf_lru_switched_on_innodb_mon && srv_monitor_event) {
/* Over 67 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory
@@ -1110,7 +954,6 @@ loop:
ut_ad(buf_pool_from_block(block) == buf_pool);
memset(&block->page.zip, 0, sizeof block->page.zip);
- block->skip_flush_check = false;
block->page.flush_observer = NULL;
return(block);
}
@@ -1660,8 +1503,6 @@ func_exit:
ut_ad(b->size.is_compressed());
- UNIV_MEM_DESC(b->zip.data, b->size.physical());
-
/* The fields in_page_hash and in_LRU_list of
the to-be-freed block descriptor should have
been cleared in
@@ -1765,38 +1606,20 @@ func_exit:
The page was declared uninitialized by
buf_LRU_block_remove_hashed(). We need to flag
the contents of the page valid (which it still is) in
- order to avoid bogus Valgrind warnings.*/
-
- UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
- UNIV_PAGE_SIZE);
- btr_search_drop_page_hash_index((buf_block_t*) bpage);
- UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
- UNIV_PAGE_SIZE);
-
- if (b != NULL) {
-
- /* Compute and stamp the compressed page
- checksum while not holding any mutex. The
- block is already half-freed
- (BUF_BLOCK_REMOVE_HASH) and removed from
- buf_pool->page_hash, thus inaccessible by any
- other thread. */
+ order to avoid bogus Valgrind or MSAN warnings.*/
+ buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
- ut_ad(b->size.is_compressed());
-
- const uint32_t checksum = page_zip_calc_checksum(
- b->zip.data,
- b->size.physical(),
- static_cast<srv_checksum_algorithm_t>(
- srv_checksum_algorithm));
-
- mach_write_to_4(b->zip.data + FIL_PAGE_SPACE_OR_CHKSUM,
- checksum);
- }
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_MAKE_DEFINED(block->frame, srv_page_size);
+#endif /* HAVE_valgrind_or_MSAN */
+ btr_search_drop_page_hash_index(block);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(block->frame, srv_page_size);
+#endif /* HAVE_valgrind_or_MSAN */
buf_pool_mutex_enter(buf_pool);
- if (b != NULL) {
+ if (b) {
mutex_enter(block_mutex);
buf_page_unset_sticky(b);
@@ -1804,7 +1627,7 @@ func_exit:
mutex_exit(block_mutex);
}
- buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
+ buf_LRU_block_free_hashed_page(block);
return(true);
}
@@ -1837,15 +1660,10 @@ buf_LRU_block_free_non_file_page(
buf_block_set_state(block, BUF_BLOCK_NOT_USED);
- UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE);
-#ifdef UNIV_DEBUG
- /* Wipe contents of page to reveal possible stale pointers to it */
- memset(block->frame, '\0', UNIV_PAGE_SIZE);
-#else
+ MEM_UNDEFINED(block->frame, srv_page_size);
/* Wipe page_no and space_id */
memset(block->frame + FIL_PAGE_OFFSET, 0xfe, 4);
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xfe, 4);
-#endif /* UNIV_DEBUG */
data = block->page.zip.data;
if (data != NULL) {
@@ -1881,7 +1699,7 @@ buf_LRU_block_free_non_file_page(
ut_d(block->page.in_free_list = TRUE);
}
- UNIV_MEM_FREE(block->frame, UNIV_PAGE_SIZE);
+ MEM_NOACCESS(block->frame, srv_page_size);
}
/******************************************************************//**
@@ -1928,9 +1746,9 @@ buf_LRU_block_remove_hashed(
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_FILE_PAGE:
- UNIV_MEM_ASSERT_W(bpage, sizeof(buf_block_t));
- UNIV_MEM_ASSERT_W(((buf_block_t*) bpage)->frame,
- UNIV_PAGE_SIZE);
+ MEM_CHECK_ADDRESSABLE(bpage, sizeof(buf_block_t));
+ MEM_CHECK_ADDRESSABLE(((buf_block_t*) bpage)->frame,
+ srv_page_size);
buf_block_modify_clock_inc((buf_block_t*) bpage);
if (bpage->zip.data) {
const page_t* page = ((buf_block_t*) bpage)->frame;
@@ -1986,8 +1804,8 @@ buf_LRU_block_remove_hashed(
case BUF_BLOCK_ZIP_PAGE:
ut_a(bpage->oldest_modification == 0);
if (bpage->size.is_compressed()) {
- UNIV_MEM_ASSERT_W(bpage->zip.data,
- bpage->size.physical());
+ MEM_CHECK_ADDRESSABLE(bpage->zip.data,
+ bpage->size.physical());
}
break;
case BUF_BLOCK_POOL_WATCH:
@@ -2001,46 +1819,9 @@ buf_LRU_block_remove_hashed(
}
hashed_bpage = buf_page_hash_get_low(buf_pool, bpage->id);
- if (bpage != hashed_bpage) {
- ib::error() << "Page " << bpage->id
- << " not found in the hash table";
-
-#ifdef UNIV_DEBUG
-
-
- ib::error()
- << "in_page_hash:" << bpage->in_page_hash
- << " in_zip_hash:" << bpage->in_zip_hash
- // << " in_free_list:"<< bpage->in_fee_list
- << " in_flush_list:" << bpage->in_flush_list
- << " in_LRU_list:" << bpage->in_LRU_list
- << " zip.data:" << bpage->zip.data
- << " zip_size:" << bpage->size.logical()
- << " page_state:" << buf_page_get_state(bpage);
-#else
- ib::error()
- << " zip.data:" << bpage->zip.data
- << " zip_size:" << bpage->size.logical()
- << " page_state:" << buf_page_get_state(bpage);
-#endif
-
- if (hashed_bpage) {
-
- ib::error() << "In hash table we find block "
- << hashed_bpage << " of " << hashed_bpage->id
- << " which is not " << bpage;
- }
-
-#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
- mutex_exit(buf_page_get_mutex(bpage));
- rw_lock_x_unlock(hash_lock);
- buf_pool_mutex_exit(buf_pool);
- buf_print();
- buf_LRU_print();
- buf_validate();
- buf_LRU_validate();
-#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
- ut_error;
+ if (UNIV_UNLIKELY(bpage != hashed_bpage)) {
+ ib::fatal() << "Page not found in the hash table: "
+ << bpage->id;
}
ut_ad(!bpage->in_zip_hash);
@@ -2078,8 +1859,7 @@ buf_LRU_block_remove_hashed(
+ FIL_PAGE_OFFSET, 0xff, 4);
memset(((buf_block_t*) bpage)->frame
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
- UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
- UNIV_PAGE_SIZE);
+ MEM_UNDEFINED(((buf_block_t*) bpage)->frame, srv_page_size);
buf_page_set_state(bpage, BUF_BLOCK_REMOVE_HASH);
/* Question: If we release bpage and hash mutex here
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index e25c0e853e4..ad583e577c4 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -279,31 +279,8 @@ buf_read_ahead_random(
high = (page_id.page_no() / buf_read_ahead_random_area + 1)
* buf_read_ahead_random_area;
- /* Remember the tablespace version before we ask the tablespace size
- below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
- do not try to read outside the bounds of the tablespace! */
if (fil_space_t* space = fil_space_acquire(page_id.space())) {
-
-#ifdef UNIV_DEBUG
- if (srv_file_per_table) {
- ulint size = 0;
-
- for (const fil_node_t* node =
- UT_LIST_GET_FIRST(space->chain);
- node != NULL;
- node = UT_LIST_GET_NEXT(chain, node)) {
-
- size += ulint(os_file_get_size(node->handle)
- / page_size.physical());
- }
-
- ut_ad(size == space->size);
- }
-#endif /* UNIV_DEBUG */
-
- if (high > space->size) {
- high = space->size;
- }
+ high = space->max_page_number_for_io(high);
fil_space_release(space);
} else {
return(0);
@@ -580,13 +557,10 @@ buf_read_ahead_linear(
return(0);
}
- /* Remember the tablespace version before we ask te tablespace size
- below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
- do not try to read outside the bounds of the tablespace! */
ulint space_size;
if (fil_space_t* space = fil_space_acquire(page_id.space())) {
- space_size = space->size;
+ space_size = space->committed_size;
fil_space_release(space);
if (high > space_size) {
@@ -925,8 +899,12 @@ buf_read_recv_pages(
ulint count = 0;
buf_pool = buf_pool_get(cur_page_id);
- while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
+ ulint limit = 0;
+ for (ulint j = 0; j < buf_pool->n_chunks; j++) {
+ limit += buf_pool->chunks[j].size / 2;
+ }
+ while (buf_pool->n_pend_reads >= limit) {
os_aio_simulated_wake_handler_threads();
os_thread_sleep(10000);
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 17126e38e42..fba06e78987 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, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -194,41 +194,20 @@ dtuple_validate(
/*============*/
const dtuple_t* tuple) /*!< in: tuple */
{
- const dfield_t* field;
- ulint n_fields;
- ulint len;
- ulint i;
-
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
+#ifdef HAVE_valgrind_or_MSAN
+ const ulint n_fields = dtuple_get_n_fields(tuple);
- n_fields = dtuple_get_n_fields(tuple);
-
- /* We dereference all the data of each field to test
- for memory traps */
-
- for (i = 0; i < n_fields; i++) {
-
- field = dtuple_get_nth_field(tuple, i);
- len = dfield_get_len(field);
+ for (ulint i = 0; i < n_fields; i++) {
+ const dfield_t* field = dtuple_get_nth_field(tuple, i);
if (!dfield_is_null(field)) {
-
- const byte* data;
-
- data = static_cast<const byte*>(dfield_get_data(field));
-#ifndef UNIV_DEBUG_VALGRIND
- ulint j;
-
- for (j = 0; j < len; j++) {
- data++;
- }
-#endif /* !UNIV_DEBUG_VALGRIND */
-
- UNIV_MEM_ASSERT_RW(data, len);
+ MEM_CHECK_DEFINED(dfield_get_data(field),
+ dfield_get_len(field));
}
}
-
- ut_a(dtuple_check_typed(tuple));
+#endif /* HAVE_valgrind_or_MSAN */
+ ut_ad(dtuple_check_typed(tuple));
return(TRUE);
}
@@ -683,14 +662,6 @@ skip_field:
memcpy(data, dfield_get_data(dfield), local_prefix_len);
/* Clear the extern field reference (BLOB pointer). */
memset(data + local_prefix_len, 0, BTR_EXTERN_FIELD_REF_SIZE);
-#if 0
- /* The following would fail the Valgrind checks in
- page_cur_insert_rec_low() and page_cur_insert_rec_zip().
- The BLOB pointers in the record will be initialized after
- the record and the BLOBs have been written. */
- UNIV_MEM_ALLOC(data + local_prefix_len,
- BTR_EXTERN_FIELD_REF_SIZE);
-#endif
dfield_set_data(dfield, data, local_len);
dfield_set_ext(dfield);
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index 9294cf6263c..8e4732f8214 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -179,7 +179,7 @@ dict_hdr_create(
/* Create the dictionary header file block in a new, allocated file
segment in the system tablespace */
- block = fseg_create(DICT_HDR_SPACE, 0,
+ block = fseg_create(DICT_HDR_SPACE,
DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
ut_a(DICT_HDR_PAGE_NO == block->page.id.page_no());
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 4ef87dae22d..2976581c19f 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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,7 +26,9 @@ Created 1/8/1996 Heikki Tuuri
#include "dict0crea.h"
#include "btr0pcur.h"
-#include "btr0btr.h"
+#ifdef BTR_CUR_HASH_ADAPT
+# include "btr0sea.h"
+#endif /* BTR_CUR_HASH_ADAPT */
#include "page0page.h"
#include "mach0data.h"
#include "dict0boot.h"
@@ -1528,6 +1530,9 @@ dict_create_index_step(
&node->table->fts->cache->init_lock);
}
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!node->index->search_info->ref_count);
+#endif /* BTR_CUR_HASH_ADAPT */
dict_index_remove_from_cache(node->table, node->index);
node->index = NULL;
@@ -1714,10 +1719,9 @@ dict_create_or_check_foreign_constraint_tables(void)
"END;\n",
FALSE, trx);
- if (err != DB_SUCCESS) {
-
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << "Creation of SYS_FOREIGN and SYS_FOREIGN_COLS"
- " failed: " << ut_strerr(err) << ". Tablespace is"
+ " failed: " << err << ". Tablespace is"
" full. Dropping incompletely created tables.";
ut_ad(err == DB_OUT_OF_FILE_SPACE
@@ -1816,10 +1820,9 @@ dict_create_or_check_sys_virtual()
"END;\n",
FALSE, trx);
- if (err != DB_SUCCESS) {
-
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << "Creation of SYS_VIRTUAL"
- " failed: " << ut_strerr(err) << ". Tablespace is"
+ " failed: " << err << ". Tablespace is"
" full or too many transactions."
" Dropping incompletely created tables.";
@@ -1897,9 +1900,9 @@ dict_foreign_eval_sql(
return(error);
}
- if (error != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
ib::error() << "Foreign key constraint creation failed: "
- << ut_strerr(error);
+ << error;
mutex_enter(&dict_foreign_err_mutex);
ut_print_timestamp(ef);
@@ -2348,10 +2351,9 @@ dict_create_or_check_sys_tablespace(void)
"END;\n",
FALSE, trx);
- if (err != DB_SUCCESS) {
-
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << "Creation of SYS_TABLESPACES and SYS_DATAFILES"
- " has failed with error " << ut_strerr(err)
+ " has failed with error " << err
<< ". Dropping incompletely created tables.";
ut_a(err == DB_OUT_OF_FILE_SPACE
@@ -2460,49 +2462,6 @@ dict_replace_tablespace_in_dictionary(
return(error);
}
-/** Delete records from SYS_TABLESPACES and SYS_DATAFILES associated
-with a particular tablespace ID.
-@param[in] space Tablespace ID
-@param[in,out] trx Current transaction
-@return DB_SUCCESS if OK, dberr_t if the operation failed */
-
-dberr_t
-dict_delete_tablespace_and_datafiles(
- ulint space,
- trx_t* trx)
-{
- dberr_t err = DB_SUCCESS;
-
- ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
- ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(srv_sys_tablespaces_open);
-
- trx->op_info = "delete tablespace and datafiles from dictionary";
-
- pars_info_t* info = pars_info_create();
- ut_a(!is_system_tablespace(space));
- pars_info_add_int4_literal(info, "space", space);
-
- err = que_eval_sql(info,
- "PROCEDURE P () IS\n"
- "BEGIN\n"
- "DELETE FROM SYS_TABLESPACES\n"
- "WHERE SPACE = :space;\n"
- "DELETE FROM SYS_DATAFILES\n"
- "WHERE SPACE = :space;\n"
- "END;\n",
- FALSE, trx);
-
- if (err != DB_SUCCESS) {
- ib::warn() << "Could not delete space_id "
- << space << " from data dictionary";
- }
-
- trx->op_info = "";
-
- 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 */
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 4b1549c419d..e3ce13b5b27 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, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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 @@ extern uint ibuf_debug;
#include "lock0lock.h"
#include "mach0data.h"
#include "mem0mem.h"
-#include "os0once.h"
#include "page0page.h"
#include "page0zip.h"
#include "pars0pars.h"
@@ -268,144 +267,6 @@ dict_mutex_exit_for_mysql(void)
mutex_exit(&dict_sys->mutex);
}
-/** Allocate and init a dict_table_t's stats latch.
-This function must not be called concurrently on the same table object.
-@param[in,out] table_void table whose stats latch to create */
-static
-void
-dict_table_stats_latch_alloc(
- void* table_void)
-{
- dict_table_t* table = static_cast<dict_table_t*>(table_void);
-
- /* Note: rw_lock_create() will call the constructor */
-
- table->stats_latch = static_cast<rw_lock_t*>(
- ut_malloc_nokey(sizeof(rw_lock_t)));
-
- ut_a(table->stats_latch != NULL);
-
- rw_lock_create(dict_table_stats_key, table->stats_latch,
- SYNC_INDEX_TREE);
-}
-
-/** Deinit and free a dict_table_t's stats latch.
-This function must not be called concurrently on the same table object.
-@param[in,out] table table whose stats latch to free */
-static
-void
-dict_table_stats_latch_free(
- dict_table_t* table)
-{
- rw_lock_free(table->stats_latch);
- ut_free(table->stats_latch);
-}
-
-/** Create a dict_table_t's stats latch or delay for lazy creation.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to create
-@param[in] enabled if false then the latch is disabled
-and dict_table_stats_lock()/unlock() become noop on this table. */
-void
-dict_table_stats_latch_create(
- dict_table_t* table,
- bool enabled)
-{
- if (!enabled) {
- table->stats_latch = NULL;
- table->stats_latch_created = os_once::DONE;
- return;
- }
-
- /* We create this lazily the first time it is used. */
- table->stats_latch = NULL;
- table->stats_latch_created = os_once::NEVER_DONE;
-}
-
-/** Destroy a dict_table_t's stats latch.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to destroy */
-void
-dict_table_stats_latch_destroy(
- dict_table_t* table)
-{
- if (table->stats_latch_created == os_once::DONE
- && table->stats_latch != NULL) {
-
- dict_table_stats_latch_free(table);
- }
-}
-
-/** Lock the appropriate latch to protect a given table's statistics.
-@param[in] table table whose stats to lock
-@param[in] latch_mode RW_S_LATCH or RW_X_LATCH */
-void
-dict_table_stats_lock(
- dict_table_t* table,
- ulint latch_mode)
-{
- ut_ad(table != NULL);
- ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- os_once::do_or_wait_for_done(
- &table->stats_latch_created,
- dict_table_stats_latch_alloc, table);
-
- if (table->stats_latch == NULL) {
- /* This is a dummy table object that is private in the current
- thread and is not shared between multiple threads, thus we
- skip any locking. */
- return;
- }
-
- switch (latch_mode) {
- case RW_S_LATCH:
- rw_lock_s_lock(table->stats_latch);
- break;
- case RW_X_LATCH:
- rw_lock_x_lock(table->stats_latch);
- break;
- case RW_NO_LATCH:
- /* fall through */
- default:
- ut_error;
- }
-}
-
-/** Unlock the latch that has been locked by dict_table_stats_lock().
-@param[in] table table whose stats to unlock
-@param[in] latch_mode RW_S_LATCH or RW_X_LATCH */
-void
-dict_table_stats_unlock(
- dict_table_t* table,
- ulint latch_mode)
-{
- ut_ad(table != NULL);
- ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- if (table->stats_latch == NULL) {
- /* This is a dummy table object that is private in the current
- thread and is not shared between multiple threads, thus we
- skip any locking. */
- return;
- }
-
- switch (latch_mode) {
- case RW_S_LATCH:
- rw_lock_s_unlock(table->stats_latch);
- break;
- case RW_X_LATCH:
- rw_lock_x_unlock(table->stats_latch);
- break;
- case RW_NO_LATCH:
- /* fall through */
- default:
- ut_error;
- }
-}
-
/**********************************************************************//**
Try to drop any indexes after an aborted index creation.
This can also be after a server kill during DROP INDEX. */
@@ -528,7 +389,10 @@ dict_table_close(
mutex_exit(&dict_sys->mutex);
- if (drop_aborted) {
+ /* dict_table_try_drop_aborted() can generate undo logs.
+ So it should be avoided after shutdown of background
+ threads */
+ if (drop_aborted && !srv_undo_sources) {
dict_table_try_drop_aborted(NULL, table_id, 0);
}
}
@@ -734,34 +598,6 @@ dict_table_get_nth_v_col_mysql(
return(dict_table_get_nth_v_col(table, i));
}
-/** Allocate and init the autoinc latch of a given table.
-This function must not be called concurrently on the same table object.
-@param[in,out] table_void table whose autoinc latch to create */
-static
-void
-dict_table_autoinc_alloc(
- void* table_void)
-{
- dict_table_t* table = static_cast<dict_table_t*>(table_void);
- table->autoinc_mutex = UT_NEW_NOKEY(ib_mutex_t());
- ut_a(table->autoinc_mutex != NULL);
- mutex_create(LATCH_ID_AUTOINC, table->autoinc_mutex);
-}
-
-/** Allocate and init the zip_pad_mutex of a given index.
-This function must not be called concurrently on the same index object.
-@param[in,out] index_void index whose zip_pad_mutex to create */
-static
-void
-dict_index_zip_pad_alloc(
- void* index_void)
-{
- dict_index_t* index = static_cast<dict_index_t*>(index_void);
- index->zip_pad.mutex = UT_NEW_NOKEY(SysMutex());
- ut_a(index->zip_pad.mutex != NULL);
- mutex_create(LATCH_ID_ZIP_PAD_MUTEX, index->zip_pad.mutex);
-}
-
/********************************************************************//**
Acquire the autoinc lock. */
void
@@ -769,11 +605,7 @@ dict_table_autoinc_lock(
/*====================*/
dict_table_t* table) /*!< in/out: table */
{
- os_once::do_or_wait_for_done(
- &table->autoinc_mutex_created,
- dict_table_autoinc_alloc, table);
-
- mutex_enter(table->autoinc_mutex);
+ mysql_mutex_lock(&table->autoinc_mutex);
}
/** Acquire the zip_pad_mutex latch.
@@ -783,11 +615,7 @@ void
dict_index_zip_pad_lock(
dict_index_t* index)
{
- os_once::do_or_wait_for_done(
- &index->zip_pad.mutex_created,
- dict_index_zip_pad_alloc, index);
-
- mutex_enter(index->zip_pad.mutex);
+ mysql_mutex_lock(&index->zip_pad.mutex);
}
/** Get all the FTS indexes on a table.
@@ -822,7 +650,7 @@ dict_table_autoinc_unlock(
/*======================*/
dict_table_t* table) /*!< in/out: table */
{
- mutex_exit(table->autoinc_mutex);
+ mysql_mutex_unlock(&table->autoinc_mutex);
}
/** Looks for column n in an index.
@@ -1273,6 +1101,8 @@ dict_table_add_to_cache(
dict_table_add_system_columns(table, heap);
+ mysql_mutex_init(0, &table->autoinc_mutex, NULL);
+
table->cached = TRUE;
fold = ut_fold_string(table->name.m_name);
@@ -1358,25 +1188,12 @@ dict_table_can_be_evicted(
}
#ifdef BTR_CUR_HASH_ADAPT
+ /* We cannot really evict the table if adaptive hash
+ index entries are pointing to any of its indexes. */
for (dict_index_t* index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
-
- btr_search_t* info = btr_search_get_info(index);
-
- /* We are not allowed to free the in-memory index
- struct dict_index_t until all entries in the adaptive
- hash index that point to any of the page belonging to
- his b-tree index are dropped. This is so because
- dropping of these entries require access to
- dict_index_t struct. To avoid such scenario we keep
- a count of number of such pages in the search_info and
- only free the dict_index_t struct when this count
- drops to zero.
-
- See also: dict_index_remove_from_cache_low() */
-
- if (btr_search_info_get_ref_count(info, index) > 0) {
+ if (index->n_ahi_pages()) {
return(FALSE);
}
}
@@ -1388,6 +1205,71 @@ dict_table_can_be_evicted(
return(FALSE);
}
+#ifdef BTR_CUR_HASH_ADAPT
+/** @return a clone of this */
+dict_index_t *dict_index_t::clone() const
+{
+ ut_ad(n_fields);
+ ut_ad(!(type & (DICT_IBUF | DICT_SPATIAL | DICT_FTS)));
+ ut_ad(online_status == ONLINE_INDEX_COMPLETE);
+ ut_ad(is_committed());
+ ut_ad(!is_dummy);
+ ut_ad(!parser);
+ ut_ad(!index_fts_syncing);
+ ut_ad(!online_log);
+ ut_ad(!rtr_track);
+
+ const size_t size= sizeof *this + n_fields * sizeof(*fields) +
+#ifdef BTR_CUR_ADAPT
+ sizeof *search_info +
+#endif
+ 1 + strlen(name) +
+ n_uniq * (sizeof *stat_n_diff_key_vals +
+ sizeof *stat_n_sample_sizes +
+ sizeof *stat_n_non_null_key_vals);
+
+ mem_heap_t* heap= mem_heap_create(size);
+ dict_index_t *index= static_cast<dict_index_t*>(mem_heap_dup(heap, this,
+ sizeof *this));
+ *index= *this;
+ rw_lock_create(index_tree_rw_lock_key, &index->lock, SYNC_INDEX_TREE);
+ index->heap= heap;
+ index->name= mem_heap_strdup(heap, name);
+ index->fields= static_cast<dict_field_t*>
+ (mem_heap_dup(heap, fields, n_fields * sizeof *fields));
+#ifdef BTR_CUR_ADAPT
+ index->search_info= btr_search_info_create(index->heap);
+#endif /* BTR_CUR_ADAPT */
+ index->stat_n_diff_key_vals= static_cast<ib_uint64_t*>
+ (mem_heap_zalloc(heap, n_uniq * sizeof *stat_n_diff_key_vals));
+ index->stat_n_sample_sizes= static_cast<ib_uint64_t*>
+ (mem_heap_zalloc(heap, n_uniq * sizeof *stat_n_sample_sizes));
+ index->stat_n_non_null_key_vals= static_cast<ib_uint64_t*>
+ (mem_heap_zalloc(heap, n_uniq * sizeof *stat_n_non_null_key_vals));
+ mysql_mutex_init(0, &index->zip_pad.mutex, NULL);
+ return index;
+}
+
+/** Clone this index for lazy dropping of the adaptive hash.
+@return this or a clone */
+dict_index_t *dict_index_t::clone_if_needed()
+{
+ if (!search_info->ref_count)
+ return this;
+ dict_index_t *prev= UT_LIST_GET_PREV(indexes, this);
+
+ UT_LIST_REMOVE(table->indexes, this);
+ UT_LIST_ADD_LAST(table->freed_indexes, this);
+ dict_index_t *index= clone();
+ set_freed();
+ if (prev)
+ UT_LIST_INSERT_AFTER(table->indexes, prev, index);
+ else
+ UT_LIST_ADD_FIRST(table->indexes, index);
+ return index;
+}
+#endif /* BTR_CUR_HASH_ADAPT */
+
/**********************************************************************//**
Make room in the table cache by evicting an unused table. The unused table
should not be part of FK relationship and currently not used in any user
@@ -1627,7 +1509,8 @@ dict_table_rename_in_cache(
return(DB_OUT_OF_MEMORY);
}
- fil_delete_tablespace(table->space);
+ fil_delete_tablespace(table->space,
+ dict_table_is_discarded(table));
/* Delete any temp file hanging around. */
if (os_file_status(filepath, &exists, &ftype)
@@ -2077,6 +1960,21 @@ dict_table_remove_from_cache_low(
UT_DELETE(table->vc_templ);
}
+ mysql_mutex_destroy(&table->autoinc_mutex);
+#ifdef BTR_CUR_HASH_ADAPT
+ if (UNIV_UNLIKELY(UT_LIST_GET_LEN(table->freed_indexes) != 0)) {
+ if (table->fts) {
+ fts_optimize_remove_table(table);
+ fts_free(table);
+ table->fts = NULL;
+ }
+
+ table->vc_templ = NULL;
+ table->id = 0;
+ return;
+ }
+#endif /* BTR_CUR_HASH_ADAPT */
+
dict_mem_table_free(table);
}
@@ -2136,7 +2034,7 @@ dict_index_remove_from_v_col_list(dict_index_t* index) {
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
col = dict_index_get_nth_col(index, i);
- if (dict_col_is_virtual(col)) {
+ if (col && col->is_virtual()) {
vcol = reinterpret_cast<const dict_v_col_t*>(
col);
/* This could be NULL, when we do add
@@ -2306,6 +2204,10 @@ dict_index_remove_from_cache_low(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(mutex_own(&dict_sys->mutex));
+ ut_ad(table->id);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!index->freed());
+#endif /* BTR_CUR_HASH_ADAPT */
/* No need to acquire the dict_index_t::lock here because
there can't be any active operations on this index (or table). */
@@ -2315,13 +2217,22 @@ dict_index_remove_from_cache_low(
row_log_free(index->online_log);
}
+ /* Remove the index from the list of indexes of the table */
+ UT_LIST_REMOVE(table->indexes, index);
+
+ /* The index is being dropped, remove any compression stats for it. */
+ if (!lru_evict && DICT_TF_GET_ZIP_SSIZE(index->table->flags)) {
+ mutex_enter(&page_zip_stat_per_index_mutex);
+ page_zip_stat_per_index.erase(index->id);
+ mutex_exit(&page_zip_stat_per_index_mutex);
+ }
+
+ /* Remove the index from affected virtual column index list */
+ index->detach_columns();
+
#ifdef BTR_CUR_HASH_ADAPT
/* We always create search info whether or not adaptive
hash index is enabled or not. */
- btr_search_t* info = btr_search_get_info(index);
- ulint retries = 0;
- ut_ad(info);
-
/* We are not allowed to free the in-memory index struct
dict_index_t until all entries in the adaptive hash index
that point to any of the page belonging to his b-tree index
@@ -2331,31 +2242,15 @@ dict_index_remove_from_cache_low(
only free the dict_index_t struct when this count drops to
zero. See also: dict_table_can_be_evicted() */
- do {
- if (!btr_search_info_get_ref_count(info, index)
- || !buf_LRU_drop_page_hash_for_tablespace(table)) {
- break;
- }
-
- ut_a(++retries < 10000);
- } while (srv_shutdown_state == SRV_SHUTDOWN_NONE || !lru_evict);
+ if (index->n_ahi_pages()) {
+ index->set_freed();
+ UT_LIST_ADD_LAST(table->freed_indexes, index);
+ return;
+ }
#endif /* BTR_CUR_HASH_ADAPT */
rw_lock_free(&index->lock);
- /* The index is being dropped, remove any compression stats for it. */
- if (!lru_evict && DICT_TF_GET_ZIP_SSIZE(index->table->flags)) {
- mutex_enter(&page_zip_stat_per_index_mutex);
- page_zip_stat_per_index.erase(index->id);
- mutex_exit(&page_zip_stat_per_index_mutex);
- }
-
- /* Remove the index from the list of indexes of the table */
- UT_LIST_REMOVE(table->indexes, index);
-
- /* Remove the index from affected virtual column index list */
- index->detach_columns();
-
dict_mem_index_free(index);
}
@@ -4955,7 +4850,7 @@ dict_create_foreign_constraints(
heap = mem_heap_create(10000);
err = dict_create_foreign_constraints_low(
- trx, heap, innobase_get_charset(trx->mysql_thd),
+ trx, heap, thd_charset(trx->mysql_thd),
str, name, reject_fks);
mem_heap_free(heap);
@@ -4990,7 +4885,7 @@ dict_foreign_parse_drop_constraints(
ut_a(trx->mysql_thd);
- cs = innobase_get_charset(trx->mysql_thd);
+ cs = thd_charset(trx->mysql_thd);
*n = 0;
@@ -5694,7 +5589,7 @@ dict_set_corrupted(
btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_LE,
BTR_MODIFY_LEAF,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
if (cursor.low_match == dtuple_get_n_fields(tuple)) {
/* UPDATE SYS_INDEXES SET TYPE=index->type
@@ -5743,6 +5638,7 @@ dict_set_corrupted_index_cache_only(
is corrupted */
if (dict_index_is_clust(index)) {
index->table->corrupted = TRUE;
+ index->table->file_unreadable = true;
}
index->type |= DICT_CORRUPT;
@@ -5796,7 +5692,7 @@ dict_index_set_merge_threshold(
btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_GE,
BTR_MODIFY_LEAF,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
if (cursor.up_match == dtuple_get_n_fields(tuple)
&& rec_get_n_fields_old(btr_cur_get_rec(&cursor))
@@ -6547,7 +6443,11 @@ dict_foreign_qualify_index(
return(false);
}
- if (index->type & (DICT_SPATIAL | DICT_FTS)) {
+ if (index->type & (DICT_SPATIAL | DICT_FTS | DICT_CORRUPT)) {
+ return false;
+ }
+
+ if (index->online_status >= ONLINE_INDEX_ABORTED) {
return false;
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 8ed947f04cf..22fc70a4e42 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -805,7 +805,7 @@ err_len:
@param[in] space_id Tablespace ID
@return First filepath (caller must invoke ut_free() on it)
@retval NULL if no SYS_DATAFILES entry was found. */
-char*
+static char*
dict_get_first_path(
ulint space_id)
{
@@ -863,7 +863,7 @@ dict_get_first_path(
ut_ad(len > 0);
ut_ad(len < OS_FILE_MAX_PATH);
- if (len > 0 && len != UNIV_SQL_NULL) {
+ if (len > 0 && len < UNIV_SQL_NULL) {
filepath = mem_strdupl(
reinterpret_cast<const char*>(field),
len);
@@ -925,7 +925,7 @@ dict_update_filepath(
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
- if (err == DB_SUCCESS) {
+ if (UNIV_LIKELY(err == DB_SUCCESS)) {
/* We just updated SYS_DATAFILES due to the contents in
a link file. Make a note that we did this. */
ib::info() << "The InnoDB data dictionary table SYS_DATAFILES"
@@ -935,7 +935,7 @@ dict_update_filepath(
ib::warn() << "Error occurred while updating InnoDB data"
" dictionary table SYS_DATAFILES for tablespace ID "
<< space_id << " to file " << filepath << ": "
- << ut_strerr(err) << ".";
+ << err << ".";
}
return(err);
@@ -1388,6 +1388,7 @@ static ulint dict_check_sys_tables()
for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES);
rec != NULL;
+ mtr.commit(), mtr.start(),
rec = dict_getnext_system(&pcur, &mtr)) {
const byte* field;
ulint len;
@@ -1570,7 +1571,7 @@ dict_load_column_low(
ulint pos;
ulint num_base;
- ut_ad(table || column);
+ ut_ad(!table == !!column);
if (rec_get_deleted_flag(rec, 0)) {
return(dict_load_column_del);
@@ -1677,7 +1678,7 @@ err_len:
}
num_base = mach_read_from_4(field);
- if (column == NULL) {
+ if (table) {
if (prtype & DATA_VIRTUAL) {
#ifdef UNIV_DEBUG
dict_v_col_t* vcol =
@@ -2685,7 +2686,7 @@ static const char* dict_load_table_low(const table_name_t& name,
*table = dict_mem_table_create(
name.m_name, space_id, n_cols + n_v_col, n_v_col, flags, flags2);
(*table)->id = table_id;
- (*table)->file_unreadable = false;
+ (*table)->file_unreadable = !!(flags2 & DICT_TF2_DISCARDED);
return(NULL);
}
@@ -2738,7 +2739,8 @@ dict_get_and_save_data_dir_path(
{
ut_ad(!dict_table_is_temporary(table));
- if (!table->data_dir_path && table->space) {
+ if (!table->data_dir_path && table->space
+ && !dict_table_is_discarded(table)) {
char* path = fil_space_get_first_path(table->space);
if (!dict_mutex_own) {
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index fe01948b70d..efefa40e69f 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -96,20 +96,36 @@ operator<<(
return(s << ut_get_name(NULL, table_name.m_name));
}
-/**********************************************************************//**
-Creates a table memory object.
-@return own: table object */
+/** @return whether a table belongs to a system database */
+static bool dict_mem_table_is_system(char *name)
+{
+ /* table has the following format: database/table
+ and some system table are of the form SYS_* */
+ if (strchr(name, '/')) {
+ size_t table_len = strlen(name);
+ const char *system_db;
+ int i = 0;
+ while ((system_db = innobase_system_databases[i++])
+ && (system_db != NullS)) {
+ size_t len = strlen(system_db);
+ if (table_len > len && !strncmp(name, system_db, len)) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ return true;
+ }
+}
+
dict_table_t*
dict_mem_table_create(
-/*==================*/
- const char* name, /*!< in: table name */
- ulint space, /*!< in: space where the clustered index of
- the table is placed */
- ulint n_cols, /*!< in: total number of columns including
- virtual and non-virtual columns */
- ulint n_v_cols,/*!< in: number of virtual columns */
- ulint flags, /*!< in: table flags */
- ulint flags2) /*!< in: table flags2 */
+ const char* name,
+ ulint space,
+ ulint n_cols,
+ ulint n_v_cols,
+ ulint flags,
+ ulint flags2)
{
dict_table_t* table;
mem_heap_t* heap;
@@ -126,6 +142,9 @@ dict_mem_table_create(
lock_table_lock_list_init(&table->locks);
UT_LIST_INIT(table->indexes, &dict_index_t::indexes);
+#ifdef BTR_CUR_HASH_ADAPT
+ UT_LIST_INIT(table->freed_indexes, &dict_index_t::indexes);
+#endif /* BTR_CUR_HASH_ADAPT */
table->heap = heap;
@@ -145,16 +164,9 @@ dict_mem_table_create(
table->v_cols = static_cast<dict_v_col_t*>(
mem_heap_alloc(heap, n_v_cols * sizeof(*table->v_cols)));
- /* true means that the stats latch will be enabled -
- dict_table_stats_lock() will not be noop. */
- dict_table_stats_latch_create(table, true);
-
table->autoinc_lock = static_cast<ib_lock_t*>(
mem_heap_alloc(heap, lock_get_size()));
- /* lazy creation of table autoinc latch */
- dict_table_autoinc_create_lazy(table);
-
/* If the table has an FTS index or we are in the process
of building one, create the table->fts */
if (dict_table_has_fts_index(table)
@@ -181,6 +193,10 @@ dict_mem_table_free(
{
ut_ad(table);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
+ ut_ad(UT_LIST_GET_LEN(table->indexes) == 0);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(UT_LIST_GET_LEN(table->freed_indexes) == 0);
+#endif /* BTR_CUR_HASH_ADAPT */
ut_d(table->cached = FALSE);
if (dict_table_has_fts_index(table)
@@ -193,9 +209,7 @@ dict_mem_table_free(
}
}
- dict_table_autoinc_destroy(table);
dict_mem_table_free_foreign_vcol_set(table);
- dict_table_stats_latch_destroy(table);
table->foreign_set.~dict_foreign_set();
table->referenced_set.~dict_foreign_set();
@@ -559,15 +573,14 @@ dict_mem_table_col_rename_low(
}
}
- dict_index_t* new_index = dict_foreign_find_index(
+ /* New index can be null if InnoDB already dropped
+ the foreign index when FOREIGN_KEY_CHECKS is
+ disabled */
+ foreign->foreign_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
foreign->n_fields, NULL, true, false,
NULL, NULL, NULL);
- /* There must be an equivalent index in this case. */
- ut_ad(new_index != NULL);
-
- foreign->foreign_index = new_index;
} else {
@@ -590,7 +603,41 @@ dict_mem_table_col_rename_low(
foreign = *it;
- ut_ad(foreign->referenced_index != NULL);
+ if (!foreign->referenced_index) {
+ /* Referenced index could have been dropped
+ when foreign_key_checks is disabled. In that case,
+ rename the corresponding referenced_col_names and
+ find the equivalent referenced index also */
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+
+ const char*& rc =
+ foreign->referenced_col_names[f];
+ if (strcmp(rc, from)) {
+ continue;
+ }
+
+ if (to_len <= strlen(rc)) {
+ memcpy(const_cast<char*>(rc), to,
+ to_len + 1);
+ } else {
+ rc = static_cast<char*>(
+ mem_heap_dup(
+ foreign->heap,
+ to, to_len + 1));
+ }
+ }
+
+ /* New index can be null if InnoDB already dropped
+ the referenced index when FOREIGN_KEY_CHECKS is
+ disabled */
+ foreign->referenced_index = dict_foreign_find_index(
+ foreign->referenced_table, NULL,
+ foreign->referenced_col_names,
+ foreign->n_fields, NULL, true, false,
+ NULL, NULL, NULL);
+ return;
+ }
+
for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
@@ -705,10 +752,9 @@ dict_mem_index_create(
dict_mem_fill_index_struct(index, heap, table_name, index_name,
space, type, n_fields);
- dict_index_zip_pad_mutex_create_lazy(index);
+ mysql_mutex_init(0, &index->zip_pad.mutex, NULL);
if (type & DICT_SPATIAL) {
- mutex_create(LATCH_ID_RTR_SSN_MUTEX, &index->rtr_ssn.mutex);
index->rtr_track = static_cast<rtr_info_track_t*>(
mem_heap_alloc(
heap,
@@ -1021,7 +1067,7 @@ dict_mem_index_free(
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- dict_index_zip_pad_mutex_destroy(index);
+ mysql_mutex_destroy(&index->zip_pad.mutex);
if (dict_index_is_spatial(index)) {
rtr_info_active::iterator it;
@@ -1034,7 +1080,6 @@ dict_mem_index_free(
rtr_info->index = NULL;
}
- mutex_destroy(&index->rtr_ssn.mutex);
mutex_destroy(&index->rtr_track->rtr_active_mutex);
UT_DELETE(index->rtr_track->rtr_active);
}
@@ -1157,31 +1202,20 @@ operator<< (std::ostream& out, const dict_foreign_set& fk_set)
return(out);
}
-/****************************************************************//**
-Determines if a table belongs to a system database
-@return */
-bool
-dict_mem_table_is_system(
-/*================*/
- char *name) /*!< in: table name */
+/** Check whether fulltext index gets affected by foreign
+key constraint. */
+bool dict_foreign_t::affects_fulltext() const
{
- ut_ad(name);
-
- /* table has the following format: database/table
- and some system table are of the form SYS_* */
- if (strchr(name, '/')) {
- size_t table_len = strlen(name);
- const char *system_db;
- int i = 0;
- while ((system_db = innobase_system_databases[i++])
- && (system_db != NullS)) {
- size_t len = strlen(system_db);
- if (table_len > len && !strncmp(name, system_db, len)) {
- return true;
- }
- }
- return false;
- } else {
- return true;
- }
+ if (foreign_table == referenced_table || !foreign_table->fts)
+ return false;
+
+ for (ulint i= 0; i < n_fields; i++)
+ {
+ const dict_col_t *col= dict_index_get_nth_col(foreign_index, i);
+ if (dict_table_is_fts_column(foreign_table->fts->indexes, col->ind,
+ col->is_virtual()) != ULINT_UNDEFINED)
+ return true;
+ }
+
+ return false;
}
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index f49fb87e4ea..f8a4cebfb16 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -33,6 +33,7 @@ Created Jan 06, 2010 Vasil Dimov
#include "pars0pars.h"
#include <mysql_com.h>
#include "btr0btr.h"
+#include "sync0sync.h"
#include <algorithm>
#include <map>
@@ -409,7 +410,7 @@ dict_stats_table_clone_create(
t = (dict_table_t*) mem_heap_alloc(heap, sizeof(*t));
- UNIV_MEM_ASSERT_RW_ABORT(&table->id, sizeof(table->id));
+ MEM_CHECK_DEFINED(&table->id, sizeof(table->id));
t->id = table->id;
t->heap = heap;
@@ -418,12 +419,10 @@ dict_stats_table_clone_create(
t->corrupted = table->corrupted;
- /* This private object "t" is not shared with other threads, so
- we do not need the stats_latch (thus we pass false below). The
- dict_table_stats_lock()/unlock() routines will do nothing. */
- dict_table_stats_latch_create(t, false);
-
UT_LIST_INIT(t->indexes, &dict_index_t::indexes);
+#ifdef BTR_CUR_HASH_ADAPT
+ UT_LIST_INIT(t->freed_indexes, &dict_index_t::indexes);
+#endif /* BTR_CUR_HASH_ADAPT */
for (index = dict_table_get_first_index(table);
index != NULL;
@@ -439,7 +438,7 @@ dict_stats_table_clone_create(
idx = (dict_index_t*) mem_heap_alloc(heap, sizeof(*idx));
- UNIV_MEM_ASSERT_RW_ABORT(&index->id, sizeof(index->id));
+ MEM_CHECK_DEFINED(&index->id, sizeof(index->id));
idx->id = index->id;
idx->name = mem_heap_strdup(heap, index->name);
@@ -499,15 +498,12 @@ dict_stats_table_clone_free(
/*========================*/
dict_table_t* t) /*!< in: dummy table object to free */
{
- dict_table_stats_latch_destroy(t);
mem_heap_free(t->heap);
}
/*********************************************************************//**
Write all zeros (or 1 where it makes sense) into an index
-statistics members. The resulting stats correspond to an empty index.
-The caller must own index's table stats latch in X mode
-(dict_table_stats_lock(table, RW_X_LATCH)) */
+statistics members. The resulting stats correspond to an empty index. */
static
void
dict_stats_empty_index(
@@ -518,6 +514,7 @@ dict_stats_empty_index(
{
ut_ad(!(index->type & DICT_FTS));
ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(mutex_own(&dict_sys->mutex));
ulint n_uniq = index->n_uniq;
@@ -547,10 +544,9 @@ dict_stats_empty_table(
bool empty_defrag_stats)
/*!< in: whether to empty defrag stats */
{
- /* Zero the stats members */
-
- dict_table_stats_lock(table, RW_X_LATCH);
+ mutex_enter(&dict_sys->mutex);
+ /* Zero the stats members */
table->stat_n_rows = 0;
table->stat_clustered_index_size = 1;
/* 1 page for each index, not counting the clustered */
@@ -574,8 +570,7 @@ dict_stats_empty_table(
}
table->stat_initialized = TRUE;
-
- dict_table_stats_unlock(table, RW_X_LATCH);
+ mutex_exit(&dict_sys->mutex);
}
/*********************************************************************//**
@@ -586,23 +581,23 @@ dict_stats_assert_initialized_index(
/*================================*/
const dict_index_t* index) /*!< in: index */
{
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_diff_key_vals,
index->n_uniq * sizeof(index->stat_n_diff_key_vals[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_sample_sizes,
index->n_uniq * sizeof(index->stat_n_sample_sizes[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_non_null_key_vals,
index->n_uniq * sizeof(index->stat_n_non_null_key_vals[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
&index->stat_index_size,
sizeof(index->stat_index_size));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
&index->stat_n_leaf_pages,
sizeof(index->stat_n_leaf_pages));
}
@@ -617,32 +612,32 @@ dict_stats_assert_initialized(
{
ut_a(table->stat_initialized);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_last_recalc,
- sizeof(table->stats_last_recalc));
+ MEM_CHECK_DEFINED(&table->stats_last_recalc,
+ sizeof table->stats_last_recalc);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_persistent,
- sizeof(table->stat_persistent));
+ MEM_CHECK_DEFINED(&table->stat_persistent,
+ sizeof table->stat_persistent);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_auto_recalc,
- sizeof(table->stats_auto_recalc));
+ MEM_CHECK_DEFINED(&table->stats_auto_recalc,
+ sizeof table->stats_auto_recalc);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_sample_pages,
- sizeof(table->stats_sample_pages));
+ MEM_CHECK_DEFINED(&table->stats_sample_pages,
+ sizeof table->stats_sample_pages);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_n_rows,
- sizeof(table->stat_n_rows));
+ MEM_CHECK_DEFINED(&table->stat_n_rows,
+ sizeof table->stat_n_rows);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_clustered_index_size,
- sizeof(table->stat_clustered_index_size));
+ MEM_CHECK_DEFINED(&table->stat_clustered_index_size,
+ sizeof table->stat_clustered_index_size);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_sum_of_other_index_sizes,
- sizeof(table->stat_sum_of_other_index_sizes));
+ MEM_CHECK_DEFINED(&table->stat_sum_of_other_index_sizes,
+ sizeof table->stat_sum_of_other_index_sizes);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_modified_counter,
- sizeof(table->stat_modified_counter));
+ MEM_CHECK_DEFINED(&table->stat_modified_counter,
+ sizeof table->stat_modified_counter);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_bg_flag,
- sizeof(table->stats_bg_flag));
+ MEM_CHECK_DEFINED(&table->stats_bg_flag,
+ sizeof table->stats_bg_flag);
for (dict_index_t* index = dict_table_get_first_index(table);
index != NULL;
@@ -674,6 +669,8 @@ dict_stats_copy(
to have the same statistics as if
the table was empty */
{
+ ut_ad(mutex_own(&dict_sys->mutex));
+
dst->stats_last_recalc = src->stats_last_recalc;
dst->stat_n_rows = src->stat_n_rows;
dst->stat_clustered_index_size = src->stat_clustered_index_size;
@@ -791,8 +788,6 @@ dict_stats_snapshot_create(
{
mutex_enter(&dict_sys->mutex);
- dict_table_stats_lock(table, RW_S_LATCH);
-
dict_stats_assert_initialized(table);
dict_table_t* t;
@@ -806,8 +801,6 @@ dict_stats_snapshot_create(
t->stats_sample_pages = table->stats_sample_pages;
t->stats_bg_flag = table->stats_bg_flag;
- dict_table_stats_unlock(table, RW_S_LATCH);
-
mutex_exit(&dict_sys->mutex);
return(t);
@@ -847,10 +840,14 @@ dict_stats_update_transient_for_index(
Initialize some bogus index cardinality
statistics, so that the data can be queried in
various means, also via secondary indexes. */
+ mutex_enter(&dict_sys->mutex);
dict_stats_empty_index(index, false);
+ mutex_exit(&dict_sys->mutex);
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
} else if (ibuf_debug && !dict_index_is_clust(index)) {
+ mutex_enter(&dict_sys->mutex);
dict_stats_empty_index(index, false);
+ mutex_exit(&dict_sys->mutex);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
} else {
mtr_t mtr;
@@ -873,7 +870,9 @@ dict_stats_update_transient_for_index(
switch (size) {
case ULINT_UNDEFINED:
+ mutex_enter(&dict_sys->mutex);
dict_stats_empty_index(index, false);
+ mutex_exit(&dict_sys->mutex);
return;
case 0:
/* The root node of the tree is a leaf */
@@ -885,11 +884,23 @@ dict_stats_update_transient_for_index(
/* Do not continue if table decryption has failed or
table is already marked as corrupted. */
if (index->is_readable()) {
- /* We don't handle the return value since it
- will be false only when some thread is
- dropping the table and we don't have to empty
- the statistics of the to be dropped index */
- btr_estimate_number_of_different_key_vals(index);
+ std::vector<index_field_stats_t> stats
+ = btr_estimate_number_of_different_key_vals(
+ index);
+
+ if (!stats.empty()) {
+ ut_ad(!mutex_own(&dict_sys->mutex));
+ mutex_enter(&dict_sys->mutex);
+ for (size_t i = 0; i < stats.size(); ++i) {
+ index->stat_n_diff_key_vals[i]
+ = stats[i].n_diff_key_vals;
+ index->stat_n_sample_sizes[i]
+ = stats[i].n_sample_sizes;
+ index->stat_n_non_null_key_vals[i]
+ = stats[i].n_non_null_key_vals;
+ }
+ mutex_exit(&dict_sys->mutex);
+ }
}
}
}
@@ -906,6 +917,8 @@ dict_stats_update_transient(
/*========================*/
dict_table_t* table) /*!< in/out: table */
{
+ ut_ad(!mutex_own(&dict_sys->mutex));
+
dict_index_t* index;
ulint sum_of_index_sizes = 0;
@@ -931,27 +944,25 @@ dict_stats_update_transient(
ut_ad(!dict_index_is_ibuf(index));
- if (index->type & DICT_FTS || dict_index_is_spatial(index)) {
+ if (index->type & (DICT_FTS | DICT_SPATIAL)) {
continue;
}
- dict_stats_empty_index(index, false);
-
- if (dict_stats_should_ignore_index(index)) {
+ if (dict_stats_should_ignore_index(index)
+ || !index->is_readable()) {
+ mutex_enter(&dict_sys->mutex);
+ dict_stats_empty_index(index, false);
+ mutex_exit(&dict_sys->mutex);
continue;
}
- /* Do not continue if table decryption has failed or
- table is already marked as corrupted. */
- if (!index->is_readable()) {
- break;
- }
-
dict_stats_update_transient_for_index(index);
sum_of_index_sizes += index->stat_index_size;
}
+ mutex_enter(&dict_sys->mutex);
+
index = dict_table_get_first_index(table);
table->stat_n_rows = index->stat_n_diff_key_vals[
@@ -967,6 +978,8 @@ dict_stats_update_transient(
table->stat_modified_counter = 0;
table->stat_initialized = TRUE;
+
+ mutex_exit(&dict_sys->mutex);
}
/* @{ Pseudo code about the relation between the following functions
@@ -1018,8 +1031,8 @@ dict_stats_analyze_index_level(
bool prev_rec_is_copied;
byte* prev_rec_buf = NULL;
ulint prev_rec_buf_size = 0;
- ulint* rec_offsets;
- ulint* prev_rec_offsets;
+ rec_offs* rec_offsets;
+ rec_offs* prev_rec_offsets;
ulint i;
DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n",
@@ -1040,9 +1053,9 @@ dict_stats_analyze_index_level(
i = (REC_OFFS_HEADER_SIZE + 1 + 1) + index->n_fields;
heap = mem_heap_create((2 * sizeof *rec_offsets) * i);
- rec_offsets = static_cast<ulint*>(
+ rec_offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof *rec_offsets));
- prev_rec_offsets = static_cast<ulint*>(
+ prev_rec_offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof *prev_rec_offsets));
rec_offs_set_n_alloc(rec_offsets, i);
rec_offs_set_n_alloc(prev_rec_offsets, i);
@@ -1166,13 +1179,9 @@ dict_stats_analyze_index_level(
prev_rec, index, prev_rec_offsets, !level,
n_uniq, &heap);
- cmp_rec_rec_with_match(rec,
- prev_rec,
- rec_offsets,
- prev_rec_offsets,
- index,
- FALSE,
- &matched_fields);
+ cmp_rec_rec(prev_rec, rec,
+ prev_rec_offsets, rec_offsets, index,
+ false, &matched_fields);
for (i = matched_fields; i < n_uniq; i++) {
@@ -1328,11 +1337,11 @@ to the number of externally stored pages which were encountered
@return offsets1 or offsets2 (the offsets of *out_rec),
or NULL if the page is empty and does not contain user records. */
UNIV_INLINE
-ulint*
+rec_offs*
dict_stats_scan_page(
const rec_t** out_rec,
- ulint* offsets1,
- ulint* offsets2,
+ rec_offs* offsets1,
+ rec_offs* offsets2,
const dict_index_t* index,
const page_t* page,
ulint n_prefix,
@@ -1340,8 +1349,8 @@ dict_stats_scan_page(
ib_uint64_t* n_diff,
ib_uint64_t* n_external_pages)
{
- ulint* offsets_rec = offsets1;
- ulint* offsets_next_rec = offsets2;
+ rec_offs* offsets_rec = offsets1;
+ rec_offs* offsets_next_rec = offsets2;
const rec_t* rec;
const rec_t* next_rec;
/* A dummy heap, to be passed to rec_get_offsets().
@@ -1392,9 +1401,8 @@ dict_stats_scan_page(
/* check whether rec != next_rec when looking at
the first n_prefix fields */
- cmp_rec_rec_with_match(rec, next_rec,
- offsets_rec, offsets_next_rec,
- index, FALSE, &matched_fields);
+ cmp_rec_rec(rec, next_rec, offsets_rec, offsets_next_rec,
+ index, false, &matched_fields);
if (matched_fields < n_prefix) {
/* rec != next_rec, => rec is non-boring */
@@ -1407,23 +1415,16 @@ dict_stats_scan_page(
}
rec = next_rec;
- {
- /* Assign offsets_rec = offsets_next_rec
- so that offsets_rec matches with rec which
- was just assigned rec = next_rec above.
- Also need to point offsets_next_rec to the
- place where offsets_rec was pointing before
- because we have just 2 placeholders where
- data is actually stored:
- offsets1 and offsets2 and we
- are using them in circular fashion
- (offsets[_next]_rec are just pointers to
- those placeholders). */
- ulint* offsets_tmp;
- offsets_tmp = offsets_rec;
- offsets_rec = offsets_next_rec;
- offsets_next_rec = offsets_tmp;
- }
+ /* Assign offsets_rec = offsets_next_rec so that
+ offsets_rec matches with rec which was just assigned
+ rec = next_rec above. Also need to point
+ offsets_next_rec to the place where offsets_rec was
+ pointing before because we have just 2 placeholders
+ where data is actually stored: offsets1 and offsets2
+ and we are using them in circular fashion
+ (offsets[_next]_rec are just pointers to those
+ placeholders). */
+ std::swap(offsets_rec, offsets_next_rec);
if (should_count_external_pages) {
*n_external_pages += btr_rec_get_externally_stored_len(
@@ -1462,9 +1463,9 @@ dict_stats_analyze_index_below_cur(
const page_t* page;
mem_heap_t* heap;
const rec_t* rec;
- ulint* offsets1;
- ulint* offsets2;
- ulint* offsets_rec;
+ rec_offs* offsets1;
+ rec_offs* offsets2;
+ rec_offs* offsets_rec;
ulint size;
mtr_t mtr;
@@ -1482,10 +1483,10 @@ dict_stats_analyze_index_below_cur(
heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2));
- offsets1 = static_cast<ulint*>(mem_heap_alloc(
+ offsets1 = static_cast<rec_offs*>(mem_heap_alloc(
heap, size * sizeof *offsets1));
- offsets2 = static_cast<ulint*>(mem_heap_alloc(
+ offsets2 = static_cast<rec_offs*>(mem_heap_alloc(
heap, size * sizeof *offsets2));
rec_offs_set_n_alloc(offsets1, size);
@@ -1747,7 +1748,7 @@ dict_stats_analyze_index_for_n_prefix(
ut_rnd_interval() to work with too big numbers since
ib_uint64_t could be bigger than ulint */
const ulint rnd = ut_rnd_interval(
- 0, static_cast<ulint>(right - left));
+ static_cast<ulint>(right - left));
const ib_uint64_t dive_below_idx
= boundaries->at(static_cast<unsigned>(left + rnd));
@@ -1819,16 +1820,31 @@ dict_stats_analyze_index_for_n_prefix(
btr_pcur_close(&pcur);
}
+/** statistics for an index */
+struct index_stats_t
+{
+ std::vector<index_field_stats_t> stats;
+ ulint index_size;
+ ulint n_leaf_pages;
+
+ index_stats_t(ulint n_uniq) : index_size(1), n_leaf_pages(1)
+ {
+ stats.reserve(n_uniq);
+ for (ulint i= 0; i < n_uniq; ++i)
+ stats.push_back(index_field_stats_t(0, 1, 0));
+ }
+};
+
/** Set dict_index_t::stat_n_diff_key_vals[] and stat_n_sample_sizes[].
@param[in] n_diff_data input data to use to derive the results
-@param[in,out] index index whose stat_n_diff_key_vals[] to set */
+@param[in,out] index_stats index stats to set */
UNIV_INLINE
void
dict_stats_index_set_n_diff(
const n_diff_data_t* n_diff_data,
- dict_index_t* index)
+ index_stats_t& index_stats)
{
- for (ulint n_prefix = dict_index_get_n_unique(index);
+ for (ulint n_prefix = index_stats.stats.size();
n_prefix >= 1;
n_prefix--) {
/* n_diff_all_analyzed_pages can be 0 here if
@@ -1859,14 +1875,14 @@ dict_stats_index_set_n_diff(
that the total number of ordinary leaf pages is
T * D / (D + E). */
n_ordinary_leaf_pages
- = index->stat_n_leaf_pages
+ = index_stats.n_leaf_pages
* data->n_leaf_pages_to_analyze
/ (data->n_leaf_pages_to_analyze
+ data->n_external_pages_sum);
}
/* See REF01 for an explanation of the algorithm */
- index->stat_n_diff_key_vals[n_prefix - 1]
+ index_stats.stats[n_prefix - 1].n_diff_key_vals
= n_ordinary_leaf_pages
* data->n_diff_on_level
@@ -1875,7 +1891,7 @@ dict_stats_index_set_n_diff(
* data->n_diff_all_analyzed_pages
/ data->n_leaf_pages_to_analyze;
- index->stat_n_sample_sizes[n_prefix - 1]
+ index_stats.stats[n_prefix - 1].n_sample_sizes
= data->n_leaf_pages_to_analyze;
DEBUG_PRINTF(" %s(): n_diff=" UINT64PF
@@ -1884,9 +1900,9 @@ dict_stats_index_set_n_diff(
" * " UINT64PF " / " UINT64PF
" * " UINT64PF " / " UINT64PF ")\n",
__func__,
- index->stat_n_diff_key_vals[n_prefix - 1],
+ index_stats.stats[n_prefix - 1].n_diff_key_vals,
n_prefix,
- index->stat_n_leaf_pages,
+ index_stats.n_leaf_pages,
data->n_diff_on_level,
data->n_recs_on_level,
data->n_diff_all_analyzed_pages,
@@ -1894,15 +1910,12 @@ dict_stats_index_set_n_diff(
}
}
-/*********************************************************************//**
-Calculates new statistics for a given index and saves them to the index
+/** Calculates new statistics for a given index and saves them to the index
members stat_n_diff_key_vals[], stat_n_sample_sizes[], stat_index_size and
-stat_n_leaf_pages. This function could be slow. */
-static
-void
-dict_stats_analyze_index(
-/*=====================*/
- dict_index_t* index) /*!< in/out: index to analyze */
+stat_n_leaf_pages. This function can be slow.
+@param[in] index index to analyze
+@return index stats */
+static index_stats_t dict_stats_analyze_index(dict_index_t* index)
{
ulint root_level;
ulint level;
@@ -1913,20 +1926,22 @@ dict_stats_analyze_index(
ib_uint64_t total_pages;
mtr_t mtr;
ulint size;
+ index_stats_t result(index->n_uniq);
DBUG_ENTER("dict_stats_analyze_index");
DBUG_PRINT("info", ("index: %s, online status: %d", index->name(),
dict_index_get_online_status(index)));
+ ut_ad(!mutex_own(&dict_sys->mutex)); // because this function is slow
+ ut_ad(index->table->get_ref_count());
+
/* Disable update statistic for Rtree */
if (dict_index_is_spatial(index)) {
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
}
DEBUG_PRINTF(" %s(index=%s)\n", __func__, index->name());
- dict_stats_empty_index(index, false);
-
mtr_start(&mtr);
mtr_s_lock(dict_index_get_lock(index), &mtr);
@@ -1934,7 +1949,7 @@ dict_stats_analyze_index(
size = btr_get_size(index, BTR_TOTAL_SIZE, &mtr);
if (size != ULINT_UNDEFINED) {
- index->stat_index_size = size;
+ result.index_size = size;
size = btr_get_size(index, BTR_N_LEAF_PAGES, &mtr);
}
@@ -1944,13 +1959,13 @@ dict_stats_analyze_index(
switch (size) {
case ULINT_UNDEFINED:
dict_stats_assert_initialized_index(index);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
case 0:
/* The root node of the tree is a leaf */
size = 1;
}
- index->stat_n_leaf_pages = size;
+ result.n_leaf_pages = size;
mtr_start(&mtr);
@@ -1991,14 +2006,18 @@ dict_stats_analyze_index(
NULL /* boundaries not needed */,
&mtr);
+ mtr_commit(&mtr);
+
+ mutex_enter(&dict_sys->mutex);
for (ulint i = 0; i < n_uniq; i++) {
- index->stat_n_sample_sizes[i] = total_pages;
+ result.stats[i].n_diff_key_vals = index->stat_n_diff_key_vals[i];
+ result.stats[i].n_sample_sizes = total_pages;
+ result.stats[i].n_non_null_key_vals = index->stat_n_non_null_key_vals[i];
}
+ result.n_leaf_pages = index->stat_n_leaf_pages;
+ mutex_exit(&dict_sys->mutex);
- mtr_commit(&mtr);
-
- dict_stats_assert_initialized_index(index);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
}
/* For each level that is being scanned in the btree, this contains the
@@ -2190,13 +2209,12 @@ found_level:
/* n_prefix == 0 means that the above loop did not end up prematurely
due to tree being changed and so n_diff_data[] is set up. */
if (n_prefix == 0) {
- dict_stats_index_set_n_diff(n_diff_data, index);
+ dict_stats_index_set_n_diff(n_diff_data, result);
}
UT_DELETE_ARRAY(n_diff_data);
- dict_stats_assert_initialized_index(index);
- DBUG_VOID_RETURN;
+ DBUG_RETURN(result);
}
/*********************************************************************//**
@@ -2214,7 +2232,7 @@ dict_stats_update_persistent(
DEBUG_PRINTF("%s(table=%s)\n", __func__, table->name);
- dict_table_stats_lock(table, RW_X_LATCH);
+ DEBUG_SYNC_C("dict_stats_update_persistent");
/* analyze the clustered index first */
@@ -2225,15 +2243,26 @@ dict_stats_update_persistent(
|| (index->type | DICT_UNIQUE) != (DICT_CLUSTERED | DICT_UNIQUE)) {
/* Table definition is corrupt */
- dict_table_stats_unlock(table, RW_X_LATCH);
dict_stats_empty_table(table, true);
return(DB_CORRUPTION);
}
ut_ad(!dict_index_is_ibuf(index));
+ mutex_enter(&dict_sys->mutex);
+ dict_stats_empty_index(index, false);
+ mutex_exit(&dict_sys->mutex);
- dict_stats_analyze_index(index);
+ index_stats_t stats = dict_stats_analyze_index(index);
+
+ mutex_enter(&dict_sys->mutex);
+ index->stat_index_size = stats.index_size;
+ index->stat_n_leaf_pages = stats.n_leaf_pages;
+ for (size_t i = 0; i < stats.stats.size(); ++i) {
+ index->stat_n_diff_key_vals[i] = stats.stats[i].n_diff_key_vals;
+ index->stat_n_sample_sizes[i] = stats.stats[i].n_sample_sizes;
+ index->stat_n_non_null_key_vals[i] = stats.stats[i].n_non_null_key_vals;
+ }
ulint n_unique = dict_index_get_n_unique(index);
@@ -2251,7 +2280,7 @@ dict_stats_update_persistent(
ut_ad(!dict_index_is_ibuf(index));
- if (index->type & DICT_FTS || dict_index_is_spatial(index)) {
+ if (index->type & (DICT_FTS | DICT_SPATIAL)) {
continue;
}
@@ -2262,7 +2291,20 @@ dict_stats_update_persistent(
}
if (!(table->stats_bg_flag & BG_STAT_SHOULD_QUIT)) {
- dict_stats_analyze_index(index);
+ mutex_exit(&dict_sys->mutex);
+ stats = dict_stats_analyze_index(index);
+ mutex_enter(&dict_sys->mutex);
+
+ index->stat_index_size = stats.index_size;
+ index->stat_n_leaf_pages = stats.n_leaf_pages;
+ for (size_t i = 0; i < stats.stats.size(); ++i) {
+ index->stat_n_diff_key_vals[i]
+ = stats.stats[i].n_diff_key_vals;
+ index->stat_n_sample_sizes[i]
+ = stats.stats[i].n_sample_sizes;
+ index->stat_n_non_null_key_vals[i]
+ = stats.stats[i].n_non_null_key_vals;
+ }
}
table->stat_sum_of_other_index_sizes
@@ -2277,7 +2319,7 @@ dict_stats_update_persistent(
dict_stats_assert_initialized(table);
- dict_table_stats_unlock(table, RW_X_LATCH);
+ mutex_exit(&dict_sys->mutex);
return(DB_SUCCESS);
}
@@ -2321,20 +2363,19 @@ dict_stats_save_index_stat(
pars_info_add_str_literal(pinfo, "database_name", db_utf8);
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
pars_info_add_str_literal(pinfo, "index_name", index->name);
- UNIV_MEM_ASSERT_RW_ABORT(&last_update, 4);
+ MEM_CHECK_DEFINED(&last_update, 4);
pars_info_add_int4_literal(pinfo, "last_update", (lint)last_update);
- UNIV_MEM_ASSERT_RW_ABORT(stat_name, strlen(stat_name));
+ MEM_CHECK_DEFINED(stat_name, strlen(stat_name));
pars_info_add_str_literal(pinfo, "stat_name", stat_name);
- UNIV_MEM_ASSERT_RW_ABORT(&stat_value, 8);
+ MEM_CHECK_DEFINED(&stat_value, 8);
pars_info_add_ull_literal(pinfo, "stat_value", stat_value);
if (sample_size != NULL) {
- UNIV_MEM_ASSERT_RW_ABORT(sample_size, 8);
+ MEM_CHECK_DEFINED(sample_size, 8);
pars_info_add_ull_literal(pinfo, "sample_size", *sample_size);
} else {
pars_info_add_literal(pinfo, "sample_size", NULL,
UNIV_SQL_NULL, DATA_FIXBINARY, 0);
}
- UNIV_MEM_ASSERT_RW_ABORT(stat_description, strlen(stat_description));
pars_info_add_str_literal(pinfo, "stat_description",
stat_description);
@@ -2364,14 +2405,14 @@ dict_stats_save_index_stat(
");\n"
"END;", trx);
- if (ret != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(ret != DB_SUCCESS)) {
if (innodb_index_stats_not_found == false &&
index->stats_error_printed == false) {
ib::error() << "Cannot save index statistics for table "
<< index->table->name
<< ", index " << index->name
<< ", stat name \"" << stat_name << "\": "
- << ut_strerr(ret);
+ << ret;
index->stats_error_printed = true;
}
}
@@ -2482,9 +2523,9 @@ dict_stats_save(
");\n"
"END;", NULL);
- if (ret != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(ret != DB_SUCCESS)) {
ib::error() << "Cannot save table statistics for table "
- << table->name << ": " << ut_strerr(ret);
+ << table->name << ": " << ret;
mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(&dict_operation_lock);
@@ -3106,11 +3147,22 @@ dict_stats_update_for_index(
if (dict_stats_is_persistent_enabled(index->table)) {
if (dict_stats_persistent_storage_check(false)) {
- dict_table_stats_lock(index->table, RW_X_LATCH);
- dict_stats_analyze_index(index);
+ index_stats_t stats = dict_stats_analyze_index(index);
+ mutex_enter(&dict_sys->mutex);
+ index->stat_index_size = stats.index_size;
+ index->stat_n_leaf_pages = stats.n_leaf_pages;
+ for (size_t i = 0; i < stats.stats.size(); ++i) {
+ index->stat_n_diff_key_vals[i]
+ = stats.stats[i].n_diff_key_vals;
+ index->stat_n_sample_sizes[i]
+ = stats.stats[i].n_sample_sizes;
+ index->stat_n_non_null_key_vals[i]
+ = stats.stats[i].n_non_null_key_vals;
+ }
index->table->stat_sum_of_other_index_sizes
+= index->stat_index_size;
- dict_table_stats_unlock(index->table, RW_X_LATCH);
+ mutex_exit(&dict_sys->mutex);
+
dict_stats_save(index->table, &index->id);
DBUG_VOID_RETURN;
}
@@ -3131,9 +3183,7 @@ dict_stats_update_for_index(
}
}
- dict_table_stats_lock(index->table, RW_X_LATCH);
dict_stats_update_transient_for_index(index);
- dict_table_stats_unlock(index->table, RW_X_LATCH);
DBUG_VOID_RETURN;
}
@@ -3287,7 +3337,7 @@ dict_stats_update(
switch (err) {
case DB_SUCCESS:
- dict_table_stats_lock(table, RW_X_LATCH);
+ mutex_enter(&dict_sys->mutex);
/* Pass reset_ignored_indexes=true as parameter
to dict_stats_copy. This will cause statictics
@@ -3296,7 +3346,7 @@ dict_stats_update(
dict_stats_assert_initialized(table);
- dict_table_stats_unlock(table, RW_X_LATCH);
+ mutex_exit(&dict_sys->mutex);
dict_stats_table_clone_free(t);
@@ -3339,7 +3389,7 @@ dict_stats_update(
" for table "
<< table->name
<< " from " TABLE_STATS_NAME_PRINT " and "
- INDEX_STATS_NAME_PRINT ": " << ut_strerr(err)
+ INDEX_STATS_NAME_PRINT ": " << err
<< ". Using transient stats method instead.";
}
@@ -3350,13 +3400,8 @@ dict_stats_update(
}
transient:
-
- dict_table_stats_lock(table, RW_X_LATCH);
-
dict_stats_update_transient(table);
- dict_table_stats_unlock(table, RW_X_LATCH);
-
return(DB_SUCCESS);
}
@@ -4017,6 +4062,9 @@ test_dict_stats_save()
table.stat_clustered_index_size = TEST_CLUSTERED_INDEX_SIZE;
table.stat_sum_of_other_index_sizes = TEST_SUM_OF_OTHER_INDEX_SIZES;
UT_LIST_INIT(table.indexes, &dict_index_t::indexes);
+#ifdef BTR_CUR_HASH_ADAPT
+ UT_LIST_INIT(table.freed_indexes, &dict_index_t::indexes);
+#endif /* BTR_CUR_HASH_ADAPT */
UT_LIST_ADD_LAST(table.indexes, &index1);
UT_LIST_ADD_LAST(table.indexes, &index2);
ut_d(table.magic_n = DICT_TABLE_MAGIC_N);
@@ -4166,6 +4214,9 @@ test_dict_stats_fetch_from_ps()
/* craft a dummy dict_table_t */
table.name.m_name = (char*) (TEST_DATABASE_NAME "/" TEST_TABLE_NAME);
UT_LIST_INIT(table.indexes, &dict_index_t::indexes);
+#ifdef BTR_CUR_HASH_ADAPT
+ UT_LIST_INIT(table.freed_indexes, &dict_index_t::indexes);
+#endif /* BTR_CUR_HASH_ADAPT */
UT_LIST_ADD_LAST(table.indexes, &index1);
UT_LIST_ADD_LAST(table.indexes, &index2);
ut_d(table.magic_n = DICT_TABLE_MAGIC_N);
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index ec3f0a8eae6..589f53dde38 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -32,6 +32,7 @@ Created Apr 25, 2012 Vasil Dimov
#include "srv0start.h"
#include "fil0fil.h"
#ifdef WITH_WSREP
+# include "trx0trx.h"
# include "mysql/service_wsrep.h"
# include "wsrep.h"
# include "log.h"
@@ -145,12 +146,12 @@ dict_stats_recalc_pool_add(
schedule new estimates for table and index statistics to be calculated.
@param[in,out] table persistent or temporary table
@param[in] thd current session */
-void dict_stats_update_if_needed(dict_table_t* table, THD* thd)
+void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx)
#else
/** Update the table modification counter and if necessary,
schedule new estimates for table and index statistics to be calculated.
@param[in,out] table persistent or temporary table */
-void dict_stats_update_if_needed_func(dict_table_t* table)
+void dict_stats_update_if_needed_func(dict_table_t *table)
#endif
{
ut_ad(table->stat_initialized);
@@ -177,10 +178,9 @@ void dict_stats_update_if_needed_func(dict_table_t* table)
generated row locks and allow BF thread
lock waits to be enqueued at head of waiting
queue. */
- if (thd
- && !wsrep_thd_is_applier(thd)
- && wsrep_on(thd)
- && wsrep_thd_is_BF(thd, 0)) {
+ if (trx.is_wsrep()
+ && !wsrep_thd_is_applier(trx.mysql_thd)
+ && wsrep_thd_is_BF(trx.mysql_thd, 0)) {
WSREP_DEBUG("Avoiding background statistics"
" calculation for table %s.",
table->name.m_name);
diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc
index e02fc7f561b..6f709707f7f 100644
--- a/storage/innobase/eval/eval0eval.cc
+++ b/storage/innobase/eval/eval0eval.cc
@@ -30,9 +30,6 @@ Created 12/29/1997 Heikki Tuuri
#include "row0sel.h"
#include "rem0cmp.h"
-/** The RND function seed */
-static ulint eval_rnd = 128367121;
-
/** Dummy adress used when we should allocate a buffer of size 0 in
eval_node_alloc_val_buf */
@@ -310,120 +307,18 @@ eval_aggregate(
/*===========*/
func_node_t* node) /*!< in: aggregate operation node */
{
- que_node_t* arg;
lint val;
- lint arg_val;
- int func;
ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
val = eval_node_get_int_val(node);
- func = node->func;
-
- if (func == PARS_COUNT_TOKEN) {
-
- val = val + 1;
- } else {
- ut_ad(func == PARS_SUM_TOKEN);
-
- arg = node->args;
- arg_val = eval_node_get_int_val(arg);
-
- val = val + arg_val;
- }
-
+ ut_a(node->func == PARS_COUNT_TOKEN);
+ val = val + 1;
eval_node_set_int_val(node, val);
}
/*****************************************************************//**
-Evaluates a predefined function node where the function is not relevant
-in benchmarks. */
-static
-void
-eval_predefined_2(
-/*==============*/
- func_node_t* func_node) /*!< in: predefined function node */
-{
- que_node_t* arg;
- que_node_t* arg1;
- que_node_t* arg2 = 0; /* remove warning (??? bug ???) */
- lint int_val;
- byte* data;
- ulint len1;
- ulint len2;
- int func;
- ulint i;
-
- ut_ad(que_node_get_type(func_node) == QUE_NODE_FUNC);
-
- arg1 = func_node->args;
-
- if (arg1) {
- arg2 = que_node_get_next(arg1);
- }
-
- func = func_node->func;
-
- if (func == PARS_PRINTF_TOKEN) {
-
- arg = arg1;
-
- while (arg) {
- dfield_print(que_node_get_val(arg));
-
- arg = que_node_get_next(arg);
- }
-
- putc('\n', stderr);
-
- } else if (func == PARS_ASSERT_TOKEN) {
-
- if (!eval_node_get_ibool_val(arg1)) {
- fputs("SQL assertion fails in a stored procedure!\n",
- stderr);
- }
-
- ut_a(eval_node_get_ibool_val(arg1));
-
- /* This function, or more precisely, a debug procedure,
- returns no value */
-
- } else if (func == PARS_RND_TOKEN) {
-
- len1 = (ulint) eval_node_get_int_val(arg1);
- len2 = (ulint) eval_node_get_int_val(arg2);
-
- ut_ad(len2 >= len1);
-
- if (len2 > len1) {
- int_val = (lint) (len1
- + (eval_rnd % (len2 - len1 + 1)));
- } else {
- int_val = (lint) len1;
- }
-
- eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
-
- eval_node_set_int_val(func_node, int_val);
-
- } else if (func == PARS_RND_STR_TOKEN) {
-
- len1 = (ulint) eval_node_get_int_val(arg1);
-
- data = eval_node_ensure_val_buf(func_node, len1);
-
- for (i = 0; i < len1; i++) {
- data[i] = (byte)(97 + (eval_rnd % 3));
-
- eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
- }
- } else {
- ut_error;
- }
-}
-
-/*****************************************************************//**
Evaluates a notfound-function node. */
UNIV_INLINE
void
@@ -494,46 +389,6 @@ eval_substr(
}
/*****************************************************************//**
-Evaluates a replstr-procedure node. */
-static
-void
-eval_replstr(
-/*=========*/
- func_node_t* func_node) /*!< in: function node */
-{
- que_node_t* arg1;
- que_node_t* arg2;
- que_node_t* arg3;
- que_node_t* arg4;
- byte* str1;
- byte* str2;
- ulint len1;
- ulint len2;
-
- arg1 = func_node->args;
- arg2 = que_node_get_next(arg1);
-
- ut_ad(que_node_get_type(arg1) == QUE_NODE_SYMBOL);
-
- arg3 = que_node_get_next(arg2);
- arg4 = que_node_get_next(arg3);
-
- str1 = static_cast<byte*>(dfield_get_data(que_node_get_val(arg1)));
- str2 = static_cast<byte*>(dfield_get_data(que_node_get_val(arg2)));
-
- len1 = (ulint) eval_node_get_int_val(arg3);
- len2 = (ulint) eval_node_get_int_val(arg4);
-
- if ((dfield_get_len(que_node_get_val(arg1)) < len1 + len2)
- || (dfield_get_len(que_node_get_val(arg2)) < len2)) {
-
- ut_error;
- }
-
- ut_memcpy(str1 + len1, str2, len2);
-}
-
-/*****************************************************************//**
Evaluates an instr-function node. */
static
void
@@ -607,44 +462,6 @@ match_found:
/*****************************************************************//**
Evaluates a predefined function node. */
-UNIV_INLINE
-void
-eval_binary_to_number(
-/*==================*/
- func_node_t* func_node) /*!< in: function node */
-{
- que_node_t* arg1;
- dfield_t* dfield;
- byte* str1;
- byte* str2;
- ulint len1;
- ulint int_val;
-
- arg1 = func_node->args;
-
- dfield = que_node_get_val(arg1);
-
- str1 = static_cast<byte*>(dfield_get_data(dfield));
- len1 = dfield_get_len(dfield);
-
- if (len1 > 4) {
- ut_error;
- }
-
- if (len1 == 4) {
- str2 = str1;
- } else {
- int_val = 0;
- str2 = (byte*) &int_val;
-
- ut_memcpy(str2 + (4 - len1), str1, len1);
- }
-
- eval_node_copy_and_alloc_val(func_node, str2, 4);
-}
-
-/*****************************************************************//**
-Evaluates a predefined function node. */
static
void
eval_concat(
@@ -734,95 +551,12 @@ eval_to_binary(
}
/*****************************************************************//**
-Evaluates a predefined function node. */
-UNIV_INLINE
-void
-eval_predefined(
-/*============*/
- func_node_t* func_node) /*!< in: function node */
+Evaluate LENGTH(). */
+inline void eval_length(func_node_t* func_node)
{
- que_node_t* arg1;
- lint int_val;
- byte* data;
- int func;
-
- func = func_node->func;
-
- arg1 = func_node->args;
-
- if (func == PARS_LENGTH_TOKEN) {
-
- int_val = (lint) dfield_get_len(que_node_get_val(arg1));
-
- } else if (func == PARS_TO_CHAR_TOKEN) {
-
- /* Convert number to character string as a
- signed decimal integer. */
-
- ulint uint_val;
- int int_len;
-
- int_val = eval_node_get_int_val(arg1);
-
- /* Determine the length of the string. */
-
- if (int_val == 0) {
- int_len = 1; /* the number 0 occupies 1 byte */
- } else {
- int_len = 0;
- if (int_val < 0) {
- uint_val = ((ulint) -int_val - 1) + 1;
- int_len++; /* reserve space for minus sign */
- } else {
- uint_val = (ulint) int_val;
- }
- for (; uint_val > 0; int_len++) {
- uint_val /= 10;
- }
- }
-
- /* allocate the string */
- data = eval_node_ensure_val_buf(func_node, int_len + 1);
-
- /* add terminating NUL character */
- data[int_len] = 0;
-
- /* convert the number */
-
- if (int_val == 0) {
- data[0] = '0';
- } else {
- int tmp;
- if (int_val < 0) {
- data[0] = '-'; /* preceding minus sign */
- uint_val = ((ulint) -int_val - 1) + 1;
- } else {
- uint_val = (ulint) int_val;
- }
- for (tmp = int_len; uint_val > 0; uint_val /= 10) {
- data[--tmp] = (byte)
- ('0' + (byte)(uint_val % 10));
- }
- }
-
- dfield_set_len(que_node_get_val(func_node), int_len);
-
- return;
-
- } else if (func == PARS_TO_NUMBER_TOKEN) {
-
- int_val = atoi((char*)
- dfield_get_data(que_node_get_val(arg1)));
-
- } else if (func == PARS_SYSDATE_TOKEN) {
- int_val = (lint) time(NULL);
- } else {
- eval_predefined_2(func_node);
-
- return;
- }
-
- eval_node_set_int_val(func_node, int_val);
+ eval_node_set_int_val(func_node,
+ dfield_get_len(que_node_get_val
+ (func_node->args)));
}
/*****************************************************************//**
@@ -852,8 +586,7 @@ eval_func(
if (dfield_is_null(que_node_get_val(arg))
&& (fclass != PARS_FUNC_CMP)
- && (func != PARS_NOTFOUND_TOKEN)
- && (func != PARS_PRINTF_TOKEN)) {
+ && (func != PARS_NOTFOUND_TOKEN)) {
ut_error;
}
@@ -878,24 +611,20 @@ eval_func(
case PARS_SUBSTR_TOKEN:
eval_substr(func_node);
return;
- case PARS_REPLSTR_TOKEN:
- eval_replstr(func_node);
- return;
case PARS_INSTR_TOKEN:
eval_instr(func_node);
return;
- case PARS_BINARY_TO_NUMBER_TOKEN:
- eval_binary_to_number(func_node);
- return;
case PARS_CONCAT_TOKEN:
eval_concat(func_node);
return;
case PARS_TO_BINARY_TOKEN:
eval_to_binary(func_node);
return;
- default:
- eval_predefined(func_node);
+ case PARS_LENGTH_TOKEN:
+ eval_length(func_node);
return;
+ default:
+ ut_error;
}
case PARS_FUNC_LOGICAL:
eval_logical(func_node);
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index d1aca92ef62..68a8a9be261 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -41,9 +41,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "fil0pagecompress.h"
#include <my_crypt.h>
-/** Mutex for keys */
-static ib_mutex_t fil_crypt_key_mutex;
-
static bool fil_crypt_threads_inited = false;
/** Is encryption enabled/disabled */
@@ -113,8 +110,6 @@ UNIV_INTERN
void
fil_space_crypt_init()
{
- mutex_create(LATCH_ID_FIL_CRYPT_MUTEX, &fil_crypt_key_mutex);
-
fil_crypt_throttle_sleep_event = os_event_create(0);
mutex_create(LATCH_ID_FIL_CRYPT_STAT_MUTEX, &crypt_stat_mutex);
@@ -128,7 +123,6 @@ void
fil_space_crypt_cleanup()
{
os_event_destroy(fil_crypt_throttle_sleep_event);
- mutex_free(&fil_crypt_key_mutex);
mutex_free(&crypt_stat_mutex);
}
@@ -298,14 +292,9 @@ fil_space_read_crypt_data(const page_size_t& page_size, const byte* page)
type == CRYPT_SCHEME_1)
|| iv_length != sizeof crypt_data->iv) {
ib::error() << "Found non sensible crypt scheme: "
- << type << "," << iv_length << " for space: "
- << page_get_space_id(page) << " offset: "
- << offset << " bytes: ["
- << page[offset + 2 + MAGIC_SZ]
- << page[offset + 3 + MAGIC_SZ]
- << page[offset + 4 + MAGIC_SZ]
- << page[offset + 5 + MAGIC_SZ]
- << "].";
+ << type << "," << iv_length
+ << " for space: "
+ << page_get_space_id(page);
return NULL;
}
@@ -418,6 +407,8 @@ fil_space_crypt_t::write_page0(
mlog_write_ulint(page + offset + MAGIC_SZ + 2 + len + 8, encryption,
MLOG_1BYTE, mtr);
+ DBUG_EXECUTE_IF("ib_do_not_log_crypt_data", return;);
+
byte* log_ptr = mlog_open(mtr, 11 + 17 + len);
if (log_ptr != NULL) {
@@ -655,51 +646,10 @@ fil_space_encrypt(
return (src_frame);
}
- fil_space_crypt_t* crypt_data = space->crypt_data;
- const page_size_t page_size(space->flags);
ut_ad(space->n_pending_ios > 0);
- byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn,
- src_frame, page_size, dst_frame);
-
-#ifdef UNIV_DEBUG
- if (tmp) {
- /* Verify that encrypted buffer is not corrupted */
- dberr_t err = DB_SUCCESS;
- byte* src = src_frame;
- bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
- byte tmp_mem[UNIV_PAGE_SIZE_MAX];
-
- if (page_compressed_encrypted) {
- memcpy(uncomp_mem, src, srv_page_size);
- ulint unzipped1 = fil_page_decompress(
- tmp_mem, uncomp_mem);
- ut_ad(unzipped1);
- if (unzipped1 != srv_page_size) {
- src = uncomp_mem;
- }
- }
-
- ut_ad(!buf_page_is_corrupted(true, src, page_size, space));
- ut_ad(fil_space_decrypt(crypt_data, tmp_mem, page_size, tmp,
- &err));
- ut_ad(err == DB_SUCCESS);
-
- /* Need to decompress the page if it was also compressed */
- if (page_compressed_encrypted) {
- byte buf[UNIV_PAGE_SIZE_MAX];
- memcpy(buf, tmp_mem, srv_page_size);
- ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
- ut_ad(unzipped2);
- }
-
- memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
- ut_ad(!memcmp(src, tmp_mem, page_size.physical()));
- }
-#endif /* UNIV_DEBUG */
-
- return tmp;
+ return fil_encrypt_buf(space->crypt_data, space->id, offset, lsn,
+ src_frame, page_size_t(space->flags),
+ dst_frame);
}
/** Decrypt a page.
@@ -766,8 +716,10 @@ fil_space_decrypt(
}
ib::fatal() << "Unable to decrypt data-block "
- << " src: " << src << "srclen: "
- << srclen << " buf: " << dst << "buflen: "
+ << " src: " << static_cast<const void*>(src)
+ << "srclen: "
+ << srclen << " buf: "
+ << static_cast<const void*>(dst) << "buflen: "
<< dstlen << " return-code: " << rc
<< " Can't continue!";
}
@@ -1120,6 +1072,7 @@ struct rotate_thread_t {
case SRV_SHUTDOWN_EXIT_THREADS:
/* srv_init_abort() must have been invoked */
case SRV_SHUTDOWN_CLEANUP:
+ case SRV_SHUTDOWN_INITIATED:
return true;
case SRV_SHUTDOWN_FLUSH_PHASE:
case SRV_SHUTDOWN_LAST_PHASE:
@@ -1427,6 +1380,99 @@ fil_crypt_return_iops(
fil_crypt_update_total_stat(state);
}
+/** Return the next tablespace from rotation_list.
+@param space previous tablespace (NULL to start from the start)
+@param recheck whether the removal condition needs to be rechecked after
+the encryption parameters were changed
+@param encrypt expected state of innodb_encrypt_tables
+@return the next tablespace to process (n_pending_ops incremented)
+@retval NULL if this was the last */
+inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
+ bool recheck, bool encrypt)
+{
+ ut_ad(mutex_own(&mutex));
+
+ sized_ilist<fil_space_t, rotation_list_tag_t>::iterator it=
+ space && space->is_in_rotation_list ? space : rotation_list.begin();
+ const sized_ilist<fil_space_t, rotation_list_tag_t>::iterator end=
+ rotation_list.end();
+
+ if (space)
+ {
+ const bool released= !--space->n_pending_ops;
+
+ if (space->is_in_rotation_list)
+ {
+ while (++it != end &&
+ (!UT_LIST_GET_LEN(it->chain) || it->is_stopping()));
+
+ /* If one of the encryption threads already started the encryption
+ of the table then don't remove the unencrypted spaces from rotation list
+
+ If there is a change in innodb_encrypt_tables variables value then
+ don't remove the last processed tablespace from the rotation list. */
+ if (released && (!recheck || space->crypt_data) &&
+ !encrypt == !srv_encrypt_tables)
+ {
+ ut_a(!rotation_list.empty());
+ rotation_list.remove(*space);
+ space->is_in_rotation_list= false;
+ }
+ }
+ }
+
+ if (it == end)
+ return NULL;
+
+ space= &*it;
+ space->n_pending_ops++;
+ return space;
+}
+
+/** Return the next tablespace.
+@param space previous tablespace (NULL to start from the beginning)
+@param recheck whether the removal condition needs to be rechecked after
+the encryption parameters were changed
+@param encrypt expected state of innodb_encrypt_tables
+@return pointer to the next tablespace (with n_pending_ops incremented)
+@retval NULL if this was the last */
+static fil_space_t *fil_space_next(fil_space_t *space, bool recheck,
+ bool encrypt)
+{
+ mutex_enter(&fil_system->mutex);
+ ut_ad(!space || space->n_pending_ops);
+
+ if (!srv_fil_crypt_rotate_key_age)
+ space= fil_system->keyrotate_next(space, recheck, encrypt);
+ else if (!space)
+ {
+ space= UT_LIST_GET_FIRST(fil_system->space_list);
+ /* We can trust that space is not NULL because at least the
+ system tablespace is always present and loaded first. */
+ space->n_pending_ops++;
+ }
+ else
+ {
+ ut_ad(space->n_pending_ops > 0);
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ /* Skip abnormal tablespaces or those that are being created by
+ fil_ibd_create(), or being dropped. */
+ while (space &&
+ (UT_LIST_GET_LEN(space->chain) == 0 ||
+ space->is_stopping() || space->purpose != FIL_TYPE_TABLESPACE))
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ if (space)
+ space->n_pending_ops++;
+ }
+
+ mutex_exit(&fil_system->mutex);
+ return space;
+}
+
/** Search for a space needing rotation
@param[in,out] key_state Key state
@param[in,out] state Rotation state
@@ -1439,6 +1485,11 @@ static bool fil_crypt_find_space_to_rotate(
{
/* we need iops to start rotating */
while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) {
+ if (state->space && state->space->is_stopping()) {
+ fil_space_release(state->space);
+ state->space = NULL;
+ }
+
os_event_reset(fil_crypt_threads_event);
os_event_wait_time(fil_crypt_threads_event, 100000);
}
@@ -1459,16 +1510,8 @@ static bool fil_crypt_find_space_to_rotate(
state->space = NULL;
}
- /* If key rotation is enabled (default) we iterate all tablespaces.
- If key rotation is not enabled we iterate only the tablespaces
- added to keyrotation list. */
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_system->keyrotate_next(
- state->space, *recheck,
- key_state->key_version);
- }
+ state->space = fil_space_next(state->space, *recheck,
+ key_state->key_version != 0);
while (!state->should_shutdown() && state->space) {
/* If there is no crypt data and we have not yet read
@@ -1486,16 +1529,16 @@ static bool fil_crypt_find_space_to_rotate(
return true;
}
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_system->keyrotate_next(
- state->space, *recheck,
- key_state->key_version);
- }
+ state->space = fil_space_next(state->space, *recheck,
+ key_state->key_version != 0);
}
- /* if we didn't find any space return iops */
+ if (state->space) {
+ fil_space_release(state->space);
+ state->space = NULL;
+ }
+
+ /* no work to do; release our allocation of I/O capacity */
fil_crypt_return_iops(state);
return false;
@@ -2302,7 +2345,7 @@ static void fil_crypt_rotation_list_fill()
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {
if (space->purpose != FIL_TYPE_TABLESPACE
- || space->is_in_rotation_list()
+ || space->is_in_rotation_list
|| space->is_stopping()
|| UT_LIST_GET_LEN(space->chain) == 0) {
continue;
@@ -2346,7 +2389,8 @@ static void fil_crypt_rotation_list_fill()
}
}
- UT_LIST_ADD_LAST(fil_system->rotation_list, space);
+ fil_system->rotation_list.push_back(*space);
+ space->is_in_rotation_list = true;
}
}
@@ -2469,6 +2513,7 @@ fil_space_crypt_close_tablespace(
/* wakeup throttle (all) sleepers */
os_event_set(fil_crypt_throttle_sleep_event);
+ os_event_set(fil_crypt_threads_event);
os_thread_sleep(20000);
dict_mutex_enter_for_mysql();
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index e37cb963c28..328cd104e5d 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, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -359,34 +359,6 @@ fil_space_get(
return(space);
}
-/** Returns the latch of a file space.
-@param[in] id space id
-@param[out] flags tablespace flags
-@return latch protecting storage allocation */
-rw_lock_t*
-fil_space_get_latch(
- ulint id,
- ulint* flags)
-{
- fil_space_t* space;
-
- ut_ad(fil_system);
-
- mutex_enter(&fil_system->mutex);
-
- space = fil_space_get_by_id(id);
-
- ut_a(space);
-
- if (flags) {
- *flags = space->flags;
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(&(space->latch));
-}
-
/** Gets the type of a file space.
@param[in] id tablespace identifier
@return file type */
@@ -593,13 +565,17 @@ bool fil_node_t::read_page0(bool first)
}
this->size = ulint(size_bytes / psize);
- space->size += this->size;
+ space->committed_size = space->size += this->size;
} else if (space->id != TRX_SYS_SPACE || space->size_in_header) {
/* If this is not the first-time open, do nothing.
For the system tablespace, we always get invoked as
first=false, so we detect the true first-time-open based
- on size_in_header and proceed to initiailze the data. */
+ on size_in_header and proceed to initialize the data. */
return true;
+ } else {
+ /* Initialize the size of predefined tablespaces
+ to FSP_SIZE. */
+ space->committed_size = size;
}
ut_ad(space->free_limit == 0 || space->free_limit == free_limit);
@@ -629,6 +605,14 @@ static bool fil_node_open_file(fil_node_t* node)
const bool first_time_open = node->size == 0;
+ bool o_direct_possible = !FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
+ if (const ulint ssize = FSP_FLAGS_GET_ZIP_SSIZE(space->flags)) {
+ compile_time_assert(((UNIV_ZIP_SIZE_MIN >> 1) << 3) == 4096);
+ if (ssize < 3) {
+ o_direct_possible = false;
+ }
+ }
+
if (first_time_open
|| (space->purpose == FIL_TYPE_TABLESPACE
&& node == UT_LIST_GET_FIRST(space->chain)
@@ -647,7 +631,12 @@ retry:
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);
+ OS_FILE_AIO,
+ o_direct_possible
+ ? OS_DATA_FILE
+ : OS_DATA_FILE_NO_O_DIRECT,
+ read_only_mode,
+ &success);
if (!success) {
/* The following call prints an error message */
@@ -678,7 +667,12 @@ retry:
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);
+ OS_FILE_AIO,
+ o_direct_possible
+ ? OS_DATA_FILE
+ : OS_DATA_FILE_NO_O_DIRECT,
+ read_only_mode,
+ &success);
}
if (space->purpose != FIL_TYPE_LOG) {
@@ -832,7 +826,7 @@ static void fil_flush_low(fil_space_t* space, bool metadata = false)
/* 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);
@@ -895,12 +889,11 @@ static void fil_flush_low(fil_space_t* space, bool metadata = false)
skip_flush:
#endif /* _WIN32 */
if (!node->needs_flush) {
- if (space->is_in_unflushed_spaces()
+ if (space->is_in_unflushed_spaces
&& fil_space_is_flushed(space)) {
- UT_LIST_REMOVE(
- fil_system->unflushed_spaces,
- space);
+ fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
}
@@ -1127,6 +1120,9 @@ fil_mutex_enter_and_prepare_for_io(
ut_a(success);
/* InnoDB data files cannot shrink. */
ut_a(space->size >= size);
+ if (size > space->committed_size) {
+ space->committed_size = size;
+ }
/* There could be multiple concurrent I/O requests for
this tablespace (multiple threads trying to extend
@@ -1195,13 +1191,14 @@ fil_node_close_to_free(
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)) {
- UT_LIST_REMOVE(fil_system->unflushed_spaces, space);
+ fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
fil_node_close_file(node);
@@ -1228,16 +1225,18 @@ fil_space_detach(
HASH_DELETE(fil_space_t, name_hash, fil_system->name_hash,
ut_fold_string(space->name), space);
- if (space->is_in_unflushed_spaces()) {
+ if (space->is_in_unflushed_spaces) {
ut_ad(!fil_buffering_disabled(space));
- UT_LIST_REMOVE(fil_system->unflushed_spaces, space);
+ fil_system->unflushed_spaces.remove(*space);
+ space->is_in_unflushed_spaces = false;
}
- if (space->is_in_rotation_list()) {
+ if (space->is_in_rotation_list) {
- UT_LIST_REMOVE(fil_system->rotation_list, space);
+ fil_system->rotation_list.remove(*space);
+ space->is_in_rotation_list = false;
}
UT_LIST_REMOVE(fil_system->space_list, space);
@@ -1463,7 +1462,8 @@ fil_space_create(
srv_encrypt_tables)) {
/* Key rotation is not enabled, need to inform background
encryption threads. */
- UT_LIST_ADD_LAST(fil_system->rotation_list, space);
+ fil_system->rotation_list.push_back(*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);
@@ -1799,8 +1799,7 @@ fil_init(
ut_a(hash_size > 0);
ut_a(max_n_open > 0);
- fil_system = static_cast<fil_system_t*>(
- ut_zalloc_nokey(sizeof(*fil_system)));
+ fil_system = new fil_system_t();
mutex_create(LATCH_ID_FIL_SYSTEM, &fil_system->mutex);
@@ -1809,9 +1808,6 @@ fil_init(
UT_LIST_INIT(fil_system->LRU, &fil_node_t::LRU);
UT_LIST_INIT(fil_system->space_list, &fil_space_t::space_list);
- UT_LIST_INIT(fil_system->rotation_list, &fil_space_t::rotation_list);
- UT_LIST_INIT(fil_system->unflushed_spaces,
- &fil_space_t::unflushed_spaces);
UT_LIST_INIT(fil_system->named_spaces, &fil_space_t::named_spaces);
fil_system->max_n_open = max_n_open;
@@ -2867,14 +2863,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- )
+dberr_t fil_delete_tablespace(ulint id, bool if_exists)
{
char* path = 0;
fil_space_t* space = 0;
@@ -2885,10 +2876,11 @@ fil_delete_tablespace(
id, FIL_OPERATION_DELETE, &space, &path);
if (err != DB_SUCCESS) {
-
- ib::error() << "Cannot delete tablespace " << id
- << " because it is not found in the tablespace"
- " memory cache.";
+ if (!if_exists) {
+ ib::error() << "Cannot delete tablespace " << id
+ << " because it is not found"
+ " in the tablespace memory cache.";
+ }
return(err);
}
@@ -3129,10 +3121,10 @@ fil_reinit_space_header_for_table(
dict_table_x_unlock_indexes(table);
row_mysql_unlock_data_dictionary(trx);
+ DEBUG_SYNC_C("buffer_pool_scan");
/* Lock the search latch in shared mode to prevent user
from disabling AHI during the scan */
btr_search_s_lock_all();
- DEBUG_SYNC_C("buffer_pool_scan");
buf_LRU_flush_or_remove_pages(id, NULL);
btr_search_s_unlock_all();
@@ -3233,12 +3225,12 @@ fil_discard_tablespace(
case DB_IO_ERROR:
ib::warn() << "While deleting tablespace " << id
<< " in DISCARD TABLESPACE. File rename/delete"
- " failed: " << ut_strerr(err);
+ " failed: " << err;
break;
case DB_TABLESPACE_NOT_FOUND:
ib::warn() << "Cannot delete tablespace " << id
- << " in DISCARD TABLESPACE: " << ut_strerr(err);
+ << " in DISCARD TABLESPACE: " << err;
break;
default:
@@ -4263,6 +4255,7 @@ fil_ibd_discover(
case SRV_OPERATION_RESTORE_DELTA:
ut_ad(0);
break;
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE_EXPORT:
case SRV_OPERATION_RESTORE:
break;
@@ -4360,7 +4353,7 @@ fil_ibd_load(
return(FIL_LOAD_OK);
}
- if (srv_operation == SRV_OPERATION_RESTORE) {
+ if (is_mariabackup_restore()) {
/* Replace absolute DATA DIRECTORY file paths with
short names relative to the backup directory. */
if (const char* name = strrchr(filename, OS_PATH_SEPARATOR)) {
@@ -4760,16 +4753,17 @@ fil_node_complete_io(fil_node_t* node, const IORequest& type)
/* We don't need to keep track of unflushed
changes as user has explicitly disabled
buffering. */
- ut_ad(!node->space->is_in_unflushed_spaces());
+ ut_ad(!node->space->is_in_unflushed_spaces);
ut_ad(node->needs_flush == false);
} else {
node->needs_flush = true;
- if (!node->space->is_in_unflushed_spaces()) {
+ if (!node->space->is_in_unflushed_spaces) {
- UT_LIST_ADD_FIRST(fil_system->unflushed_spaces,
- node->space);
+ fil_system->unflushed_spaces.push_front(
+ *node->space);
+ node->space->is_in_unflushed_spaces = true;
}
}
}
@@ -5180,7 +5174,7 @@ fil_aio_wait(
ib::error() << "Failed to read file '"
<< node->name
<< "' at offset " << offset
- << ": " << ut_strerr(err);
+ << ": " << err;
}
fil_space_release_for_io(space);
@@ -5237,7 +5231,6 @@ void
fil_flush_file_spaces(
fil_type_t purpose)
{
- fil_space_t* space;
ulint* space_ids;
ulint n_space_ids;
@@ -5245,30 +5238,25 @@ fil_flush_file_spaces(
mutex_enter(&fil_system->mutex);
- n_space_ids = UT_LIST_GET_LEN(fil_system->unflushed_spaces);
+ n_space_ids = fil_system->unflushed_spaces.size();
if (n_space_ids == 0) {
mutex_exit(&fil_system->mutex);
return;
}
- /* Assemble a list of space ids to flush. Previously, we
- traversed fil_system->unflushed_spaces and called UT_LIST_GET_NEXT()
- on a space that was just removed from the list by fil_flush().
- Thus, the space could be dropped and the memory overwritten. */
space_ids = static_cast<ulint*>(
ut_malloc_nokey(n_space_ids * sizeof(*space_ids)));
n_space_ids = 0;
- for (space = UT_LIST_GET_FIRST(fil_system->unflushed_spaces);
- space;
- space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
-
- if (space->purpose == purpose
- && !space->is_stopping()) {
+ for (sized_ilist<fil_space_t, unflushed_spaces_tag_t>::iterator it
+ = fil_system->unflushed_spaces.begin(),
+ end = fil_system->unflushed_spaces.end();
+ it != end; ++it) {
- space_ids[n_space_ids++] = space->id;
+ if (it->purpose == purpose && !it->is_stopping()) {
+ space_ids[n_space_ids++] = it->id;
}
}
@@ -5323,24 +5311,15 @@ bool
fil_validate(void)
/*==============*/
{
- fil_space_t* space;
fil_node_t* fil_node;
ulint n_open = 0;
mutex_enter(&fil_system->mutex);
- /* Look for spaces in the hash table */
-
- for (ulint i = 0; i < hash_get_n_cells(fil_system->spaces); i++) {
-
- for (space = static_cast<fil_space_t*>(
- HASH_GET_FIRST(fil_system->spaces, i));
- space != 0;
- space = static_cast<fil_space_t*>(
- HASH_GET_NEXT(hash, space))) {
-
- n_open += Check::validate(space);
- }
+ for (fil_space_t *space = UT_LIST_GET_FIRST(fil_system->space_list);
+ space != NULL;
+ space = UT_LIST_GET_NEXT(space_list, space)) {
+ n_open += Check::validate(space);
}
ut_a(fil_system->n_open == n_open);
@@ -5420,12 +5399,12 @@ fil_close(void)
hash_table_free(fil_system->name_hash);
ut_a(UT_LIST_GET_LEN(fil_system->LRU) == 0);
- ut_a(UT_LIST_GET_LEN(fil_system->unflushed_spaces) == 0);
+ ut_a(fil_system->unflushed_spaces.size() == 0);
ut_a(UT_LIST_GET_LEN(fil_system->space_list) == 0);
mutex_free(&fil_system->mutex);
- ut_free(fil_system);
+ delete fil_system;
fil_system = NULL;
fil_space_crypt_cleanup();
@@ -5455,51 +5434,6 @@ fil_delete_file(
}
}
-/**
-Iterate over all the spaces in the space list and fetch the
-tablespace names. It will return a copy of the name that must be
-freed by the caller using: delete[].
-@return DB_SUCCESS if all OK. */
-dberr_t
-fil_get_space_names(
-/*================*/
- space_name_list_t& space_name_list)
- /*!< in/out: List to append to */
-{
- fil_space_t* space;
- dberr_t err = DB_SUCCESS;
-
- mutex_enter(&fil_system->mutex);
-
- for (space = UT_LIST_GET_FIRST(fil_system->space_list);
- space != NULL;
- space = UT_LIST_GET_NEXT(space_list, space)) {
-
- if (space->purpose == FIL_TYPE_TABLESPACE) {
- ulint len;
- char* name;
-
- len = ::strlen(space->name);
- name = UT_NEW_ARRAY_NOKEY(char, len + 1);
-
- if (name == 0) {
- /* Caller to free elements allocated so far. */
- err = DB_OUT_OF_MEMORY;
- break;
- }
-
- memcpy(name, space->name, len);
- name[len] = 0;
-
- space_name_list.push_back(name);
- }
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(err);
-}
-
/** Generate redo log for swapping two .ibd files
@param[in] old_table old table
@param[in] new_table new table
@@ -5931,134 +5865,6 @@ fil_space_t::release_free_extents(ulint n_reserved)
n_reserved_extents -= n_reserved;
}
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-fil_space_t*
-fil_space_next(fil_space_t* prev_space)
-{
- fil_space_t* space=prev_space;
-
- mutex_enter(&fil_system->mutex);
-
- if (prev_space == NULL) {
- space = UT_LIST_GET_FIRST(fil_system->space_list);
-
- /* We can trust that space is not NULL because at least the
- system tablespace is always present and loaded first. */
- space->n_pending_ops++;
- } else {
- ut_ad(space->n_pending_ops > 0);
-
- /* Move on to the next fil_space_t */
- space->n_pending_ops--;
- space = UT_LIST_GET_NEXT(space_list, space);
-
- /* Skip spaces that are being created by
- fil_ibd_create(), or dropped, or !tablespace. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping()
- || space->purpose != FIL_TYPE_TABLESPACE)) {
- space = UT_LIST_GET_NEXT(space_list, space);
- }
-
- if (space != NULL) {
- space->n_pending_ops++;
- }
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(space);
-}
-
-/**
-Remove space from key rotation list if there are no more
-pending operations.
-@param[in,out] space Tablespace */
-static
-void
-fil_space_remove_from_keyrotation(fil_space_t* space)
-{
- ut_ad(mutex_own(&fil_system->mutex));
- ut_ad(space);
-
- if (space->n_pending_ops == 0 && space->is_in_rotation_list()) {
- ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
- UT_LIST_REMOVE(fil_system->rotation_list, space);
- }
-}
-
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Previous tablespace or NULL to start
- from beginning of fil_system->rotation list
-@param[in] recheck recheck of the tablespace is needed or
- still encryption thread does write page0 for it
-@param[in] key_version key version of the key state thread
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last */
-fil_space_t*
-fil_system_t::keyrotate_next(
- fil_space_t* prev_space,
- bool recheck,
- uint key_version)
-{
- mutex_enter(&fil_system->mutex);
-
- /* If one of the encryption threads already started the encryption
- of the table then don't remove the unencrypted spaces from
- rotation list
-
- If there is a change in innodb_encrypt_tables variables value then
- don't remove the last processed tablespace from the rotation list. */
- const bool remove = ((!recheck || prev_space->crypt_data)
- && (!key_version == !srv_encrypt_tables));
-
- fil_space_t* space = prev_space;
-
- if (prev_space == NULL) {
- space = UT_LIST_GET_FIRST(fil_system->rotation_list);
-
- /* We can trust that space is not NULL because we
- checked list length above */
- } else {
- ut_ad(space->n_pending_ops > 0);
-
- /* Move on to the next fil_space_t */
- space->n_pending_ops--;
-
- space = UT_LIST_GET_NEXT(rotation_list, space);
-
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping())) {
- space = UT_LIST_GET_NEXT(rotation_list, space);
- }
-
- if (remove) {
- fil_space_remove_from_keyrotation(prev_space);
- }
- }
-
- if (space != NULL) {
- space->n_pending_ops++;
- }
-
- mutex_exit(&fil_system->mutex);
- return(space);
-}
-
/** Determine the block size of the data file.
@param[in] space tablespace
@param[in] offset page number
@@ -6131,21 +5937,3 @@ 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 89b8efc4e9b..4f7fa89c662 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2018, MariaDB Corporation.
+Copyright (C) 2013, 2020, 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,7 +27,6 @@ Updated 14/02/2015
#include "fil0fil.h"
#include "fil0pagecompress.h"
-#include <debug_sync.h>
#include <my_dbug.h>
#include "mem0mem.h"
@@ -236,25 +235,12 @@ success:
/* Set up the actual payload lenght */
mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size);
-#ifdef UNIV_DEBUG
- /* Verify */
ut_ad(fil_page_is_compressed(out_buf) || fil_page_is_compressed_encrypted(out_buf));
ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC);
ut_ad(mach_read_from_2(out_buf+FIL_PAGE_DATA) == write_size);
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) == (ulint)comp_method ||
mach_read_from_2(out_buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE) == (ulint)comp_method);
- /* Verify that page can be decompressed */
- {
- page_t tmp_buf[UNIV_PAGE_SIZE_MAX];
- page_t page[UNIV_PAGE_SIZE_MAX];
- memcpy(page, out_buf, srv_page_size);
- ut_ad(fil_page_decompress(tmp_buf, page));
- ut_ad(!buf_page_is_corrupted(false, page, univ_page_size,
- NULL));
- }
-#endif /* UNIV_DEBUG */
-
write_size+=header_len;
if (block_size <= 0) {
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 673e74cfb3d..b367ed37c2b 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -331,7 +331,7 @@ Datafile::read_first_page(bool read_only_mode)
ib::error()
<< "Cannot read first page of '"
<< m_filepath << "' "
- << ut_strerr(err);
+ << err;
break;
}
}
@@ -768,10 +768,10 @@ Datafile::restore_from_doublewrite()
}
/* Find if double write buffer contains page_no of given space id. */
- const byte* page = recv_sys->dblwr.find_page(m_space_id, 0);
const page_id_t page_id(m_space_id, 0);
+ const byte* page = recv_sys->dblwr.find_page(page_id);
- if (page == NULL) {
+ if (!page) {
/* If the first page of the given user tablespace is not there
in the doublewrite buffer, then the recovery is going to fail
now. Hence this is treated as an error. */
@@ -788,15 +788,10 @@ Datafile::restore_from_doublewrite()
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
if (!fsp_flags_is_valid(flags, m_space_id)) {
- ulint cflags = fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED) {
- ib::warn()
- << "Ignoring a doublewrite copy of page "
- << page_id
- << " due to invalid flags " << ib::hex(flags);
- return(true);
- }
- flags = cflags;
+ flags = fsp_flags_convert_from_101(flags);
+ /* recv_dblwr_t::validate_page() inside find_page()
+ checked this already. */
+ ut_ad(flags != ULINT_UNDEFINED);
/* The flags on the page should be converted later. */
}
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 78d562be9a3..58aa18ac323 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -117,7 +117,6 @@ to minimize file space fragmentation.
@param[in] direction if the new page is needed because of
an index page split, and records are inserted there in order, into which
direction they go alphabetically: FSP_DOWN, FSP_UP, FSP_NO_DIR
-@param[in] rw_latch RW_SX_LATCH, RW_X_LATCH
@param[in,out] mtr mini-transaction
@param[in,out] init_mtr mtr or another mini-transaction in
which the page should be initialized. If init_mtr != mtr, but the page is
@@ -136,7 +135,6 @@ fseg_alloc_free_page_low(
fseg_inode_t* seg_inode,
ulint hint,
byte direction,
- rw_lock_type_t rw_latch,
mtr_t* mtr,
mtr_t* init_mtr
#ifdef UNIV_DEBUG
@@ -224,7 +222,9 @@ xdes_set_bit(
ulint bit_index;
ulint descr_byte;
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX));
+ ut_ad(mtr_memo_contains_page(
+ mtr, descr,
+ MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX));
ut_ad((bit == XDES_FREE_BIT) || (bit == XDES_CLEAN_BIT));
ut_ad(offset < FSP_EXTENT_SIZE);
@@ -351,7 +351,9 @@ xdes_set_state(
ut_ad(descr && mtr);
ut_ad(state >= XDES_FREE);
ut_ad(state <= XDES_FSEG);
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX));
+ ut_ad(mtr_memo_contains_page(
+ mtr, descr,
+ MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(descr + XDES_STATE, state, MLOG_4BYTES, mtr);
}
@@ -388,7 +390,9 @@ xdes_init(
ulint i;
ut_ad(descr && mtr);
- ut_ad(mtr_memo_contains_page(mtr, descr, MTR_MEMO_PAGE_SX_FIX));
+ ut_ad(mtr_memo_contains_page(
+ mtr, descr,
+ MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX));
ut_ad((XDES_SIZE - XDES_BITMAP) % 4 == 0);
for (i = XDES_BITMAP; i < XDES_SIZE; i += 4) {
@@ -422,8 +426,9 @@ xdes_get_descriptor_with_space_hdr(
ulint size;
ulint descr_page_no;
page_t* descr_page;
- ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_X_LOCK));
- ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_SX_FIX));
+ ut_ad(mtr_memo_contains(mtr, space, MTR_MEMO_SPACE_X_LOCK));
+ ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_SX_FIX)
+ || mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
limit = mach_read_from_4(sp_header + FSP_FREE_LIMIT);
@@ -566,7 +571,7 @@ xdes_lst_get_descriptor(
fil_addr_t lst_node,
mtr_t* mtr)
{
- ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_X_LOCK));
+ ut_ad(mtr_memo_contains(mtr, space, MTR_MEMO_SPACE_X_LOCK));
ut_ad(page_size.equals_to(page_size_t(space->flags)));
return(fut_get_ptr(space->id, page_size, lst_node, RW_SX_LATCH, mtr)
- XDES_FLST_NODE);
@@ -701,7 +706,6 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
const page_size_t page_size(space->flags);
block = buf_page_create(page_id, page_size, mtr);
- buf_page_get(page_id, page_size, RW_SX_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
space->size_in_header = size;
@@ -1100,9 +1104,6 @@ fsp_fill_free_list(
block = buf_page_create(
page_id, page_size, mtr);
- buf_page_get(
- page_id, page_size, RW_SX_LATCH, mtr);
-
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
fsp_init_file_page(space, block, mtr);
@@ -1112,42 +1113,19 @@ fsp_fill_free_list(
MLOG_2BYTES, mtr);
}
- /* Initialize the ibuf bitmap page in a separate
- mini-transaction because it is low in the latching
- order, and we must be able to release its latch.
- Note: Insert-Buffering is disabled for tables that
- reside in the temp-tablespace. */
if (space->purpose != FIL_TYPE_TEMPORARY) {
- mtr_t ibuf_mtr;
-
- mtr_start(&ibuf_mtr);
- ibuf_mtr.set_named_space(space);
-
- /* Avoid logging while truncate table
- fix-up is active. */
- if (srv_is_tablespace_truncated(space->id)) {
- mtr_set_log_mode(
- &ibuf_mtr, MTR_LOG_NO_REDO);
- }
-
const page_id_t page_id(
space->id,
i + FSP_IBUF_BITMAP_OFFSET);
block = buf_page_create(
- page_id, page_size, &ibuf_mtr);
-
- buf_page_get(
- page_id, page_size, RW_SX_LATCH,
- &ibuf_mtr);
+ page_id, page_size, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- fsp_init_file_page(space, block, &ibuf_mtr);
-
- ibuf_bitmap_page_init(block, &ibuf_mtr);
+ fsp_init_file_page(space, block, mtr);
- mtr_commit(&ibuf_mtr);
+ ibuf_bitmap_page_init(block, mtr);
}
}
@@ -1288,7 +1266,6 @@ x-latched only by mtr, and freed in mtr in that case.
@param[in,out] space tablespace
@param[in] offset page number of the allocated page
@param[in] page_size page size of the allocated page
-@param[in] rw_latch RW_SX_LATCH, RW_X_LATCH
@param[in,out] mtr mini-transaction of the allocation
@param[in,out] init_mtr mini-transaction for initializing the page
@return block, initialized if init_mtr==mtr
@@ -1299,7 +1276,6 @@ fsp_page_create(
fil_space_t* space,
page_no_t offset,
const page_size_t& page_size,
- rw_lock_type_t rw_latch,
mtr_t* mtr,
mtr_t* init_mtr)
{
@@ -1309,26 +1285,10 @@ fsp_page_create(
page_size, init_mtr);
ut_d(bool latched = mtr_memo_contains_flagged(mtr, block,
- MTR_MEMO_PAGE_X_FIX
- | MTR_MEMO_PAGE_SX_FIX));
-
- ut_ad(rw_latch == RW_X_LATCH || rw_latch == RW_SX_LATCH);
-
- /* Mimic buf_page_get(), but avoid the buf_pool->page_hash lookup. */
- if (rw_latch == RW_X_LATCH) {
- rw_lock_x_lock(&block->lock);
- } else {
- rw_lock_sx_lock(&block->lock);
- }
-
- buf_block_buf_fix_inc(block, __FILE__, __LINE__);
- mtr_memo_push(init_mtr, block, rw_latch == RW_X_LATCH
- ? MTR_MEMO_PAGE_X_FIX : MTR_MEMO_PAGE_SX_FIX);
+ MTR_MEMO_PAGE_X_FIX));
if (init_mtr == mtr
- || (rw_latch == RW_X_LATCH
- ? rw_lock_get_x_lock_count(&block->lock) == 1
- : rw_lock_get_sx_lock_count(&block->lock) == 1)) {
+ || rw_lock_get_x_lock_count(&block->lock) == 1) {
/* Initialize the page, unless it was already
SX-latched in mtr. (In this case, we would want to
@@ -1345,7 +1305,6 @@ The page is marked as used.
@param[in,out] space tablespace
@param[in] page_size page size
@param[in] hint hint of which page would be desirable
-@param[in] rw_latch RW_SX_LATCH, RW_X_LATCH
@param[in,out] mtr mini-transaction
@param[in,out] init_mtr mini-transaction in which the page should be
initialized (may be the same as mtr)
@@ -1359,7 +1318,6 @@ fsp_alloc_free_page(
fil_space_t* space,
const page_size_t& page_size,
ulint hint,
- rw_lock_type_t rw_latch,
mtr_t* mtr,
mtr_t* init_mtr)
{
@@ -1437,7 +1395,7 @@ fsp_alloc_free_page(
ut_a(!is_system_tablespace(space_id));
if (page_no >= FSP_EXTENT_SIZE) {
ib::error() << "Trying to extend a single-table"
- " tablespace " << space << " , by single"
+ " tablespace " << space->name << " , by single"
" page(s) though the space size " << space_size
<< ". Page no " << page_no << ".";
return(NULL);
@@ -1451,8 +1409,7 @@ fsp_alloc_free_page(
}
fsp_alloc_from_free_frag(header, descr, free, mtr);
- return(fsp_page_create(space, page_no, page_size, rw_latch,
- mtr, init_mtr));
+ return(fsp_page_create(space, page_no, page_size, mtr, init_mtr));
}
/** Frees a single page of a space.
@@ -1569,7 +1526,7 @@ fsp_free_extent(
fsp_header_t* header;
xdes_t* descr;
- ut_ad(mtr_memo_contains(mtr, &space->latch, MTR_MEMO_X_LOCK));
+ ut_ad(mtr_memo_contains(mtr, space, MTR_MEMO_SPACE_X_LOCK));
header = fsp_get_space_header(space, page_size, mtr);
@@ -1689,8 +1646,7 @@ fsp_alloc_seg_inode_page(
const page_size_t page_size(space->flags);
- block = fsp_alloc_free_page(
- space, page_size, 0, RW_SX_LATCH, mtr, mtr);
+ block = fsp_alloc_free_page(space, page_size, 0, mtr, mtr);
if (block == NULL) {
@@ -1698,7 +1654,7 @@ fsp_alloc_seg_inode_page(
}
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- ut_ad(rw_lock_get_sx_lock_count(&block->lock) == 1);
+ ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
mlog_write_ulint(block->frame + FIL_PAGE_TYPE, FIL_PAGE_INODE,
MLOG_2BYTES, mtr);
@@ -2007,32 +1963,36 @@ fseg_get_n_frag_pages(
return(count);
}
-/**********************************************************************//**
-Creates a new segment.
+/** Creates a new segment.
+@param[in] space_id space_id
+@param[in] byte_offset byte offset of the created segment
+ header on the page
+@param[in] has_done_reservation TRUE if the caller has already
+ done the reservation for the pages
+ with fsp_reserve_free_externts
+ (at least 2 extents: one for
+ the inode and the other for the
+ segment) then there is no need to do
+ the check for this individual
+ operation
+@param[in,out] mtr mini-transaction
+@param[in] block block where the segment header is
+ placed. If it is null then new page
+ will be allocated and it will belong
+ to the created segment
@return the block where the segment header is placed, x-latched, NULL
if could not create segment because of lack of space */
buf_block_t*
fseg_create_general(
-/*================*/
- ulint space_id,/*!< in: space id */
- ulint page, /*!< in: page where the segment header is placed: if
- this is != 0, the page must belong to another segment,
- if this is 0, a new page will be allocated and it
- will belong to the created segment */
- ulint byte_offset, /*!< in: byte offset of the created segment header
- on the page */
- ibool has_done_reservation, /*!< in: TRUE if the caller has already
- done the reservation for the pages with
- fsp_reserve_free_extents (at least 2 extents: one for
- the inode and the other for the segment) then there is
- no need to do the check for this individual
- operation */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ ulint space_id,
+ ulint byte_offset,
+ ibool has_done_reservation,
+ mtr_t* mtr,
+ buf_block_t* block)
{
fsp_header_t* space_header;
fseg_inode_t* inode;
ib_id_t seg_id;
- buf_block_t* block = 0; /* remove warning */
fseg_header_t* header = 0; /* remove warning */
ulint n_reserved;
ulint i;
@@ -2047,14 +2007,11 @@ fseg_create_general(
const page_size_t page_size(space->flags);
ut_d(space->modify_check(*mtr));
- if (page != 0) {
- block = buf_page_get(page_id_t(space_id, page), page_size,
- RW_SX_LATCH, mtr);
-
+ if (block) {
header = byte_offset + buf_block_get_frame(block);
- const ulint type = space_id == TRX_SYS_SPACE
- && page == TRX_SYS_PAGE_NO
+ const ulint type = block->page.id == page_id_t(TRX_SYS_SPACE,
+ TRX_SYS_PAGE_NO)
? FIL_PAGE_TYPE_TRX_SYS
: FIL_PAGE_TYPE_SYS;
@@ -2095,9 +2052,9 @@ fseg_create_general(
fseg_set_nth_frag_page_no(inode, i, FIL_NULL, mtr);
}
- if (page == 0) {
+ if (!block) {
block = fseg_alloc_free_page_low(space, page_size,
- inode, 0, FSP_UP, RW_SX_LATCH,
+ inode, 0, FSP_UP,
mtr, mtr
#ifdef UNIV_DEBUG
, has_done_reservation
@@ -2115,7 +2072,7 @@ fseg_create_general(
goto funct_exit;
}
- ut_ad(rw_lock_get_sx_lock_count(&block->lock) == 1);
+ ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
header = byte_offset + buf_block_get_frame(block);
mlog_write_ulint(buf_block_get_frame(block) + FIL_PAGE_TYPE,
@@ -2140,23 +2097,25 @@ funct_exit:
DBUG_RETURN(block);
}
-/**********************************************************************//**
-Creates a new segment.
+/** Creates a new segment.
+@param[in] space space id
+@param[in] byte_offset byte offset of the created segment header
+ on the page
+@param[in,out] mtr mini-transaction
+@param[in,out] block block where segment header is placed;
+ If it is null then new page will be
+ allocated and it will belong to
+ the created segment
@return the block where the segment header is placed, x-latched, NULL
if could not create segment because of lack of space */
buf_block_t*
fseg_create(
-/*========*/
- ulint space, /*!< in: space id */
- ulint page, /*!< in: page where the segment header is placed: if
- this is != 0, the page must belong to another segment,
- if this is 0, a new page will be allocated and it
- will belong to the created segment */
- ulint byte_offset, /*!< in: byte offset of the created segment header
- on the page */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ ulint space,
+ ulint byte_offset,
+ mtr_t* mtr,
+ buf_block_t* block)
{
- return(fseg_create_general(space, page, byte_offset, FALSE, mtr));
+ return(fseg_create_general(space, byte_offset, FALSE, mtr, block));
}
/**********************************************************************//**
@@ -2354,7 +2313,6 @@ minimize file space fragmentation.
@param[in] direction if the new page is needed because of
an index page split, and records are inserted there in order, into which
direction they go alphabetically: FSP_DOWN, FSP_UP, FSP_NO_DIR
-@param[in] rw_latch RW_SX_LATCH, RW_X_LATCH
@param[in,out] mtr mini-transaction
@param[in,out] init_mtr mtr or another mini-transaction in
which the page should be initialized. If init_mtr != mtr, but the page is
@@ -2373,7 +2331,6 @@ fseg_alloc_free_page_low(
fseg_inode_t* seg_inode,
ulint hint,
byte direction,
- rw_lock_type_t rw_latch,
mtr_t* mtr,
mtr_t* init_mtr
#ifdef UNIV_DEBUG
@@ -2516,7 +2473,7 @@ take_hinted_page:
/* 6. We allocate an individual page from the space
===================================================*/
buf_block_t* block = fsp_alloc_free_page(
- space, page_size, hint, rw_latch, mtr, init_mtr);
+ space, page_size, hint, mtr, init_mtr);
ut_ad(!has_done_reservation || block != NULL);
@@ -2597,8 +2554,7 @@ got_hinted_page:
fseg_mark_page_used(seg_inode, ret_page, ret_descr, mtr);
}
- return(fsp_page_create(space, ret_page, page_size, rw_latch,
- mtr, init_mtr));
+ return(fsp_page_create(space, ret_page, page_size, mtr, init_mtr));
}
/**********************************************************************//**
@@ -2653,7 +2609,7 @@ fseg_alloc_free_page_general(
block = fseg_alloc_free_page_low(space, page_size,
inode, hint, direction,
- RW_X_LATCH, mtr, init_mtr
+ mtr, init_mtr
#ifdef UNIV_DEBUG
, has_done_reservation
#endif /* UNIV_DEBUG */
@@ -2976,8 +2932,6 @@ fseg_mark_page_used(
@param[in,out] space tablespace
@param[in] offset page number
@param[in] page_size page size
-@param[in] ahi whether we may need to drop the adaptive
-hash index
@param[in,out] mtr mini-transaction */
static
void
@@ -2986,9 +2940,6 @@ fseg_free_page_low(
fil_space_t* space,
page_no_t offset,
const page_size_t& page_size,
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi,
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr)
{
xdes_t* descr;
@@ -3003,15 +2954,6 @@ fseg_free_page_low(
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
ut_d(space->modify_check(*mtr));
-#ifdef BTR_CUR_HASH_ADAPT
- /* Drop search system page hash index if the page is found in
- the pool and is hashed */
-
- if (ahi) {
- btr_search_drop_page_hash_when_freed(
- page_id_t(space->id, offset));
- }
-#endif /* BTR_CUR_HASH_ADAPT */
descr = xdes_get_descriptor(space, offset, page_size, mtr);
@@ -3097,22 +3039,13 @@ fseg_free_page_low(
}
}
-#ifndef BTR_CUR_HASH_ADAPT
-# define fseg_free_page_low(inode, space, offset, page_size, ahi, mtr) \
- fseg_free_page_low(inode, space, offset, page_size, mtr)
-#endif /* !BTR_CUR_HASH_ADAPT */
-
/**********************************************************************//**
Frees a single page of a segment. */
void
-fseg_free_page_func(
+fseg_free_page(
fseg_header_t* seg_header, /*!< in: segment header */
ulint space_id,/*!< in: space id */
ulint page, /*!< in: page offset */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
DBUG_ENTER("fseg_free_page");
@@ -3128,7 +3061,7 @@ fseg_free_page_func(
&iblock);
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
- fseg_free_page_low(seg_inode, space, page, page_size, ahi, mtr);
+ fseg_free_page_low(seg_inode, space, page, page_size, mtr);
ut_d(buf_page_set_file_page_was_freed(page_id_t(space_id, page)));
@@ -3169,8 +3102,6 @@ fseg_page_is_free(fil_space_t* space, unsigned page)
@param[in,out] space tablespace
@param[in] page_size page size
@param[in] page page number in the extent
-@param[in] ahi whether we may need to drop
- the adaptive hash index
@param[in,out] mtr mini-transaction */
MY_ATTRIBUTE((nonnull))
static
@@ -3180,12 +3111,8 @@ fseg_free_extent(
fil_space_t* space,
const page_size_t& page_size,
ulint page,
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi,
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr)
{
- ulint first_page_in_extent;
xdes_t* descr;
ulint not_full_n_used;
ulint descr_n_used;
@@ -3199,25 +3126,7 @@ fseg_free_extent(
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_d(space->modify_check(*mtr));
-
- first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
-
-#ifdef BTR_CUR_HASH_ADAPT
- if (ahi) {
- for (ulint i = 0; i < FSP_EXTENT_SIZE; i++) {
- if (!xdes_mtr_get_bit(descr, XDES_FREE_BIT, i, mtr)) {
-
- /* Drop search system page hash index
- if the page is found in the pool and
- is hashed */
-
- btr_search_drop_page_hash_when_freed(
- page_id_t(space->id,
- first_page_in_extent + i));
- }
- }
- }
-#endif /* BTR_CUR_HASH_ADAPT */
+ ut_d(ulint first_page_in_extent = page - (page % FSP_EXTENT_SIZE));
if (xdes_is_full(descr, mtr)) {
flst_remove(seg_inode + FSEG_FULL,
@@ -3250,27 +3159,18 @@ fseg_free_extent(
#endif /* UNIV_DEBUG */
}
-#ifndef BTR_CUR_HASH_ADAPT
-# define fseg_free_extent(inode, space, page_size, page, ahi, mtr) \
- fseg_free_extent(inode, space, page_size, page, mtr)
-#endif /* !BTR_CUR_HASH_ADAPT */
-
/**********************************************************************//**
Frees part of a segment. This function can be used to free a segment by
repeatedly calling this function in different mini-transactions. Doing
the freeing in a single mini-transaction might result in too big a
mini-transaction.
-@return TRUE if freeing completed */
-ibool
-fseg_free_step_func(
+@return whether the freeing was completed */
+bool
+fseg_free_step(
fseg_header_t* header, /*!< in, own: segment header; NOTE: if the header
resides on the first page of the frag list
of the segment, this pointer becomes obsolete
after the last freeing step */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint n;
@@ -3302,7 +3202,7 @@ fseg_free_step_func(
if (inode == NULL) {
ib::info() << "Double free of inode from "
<< page_id_t(space_id, header_page);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
@@ -3312,9 +3212,9 @@ fseg_free_step_func(
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
- fseg_free_extent(inode, space, page_size, page, ahi, mtr);
+ fseg_free_extent(inode, space, page_size, page, mtr);
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
}
/* Free a frag page */
@@ -3324,13 +3224,13 @@ fseg_free_step_func(
/* Freeing completed: free the segment inode */
fsp_free_seg_inode(space, page_size, inode, mtr);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
fseg_free_page_low(
inode, space,
fseg_get_nth_frag_page_no(inode, n, mtr),
- page_size, ahi, mtr);
+ page_size, mtr);
n = fseg_find_last_used_frag_page_slot(inode, mtr);
@@ -3338,24 +3238,20 @@ fseg_free_step_func(
/* Freeing completed: free the segment inode */
fsp_free_seg_inode(space, page_size, inode, mtr);
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
}
/**********************************************************************//**
Frees part of a segment. Differs from fseg_free_step because this function
leaves the header page unfreed.
-@return TRUE if freeing completed, except the header page */
-ibool
-fseg_free_step_not_header_func(
+@return whether the freeing was completed, except for the header page */
+bool
+fseg_free_step_not_header(
fseg_header_t* header, /*!< in: segment header which must reside on
the first fragment page of the segment */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
ulint n;
@@ -3381,29 +3277,27 @@ fseg_free_step_not_header_func(
/* Free the extent held by the segment */
page = xdes_get_offset(descr);
- fseg_free_extent(inode, space, page_size, page, ahi, mtr);
+ fseg_free_extent(inode, space, page_size, page, mtr);
- return(FALSE);
+ return false;
}
/* Free a frag page */
n = fseg_find_last_used_frag_page_slot(inode, mtr);
- if (n == ULINT_UNDEFINED) {
- ut_error;
- }
+ ut_a(n != ULINT_UNDEFINED);
page_no = fseg_get_nth_frag_page_no(inode, n, mtr);
if (page_no == page_get_page_no(page_align(header))) {
- return(TRUE);
+ return true;
}
- fseg_free_page_low(inode, space, page_no, page_size, ahi, mtr);
+ fseg_free_page_low(inode, space, page_no, page_size, mtr);
- return(FALSE);
+ return false;
}
/** Returns the first extent descriptor for a segment.
@@ -3470,7 +3364,7 @@ fseg_print_low(
ulint page_no;
ib_id_t seg_id;
- ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_SX_FIX));
+ ut_ad(mtr_memo_contains_page(mtr, inode, MTR_MEMO_PAGE_X_FIX));
space = page_get_space_id(page_align(inode));
page_no = page_get_page_no(page_align(inode));
diff --git a/storage/innobase/fts/fts0ast.cc b/storage/innobase/fts/fts0ast.cc
index e22613a265b..6be4fb0d52b 100644
--- a/storage/innobase/fts/fts0ast.cc
+++ b/storage/innobase/fts/fts0ast.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2007, 2020, 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
@@ -557,8 +557,7 @@ fts_ast_node_check_union(
fts_ast_node_t* node)
{
if (node->type == FTS_AST_LIST
- || node->type == FTS_AST_SUBEXP_LIST
- || node->type == FTS_AST_PARSER_PHRASE_LIST) {
+ || node->type == FTS_AST_SUBEXP_LIST) {
for (node = node->list.head; node; node = node->next) {
if (!fts_ast_node_check_union(node)) {
@@ -566,6 +565,9 @@ fts_ast_node_check_union(
}
}
+ } else if (node->type == FTS_AST_PARSER_PHRASE_LIST) {
+ /* Phrase search for plugin parser */
+ return(false);
} else if (node->type == FTS_AST_OPER
&& (node->oper == FTS_IGNORE
|| node->oper == FTS_EXIST)) {
diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc
index 6130546e963..ed4340d818b 100644
--- a/storage/innobase/fts/fts0config.cc
+++ b/storage/innobase/fts/fts0config.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -148,9 +148,7 @@ fts_config_create_index_param_name(
::strcpy(name, param);
name[len] = '_';
- fts_write_object_id(index->id, name + len + 1,
- DICT_TF2_FLAG_IS_SET(index->table,
- DICT_TF2_FTS_AUX_HEX_NAME));
+ fts_write_object_id(index->id, name + len + 1);
return(name);
}
@@ -317,9 +315,7 @@ fts_config_get_index_ulint(
error = fts_config_get_index_value(trx, index, name, &value);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
-
- ib::error() << "(" << ut_strerr(error) << ") reading `"
- << name << "'";
+ ib::error() << "(" << error << ") reading `" << name << "'";
} else {
*int_value = strtoul((char*) value.f_str, NULL, 10);
}
@@ -357,9 +353,7 @@ fts_config_set_index_ulint(
error = fts_config_set_index_value(trx, index, name, &value);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
-
- ib::error() << "(" << ut_strerr(error) << ") writing `"
- << name << "'";
+ ib::error() << "(" << error << ") writing `" << name << "'";
}
ut_free(value.f_str);
@@ -391,8 +385,7 @@ fts_config_get_ulint(
error = fts_config_get_value(trx, fts_table, name, &value);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
- ib::error() << "(" << ut_strerr(error) << ") reading `"
- << name << "'";
+ ib::error() << "(" << error << ") reading `" << name << "'";
} else {
*int_value = strtoul((char*) value.f_str, NULL, 10);
}
@@ -430,8 +423,7 @@ fts_config_set_ulint(
error = fts_config_set_value(trx, fts_table, name, &value);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
- ib::error() << "(" << ut_strerr(error) << ") writing `"
- << name << "'";
+ ib::error() << "(" << error << ") writing `" << name << "'";
}
ut_free(value.f_str);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 458f4277988..fb06d300803 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -286,7 +286,6 @@ fts_cache_destroy(fts_cache_t* cache)
{
rw_lock_free(&cache->lock);
rw_lock_free(&cache->init_lock);
- mutex_free(&cache->optimize_lock);
mutex_free(&cache->deleted_lock);
mutex_free(&cache->doc_id_lock);
os_event_destroy(cache->sync->event);
@@ -444,9 +443,9 @@ fts_read_stopword(
/******************************************************************//**
Load user defined stopword from designated user table
-@return TRUE if load operation is successful */
+@return whether the operation is successful */
static
-ibool
+bool
fts_load_user_stopword(
/*===================*/
fts_t* fts, /*!< in: FTS struct */
@@ -454,27 +453,26 @@ fts_load_user_stopword(
name */
fts_stopword_t* stopword_info) /*!< in: Stopword info */
{
- pars_info_t* info;
- que_t* graph;
- dberr_t error = DB_SUCCESS;
- ibool ret = TRUE;
- trx_t* trx;
- ibool has_lock = fts->dict_locked;
-
- trx = trx_allocate_for_background();
- trx->op_info = "Load user stopword table into FTS cache";
-
- if (!has_lock) {
+ if (!fts->dict_locked) {
mutex_enter(&dict_sys->mutex);
}
- /* Validate the user table existence and in the right
- format */
+ /* Validate the user table existence in the right format */
+ bool ret= false;
stopword_info->charset = fts_valid_stopword_table(stopword_table_name);
if (!stopword_info->charset) {
- ret = FALSE;
- goto cleanup;
- } else if (!stopword_info->cached_stopword) {
+cleanup:
+ if (!fts->dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+
+ return ret;
+ }
+
+ trx_t* trx = trx_allocate_for_background();
+ trx->op_info = "Load user stopword table into FTS cache";
+
+ if (!stopword_info->cached_stopword) {
/* Create the stopword RB tree with the stopword column
charset. All comparison will use this charset */
stopword_info->cached_stopword = rbt_create_arg_cmp(
@@ -483,14 +481,14 @@ fts_load_user_stopword(
}
- info = pars_info_create();
+ pars_info_t* info = pars_info_create();
pars_info_bind_id(info, TRUE, "table_stopword", stopword_table_name);
pars_info_bind_function(info, "my_func", fts_read_stopword,
stopword_info);
- graph = fts_parse_sql_no_dict_lock(
+ que_t* graph = fts_parse_sql_no_dict_lock(
NULL,
info,
"DECLARE FUNCTION my_func;\n"
@@ -509,14 +507,13 @@ fts_load_user_stopword(
"CLOSE c;");
for (;;) {
- error = fts_eval_sql(trx, graph);
+ dberr_t error = fts_eval_sql(trx, graph);
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
stopword_info->status = STOPWORD_USER_TABLE;
break;
} else {
-
fts_sql_rollback(trx);
if (error == DB_LOCK_WAIT_TIMEOUT) {
@@ -525,7 +522,7 @@ fts_load_user_stopword(
trx->error_state = DB_SUCCESS;
} else {
- ib::error() << "Error '" << ut_strerr(error)
+ ib::error() << "Error '" << error
<< "' while reading user stopword"
" table.";
ret = FALSE;
@@ -535,14 +532,9 @@ fts_load_user_stopword(
}
que_graph_free(graph);
-
-cleanup:
- if (!has_lock) {
- mutex_exit(&dict_sys->mutex);
- }
-
trx_free_for_background(trx);
- return(ret);
+ ret = true;
+ goto cleanup;
}
/******************************************************************//**
@@ -591,7 +583,7 @@ fts_cache_init(
mutex_enter((ib_mutex_t*) &cache->deleted_lock);
cache->deleted_doc_ids = ib_vector_create(
- cache->sync_heap, sizeof(fts_update_t), 4);
+ cache->sync_heap, sizeof(doc_id_t), 4);
mutex_exit((ib_mutex_t*) &cache->deleted_lock);
/* Reset the cache data for all the FTS indexes. */
@@ -630,8 +622,6 @@ fts_cache_create(
mutex_create(LATCH_ID_FTS_DELETE, &cache->deleted_lock);
- mutex_create(LATCH_ID_FTS_OPTIMIZE, &cache->optimize_lock);
-
mutex_create(LATCH_ID_FTS_DOC_ID, &cache->doc_id_lock);
/* This is the heap used to create the cache itself. */
@@ -812,6 +802,29 @@ fts_check_cached_index(
return(TRUE);
}
+/** Clear all fts resources when there is no internal DOC_ID
+and there are no new fts index to add.
+@param[in,out] table table where fts is to be freed
+@param[in] trx transaction to drop all fts tables */
+void fts_clear_all(dict_table_t *table, trx_t *trx)
+{
+ if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID) ||
+ !table->fts ||
+ !ib_vector_is_empty(table->fts->indexes))
+ return;
+
+ for (const dict_index_t *index= dict_table_get_first_index(table);
+ index; index= dict_table_get_next_index(index))
+ if (index->type & DICT_FTS)
+ return;
+
+ fts_optimize_remove_table(table);
+
+ fts_drop_tables(trx, table);
+ fts_free(table);
+ DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS);
+}
+
/*******************************************************************//**
Drop auxiliary tables related to an FTS index
@return DB_SUCCESS or error number */
@@ -828,9 +841,10 @@ fts_drop_index(
ut_a(indexes);
if ((ib_vector_size(indexes) == 1
- && (index == static_cast<dict_index_t*>(
- ib_vector_getp(table->fts->indexes, 0))))
- || ib_vector_is_empty(indexes)) {
+ && (index == static_cast<dict_index_t*>(
+ ib_vector_getp(table->fts->indexes, 0)))
+ && DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
+ || ib_vector_is_empty(indexes)) {
doc_id_t current_doc_id;
doc_id_t first_doc_id;
@@ -840,27 +854,6 @@ fts_drop_index(
DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS);
- /* If Doc ID column is not added internally by FTS index,
- we can drop all FTS auxiliary tables. Otherwise, we will
- need to keep some common table such as CONFIG table, so
- as to keep track of incrementing Doc IDs */
- if (!DICT_TF2_FLAG_IS_SET(
- table, DICT_TF2_FTS_HAS_DOC_ID)) {
-
- err = fts_drop_tables(trx, table);
-
- err = fts_drop_index_tables(trx, index);
-
- while (index->index_fts_syncing
- && !trx_is_interrupted(trx)) {
- DICT_BG_YIELD(trx);
- }
-
- fts_free(table);
-
- return(err);
- }
-
while (index->index_fts_syncing
&& !trx_is_interrupted(trx)) {
DICT_BG_YIELD(trx);
@@ -1110,9 +1103,6 @@ fts_cache_clear(
index_cache->doc_stats = NULL;
}
- mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
- cache->sync_heap->arg = NULL;
-
fts_need_sync = false;
cache->total_size = 0;
@@ -1120,6 +1110,9 @@ fts_cache_clear(
mutex_enter((ib_mutex_t*) &cache->deleted_lock);
cache->deleted_doc_ids = NULL;
mutex_exit((ib_mutex_t*) &cache->deleted_lock);
+
+ mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
+ cache->sync_heap->arg = NULL;
}
/*********************************************************************//**
@@ -1461,9 +1454,9 @@ fts_drop_table(
error = row_drop_table_for_mysql(table_name, trx,
SQLCOM_DROP_DB, false, false);
- if (error != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
ib::error() << "Unable to drop FTS index aux table "
- << table_name << ": " << ut_strerr(error);
+ << table_name << ": " << error;
}
} else {
error = DB_FAIL;
@@ -1569,18 +1562,19 @@ fts_rename_aux_tables(
return(DB_SUCCESS);
}
-/****************************************************************//**
-Drops the common ancillary tables needed for supporting an FTS index
+/** Drops the common ancillary tables needed for supporting an FTS index
on the given table. row_mysql_lock_data_dictionary must have been called
before this.
+@param[in] trx transaction to drop fts common table
+@param[in] fts_table table with an FTS index
+@param[in] drop_orphan True if the function is used to drop
+ orphaned table
@return DB_SUCCESS or error code */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
+static dberr_t
fts_drop_common_tables(
-/*===================*/
- trx_t* trx, /*!< in: transaction */
- fts_table_t* fts_table) /*!< in: table with an FTS
- index */
+ trx_t* trx,
+ fts_table_t* fts_table,
+ bool drop_orphan=false)
{
ulint i;
dberr_t error = DB_SUCCESS;
@@ -1598,6 +1592,16 @@ fts_drop_common_tables(
if (err != DB_SUCCESS && err != DB_FAIL) {
error = err;
}
+
+ if (drop_orphan && err == DB_FAIL) {
+ char* path = fil_make_filepath(
+ NULL, table_name, IBD, false);
+ if (path != NULL) {
+ os_file_delete_if_exists(
+ innodb_data_file_key, path, NULL);
+ ut_free(path);
+ }
+ }
}
return(error);
@@ -2136,37 +2140,6 @@ fts_create_index_tables(
return(err);
}
-#if 0
-/******************************************************************//**
-Return string representation of state. */
-static
-const char*
-fts_get_state_str(
-/*==============*/
- /* out: string representation of state */
- fts_row_state state) /*!< in: state */
-{
- switch (state) {
- case FTS_INSERT:
- return("INSERT");
-
- case FTS_MODIFY:
- return("MODIFY");
-
- case FTS_DELETE:
- return("DELETE");
-
- case FTS_NOTHING:
- return("NOTHING");
-
- case FTS_INVALID:
- return("INVALID");
-
- default:
- return("UNKNOWN");
- }
-}
-#endif
/******************************************************************//**
Calculate the new state of a row given the existing state and a new event.
@@ -2542,8 +2515,7 @@ fts_get_max_cache_size(
error = fts_config_get_value(
trx, fts_table, FTS_MAX_CACHE_SIZE_IN_MB, &value);
- if (error == DB_SUCCESS) {
-
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
value.f_str[value.f_len] = 0;
cache_size_in_mb = strtoul((char*) value.f_str, NULL, 10);
@@ -2573,7 +2545,7 @@ fts_get_max_cache_size(
cache_size_in_mb = FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB;
}
} else {
- ib::error() << "(" << ut_strerr(error) << ") reading max"
+ ib::error() << "(" << error << ") reading max"
" cache config value from config table";
}
@@ -2644,11 +2616,11 @@ dberr_t
fts_cmp_set_sync_doc_id(
/*====================*/
const dict_table_t* table, /*!< in: table */
- doc_id_t doc_id_cmp, /*!< in: Doc ID to compare */
+ doc_id_t cmp_doc_id, /*!< in: Doc ID to compare */
ibool read_only, /*!< in: TRUE if read the
synced_doc_id only */
doc_id_t* doc_id) /*!< out: larger document id
- after comparing "doc_id_cmp"
+ after comparing "cmp_doc_id"
to the one stored in CONFIG
table */
{
@@ -2719,10 +2691,10 @@ retry:
goto func_exit;
}
- if (doc_id_cmp == 0 && *doc_id) {
+ if (cmp_doc_id == 0 && *doc_id) {
cache->synced_doc_id = *doc_id - 1;
} else {
- cache->synced_doc_id = ut_max(doc_id_cmp, *doc_id);
+ cache->synced_doc_id = ut_max(cmp_doc_id, *doc_id);
}
mutex_enter(&cache->doc_id_lock);
@@ -2733,7 +2705,7 @@ retry:
}
mutex_exit(&cache->doc_id_lock);
- if (doc_id_cmp > *doc_id) {
+ if (cmp_doc_id > *doc_id) {
error = fts_update_sync_doc_id(
table, cache->synced_doc_id, trx);
}
@@ -2742,13 +2714,12 @@ retry:
func_exit:
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
} else {
*doc_id = 0;
- ib::error() << "(" << ut_strerr(error) << ") while getting"
- " next doc id.";
+ ib::error() << "(" << error << ") while getting next doc id.";
fts_sql_rollback(trx);
if (error == DB_DEADLOCK) {
@@ -2823,12 +2794,11 @@ fts_update_sync_doc_id(
fts_que_graph_free_check_lock(&fts_table, NULL, graph);
if (local_trx) {
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
cache->synced_doc_id = doc_id;
} else {
-
- ib::error() << "(" << ut_strerr(error) << ") while"
+ ib::error() << "(" << error << ") while"
" updating last doc id.";
fts_sql_rollback(trx);
@@ -2855,7 +2825,7 @@ fts_doc_ids_create(void)
fts_doc_ids->self_heap = ib_heap_allocator_create(heap);
fts_doc_ids->doc_ids = static_cast<ib_vector_t*>(ib_vector_create(
- fts_doc_ids->self_heap, sizeof(fts_update_t), 32));
+ fts_doc_ids->self_heap, sizeof(doc_id_t), 32));
return(fts_doc_ids);
}
@@ -3229,7 +3199,7 @@ fts_fetch_doc_from_rec(
dict_index_t* clust_index, /*!< in: cluster index */
btr_pcur_t* pcur, /*!< in: cursor whose position
has been stored */
- ulint* offsets, /*!< in: offsets */
+ rec_offs* offsets, /*!< in: offsets */
fts_doc_t* doc) /*!< out: fts doc to hold parsed
documents */
{
@@ -3412,7 +3382,7 @@ fts_add_doc_from_tuple(
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
fts_load_stopword(table, NULL, NULL,
- NULL, TRUE, TRUE);
+ true, true);
}
fts_cache_add_doc(
@@ -3511,7 +3481,7 @@ fts_add_doc_by_id(
btr_pcur_t* doc_pcur;
const rec_t* clust_rec;
btr_pcur_t clust_pcur;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
ulint num_idx = ib_vector_size(cache->get_docs);
rec = btr_pcur_get_rec(&pcur);
@@ -3576,8 +3546,8 @@ fts_add_doc_by_id(
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
- fts_load_stopword(table, NULL, NULL,
- NULL, TRUE, TRUE);
+ fts_load_stopword(table, NULL,
+ NULL, true, true);
}
fts_cache_add_doc(
@@ -3700,8 +3670,8 @@ 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_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
ulint len;
const void* data;
@@ -3950,7 +3920,7 @@ fts_sync_add_deleted_cache(
ut_a(ib_vector_size(doc_ids) > 0);
- ib_vector_sort(doc_ids, fts_update_doc_id_cmp);
+ ib_vector_sort(doc_ids, fts_doc_id_cmp);
info = pars_info_create();
@@ -3968,13 +3938,13 @@ fts_sync_add_deleted_cache(
"BEGIN INSERT INTO $table_name VALUES (:doc_id);");
for (i = 0; i < n_elems && error == DB_SUCCESS; ++i) {
- fts_update_t* update;
+ doc_id_t* update;
doc_id_t write_doc_id;
- update = static_cast<fts_update_t*>(ib_vector_get(doc_ids, i));
+ update = static_cast<doc_id_t*>(ib_vector_get(doc_ids, i));
/* Convert to "storage" byte order. */
- fts_write_doc_id((byte*) &write_doc_id, update->doc_id);
+ fts_write_doc_id((byte*) &write_doc_id, *update);
fts_bind_doc_id(info, "doc_id", &write_doc_id);
error = fts_eval_sql(sync->trx, graph);
@@ -4072,14 +4042,14 @@ fts_sync_write_words(
n_nodes += ib_vector_size(word->nodes);
- if (error != DB_SUCCESS && !print_error) {
- ib::error() << "(" << ut_strerr(error) << ") writing"
+ if (UNIV_UNLIKELY(error != DB_SUCCESS) && !print_error) {
+ ib::error() << "(" << error << ") writing"
" word node to FTS auxiliary index table.";
print_error = TRUE;
}
}
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
printf("Avg number of nodes: %lf\n",
(double) n_nodes / (double) (n_words > 1 ? n_words : 1));
}
@@ -4105,7 +4075,7 @@ fts_sync_begin(
sync->trx = trx_allocate_for_background();
trx_start_internal(sync->trx);
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "FTS SYNC for table " << sync->table->name
<< ", deleted count: "
<< ib_vector_size(cache->deleted_doc_ids)
@@ -4128,7 +4098,7 @@ fts_sync_index(
trx->op_info = "doing SYNC index";
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "SYNC words: " << rbt_size(index_cache->words);
}
@@ -4225,18 +4195,14 @@ fts_sync_commit(
fts_cache_init(cache);
rw_lock_x_unlock(&cache->lock);
- if (error == DB_SUCCESS) {
-
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
-
- } else if (error != DB_SUCCESS) {
-
+ } else {
fts_sql_rollback(trx);
-
- ib::error() << "(" << ut_strerr(error) << ") during SYNC.";
+ ib::error() << "(" << error << ") during SYNC.";
}
- if (fts_enable_diag_print && elapsed_time) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print) && elapsed_time) {
ib::info() << "SYNC for table " << sync->table->name
<< ": SYNC time: "
<< (time(NULL) - sync->start_time)
@@ -4245,7 +4211,7 @@ fts_sync_commit(
<< " ins/sec";
}
- /* Avoid assertion in trx_free(). */
+ /* Avoid assertion in trx_t::free(). */
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
@@ -4299,7 +4265,7 @@ fts_sync_rollback(
fts_sql_rollback(trx);
- /* Avoid assertion in trx_free(). */
+ /* Avoid assertion in trx_t::free(). */
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
}
@@ -4990,7 +4956,7 @@ fts_get_rows_count(
for (;;) {
error = fts_eval_sql(trx, graph);
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
break; /* Exit the loop. */
@@ -5003,7 +4969,7 @@ fts_get_rows_count(
trx->error_state = DB_SUCCESS;
} else {
- ib::error() << "(" << ut_strerr(error)
+ ib::error() << "(" << error
<< ") while reading FTS table.";
break; /* Exit the loop. */
@@ -5208,8 +5174,8 @@ fts_get_doc_id_from_rec(
const byte* data;
ulint col_no;
doc_id_t doc_id = 0;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
mem_heap_t* my_heap = heap;
ut_a(table->fts->doc_col != ULINT_UNDEFINED);
@@ -5299,12 +5265,12 @@ fts_cache_append_deleted_doc_ids(
for (ulint i = 0; i < ib_vector_size(cache->deleted_doc_ids); ++i) {
- fts_update_t* update;
+ doc_id_t* update;
- update = static_cast<fts_update_t*>(
+ update = static_cast<doc_id_t*>(
ib_vector_get(cache->deleted_doc_ids, i));
- ib_vector_push(vector, &update->doc_id);
+ ib_vector_push(vector, &update);
}
mutex_exit((ib_mutex_t*) &cache->deleted_lock);
@@ -5393,7 +5359,6 @@ fts_t::fts_t(
mem_heap_t* heap)
:
added_synced(0), dict_locked(0),
- bg_threads(0),
add_wq(NULL),
cache(NULL),
doc_col(ULINT_UNDEFINED), in_queue(false),
@@ -5401,8 +5366,6 @@ fts_t::fts_t(
{
ut_a(table->fts == NULL);
- mutex_create(LATCH_ID_FTS_BG_THREADS, &bg_threads_mutex);
-
ib_alloc_t* heap_alloc = ib_heap_allocator_create(fts_heap);
indexes = ib_vector_create(heap_alloc, sizeof(dict_index_t*), 4);
@@ -5413,8 +5376,6 @@ fts_t::fts_t(
/** fts_t destructor. */
fts_t::~fts_t()
{
- mutex_free(&bg_threads_mutex);
-
ut_ad(add_wq == NULL);
if (cache != NULL) {
@@ -5777,1336 +5738,245 @@ fts_savepoint_rollback(
}
}
-/** Check if a table is an FTS auxiliary table name.
-@param[out] table FTS table info
-@param[in] name Table name
-@param[in] len Length of table name
-@return true if the name matches an auxiliary table name pattern */
-static
-bool
-fts_is_aux_table_name(
- fts_aux_table_t* table,
- const char* name,
- ulint len)
-{
- const char* ptr;
- char* end;
- char my_name[MAX_FULL_NAME_LEN + 1];
-
- ut_ad(len <= MAX_FULL_NAME_LEN);
- ut_memcpy(my_name, name, len);
- my_name[len] = 0;
- end = my_name + len;
-
- ptr = static_cast<const char*>(memchr(my_name, '/', len));
-
- if (ptr != NULL) {
- /* We will start the match after the '/' */
- ++ptr;
- len = end - ptr;
- }
-
- /* All auxiliary tables are prefixed with "FTS_" and the name
- length will be at the very least greater than 20 bytes. */
- if (ptr != NULL && len > 20 && strncmp(ptr, "FTS_", 4) == 0) {
- ulint i;
-
- /* Skip the prefix. */
- ptr += 4;
- len -= 4;
-
- /* Try and read the table id. */
- if (!fts_read_object_id(&table->parent_id, ptr)) {
- return(false);
- }
-
- /* Skip the table id. */
- ptr = static_cast<const char*>(memchr(ptr, '_', len));
-
- if (ptr == NULL) {
- return(false);
- }
-
- /* Skip the underscore. */
- ++ptr;
- ut_a(end > ptr);
- len = end - ptr;
-
- /* First search the common table suffix array. */
- for (i = 0; fts_common_tables[i] != NULL; ++i) {
-
- if (strncmp(ptr, fts_common_tables[i], len) == 0) {
- return(true);
- }
- }
-
- /* Could be obsolete common tables. */
- if (strncmp(ptr, "ADDED", len) == 0
- || strncmp(ptr, "STOPWORDS", len) == 0) {
- return(true);
- }
-
- /* Try and read the index id. */
- if (!fts_read_object_id(&table->index_id, ptr)) {
- return(false);
- }
-
- /* Skip the table id. */
- ptr = static_cast<const char*>(memchr(ptr, '_', len));
-
- if (ptr == NULL) {
- return(false);
- }
-
- /* Skip the underscore. */
- ++ptr;
- ut_a(end > ptr);
- len = end - ptr;
-
- /* Search the FT index specific array. */
- for (i = 0; i < FTS_NUM_AUX_INDEX; ++i) {
-
- if (strncmp(ptr, fts_get_suffix(i), len) == 0) {
- return(true);
- }
- }
-
- /* Other FT index specific table(s). */
- if (strncmp(ptr, "DOC_ID", len) == 0) {
- return(true);
- }
- }
-
- return(false);
-}
-
-/**********************************************************************//**
-Callback function to read a single table ID column.
-@return Always return TRUE */
-static
-ibool
-fts_read_tables(
-/*============*/
- void* row, /*!< in: sel_node_t* */
- void* user_arg) /*!< in: pointer to ib_vector_t */
-{
- int i;
- fts_aux_table_t*table;
- mem_heap_t* heap;
- ibool done = FALSE;
- ib_vector_t* tables = static_cast<ib_vector_t*>(user_arg);
- sel_node_t* sel_node = static_cast<sel_node_t*>(row);
- que_node_t* exp = sel_node->select_list;
-
- /* Must be a heap allocated vector. */
- ut_a(tables->allocator->arg != NULL);
-
- /* We will use this heap for allocating strings. */
- heap = static_cast<mem_heap_t*>(tables->allocator->arg);
- table = static_cast<fts_aux_table_t*>(ib_vector_push(tables, NULL));
-
- memset(table, 0x0, sizeof(*table));
-
- /* Iterate over the columns and read the values. */
- for (i = 0; exp && !done; exp = que_node_get_next(exp), ++i) {
-
- dfield_t* dfield = que_node_get_val(exp);
- void* data = dfield_get_data(dfield);
- ulint len = dfield_get_len(dfield);
-
- ut_a(len != UNIV_SQL_NULL);
-
- /* Note: The column numbers below must match the SELECT */
- switch (i) {
- case 0: /* NAME */
-
- if (!fts_is_aux_table_name(
- table, static_cast<const char*>(data), len)) {
- ib_vector_pop(tables);
- done = TRUE;
- break;
- }
-
- table->name = static_cast<char*>(
- mem_heap_alloc(heap, len + 1));
- memcpy(table->name, data, len);
- table->name[len] = 0;
- break;
-
- case 1: /* ID */
- ut_a(len == 8);
- table->id = mach_read_from_8(
- static_cast<const byte*>(data));
- break;
-
- default:
- ut_error;
- }
- }
-
- return(TRUE);
-}
-
-/******************************************************************//**
-Callback that sets a hex formatted FTS table's flags2 in
-SYS_TABLES. The flags is stored in MIX_LEN column.
-@return FALSE if all OK */
-static
-ibool
-fts_set_hex_format(
-/*===============*/
- void* row, /*!< in: sel_node_t* */
- void* user_arg) /*!< in: bool set/unset flag */
-{
- sel_node_t* node = static_cast<sel_node_t*>(row);
- dfield_t* dfield = que_node_get_val(node->select_list);
-
- ut_ad(dtype_get_mtype(dfield_get_type(dfield)) == DATA_INT);
- ut_ad(dfield_get_len(dfield) == sizeof(ib_uint32_t));
- /* There should be at most one matching record. So the value
- must be the default value. */
- ut_ad(mach_read_from_4(static_cast<byte*>(user_arg))
- == ULINT32_UNDEFINED);
-
- ulint flags2 = mach_read_from_4(
- static_cast<byte*>(dfield_get_data(dfield)));
-
- flags2 |= DICT_TF2_FTS_AUX_HEX_NAME;
-
- mach_write_to_4(static_cast<byte*>(user_arg), flags2);
-
- return(FALSE);
-}
-
-/*****************************************************************//**
-Update the DICT_TF2_FTS_AUX_HEX_NAME flag in SYS_TABLES.
-@return DB_SUCCESS or error code. */
-static
-dberr_t
-fts_update_hex_format_flag(
-/*=======================*/
- trx_t* trx, /*!< in/out: transaction that
- covers the update */
- table_id_t table_id, /*!< in: Table for which we want
- to set the root table->flags2 */
- bool dict_locked) /*!< in: set to true if the
- caller already owns the
- dict_sys_t::mutex. */
-{
- pars_info_t* info;
- ib_uint32_t flags2;
-
- static const char sql[] =
- "PROCEDURE UPDATE_HEX_FORMAT_FLAG() IS\n"
- "DECLARE FUNCTION my_func;\n"
- "DECLARE CURSOR c IS\n"
- " SELECT MIX_LEN"
- " FROM SYS_TABLES"
- " WHERE ID = :table_id FOR UPDATE;"
- "\n"
- "BEGIN\n"
- "OPEN c;\n"
- "WHILE 1 = 1 LOOP\n"
- " FETCH c INTO my_func();\n"
- " IF c % NOTFOUND THEN\n"
- " EXIT;\n"
- " END IF;\n"
- "END LOOP;\n"
- "UPDATE SYS_TABLES"
- " SET MIX_LEN = :flags2"
- " WHERE ID = :table_id;\n"
- "CLOSE c;\n"
- "END;\n";
-
- flags2 = ULINT32_UNDEFINED;
-
- info = pars_info_create();
-
- pars_info_add_ull_literal(info, "table_id", table_id);
- pars_info_bind_int4_literal(info, "flags2", &flags2);
-
- pars_info_bind_function(
- info, "my_func", fts_set_hex_format, &flags2);
-
- if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE) {
- trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- }
-
- dberr_t err = que_eval_sql(info, sql, !dict_locked, trx);
-
- ut_a(flags2 != ULINT32_UNDEFINED);
-
- return(err);
-}
-
-/*********************************************************************//**
-Rename an aux table to HEX format. It's called when "%016llu" is used
-to format an object id in table name, which only happens in Windows. */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
-fts_rename_one_aux_table_to_hex_format(
-/*===================================*/
- trx_t* trx, /*!< in: transaction */
- const fts_aux_table_t* aux_table, /*!< in: table info */
- const dict_table_t* parent_table) /*!< in: parent table name */
-{
- const char* ptr;
- fts_table_t fts_table;
- char new_name[MAX_FULL_NAME_LEN];
- dberr_t error;
-
- ptr = strchr(aux_table->name, '/');
- ut_a(ptr != NULL);
- ++ptr;
- /* Skip "FTS_", table id and underscore */
- for (ulint i = 0; i < 2; ++i) {
- ptr = strchr(ptr, '_');
- ut_a(ptr != NULL);
- ++ptr;
- }
-
- fts_table.suffix = NULL;
- if (aux_table->index_id == 0) {
- fts_table.type = FTS_COMMON_TABLE;
-
- for (ulint i = 0; fts_common_tables[i] != NULL; ++i) {
- if (strcmp(ptr, fts_common_tables[i]) == 0) {
- fts_table.suffix = fts_common_tables[i];
- break;
- }
- }
- } else {
- fts_table.type = FTS_INDEX_TABLE;
-
- /* Skip index id and underscore */
- ptr = strchr(ptr, '_');
- ut_a(ptr != NULL);
- ++ptr;
-
- for (ulint i = 0; fts_index_selector[i].value; ++i) {
- if (strcmp(ptr, fts_get_suffix(i)) == 0) {
- fts_table.suffix = fts_get_suffix(i);
- break;
- }
- }
- }
-
- ut_a(fts_table.suffix != NULL);
-
- fts_table.table_id = aux_table->parent_id;
- fts_table.index_id = aux_table->index_id;
- fts_table.table = parent_table;
-
- fts_get_table_name(&fts_table, new_name);
- ut_ad(strcmp(new_name, aux_table->name) != 0);
-
- if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE) {
- trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- }
-
- error = row_rename_table_for_mysql(aux_table->name, new_name, trx,
- false, false);
-
- if (error != DB_SUCCESS) {
- ib::warn() << "Failed to rename aux table '"
- << aux_table->name << "' to new format '"
- << new_name << "'.";
- } else {
- ib::info() << "Renamed aux table '" << aux_table->name
- << "' to '" << new_name << "'.";
- }
-
- return(error);
-}
-
-/**********************************************************************//**
-Rename all aux tables of a parent table to HEX format. Also set aux tables'
-flags2 and parent table's flags2 with DICT_TF2_FTS_AUX_HEX_NAME.
-It's called when "%016llu" is used to format an object id in table name,
-which only happens in Windows.
-Note the ids in tables are correct but the names are old ambiguous ones.
-
-This function should make sure that either all the parent table and aux tables
-are set DICT_TF2_FTS_AUX_HEX_NAME with flags2 or none of them are set */
-static MY_ATTRIBUTE((nonnull, warn_unused_result))
-dberr_t
-fts_rename_aux_tables_to_hex_format_low(
-/*====================================*/
- trx_t* trx, /*!< in: transaction */
- dict_table_t* parent_table, /*!< in: parent table */
- ib_vector_t* tables) /*!< in: aux tables to rename. */
-{
- dberr_t error;
- ulint count;
-
- ut_ad(!DICT_TF2_FLAG_IS_SET(parent_table, DICT_TF2_FTS_AUX_HEX_NAME));
- ut_ad(!ib_vector_is_empty(tables));
-
- error = fts_update_hex_format_flag(trx, parent_table->id, true);
-
- if (error != DB_SUCCESS) {
- ib::warn() << "Setting parent table " << parent_table->name
- << " to hex format failed.";
- fts_sql_rollback(trx);
- return(error);
- }
-
- DICT_TF2_FLAG_SET(parent_table, DICT_TF2_FTS_AUX_HEX_NAME);
-
- for (count = 0; count < ib_vector_size(tables); ++count) {
- dict_table_t* table;
- fts_aux_table_t* aux_table;
-
- aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, count));
-
- table = dict_table_open_on_id(aux_table->id, TRUE,
- DICT_TABLE_OP_NORMAL);
-
- ut_ad(table != NULL);
- ut_ad(!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_AUX_HEX_NAME));
-
- /* Set HEX_NAME flag here to make sure we can get correct
- new table name in following function */
- DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME);
- error = fts_rename_one_aux_table_to_hex_format(trx,
- aux_table, parent_table);
- /* We will rollback the trx if the error != DB_SUCCESS,
- so setting the flag here is the same with setting it in
- row_rename_table_for_mysql */
- DBUG_EXECUTE_IF("rename_aux_table_fail", error = DB_ERROR;);
-
- if (error != DB_SUCCESS) {
- dict_table_close(table, TRUE, FALSE);
-
- ib::warn() << "Failed to rename one aux table "
- << aux_table->name << ". Will revert"
- " all successful rename operations.";
-
- fts_sql_rollback(trx);
- break;
- }
-
- error = fts_update_hex_format_flag(trx, aux_table->id, true);
- dict_table_close(table, TRUE, FALSE);
-
- if (error != DB_SUCCESS) {
- ib::warn() << "Setting aux table " << aux_table->name
- << " to hex format failed.";
-
- fts_sql_rollback(trx);
- break;
- }
- }
-
- if (error != DB_SUCCESS) {
- ut_ad(count != ib_vector_size(tables));
-
- /* If rename fails, thr trx would be rolled back, we can't
- use it any more, we'll start a new background trx to do
- the reverting. */
-
- ut_ad(!trx_is_started(trx));
-
- bool not_rename = false;
-
- /* Try to revert those succesful rename operations
- in order to revert the ibd file rename. */
- for (ulint i = 0; i <= count; ++i) {
- dict_table_t* table;
- fts_aux_table_t* aux_table;
- trx_t* trx_bg;
- dberr_t err;
-
- aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, i));
-
- table = dict_table_open_on_id(aux_table->id, TRUE,
- DICT_TABLE_OP_NORMAL);
- ut_ad(table != NULL);
-
- if (not_rename) {
- DICT_TF2_FLAG_UNSET(table,
- DICT_TF2_FTS_AUX_HEX_NAME);
- }
-
- if (!DICT_TF2_FLAG_IS_SET(table,
- DICT_TF2_FTS_AUX_HEX_NAME)) {
- dict_table_close(table, TRUE, FALSE);
- continue;
- }
-
- trx_bg = trx_allocate_for_background();
- trx_bg->op_info = "Revert half done rename";
- trx_bg->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_bg, TRX_DICT_OP_TABLE);
-
- 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, false);
-
- trx_bg->dict_operation_lock_mode = 0;
- dict_table_close(table, TRUE, FALSE);
-
- if (err != DB_SUCCESS) {
- ib::warn() << "Failed to revert table "
- << table->name << ". Please revert"
- " manually.";
- fts_sql_rollback(trx_bg);
- trx_free_for_background(trx_bg);
- /* Continue to clear aux tables' flags2 */
- not_rename = true;
- continue;
- }
-
- fts_sql_commit(trx_bg);
- trx_free_for_background(trx_bg);
- }
-
- DICT_TF2_FLAG_UNSET(parent_table, DICT_TF2_FTS_AUX_HEX_NAME);
- }
-
- return(error);
-}
-
-/**********************************************************************//**
-Convert an id, which is actually a decimal number but was regard as a HEX
-from a string, to its real value. */
-static
-ib_id_t
-fts_fake_hex_to_dec(
-/*================*/
- ib_id_t id) /*!< in: number to convert */
-{
- ib_id_t dec_id = 0;
- char tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
-
-#ifdef UNIV_DEBUG
- int ret =
-#endif /* UNIV_DEBUG */
- sprintf(tmp_id, UINT64PFx, id);
- ut_ad(ret == 16);
-#ifdef UNIV_DEBUG
- ret =
-#endif /* UNIV_DEBUG */
- sscanf(tmp_id, "%016" UINT64scan, &dec_id);
- ut_ad(ret == 1);
-
- return dec_id;
-}
-
-/*********************************************************************//**
-Compare two fts_aux_table_t parent_ids.
-@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
-UNIV_INLINE
-int
-fts_check_aux_table_parent_id_cmp(
-/*==============================*/
- const void* p1, /*!< in: id1 */
- const void* p2) /*!< in: id2 */
-{
- const fts_aux_table_t* fa1 = static_cast<const fts_aux_table_t*>(p1);
- const fts_aux_table_t* fa2 = static_cast<const fts_aux_table_t*>(p2);
-
- return static_cast<int>(fa1->parent_id - fa2->parent_id);
-}
-
-/** Mark all the fts index associated with the parent table as corrupted.
-@param[in] trx transaction
-@param[in, out] parent_table fts index associated with this parent table
- will be marked as corrupted. */
-static
-void
-fts_parent_all_index_set_corrupt(
- trx_t* trx,
- dict_table_t* parent_table)
-{
- fts_t* fts = parent_table->fts;
-
- if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE) {
- trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- }
-
- for (ulint j = 0; j < ib_vector_size(fts->indexes); j++) {
- dict_index_t* index = static_cast<dict_index_t*>(
- ib_vector_getp_const(fts->indexes, j));
- dict_set_corrupted(index,
- trx, "DROP ORPHANED TABLE");
- }
-}
-
-/** Mark the fts index which index id matches the id as corrupted.
-@param[in] trx transaction
-@param[in] id index id to search
-@param[in, out] parent_table parent table to check with all
- the index. */
-static
-void
-fts_set_index_corrupt(
- trx_t* trx,
- index_id_t id,
- dict_table_t* table)
-{
- fts_t* fts = table->fts;
-
- if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE) {
- trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- }
-
- for (ulint j = 0; j < ib_vector_size(fts->indexes); j++) {
- dict_index_t* index = static_cast<dict_index_t*>(
- ib_vector_getp_const(fts->indexes, j));
- if (index->id == id) {
- dict_set_corrupted(index, trx,
- "DROP ORPHANED TABLE");
- break;
- }
- }
-}
-
-/** Check the index for the aux table is corrupted.
-@param[in] aux_table auxiliary table
-@retval nonzero if index is corrupted, zero for valid index */
-static
-ulint
-fts_check_corrupt_index(
- fts_aux_table_t* aux_table)
-{
- dict_table_t* table;
- dict_index_t* index;
- table = dict_table_open_on_id(
- aux_table->parent_id, TRUE, DICT_TABLE_OP_NORMAL);
-
- if (table == NULL) {
- return(0);
- }
-
- for (index = UT_LIST_GET_FIRST(table->indexes);
- index;
- index = UT_LIST_GET_NEXT(indexes, index)) {
- if (index->id == aux_table->index_id) {
- ut_ad(index->type & DICT_FTS);
- dict_table_close(table, true, false);
- return index->is_corrupted();
- }
- }
-
- dict_table_close(table, true, false);
- return(0);
-}
-
-/* Get parent table name if it's a fts aux table
-@param[in] aux_table_name aux table name
-@param[in] aux_table_len aux table length
-@return parent table name, or NULL */
-char*
-fts_get_parent_table_name(
- const char* aux_table_name,
- ulint aux_table_len)
-{
- fts_aux_table_t aux_table;
- char* parent_table_name = NULL;
-
- if (fts_is_aux_table_name(&aux_table, aux_table_name, aux_table_len)) {
- dict_table_t* parent_table;
-
- parent_table = dict_table_open_on_id(
- aux_table.parent_id, TRUE, DICT_TABLE_OP_NORMAL);
-
- if (parent_table != NULL) {
- parent_table_name = mem_strdupl(
- parent_table->name.m_name,
- strlen(parent_table->name.m_name));
-
- dict_table_close(parent_table, TRUE, FALSE);
- }
- }
-
- return(parent_table_name);
-}
-
-/** Check the validity of the parent table.
-@param[in] aux_table auxiliary table
-@return true if it is a valid table or false if it is not */
-static
-bool
-fts_valid_parent_table(
- const fts_aux_table_t* aux_table)
-{
- dict_table_t* parent_table;
- bool valid = false;
-
- parent_table = dict_table_open_on_id(
- aux_table->parent_id, TRUE, DICT_TABLE_OP_NORMAL);
-
- if (parent_table != NULL && parent_table->fts != NULL) {
- if (aux_table->index_id == 0) {
- valid = true;
- } else {
- index_id_t id = aux_table->index_id;
- dict_index_t* index;
-
- /* Search for the FT index in the table's list. */
- for (index = UT_LIST_GET_FIRST(parent_table->indexes);
- index;
- index = UT_LIST_GET_NEXT(indexes, index)) {
- if (index->id == id) {
- valid = true;
- break;
- }
-
- }
- }
- }
-
- if (parent_table) {
- dict_table_close(parent_table, TRUE, FALSE);
- }
-
- return(valid);
-}
-
-/** Try to rename all aux tables of the specified parent table.
-@param[in] aux_tables aux_tables to be renamed
-@param[in] parent_table parent table of all aux
- tables stored in tables. */
-static
-void
-fts_rename_aux_tables_to_hex_format(
- ib_vector_t* aux_tables,
- dict_table_t* parent_table)
-{
- dberr_t err;
- trx_t* trx_rename = trx_allocate_for_background();
- trx_rename->op_info = "Rename aux tables to hex format";
- trx_rename->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_rename, TRX_DICT_OP_TABLE);
-
- err = fts_rename_aux_tables_to_hex_format_low(trx_rename,
- parent_table, aux_tables);
-
- trx_rename->dict_operation_lock_mode = 0;
-
- if (err != DB_SUCCESS) {
-
- ib::warn() << "Rollback operations on all aux tables of "
- "table "<< parent_table->name << ". All the fts index "
- "associated with the table are marked as corrupted. "
- "Please rebuild the index again.";
-
- /* Corrupting the fts index related to parent table. */
- trx_t* trx_corrupt;
- trx_corrupt = trx_allocate_for_background();
- trx_corrupt->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_corrupt, TRX_DICT_OP_TABLE);
- fts_parent_all_index_set_corrupt(trx_corrupt, parent_table);
- trx_corrupt->dict_operation_lock_mode = 0;
- fts_sql_commit(trx_corrupt);
- trx_free_for_background(trx_corrupt);
- } else {
- fts_sql_commit(trx_rename);
- }
-
- trx_free_for_background(trx_rename);
- ib_vector_reset(aux_tables);
-}
-
-/** Set the hex format flag for the parent table.
-@param[in, out] parent_table parent table
-@param[in] trx transaction */
-static
-void
-fts_set_parent_hex_format_flag(
- dict_table_t* parent_table,
- trx_t* trx)
-{
- if (!DICT_TF2_FLAG_IS_SET(parent_table,
- DICT_TF2_FTS_AUX_HEX_NAME)) {
- DBUG_EXECUTE_IF("parent_table_flag_fail", DBUG_SUICIDE(););
-
- dberr_t err = fts_update_hex_format_flag(
- trx, parent_table->id, true);
-
- if (err != DB_SUCCESS) {
- ib::fatal() << "Setting parent table "
- << parent_table->name
- << "to hex format failed. Please try "
- << "to restart the server again, if it "
- << "doesn't work, the system tables "
- << "might be corrupted.";
- } else {
- DICT_TF2_FLAG_SET(
- parent_table, DICT_TF2_FTS_AUX_HEX_NAME);
- }
- }
-}
-
-/** Drop the obsolete auxilary table.
-@param[in] tables tables to be dropped. */
-static
-void
-fts_drop_obsolete_aux_table_from_vector(
- ib_vector_t* tables)
-{
- dberr_t err;
-
- for (ulint count = 0; count < ib_vector_size(tables);
- ++count) {
-
- fts_aux_table_t* aux_drop_table;
- aux_drop_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, count));
- trx_t* trx_drop = trx_allocate_for_background();
- trx_drop->op_info = "Drop obsolete aux tables";
- trx_drop->dict_operation_lock_mode = RW_X_LATCH;
- trx_start_for_ddl(trx_drop, TRX_DICT_OP_TABLE);
-
- err = row_drop_table_for_mysql(
- aux_drop_table->name, trx_drop,
- SQLCOM_DROP_TABLE, true);
-
- trx_drop->dict_operation_lock_mode = 0;
-
- if (err != DB_SUCCESS) {
- /* We don't need to worry about the
- failure, since server would try to
- drop it on next restart, even if
- the table was broken. */
- ib::warn() << "Failed to drop obsolete aux table "
- << aux_drop_table->name << ", which is "
- << "harmless. will try to drop it on next "
- << "restart.";
-
- fts_sql_rollback(trx_drop);
- } else {
- ib::info() << "Dropped obsolete aux"
- " table '" << aux_drop_table->name
- << "'.";
-
- fts_sql_commit(trx_drop);
- }
-
- trx_free_for_background(trx_drop);
- }
-}
-
-/** Drop all the auxiliary table present in the vector.
-@param[in] trx transaction
-@param[in] tables tables to be dropped */
-static
-void
-fts_drop_aux_table_from_vector(
- trx_t* trx,
- ib_vector_t* tables)
-{
- for (ulint count = 0; count < ib_vector_size(tables);
- ++count) {
- fts_aux_table_t* aux_drop_table;
- aux_drop_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, count));
-
- /* Check for the validity of the parent table */
- if (!fts_valid_parent_table(aux_drop_table)) {
-
- ib::warn() << "Parent table of FTS auxiliary table "
- << aux_drop_table->name << " not found.";
-
- dberr_t err = fts_drop_table(trx, aux_drop_table->name);
- if (err == DB_FAIL) {
-
- char* path = fil_make_filepath(
- NULL, aux_drop_table->name, IBD, false);
-
- if (path != NULL) {
- os_file_delete_if_exists(
- innodb_data_file_key,
- path , NULL);
- ut_free(path);
- }
- }
- }
- }
-}
-
-/**********************************************************************//**
-Check and drop all orphaned FTS auxiliary tables, those that don't have
-a parent table or FTS index defined on them.
-@return DB_SUCCESS or error code */
-static MY_ATTRIBUTE((nonnull))
-void
-fts_check_and_drop_orphaned_tables(
-/*===============================*/
- trx_t* trx, /*!< in: transaction */
- ib_vector_t* tables) /*!< in: tables to check */
-{
- mem_heap_t* heap;
- ib_vector_t* aux_tables_to_rename;
- ib_vector_t* invalid_aux_tables;
- ib_vector_t* valid_aux_tables;
- ib_vector_t* drop_aux_tables;
- ib_vector_t* obsolete_aux_tables;
- ib_alloc_t* heap_alloc;
-
- heap = mem_heap_create(1024);
- heap_alloc = ib_heap_allocator_create(heap);
-
- /* We store all aux tables belonging to the same parent table here,
- and rename all these tables in a batch mode. */
- aux_tables_to_rename = ib_vector_create(heap_alloc,
- sizeof(fts_aux_table_t), 128);
-
- /* We store all fake auxiliary table and orphaned table here. */
- invalid_aux_tables = ib_vector_create(heap_alloc,
- sizeof(fts_aux_table_t), 128);
-
- /* We store all valid aux tables. We use this to filter the
- fake auxiliary table from invalid auxiliary tables. */
- valid_aux_tables = ib_vector_create(heap_alloc,
- sizeof(fts_aux_table_t), 128);
-
- /* We store all auxiliary tables to be dropped. */
- drop_aux_tables = ib_vector_create(heap_alloc,
- sizeof(fts_aux_table_t), 128);
-
- /* We store all obsolete auxiliary tables to be dropped. */
- obsolete_aux_tables = ib_vector_create(heap_alloc,
- sizeof(fts_aux_table_t), 128);
-
- /* Sort by parent_id first, in case rename will fail */
- ib_vector_sort(tables, fts_check_aux_table_parent_id_cmp);
-
- for (ulint i = 0; i < ib_vector_size(tables); ++i) {
- dict_table_t* parent_table;
- fts_aux_table_t* aux_table;
- bool drop = false;
- dict_table_t* table;
- fts_aux_table_t* next_aux_table = NULL;
- ib_id_t orig_parent_id = 0;
- ib_id_t orig_index_id = 0;
- bool rename = false;
-
- aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, i));
-
- table = dict_table_open_on_id(
- aux_table->id, TRUE, DICT_TABLE_OP_NORMAL);
- orig_parent_id = aux_table->parent_id;
- orig_index_id = aux_table->index_id;
-
- if (table == NULL
- || strcmp(table->name.m_name, aux_table->name)) {
-
- bool fake_aux = false;
-
- if (table != NULL) {
- dict_table_close(table, TRUE, FALSE);
- }
-
- if (i + 1 < ib_vector_size(tables)) {
- next_aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, i + 1));
- }
-
- /* To know whether aux table is fake fts or
- orphan fts table. */
- for (ulint count = 0;
- count < ib_vector_size(valid_aux_tables);
- count++) {
- fts_aux_table_t* valid_aux;
- valid_aux = static_cast<fts_aux_table_t*>(
- ib_vector_get(valid_aux_tables, count));
- if (strcmp(valid_aux->name,
- aux_table->name) == 0) {
- fake_aux = true;
- break;
- }
- }
-
- /* All aux tables of parent table, whose id is
- last_parent_id, have been checked, try to rename
- them if necessary. */
- if ((next_aux_table == NULL
- || orig_parent_id != next_aux_table->parent_id)
- && (!ib_vector_is_empty(aux_tables_to_rename))) {
+bool fts_check_aux_table(const char *name,
+ table_id_t *table_id,
+ index_id_t *index_id)
+{
+ ulint len= strlen(name);
+ const char* ptr;
+ const char* end= name + len;
- ib_id_t parent_id = fts_fake_hex_to_dec(
- aux_table->parent_id);
+ ut_ad(len <= MAX_FULL_NAME_LEN);
+ ptr= static_cast<const char*>(memchr(name, '/', len));
- parent_table = dict_table_open_on_id(
- parent_id, TRUE,
- DICT_TABLE_OP_NORMAL);
+ if (ptr != NULL)
+ {
+ /* We will start the match after the '/' */
+ ++ptr;
+ len = end - ptr;
+ }
+
+ /* All auxiliary tables are prefixed with "FTS_" and the name
+ length will be at the very least greater than 20 bytes. */
+ if (ptr && len > 20 && !memcmp(ptr, "FTS_", 4))
+ {
+ /* Skip the prefix. */
+ ptr+= 4;
+ len-= 4;
+
+ const char *table_id_ptr= ptr;
+ /* Skip the table id. */
+ ptr= static_cast<const char*>(memchr(ptr, '_', len));
+
+ if (!ptr)
+ return false;
+
+ /* Skip the underscore. */
+ ++ptr;
+ ut_ad(end > ptr);
+ len= end - ptr;
+
+ sscanf(table_id_ptr, UINT64PFx, table_id);
+ /* First search the common table suffix array. */
+ for (ulint i = 0; fts_common_tables[i]; ++i)
+ {
+ if (!strncmp(ptr, fts_common_tables[i], len))
+ return true;
+ }
+
+ /* Could be obsolete common tables. */
+ if ((len == 5 && !memcmp(ptr, "ADDED", len)) ||
+ (len == 9 && !memcmp(ptr, "STOPWORDS", len)))
+ return true;
+
+ const char* index_id_ptr= ptr;
+ /* Skip the index id. */
+ ptr= static_cast<const char*>(memchr(ptr, '_', len));
+ if (!ptr)
+ return false;
+
+ sscanf(index_id_ptr, UINT64PFx, index_id);
+
+ /* Skip the underscore. */
+ ++ptr;
+ ut_a(end > ptr);
+ len= end - ptr;
+
+ if (len > 7)
+ return false;
+
+ /* Search the FT index specific array. */
+ for (ulint i = 0; i < FTS_NUM_AUX_INDEX; ++i)
+ {
+ if (!memcmp(ptr, "INDEX_", len - 1))
+ return true;
+ }
+
+ /* Other FT index specific table(s). */
+ if (len == 6 && !memcmp(ptr, "DOC_ID", len))
+ return true;
+ }
+
+ return false;
+}
+
+typedef std::pair<table_id_t,index_id_t> fts_aux_id;
+typedef std::set<fts_aux_id> fts_space_set_t;
+
+/** Iterate over all the spaces in the space list and fetch the
+fts parent table id and index id.
+@param[in,out] fts_space_set store the list of tablespace id and
+ index id */
+static void fil_get_fts_spaces(fts_space_set_t& fts_space_set)
+{
+ mutex_enter(&fil_system->mutex);
+
+ for (fil_space_t *space = UT_LIST_GET_FIRST(fil_system->space_list);
+ space != NULL;
+ space = UT_LIST_GET_NEXT(space_list, space))
+ {
+ index_id_t index_id = 0;
+ table_id_t table_id = 0;
+
+ if (space->purpose == FIL_TYPE_TABLESPACE
+ && fts_check_aux_table(space->name, &table_id, &index_id))
+ fts_space_set.insert(std::make_pair(table_id, index_id));
+ }
+
+ mutex_exit(&fil_system->mutex);
+}
+
+/** Check whether the parent table id and index id of fts auxilary
+tables with SYS_INDEXES. If it exists then we can safely ignore the
+fts table from orphaned tables.
+@param[in,out] fts_space_set fts space set contains set of auxiliary
+ table ids */
+static void fts_check_orphaned_tables(fts_space_set_t& fts_space_set)
+{
+ btr_pcur_t pcur;
+ mtr_t mtr;
+ trx_t* trx = trx_allocate_for_background();
+ trx->op_info = "checking fts orphaned tables";
+
+ row_mysql_lock_data_dictionary(trx);
+
+ mtr.start();
+ btr_pcur_open_at_index_side(
+ true, dict_table_get_first_index(dict_sys->sys_indexes),
+ BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
+
+ do
+ {
+ const rec_t *rec;
+ const byte *tbl_field;
+ const byte *index_field;
+ ulint len;
+
+ btr_pcur_move_to_next_user_rec(&pcur, &mtr);
+ if (!btr_pcur_is_on_user_rec(&pcur))
+ break;
+
+ rec= btr_pcur_get_rec(&pcur);
+ if (rec_get_deleted_flag(rec, 0))
+ continue;
+
+ tbl_field= rec_get_nth_field_old(rec, 0, &len);
+ if (len != 8)
+ continue;
+
+ index_field= rec_get_nth_field_old(rec, 1, &len);
+ if (len != 8)
+ continue;
+
+ table_id_t table_id = mach_read_from_8(tbl_field);
+ index_id_t index_id = mach_read_from_8(index_field);
+
+ fts_space_set_t::iterator it = fts_space_set.find(
+ fts_aux_id(table_id, index_id));
- fts_rename_aux_tables_to_hex_format(
- aux_tables_to_rename, parent_table);
-
- dict_table_close(parent_table, TRUE,
- FALSE);
- }
-
- /* If the aux table is fake aux table. Skip it. */
- if (!fake_aux) {
- ib_vector_push(invalid_aux_tables, aux_table);
- }
-
- continue;
- } else if (!DICT_TF2_FLAG_IS_SET(table,
- DICT_TF2_FTS_AUX_HEX_NAME)) {
-
- aux_table->parent_id = fts_fake_hex_to_dec(
- aux_table->parent_id);
-
- if (aux_table->index_id != 0) {
- aux_table->index_id = fts_fake_hex_to_dec(
- aux_table->index_id);
- }
-
- ut_ad(aux_table->id > aux_table->parent_id);
-
- /* Check whether parent table id and index id
- are stored as decimal format. */
- if (fts_valid_parent_table(aux_table)) {
-
- parent_table = dict_table_open_on_id(
- aux_table->parent_id, true,
- DICT_TABLE_OP_NORMAL);
-
- ut_ad(parent_table != NULL);
- ut_ad(parent_table->fts != NULL);
-
- if (!DICT_TF2_FLAG_IS_SET(
- parent_table,
- DICT_TF2_FTS_AUX_HEX_NAME)) {
- rename = true;
- }
-
- dict_table_close(parent_table, TRUE, FALSE);
- }
-
- if (!rename) {
- /* Reassign the original value of
- aux table if it is not in decimal format */
- aux_table->parent_id = orig_parent_id;
- aux_table->index_id = orig_index_id;
- }
- }
-
- if (table != NULL) {
- dict_table_close(table, TRUE, FALSE);
- }
-
- if (!rename) {
- /* Check the validity of the parent table. */
- if (!fts_valid_parent_table(aux_table)) {
- drop = true;
- }
- }
-
- /* Filter out the fake aux table by comparing with the
- current valid auxiliary table name. */
- for (ulint count = 0;
- count < ib_vector_size(invalid_aux_tables); count++) {
- fts_aux_table_t* invalid_aux;
- invalid_aux = static_cast<fts_aux_table_t*>(
- ib_vector_get(invalid_aux_tables, count));
- if (strcmp(invalid_aux->name, aux_table->name) == 0) {
- ib_vector_remove(
- invalid_aux_tables,
- *reinterpret_cast<void**>(invalid_aux));
- break;
- }
- }
-
- ib_vector_push(valid_aux_tables, aux_table);
-
- /* If the index associated with aux table is corrupted,
- skip it. */
- if (fts_check_corrupt_index(aux_table) > 0) {
-
- if (i + 1 < ib_vector_size(tables)) {
- next_aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, i + 1));
- }
-
- if (next_aux_table == NULL
- || orig_parent_id != next_aux_table->parent_id) {
-
- parent_table = dict_table_open_on_id(
- aux_table->parent_id, TRUE,
- DICT_TABLE_OP_NORMAL);
-
- if (!ib_vector_is_empty(aux_tables_to_rename)) {
- fts_rename_aux_tables_to_hex_format(
- aux_tables_to_rename, parent_table);
- } else {
- fts_set_parent_hex_format_flag(
- parent_table, trx);
- }
-
- dict_table_close(parent_table, TRUE, FALSE);
- }
-
- continue;
- }
-
- parent_table = dict_table_open_on_id(
- aux_table->parent_id, TRUE, DICT_TABLE_OP_NORMAL);
-
- if (drop) {
- ib_vector_push(drop_aux_tables, aux_table);
- } else {
- if (FTS_IS_OBSOLETE_AUX_TABLE(aux_table->name)) {
- ib_vector_push(obsolete_aux_tables, aux_table);
- continue;
- }
- }
-
- /* If the aux table is in decimal format, we should
- rename it, so push it to aux_tables_to_rename */
- if (!drop && rename) {
- bool rename_table = true;
- for (ulint count = 0;
- count < ib_vector_size(aux_tables_to_rename);
- count++) {
- fts_aux_table_t* rename_aux =
- static_cast<fts_aux_table_t*>(
- ib_vector_get(aux_tables_to_rename,
- count));
- if (strcmp(rename_aux->name,
- aux_table->name) == 0) {
- rename_table = false;
- break;
- }
- }
-
- if (rename_table) {
- ib_vector_push(aux_tables_to_rename,
- aux_table);
- }
- }
-
- if (i + 1 < ib_vector_size(tables)) {
- next_aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_get(tables, i + 1));
- }
-
- if ((next_aux_table == NULL
- || orig_parent_id != next_aux_table->parent_id)
- && !ib_vector_is_empty(aux_tables_to_rename)) {
-
- ut_ad(rename);
- ut_ad(!DICT_TF2_FLAG_IS_SET(
- parent_table, DICT_TF2_FTS_AUX_HEX_NAME));
-
- fts_rename_aux_tables_to_hex_format(
- aux_tables_to_rename,parent_table);
- }
-
- /* The IDs are already in correct hex format. */
- if (!drop && !rename) {
- dict_table_t* table;
-
- table = dict_table_open_on_id(
- aux_table->id, TRUE, DICT_TABLE_OP_NORMAL);
-
- if (table != NULL
- && strcmp(table->name.m_name, aux_table->name)) {
- dict_table_close(table, TRUE, FALSE);
- table = NULL;
- }
-
- if (table != NULL
- && !DICT_TF2_FLAG_IS_SET(
- table,
- DICT_TF2_FTS_AUX_HEX_NAME)) {
-
- DBUG_EXECUTE_IF("aux_table_flag_fail",
- ib::warn() << "Setting aux table "
- << table->name << " to hex "
- "format failed.";
- fts_set_index_corrupt(
- trx, aux_table->index_id,
- parent_table);
- goto table_exit;);
-
- dberr_t err = fts_update_hex_format_flag(
- trx, table->id, true);
-
- if (err != DB_SUCCESS) {
- ib::warn() << "Setting aux table "
- << table->name << " to hex "
- "format failed.";
-
- fts_set_index_corrupt(
- trx, aux_table->index_id,
- parent_table);
- } else {
- DICT_TF2_FLAG_SET(table,
- DICT_TF2_FTS_AUX_HEX_NAME);
- }
- }
-#ifndef DBUG_OFF
-table_exit:
-#endif /* !DBUG_OFF */
-
- if (table != NULL) {
- dict_table_close(table, TRUE, FALSE);
- }
-
- ut_ad(parent_table != NULL);
-
- fts_set_parent_hex_format_flag(
- parent_table, trx);
- }
-
- if (parent_table != NULL) {
- dict_table_close(parent_table, TRUE, FALSE);
- }
- }
-
- fts_drop_aux_table_from_vector(trx, invalid_aux_tables);
- fts_drop_aux_table_from_vector(trx, drop_aux_tables);
- fts_sql_commit(trx);
-
- fts_drop_obsolete_aux_table_from_vector(obsolete_aux_tables);
-
- /* Free the memory allocated at the beginning */
- if (heap != NULL) {
- mem_heap_free(heap);
- }
+ if (it != fts_space_set.end())
+ fts_space_set.erase(*it);
+ else
+ {
+ it= fts_space_set.find(fts_aux_id(table_id, 0));
+ if (it != fts_space_set.end())
+ fts_space_set.erase(*it);
+ }
+ } while(!fts_space_set.empty());
+
+ btr_pcur_close(&pcur);
+ mtr.commit();
+ row_mysql_unlock_data_dictionary(trx);
+ trx_free_for_background(trx);
}
-/**********************************************************************//**
-Drop all orphaned FTS auxiliary tables, those that don't have a parent
-table or FTS index defined on them. */
-void
-fts_drop_orphaned_tables(void)
-/*==========================*/
+/** Drop all fts auxilary table for the respective fts_id
+@param[in] fts_id fts auxilary table ids */
+static void fts_drop_all_aux_tables(trx_t *trx, fts_table_t *fts_table)
{
- trx_t* trx;
- pars_info_t* info;
- mem_heap_t* heap;
- que_t* graph;
- ib_vector_t* tables;
- ib_alloc_t* heap_alloc;
- space_name_list_t space_name_list;
- dberr_t error = DB_SUCCESS;
-
- /* Note: We have to free the memory after we are done with the list. */
- error = fil_get_space_names(space_name_list);
-
- if (error == DB_OUT_OF_MEMORY) {
- ib::fatal() << "Out of memory";
- }
-
- heap = mem_heap_create(1024);
- heap_alloc = ib_heap_allocator_create(heap);
-
- /* We store the table ids of all the FTS indexes that were found. */
- tables = ib_vector_create(heap_alloc, sizeof(fts_aux_table_t), 128);
-
- /* Get the list of all known .ibd files and check for orphaned
- FTS auxiliary files in that list. We need to remove them because
- users can't map them back to table names and this will create
- unnecessary clutter. */
-
- for (space_name_list_t::iterator it = space_name_list.begin();
- it != space_name_list.end();
- ++it) {
-
- fts_aux_table_t* fts_aux_table;
-
- fts_aux_table = static_cast<fts_aux_table_t*>(
- ib_vector_push(tables, NULL));
-
- memset(fts_aux_table, 0x0, sizeof(*fts_aux_table));
-
- if (!fts_is_aux_table_name(fts_aux_table, *it, strlen(*it))) {
- ib_vector_pop(tables);
- } else {
- ulint len = strlen(*it);
-
- fts_aux_table->id = fil_space_get_id_by_name(*it);
-
- /* We got this list from fil0fil.cc. The tablespace
- with this name must exist. */
- ut_a(fts_aux_table->id != ULINT_UNDEFINED);
-
- fts_aux_table->name = static_cast<char*>(
- mem_heap_dup(heap, *it, len + 1));
-
- fts_aux_table->name[len] = 0;
- }
- }
-
- trx = trx_allocate_for_background();
- trx->op_info = "dropping orphaned FTS tables";
- row_mysql_lock_data_dictionary(trx);
-
- info = pars_info_create();
-
- pars_info_bind_function(info, "my_func", fts_read_tables, tables);
-
- graph = fts_parse_sql_no_dict_lock(
- NULL,
- info,
- "DECLARE FUNCTION my_func;\n"
- "DECLARE CURSOR c IS"
- " SELECT NAME, ID"
- " FROM SYS_TABLES;\n"
- "BEGIN\n"
- "\n"
- "OPEN c;\n"
- "WHILE 1 = 1 LOOP\n"
- " FETCH c INTO my_func();\n"
- " IF c % NOTFOUND THEN\n"
- " EXIT;\n"
- " END IF;\n"
- "END LOOP;\n"
- "CLOSE c;");
-
- for (;;) {
- error = fts_eval_sql(trx, graph);
+ char fts_table_name[MAX_FULL_NAME_LEN];
+ for (ulint i= 0;i < FTS_NUM_AUX_INDEX; i++)
+ {
+ fts_table->suffix= fts_get_suffix(i);
+ fts_get_table_name(fts_table, fts_table_name, true);
+
+ /* Drop all fts aux and common table */
+ dberr_t err= fts_drop_table(trx, fts_table_name);
+
+ if (err == DB_FAIL)
+ {
+ char *path= fil_make_filepath(NULL, fts_table_name, IBD, false);
+
+ if (path != NULL)
+ {
+ os_file_delete_if_exists(innodb_data_file_key, path , NULL);
+ ut_free(path);
+ }
+ }
+ }
+}
+
+/** Drop all orphaned FTS auxiliary tables, those that don't have
+a parent table or FTS index defined on them. */
+void fts_drop_orphaned_tables()
+{
+ fts_space_set_t fts_space_set;
+ fil_get_fts_spaces(fts_space_set);
- if (error == DB_SUCCESS) {
- fts_check_and_drop_orphaned_tables(trx, tables);
- break; /* Exit the loop. */
- } else {
- ib_vector_reset(tables);
-
- fts_sql_rollback(trx);
+ if (fts_space_set.empty())
+ return;
+
+ fts_check_orphaned_tables(fts_space_set);
+
+ if (fts_space_set.empty())
+ return;
+
+ trx_t* trx= trx_allocate_for_background();
+ trx->op_info= "Drop orphaned aux FTS tables";
+ row_mysql_lock_data_dictionary(trx);
+
+ for (fts_space_set_t::iterator it = fts_space_set.begin();
+ it != fts_space_set.end(); it++)
+ {
+ fts_table_t fts_table;
+ dict_table_t *table= dict_table_open_on_id(it->first, TRUE,
+ DICT_TABLE_OP_NORMAL);
+ if (!table)
+ continue;
+
+ FTS_INIT_FTS_TABLE(&fts_table, NULL, FTS_COMMON_TABLE, table);
+ fts_drop_common_tables(trx, &fts_table, true);
+
+ fts_table.type= FTS_INDEX_TABLE;
+ fts_table.index_id= it->second;
+ fts_drop_all_aux_tables(trx, &fts_table);
- if (error == DB_LOCK_WAIT_TIMEOUT) {
- ib::warn() << "lock wait timeout reading"
- " SYS_TABLES. Retrying!";
-
- trx->error_state = DB_SUCCESS;
- } else {
- ib::error() << "(" << ut_strerr(error)
- << ") while reading SYS_TABLES.";
-
- break; /* Exit the loop. */
- }
- }
- }
-
- que_graph_free(graph);
-
- row_mysql_unlock_data_dictionary(trx);
-
- trx_free_for_background(trx);
-
- if (heap != NULL) {
- mem_heap_free(heap);
- }
-
- /** Free the memory allocated to store the .ibd names. */
- for (space_name_list_t::iterator it = space_name_list.begin();
- it != space_name_list.end();
- ++it) {
-
- UT_DELETE_ARRAY(*it);
- }
+ dict_table_close(table, true, false);
+ }
+ trx_commit_for_mysql(trx);
+ row_mysql_unlock_data_dictionary(trx);
+ trx->dict_operation_lock_mode= 0;
+ trx_free_for_background(trx);
}
/**********************************************************************//**
@@ -7168,20 +6038,18 @@ This function loads the stopword into the FTS cache. It also
records/fetches stopword configuration to/from FTS configure
table, depending on whether we are creating or reloading the
FTS.
-@return TRUE if load operation is successful */
-ibool
+@return true if load operation is successful */
+bool
fts_load_stopword(
/*==============*/
const dict_table_t*
table, /*!< in: Table with FTS */
trx_t* trx, /*!< in: Transactions */
- const char* global_stopword_table, /*!< in: Global stopword table
- name */
const char* session_stopword_table, /*!< in: Session stopword table
name */
- ibool stopword_is_on, /*!< in: Whether stopword
+ bool stopword_is_on, /*!< in: Whether stopword
option is turned on/off */
- ibool reload) /*!< in: Whether it is
+ bool reload) /*!< in: Whether it is
for reloading FTS table */
{
fts_table_t fts_table;
@@ -7197,9 +6065,8 @@ fts_load_stopword(
cache = table->fts->cache;
- if (!reload && !(cache->stopword_info.status
- & STOPWORD_NOT_INIT)) {
- return(TRUE);
+ if (!reload && !(cache->stopword_info.status & STOPWORD_NOT_INIT)) {
+ return true;
}
if (!trx) {
@@ -7249,12 +6116,11 @@ fts_load_stopword(
goto cleanup;
}
- if (strlen((char*) str.f_str) > 0) {
+ if (*str.f_str) {
stopword_to_use = (const char*) str.f_str;
}
} else {
- stopword_to_use = (session_stopword_table)
- ? session_stopword_table : global_stopword_table;
+ stopword_to_use = session_stopword_table;
}
if (stopword_to_use
@@ -7292,7 +6158,7 @@ cleanup:
&my_charset_latin1);
}
- return(error == DB_SUCCESS);
+ return error == DB_SUCCESS;
}
/**********************************************************************//**
@@ -7493,7 +6359,7 @@ fts_init_index(
} else {
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
- fts_load_stopword(table, NULL, NULL, NULL, TRUE, TRUE);
+ fts_load_stopword(table, NULL, NULL, true, true);
}
for (ulint i = 0; i < ib_vector_size(cache->get_docs); ++i) {
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 202bd80d20a..3cabb64b851 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -525,7 +525,7 @@ fts_index_fetch_nodes(
for (;;) {
error = fts_eval_sql(trx, *graph);
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
break; /* Exit the loop. */
@@ -538,7 +538,7 @@ fts_index_fetch_nodes(
trx->error_state = DB_SUCCESS;
} else {
- ib::error() << "(" << ut_strerr(error)
+ ib::error() << "(" << error
<< ") while reading FTS index.";
break; /* Exit the loop. */
@@ -860,7 +860,7 @@ fts_index_fetch_words(
error = fts_eval_sql(optim->trx, graph);
}
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
//FIXME fts_sql_commit(optim->trx);
break;
} else {
@@ -877,7 +877,7 @@ fts_index_fetch_words(
optim->trx->error_state = DB_SUCCESS;
} else {
- ib::error() << "(" << ut_strerr(error)
+ ib::error() << "(" << error
<< ") while reading document.";
break; /* Exit the loop. */
@@ -920,7 +920,7 @@ fts_fetch_doc_ids(
int i = 0;
sel_node_t* sel_node = static_cast<sel_node_t*>(row);
fts_doc_ids_t* fts_doc_ids = static_cast<fts_doc_ids_t*>(user_arg);
- fts_update_t* update = static_cast<fts_update_t*>(
+ doc_id_t* update = static_cast<doc_id_t*>(
ib_vector_push(fts_doc_ids->doc_ids, NULL));
for (exp = sel_node->select_list;
@@ -936,8 +936,7 @@ fts_fetch_doc_ids(
/* Note: The column numbers below must match the SELECT. */
switch (i) {
case 0: /* DOC_ID */
- update->fts_indexes = NULL;
- update->doc_id = fts_read_doc_id(
+ *update = fts_read_doc_id(
static_cast<byte*>(data));
break;
@@ -1005,7 +1004,7 @@ fts_table_fetch_doc_ids(
mutex_exit(&dict_sys->mutex);
if (error == DB_SUCCESS) {
- ib_vector_sort(doc_ids->doc_ids, fts_update_doc_id_cmp);
+ ib_vector_sort(doc_ids->doc_ids, fts_doc_id_cmp);
}
if (alloc_bk_trx) {
@@ -1022,7 +1021,7 @@ Do a binary search for a doc id in the array
int
fts_bsearch(
/*========*/
- fts_update_t* array, /*!< in: array to sort */
+ doc_id_t* array, /*!< in: array to sort */
int lower, /*!< in: the array lower bound */
int upper, /*!< in: the array upper bound */
doc_id_t doc_id) /*!< in: the doc id to search for */
@@ -1036,9 +1035,9 @@ fts_bsearch(
while (lower < upper) {
int i = (lower + upper) >> 1;
- if (doc_id > array[i].doc_id) {
+ if (doc_id > array[i]) {
lower = i + 1;
- } else if (doc_id < array[i].doc_id) {
+ } else if (doc_id < array[i]) {
upper = i - 1;
} else {
return(i); /* Found. */
@@ -1047,7 +1046,7 @@ fts_bsearch(
}
if (lower == upper && lower < orig_size) {
- if (doc_id == array[lower].doc_id) {
+ if (doc_id == array[lower]) {
return(lower);
} else if (lower == 0) {
return(-1);
@@ -1074,7 +1073,7 @@ fts_optimize_lookup(
{
int pos;
int upper = static_cast<int>(ib_vector_size(doc_ids));
- fts_update_t* array = (fts_update_t*) doc_ids->data;
+ doc_id_t* array = (doc_id_t*) doc_ids->data;
pos = fts_bsearch(array, static_cast<int>(lower), upper, first_doc_id);
@@ -1087,10 +1086,10 @@ fts_optimize_lookup(
/* If i is 1, it could be first_doc_id is less than
either the first or second array item, do a
double check */
- if (i == 1 && array[0].doc_id <= last_doc_id
- && first_doc_id < array[0].doc_id) {
+ if (i == 1 && array[0] <= last_doc_id
+ && first_doc_id < array[0]) {
pos = 0;
- } else if (i < upper && array[i].doc_id <= last_doc_id) {
+ } else if (i < upper && array[i] <= last_doc_id) {
/* Check if the "next" doc id is within the
first & last doc id of the node. */
@@ -1229,12 +1228,12 @@ test_again:
delta for decoding the entries following this document's
entries. */
if (*del_pos >= 0 && *del_pos < (int) ib_vector_size(del_vec)) {
- fts_update_t* update;
+ doc_id_t* update;
- update = (fts_update_t*) ib_vector_get(
+ update = (doc_id_t*) ib_vector_get(
del_vec, *del_pos);
- del_doc_id = update->doc_id;
+ del_doc_id = *update;
}
if (enc->src_ilist_ptr == src_node->ilist && doc_id == 0) {
@@ -1357,12 +1356,6 @@ fts_optimize_word(
enc.src_last_doc_id = 0;
enc.src_ilist_ptr = NULL;
- if (fts_enable_diag_print) {
- word->text.f_str[word->text.f_len] = 0;
- ib::info() << "FTS_OPTIMIZE: optimize \"" << word->text.f_str
- << "\"";
- }
-
while (i < size) {
ulint copied;
fts_node_t* src_node;
@@ -1440,11 +1433,6 @@ fts_optimize_write_word(
ut_ad(fts_table->charset);
- if (fts_enable_diag_print) {
- ib::info() << "FTS_OPTIMIZE: processed \"" << word->f_str
- << "\"";
- }
-
pars_info_bind_varchar_literal(
info, "word", word->f_str, word->f_len);
@@ -1462,8 +1450,8 @@ fts_optimize_write_word(
error = fts_eval_sql(trx, graph);
- if (error != DB_SUCCESS) {
- ib::error() << "(" << ut_strerr(error) << ") during optimize,"
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
+ ib::error() << "(" << error << ") during optimize,"
" when deleting a word from the FTS index.";
}
@@ -1486,8 +1474,8 @@ fts_optimize_write_word(
error = fts_write_node(
trx, &graph, fts_table, word, node);
- if (error != DB_SUCCESS) {
- ib::error() << "(" << ut_strerr(error) << ")"
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
+ ib::error() << "(" << error << ")"
" during optimize, while adding a"
" word to the FTS index.";
}
@@ -1876,9 +1864,8 @@ fts_optimize_index_completed(
error = fts_config_set_index_value(
optim->trx, index, FTS_LAST_OPTIMIZED_WORD, &word);
- if (error != DB_SUCCESS) {
-
- ib::error() << "(" << ut_strerr(error) << ") while updating"
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
+ ib::error() << "(" << error << ") while updating"
" last optimized word!";
}
@@ -2020,7 +2007,7 @@ fts_optimize_purge_deleted_doc_ids(
ulint i;
pars_info_t* info;
que_t* graph;
- fts_update_t* update;
+ doc_id_t* update;
doc_id_t write_doc_id;
dberr_t error = DB_SUCCESS;
char deleted[MAX_FULL_NAME_LEN];
@@ -2030,11 +2017,11 @@ fts_optimize_purge_deleted_doc_ids(
ut_a(ib_vector_size(optim->to_delete->doc_ids) > 0);
- update = static_cast<fts_update_t*>(
+ update = static_cast<doc_id_t*>(
ib_vector_get(optim->to_delete->doc_ids, 0));
/* Convert to "storage" byte order. */
- fts_write_doc_id((byte*) &write_doc_id, update->doc_id);
+ fts_write_doc_id((byte*) &write_doc_id, *update);
/* This is required for the SQL parser to work. It must be able
to find the following variables. So we do it twice. */
@@ -2056,11 +2043,11 @@ fts_optimize_purge_deleted_doc_ids(
/* Delete the doc ids that were copied at the start. */
for (i = 0; i < ib_vector_size(optim->to_delete->doc_ids); ++i) {
- update = static_cast<fts_update_t*>(ib_vector_get(
+ update = static_cast<doc_id_t*>(ib_vector_get(
optim->to_delete->doc_ids, i));
/* Convert to "storage" byte order. */
- fts_write_doc_id((byte*) &write_doc_id, update->doc_id);
+ fts_write_doc_id((byte*) &write_doc_id, *update);
fts_bind_doc_id(info, "doc_id1", &write_doc_id);
@@ -2430,7 +2417,7 @@ fts_optimize_table(
fts_optimize_t* optim = NULL;
fts_t* fts = table->fts;
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "FTS start optimize " << table->name;
}
@@ -2482,7 +2469,7 @@ fts_optimize_table(
if (error == DB_SUCCESS
&& optim->n_completed == ib_vector_size(fts->indexes)) {
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "FTS_OPTIMIZE: Completed"
" Optimize, cleanup DELETED table";
}
@@ -2505,7 +2492,7 @@ fts_optimize_table(
fts_optimize_free(optim);
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "FTS end optimize " << table->name;
}
@@ -2586,6 +2573,11 @@ fts_optimize_remove_table(
if (fts_opt_start_shutdown) {
ib::info() << "Try to remove table " << table->name
<< " after FTS optimize thread exiting.";
+ /* If the table can't be removed then wait till
+ fts optimize thread shuts down */
+ while (fts_optimize_wq) {
+ os_thread_sleep(10000);
+ }
return;
}
@@ -2616,9 +2608,13 @@ fts_optimize_remove_table(
os_event_destroy(event);
- ut_d(mutex_enter(&fts_optimize_wq->mutex));
- ut_ad(!table->fts->in_queue);
- ut_d(mutex_exit(&fts_optimize_wq->mutex));
+#ifdef UNIV_DEBUG
+ if (!fts_opt_start_shutdown) {
+ mutex_enter(&fts_optimize_wq->mutex);
+ ut_ad(!table->fts->in_queue);
+ mutex_exit(&fts_optimize_wq->mutex);
+ }
+#endif /* UNIV_DEBUG */
}
/** Send sync fts cache for the table.
@@ -2645,8 +2641,6 @@ fts_optimize_request_sync_table(
ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true);
- table->fts->in_queue = true;
-
mutex_exit(&fts_optimize_wq->mutex);
}
@@ -2692,7 +2686,7 @@ static bool fts_optimize_del_table(const dict_table_t* table)
slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i));
if (slot->table == table) {
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "FTS Optimize Removing table "
<< table->name;
}
@@ -2805,8 +2799,7 @@ fts_optimize_thread(
/* Assign number of tables added in fts_slots_t to n_tables */
n_tables = ib_vector_size(fts_slots);
- while (!done && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-
+ while (!done && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
/* If there is no message in the queue and we have tables
to optimize then optimize the tables. */
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 6baec777270..df2b330fe4b 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 2020, 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
@@ -144,6 +144,8 @@ struct fts_query_t {
ib_rbt_t* wildcard_words; /*!< words with wildcard */
bool multi_exist; /*!< multiple FTS_EXIST oper */
+ byte visiting_sub_exp; /*!< count of nested
+ fts_ast_visit_sub_exp() */
st_mysql_ftparser* parser; /*!< fts plugin parser */
};
@@ -730,10 +732,10 @@ fts_query_union_doc_id(
{
ib_rbt_bound_t parent;
ulint size = ib_vector_size(query->deleted->doc_ids);
- fts_update_t* array = (fts_update_t*) query->deleted->doc_ids->data;
+ doc_id_t* updates = (doc_id_t*) query->deleted->doc_ids->data;
/* Check if the doc id is deleted and it's not already in our set. */
- if (fts_bsearch(array, 0, static_cast<int>(size), doc_id) < 0
+ if (fts_bsearch(updates, 0, static_cast<int>(size), doc_id) < 0
&& rbt_search(query->doc_ids, &parent, &doc_id) != 0) {
fts_ranking_t ranking;
@@ -761,10 +763,10 @@ fts_query_remove_doc_id(
{
ib_rbt_bound_t parent;
ulint size = ib_vector_size(query->deleted->doc_ids);
- fts_update_t* array = (fts_update_t*) query->deleted->doc_ids->data;
+ doc_id_t* updates = (doc_id_t*) query->deleted->doc_ids->data;
/* Check if the doc id is deleted and it's in our set. */
- if (fts_bsearch(array, 0, static_cast<int>(size), doc_id) < 0
+ if (fts_bsearch(updates, 0, static_cast<int>(size), doc_id) < 0
&& rbt_search(query->doc_ids, &parent, &doc_id) == 0) {
ut_free(rbt_remove_node(query->doc_ids, parent.last));
@@ -791,10 +793,10 @@ fts_query_change_ranking(
{
ib_rbt_bound_t parent;
ulint size = ib_vector_size(query->deleted->doc_ids);
- fts_update_t* array = (fts_update_t*) query->deleted->doc_ids->data;
+ doc_id_t* updates = (doc_id_t*) query->deleted->doc_ids->data;
/* Check if the doc id is deleted and it's in our set. */
- if (fts_bsearch(array, 0, static_cast<int>(size), doc_id) < 0
+ if (fts_bsearch(updates, 0, static_cast<int>(size), doc_id) < 0
&& rbt_search(query->doc_ids, &parent, &doc_id) == 0) {
fts_ranking_t* ranking;
@@ -828,7 +830,7 @@ fts_query_intersect_doc_id(
{
ib_rbt_bound_t parent;
ulint size = ib_vector_size(query->deleted->doc_ids);
- fts_update_t* array = (fts_update_t*) query->deleted->doc_ids->data;
+ doc_id_t* updates = (doc_id_t*) query->deleted->doc_ids->data;
fts_ranking_t* ranking= NULL;
/* There are three types of intersect:
@@ -840,7 +842,7 @@ fts_query_intersect_doc_id(
if it matches 'b' and it's in doc_ids.(multi_exist = true). */
/* Check if the doc id is deleted and it's in our set */
- if (fts_bsearch(array, 0, static_cast<int>(size), doc_id) < 0) {
+ if (fts_bsearch(updates, 0, static_cast<int>(size), doc_id) < 0) {
fts_ranking_t new_ranking;
if (rbt_search(query->doc_ids, &parent, &doc_id) != 0) {
@@ -2447,9 +2449,8 @@ fts_query_match_document(
get_doc, match->doc_id, NULL, FTS_FETCH_DOC_BY_ID_EQUAL,
fts_query_fetch_document, &phrase);
- if (error != DB_SUCCESS) {
- ib::error() << "(" << ut_strerr(error)
- << ") matching document.";
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
+ ib::error() << "(" << error << ") matching document.";
} else {
*found = phrase.found;
}
@@ -2495,8 +2496,8 @@ fts_query_is_in_proximity_range(
&get_doc, match[0]->doc_id, NULL, FTS_FETCH_DOC_BY_ID_EQUAL,
fts_query_fetch_document, &phrase);
- if (err != DB_SUCCESS) {
- ib::error() << "(" << ut_strerr(err) << ") in verification"
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
+ ib::error() << "(" << err << ") in verification"
" phase of proximity search";
}
@@ -2743,7 +2744,7 @@ fts_query_phrase_search(
/* Ignore empty strings. */
if (num_token > 0) {
- fts_string_t* token;
+ fts_string_t* token = NULL;
fts_fetch_t fetch;
trx_t* trx = query->trx;
fts_ast_oper_t oper = query->oper;
@@ -2964,6 +2965,8 @@ fts_query_get_token(
return(new_ptr);
}
+static dberr_t fts_ast_visit_sub_exp(fts_ast_node_t*, fts_ast_callback, void*);
+
/*****************************************************************//**
Visit every node of the AST. */
static
@@ -3088,6 +3091,14 @@ fts_ast_visit_sub_exp(
ut_a(node->type == FTS_AST_SUBEXP_LIST);
+ /* To avoid stack overflow, we limit the mutual recursion
+ depth between fts_ast_visit(), fts_query_visitor() and
+ fts_ast_visit_sub_exp(). */
+ if (query->visiting_sub_exp++ > 31) {
+ query->error = DB_OUT_OF_MEMORY;
+ DBUG_RETURN(query->error);
+ }
+
cur_oper = query->oper;
/* Save current result set */
@@ -3110,6 +3121,7 @@ fts_ast_visit_sub_exp(
/* Reinstate parent node state */
query->multi_exist = multi_exist;
query->oper = cur_oper;
+ query->visiting_sub_exp--;
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;
@@ -3501,14 +3513,6 @@ fts_query_calculate_idf(
/ (double) word_freq->doc_count);
}
}
-
- if (fts_enable_diag_print) {
- ib::info() << "'" << word_freq->word.f_str << "' -> "
- << query->total_docs << "/"
- << word_freq->doc_count << " "
- << std::setw(6) << std::setprecision(5)
- << word_freq->idf;
- }
}
}
@@ -3649,8 +3653,8 @@ fts_query_prepare_result(
if (query->flags == FTS_OPT_RANKING) {
fts_word_freq_t* word_freq;
ulint size = ib_vector_size(query->deleted->doc_ids);
- fts_update_t* array =
- (fts_update_t*) query->deleted->doc_ids->data;
+ doc_id_t* updates =
+ (doc_id_t*) query->deleted->doc_ids->data;
node = rbt_first(query->word_freqs);
ut_ad(node);
@@ -3665,7 +3669,7 @@ fts_query_prepare_result(
doc_freq = rbt_value(fts_doc_freq_t, node);
/* Don't put deleted docs into result */
- if (fts_bsearch(array, 0, static_cast<int>(size),
+ if (fts_bsearch(updates, 0, static_cast<int>(size),
doc_freq->doc_id) >= 0) {
/* one less matching doc count */
--word_freq->doc_count;
@@ -3884,7 +3888,7 @@ fts_query_parse(
} else {
query->root = state.root;
- if (fts_enable_diag_print && query->root != NULL) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print) && query->root) {
fts_ast_node_print(query->root);
}
}
@@ -4016,7 +4020,7 @@ fts_query(
DEBUG_SYNC_C("fts_deleted_doc_ids_append");
/* Sort the vector so that we can do a binary search over the ids. */
- ib_vector_sort(query.deleted->doc_ids, fts_update_doc_id_cmp);
+ ib_vector_sort(query.deleted->doc_ids, fts_doc_id_cmp);
/* Convert the query string to lower case before parsing. We own
the ut_malloc'ed result and so remember to free it before return. */
@@ -4108,7 +4112,7 @@ fts_query(
ut_free(lc_query_str);
- if (fts_enable_diag_print && (*result)) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print) && (*result)) {
ulint diff_time = ut_time_ms() - start_time_ms;
ib::info() << "FTS Search Processing time: "
@@ -4264,7 +4268,7 @@ fts_expand_query(
query->total_size += SIZEOF_RBT_CREATE;
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
fts_print_doc_id(query);
}
@@ -4417,24 +4421,27 @@ fts_phrase_or_proximity_search(
if (k == ib_vector_size(query->match_array[j])) {
end_list = TRUE;
- if (match[j]->doc_id != match[0]->doc_id) {
- /* no match */
- if (query->flags & FTS_PHRASE) {
- ulint s;
+ if (query->flags & FTS_PHRASE) {
+ ulint s;
+ /* Since i is the last doc id in the
+ match_array[j], remove all doc ids > i
+ from the match_array[0]. */
+ fts_match_t* match_temp;
+ for (s = i + 1; s < n_matched; s++) {
+ match_temp = static_cast<
+ fts_match_t*>(ib_vector_get(
+ query->match_array[0], s));
+ match_temp->doc_id = 0;
+ }
+ if (match[j]->doc_id !=
+ match[0]->doc_id) {
+ /* no match */
match[0]->doc_id = 0;
-
- for (s = i + 1; s < n_matched;
- s++) {
- match[0] = static_cast<
- fts_match_t*>(
- ib_vector_get(
- query->match_array[0],
- s));
- match[0]->doc_id = 0;
- }
}
+ }
+ if (match[j]->doc_id != match[0]->doc_id) {
goto func_exit;
}
}
diff --git a/storage/innobase/fts/fts0sql.cc b/storage/innobase/fts/fts0sql.cc
index 376662bba8a..e61f2118e70 100644
--- a/storage/innobase/fts/fts0sql.cc
+++ b/storage/innobase/fts/fts0sql.cc
@@ -55,28 +55,23 @@ fts_get_table_id(
long */
{
int len;
- bool hex_name = DICT_TF2_FLAG_IS_SET(fts_table->table,
- DICT_TF2_FTS_AUX_HEX_NAME);
ut_a(fts_table->table != NULL);
switch (fts_table->type) {
case FTS_COMMON_TABLE:
- len = fts_write_object_id(fts_table->table_id, table_id,
- hex_name);
+ len = fts_write_object_id(fts_table->table_id, table_id);
break;
case FTS_INDEX_TABLE:
- len = fts_write_object_id(fts_table->table_id, table_id,
- hex_name);
+ len = fts_write_object_id(fts_table->table_id, table_id);
table_id[len] = '_';
++len;
table_id += len;
- len += fts_write_object_id(fts_table->index_id, table_id,
- hex_name);
+ len += fts_write_object_id(fts_table->index_id, table_id);
break;
default:
diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index cad3877d3e9..3a727185632 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -444,26 +444,6 @@ pick_seeds(
}
}
-/*********************************************************//**
-Generates a random iboolean value.
-@return the random value */
-static
-ibool
-ut_rnd_gen_ibool(void)
-/*=================*/
-{
- ulint x;
-
- x = ut_rnd_gen_ulint();
-
- if (((x >> 20) + (x >> 15)) & 1) {
-
- return(TRUE);
- }
-
- return(FALSE);
-}
-
/*************************************************************//**
Select next node and group where to add. */
static
@@ -500,8 +480,7 @@ pick_next(
/* Introduce some randomness if the record
is identical */
if (diff == 0) {
- diff = static_cast<double>(
- ut_rnd_gen_ibool());
+ diff = static_cast<double>(ut_rnd_gen() & 1);
}
*n_group = 1 + (diff > 0);
@@ -801,35 +780,3 @@ rtree_area_overlapping(
return(area);
}
-
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len)
-{
- // JAN: TODO: MYSQL 5.7 GIS
- #define GEOM_HEADER_SIZE 16
- if (len < GEOM_HEADER_SIZE + sizeof(double) * n_dims) {
- return(0);
- }
-
- /** POINT wkb comprises SRID, wkb header(byte order and type)
- and coordinates of the POINT */
- len = GEOM_HEADER_SIZE + sizeof(double) * n_dims;
- /** We always use 0 as default coordinate */
- memset(wkb, 0, len);
- /** We don't need to write SRID, write 0x01 for Byte Order */
- mach_write_to_n_little_endian(wkb + SRID_SIZE, 1, 0x01);
- /** Write wkbType::wkbPoint for the POINT type */
- mach_write_to_n_little_endian(wkb + SRID_SIZE + 1, 4, wkbPoint);
-
- return(len);
-}
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index ce1749820c3..e3d5a09f736 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, 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
@@ -50,7 +50,7 @@ rtr_page_split_initialize_nodes(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
- ulint** offsets,/*!< in: offsets on inserted record */
+ rec_offs** offsets,/*!< in: offsets on inserted record */
const dtuple_t* tuple, /*!< in: tuple to insert */
double** buf_pos)/*!< in/out: current buffer position */
{
@@ -193,7 +193,7 @@ rtr_update_mbr_field_in_place(
/*==========================*/
dict_index_t* index, /*!< in: spatial index. */
rec_t* rec, /*!< in/out: rec to be modified.*/
- ulint* offsets, /*!< in/out: offsets on rec. */
+ rec_offs* offsets, /*!< in/out: offsets on rec. */
rtr_mbr_t* mbr, /*!< in: the new mbr. */
mtr_t* mtr) /*!< in: mtr */
{
@@ -267,7 +267,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/
- ulint* offsets, /*!< in/out: offsets on rec. */
+ rec_offs* offsets, /*!< in/out: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to
@@ -297,7 +297,7 @@ rtr_update_mbr_field(
bool ins_suc = true;
ulint cur2_pos = 0;
ulint del_page_no = 0;
- ulint* offsets2;
+ rec_offs* offsets2;
rec = btr_cur_get_rec(cursor);
page = page_align(rec);
@@ -384,7 +384,7 @@ rtr_update_mbr_field(
}
if (cursor2) {
- ulint* offsets2;
+ rec_offs* offsets2;
if (page_zip) {
cursor2->page_cur.rec
@@ -406,7 +406,7 @@ rtr_update_mbr_field(
page_cur_t page_cur;
rec_t* insert_rec;
- ulint* insert_offsets = NULL;
+ rec_offs* insert_offsets = NULL;
ulint old_pos;
rec_t* old_rec;
@@ -438,7 +438,7 @@ update_mbr:
/* When there're not only 1 rec in the page, we do delete/insert
to avoid page split. */
rec_t* insert_rec;
- ulint* insert_offsets = NULL;
+ rec_offs* insert_offsets = NULL;
rec_t* next_rec;
/* Delete the rec which cursor point to. */
@@ -639,7 +639,7 @@ rtr_adjust_upper_level(
page_zip_des_t* new_page_zip;
dict_index_t* index = sea_cur->index;
btr_cur_t cursor;
- ulint* offsets;
+ rec_offs* offsets;
mem_heap_t* heap;
ulint level;
dtuple_t* node_ptr_upper;
@@ -809,8 +809,8 @@ rtr_split_page_move_rec_list(
page_cur_t new_page_cursor;
page_t* page;
page_t* new_page;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
page_zip_des_t* new_page_zip
= buf_block_get_page_zip(new_block);
rec_t* rec;
@@ -970,7 +970,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@@ -1322,7 +1322,7 @@ rtr_ins_enlarge_mbr(
mem_heap_t* heap;
dict_index_t* index = btr_cur->index;
page_cur_t* page_cursor;
- ulint* offsets;
+ rec_offs* offsets;
node_visit_t* node_visit;
btr_cur_t cursor;
page_t* page;
@@ -1406,10 +1406,10 @@ rtr_page_copy_rec_list_end_no_locks(
page_cur_t page_cur;
page_cur_t cur1;
rec_t* cur_rec;
- ulint offsets_1[REC_OFFS_NORMAL_SIZE];
- ulint* offsets1 = offsets_1;
- ulint offsets_2[REC_OFFS_NORMAL_SIZE];
- ulint* offsets2 = offsets_2;
+ rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets1 = offsets_1;
+ rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets2 = offsets_2;
ulint moved = 0;
bool is_leaf = page_is_leaf(new_page);
@@ -1449,10 +1449,9 @@ rtr_page_copy_rec_list_end_no_locks(
offsets2 = rec_get_offsets(cur_rec, index, offsets2,
is_leaf,
ULINT_UNDEFINED, &heap);
- cmp = cmp_rec_rec_with_match(cur1_rec, cur_rec,
- offsets1, offsets2,
- index, FALSE,
- &cur_matched_fields);
+ cmp = cmp_rec_rec(cur1_rec, cur_rec,
+ offsets1, offsets2, index, false,
+ &cur_matched_fields);
if (cmp < 0) {
page_cur_move_to_prev(&page_cur);
break;
@@ -1533,10 +1532,10 @@ rtr_page_copy_rec_list_start_no_locks(
{
page_cur_t cur1;
rec_t* cur_rec;
- ulint offsets_1[REC_OFFS_NORMAL_SIZE];
- ulint* offsets1 = offsets_1;
- ulint offsets_2[REC_OFFS_NORMAL_SIZE];
- ulint* offsets2 = offsets_2;
+ rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets1 = offsets_1;
+ rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets2 = offsets_2;
page_cur_t page_cur;
ulint moved = 0;
bool is_leaf = page_is_leaf(buf_block_get_frame(block));
@@ -1564,15 +1563,13 @@ rtr_page_copy_rec_list_start_no_locks(
while (!page_rec_is_supremum(cur_rec)) {
ulint cur_matched_fields = 0;
- int cmp;
offsets2 = rec_get_offsets(cur_rec, index, offsets2,
is_leaf,
ULINT_UNDEFINED, &heap);
- cmp = cmp_rec_rec_with_match(cur1_rec, cur_rec,
- offsets1, offsets2,
- index, FALSE,
- &cur_matched_fields);
+ int cmp = cmp_rec_rec(cur1_rec, cur_rec,
+ offsets1, offsets2, index, false,
+ &cur_matched_fields);
if (cmp < 0) {
page_cur_move_to_prev(&page_cur);
cur_rec = page_cur_get_rec(&page_cur);
@@ -1645,8 +1642,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
- ulint* offsets, /*!< in: rec offsets */
- ulint* offsets2, /*!< in: rec offsets */
+ rec_offs* offsets, /*!< in: rec offsets */
+ rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr, /*!< out: MBR to update */
buf_block_t* merge_block, /*!< in: page to merge */
buf_block_t* block, /*!< in: page be merged */
@@ -1692,8 +1689,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
- ulint* offsets, /*!< in: rec offsets */
- ulint* offsets2, /*!< in: rec offsets */
+ rec_offs* offsets, /*!< in: rec offsets */
+ rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the page. */
buf_block_t* merge_block, /*!< in: page to merge */
buf_block_t* block, /*!< in: page be merged */
@@ -1762,7 +1759,7 @@ rtr_check_same_block(
{
ulint page_no = childb->page.id.page_no();
- ulint* offsets;
+ rec_offs* offsets;
rec_t* rec = page_rec_get_next(page_get_infimum_rec(
buf_block_get_frame(parentb)));
@@ -1793,7 +1790,7 @@ rtr_rec_cal_increase(
dtuple in some of the common fields, or which
has an equal number or more fields than
dtuple */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
double* area) /*!< out: increased area */
{
const dfield_t* dtuple_field;
@@ -1889,7 +1886,7 @@ rtr_estimate_n_rows_in_range(
rec_t* rec;
byte* field;
ulint len;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
mem_heap_t* heap;
heap = mem_heap_create(512);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 84307659873..5ea3f328d5c 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -527,7 +527,7 @@ rtr_compare_cursor_rec(
mem_heap_t** heap) /*!< in: memory heap */
{
const rec_t* rec;
- ulint* offsets;
+ rec_offs* offsets;
rec = btr_cur_get_rec(cursor);
@@ -590,7 +590,7 @@ rtr_pcur_open_low(
}
btr_cur_search_to_nth_level(index, level, tuple, mode, latch_mode,
- btr_cursor, 0, file, line, mtr);
+ btr_cursor, 0, file, line, mtr, 0);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->trx_if_known = NULL;
@@ -669,7 +669,7 @@ rtr_page_get_father(
{
mem_heap_t* heap = mem_heap_create(100);
#ifdef UNIV_DEBUG
- ulint* offsets;
+ rec_offs* offsets;
offsets = rtr_page_get_father_block(
NULL, heap, index, block, mtr, sea_cur, cursor);
@@ -686,13 +686,128 @@ rtr_page_get_father(
mem_heap_free(heap);
}
+/********************************************************************//**
+Returns the upper level node pointer to a R-Tree page. It is assumed
+that mtr holds an x-latch on the tree. */
+static void rtr_get_father_node(
+ dict_index_t* index, /*!< in: index */
+ ulint level, /*!< in: the tree level of search */
+ const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in
+ tuple must be set so that it cannot get
+ compared to the node ptr page number field! */
+ btr_cur_t* sea_cur,/*!< in: search cursor */
+ btr_cur_t* btr_cur,/*!< in/out: tree cursor; the cursor page is
+ s- or x-latched, but see also above! */
+ ulint page_no,/*!< Current page no */
+ mtr_t* mtr) /*!< in: mtr */
+{
+ mem_heap_t* heap = NULL;
+ bool ret = false;
+ const rec_t* rec;
+ ulint n_fields;
+ bool new_rtr = false;
+
+ /* Try to optimally locate the parent node. Level should always
+ less than sea_cur->tree_height unless the root is splitting */
+ if (sea_cur && sea_cur->tree_height > level) {
+
+ ut_ad(mtr_memo_contains_flagged(mtr,
+ dict_index_get_lock(index),
+ MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK));
+ ret = rtr_cur_restore_position(
+ BTR_CONT_MODIFY_TREE, sea_cur, level, mtr);
+
+ /* Once we block shrink tree nodes while there are
+ active search on it, this optimal locating should always
+ succeeds */
+ ut_ad(ret);
+
+ if (ret) {
+ btr_pcur_t* r_cursor = rtr_get_parent_cursor(
+ sea_cur, level, false);
+
+ rec = btr_pcur_get_rec(r_cursor);
+
+ ut_ad(r_cursor->rel_pos == BTR_PCUR_ON);
+ page_cur_position(rec,
+ btr_pcur_get_block(r_cursor),
+ btr_cur_get_page_cur(btr_cur));
+ btr_cur->rtr_info = sea_cur->rtr_info;
+ btr_cur->tree_height = sea_cur->tree_height;
+ ut_ad(rtr_compare_cursor_rec(
+ index, btr_cur, page_no, &heap));
+ goto func_exit;
+ }
+ }
+
+ /* We arrive here in one of two scenario
+ 1) check table and btr_valide
+ 2) index root page being raised */
+ ut_ad(!sea_cur || sea_cur->tree_height == level);
+
+ if (btr_cur->rtr_info) {
+ rtr_clean_rtr_info(btr_cur->rtr_info, true);
+ } else {
+ new_rtr = true;
+ }
+
+ btr_cur->rtr_info = rtr_create_rtr_info(false, false, btr_cur, index);
+
+ if (sea_cur && sea_cur->tree_height == level) {
+ /* root split, and search the new root */
+ btr_cur_search_to_nth_level(
+ index, level, tuple, PAGE_CUR_RTREE_LOCATE,
+ BTR_CONT_MODIFY_TREE, btr_cur, 0,
+ __FILE__, __LINE__, mtr, 0);
+
+ } else {
+ /* btr_validate */
+ ut_ad(level >= 1);
+ ut_ad(!sea_cur);
+
+ btr_cur_search_to_nth_level(
+ index, level, tuple, PAGE_CUR_RTREE_LOCATE,
+ BTR_CONT_MODIFY_TREE, btr_cur, 0,
+ __FILE__, __LINE__, mtr, 0);
+
+ rec = btr_cur_get_rec(btr_cur);
+ n_fields = dtuple_get_n_fields_cmp(tuple);
+
+ if (page_rec_is_infimum(rec)
+ || (btr_cur->low_match != n_fields)) {
+ ret = rtr_pcur_getnext_from_path(
+ tuple, PAGE_CUR_RTREE_LOCATE, btr_cur,
+ level, BTR_CONT_MODIFY_TREE,
+ true, mtr);
+
+ ut_ad(ret && btr_cur->low_match == n_fields);
+ }
+ }
+
+ ret = rtr_compare_cursor_rec(
+ index, btr_cur, page_no, &heap);
+
+ ut_ad(ret);
+
+func_exit:
+ if (heap) {
+ mem_heap_free(heap);
+ }
+
+ if (new_rtr && btr_cur->rtr_info) {
+ rtr_clean_rtr_info(btr_cur->rtr_info, true);
+ btr_cur->rtr_info = NULL;
+ }
+}
+
/** Returns the upper level node pointer to a R-Tree page. It is assumed
that mtr holds an SX-latch or X-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
-ulint*
+rec_offs*
rtr_page_get_father_node_ptr(
- ulint* offsets,/*!< in: work area for the return value */
+ rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* sea_cur,/*!< in: search cursor */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
@@ -785,10 +900,10 @@ rtr_page_get_father_node_ptr(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
-ulint*
+rec_offs*
rtr_page_get_father_block(
/*======================*/
- ulint* offsets,/*!< in: work area for the return value */
+ rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@@ -806,123 +921,6 @@ rtr_page_get_father_block(
cursor, mtr));
}
-/********************************************************************//**
-Returns the upper level node pointer to a R-Tree page. It is assumed
-that mtr holds an x-latch on the tree. */
-void
-rtr_get_father_node(
-/*================*/
- dict_index_t* index, /*!< in: index */
- ulint level, /*!< in: the tree level of search */
- const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in
- tuple must be set so that it cannot get
- compared to the node ptr page number field! */
- btr_cur_t* sea_cur,/*!< in: search cursor */
- btr_cur_t* btr_cur,/*!< in/out: tree cursor; the cursor page is
- s- or x-latched, but see also above! */
- ulint page_no,/*!< Current page no */
- mtr_t* mtr) /*!< in: mtr */
-{
- mem_heap_t* heap = NULL;
- bool ret = false;
- const rec_t* rec;
- ulint n_fields;
- bool new_rtr = false;
-
- /* Try to optimally locate the parent node. Level should always
- less than sea_cur->tree_height unless the root is splitting */
- if (sea_cur && sea_cur->tree_height > level) {
-
- ut_ad(mtr_memo_contains_flagged(mtr,
- dict_index_get_lock(index),
- MTR_MEMO_X_LOCK
- | MTR_MEMO_SX_LOCK));
- ret = rtr_cur_restore_position(
- BTR_CONT_MODIFY_TREE, sea_cur, level, mtr);
-
- /* Once we block shrink tree nodes while there are
- active search on it, this optimal locating should always
- succeeds */
- ut_ad(ret);
-
- if (ret) {
- btr_pcur_t* r_cursor = rtr_get_parent_cursor(
- sea_cur, level, false);
-
- rec = btr_pcur_get_rec(r_cursor);
-
- ut_ad(r_cursor->rel_pos == BTR_PCUR_ON);
- page_cur_position(rec,
- btr_pcur_get_block(r_cursor),
- btr_cur_get_page_cur(btr_cur));
- btr_cur->rtr_info = sea_cur->rtr_info;
- btr_cur->tree_height = sea_cur->tree_height;
- ut_ad(rtr_compare_cursor_rec(
- index, btr_cur, page_no, &heap));
- goto func_exit;
- }
- }
-
- /* We arrive here in one of two scenario
- 1) check table and btr_valide
- 2) index root page being raised */
- ut_ad(!sea_cur || sea_cur->tree_height == level);
-
- if (btr_cur->rtr_info) {
- rtr_clean_rtr_info(btr_cur->rtr_info, true);
- } else {
- new_rtr = true;
- }
-
- btr_cur->rtr_info = rtr_create_rtr_info(false, false, btr_cur, index);
-
- if (sea_cur && sea_cur->tree_height == level) {
- /* root split, and search the new root */
- btr_cur_search_to_nth_level(
- index, level, tuple, PAGE_CUR_RTREE_LOCATE,
- BTR_CONT_MODIFY_TREE, btr_cur, 0,
- __FILE__, __LINE__, mtr);
-
- } else {
- /* btr_validate */
- ut_ad(level >= 1);
- ut_ad(!sea_cur);
-
- btr_cur_search_to_nth_level(
- index, level, tuple, PAGE_CUR_RTREE_LOCATE,
- BTR_CONT_MODIFY_TREE, btr_cur, 0,
- __FILE__, __LINE__, mtr);
-
- rec = btr_cur_get_rec(btr_cur);
- n_fields = dtuple_get_n_fields_cmp(tuple);
-
- if (page_rec_is_infimum(rec)
- || (btr_cur->low_match != n_fields)) {
- ret = rtr_pcur_getnext_from_path(
- tuple, PAGE_CUR_RTREE_LOCATE, btr_cur,
- level, BTR_CONT_MODIFY_TREE,
- true, mtr);
-
- ut_ad(ret && btr_cur->low_match == n_fields);
- }
- }
-
- ret = rtr_compare_cursor_rec(
- index, btr_cur, page_no, &heap);
-
- ut_ad(ret);
-
-func_exit:
- if (heap) {
- mem_heap_free(heap);
- }
-
- if (new_rtr && btr_cur->rtr_info) {
- rtr_clean_rtr_info(btr_cur->rtr_info, true);
- btr_cur->rtr_info = NULL;
- }
-}
-
/*******************************************************************//**
Create a RTree search info structure */
rtr_info_t*
@@ -1259,6 +1257,24 @@ rtr_check_discard_page(
lock_mutex_exit();
}
+/** Structure acts as functor to get the optimistic access of the page.
+It returns true if it successfully gets the page. */
+struct optimistic_get
+{
+ btr_pcur_t *const r_cursor;
+ mtr_t *const mtr;
+
+ optimistic_get(btr_pcur_t *r_cursor,mtr_t *mtr)
+ :r_cursor(r_cursor), mtr(mtr) {}
+
+ bool operator()(buf_block_t *hint) const
+ {
+ return hint && buf_page_optimistic_get(
+ RW_X_LATCH, hint, r_cursor->modify_clock, __FILE__,
+ __LINE__, mtr);
+ }
+};
+
/** Restore the stored position of a persistent cursor bufferfixing the page */
static
bool
@@ -1292,19 +1308,16 @@ rtr_cur_restore_position(
ut_ad(latch_mode == BTR_CONT_MODIFY_TREE);
- if (!buf_pool_is_obsolete(r_cursor->withdraw_clock)
- && buf_page_optimistic_get(RW_X_LATCH,
- r_cursor->block_when_stored,
- r_cursor->modify_clock,
- __FILE__, __LINE__, mtr)) {
+ if (r_cursor->block_when_stored.run_with_hint(
+ optimistic_get(r_cursor, mtr))) {
ut_ad(r_cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(r_cursor->rel_pos == BTR_PCUR_ON);
#ifdef UNIV_DEBUG
do {
const rec_t* rec;
- const ulint* offsets1;
- const ulint* offsets2;
+ const rec_offs* offsets1;
+ const rec_offs* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@@ -1377,8 +1390,8 @@ search_again:
if (low_match == r_cursor->old_n_fields) {
const rec_t* rec;
- const ulint* offsets1;
- const ulint* offsets2;
+ const rec_offs* offsets1;
+ const rec_offs* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@@ -1424,7 +1437,7 @@ rtr_leaf_push_match_rec(
/*====================*/
const rec_t* rec, /*!< in: record to copy */
rtr_info_t* rtr_info, /*!< in/out: search stack */
- ulint* offsets, /*!< in: offsets */
+ rec_offs* offsets, /*!< in: offsets */
bool is_comp) /*!< in: is compact format */
{
byte* buf;
@@ -1610,7 +1623,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
- const ulint* offsets,/*!< in: offsets array */
+ const rec_offs* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr) /*!< out MBR */
{
ulint rec_f_len;
@@ -1657,8 +1670,8 @@ rtr_cur_search_with_match(
const page_t* page;
const rec_t* rec;
const rec_t* last_rec;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
int cmp = 1;
double least_inc = DBL_MAX;
@@ -1941,8 +1954,8 @@ rtr_cur_search_with_match(
test_rec = match_rec->matched_recs->back();
#ifdef UNIV_DEBUG
- ulint offsets_2[REC_OFFS_NORMAL_SIZE];
- ulint* offsets2 = offsets_2;
+ rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets2 = offsets_2;
rec_offs_init(offsets_2);
ut_ad(found);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index caa0b1e861c..0617005a213 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1,10 +1,10 @@
/*****************************************************************************
-Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -103,6 +103,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "srv0mon.h"
#include "srv0srv.h"
#include "srv0start.h"
+#include "rem0rec.h"
#ifdef UNIV_DEBUG
#include "trx0purge.h"
#endif /* UNIV_DEBUG */
@@ -270,6 +271,27 @@ enum default_row_format_enum {
DEFAULT_ROW_FORMAT_DYNAMIC = 2,
};
+/** A dummy variable */
+static uint innodb_max_purge_lag_wait;
+
+/** Wait for trx_sys_t::rseg_history_len to be below a limit. */
+static void innodb_max_purge_lag_wait_update(THD *thd, st_mysql_sys_var *,
+ void *, const void *limit)
+{
+ const uint l= *static_cast<const uint*>(limit);
+ if (trx_sys->rseg_history_len <= l)
+ return;
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ while (trx_sys->rseg_history_len > l)
+ {
+ if (thd_kill_level(thd))
+ break;
+ srv_wake_purge_thread_if_not_active();
+ os_thread_sleep(100000);
+ }
+ mysql_mutex_lock(&LOCK_global_system_variables);
+}
+
static
void set_my_errno(int err)
{
@@ -585,9 +607,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(file_format_max_mutex),
PSI_KEY(fil_system_mutex),
PSI_KEY(flush_list_mutex),
- PSI_KEY(fts_bg_threads_mutex),
PSI_KEY(fts_delete_mutex),
- PSI_KEY(fts_optimize_mutex),
PSI_KEY(fts_doc_id_mutex),
PSI_KEY(log_flush_order_mutex),
PSI_KEY(hash_table_mutex),
@@ -626,7 +646,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
PSI_KEY(rtr_active_mutex),
PSI_KEY(rtr_match_mutex),
PSI_KEY(rtr_path_mutex),
- PSI_KEY(rtr_ssn_mutex),
PSI_KEY(trx_sys_mutex),
PSI_KEY(zip_pad_mutex)
};
@@ -653,7 +672,6 @@ static PSI_rwlock_info all_innodb_rwlocks[] = {
PSI_RWLOCK_KEY(trx_purge_latch),
PSI_RWLOCK_KEY(index_tree_rw_lock),
PSI_RWLOCK_KEY(index_online_log),
- PSI_RWLOCK_KEY(dict_table_stats),
PSI_RWLOCK_KEY(hash_table_locks)
};
# endif /* UNIV_PFS_RWLOCK */
@@ -1408,18 +1426,6 @@ innobase_commit_by_xid(
handlerton* hton, /*!< in: InnoDB handlerton */
XID* xid); /*!< in: X/Open XA transaction
identification */
-/*******************************************************************//**
-This function is used to rollback one X/Open XA distributed transaction
-which is in the prepared state
-@return 0 or error number */
-static
-int
-innobase_rollback_by_xid(
-/*=====================*/
- handlerton* hton, /*!< in: InnoDB handlerton */
- XID* xid); /*!< in: X/Open XA transaction
- identification */
-
/** Remove all tables in the named database inside InnoDB.
@param[in] hton handlerton from InnoDB
@param[in] path Database path; Inside InnoDB the name of the last
@@ -1727,20 +1733,14 @@ thd_trx_is_auto_commit(
/** Enter InnoDB engine after checking the max number of user threads
allowed, else the thread is put into sleep.
@param[in,out] prebuilt row prebuilt handler */
-static inline
-void
-innobase_srv_conc_enter_innodb(
- row_prebuilt_t* prebuilt)
+static inline void innobase_srv_conc_enter_innodb(row_prebuilt_t *prebuilt)
{
+ trx_t* trx = prebuilt->trx;
+
#ifdef WITH_WSREP
- if (wsrep_on(prebuilt->trx->mysql_thd) &&
- wsrep_thd_is_BF(prebuilt->trx->mysql_thd, FALSE)) {
- return;
- }
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
- trx_t* trx = prebuilt->trx;
-
if (srv_thread_concurrency) {
if (trx->n_tickets_to_enter_innodb > 0) {
@@ -1767,22 +1767,16 @@ innobase_srv_conc_enter_innodb(
/** Note that the thread wants to leave InnoDB only if it doesn't have
any spare tickets.
@param[in,out] m_prebuilt row prebuilt handler */
-static inline
-void
-innobase_srv_conc_exit_innodb(
- row_prebuilt_t* prebuilt)
+static inline void innobase_srv_conc_exit_innodb(row_prebuilt_t *prebuilt)
{
ut_ad(!sync_check_iterate(sync_check()));
+ trx_t* trx = prebuilt->trx;
+
#ifdef WITH_WSREP
- if (wsrep_on(prebuilt->trx->mysql_thd) &&
- wsrep_thd_is_BF(prebuilt->trx->mysql_thd, FALSE)) {
- return;
- }
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
- trx_t* trx = prebuilt->trx;
-
/* This is to avoid making an unnecessary function call. */
if (trx->declared_to_be_inside_innodb
&& trx->n_tickets_to_enter_innodb == 0) {
@@ -2324,17 +2318,6 @@ innobase_casedn_str(
my_casedn_str(system_charset_info, a);
}
-/**********************************************************************//**
-Determines the connection character set.
-@return connection character set */
-CHARSET_INFO*
-innobase_get_charset(
-/*=================*/
- THD* mysql_thd) /*!< in: MySQL thread handle */
-{
- return(thd_charset(mysql_thd));
-}
-
/** Determines the current SQL statement.
Thread unsafe, can only be called from the thread owning the THD.
@param[in] thd MySQL thread handle
@@ -2354,22 +2337,6 @@ innobase_get_stmt_unsafe(
return NULL;
}
-/** Determines the current SQL statement.
-Thread safe, can be called from any thread as the string is copied
-into the provided buffer.
-@param[in] thd MySQL thread handle
-@param[out] buf Buffer containing SQL statement
-@param[in] buflen Length of provided buffer
-@return Length of the SQL statement */
-size_t
-innobase_get_stmt_safe(
- THD* thd,
- char* buf,
- size_t buflen)
-{
- return thd_query_safe(thd, buf, buflen);
-}
-
/**********************************************************************//**
Get the current setting of the tdc_size global parameter. We do
a dirty read because for one there is no synchronization object and
@@ -2770,11 +2737,20 @@ innobase_trx_init(
DBUG_ENTER("innobase_trx_init");
DBUG_ASSERT(thd == trx->mysql_thd);
+ /* Ensure that thd_lock_wait_timeout(), which may be called
+ while holding lock_sys.mutex, by lock_rec_enqueue_waiting(),
+ will not end up acquiring LOCK_global_system_variables in
+ intern_sys_var_ptr(). */
+ THDVAR(thd, lock_wait_timeout);
+
trx->check_foreigns = !thd_test_options(
thd, OPTION_NO_FOREIGN_KEY_CHECKS);
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
+#ifdef WITH_WSREP
+ trx->wsrep = wsrep_on(thd);
+#endif
DBUG_VOID_RETURN;
}
@@ -2850,18 +2826,6 @@ trx_is_registered_for_2pc(
}
/*********************************************************************//**
-Note that innobase_commit_ordered() was run. */
-static inline
-void
-trx_set_active_commit_ordered(
-/*==========================*/
- trx_t* trx) /* in: transaction */
-{
- ut_a(trx_is_registered_for_2pc(trx));
- trx->active_commit_ordered = 1;
-}
-
-/*********************************************************************//**
Note that a transaction has been registered with MySQL 2PC coordinator. */
static inline
void
@@ -2870,7 +2834,7 @@ trx_register_for_2pc(
trx_t* trx) /* in: transaction */
{
trx->is_registered = 1;
- ut_ad(trx->active_commit_ordered == 0);
+ ut_ad(!trx->active_commit_ordered);
}
/*********************************************************************//**
@@ -2881,19 +2845,8 @@ trx_deregister_from_2pc(
/*====================*/
trx_t* trx) /* in: transaction */
{
- trx->is_registered = 0;
- trx->active_commit_ordered = 0;
-}
-
-/*********************************************************************//**
-Check whether a transaction has active_commit_ordered set */
-static inline
-bool
-trx_is_active_commit_ordered(
-/*=========================*/
- const trx_t* trx) /* in: transaction */
-{
- return(trx->active_commit_ordered == 1);
+ trx->is_registered= false;
+ trx->active_commit_ordered= false;
}
/*********************************************************************//**
@@ -3504,17 +3457,6 @@ trx_is_interrupted(
return(trx && trx->mysql_thd && thd_kill_level(trx->mysql_thd));
}
-/**********************************************************************//**
-Determines if the currently running transaction is in strict mode.
-@return TRUE if strict */
-ibool
-trx_is_strict(
-/*==========*/
- trx_t* trx) /*!< in: transaction */
-{
- return(trx && trx->mysql_thd && THDVAR(trx->mysql_thd, strict_mode));
-}
-
/**************************************************************//**
Resets some fields of a m_prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -3528,7 +3470,7 @@ ha_innobase::reset_template(void)
/* Force table to be freed in close_thread_table(). */
DBUG_EXECUTE_IF("free_table_in_fts_query",
if (m_prebuilt->in_fts_query) {
- table->m_needs_reopen = true;
+ table->mark_table_for_reopen();
}
);
@@ -3602,12 +3544,8 @@ ha_innobase::init_table_handle_for_HANDLER(void)
reset_template();
}
-/*********************************************************************//**
-Free tablespace resources allocated. */
-static
-void
-innobase_space_shutdown()
-/*=====================*/
+/** Free tablespace resources allocated. */
+void innobase_space_shutdown()
{
DBUG_ENTER("innobase_space_shutdown");
@@ -3688,8 +3626,7 @@ static const char* deprecated_mtflush_threads
static my_bool innodb_instrument_semaphores;
-/** Update log_checksum_algorithm_ptr with a pointer to the function
-corresponding to whether checksums are enabled.
+/** If applicable, emit a message that log checksums cannot be disabled.
@param[in,out] thd client session, or NULL if at startup
@param[in] check whether redo log block checksums are enabled
@return whether redo log block checksums are enabled */
@@ -3697,34 +3634,21 @@ static inline
bool
innodb_log_checksums_func_update(THD* thd, bool check)
{
- static const char msg[] = "innodb_encrypt_log implies"
- " innodb_log_checksums";
+ static const char msg[] = "innodb_log_checksums is deprecated"
+ " and has no effect outside recovery";
ut_ad(!thd == !srv_was_started);
if (!check) {
- check = srv_encrypt_log;
- if (!check) {
- } else if (thd) {
+ if (thd) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED, msg);
+ check = true;
} else {
sql_print_warning(msg);
}
}
- if (thd) {
- log_mutex_enter();
- log_checksum_algorithm_ptr = check
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
- log_mutex_exit();
- } else {
- log_checksum_algorithm_ptr = check
- ? log_block_calc_checksum_crc32
- : log_block_calc_checksum_none;
- }
-
return(check);
}
@@ -3845,21 +3769,30 @@ innobase_init(
pages, even for larger pages */
if (UNIV_PAGE_SIZE > UNIV_PAGE_SIZE_DEF
&& innobase_buffer_pool_size < (24 * 1024 * 1024)) {
- ib::info() << "innodb_page_size="
+ ib::error() << "innodb_page_size="
<< UNIV_PAGE_SIZE << " requires "
<< "innodb_buffer_pool_size > 24M current "
<< innobase_buffer_pool_size;
goto error;
}
+ if (innodb_lock_schedule_algorithm == INNODB_LOCK_SCHEDULE_ALGORITHM_VATS) {
+ ib::warn() << "The parameter innodb_lock_schedule_algorithm"
+ " is deprecated, and the setting"
+ " innodb_lock_schedule_algorithm=vats"
+ " may cause corruption. The parameter may be removed"
+ " in future releases.";
+
#ifdef WITH_WSREP
- /* Currently, Galera does not support VATS lock schedule algorithm. */
- if (innodb_lock_schedule_algorithm == INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
- && global_system_variables.wsrep_on) {
- ib::info() << "For Galera, using innodb_lock_schedule_algorithm=fcfs";
- innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS;
+ /* Currently, Galera does not support VATS lock schedule algorithm. */
+ if (global_system_variables.wsrep_on) {
+ ib::info() << "For Galera, using innodb_lock_schedule_algorithm=fcfs";
+ innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS;
+ }
+#endif /* WITH_WSREP */
}
+#ifdef WITH_WSREP
/* Print deprecation info if xtrabackup is used for SST method */
if (global_system_variables.wsrep_on
&& wsrep_sst_method
@@ -4502,29 +4435,26 @@ innobase_commit_low(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
- THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
- if (thd && wsrep_on(thd)) {
-#ifdef WSREP_PROC_INFO
- char info[64];
- info[sizeof(info) - 1] = '\0';
- snprintf(info, sizeof(info) - 1,
- "innobase_commit_low():trx_commit_for_mysql(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- tmp = thd_proc_info(thd, info);
-
-#else
+ const bool is_wsrep = trx->is_wsrep();
+ THD* thd = trx->mysql_thd;
+ if (is_wsrep) {
tmp = thd_proc_info(thd, "innobase_commit_low()");
-#endif /* WSREP_PROC_INFO */
}
#endif /* WITH_WSREP */
if (trx_is_started(trx)) {
-
trx_commit_for_mysql(trx);
+ } else {
+ trx->will_lock = 0;
+#ifdef WITH_WSREP
+ trx->wsrep = false;
+#endif /* WITH_WSREP */
}
- trx->will_lock = 0;
+
#ifdef WITH_WSREP
- if (thd && wsrep_on(thd)) { thd_proc_info(thd, tmp); }
+ if (is_wsrep) {
+ thd_proc_info(thd, tmp);
+ }
#endif /* WITH_WSREP */
}
@@ -4698,8 +4628,7 @@ innobase_commit_ordered(
(!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)));
innobase_commit_ordered_2(trx, thd);
-
- trx_set_active_commit_ordered(trx);
+ trx->active_commit_ordered = true;
DBUG_VOID_RETURN;
}
@@ -4752,7 +4681,7 @@ innobase_commit(
DBUG_SUICIDE(););
/* Run the fast part of commit if we did not already. */
- if (!trx_is_active_commit_ordered(trx)) {
+ if (!trx->active_commit_ordered) {
innobase_commit_ordered_2(trx, thd);
}
@@ -4874,6 +4803,9 @@ innobase_rollback_trx(
if (!trx->has_logged()) {
trx->will_lock = 0;
+#ifdef WITH_WSREP
+ trx->wsrep = false;
+#endif
DBUG_RETURN(0);
}
@@ -5256,13 +5188,43 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels)
}
#endif /* WITH_WSREP */
- if (trx_t* trx = thd_to_trx(thd)) {
- ut_ad(trx->mysql_thd == thd);
- /* Cancel a pending lock request if there are any */
- lock_trx_handle_wait(trx);
- }
+ if (trx_t* trx= thd_to_trx(thd))
+ {
+ lock_mutex_enter();
+ trx_sys_mutex_enter();
+ trx_mutex_enter(trx);
+ /* It is possible that innobase_close_connection() is concurrently
+ being executed on our victim. In that case, trx->mysql_thd would
+ be reset before invoking trx_t::free(). Even if the trx object is later
+ reused for another client connection or a background transaction,
+ its trx->mysql_thd will differ from our thd.
+
+ If trx never performed any changes, nothing is really protecting
+ the trx_t::free() call or the changes of trx_t::state when the
+ transaction is being rolled back and trx_commit_low() is being
+ executed.
+
+ The function trx_allocate_for_mysql() acquires
+ trx_sys_t::mutex, but trx_allocate_for_background() will not.
+ Luckily, background transactions cannot be read-only, because
+ for read-only transactions, trx_start_low() will avoid acquiring
+ any of the trx_sys_t::mutex, lock_sys_t::mutex, trx_t::mutex before
+ assigning trx_t::state.
+
+ At this point, trx may have been reallocated for another client
+ connection, or for a background operation. In that case, either
+ trx_t::state or trx_t::mysql_thd should not match our expectations. */
+ bool cancel= trx->mysql_thd == thd && trx->state == TRX_STATE_ACTIVE &&
+ !trx->lock.was_chosen_as_deadlock_victim;
+ trx_sys_mutex_exit();
+ if (!cancel);
+ else if (lock_t *lock= trx->lock.wait_lock)
+ lock_cancel_waiting_and_release(lock);
+ lock_mutex_exit();
+ trx_mutex_exit(trx);
+ }
- DBUG_VOID_RETURN;
+ DBUG_VOID_RETURN;
}
@@ -5846,14 +5808,13 @@ innobase_vcol_build_templ(
mysql_row_templ_t* templ,
ulint col_no)
{
- if (dict_col_is_virtual(col)) {
- templ->is_virtual = true;
- templ->col_no = col_no;
+ templ->col_no = col_no;
+ templ->is_virtual = col->is_virtual();
+
+ if (templ->is_virtual) {
templ->clust_rec_field_no = ULINT_UNDEFINED;
templ->rec_field_no = col->ind;
} else {
- templ->is_virtual = false;
- templ->col_no = col_no;
templ->clust_rec_field_no = dict_col_get_clust_pos(
col, clust_index);
ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED);
@@ -7524,7 +7485,11 @@ build_template_field(
ut_ad(clust_index->table == index->table);
templ = prebuilt->mysql_template + prebuilt->n_template++;
- UNIV_MEM_INVALID(templ, sizeof *templ);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(templ, sizeof *templ);
+#endif /* HAVE_valgrind_or_MSAN */
+ templ->rec_field_is_prefix = FALSE;
+ templ->rec_prefix_field_no = ULINT_UNDEFINED;
templ->is_virtual = !field->stored_in_db();
if (!templ->is_virtual) {
@@ -7586,8 +7551,6 @@ build_template_field(
<< " query "
<< innobase_get_stmt_unsafe(current_thd, &size);
}
- templ->rec_field_is_prefix = FALSE;
- templ->rec_prefix_field_no = ULINT_UNDEFINED;
if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no;
@@ -7605,7 +7568,6 @@ build_template_field(
DBUG_ASSERT(!ha_innobase::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;
if (dict_index_is_clust(index)) {
templ->rec_field_no = templ->clust_rec_field_no;
@@ -8140,7 +8102,7 @@ ha_innobase::write_row(
{
dberr_t error;
#ifdef WITH_WSREP
- ibool auto_inc_inserted= FALSE; /* if NULL was inserted */
+ bool wsrep_auto_inc_inserted= false;
#endif
int error_result = 0;
bool auto_inc_used = false;
@@ -8153,8 +8115,7 @@ ha_innobase::write_row(
if (high_level_read_only) {
ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
DBUG_RETURN(HA_ERR_TABLE_READONLY);
- } else if (m_prebuilt->trx != trx) {
-
+ } else if (UNIV_UNLIKELY(m_prebuilt->trx != trx)) {
ib::error() << "The transaction object for the table handle is"
" at " << static_cast<const void*>(m_prebuilt->trx)
<< ", but for the current thread it is at "
@@ -8171,7 +8132,7 @@ ha_innobase::write_row(
}
#ifdef WITH_WSREP
- if (wsrep_is_load_multi_commit(m_user_thd))
+ if (trx->is_wsrep() && wsrep_is_load_multi_commit(m_user_thd))
{
/* Note that this transaction is still active. */
trx_register_for_2pc(m_prebuilt->trx);
@@ -8188,7 +8149,9 @@ ha_innobase::write_row(
m_prebuilt->autoinc_error = DB_SUCCESS;
#ifdef WITH_WSREP
- auto_inc_inserted= (table->next_number_field->val_int() == 0);
+ wsrep_auto_inc_inserted = trx->is_wsrep()
+ && wsrep_drupal_282555_workaround
+ && table->next_number_field->val_int() == 0;
#endif
if ((error_result = update_auto_increment())) {
@@ -8282,18 +8245,14 @@ ha_innobase::write_row(
m_prebuilt->autoinc_offset,
m_prebuilt->autoinc_increment);
- if (wsrep_on(m_user_thd) &&
- auto_inc_inserted &&
- wsrep_drupal_282555_workaround &&
+ if (wsrep_auto_inc_inserted &&
wsrep_thd_retry_counter(m_user_thd) == 0 &&
!thd_test_options(m_user_thd,
OPTION_NOT_AUTOCOMMIT |
OPTION_BEGIN)) {
WSREP_DEBUG(
"retrying insert: %s",
- (*wsrep_thd_query(m_user_thd)) ?
- wsrep_thd_query(m_user_thd) :
- (char *)"void");
+ wsrep_thd_query(m_user_thd));
error= DB_SUCCESS;
wsrep_thd_set_conflict_state(
m_user_thd, MUST_ABORT);
@@ -8333,7 +8292,7 @@ set_max_autoinc:
m_prebuilt autoinc values don't get
properly assigned. Fetch values from
server side. */
- if (wsrep_on(m_user_thd) &&
+ if (trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
{
wsrep_thd_auto_increment_variables(
@@ -8382,8 +8341,7 @@ report_error:
error, m_prebuilt->table->flags, m_user_thd);
#ifdef WITH_WSREP
- if (!error_result
- && wsrep_on(m_user_thd)
+ if (!error_result && trx->is_wsrep()
&& wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(m_user_thd)
&& !wsrep_thd_ignore_table(m_user_thd)) {
@@ -8391,10 +8349,9 @@ report_error:
NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ goto func_exit;
}
}
-wsrep_error:
#endif /* WITH_WSREP */
if (error_result == HA_FTS_INVALID_DOCID) {
@@ -8649,7 +8606,9 @@ calc_row_difference(
/* The field has changed */
ufield = uvect->fields + n_changed;
- UNIV_MEM_INVALID(ufield, sizeof *ufield);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(ufield, sizeof *ufield);
+#endif /* HAVE_valgrind_or_MSAN */
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
@@ -9027,7 +8986,7 @@ ha_innobase::update_row(
m_prebuilt autoinc values don't get
properly assigned. Fetch values from
server side. */
- if (wsrep_on(m_user_thd) &&
+ if (trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == REPL_RECV)
{
wsrep_thd_auto_increment_variables(
@@ -9078,9 +9037,8 @@ func_exit:
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
+ if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(m_user_thd) == LOCAL_STATE &&
- wsrep_on(m_user_thd) &&
!wsrep_thd_ignore_table(m_user_thd)) {
DBUG_PRINT("wsrep", ("update row key"));
@@ -9088,14 +9046,11 @@ func_exit:
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed"));
- err = HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
-wsrep_error:
#endif /* WITH_WSREP */
-
DBUG_RETURN(err);
}
@@ -9142,18 +9097,15 @@ ha_innobase::delete_row(
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS
+ if (error == DB_SUCCESS && trx->is_wsrep()
&& 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, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
- error = (dberr_t) HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
-wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(convert_error_code_to_mysql(
error, m_prebuilt->table->flags, m_user_thd));
@@ -10025,7 +9977,7 @@ ha_innobase::ft_init_ext(
const CHARSET_INFO* char_set = key->charset();
const char* query = key->ptr();
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
{
ib::info out;
out << "keynr=" << keynr << ", '";
@@ -10347,30 +10299,27 @@ wsrep_append_foreign_key(
wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{
- 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;
+ THD* thd = trx->mysql_thd;
- if (!wsrep_on(trx->mysql_thd) ||
- wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
+ if (!trx->is_wsrep() || wsrep_thd_exec_mode(thd) != LOCAL_STATE) {
return DB_SUCCESS;
}
- if (!thd || !foreign ||
+ if (!foreign ||
(!foreign->referenced_table && !foreign->foreign_table)) {
WSREP_INFO("FK: %s missing in: %s",
- (!thd) ? "thread" :
- ((!foreign) ? "constraint" :
- ((!foreign->referenced_table) ?
+ (!foreign ? "constraint" :
+ (!foreign->referenced_table ?
"referenced table" : "foreign table")),
- (thd && wsrep_thd_query(thd)) ?
- wsrep_thd_query(thd) : "void");
+ wsrep_thd_query(thd));
return DB_ERROR;
}
+ ulint rcode = DB_SUCCESS;
+ char cache_key[513] = {'\0'};
+ int cache_key_len=0;
+ bool const copy = true;
+
if ( !((referenced) ?
foreign->referenced_table : foreign->foreign_table)) {
WSREP_DEBUG("pulling %s table into cache",
@@ -11923,10 +11872,17 @@ innobase_fts_load_stopword(
trx_t* trx, /*!< in: transaction */
THD* thd) /*!< in: current thread */
{
- return(fts_load_stopword(table, trx,
- innobase_server_stopword_table,
- THDVAR(thd, ft_user_stopword_table),
- THDVAR(thd, ft_enable_stopword), FALSE));
+ const char *stopword_table= THDVAR(thd, ft_user_stopword_table);
+ if (!stopword_table)
+ {
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ if (innobase_server_stopword_table)
+ stopword_table= thd_strdup(thd, innobase_server_stopword_table);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ }
+
+ return fts_load_stopword(table, trx, stopword_table,
+ THDVAR(thd, ft_enable_stopword), false);
}
/** Parse the table name into normal name and remote path if needed.
@@ -12742,7 +12698,10 @@ int create_table_info_t::create_table(bool create_fk)
DICT_ERR_IGNORE_NONE);
ut_ad(innobase_table);
- const bool is_acceptable = row_size_is_acceptable(*innobase_table);
+ /* In TRUNCATE TABLE, we will merely warn about the maximum
+ row size being too large. */
+ const bool is_acceptable = row_size_is_acceptable(*innobase_table,
+ create_fk);
dict_table_close(innobase_table, true, false);
@@ -12755,18 +12714,12 @@ int create_table_info_t::create_table(bool create_fk)
}
bool create_table_info_t::row_size_is_acceptable(
- const dict_table_t &table) const
+ const dict_table_t &table, bool strict) const
{
for (dict_index_t *index= dict_table_get_first_index(&table); index;
index= dict_table_get_next_index(index))
- {
-
- if (!row_size_is_acceptable(*index))
- {
+ if (!row_size_is_acceptable(*index, strict))
return false;
- }
- }
-
return true;
}
@@ -12944,7 +12897,7 @@ static void ib_warn_row_too_big(THD *thd, const dict_table_t *table)
}
bool create_table_info_t::row_size_is_acceptable(
- const dict_index_t &index) const
+ const dict_index_t &index, bool strict) const
{
if ((index.type & DICT_FTS) || index.table->is_system_db)
{
@@ -12953,7 +12906,7 @@ bool create_table_info_t::row_size_is_acceptable(
return true;
}
- const bool strict= THDVAR(m_thd, strict_mode);
+ const bool innodb_strict_mode= THDVAR(m_thd, strict_mode);
dict_index_t::record_size_info_t info= index.record_size_info();
if (info.row_is_too_big())
@@ -12964,18 +12917,19 @@ bool create_table_info_t::row_size_is_acceptable(
const size_t idx= info.get_first_overrun_field_index();
const dict_field_t *field= dict_index_get_nth_field(&index, idx);
- ib::error_or_warn(strict)
- << "Cannot add field " << field->name << " in table "
- << index.table->name << " because after adding it, the row size is "
- << info.get_overrun_size()
- << " which is greater than maximum allowed size ("
- << info.max_leaf_size << " bytes) for a record on index leaf page.";
-
- if (strict)
+ if (innodb_strict_mode || global_system_variables.log_warnings > 2)
{
- return false;
+ ib::error_or_warn(strict && innodb_strict_mode)
+ << "Cannot add field " << field->name << " in table "
+ << index.table->name << " because after adding it, the row size is "
+ << info.get_overrun_size()
+ << " which is greater than maximum allowed size ("
+ << info.max_leaf_size << " bytes) for a record on index leaf page.";
}
+ if (strict && innodb_strict_mode)
+ return false;
+
ib_warn_row_too_big(m_thd, index.table);
}
@@ -14386,6 +14340,8 @@ ha_innobase::info_low(
DEBUG_SYNC_C("ha_innobase_info_low");
+ ut_ad(!mutex_own(&dict_sys->mutex));
+
/* If we are forcing recovery at a high level, we will suppress
statistics calculation on tables, because that may crash the
server if an index is badly corrupted. */
@@ -14422,7 +14378,6 @@ ha_innobase::info_low(
opt = DICT_STATS_RECALC_TRANSIENT;
}
- ut_ad(!mutex_own(&dict_sys->mutex));
ret = dict_stats_update(ib_table, opt);
if (ret != DB_SUCCESS) {
@@ -14443,9 +14398,7 @@ ha_innobase::info_low(
ulint stat_clustered_index_size;
ulint stat_sum_of_other_index_sizes;
- if (!(flag & HA_STATUS_NO_LOCK)) {
- dict_table_stats_lock(ib_table, RW_S_LATCH);
- }
+ mutex_enter(&dict_sys->mutex);
ut_a(ib_table->stat_initialized);
@@ -14457,9 +14410,7 @@ ha_innobase::info_low(
stat_sum_of_other_index_sizes
= ib_table->stat_sum_of_other_index_sizes;
- if (!(flag & HA_STATUS_NO_LOCK)) {
- dict_table_stats_unlock(ib_table, RW_S_LATCH);
- }
+ mutex_exit(&dict_sys->mutex);
/*
The MySQL optimizer seems to assume in a left join that n_rows
@@ -14608,10 +14559,27 @@ ha_innobase::info_low(
ib_push_frm_error(m_user_thd, ib_table, table, num_innodb_index, true);
}
- if (!(flag & HA_STATUS_NO_LOCK)) {
- dict_table_stats_lock(ib_table, RW_S_LATCH);
+
+ snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home, table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(
+ path, &stat_info, false,
+ srv_read_only_mode) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
}
+ struct Locking {
+ Locking() { mutex_enter(&dict_sys->mutex); }
+ ~Locking() { mutex_exit(&dict_sys->mutex); }
+ } locking;
+
ut_a(ib_table->stat_initialized);
for (i = 0; i < table->s->keys; i++) {
@@ -14689,25 +14657,6 @@ ha_innobase::info_low(
key->rec_per_key[j] = rec_per_key_int;
}
}
-
- if (!(flag & HA_STATUS_NO_LOCK)) {
- dict_table_stats_unlock(ib_table, RW_S_LATCH);
- }
-
- snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, table->s->normalized_path.str,
- reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(
- path, &stat_info, false,
- srv_read_only_mode) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -14784,25 +14733,14 @@ ha_innobase::analyze(
/*****************************************************************//**
Defragment table.
@return error number */
-UNIV_INTERN
-int
-ha_innobase::defragment_table(
-/*==========================*/
- const char* name, /*!< in: table name */
- const char* index_name, /*!< in: index name */
- bool async) /*!< in: whether to wait until finish */
+inline int ha_innobase::defragment_table(const char *name)
{
char norm_name[FN_REFLEN];
dict_table_t* table = NULL;
dict_index_t* index = NULL;
- ibool one_index = (index_name != 0);
int ret = 0;
dberr_t err = DB_SUCCESS;
- if (!srv_defragment) {
- return ER_FEATURE_DISABLED;
- }
-
normalize_table_name(norm_name, name);
table = dict_table_open_on_name(norm_name, FALSE,
@@ -14830,10 +14768,6 @@ ha_innobase::defragment_table(
continue;
}
- if (one_index && strcasecmp(index_name, index->name) != 0) {
- continue;
- }
-
if (btr_defragment_find_index(index)) {
// We borrow this error code. When the same index is
// already in the defragmentation queue, issue another
@@ -14849,7 +14783,7 @@ ha_innobase::defragment_table(
break;
}
- os_event_t event = btr_defragment_add_index(index, async, &err);
+ os_event_t event = btr_defragment_add_index(index, &err);
if (err != DB_SUCCESS) {
push_warning_printf(
@@ -14865,7 +14799,7 @@ ha_innobase::defragment_table(
break;
}
- if (!async && event) {
+ if (event) {
while(os_event_wait_time(event, 1000000)) {
if (thd_killed(current_thd)) {
btr_defragment_remove_index(index);
@@ -14879,19 +14813,9 @@ ha_innobase::defragment_table(
if (ret) {
break;
}
-
- if (one_index) {
- one_index = FALSE;
- break;
- }
}
dict_table_close(table, FALSE, FALSE);
-
- if (ret == 0 && one_index) {
- ret = ER_NO_SUCH_INDEX;
- }
-
return ret;
}
@@ -14916,11 +14840,8 @@ ha_innobase::optimize(
calls to OPTIMIZE, which is undesirable. */
bool try_alter = true;
- /* TODO: Defragment is disabled for now */
- if (srv_defragment) {
- int err;
-
- err = defragment_table(m_prebuilt->table->name.m_name, NULL, false);
+ if (!m_prebuilt->table->is_temporary() && srv_defragment) {
+ int err = defragment_table(m_prebuilt->table->name.m_name);
if (err == 0) {
try_alter = false;
@@ -16005,9 +15926,7 @@ ha_innobase::external_lock(
DBUG_PRINT("enter",("lock_type: %d", lock_type));
update_thd(thd);
-
- trx_t* trx = m_prebuilt->trx;
-
+ trx_t* trx = m_prebuilt->trx;
ut_ad(m_prebuilt->table);
/* Statement based binlogging does not work in isolation level
@@ -16022,26 +15941,21 @@ ha_innobase::external_lock(
&& thd_binlog_format(thd) == BINLOG_FORMAT_STMT
&& thd_binlog_filter_ok(thd)
&& thd_sqlcom_can_generate_row_events(thd)) {
-
- bool skip = false;
-
+ bool skip = false;
+#ifdef WITH_WSREP
+ skip = trx->is_wsrep()
+ && wsrep_thd_exec_mode(thd) != LOCAL_STATE;
+#endif /* WITH_WSREP */
/* used by test case */
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
-#ifdef WITH_WSREP
- if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
- {
-#endif /* WITH_WSREP */
my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
" InnoDB is limited to row-logging when"
" transaction isolation level is"
" READ COMMITTED or READ UNCOMMITTED.");
DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
}
}
@@ -16433,8 +16347,7 @@ struct ShowStatus {
/** Collect the latch metrics. Ignore entries where the
spins and waits are zero.
@param[in] count The latch metrics */
- void operator()(Count* count)
- UNIV_NOTHROW
+ void operator()(Count* count) const UNIV_NOTHROW
{
if (count->m_spins > 0 || count->m_waits > 0) {
@@ -16462,13 +16375,8 @@ struct ShowStatus {
bool operator()(latch_meta_t& latch_meta)
UNIV_NOTHROW
{
- latch_meta_t::CounterType* counter;
-
- counter = latch_meta.get_counter();
-
- GetCount get_count(latch_meta.get_name(), &m_values);
-
- counter->iterate(get_count);
+ latch_meta.get_counter()->iterate(
+ GetCount(latch_meta.get_name(), &m_values));
return(true);
}
@@ -17509,17 +17417,14 @@ innobase_commit_by_xid(
}
}
-/*******************************************************************//**
-This function is used to rollback one X/Open XA distributed transaction
+/** This function is used to rollback one X/Open XA distributed transaction
which is in the prepared state
+
+@param[in] hton InnoDB handlerton
+@param[in] xid X/Open XA transaction identification
+
@return 0 or error number */
-static
-int
-innobase_rollback_by_xid(
-/*=====================*/
- handlerton* hton, /*!< in: InnoDB handlerton */
- XID* xid) /*!< in: X/Open XA transaction
- identification */
+int innobase_rollback_by_xid(handlerton* hton, XID* xid)
{
DBUG_ASSERT(hton == innodb_hton_ptr);
@@ -18059,7 +17964,6 @@ innodb_stopword_table_validate(
char buff[STRING_BUFFER_USUAL_SIZE];
int len = sizeof(buff);
trx_t* trx;
- int ret = 1;
ut_a(save != NULL);
ut_a(value != NULL);
@@ -18072,14 +17976,22 @@ innodb_stopword_table_validate(
/* Validate the stopword table's (if supplied) existence and
of the right format */
- if (!stopword_table_name
- || fts_valid_stopword_table(stopword_table_name)) {
- *static_cast<const char**>(save) = stopword_table_name;
- ret = 0;
- }
+ int ret = stopword_table_name && !fts_valid_stopword_table(
+ stopword_table_name);
row_mysql_unlock_data_dictionary(trx);
+ if (!ret) {
+ if (stopword_table_name == buff) {
+ ut_ad(static_cast<size_t>(len) < sizeof buff);
+ stopword_table_name = thd_strmake(thd,
+ stopword_table_name,
+ len);
+ }
+
+ *static_cast<const char**>(save) = stopword_table_name;
+ }
+
return(ret);
}
@@ -18113,9 +18025,10 @@ innodb_buffer_pool_size_update(
static char* innodb_ft_aux_table;
/** Update innodb_ft_aux_table_id on SET GLOBAL innodb_ft_aux_table.
+@param[in,out] thd connection
@param[out] save new value of innodb_ft_aux_table
@param[in] value user-specified value */
-static int innodb_ft_aux_table_validate(THD*, st_mysql_sys_var*,
+static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*,
void* save, st_mysql_value* value)
{
char buf[STRING_BUFFER_USUAL_SIZE];
@@ -18129,6 +18042,15 @@ static int innodb_ft_aux_table_validate(THD*, st_mysql_sys_var*,
dict_table_close(table, FALSE, FALSE);
if (id) {
innodb_ft_aux_table_id = id;
+ if (table_name == buf) {
+ ut_ad(static_cast<size_t>(len)
+ < sizeof buf);
+ table_name = thd_strmake(thd,
+ table_name,
+ len);
+ }
+
+
*static_cast<const char**>(save) = table_name;
return 0;
}
@@ -18162,7 +18084,7 @@ innodb_adaptive_hash_index_update(
if (*(my_bool*) save) {
btr_search_enable();
} else {
- btr_search_disable(true);
+ btr_search_disable();
}
mysql_mutex_lock(&LOCK_global_system_variables);
}
@@ -18855,51 +18777,43 @@ exit:
return;
}
-#ifdef _WIN32
-/*************************************************************//**
-Validate if passed-in "value" is a valid value for
-innodb_buffer_pool_filename. On Windows, file names with colon (:)
-are not allowed.
-
-@return 0 for valid name */
-static
-int
-innodb_srv_buf_dump_filename_validate(
-/*==================================*/
- THD* thd, /*!< in: thread handle */
- struct st_mysql_sys_var* var, /*!< in: pointer to system
- variable */
- void* save, /*!< out: immediate result
- for update function */
- struct st_mysql_value* value) /*!< in: incoming string */
+/** Validate SET GLOBAL innodb_buffer_pool_filename.
+On Windows, file names with colon (:) are not allowed.
+@param thd connection
+@param save &srv_buf_dump_filename
+@param value new value to be validated
+@return 0 for valid name */
+static int innodb_srv_buf_dump_filename_validate(THD *thd, st_mysql_sys_var*,
+ void *save,
+ st_mysql_value *value)
{
- char buff[OS_FILE_MAX_PATH];
- int len = sizeof(buff);
-
- ut_a(save != NULL);
- ut_a(value != NULL);
-
- const char* buf_name = value->val_str(value, buff, &len);
+ char buff[OS_FILE_MAX_PATH];
+ int len= sizeof buff;
- if (buf_name != NULL) {
- if (is_filename_allowed(buf_name, len, FALSE)){
- *static_cast<const char**>(save) = buf_name;
- return(0);
- } else {
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_WRONG_ARGUMENTS,
- "InnoDB: innodb_buffer_pool_filename"
- " cannot have colon (:) in the file name.");
+ if (const char *buf_name= value->val_str(value, buff, &len))
+ {
+#ifdef _WIN32
+ if (!is_filename_allowed(buf_name, len, FALSE))
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: innodb_buffer_pool_filename "
+ "cannot have colon (:) in the file name.");
+ return 1;
+ }
+#endif /* _WIN32 */
+ if (buf_name == buff)
+ {
+ ut_ad(static_cast<size_t>(len) < sizeof buff);
+ buf_name= thd_strmake(thd, buf_name, len);
+ }
- }
- }
+ *static_cast<const char**>(save)= buf_name;
+ return 0;
+ }
- return(1);
+ return 1;
}
-#else /* _WIN32 */
-# define innodb_srv_buf_dump_filename_validate NULL
-#endif /* _WIN32 */
#ifdef UNIV_DEBUG
static char* srv_buffer_pool_evict;
@@ -18908,10 +18822,7 @@ static char* srv_buffer_pool_evict;
Evict all uncompressed pages of compressed tables from the buffer pool.
Keep the compressed pages in the buffer pool.
@return whether all uncompressed pages were evicted */
-static MY_ATTRIBUTE((warn_unused_result))
-bool
-innodb_buffer_pool_evict_uncompressed(void)
-/*=======================================*/
+static bool innodb_buffer_pool_evict_uncompressed()
{
bool all_evicted = true;
@@ -18932,9 +18843,13 @@ innodb_buffer_pool_evict_uncompressed(void)
if (!buf_LRU_free_page(&block->page, false)) {
all_evicted = false;
+ block = prev_block;
+ } else {
+ /* Because buf_LRU_free_page() may release
+ and reacquire buf_pool_t::mutex, prev_block
+ may be invalid. */
+ block = UT_LIST_GET_LAST(buf_pool->unzip_LRU);
}
-
- block = prev_block;
}
buf_pool_mutex_exit(buf_pool);
@@ -19518,11 +19433,14 @@ static
void
innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save)
{
- *static_cast<my_bool*>(var) = *static_cast<const my_bool*>(save);
- mysql_mutex_unlock(&LOCK_global_system_variables);
- /* Wakeup server monitor thread. */
- os_event_set(srv_monitor_event);
- mysql_mutex_lock(&LOCK_global_system_variables);
+ *static_cast<my_bool*>(var)= *static_cast<const my_bool*>(save);
+ if (srv_monitor_event)
+ {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ /* Wakeup server monitor thread. */
+ os_event_set(srv_monitor_event);
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ }
}
/** Update the system variable innodb_encryption_threads.
@@ -19588,33 +19506,6 @@ innodb_log_checksums_update(
thd, *static_cast<const my_bool*>(save));
}
-#ifdef UNIV_DEBUG
-static
-void
-innobase_debug_sync_callback(srv_slot_t *slot, const void *value)
-{
- const char *value_str = *static_cast<const char* const*>(value);
- size_t len = strlen(value_str) + 1;
-
-
- // One allocatoin for list node object and value.
- void *buf = ut_malloc_nokey(sizeof(srv_slot_t::debug_sync_t) + len);
- srv_slot_t::debug_sync_t *sync = new(buf) srv_slot_t::debug_sync_t();
- strcpy(reinterpret_cast<char*>(&sync[1]), value_str);
-
- rw_lock_x_lock(&slot->debug_sync_lock);
- UT_LIST_ADD_LAST(slot->debug_sync, sync);
- rw_lock_x_unlock(&slot->debug_sync_lock);
-}
-static
-void
-innobase_debug_sync_set(THD *thd, st_mysql_sys_var*, void *, const void *value)
-{
- srv_for_each_thread(SRV_WORKER, innobase_debug_sync_callback, value);
- srv_for_each_thread(SRV_PURGE, innobase_debug_sync_callback, value);
-}
-#endif
-
static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
@@ -20018,7 +19909,7 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
static MYSQL_SYSVAR_BOOL(log_checksums, innodb_log_checksums,
PLUGIN_VAR_RQCMDARG,
- "Whether to compute and require checksums for InnoDB redo log blocks",
+ "DEPRECATED. Whether to require checksums for InnoDB redo log blocks.",
NULL, innodb_log_checksums_update, TRUE);
static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums,
@@ -20271,6 +20162,11 @@ static MYSQL_SYSVAR_ULONG(max_purge_lag_delay, srv_max_purge_lag_delay,
0L, /* Minimum value */
10000000UL, 0); /* Maximum value */
+static MYSQL_SYSVAR_UINT(max_purge_lag_wait, innodb_max_purge_lag_wait,
+ PLUGIN_VAR_RQCMDARG,
+ "Wait until History list length is below the specified limit",
+ NULL, innodb_max_purge_lag_wait_update, UINT_MAX, 0, UINT_MAX, 0);
+
static MYSQL_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
@@ -20369,10 +20265,10 @@ static MYSQL_SYSVAR_BOOL(log_compressed_pages, page_zip_log_pages,
static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl,
PLUGIN_VAR_OPCMDARG,
- "Reduce redo logging when natively creating indexes or rebuilding tables."
- " Setting this OFF avoids delay due to page flushing and"
- " allows concurrent backup.",
- NULL, NULL, TRUE);
+ "DEPRECATED. Ignored in MariaDB 10.5."
+ " Reduce redo logging when natively creating indexes or rebuilding tables."
+ " Enabling this may slow down backup and cause delay due to page flushing.",
+ NULL, NULL, FALSE);
static MYSQL_SYSVAR_ULONG(autoextend_increment,
sys_tablespace_auto_extend_increment,
@@ -20713,8 +20609,8 @@ static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
static MYSQL_SYSVAR_UINT(spin_wait_delay, srv_spin_wait_delay,
PLUGIN_VAR_OPCMDARG,
- "Maximum delay between polling for a spin lock (6 by default)",
- NULL, NULL, 6, 0, 6000, 0);
+ "Maximum delay between polling for a spin lock (4 by default)",
+ NULL, NULL, 4, 0, 6000, 0);
static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
PLUGIN_VAR_RQCMDARG,
@@ -21026,7 +20922,7 @@ static MYSQL_SYSVAR_UINT(data_file_size_debug,
srv_sys_space_size_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"InnoDB system tablespace size to be set in recovery.",
- NULL, NULL, 0, 0, UINT_MAX32, 0);
+ NULL, NULL, 0, 0, 256U << 20, 0);
static MYSQL_SYSVAR_ULONG(fil_make_page_dirty_debug,
srv_fil_make_page_dirty_debug, PLUGIN_VAR_OPCMDARG,
@@ -21091,7 +20987,7 @@ static TYPELIB page_compression_algorithms_typelib=
};
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG,
- "Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2",
+ "Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy",
innodb_compression_algorithm_validate, NULL,
/* We use here the largest number of supported compression method to
enable all those methods that are available. Availability of compression
@@ -21142,7 +21038,7 @@ static MYSQL_SYSVAR_UINT(encryption_threads, srv_n_fil_crypt_threads,
"scrubbing",
NULL,
innodb_encryption_threads_update,
- srv_n_fil_crypt_threads, 0, UINT_MAX32, 0);
+ 0, 0, 255, 0);
static MYSQL_SYSVAR_UINT(encryption_rotate_key_age,
srv_fil_crypt_rotate_key_age,
@@ -21227,16 +21123,6 @@ static MYSQL_SYSVAR_BOOL(debug_force_scrubbing,
0,
"Perform extra scrubbing to increase test exposure",
NULL, NULL, FALSE);
-
-char *innobase_debug_sync;
-static MYSQL_SYSVAR_STR(debug_sync, innobase_debug_sync,
- PLUGIN_VAR_NOCMDARG,
- "debug_sync for innodb purge threads. "
- "Use it to set up sync points for all purge threads "
- "at once. The commands will be applied sequentially at "
- "the beginning of purging the next undo record.",
- NULL,
- innobase_debug_sync_set, NULL);
#endif /* UNIV_DEBUG */
static MYSQL_SYSVAR_BOOL(instrument_semaphores, innodb_instrument_semaphores,
@@ -21329,6 +21215,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flushing_avg_loops),
MYSQL_SYSVAR(max_purge_lag),
MYSQL_SYSVAR(max_purge_lag_delay),
+ MYSQL_SYSVAR(max_purge_lag_wait),
MYSQL_SYSVAR(old_blocks_pct),
MYSQL_SYSVAR(old_blocks_time),
MYSQL_SYSVAR(open_files),
@@ -21460,7 +21347,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(background_scrub_data_check_interval),
#ifdef UNIV_DEBUG
MYSQL_SYSVAR(debug_force_scrubbing),
- MYSQL_SYSVAR(debug_sync),
#endif
MYSQL_SYSVAR(instrument_semaphores),
MYSQL_SYSVAR(buf_dump_status_frequency),
@@ -21934,64 +21820,53 @@ innobase_get_field_from_update_vector(
Allocate a heap and record for calculating virtual fields
Used mainly for virtual fields in indexes
-@param[in] thd MariaDB THD
-@param[in] index Index in use
-@param[out] heap Heap that holds temporary row
-@param[in,out] table MariaDB table
-@param[out] record Pointer to allocated MariaDB record
-@param[out] storage Internal storage for blobs etc
+@param[in] thd MariaDB THD
+@param[in] index Index in use
+@param[out] heap Heap that holds temporary row
+@param[in,out] table MariaDB table
+@param[out] record Pointer to allocated MariaDB record
+@param[out] storage Internal storage for blobs etc
-@retval false on success
-@retval true on malloc failure or failed to open the maria table
+@retval true on success
+@retval false on malloc failure or failed to open the maria table
for purge thread.
*/
-bool innobase_allocate_row_for_vcol(
- THD * thd,
- dict_index_t* index,
- mem_heap_t** heap,
- TABLE** table,
- byte** record,
- VCOL_STORAGE** storage)
-{
- TABLE *maria_table;
- String *blob_value_storage;
- if (!*table)
- *table= innodb_find_table_for_vc(thd, index->table);
-
- /* For purge thread, there is a possiblity that table could have
- dropped, corrupted or unaccessible. */
- if (!*table)
- return true;
- maria_table= *table;
- if (!*heap && !(*heap= mem_heap_create(srv_page_size)))
- {
- *storage= 0;
- return TRUE;
- }
- *record= static_cast<byte*>(mem_heap_alloc(*heap,
- maria_table->s->reclength));
- *storage= static_cast<VCOL_STORAGE*>
- (mem_heap_alloc(*heap, sizeof(**storage)));
- blob_value_storage= static_cast<String*>
- (mem_heap_alloc(*heap,
- maria_table->s->virtual_not_stored_blob_fields *
- sizeof(String)));
- if (!*record || !*storage || !blob_value_storage)
- {
- *storage= 0;
- return TRUE;
- }
- (*storage)->maria_table= maria_table;
- (*storage)->innobase_record= *record;
- (*storage)->maria_record= maria_table->field[0]->record_ptr();
- (*storage)->blob_value_storage= blob_value_storage;
+bool innobase_allocate_row_for_vcol(THD *thd, dict_index_t *index,
+ mem_heap_t **heap, TABLE **table,
+ VCOL_STORAGE *storage)
+{
+ TABLE *maria_table;
+ String *blob_value_storage;
+ if (!*table)
+ *table = innodb_find_table_for_vc(thd, index->table);
+
+ /* For purge thread, there is a possiblity that table could have
+ dropped, corrupted or unaccessible. */
+ if (!*table)
+ return false;
+ maria_table = *table;
+ if (!*heap && !(*heap = mem_heap_create(srv_page_size)))
+ return false;
+
+ uchar *record = static_cast<byte *>(mem_heap_alloc(*heap,
+ maria_table->s->reclength));
- maria_table->move_fields(maria_table->field, *record,
- (*storage)->maria_record);
- maria_table->remember_blob_values(blob_value_storage);
+ size_t len = maria_table->s->virtual_not_stored_blob_fields * sizeof(String);
+ blob_value_storage = static_cast<String *>(mem_heap_alloc(*heap, len));
- return FALSE;
+ if (!record || !blob_value_storage)
+ return false;
+
+ storage->maria_table = maria_table;
+ storage->innobase_record = record;
+ storage->maria_record = maria_table->field[0]->record_ptr();
+ storage->blob_value_storage = blob_value_storage;
+
+ maria_table->move_fields(maria_table->field, record, storage->maria_record);
+ maria_table->remember_blob_values(blob_value_storage);
+
+ return true;
}
@@ -22006,6 +21881,13 @@ void innobase_free_row_for_vcol(VCOL_STORAGE *storage)
}
+void innobase_report_computed_value_failed(dtuple_t *row)
+{
+ ib::error() << "Compute virtual column values failed for "
+ << rec_printer(row).str();
+}
+
+
/** Get the computed value by supplying the base column values.
@param[in,out] row the data row
@param[in] col virtual column
@@ -22133,13 +22015,6 @@ innobase_get_computed_value(
dbug_tmp_restore_column_map(mysql_table->write_set, old_write_set);
if (ret != 0) {
- // FIXME: Why this error message is macro-hidden?
-#ifdef INNODB_VIRTUAL_DEBUG
- ib::warn() << "Compute virtual column values failed ";
- fputs("InnoDB: Cannot compute value for following record ",
- stderr);
- dtuple_print(stderr, row);
-#endif /* INNODB_VIRTUAL_DEBUG */
DBUG_RETURN(NULL);
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 312da6451f0..a02c897f7ae 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -219,8 +219,7 @@ public:
int delete_table(const char *name);
int rename_table(const char* from, const char* to);
- int defragment_table(const char* name, const char* index_name,
- bool async);
+ inline int defragment_table(const char* name);
int check(THD* thd, HA_CHECK_OPT* check_opt);
char* update_table_comment(const char* comment);
@@ -508,8 +507,6 @@ size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen);
extern "C" {
-struct charset_info_st *thd_charset(MYSQL_THD thd);
-
/** Check if a user thread is a replication slave thread
@param thd user thread
@retval 0 the user thread is not a replication slave thread
@@ -680,9 +677,11 @@ public:
void allocate_trx();
/** Checks that every index have sane size. Depends on strict mode */
- bool row_size_is_acceptable(const dict_table_t& table) const;
+ bool row_size_is_acceptable(const dict_table_t& table,
+ bool strict) const;
/** Checks that given index have sane size. Depends on strict mode */
- bool row_size_is_acceptable(const dict_index_t& index) const;
+ bool row_size_is_acceptable(const dict_index_t& index,
+ bool strict) const;
/** Determines InnoDB table flags.
If strict_mode=OFF, this will adjust the flags to what should be assumed.
@@ -968,3 +967,15 @@ ib_push_frm_error(
@return true if index column length exceeds limit */
MY_ATTRIBUTE((warn_unused_result))
bool too_big_key_part_length(size_t max_field_len, const KEY& key);
+
+/** This function is used to rollback one X/Open XA distributed transaction
+which is in the prepared state
+
+@param[in] hton InnoDB handlerton
+@param[in] xid X/Open XA transaction identification
+
+@return 0 or error number */
+int innobase_rollback_by_xid(handlerton* hton, XID* xid);
+
+/** Free tablespace resources allocated. */
+void innobase_space_shutdown();
diff --git a/storage/innobase/handler/ha_xtradb.h b/storage/innobase/handler/ha_xtradb.h
index 9e898818a01..b049905613c 100644
--- a/storage/innobase/handler/ha_xtradb.h
+++ b/storage/innobase/handler/ha_xtradb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
@@ -507,18 +507,6 @@ set_log_checksum_algorithm(THD* thd, st_mysql_sys_var*, void*, const void* save)
ER_WARN_DEPRECATED_SYNTAX,
innodb_deprecated_msg,
"innodb_log_checksum_algorithm");
- log_mutex_enter();
- srv_log_checksum_algorithm = *static_cast<const ulong*>(save);
- if (srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
- ib::info() << "Setting innodb_log_checksums = false";
- innodb_log_checksums = false;
- log_checksum_algorithm_ptr = log_block_calc_checksum_none;
- } else {
- ib::info() << "Setting innodb_log_checksums = true";
- innodb_log_checksums = true;
- log_checksum_algorithm_ptr = log_block_calc_checksum_crc32;
- }
- log_mutex_exit();
}
static MYSQL_SYSVAR_ENUM(log_checksum_algorithm, srv_log_checksum_algorithm,
PLUGIN_VAR_RQCMDARG,
@@ -869,15 +857,6 @@ innodb_check_deprecated(void)
if (srv_log_checksum_algorithm != SRV_CHECKSUM_ALGORITHM_DEPRECATED) {
innodb_print_deprecation("innodb-log-checksum-algorithm");
- if (srv_log_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
- ib::info() << "Setting innodb_log_checksums = false";
- innodb_log_checksums = false;
- log_checksum_algorithm_ptr = log_block_calc_checksum_none;
- } else {
- ib::info() << "Setting innodb_log_checksums = true";
- innodb_log_checksums = true;
- log_checksum_algorithm_ptr = log_block_calc_checksum_crc32;
- }
}
if (srv_max_changed_pages) {
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bae93e399e9..b766cac5dd5 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -101,19 +101,23 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_FOREIGN_OPERATIONS
= Alter_inplace_info::DROP_FOREIGN_KEY
| Alter_inplace_info::ADD_FOREIGN_KEY;
-/** Operations that InnoDB cares about and can perform without rebuild */
-static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_NOREBUILD
- = INNOBASE_ONLINE_CREATE
- | INNOBASE_FOREIGN_OPERATIONS
+/** Operations that InnoDB cares about and can perform without validation */
+static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_NOVALIDATE
+ = INNOBASE_FOREIGN_OPERATIONS
| Alter_inplace_info::DROP_INDEX
| Alter_inplace_info::DROP_UNIQUE_INDEX
| Alter_inplace_info::ALTER_COLUMN_NAME
- | Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH
//| Alter_inplace_info::ALTER_INDEX_COMMENT
- | Alter_inplace_info::ADD_VIRTUAL_COLUMN
| Alter_inplace_info::DROP_VIRTUAL_COLUMN
| Alter_inplace_info::ALTER_VIRTUAL_COLUMN_ORDER;
+/** Operations that InnoDB cares about and can perform without rebuild */
+static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_NOREBUILD
+ = INNOBASE_ALTER_NOVALIDATE
+ | INNOBASE_ONLINE_CREATE
+ | Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH
+ | Alter_inplace_info::ADD_VIRTUAL_COLUMN;
+
struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
{
/** Dummy query graph */
@@ -244,15 +248,12 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
@return whether the table will be rebuilt */
bool need_rebuild () const { return(old_table != new_table); }
- /** Clear uncommmitted added indexes after a failed operation. */
- void clear_added_indexes()
- {
- for (ulint i = 0; i < num_to_add_index; i++) {
- if (!add_index[i]->is_committed()) {
- add_index[i]->detach_columns();
- }
- }
- }
+ /** Clear uncommmitted added indexes after a failed operation. */
+ void clear_added_indexes()
+ {
+ for (ulint i= 0; i < num_to_add_index; i++)
+ add_index[i]->detach_columns(true);
+ }
/** Share context between partitions.
@param[in] ctx context from another partition of the table */
@@ -1801,7 +1802,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets)/*!< in: rec_get_offsets(
+ const rec_offs* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
{
uint n_fields = table->s->fields;
@@ -3361,7 +3362,11 @@ innobase_pk_order_preserved(
if (old_pk_column) {
new_field_order = old_field;
} else if (innobase_pk_col_is_existing(new_col_no, col_map,
- old_n_cols)) {
+ old_n_cols)
+ || new_clust_index->table->persistent_autoinc
+ == new_field + 1) {
+ /* Adding an existing column or an AUTO_INCREMENT
+ column may change the existing ordering. */
new_field_order = old_n_uniq + existing_field_count++;
} else {
/* Skip newly added column. */
@@ -4403,6 +4408,7 @@ prepare_inplace_alter_table_dict(
create_table_info_t info(ctx->prebuilt->trx->mysql_thd, altered_table,
ha_alter_info->create_info, NULL, NULL,
srv_file_per_table);
+ ut_d(bool stats_wait = false);
if (num_fts_index > 1) {
my_error(ER_INNODB_FT_LIMIT, MYF(0));
@@ -4476,6 +4482,7 @@ prepare_inplace_alter_table_dict(
XXX what may happen if bg stats opens the table after we
have unlocked data dictionary below? */
dict_stats_wait_bg_to_stop_using_table(user_table, ctx->trx);
+ ut_d(stats_wait = true);
online_retry_drop_indexes_low(ctx->new_table, ctx->trx);
@@ -4844,7 +4851,14 @@ index_created:
goto error_handling;
}
- if (!info.row_size_is_acceptable(*ctx->add_index[a])) {
+ /* For ALTER TABLE...FORCE or OPTIMIZE TABLE, we may
+ only issue warnings, because there will be no schema change. */
+ if (!info.row_size_is_acceptable(
+ *ctx->add_index[a],
+ !!(ha_alter_info->handler_flags
+ & ~(INNOBASE_INPLACE_IGNORE
+ | INNOBASE_ALTER_NOVALIDATE
+ | Alter_inplace_info::RECREATE_TABLE)))) {
error = DB_TOO_BIG_RECORD;
goto error_handling;
}
@@ -4903,12 +4917,6 @@ index_created:
user_table);
dict_index_t* new_clust_index = dict_table_get_first_index(
ctx->new_table);
- ctx->skip_pk_sort = innobase_pk_order_preserved(
- ctx->col_map, clust_index, new_clust_index);
-
- DBUG_EXECUTE_IF("innodb_alter_table_pk_assert_no_sort",
- DBUG_ASSERT(ctx->skip_pk_sort););
-
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);
@@ -4927,6 +4935,12 @@ index_created:
}
}
+ ctx->skip_pk_sort = innobase_pk_order_preserved(
+ ctx->col_map, clust_index, new_clust_index);
+
+ DBUG_EXECUTE_IF("innodb_alter_table_pk_assert_no_sort",
+ DBUG_ASSERT(ctx->skip_pk_sort););
+
if (ctx->online) {
/* Allocate a log for online table rebuild. */
rw_lock_x_lock(&clust_index->lock);
@@ -5108,7 +5122,8 @@ error_handled:
/* n_ref_count must be 1, because purge cannot
be executing on this very table as we are
holding dict_operation_lock X-latch. */
- DBUG_ASSERT(user_table->get_ref_count() == 1 || ctx->online);
+ ut_ad(!stats_wait || ctx->online
+ || user_table->get_ref_count() == 1);
online_retry_drop_indexes_with_trx(user_table, ctx->trx);
} else {
@@ -5133,6 +5148,12 @@ err_exit:
trx_free_for_mysql(ctx->trx);
trx_commit_for_mysql(ctx->prebuilt->trx);
+ for (uint i = 0; i < ctx->num_to_add_fk; i++) {
+ if (ctx->add_fk[i]) {
+ dict_foreign_free(ctx->add_fk[i]);
+ }
+ }
+
delete ctx;
ha_alter_info->handler_ctx = NULL;
@@ -7911,6 +7932,7 @@ commit_cache_norebuild(
dict_index_remove_from_cache(index->table, index);
}
+ fts_clear_all(ctx->old_table, trx);
trx_commit_for_mysql(trx);
}
@@ -8395,9 +8417,15 @@ ha_innobase::commit_inplace_alter_table(
= static_cast<ha_innobase_inplace_ctx*>(*pctx);
DBUG_ASSERT(new_clustered == ctx->need_rebuild());
-
- fail = commit_set_autoinc(ha_alter_info, ctx, altered_table,
- table);
+ if (ctx->need_rebuild()
+ && dict_table_is_discarded(ctx->old_table)) {
+ my_error(ER_TABLESPACE_DISCARDED, MYF(0),
+ table->s->table_name.str);
+ fail = true;
+ } else {
+ fail = commit_set_autoinc(ha_alter_info, ctx,
+ altered_table, table);
+ }
if (fail) {
} else if (ctx->need_rebuild()) {
@@ -8678,25 +8706,18 @@ foreign_fail:
}
if (ctx0->num_to_drop_vcol || ctx0->num_to_add_vcol) {
+ /* FIXME: this workaround does not seem to work with
+ partitioned tables */
DBUG_ASSERT(ctx0->old_table->get_ref_count() == 1);
trx_commit_for_mysql(m_prebuilt->trx);
-#ifdef BTR_CUR_HASH_ADAPT
- if (btr_search_enabled) {
- btr_search_disable(false);
- btr_search_enable();
- }
-#endif /* BTR_CUR_HASH_ADAPT */
-
- char tb_name[FN_REFLEN];
- ut_strcpy(tb_name, m_prebuilt->table->name.m_name);
-
- tb_name[strlen(m_prebuilt->table->name.m_name)] = 0;
+ char tb_name[NAME_LEN * 2 + 1 + 1];
+ strcpy(tb_name, m_prebuilt->table->name.m_name);
dict_table_close(m_prebuilt->table, true, false);
dict_table_remove_from_cache(m_prebuilt->table);
m_prebuilt->table = dict_table_open_on_name(
- tb_name, TRUE, TRUE, DICT_ERR_IGNORE_NONE);
+ tb_name, TRUE, TRUE, DICT_ERR_IGNORE_FK_NOKEY);
/* Drop outdated table stats. */
char errstr[1024];
@@ -8822,7 +8843,7 @@ foreign_fail:
trx_start_for_ddl(trx, TRX_DICT_OP_TABLE);
dberr_t error = row_merge_drop_table(trx, ctx->old_table);
- if (error != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
ib::error() << "Inplace alter table " << ctx->old_table->name
<< " dropping copy of the old table failed error "
<< error
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index fae634630fd..003760f80b1 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -2508,7 +2508,7 @@ i_s_metrics_fill(
time_diff = 0;
}
- /* Unless MONITOR__NO_AVERAGE is marked, we will need
+ /* Unless MONITOR_NO_AVERAGE is set, we must
to calculate the average value. If this is a monitor set
owner marked by MONITOR_SET_OWNER, divide
the value by another counter (number of calls) designated
@@ -2516,8 +2516,9 @@ i_s_metrics_fill(
Otherwise average the counter value by the time between the
time that the counter is enabled and time it is disabled
or time it is sampled. */
- if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE)
- && (monitor_info->monitor_type & MONITOR_SET_OWNER)
+ if ((monitor_info->monitor_type
+ & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER))
+ == MONITOR_SET_OWNER
&& monitor_info->monitor_related_id) {
mon_type_t value_start
= MONITOR_VALUE_SINCE_START(
@@ -2533,18 +2534,18 @@ i_s_metrics_fill(
fields[METRIC_AVG_VALUE_START]->set_null();
}
- if (MONITOR_VALUE(monitor_info->monitor_related_id)) {
- OK(fields[METRIC_AVG_VALUE_RESET]->store(
- MONITOR_VALUE(count)
- / MONITOR_VALUE(
- monitor_info->monitor_related_id),
- FALSE));
+ if (mon_type_t related_value =
+ MONITOR_VALUE(monitor_info->monitor_related_id)) {
+ OK(fields[METRIC_AVG_VALUE_RESET]
+ ->store(MONITOR_VALUE(count)
+ / related_value, false));
+ fields[METRIC_AVG_VALUE_RESET]->set_notnull();
} else {
fields[METRIC_AVG_VALUE_RESET]->set_null();
}
- } else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE)
- && !(monitor_info->monitor_type
- & MONITOR_DISPLAY_CURRENT)) {
+ } else if (!(monitor_info->monitor_type
+ & (MONITOR_NO_AVERAGE
+ | MONITOR_DISPLAY_CURRENT))) {
if (time_diff != 0) {
OK(fields[METRIC_AVG_VALUE_START]->store(
(double) MONITOR_VALUE_SINCE_START(
@@ -3326,6 +3327,8 @@ no_fts:
conv_str.f_len = sizeof word;
conv_str.f_str = word;
+ rw_lock_s_lock(&cache->lock);
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
@@ -3336,6 +3339,7 @@ no_fts:
index_cache, thd, &conv_str, tables));
}
+ rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
@@ -3474,7 +3478,7 @@ i_s_fts_index_table_fill_selected(
for (;;) {
error = fts_eval_sql(trx, graph);
- if (error == DB_SUCCESS) {
+ if (UNIV_LIKELY(error == DB_SUCCESS)) {
fts_sql_commit(trx);
break;
@@ -3488,7 +3492,7 @@ i_s_fts_index_table_fill_selected(
trx->error_state = DB_SUCCESS;
} else {
ib::error() << "Error occurred while reading"
- " FTS index: " << ut_strerr(error);
+ " FTS index: " << error;
break;
}
}
@@ -6313,38 +6317,43 @@ i_s_dict_fill_sys_tablestats(
OK(field_store_string(fields[SYS_TABLESTATS_NAME],
table->name.m_name));
- dict_table_stats_lock(table, RW_S_LATCH);
+ {
+ struct Locking
+ {
+ Locking() { mutex_enter(&dict_sys->mutex); }
+ ~Locking() { mutex_exit(&dict_sys->mutex); }
+ } locking;
- if (table->stat_initialized) {
- OK(field_store_string(fields[SYS_TABLESTATS_INIT],
- "Initialized"));
+ if (table->stat_initialized) {
+ OK(field_store_string(fields[SYS_TABLESTATS_INIT],
+ "Initialized"));
- OK(fields[SYS_TABLESTATS_NROW]->store(table->stat_n_rows,
- true));
+ OK(fields[SYS_TABLESTATS_NROW]->store(
+ table->stat_n_rows, true));
- OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(
- table->stat_clustered_index_size, true));
+ OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(
+ table->stat_clustered_index_size, true));
- OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(
- table->stat_sum_of_other_index_sizes, true));
+ OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(
+ table->stat_sum_of_other_index_sizes,
+ true));
- OK(fields[SYS_TABLESTATS_MODIFIED]->store(
- table->stat_modified_counter, true));
- } else {
- OK(field_store_string(fields[SYS_TABLESTATS_INIT],
- "Uninitialized"));
+ OK(fields[SYS_TABLESTATS_MODIFIED]->store(
+ table->stat_modified_counter, true));
+ } else {
+ OK(field_store_string(fields[SYS_TABLESTATS_INIT],
+ "Uninitialized"));
- OK(fields[SYS_TABLESTATS_NROW]->store(0, true));
+ OK(fields[SYS_TABLESTATS_NROW]->store(0, true));
- OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true));
+ OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0, true));
- OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true));
+ OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0, true));
- OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true));
+ OK(fields[SYS_TABLESTATS_MODIFIED]->store(0, true));
+ }
}
- dict_table_stats_unlock(table, RW_S_LATCH);
-
OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->autoinc, true));
OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]->store(ref_count, true));
@@ -8057,31 +8066,24 @@ i_s_dict_fill_sys_tablespaces(
OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
page_size.physical(), true));
- char* filepath = NULL;
- if (FSP_FLAGS_HAS_DATA_DIR(cflags)) {
- mutex_enter(&dict_sys->mutex);
- filepath = dict_get_first_path(space);
- mutex_exit(&dict_sys->mutex);
- }
-
- if (filepath == NULL) {
- filepath = fil_make_filepath(NULL, name, IBD, false);
- }
-
os_file_stat_t stat;
os_file_size_t file;
memset(&file, 0xff, sizeof(file));
memset(&stat, 0x0, sizeof(stat));
- if (filepath != NULL) {
+ if (fil_space_t* s = fil_space_acquire_silent(space)) {
+ const char *filepath = s->chain.start
+ ? s->chain.start->name : NULL;
+ if (!filepath) {
+ goto file_done;
+ }
file = os_file_get_size(filepath);
/* Get the file system (or Volume) block size. */
- dberr_t err = os_file_get_status(filepath, &stat, false, false);
-
- switch(err) {
+ switch (dberr_t err = os_file_get_status(filepath, &stat,
+ false, false)) {
case DB_FAIL:
ib::warn()
<< "File '" << filepath << "', failed to get "
@@ -8093,13 +8095,12 @@ i_s_dict_fill_sys_tablespaces(
break;
default:
- ib::error()
- << "File '" << filepath << "' "
- << ut_strerr(err);
+ ib::error() << "File '" << filepath << "' " << err;
break;
}
- ut_free(filepath);
+file_done:
+ fil_space_release(s);
}
if (file.m_total_size == static_cast<os_offset_t>(~0)) {
@@ -8627,7 +8628,7 @@ i_s_tablespaces_encryption_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to user without PROCESS_ACL privilege */
- if (check_global_access(thd, SUPER_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
}
@@ -9101,6 +9102,8 @@ i_s_innodb_mutexes_fill_table(
~Locking() { mutex_exit(&rw_lock_list_mutex); }
} locking;
+ char lock_name[sizeof "buf0dump.cc:12345"];
+
for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL;
lock = UT_LIST_GET_NEXT(list, lock)) {
if (lock->count_os_wait == 0) {
@@ -9113,11 +9116,16 @@ i_s_innodb_mutexes_fill_table(
continue;
}
- //OK(field_store_string(fields[MUTEXES_NAME],
- // lock->lock_name));
- OK(field_store_string(
- fields[MUTEXES_CREATE_FILE],
- innobase_basename(lock->cfile_name)));
+ const char* basename = innobase_basename(
+ lock->cfile_name);
+
+ snprintf(lock_name, sizeof lock_name, "%s:%u",
+ basename, lock->cline);
+
+ OK(field_store_string(fields[MUTEXES_NAME],
+ lock_name));
+ OK(field_store_string(fields[MUTEXES_CREATE_FILE],
+ basename));
OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline,
true));
fields[MUTEXES_CREATE_LINE]->set_notnull();
@@ -9133,8 +9141,8 @@ i_s_innodb_mutexes_fill_table(
snprintf(buf1, sizeof buf1, "combined %s",
innobase_basename(block_lock->cfile_name));
- //OK(field_store_string(fields[MUTEXES_NAME],
- // block_lock->lock_name));
+ OK(field_store_string(fields[MUTEXES_NAME],
+ "buf_block_t::lock"));
OK(field_store_string(fields[MUTEXES_CREATE_FILE],
buf1));
OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline,
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 7bf00eaa7c8..7068dab77a4 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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,6 +28,8 @@ Created 7/19/1997 Heikki Tuuri
#include "sync0sync.h"
#include "btr0sea.h"
+using st_::span;
+
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
my_bool srv_ibuf_disable_background_merge;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@@ -1982,7 +1984,7 @@ ibuf_add_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
- mtr_x_lock(&space->latch, &mtr);
+ mtr.x_lock_space(space, __FILE__, __LINE__);
header_page = ibuf_header_page_get(&mtr);
/* Allocate a new page: NOTE that if the page has been a part of a
@@ -2066,7 +2068,7 @@ ibuf_remove_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
- mtr_x_lock(&space->latch, &mtr);
+ mtr.x_lock_space(space, __FILE__, __LINE__);
header_page = ibuf_header_page_get(&mtr);
/* Prevent pessimistic inserts to insert buffer trees for a while */
@@ -2107,7 +2109,7 @@ ibuf_remove_free_page(void)
page from it. */
fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
- IBUF_SPACE_ID, page_no, false, &mtr);
+ IBUF_SPACE_ID, page_no, &mtr);
const page_id_t page_id(IBUF_SPACE_ID, page_no);
@@ -2612,7 +2614,7 @@ ibuf_merge(
when a slow shutdown is being executed. During a slow
shutdown, the insert buffer merge must be completed. */
- if (ibuf->empty && !srv_shutdown_state) {
+ if (ibuf->empty && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
return(0);
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
} else if (ibuf_debug) {
@@ -2744,42 +2746,28 @@ ibuf_contract_after_insert(
} while (size > 0 && sum_sizes < entry_size);
}
-/*********************************************************************//**
-Determine if an insert buffer record has been encountered already.
-@return TRUE if a new record, FALSE if possible duplicate */
-static
-ibool
-ibuf_get_volume_buffered_hash(
-/*==========================*/
- const rec_t* rec, /*!< in: ibuf record in post-4.1 format */
- const byte* types, /*!< in: fields */
- const byte* data, /*!< in: start of user record data */
- ulint comp, /*!< in: 0=ROW_FORMAT=REDUNDANT,
- nonzero=ROW_FORMAT=COMPACT */
- ulint* hash, /*!< in/out: hash array */
- ulint size) /*!< in: number of elements in hash array */
+/** Determine if a change buffer record has been encountered already.
+@param rec change buffer record in the MySQL 5.5 format
+@param hash hash table of encountered records
+@param size number of elements in hash
+@retval true if a distinct record
+@retval false if this may be duplicating an earlier record */
+static bool ibuf_get_volume_buffered_hash(const rec_t *rec, ulint *hash,
+ ulint size)
{
- ulint len;
- ulint fold;
- ulint bitmask;
-
- len = ibuf_rec_get_size(
- rec, types,
- rec_get_n_fields_old(rec) - IBUF_REC_FIELD_USER, comp);
- fold = ut_fold_binary(data, len);
-
- hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
- bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
-
- if (*hash & bitmask) {
-
- return(FALSE);
- }
-
- /* We have not seen this record yet. Insert it. */
- *hash |= bitmask;
-
- return(TRUE);
+ ut_ad(rec_get_n_fields_old(rec) > IBUF_REC_FIELD_USER);
+ const ulint start= rec_get_field_start_offs(rec, IBUF_REC_FIELD_USER);
+ const ulint len= rec_get_data_size_old(rec) - start;
+ const uint32_t fold= ut_crc32(rec + start, len);
+ hash+= (fold / (CHAR_BIT * sizeof *hash)) % size;
+ ulint bitmask= static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
+
+ if (*hash & bitmask)
+ return false;
+
+ /* We have not seen this record yet. Remember it. */
+ *hash|= bitmask;
+ return true;
}
#ifdef UNIV_DEBUG
@@ -2872,11 +2860,7 @@ ibuf_get_volume_buffered_count_func(
case IBUF_OP_DELETE_MARK:
/* There must be a record to delete-mark.
See if this record has been already buffered. */
- if (n_recs && ibuf_get_volume_buffered_hash(
- rec, types + IBUF_REC_INFO_SIZE,
- types + len,
- types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT,
- hash, size)) {
+ if (n_recs && ibuf_get_volume_buffered_hash(rec, hash, size)) {
(*n_recs)++;
}
@@ -3319,7 +3303,7 @@ ibuf_insert_low(
dtuple_t* ibuf_entry;
mem_heap_t* offsets_heap = NULL;
mem_heap_t* heap;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
ulint buffered;
lint min_n_recs;
rec_t* ins_rec;
@@ -3784,7 +3768,7 @@ ibuf_insert_to_index_page_low(
buf_block_t* block, /*!< in/out: index page where the buffered
entry should be placed */
dict_index_t* index, /*!< in: record descriptor */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t* heap, /*!< in/out: memory heap */
mtr_t* mtr, /*!< in/out: mtr */
page_cur_t* page_cur)/*!< in/out: cursor positioned on the record
@@ -3864,7 +3848,7 @@ ibuf_insert_to_index_page(
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
- ulint* offsets;
+ rec_offs* offsets;
mem_heap_t* heap;
DBUG_ENTER("ibuf_insert_to_index_page");
@@ -4121,8 +4105,8 @@ ibuf_delete(
/* TODO: the below should probably be a separate function,
it's a bastardized version of btr_cur_optimistic_delete. */
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
ulint max_ins_size = 0;
@@ -4488,7 +4472,10 @@ ibuf_merge_or_delete_for_page(
fil_space_release(space);
if (UNIV_UNLIKELY(srv_shutdown_state)
- && !srv_fast_shutdown) {
+ && !srv_fast_shutdown
+ && (!block
+ || btr_page_get_index_id(block->frame)
+ != DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) {
/* Prevent an infinite loop on slow
shutdown, in case the bitmap bits are
wrongly clear even though buffered
@@ -4574,8 +4561,7 @@ loop:
}
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
-
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto reset_bit;
}
@@ -4805,8 +4791,7 @@ loop:
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
-
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto leave_loop;
}
@@ -4972,7 +4957,8 @@ ibuf_check_bitmap_on_import(
bitmap_page = ibuf_bitmap_get_map_page(
page_id_t(space_id, page_no), page_size, &mtr);
- if (buf_page_is_zeroes(bitmap_page, page_size.physical())) {
+ if (buf_is_zeroes(span<const byte>(bitmap_page,
+ page_size.physical()))) {
/* This means we got all-zero page instead of
ibuf bitmap page. The subsequent page should be
all-zero pages. */
@@ -4985,8 +4971,8 @@ ibuf_check_bitmap_on_import(
page_size,
RW_S_LATCH, &mtr);
page_t* page = buf_block_get_frame(block);
- ut_ad(buf_page_is_zeroes(
- page, page_size.physical()));
+ ut_ad(buf_is_zeroes(span<const byte>(
+ page, page_size.physical())));
}
#endif /* UNIV_DEBUG */
ibuf_exit(&mtr);
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index ee4e522cf49..29ece955702 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -30,6 +30,7 @@ Created 6/2/1994 Heikki Tuuri
#include "dict0dict.h"
#include "data0data.h"
+#include "rem0types.h"
#include "page0cur.h"
#include "btr0types.h"
#include "gis0type.h"
@@ -212,7 +213,7 @@ the index.
ulint
btr_height_get(
/*===========*/
- dict_index_t* index, /*!< in: index tree */
+ const dict_index_t* index, /*!< in: index tree */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((warn_unused_result));
@@ -305,7 +306,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/** Create the root node for a new index tree.
@@ -392,7 +393,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
@@ -475,7 +476,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
@@ -584,7 +585,7 @@ Gets the number of pages in a B-tree.
ulint
btr_get_size(
/*=========*/
- dict_index_t* index, /*!< in: index */
+ const dict_index_t* index, /*!< in: index */
ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */
mtr_t* mtr) /*!< in/out: mini-transaction where index
is s-latched */
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index f4fcd9f4194..878e414a039 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -218,7 +218,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
const byte* field;
ulint len;
diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h
index a65f6901ce9..854414d504d 100644
--- a/storage/innobase/include/btr0bulk.h
+++ b/storage/innobase/include/btr0bulk.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, 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,6 +28,7 @@ Created 03/11/2014 Shaohua Wang
#define btr0bulk_h
#include "dict0dict.h"
+#include "rem0types.h"
#include "page0cur.h"
#include <vector>
@@ -103,12 +104,15 @@ public:
/** Insert a record in the page.
@param[in] rec record
@param[in] offsets record offsets */
- void insert(const rec_t* rec, ulint* offsets);
+ void insert(const rec_t* rec, rec_offs* offsets);
/** Mark end of insertion to the page. Scan all records to set page
dirs, and set page header members. */
void finish();
+ /** @return whether finish() actually needs to do something */
+ inline bool needs_finish() const;
+
/** Commit mtr for a page
@param[in] success Flag whether all inserts succeed. */
void commit(bool success);
@@ -127,7 +131,7 @@ public:
@param[in] big_rec external recrod
@param[in] offsets record offsets
@return error code */
- dberr_t storeExt(const big_rec_t* big_rec, ulint* offsets);
+ dberr_t storeExt(const big_rec_t* big_rec, rec_offs* offsets);
/** Get node pointer
@return node pointer */
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 4d67833db70..2f49ac6d12f 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 2020, 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
@@ -30,6 +30,7 @@ Created 10/16/1994 Heikki Tuuri
#include "dict0dict.h"
#include "page0cur.h"
#include "btr0types.h"
+#include "rem0types.h"
#include "gis0type.h"
/** Mode flags for btr_cur operations; these can be ORed */
@@ -153,8 +154,7 @@ Note that if mode is PAGE_CUR_LE, which is used in inserts, then
cursor->up_match and cursor->low_match both will have sensible values.
If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */
dberr_t
-btr_cur_search_to_nth_level(
-/*========================*/
+btr_cur_search_to_nth_level_func(
dict_index_t* index, /*!< in: index */
ulint level, /*!< in: the tree level of search */
const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in
@@ -180,16 +180,24 @@ btr_cur_search_to_nth_level(
to protect the record! */
btr_cur_t* cursor, /*!< in/out: tree cursor; the cursor page is
s- or x-latched, but see also above! */
+#ifdef BTR_CUR_HASH_ADAPT
ulint has_search_latch,
/*!< in: latch mode the caller
currently has on search system:
RW_S_LATCH, or 0 */
+#endif /* BTR_CUR_HASH_ADAPT */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr, /*!< in/out: mini-transaction */
- ib_uint64_t autoinc = 0);
+ ib_uint64_t autoinc);
/*!< in: PAGE_ROOT_AUTO_INC to be written
(0 if none) */
+#ifdef BTR_CUR_HASH_ADAPT
+# define btr_cur_search_to_nth_level btr_cur_search_to_nth_level_func
+#else /* BTR_CUR_HASH_ADAPT */
+# define btr_cur_search_to_nth_level(ix,lv,t,md,l,cur,has,file,line,m,ai) \
+ btr_cur_search_to_nth_level_func(ix,lv,t,md,l,cur,file,line,m,ai)
+#endif /* BTR_CUR_HASH_ADAPT */
/*****************************************************************//**
Opens a cursor at either end of an index.
@@ -242,7 +250,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@@ -278,7 +286,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@@ -312,7 +320,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
- ulint* offsets,/*!< in/out: offsets of the cursor record */
+ rec_offs* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@@ -339,7 +347,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
- ulint* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+ rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@@ -381,7 +389,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
- ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@@ -408,7 +416,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
- ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@@ -440,7 +448,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record */
mtr_t* mtr) /*!< in/out: mini-transaction */
@@ -584,8 +592,24 @@ btr_estimate_n_rows_in_range(
const dtuple_t* tuple2,
page_cur_mode_t mode2);
-/*******************************************************************//**
-Estimates the number of different key values in a given index, for
+
+/** Statistics for one field of an index. */
+struct index_field_stats_t
+{
+ ib_uint64_t n_diff_key_vals;
+ ib_uint64_t n_sample_sizes;
+ ib_uint64_t n_non_null_key_vals;
+
+ index_field_stats_t(ib_uint64_t n_diff_key_vals= 0,
+ ib_uint64_t n_sample_sizes= 0,
+ ib_uint64_t n_non_null_key_vals= 0)
+ : n_diff_key_vals(n_diff_key_vals), n_sample_sizes(n_sample_sizes),
+ n_non_null_key_vals(n_non_null_key_vals)
+ {
+ }
+};
+
+/** Estimates the number of different key values in a given index, for
each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index).
The estimates are stored in the array index->stat_n_diff_key_vals[] (indexed
0..n_uniq-1) and the number of pages that were sampled is saved in
@@ -593,12 +617,11 @@ index->stat_n_sample_sizes[].
If innodb_stats_method is nulls_ignored, we also record the number of
non-null values for each prefix and stored the estimates in
array index->stat_n_non_null_key_vals.
-@return true if the index is available and we get the estimated numbers,
-false if the index is unavailable. */
-bool
-btr_estimate_number_of_different_key_vals(
-/*======================================*/
- dict_index_t* index); /*!< in: index */
+@param[in] index index
+@return stat vector if the index is available and we get the estimated numbers,
+empty vector if the index is unavailable. */
+std::vector<index_field_stats_t>
+btr_estimate_number_of_different_key_vals(dict_index_t* index);
/** Gets the externally stored size of a record, in units of a database page.
@param[in] rec record
@@ -607,7 +630,7 @@ btr_estimate_number_of_different_key_vals(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
- const ulint* offsets);
+ const rec_offs* offsets);
/*******************************************************************//**
Marks non-updated off-page fields as disowned by this record. The ownership
@@ -621,7 +644,7 @@ btr_cur_disown_inherited_fields(
part will be updated, or NULL */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull(2,3,4,5,6)));
@@ -660,7 +683,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
- ulint* offsets, /*!< in/out: rec_get_offsets() on
+ rec_offs* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@@ -691,7 +714,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index),
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
page_zip_des_t* page_zip, /*!< in: compressed page corresponding
to rec, or NULL if rec == NULL */
@@ -748,24 +771,12 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
const page_size_t& page_size,
ulint no,
ulint* len,
mem_heap_t* heap);
-/*******************************************************************//**
-Flags the data tuple fields that are marked as extern storage in the
-update vector. We use this function to remember which fields we must
-mark as extern storage in a record inserted for an update.
-@return number of flagged external columns */
-ulint
-btr_push_update_extern_fields(
-/*==========================*/
- dtuple_t* tuple, /*!< in/out: data tuple */
- const upd_t* update, /*!< in: update vector */
- mem_heap_t* heap) /*!< in: memory heap */
- MY_ATTRIBUTE((nonnull));
/***********************************************************//**
Sets a secondary index record's delete mark to the given value. This
function is only used by the insert buffer merge mechanism. */
diff --git a/storage/innobase/include/btr0defragment.h b/storage/innobase/include/btr0defragment.h
index 57f8c2f3811..d622c3c7c39 100644
--- a/storage/innobase/include/btr0defragment.h
+++ b/storage/innobase/include/btr0defragment.h
@@ -64,8 +64,6 @@ is a synchronized defragmentation. */
os_event_t
btr_defragment_add_index(
dict_index_t* index, /*!< index to be added */
- bool async, /*!< whether this is an async
- defragmentation */
dberr_t* err); /*!< out: error code */
/******************************************************************//**
When table is dropped, this function is called to mark a table as removed in
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index b79260e5ab6..9e3b4fc20a6 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -29,6 +29,7 @@ Created 2/23/1996 Heikki Tuuri
#include "dict0dict.h"
#include "btr0cur.h"
+#include "buf0block_hint.h"
#include "btr0btr.h"
#include "gis0rtree.h"
@@ -136,15 +137,22 @@ btr_pcur_open_with_no_init_func(
page, but assume that the caller uses his
btr search latch to protect the record! */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
+#ifdef BTR_CUR_HASH_ADAPT
ulint has_search_latch,
/*!< in: latch mode the caller
currently has on search system:
RW_S_LATCH, or 0 */
+#endif /* BTR_CUR_HASH_ADAPT */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
-#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
+#ifdef BTR_CUR_HASH_ADAPT
+# define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m)
+#else /* BTR_CUR_HASH_ADAPT */
+# define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
+ btr_pcur_open_with_no_init_func(ix,t,md,l,cur,__FILE__,__LINE__,m)
+#endif /* BTR_CUR_HASH_ADAPT */
/*****************************************************************//**
Opens a persistent cursor at either end of an index. */
@@ -507,13 +515,10 @@ struct btr_pcur_t{
whether cursor was on, before, or after the old_rec record */
enum btr_pcur_pos_t rel_pos;
/** buffer block when the position was stored */
- buf_block_t* block_when_stored;
+ buf::Block_hint block_when_stored;
/** the modify clock value of the buffer block when the cursor position
was stored */
ib_uint64_t modify_clock;
- /** the withdraw clock value of the buffer pool when the cursor
- position was stored */
- ulint withdraw_clock;
/** btr_pcur_store_position() and btr_pcur_restore_position() state. */
enum pcur_pos_t pos_state;
/** PAGE_CUR_G, ... */
@@ -533,9 +538,8 @@ struct btr_pcur_t{
btr_pcur_t() :
btr_cur(), latch_mode(0), old_stored(false), old_rec(NULL),
old_n_fields(0), rel_pos(btr_pcur_pos_t(0)),
- block_when_stored(NULL),
- modify_clock(0), withdraw_clock(0),
- pos_state(BTR_PCUR_NOT_POSITIONED),
+ block_when_stored(),
+ modify_clock(0), pos_state(BTR_PCUR_NOT_POSITIONED),
search_mode(PAGE_CUR_UNSUPP), trx_if_known(NULL),
old_rec_buf(NULL), buf_size(0)
{
diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic
index 8b0da666250..6bc5b356dab 100644
--- a/storage/innobase/include/btr0pcur.ic
+++ b/storage/innobase/include/btr0pcur.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -458,7 +458,7 @@ btr_pcur_open_low(
index, level, tuple, mode, latch_mode,
btr_cursor, 0, file, line, mtr, autoinc);
- if (err != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::warn() << " Error code: " << err
<< " btr_pcur_open_low "
<< " level: " << level
@@ -496,10 +496,12 @@ btr_pcur_open_with_no_init_func(
page, but assume that the caller uses his
btr search latch to protect the record! */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
+#ifdef BTR_CUR_HASH_ADAPT
ulint has_search_latch,
/*!< in: latch mode the caller
currently has on search system:
RW_S_LATCH, or 0 */
+#endif /* BTR_CUR_HASH_ADAPT */
const char* file, /*!< in: file name */
unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
@@ -516,7 +518,7 @@ btr_pcur_open_with_no_init_func(
err = btr_cur_search_to_nth_level(
index, 0, tuple, mode, latch_mode, btr_cursor,
- has_search_latch, file, line, mtr);
+ has_search_latch, file, line, mtr, 0);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 645b3689ff6..a9781c65491 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -36,32 +36,17 @@ Created 2/17/1996 Heikki Tuuri
void
btr_search_sys_create(ulint hash_size);
-/** Resize hash index hash table.
-@param[in] hash_size hash index hash table size */
-void
-btr_search_sys_resize(ulint hash_size);
-
/** Frees the adaptive search system at a database shutdown. */
void
btr_search_sys_free();
-/** Disable the adaptive hash search system and empty the index.
-@param need_mutex need to acquire dict_sys->mutex */
-void
-btr_search_disable(
- bool need_mutex);
-/** Enable the adaptive hash search system. */
+/** Disable the adaptive hash search system and empty the index. */
+void btr_search_disable();
+
+/** Enable the adaptive hash search system.
+@param[in] resize Flag to indicate call during buf_pool_resize() */
void
-btr_search_enable();
-
-/** Returns the value of ref_count. The value is protected by latch.
-@param[in] info search info
-@param[in] index index identifier
-@return ref_count value. */
-ulint
-btr_search_info_get_ref_count(
- btr_search_t* info,
- dict_index_t* index);
+btr_search_enable(bool resize=false);
/*********************************************************************//**
Updates the search info. */
@@ -156,18 +141,6 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor);
bool
btr_search_validate();
-/** X-Lock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_x_lock(const dict_index_t* index);
-
-/** X-Unlock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_x_unlock(const dict_index_t* index);
-
/** Lock all search latches in exclusive mode. */
UNIV_INLINE
void
@@ -178,18 +151,6 @@ UNIV_INLINE
void
btr_search_x_unlock_all();
-/** S-Lock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_s_lock(const dict_index_t* index);
-
-/** S-Unlock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_s_unlock(const dict_index_t* index);
-
/** Lock all search latches in shared mode. */
UNIV_INLINE
void
@@ -236,17 +197,12 @@ btr_get_search_table(const dict_index_t* index);
#else /* BTR_CUR_HASH_ADAPT */
# define btr_search_sys_create(size)
# define btr_search_drop_page_hash_index(block)
-# define btr_search_s_lock(index)
-# define btr_search_s_unlock(index)
# define btr_search_s_lock_all(index)
# define btr_search_s_unlock_all(index)
-# define btr_search_x_lock(index)
-# define btr_search_x_unlock(index)
# define btr_search_info_update(index, cursor)
# define btr_search_move_or_delete_hash_entries(new_block, block, index)
# define btr_search_update_hash_on_insert(cursor)
# define btr_search_update_hash_on_delete(cursor)
-# define btr_search_sys_resize(hash_size)
#endif /* BTR_CUR_HASH_ADAPT */
#ifdef BTR_CUR_ADAPT
@@ -274,8 +230,6 @@ struct btr_search_t{
the machine word, i.e., they cannot be turned into bit-fields. */
buf_block_t* root_guess;/*!< the root page frame when it was last time
fetched, or NULL */
- ulint withdraw_clock; /*!< the withdraw clock value of the buffer
- pool when root_guess was stored */
#ifdef BTR_CUR_HASH_ADAPT
ulint hash_analysis; /*!< when this exceeds
BTR_SEARCH_HASH_ANALYSIS, the hash
@@ -327,6 +281,18 @@ struct btr_search_t{
};
#ifdef BTR_CUR_HASH_ADAPT
+/** @return number of leaf pages pointed to by the adaptive hash index */
+inline ulint dict_index_t::n_ahi_pages() const
+{
+ if (!btr_search_enabled)
+ return 0;
+ rw_lock_t *latch = btr_get_search_latch(this);
+ rw_lock_s_lock(latch);
+ ulint ref_count= search_info->ref_count;
+ rw_lock_s_unlock(latch);
+ return ref_count;
+}
+
/** The hash index system */
struct btr_search_sys_t{
hash_table_t** hash_tables; /*!< the adaptive hash tables,
diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.ic
index 4972de16064..90877d23192 100644
--- a/storage/innobase/include/btr0sea.ic
+++ b/storage/innobase/include/btr0sea.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -62,8 +63,8 @@ btr_search_info_update(
dict_index_t* index, /*!< in: index of the cursor */
btr_cur_t* cursor) /*!< in: cursor which was just positioned */
{
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
- ut_ad(!rw_lock_own(btr_get_search_latch(index), RW_LOCK_X));
+ ut_ad(!rw_lock_own_flagged(btr_get_search_latch(index),
+ RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
if (dict_index_is_spatial(index) || !btr_search_enabled) {
return;
@@ -87,24 +88,6 @@ btr_search_info_update(
btr_search_info_update_slow(info, cursor);
}
-/** X-Lock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_x_lock(const dict_index_t* index)
-{
- rw_lock_x_lock(btr_get_search_latch(index));
-}
-
-/** X-Unlock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_x_unlock(const dict_index_t* index)
-{
- rw_lock_x_unlock(btr_get_search_latch(index));
-}
-
/** Lock all search latches in exclusive mode. */
UNIV_INLINE
void
@@ -125,24 +108,6 @@ btr_search_x_unlock_all()
}
}
-/** S-Lock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_s_lock(const dict_index_t* index)
-{
- rw_lock_s_lock(btr_get_search_latch(index));
-}
-
-/** S-Unlock the search latch (corresponding to given index)
-@param[in] index index handler */
-UNIV_INLINE
-void
-btr_search_s_unlock(const dict_index_t* index)
-{
- rw_lock_s_unlock(btr_get_search_latch(index));
-}
-
/** Lock all search latches in shared mode. */
UNIV_INLINE
void
diff --git a/storage/innobase/include/buf0block_hint.h b/storage/innobase/include/buf0block_hint.h
new file mode 100644
index 00000000000..2d681175b25
--- /dev/null
+++ b/storage/innobase/include/buf0block_hint.h
@@ -0,0 +1,77 @@
+/*****************************************************************************
+
+Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, MariaDB Corporation.
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License, version 2.0, as published by the
+Free Software Foundation.
+
+This program is also distributed with certain software (including but not
+limited to OpenSSL) that is licensed under separate terms, as designated in a
+particular file or component or in included license documentation. The authors
+of MySQL hereby grant you an additional permission to link the program and
+your derivative works with the separately licensed software that they have
+included with MySQL.
+
+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, version 2.0,
+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
+
+*****************************************************************************/
+#pragma once
+#include "buf0buf.h"
+
+namespace buf {
+class Block_hint {
+ public:
+ Block_hint():m_block(NULL),m_page_id(0,0) {}
+ /** Stores the pointer to the block, which is currently buffer-fixed.
+ @param block a pointer to a buffer-fixed block to be stored */
+ inline void store(buf_block_t *block)
+ {
+ ut_ad(block->page.buf_fix_count);
+ m_block= block;
+ m_page_id= block->page.id;
+ }
+
+ /** Clears currently stored pointer. */
+ inline void clear() { m_block= NULL; }
+
+ /** Invoke f on m_block(which may be null)
+ @param f The function to be executed. It will be passed the pointer.
+ If you wish to use the block pointer subsequently,
+ you need to ensure you buffer-fix it before returning from f.
+ @return the return value of f
+ */
+ template <typename F>
+ bool run_with_hint(const F &f)
+ {
+ buffer_fix_block_if_still_valid();
+ /* m_block could be changed during f() call, so we use local
+ variable to remember which block we need to unfix */
+ buf_block_t *block= m_block;
+ bool res= f(block);
+ if (block)
+ buf_block_buf_fix_dec(block);
+ return res;
+ }
+
+ buf_block_t *block() const { return m_block; }
+
+ private:
+ /** The block pointer stored by store(). */
+ buf_block_t *m_block;
+ /** If m_block is non-null, the m_block->page.id at time it was stored. */
+ page_id_t m_page_id;
+
+ /** A helper function which checks if m_block is not a dangling pointer and
+ still points to block with page with m_page_id and if so, buffer-fixes it,
+ otherwise clear()s it */
+ void buffer_fix_block_if_still_valid();
+};
+} // namespace buf
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index af2a7d90101..40d2e6b2023 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -33,6 +33,7 @@ Created 11/5/1995 Heikki Tuuri
#include "fil0fil.h"
#include "mtr0types.h"
#include "buf0types.h"
+#include "span.h"
#ifndef UNIV_INNOCHECKSUM
#include "hash0hash.h"
#include "ut0byte.h"
@@ -70,11 +71,13 @@ struct fil_addr_t;
/* @} */
/** @name Modes for buf_page_get_known_nowait */
/* @{ */
-#define BUF_MAKE_YOUNG 51 /*!< Move the block to the
+#ifdef BTR_CUR_HASH_ADAPT
+# define BUF_MAKE_YOUNG 51 /*!< Move the block to the
start of the LRU list if there
is a danger that the block
would drift out of the buffer
pool*/
+#endif /* BTR_CUR_HASH_ADAPT */
#define BUF_KEEP_OLD 52 /*!< Preserve the current LRU
position of the block. */
/* @} */
@@ -98,10 +101,6 @@ extern buf_pool_t* buf_pool_ptr; /*!< The buffer pools
extern volatile bool buf_pool_withdrawing; /*!< true when withdrawing buffer
pool pages might cause page relocation */
-extern volatile ulint buf_withdraw_clock; /*!< the clock is incremented
- every time a pointer to a page may
- become obsolete */
-
# ifdef UNIV_DEBUG
extern my_bool buf_disable_resize_buffer_pool_debug; /*!< if TRUE, resizing
buffer pool is not allowed. */
@@ -281,12 +280,6 @@ extern "C"
os_thread_ret_t
DECLARE_THREAD(buf_resize_thread)(void*);
-#ifdef BTR_CUR_HASH_ADAPT
-/** Clear the adaptive hash index on all pages in the buffer pool. */
-void
-buf_pool_clear_hash_index();
-#endif /* BTR_CUR_HASH_ADAPT */
-
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
@@ -435,6 +428,7 @@ buf_page_get_zip(
const page_size_t& page_size);
/** This is the general function used to get access to a database page.
+It does page initialization and applies the buffered redo logs.
@param[in] page_id page id
@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
@param[in] guess guessed block or NULL
@@ -457,6 +451,29 @@ buf_page_get_gen(
mtr_t* mtr,
dberr_t* err);
+/** This is the low level function used to get access to a database page.
+@param[in] page_id page id
+@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH
+@param[in] guess guessed block or NULL
+@param[in] mode BUF_GET, BUF_GET_IF_IN_POOL,
+BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
+@param[in] file file name
+@param[in] line line where called
+@param[in] mtr mini-transaction
+@param[out] err DB_SUCCESS or error code
+@return pointer to the block or NULL */
+buf_block_t*
+buf_page_get_low(
+ const page_id_t page_id,
+ const page_size_t& page_size,
+ ulint rw_latch,
+ buf_block_t* guess,
+ ulint mode,
+ const char* file,
+ unsigned line,
+ mtr_t* mtr,
+ dberr_t* err);
+
/** Initializes a page to the buffer buf_pool. The page is usually not read
from a file even if it cannot be found in the buffer buf_pool. This is one
of the functions which perform to a block a state transition NOT_USED =>
@@ -646,11 +663,10 @@ buf_block_unfix(buf_block_t* block);
# endif /* UNIV_DEBUG */
#endif /* !UNIV_INNOCHECKSUM */
-/** 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 */
-bool buf_page_is_zeroes(const void* read_buf, size_t page_size);
+/** Check if a buffer is all zeroes.
+@param[in] buf data to check
+@return whether the buffer is all zeroes */
+bool buf_is_zeroes(st_::span<const byte> buf);
/** Checks if the page is in crc32 checksum format.
@param[in] read_buf database page
@@ -706,6 +722,27 @@ buf_page_is_corrupted(
#endif
MY_ATTRIBUTE((warn_unused_result));
+inline void *aligned_malloc(size_t size, size_t align)
+{
+#ifdef _MSC_VER
+ return _aligned_malloc(size, align);
+#else
+ void *result;
+ if (posix_memalign(&result, align, size))
+ result= NULL;
+ return result;
+#endif
+}
+
+inline void aligned_free(void *ptr)
+{
+#ifdef _MSC_VER
+ _aligned_free(ptr);
+#else
+ free(ptr);
+#endif
+}
+
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Gets the space id, page offset, and byte offset within page of a
@@ -1332,14 +1369,6 @@ buf_get_nth_chunk_block(
ulint n, /*!< in: nth chunk in the buffer pool */
ulint* chunk_size); /*!< in: chunk size */
-/** Verify the possibility that a stored page is not in buffer pool.
-@param[in] withdraw_clock withdraw clock when stored the page
-@retval true if the page might be relocated */
-UNIV_INLINE
-bool
-buf_pool_is_obsolete(
- ulint withdraw_clock);
-
/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit,
if needed.
@param[in] size size in bytes
@@ -1379,7 +1408,7 @@ 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 {
+struct buf_tmp_buffer_t {
private:
int32 reserved; /*!< true if this slot is reserved
*/
@@ -1409,7 +1438,7 @@ public:
return !my_atomic_fas32_explicit(&reserved, true,
MY_MEMORY_ORDER_RELAXED);
}
-} buf_tmp_buffer_t;
+};
/** The common buffer control block structure
for compressed and uncompressed frames */
@@ -1463,11 +1492,6 @@ public:
zip.data == NULL means an active
buf_pool->watch */
- ulint write_size; /* Write size is set when this
- page is first time written and then
- if written again we check is TRIM
- operation needed. */
-
ulint real_size; /*!< Real size of the page
Normal pages == UNIV_PAGE_SIZE
page compressed pages, payload
@@ -1701,7 +1725,7 @@ struct buf_block_t{
# define assert_block_ahi_empty(block) \
ut_a(my_atomic_addlint(&(block)->n_pointers, 0) == 0)
# define assert_block_ahi_empty_on_init(block) do { \
- UNIV_MEM_VALID(&(block)->n_pointers, sizeof (block)->n_pointers); \
+ MEM_MAKE_DEFINED(&(block)->n_pointers, sizeof (block)->n_pointers); \
assert_block_ahi_empty(block); \
} while (0)
# define assert_block_ahi_valid(block) \
@@ -1732,9 +1756,6 @@ struct buf_block_t{
# define assert_block_ahi_empty_on_init(block) /* nothing */
# define assert_block_ahi_valid(block) /* nothing */
#endif /* BTR_CUR_HASH_ADAPT */
- bool skip_flush_check;
- /*!< Skip check in buf_dblwr_check_block
- during bulk load, protected by lock.*/
# ifdef UNIV_DEBUG
/** @name Debug fields */
/* @{ */
@@ -2174,6 +2195,11 @@ struct buf_pool_t{
buf_tmp_array_t* tmp_arr;
/*!< Array for temporal memory
used in compression and encryption */
+ /** Determine if a pointer belongs to a buf_block_t.
+ It can be a pointer to the buf_block_t itself or a member of it.
+ @param ptr a pointer that will not be dereferenced
+ @return whether the ptr belongs to a buf_block_t struct */
+ inline bool is_block_field(const void *ptr) const;
#if BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN
# error "BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN"
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 98026159b8a..49b741ab5c8 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -54,6 +54,25 @@ struct buf_chunk_t{
}
};
+bool buf_pool_t::is_block_field(const void *ptr) const
+{
+ const buf_chunk_t* chunk= chunks;
+ const buf_chunk_t *const echunk= chunk + ut_min(n_chunks,
+ n_chunks_new);
+ /* TODO: protect chunks with a mutex (the older pointer will
+ currently remain during resize()) */
+ while (chunk < echunk)
+ {
+ if (ptr >= reinterpret_cast<const void*>(chunk->blocks) &&
+ ptr < reinterpret_cast<const void*>(
+ chunk->blocks + chunk->size))
+ return true;
+ chunk++;
+ }
+
+ return false;
+}
+
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
@@ -113,7 +132,17 @@ ulint
buf_pool_get_n_pages(void)
/*======================*/
{
- return(buf_pool_get_curr_size() / UNIV_PAGE_SIZE);
+ if (!buf_pool_ptr)
+ return buf_pool_get_curr_size() >> srv_page_size_shift;
+
+ ulint chunk_size= 0;
+ for (uint i= 0; i < srv_buf_pool_instances; i++)
+ {
+ buf_pool_t* buf_pool = buf_pool_from_array(i);
+ for (uint j= 0; j < buf_pool->n_chunks; j++)
+ chunk_size+= buf_pool->chunks[j].size;
+ }
+ return chunk_size;
}
/********************************************************************//**
@@ -814,7 +843,7 @@ buf_page_alloc_descriptor(void)
bpage = (buf_page_t*) ut_zalloc_nokey(sizeof *bpage);
ut_ad(bpage);
- UNIV_MEM_ALLOC(bpage, sizeof *bpage);
+ MEM_UNDEFINED(bpage, sizeof *bpage);
return(bpage);
}
@@ -1046,8 +1075,6 @@ buf_block_buf_fix_dec(
/*==================*/
buf_block_t* block) /*!< in/out: block to bufferunfix */
{
- buf_block_unfix(block);
-
#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
@@ -1056,6 +1083,8 @@ buf_block_buf_fix_dec(
rw_lock_s_unlock(&block->debug_latch);
}
#endif /* UNIV_DEBUG */
+
+ buf_block_unfix(block);
}
/** Returns the buffer pool instance given a page id.
@@ -1429,18 +1458,6 @@ buf_page_get_frame(
}
}
-/** Verify the possibility that a stored page is not in buffer pool.
-@param[in] withdraw_clock withdraw clock when stored the page
-@retval true if the page might be relocated */
-UNIV_INLINE
-bool
-buf_pool_is_obsolete(
- ulint withdraw_clock)
-{
- return(buf_pool_withdrawing
- || buf_withdraw_clock != withdraw_clock);
-}
-
/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit,
if needed.
@param[in] size size in bytes
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index 1efbb1f03ef..a72d98395af 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -49,17 +49,6 @@ These are low-level functions
/** Minimum LRU list length for which the LRU_old pointer is defined */
#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
-#ifdef BTR_CUR_HASH_ADAPT
-struct dict_table_t;
-/** Try to drop the adaptive hash index for a tablespace.
-@param[in,out] table table
-@return whether anything was dropped */
-bool buf_LRU_drop_page_hash_for_tablespace(dict_table_t* table)
- MY_ATTRIBUTE((warn_unused_result,nonnull));
-#else
-# define buf_LRU_drop_page_hash_for_tablespace(table)
-#endif /* BTR_CUR_HASH_ADAPT */
-
/** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier
@param[in,out] observer flush observer,
diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h
index 33d03c8a2c9..fdf1a14feee 100644
--- a/storage/innobase/include/data0data.h
+++ b/storage/innobase/include/data0data.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2019, 2020 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
@@ -32,6 +32,7 @@ Created 5/30/1994 Heikki Tuuri
#include "mem0mem.h"
#include "dict0types.h"
#include "btr0types.h"
+#include <vector>
#include <ostream>
@@ -510,9 +511,6 @@ struct dtuple_t {
dfield_t* fields; /*!< fields */
ulint n_v_fields; /*!< number of virtual fields */
dfield_t* v_fields; /*!< fields on virtual column */
- UT_LIST_NODE_T(dtuple_t) tuple_list;
- /*!< data tuples can be linked into a
- list using this field */
#ifdef UNIV_DEBUG
ulint magic_n; /*!< magic number, used in
debug assertions */
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index 295c786a583..9b7a3132873 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -50,10 +50,6 @@ dfield_set_len(
dfield_t* field, /*!< in: field */
ulint len) /*!< in: length or UNIV_SQL_NULL */
{
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(field->data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
-
field->ext = 0;
field->len = static_cast<unsigned int>(len);
}
@@ -96,9 +92,6 @@ dfield_set_data(
const void* data, /*!< in: data */
ulint len) /*!< in: length or UNIV_SQL_NULL */
{
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
field->data = (void*) data;
field->ext = 0;
field->len = static_cast<unsigned int>(len);
@@ -113,9 +106,7 @@ dfield_write_mbr(
dfield_t* field, /*!< in: field */
const double* mbr) /*!< in: data */
{
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
+ MEM_CHECK_DEFINED(mbr, sizeof *mbr);
field->ext = 0;
for (unsigned i = 0; i < SPDIMS * 2; i++) {
@@ -177,7 +168,7 @@ dfield_dup(
mem_heap_t* heap) /*!< in: memory heap where allocated */
{
if (!dfield_is_null(field)) {
- UNIV_MEM_ASSERT_RW(field->data, field->len);
+ MEM_CHECK_DEFINED(field->data, field->len);
field->data = mem_heap_dup(heap, field->data, field->len);
}
}
@@ -334,8 +325,9 @@ dtuple_create_from_mem(
}
}
#endif
- UNIV_MEM_ASSERT_W(tuple->fields, n_t_fields * sizeof *tuple->fields);
- UNIV_MEM_INVALID(tuple->fields, n_t_fields * sizeof *tuple->fields);
+ MEM_CHECK_ADDRESSABLE(tuple->fields, n_t_fields
+ * sizeof *tuple->fields);
+ MEM_UNDEFINED(tuple->fields, n_t_fields * sizeof *tuple->fields);
return(tuple);
}
diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h
index 7d87686e010..359d9f556e5 100644
--- a/storage/innobase/include/dict0crea.h
+++ b/storage/innobase/include/dict0crea.h
@@ -238,16 +238,6 @@ dict_replace_tablespace_in_dictionary(
const char* path,
trx_t* trx);
-/** Delete records from SYS_TABLESPACES and SYS_DATAFILES associated
-with a particular tablespace ID.
-@param[in] space Tablespace ID
-@param[in,out] trx Current transaction
-@return DB_SUCCESS if OK, dberr_t if the operation failed */
-dberr_t
-dict_delete_tablespace_and_datafiles(
- ulint space,
- trx_t* trx);
-
/********************************************************************//**
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 565ea77374d..7351b5fb682 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -302,7 +302,7 @@ UNIV_INLINE
void
dict_table_autoinc_initialize(dict_table_t* table, ib_uint64_t value)
{
- ut_ad(dict_table_autoinc_own(table));
+ mysql_mutex_assert_owner(&table->autoinc_mutex);
table->autoinc = value;
}
@@ -315,7 +315,7 @@ UNIV_INLINE
ib_uint64_t
dict_table_autoinc_read(const dict_table_t* table)
{
- ut_ad(dict_table_autoinc_own(table));
+ mysql_mutex_assert_owner(&table->autoinc_mutex);
return(table->autoinc);
}
@@ -329,7 +329,7 @@ UNIV_INLINE
bool
dict_table_autoinc_update_if_greater(dict_table_t* table, ib_uint64_t value)
{
- ut_ad(dict_table_autoinc_own(table));
+ mysql_mutex_assert_owner(&table->autoinc_mutex);
if (value > table->autoinc) {
@@ -1459,7 +1459,7 @@ UNIV_INLINE
rw_lock_t*
dict_index_get_lock(
/*================*/
- dict_index_t* index) /*!< in: index */
+ const dict_index_t* index) /*!< in: index */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/********************************************************************//**
Returns free space reserved for future updates of records. This is
@@ -1524,41 +1524,6 @@ void
dict_mutex_exit_for_mysql(void);
/*===========================*/
-/** Create a dict_table_t's stats latch or delay for lazy creation.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to create
-@param[in] enabled if false then the latch is disabled
-and dict_table_stats_lock()/unlock() become noop on this table. */
-void
-dict_table_stats_latch_create(
- dict_table_t* table,
- bool enabled);
-
-/** Destroy a dict_table_t's stats latch.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to destroy */
-void
-dict_table_stats_latch_destroy(
- dict_table_t* table);
-
-/** Lock the appropriate latch to protect a given table's statistics.
-@param[in] table table whose stats to lock
-@param[in] latch_mode RW_S_LATCH or RW_X_LATCH */
-void
-dict_table_stats_lock(
- dict_table_t* table,
- ulint latch_mode);
-
-/** Unlock the latch that has been locked by dict_table_stats_lock().
-@param[in] table table whose stats to unlock
-@param[in] latch_mode RW_S_LATCH or RW_X_LATCH */
-void
-dict_table_stats_unlock(
- dict_table_t* table,
- ulint latch_mode);
-
/********************************************************************//**
Checks if the database name in two table names is the same.
@return TRUE if same db name */
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index bb77bb7e6e6..554bfdd50ac 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -862,16 +862,18 @@ dict_table_x_lock_indexes(
/*======================*/
dict_table_t* table) /*!< in: table */
{
- dict_index_t* index;
-
ut_ad(mutex_own(&dict_sys->mutex));
+ dict_index_t* clust_index = dict_table_get_first_index(table);
+
/* Loop through each index of the table and lock them */
- for (index = dict_table_get_first_index(table);
+ for (dict_index_t* index = dict_table_get_next_index(clust_index);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index));
}
+
+ rw_lock_x_lock(dict_index_get_lock(clust_index));
}
/*********************************************************************//**
@@ -1179,7 +1181,7 @@ UNIV_INLINE
rw_lock_t*
dict_index_get_lock(
/*================*/
- dict_index_t* index) /*!< in: index */
+ const dict_index_t* index) /*!< in: index */
{
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index 79440533ab2..b288c0b337a 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -88,14 +88,6 @@ dict_get_first_table_name_in_db(
/*============================*/
const char* name); /*!< in: database name which ends to '/' */
-/** Get the first filepath from SYS_DATAFILES for a given space_id.
-@param[in] space_id Tablespace ID
-@return First filepath (caller must invoke ut_free() on it)
-@retval NULL if no SYS_DATAFILES entry was found. */
-char*
-dict_get_first_path(
- ulint space_id);
-
/** Make sure the data_file_name is saved in dict_table_t if needed.
Try to read it from the fil_system first, then from SYS_DATAFILES.
@param[in] table Table object
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 0f96cd4e3ba..a4defe4d92a 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -44,7 +44,6 @@ Created 1/8/1996 Heikki Tuuri
#include "fts0fts.h"
#include "buf0buf.h"
#include "gis0type.h"
-#include "os0once.h"
#include "fil0fil.h"
#include <my_crypt.h>
#include "fil0crypt.h"
@@ -299,29 +298,25 @@ parent table will fail, and user has to drop excessive foreign constraint
before proceeds. */
#define FK_MAX_CASCADE_DEL 15
-/**********************************************************************//**
-Creates a table memory object.
+/** Creates a table memory object.
+@param[in] name table name
+@param[in] space space where the clustered index
+ of the table is placed
+@param[in] n_cols total number of columns including
+ virtual and non-virtual columns
+@param[in] n_v_cols number of virtual columns
+@param[in] flags table flags
+@param[in] flags2 table flags2
@return own: table object */
dict_table_t*
dict_mem_table_create(
-/*==================*/
- const char* name, /*!< in: table name */
- ulint space, /*!< in: space where the clustered index
- of the table is placed */
- ulint n_cols, /*!< in: total number of columns
- including virtual and non-virtual
- columns */
- ulint n_v_cols, /*!< in: number of virtual columns */
- ulint flags, /*!< in: table flags */
- ulint flags2); /*!< in: table flags2 */
-/**********************************************************************//**
-Determines if a table belongs to a system database
-@return */
-UNIV_INTERN
-bool
-dict_mem_table_is_system(
-/*==================*/
- char *name); /*!< in: table name */
+ const char* name,
+ ulint space,
+ ulint n_cols,
+ ulint n_v_cols,
+ ulint flags,
+ ulint flags2);
+
/****************************************************************//**
Free a table memory object. */
void
@@ -634,12 +629,12 @@ struct dict_col_t{
this column. Our current max limit is
3072 for Barracuda table */
- /** @return whether this is a virtual column */
- bool is_virtual() const { return prtype & DATA_VIRTUAL; }
+ /** @return whether this is a virtual column */
+ bool is_virtual() const { return prtype & DATA_VIRTUAL; }
- /** Detach the column from an index.
- @param[in] index index to be detached from */
- inline void detach(const dict_index_t& index);
+ /** Detach a virtual column from an index.
+ @param index being-freed index */
+ inline void detach(const dict_index_t &index);
};
/** Index information put in a list of virtual column structure. Index
@@ -800,7 +795,7 @@ extern ulong zip_pad_max;
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 */
+ mysql_mutex_t mutex; /*!< mutex protecting the info */
ulint pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
current round */
@@ -808,9 +803,6 @@ struct zip_pad_info_t {
current round */
ulint n_rounds;/*!< number of currently successful
rounds */
- volatile os_once::state_t
- mutex_created;
- /*!< Creation state of mutex member */
};
/** Number of samples of data size kept when page compression fails for
@@ -821,10 +813,6 @@ a certain index.*/
system clustered index when there is no primary key. */
const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX";
-/* Estimated number of offsets in records (based on columns)
-to start with. */
-#define OFFS_IN_REC_NORMAL_SIZE 100
-
/** Data structure for an index. Most fields will be
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
struct dict_index_t{
@@ -835,6 +823,9 @@ struct dict_index_t{
dict_table_t* table; /*!< back pointer to table */
unsigned space:32;
/*!< space where the index tree is placed */
+ /** root page number, or FIL_NULL if the index has been detached
+ from storage (DISCARD TABLESPACE or similar),
+ or 1 if the index is in table->freed_indexes */
unsigned page:32;/*!< index tree root page number */
unsigned merge_threshold:6;
/*!< In the pessimistic delete, if the page
@@ -968,7 +959,8 @@ struct dict_index_t{
/* in which slot the next sample should be
saved. */
/* @} */
- rtr_ssn_t rtr_ssn;/*!< Node sequence number for RTree */
+ /** R-tree split sequence number */
+ volatile int32 rtr_ssn;
rtr_info_track_t*
rtr_track;/*!< tracking all R-Tree search cursors */
trx_id_t trx_id; /*!< id of the transaction that created this
@@ -976,7 +968,7 @@ struct dict_index_t{
when InnoDB was started up */
zip_pad_info_t zip_pad;/*!< Information about state of
compression failures and successes */
- rw_lock_t lock; /*!< read-write lock protecting the
+ mutable rw_lock_t lock; /*!< read-write lock protecting the
upper levels of the index tree */
/** Determine if the index has been committed to the
@@ -1014,20 +1006,61 @@ struct dict_index_t{
/** @return whether the index includes virtual columns */
bool has_virtual() const { return type & DICT_VIRTUAL; }
+ /** @return the position of DB_TRX_ID */
+ uint16_t db_trx_id() const {
+ DBUG_ASSERT(is_primary());
+ DBUG_ASSERT(n_uniq);
+ return n_uniq;
+ }
+ /** @return the position of DB_ROLL_PTR */
+ uint16_t db_roll_ptr() const
+ {
+ return static_cast<uint16_t>(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 */
+ uint16_t first_user_field() const
+ {
+ return static_cast<uint16_t>(db_trx_id() + 2);
+ }
+
/** @return whether the index is corrupted */
inline bool is_corrupted() const;
- /** Detach the columns from the index that is to be freed. */
- void detach_columns()
- {
- if (has_virtual()) {
- for (unsigned i = 0; i < n_fields; i++) {
- fields[i].col->detach(*this);
- }
+ /** Detach the virtual columns from the index that is to be removed.
+ @param whether to reset fields[].col */
+ void detach_columns(bool clear= false)
+ {
+ if (!has_virtual())
+ return;
+ for (unsigned i= 0; i < n_fields; i++)
+ {
+ dict_col_t* col= fields[i].col;
+ if (!col || !col->is_virtual())
+ continue;
+ col->detach(*this);
+ if (clear)
+ fields[i].col= NULL;
+ }
+ }
+
+ /** @return whether this is the change buffer */
+ bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); }
- n_fields = 0;
- }
- }
+#ifdef BTR_CUR_HASH_ADAPT
+ /** @return a clone of this */
+ dict_index_t* clone() const;
+ /** Clone this index for lazy dropping of the adaptive hash index.
+ @return this or a clone */
+ dict_index_t* clone_if_needed();
+ /** @return number of leaf pages pointed to by the adaptive hash index */
+ inline ulint n_ahi_pages() const;
+ /** @return whether mark_freed() had been invoked */
+ bool freed() const { return UNIV_UNLIKELY(page == 1); }
+ /** Note that the index is waiting for btr_search_lazy_free() */
+ void set_freed() { ut_ad(!freed()); page= 1; }
+#endif /* BTR_CUR_HASH_ADAPT */
/** This ad-hoc class is used by record_size_info only. */
class record_size_info_t {
@@ -1090,24 +1123,24 @@ struct dict_index_t{
inline record_size_info_t record_size_info() const;
};
-/** Detach a column from an index.
-@param[in] index index to be detached from */
-inline void dict_col_t::detach(const dict_index_t& index)
+/** Detach a virtual column from an index.
+@param index being-freed index */
+inline void dict_col_t::detach(const dict_index_t &index)
{
- if (!is_virtual()) {
- return;
- }
-
- if (dict_v_idx_list* v_indexes = reinterpret_cast<const dict_v_col_t*>
- (this)->v_indexes) {
- for (dict_v_idx_list::iterator i = v_indexes->begin();
- i != v_indexes->end(); i++) {
- if (i->index == &index) {
- v_indexes->erase(i);
- return;
- }
- }
- }
+ ut_ad(is_virtual());
+
+ if (dict_v_idx_list *v_indexes= reinterpret_cast<const dict_v_col_t*>(this)
+ ->v_indexes)
+ {
+ for (dict_v_idx_list::iterator i= v_indexes->begin();
+ i != v_indexes->end(); i++)
+ {
+ if (i->index == &index) {
+ v_indexes->erase(i);
+ return;
+ }
+ }
+ }
}
/** The status of online index creation */
@@ -1173,6 +1206,10 @@ struct dict_foreign_t{
dict_vcol_set* v_cols; /*!< set of virtual columns affected
by foreign key constraint. */
+
+ /** Check whether the fulltext index gets affected by
+ foreign key constraint */
+ bool affects_fulltext() const;
};
std::ostream&
@@ -1608,6 +1645,11 @@ struct dict_table_t {
/** List of indexes of the table. */
UT_LIST_BASE_NODE_T(dict_index_t) indexes;
+#ifdef BTR_CUR_HASH_ADAPT
+ /** List of detached indexes that are waiting to be freed along with
+ the last adaptive hash index entry */
+ UT_LIST_BASE_NODE_T(dict_index_t) freed_indexes;
+#endif /* BTR_CUR_HASH_ADAPT */
/** List of foreign key constraints in the table. These refer to
columns in other tables. */
@@ -1647,23 +1689,8 @@ struct dict_table_t {
/*!< set of foreign key constraints which refer to this table */
dict_foreign_set referenced_set;
- /** Statistics for query optimization. @{ */
-
- /** Creation state of 'stats_latch'. */
- volatile os_once::state_t stats_latch_created;
-
- /** This latch protects:
- dict_table_t::stat_initialized,
- dict_table_t::stat_n_rows (*),
- dict_table_t::stat_clustered_index_size,
- dict_table_t::stat_sum_of_other_index_sizes,
- dict_table_t::stat_modified_counter (*),
- dict_table_t::indexes*::stat_n_diff_key_vals[],
- dict_table_t::indexes*::stat_index_size,
- dict_table_t::indexes*::stat_n_leaf_pages.
- (*) Those are not always protected for
- performance reasons. */
- rw_lock_t* stats_latch;
+ /** Statistics for query optimization. Mostly protected by
+ dict_sys->mutex. @{ */
/** TRUE if statistics have been calculated the first time after
database startup or table creation. */
@@ -1787,11 +1814,8 @@ struct dict_table_t {
from a select. */
lock_t* autoinc_lock;
- /** Creation state of autoinc_mutex member */
- volatile os_once::state_t autoinc_mutex_created;
-
/** Mutex protecting the autoincrement counter. */
- ib_mutex_t* autoinc_mutex;
+ mysql_mutex_t autoinc_mutex;
/** Autoinc counter value to give to the next inserted row. */
ib_uint64_t autoinc;
@@ -1885,64 +1909,6 @@ struct dict_foreign_add_to_referenced_table {
}
};
-/** Destroy the autoinc latch of the given table.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to destroy */
-inline
-void
-dict_table_autoinc_destroy(
- dict_table_t* table)
-{
- if (table->autoinc_mutex_created == os_once::DONE
- && table->autoinc_mutex != NULL) {
- mutex_free(table->autoinc_mutex);
- UT_DELETE(table->autoinc_mutex);
- }
-}
-
-/** Request for lazy creation of the autoinc latch of a given table.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose autoinc latch is to be created. */
-inline
-void
-dict_table_autoinc_create_lazy(
- dict_table_t* table)
-{
- table->autoinc_mutex = NULL;
- table->autoinc_mutex_created = os_once::NEVER_DONE;
-}
-
-/** Request a lazy creation of dict_index_t::zip_pad::mutex.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] index index whose zip_pad mutex is to be created */
-inline
-void
-dict_index_zip_pad_mutex_create_lazy(
- dict_index_t* index)
-{
- index->zip_pad.mutex = NULL;
- index->zip_pad.mutex_created = os_once::NEVER_DONE;
-}
-
-/** Destroy the zip_pad_mutex of the given index.
-This function is only called from either single threaded environment
-or from a thread that has not shared the table object with other threads.
-@param[in,out] table table whose stats latch to destroy */
-inline
-void
-dict_index_zip_pad_mutex_destroy(
- dict_index_t* index)
-{
- if (index->zip_pad.mutex_created == os_once::DONE
- && index->zip_pad.mutex != NULL) {
- mutex_free(index->zip_pad.mutex);
- UT_DELETE(index->zip_pad.mutex);
- }
-}
-
/** Release the zip_pad_mutex of a given index.
@param[in,out] index index whose zip_pad_mutex is to be released */
inline
@@ -1950,22 +1916,9 @@ void
dict_index_zip_pad_unlock(
dict_index_t* index)
{
- mutex_exit(index->zip_pad.mutex);
+ mysql_mutex_unlock(&index->zip_pad.mutex);
}
-#ifdef UNIV_DEBUG
-/** Check if the current thread owns the autoinc_mutex of a given table.
-@param[in] table the autoinc_mutex belongs to this table
-@return true, if the current thread owns the autoinc_mutex, false otherwise.*/
-inline
-bool
-dict_table_autoinc_own(
- const dict_table_t* table)
-{
- return(mutex_own(table->autoinc_mutex));
-}
-#endif /* UNIV_DEBUG */
-
/** Check whether the col is used in spatial index or regular index.
@param[in] col column to check
@return spatial status */
diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h
index 98956412ae2..00ac6eb4745 100644
--- a/storage/innobase/include/dict0stats.h
+++ b/storage/innobase/include/dict0stats.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2009, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -115,16 +115,16 @@ dict_stats_deinit(
/** Update the table modification counter and if necessary,
schedule new estimates for table and index statistics to be calculated.
@param[in,out] table persistent or temporary table
-@param[in] thd current session */
-void dict_stats_update_if_needed(dict_table_t* table, THD* thd)
- MY_ATTRIBUTE((nonnull(1)));
+@param[in] trx transaction */
+void dict_stats_update_if_needed(dict_table_t *table, const trx_t &trx)
+ MY_ATTRIBUTE((nonnull));
#else
/** Update the table modification counter and if necessary,
schedule new estimates for table and index statistics to be calculated.
@param[in,out] table persistent or temporary table */
-void dict_stats_update_if_needed_func(dict_table_t* table)
+void dict_stats_update_if_needed_func(dict_table_t *table)
MY_ATTRIBUTE((nonnull));
-# define dict_stats_update_if_needed(t,thd) dict_stats_update_if_needed_func(t)
+# define dict_stats_update_if_needed(t,trx) dict_stats_update_if_needed_func(t)
#endif
/*********************************************************************//**
diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic
index 31065d15c45..c467ee1f3ac 100644
--- a/storage/innobase/include/dict0stats.ic
+++ b/storage/innobase/include/dict0stats.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -75,7 +75,7 @@ dict_stats_is_persistent_enabled(const dict_table_t* table)
+ dict_stats_update(DICT_STATS_RECALC_TRANSIENT) on a table that has
just been PS-enabled.
This is acceptable. Avoiding this would mean that we would have to
- protect the ::stat_persistent with dict_table_stats_lock() like the
+ protect the ::stat_persistent with dict_sys->mutex like the
other ::stat_ members which would be too big performance penalty,
especially when this function is called from
dict_stats_update_if_needed(). */
@@ -178,50 +178,44 @@ dict_stats_deinit(
ut_a(table->get_ref_count() == 0);
- dict_table_stats_lock(table, RW_X_LATCH);
-
if (!table->stat_initialized) {
- dict_table_stats_unlock(table, RW_X_LATCH);
return;
}
table->stat_initialized = FALSE;
-#ifdef UNIV_DEBUG_VALGRIND
- UNIV_MEM_INVALID(&table->stat_n_rows,
- sizeof(table->stat_n_rows));
- UNIV_MEM_INVALID(&table->stat_clustered_index_size,
- sizeof(table->stat_clustered_index_size));
- UNIV_MEM_INVALID(&table->stat_sum_of_other_index_sizes,
- sizeof(table->stat_sum_of_other_index_sizes));
- UNIV_MEM_INVALID(&table->stat_modified_counter,
- sizeof(table->stat_modified_counter));
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&table->stat_n_rows, sizeof table->stat_n_rows);
+ MEM_UNDEFINED(&table->stat_clustered_index_size,
+ sizeof table->stat_clustered_index_size);
+ MEM_UNDEFINED(&table->stat_sum_of_other_index_sizes,
+ sizeof table->stat_sum_of_other_index_sizes);
+ MEM_UNDEFINED(&table->stat_modified_counter,
+ sizeof table->stat_modified_counter);
dict_index_t* index;
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
-
- ulint n_uniq = dict_index_get_n_unique(index);
-
- UNIV_MEM_INVALID(
+ MEM_UNDEFINED(
index->stat_n_diff_key_vals,
- n_uniq * sizeof(index->stat_n_diff_key_vals[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_diff_key_vals[0]));
+ MEM_UNDEFINED(
index->stat_n_sample_sizes,
- n_uniq * sizeof(index->stat_n_sample_sizes[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_sample_sizes[0]));
+ MEM_UNDEFINED(
index->stat_n_non_null_key_vals,
- n_uniq * sizeof(index->stat_n_non_null_key_vals[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_non_null_key_vals[0]));
+ MEM_UNDEFINED(
&index->stat_index_size,
sizeof(index->stat_index_size));
- UNIV_MEM_INVALID(
+ MEM_UNDEFINED(
&index->stat_n_leaf_pages,
sizeof(index->stat_n_leaf_pages));
}
-#endif /* UNIV_DEBUG_VALGRIND */
-
- dict_table_stats_unlock(table, RW_X_LATCH);
+#endif /* HAVE_valgrind_or_MSAN */
}
diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h
index a7a8e1dea1e..b3302409e5f 100644
--- a/storage/innobase/include/dyn0buf.h
+++ b/storage/innobase/include/dyn0buf.h
@@ -29,7 +29,8 @@ Created 2013-03-16 Sunny Bains
#include "mem0mem.h"
#include "dyn0types.h"
-#include "ut0lst.h"
+#include "ilist.h"
+
/** Class that manages dynamic buffers. It uses a UT_LIST of
dyn_buf_t::block_t instances. We don't use STL containers in
@@ -42,12 +43,7 @@ template <size_t SIZE = DYN_ARRAY_DATA_SIZE>
class dyn_buf_t {
public:
- class block_t;
-
- typedef UT_LIST_NODE_T(block_t) block_node_t;
- typedef UT_LIST_BASE_NODE_T(block_t) block_list_t;
-
- class block_t {
+ class block_t : public ilist_node<> {
public:
block_t()
@@ -157,16 +153,13 @@ public:
/** SIZE - sizeof(m_node) + sizeof(m_used) */
enum {
MAX_DATA_SIZE = SIZE
- - sizeof(block_node_t)
+ - sizeof(ilist_node<>)
+ sizeof(ib_uint32_t)
};
/** Storage */
byte m_data[MAX_DATA_SIZE];
- /** Doubly linked list node. */
- block_node_t m_node;
-
/** number of data bytes used in this block;
DYN_BLOCK_FULL_FLAG is set when the block becomes full */
ib_uint32_t m_used;
@@ -174,6 +167,8 @@ public:
friend class dyn_buf_t;
};
+ typedef sized_ilist<block_t> list_t;
+
enum { MAX_DATA_SIZE = block_t::MAX_DATA_SIZE};
/** Default constructor */
@@ -182,7 +177,6 @@ public:
m_heap(),
m_size()
{
- UT_LIST_INIT(m_list, &block_t::m_node);
push_back(&m_first_block);
}
@@ -200,11 +194,11 @@ public:
m_heap = NULL;
/* Initialise the list and add the first block. */
- UT_LIST_INIT(m_list, &block_t::m_node);
- push_back(&m_first_block);
+ m_list.clear();
+ m_list.push_back(m_first_block);
} else {
m_first_block.init();
- ut_ad(UT_LIST_GET_LEN(m_list) == 1);
+ ut_ad(m_list.size() == 1);
}
m_size = 0;
@@ -236,7 +230,7 @@ public:
@param ptr end of used space */
void close(const byte* ptr)
{
- ut_ad(UT_LIST_GET_LEN(m_list) > 0);
+ ut_ad(!m_list.empty());
block_t* block = back();
m_size -= block->used();
@@ -324,11 +318,10 @@ public:
#ifdef UNIV_DEBUG
ulint total_size = 0;
- for (const block_t* block = UT_LIST_GET_FIRST(m_list);
- block != NULL;
- block = UT_LIST_GET_NEXT(m_node, block)) {
-
- total_size += block->used();
+ for (typename list_t::iterator it = m_list.begin(),
+ end = m_list.end();
+ it != end; ++it) {
+ total_size += it->used();
}
ut_ad(total_size == m_size);
@@ -342,12 +335,12 @@ public:
template <typename Functor>
bool for_each_block(Functor& functor) const
{
- for (const block_t* block = UT_LIST_GET_FIRST(m_list);
- block != NULL;
- block = UT_LIST_GET_NEXT(m_node, block)) {
+ for (typename list_t::iterator it = m_list.begin(),
+ end = m_list.end();
+ it != end; ++it) {
- if (!functor(block)) {
- return(false);
+ if (!functor(&*it)) {
+ return false;
}
}
@@ -360,12 +353,12 @@ public:
template <typename Functor>
bool for_each_block_in_reverse(Functor& functor) const
{
- for (block_t* block = UT_LIST_GET_LAST(m_list);
- block != NULL;
- block = UT_LIST_GET_PREV(m_node, block)) {
+ for (typename list_t::reverse_iterator it = m_list.rbegin(),
+ end = m_list.rend();
+ it != end; ++it) {
- if (!functor(block)) {
- return(false);
+ if (!functor(&*it)) {
+ return false;
}
}
@@ -378,12 +371,12 @@ public:
template <typename Functor>
bool for_each_block_in_reverse(const Functor& functor) const
{
- for (block_t* block = UT_LIST_GET_LAST(m_list);
- block != NULL;
- block = UT_LIST_GET_PREV(m_node, block)) {
+ for (typename list_t::reverse_iterator it = m_list.rbegin(),
+ end = m_list.rend();
+ it != end; ++it) {
- if (!functor(block)) {
- return(false);
+ if (!functor(&*it)) {
+ return false;
}
}
@@ -395,8 +388,7 @@ public:
block_t* front()
MY_ATTRIBUTE((warn_unused_result))
{
- ut_ad(UT_LIST_GET_LEN(m_list) > 0);
- return(UT_LIST_GET_FIRST(m_list));
+ return &m_list.front();
}
/**
@@ -417,14 +409,13 @@ private:
void push_back(block_t* block)
{
block->init();
-
- UT_LIST_ADD_LAST(m_list, block);
+ m_list.push_back(*block);
}
/** @return the last block in the list */
block_t* back()
{
- return(UT_LIST_GET_LAST(m_list));
+ return &m_list.back();
}
/*
@@ -447,25 +438,22 @@ private:
@return the block containing the pos. */
block_t* find(ulint& pos)
{
- block_t* block;
+ ut_ad(!m_list.empty());
- ut_ad(UT_LIST_GET_LEN(m_list) > 0);
+ for (typename list_t::iterator it = m_list.begin(),
+ end = m_list.end();
+ it != end; ++it) {
- for (block = UT_LIST_GET_FIRST(m_list);
- block != NULL;
- block = UT_LIST_GET_NEXT(m_node, block)) {
+ if (pos < it->used()) {
+ ut_ad(it->used() >= pos);
- if (pos < block->used()) {
- break;
+ return &*it;
}
- pos -= block->used();
+ pos -= it->used();
}
- ut_ad(block != NULL);
- ut_ad(block->used() >= pos);
-
- return(block);
+ return NULL;
}
/**
@@ -491,7 +479,7 @@ private:
mem_heap_t* m_heap;
/** Allocated blocks */
- block_list_t m_list;
+ list_t m_list;
/** Total size used by all blocks */
ulint m_size;
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 386f574a59f..65457b414ca 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -33,9 +33,13 @@ Created 10/25/1995 Heikki Tuuri
#include "dict0types.h"
#include "page0size.h"
#include "ibuf0types.h"
+#include "ilist.h"
#include <list>
+struct unflushed_spaces_tag_t;
+struct rotation_list_tag_t;
+
// Forward declaration
extern ibool srv_use_doublewrite_buf;
extern struct buf_dblwr_t* buf_dblwr;
@@ -78,7 +82,9 @@ fil_type_is_data(
struct fil_node_t;
/** Tablespace or log data space */
-struct fil_space_t {
+struct fil_space_t : ilist_node<unflushed_spaces_tag_t>,
+ ilist_node<rotation_list_tag_t>
+{
ulint id; /*!< space id */
hash_node_t hash; /*!< hash chain node */
char* name; /*!< Tablespace name */
@@ -129,6 +135,8 @@ struct fil_space_t {
/*!< recovered tablespace size in pages;
0 if no size change was read from the redo log,
or if the size change was implemented */
+ /** the committed size of the tablespace in pages */
+ ulint committed_size;
ulint flags; /*!< FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
see fsp0types.h,
fsp_flags_is_valid(),
@@ -156,26 +164,21 @@ struct fil_space_t {
ulint n_pending_ios;
rw_lock_t latch; /*!< latch protecting the file space storage
allocation */
- UT_LIST_NODE_T(fil_space_t) unflushed_spaces;
- /*!< list of spaces with at least one unflushed
- file we have written to */
UT_LIST_NODE_T(fil_space_t) named_spaces;
/*!< list of spaces for which MLOG_FILE_NAME
records have been issued */
- /** 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;
- /** 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;
+ /** Checks that this tablespace in a list of unflushed tablespaces. */
+ bool is_in_unflushed_spaces;
+
+ /** Checks that this tablespace needs key rotation. */
+ bool is_in_rotation_list;
+
/** True if the device this filespace is on supports atomic writes */
bool atomic_write_supported;
@@ -192,6 +195,15 @@ struct fil_space_t {
/** @return whether the tablespace is about to be dropped */
bool is_stopping() const { return stop_new_ops; }
+ /** Clamp a page number for batched I/O, such as read-ahead.
+ @param offset page number limit
+ @return offset clamped to the tablespace size */
+ ulint max_page_number_for_io(ulint offset) const
+ {
+ const ulint limit= committed_size;
+ return limit > offset ? offset : limit;
+ }
+
/** @return whether doublewrite buffering is needed */
bool use_doublewrite() const
{
@@ -484,6 +496,11 @@ fil_space_get(
data space) is stored here; below we talk about tablespaces, but also
the ib_logfiles form a 'space' and it is handled here */
struct fil_system_t {
+ fil_system_t()
+ : n_open(0), max_assigned_id(0), space_id_reuse_warned(false)
+ {
+ }
+
ib_mutex_t mutex; /*!< The mutex protecting the cache */
hash_table_t* spaces; /*!< The hash table of spaces in the
system; they are hashed on the space
@@ -501,8 +518,8 @@ struct fil_system_t {
not put to this list: they are opened
after the startup, and kept open until
shutdown */
- UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces;
- /*!< base node for the list of those
+ sized_ilist<fil_space_t, unflushed_spaces_tag_t> unflushed_spaces;
+ /*!< list of those
tablespaces whose files contain
unflushed writes; those spaces have
at least one file node where
@@ -524,11 +541,11 @@ struct fil_system_t {
record has been written since
the latest redo log checkpoint.
Protected only by log_sys->mutex. */
- UT_LIST_BASE_NODE_T(fil_space_t) rotation_list;
+ ilist<fil_space_t, rotation_list_tag_t> rotation_list;
/*!< list of all file spaces needing
key rotation.*/
- ibool space_id_reuse_warned;
+ bool space_id_reuse_warned;
/* !< TRUE if fil_space_create()
has issued a warning about
potential space_id reuse */
@@ -539,24 +556,15 @@ struct fil_system_t {
@retval NULL if the tablespace does not exist or cannot be read */
fil_space_t* read_page0(ulint id);
- /** Return the next fil_space_t from key rotation list.
- Once started, the caller must keep calling this until it returns NULL.
- fil_space_acquire() and fil_space_release() are invoked here which
- blocks a concurrent operation from dropping the tablespace.
- @param[in] prev_space Previous tablespace or NULL to start
- from beginning of fil_system->rotation
- list
- @param[in] recheck recheck of the tablespace is needed or
- still encryption thread does write page0
- for it
- @param[in] key_version key version of the key state thread
- If NULL, use the first fil_space_t on fil_system->space_list.
- @return pointer to the next fil_space_t.
- @retval NULL if this was the last */
- fil_space_t* keyrotate_next(
- fil_space_t* prev_space,
- bool remove,
- uint key_version);
+ /** Return the next tablespace from rotation_list.
+ @param space previous tablespace (NULL to start from the start)
+ @param recheck whether the removal condition needs to be rechecked after
+ the encryption parameters were changed
+ @param encrypt expected state of innodb_encrypt_tables
+ @return the next tablespace to process (n_pending_ops incremented)
+ @retval NULL if this was the last */
+ inline fil_space_t* keyrotate_next(fil_space_t *space, bool recheck,
+ bool encrypt);
};
/** The tablespace memory cache. This variable is NULL before the module is
@@ -565,15 +573,6 @@ extern fil_system_t* fil_system;
#include "fil0crypt.h"
-/** Returns the latch of a file space.
-@param[in] id space id
-@param[out] flags tablespace flags
-@return latch protecting storage allocation */
-rw_lock_t*
-fil_space_get_latch(
- ulint id,
- ulint* flags);
-
/** Gets the type of a file space.
@param[in] id tablespace identifier
@return file type */
@@ -795,34 +794,6 @@ fil_space_acquire_for_io(ulint id);
void
fil_space_release_for_io(fil_space_t* space);
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in,out] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last */
-fil_space_t*
-fil_space_next(
- fil_space_t* prev_space)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Previous tablespace or NULL to start
- from beginning of fil_system->rotation list
-@param[in] remove Whether to remove the previous tablespace from
- the rotation list
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-fil_space_t*
-fil_space_keyrotate_next(fil_space_t* prev_space, bool remove)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Wrapper with reference-counting for a fil_space_t. */
class FilSpace
{
@@ -958,14 +929,9 @@ bool fil_table_accessible(const dict_table_t* table)
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
+@param[in] if_exists whether to ignore missing tablespace
@return DB_SUCCESS or error */
-dberr_t
-fil_delete_tablespace(
- ulint id
-#ifdef BTR_CUR_HASH_ADAPT
- , bool drop_ahi = false /*!< whether to drop the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
- );
+dberr_t fil_delete_tablespace(ulint id, bool if_exists= false);
/** Prepare to truncate an undo tablespace.
@param[in] space_id undo tablespace id
@@ -1383,18 +1349,6 @@ ulint
fil_space_get_id_by_name(
const char* tablespace);
-/**
-Iterate over all the spaces in the space list and fetch the
-tablespace names. It will return a copy of the name that must be
-freed by the caller using: delete[].
-@return DB_SUCCESS if all OK. */
-dberr_t
-fil_get_space_names(
-/*================*/
- space_name_list_t& space_name_list)
- /*!< in/out: Vector for collecting the names. */
- MY_ATTRIBUTE((warn_unused_result));
-
/** Generate redo log for swapping two .ibd files
@param[in] old_table old table
@param[in] new_table new table
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index a4e3b84b55e..a50be6f8998 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -407,42 +407,52 @@ fsp_header_inc_size(
ulint space_id, /*!< in: space id */
ulint size_inc, /*!< in: size increment in pages */
mtr_t* mtr); /*!< in/out: mini-transaction */
-/**********************************************************************//**
-Creates a new segment.
+
+/** Creates a new segment.
+@param[in] space space id
+@param[in] byte_offset byte offset of the created segment header
+ on the page
+@param[in,out] mtr mini-transaction
+@param[in,out] block block where segment header is placed;
+ If it is null then new page will be
+ allocated and it will belong to
+ the created segment
@return the block where the segment header is placed, x-latched, NULL
if could not create segment because of lack of space */
buf_block_t*
fseg_create(
-/*========*/
- ulint space_id,/*!< in: space id */
- ulint page, /*!< in: page where the segment header is placed: if
- this is != 0, the page must belong to another segment,
- if this is 0, a new page will be allocated and it
- will belong to the created segment */
- ulint byte_offset, /*!< in: byte offset of the created segment header
- on the page */
- mtr_t* mtr); /*!< in/out: mini-transaction */
-/**********************************************************************//**
-Creates a new segment.
+ ulint space,
+ ulint byte_offset,
+ mtr_t* mtr,
+ buf_block_t* block=NULL);
+
+/** Creates a new segment.
+@param[in] space_id space_id
+@param[in] byte_offset byte offset of the created segment
+ header on the page
+@param[in] has_done_reservation TRUE if the caller has already
+ done the reservation for the pages
+ with fsp_reserve_free_externts
+ (at least 2 extents: one for
+ the inode and the other for the
+ segment) then there is no need to do
+ the check for this individual
+ operation
+@param[in,out] mtr mini-transaction
+@param[in] block block where the segment header is
+ placed. If it is null then new page
+ will be allocated and it will belong
+ to the created segment
@return the block where the segment header is placed, x-latched, NULL
if could not create segment because of lack of space */
buf_block_t*
fseg_create_general(
-/*================*/
- ulint space_id,/*!< in: space id */
- ulint page, /*!< in: page where the segment header is placed: if
- this is != 0, the page must belong to another segment,
- if this is 0, a new page will be allocated and it
- will belong to the created segment */
- ulint byte_offset, /*!< in: byte offset of the created segment header
- on the page */
- ibool has_done_reservation, /*!< in: TRUE if the caller has already
- done the reservation for the pages with
- fsp_reserve_free_extents (at least 2 extents: one for
- the inode and the other for the segment) then there is
- no need to do the check for this individual
- operation */
- mtr_t* mtr); /*!< in/out: mini-transaction */
+ ulint space_id,
+ ulint byte_offset,
+ ibool has_done_reservation,
+ mtr_t* mtr,
+ buf_block_t* block);
+
/**********************************************************************//**
Calculates the number of pages reserved by a segment, and how many pages are
currently used.
@@ -568,22 +578,11 @@ fsp_get_available_space_in_free_extents(
/**********************************************************************//**
Frees a single page of a segment. */
void
-fseg_free_page_func(
+fseg_free_page(
fseg_header_t* seg_header, /*!< in: segment header */
ulint space_id, /*!< in: space id */
ulint page, /*!< in: page offset */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr); /*!< in/out: mini-transaction */
-#ifdef BTR_CUR_HASH_ADAPT
-# define fseg_free_page(header, space_id, page, ahi, mtr) \
- fseg_free_page_func(header, space_id, page, ahi, mtr)
-#else /* BTR_CUR_HASH_ADAPT */
-# define fseg_free_page(header, space_id, page, ahi, mtr) \
- fseg_free_page_func(header, space_id, page, mtr)
-#endif /* BTR_CUR_HASH_ADAPT */
/** Determine whether a page is free.
@param[in,out] space tablespace
@param[in] page page number
@@ -596,45 +595,25 @@ Frees part of a segment. This function can be used to free a segment
by repeatedly calling this function in different mini-transactions.
Doing the freeing in a single mini-transaction might result in
too big a mini-transaction.
-@return TRUE if freeing completed */
-ibool
-fseg_free_step_func(
+@return whether the freeing was completed */
+bool
+fseg_free_step(
fseg_header_t* header, /*!< in, own: segment header; NOTE: if the header
resides on the first page of the frag list
of the segment, this pointer becomes obsolete
after the last freeing step */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((warn_unused_result));
-#ifdef BTR_CUR_HASH_ADAPT
-# define fseg_free_step(header, ahi, mtr) fseg_free_step_func(header, ahi, mtr)
-#else /* BTR_CUR_HASH_ADAPT */
-# define fseg_free_step(header, ahi, mtr) fseg_free_step_func(header, mtr)
-#endif /* BTR_CUR_HASH_ADAPT */
/**********************************************************************//**
Frees part of a segment. Differs from fseg_free_step because this function
leaves the header page unfreed.
-@return TRUE if freeing completed, except the header page */
-ibool
-fseg_free_step_not_header_func(
+@return whether the freeing was completed, except for the header page */
+bool
+fseg_free_step_not_header(
fseg_header_t* header, /*!< in: segment header which must reside on
the first fragment page of the segment */
-#ifdef BTR_CUR_HASH_ADAPT
- bool ahi, /*!< in: whether we may need to drop
- the adaptive hash index */
-#endif /* BTR_CUR_HASH_ADAPT */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((warn_unused_result));
-#ifdef BTR_CUR_HASH_ADAPT
-# define fseg_free_step_not_header(header, ahi, mtr) \
- fseg_free_step_not_header_func(header, ahi, mtr)
-#else /* BTR_CUR_HASH_ADAPT */
-# define fseg_free_step_not_header(header, ahi, mtr) \
- fseg_free_step_not_header_func(header, mtr)
-#endif /* BTR_CUR_HASH_ADAPT */
/** Reset the page type.
Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE.
diff --git a/storage/innobase/include/fts0ast.h b/storage/innobase/include/fts0ast.h
index bad040fdcda..5799776c32d 100644
--- a/storage/innobase/include/fts0ast.h
+++ b/storage/innobase/include/fts0ast.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index e8a91b0ef55..84d8ccd26ef 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, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -317,19 +317,11 @@ public:
/** fts_t destructor. */
~fts_t();
- /** Mutex protecting bg_threads* and fts_add_wq. */
- ib_mutex_t bg_threads_mutex;
-
- /** Whether the ADDED table record sync-ed after
- crash recovery; protected by bg_threads_mutex */
+ /** Whether the ADDED table record sync-ed after crash recovery */
unsigned added_synced:1;
- /** Whether the table holds dict_sys->mutex;
- protected by bg_threads_mutex */
+ /** Whether the table holds dict_sys->mutex */
unsigned dict_locked:1;
- /** Number of background threads accessing this table. */
- ulint bg_threads;
-
/** Work queue for scheduling jobs for the FTS 'Add' thread, or NULL
if the thread has not yet been created. Each work item is a
fts_trx_doc_ids_t*. */
@@ -735,12 +727,9 @@ fts_savepoint_rollback_last_stmt(
/*=============================*/
trx_t* trx); /*!< in: transaction */
-/***********************************************************************//**
-Drop all orphaned FTS auxiliary tables, those that don't have a parent
+/** Drop all orphaned FTS auxiliary tables, those that don't have a parent
table or FTS index defined on them. */
-void
-fts_drop_orphaned_tables(void);
-/*==========================*/
+void fts_drop_orphaned_tables();
/** Run SYNC on the table, i.e., write out data from the cache to the
FTS auxiliary INDEX table and clear the cache at the end.
@@ -774,15 +763,6 @@ fts_init_doc_id(
/*============*/
const dict_table_t* table); /*!< in: table */
-/* Get parent table name if it's a fts aux table
-@param[in] aux_table_name aux table name
-@param[in] aux_table_len aux table length
-@return parent table name, or NULL */
-char*
-fts_get_parent_table_name(
- const char* aux_table_name,
- ulint aux_table_len);
-
/******************************************************************//**
compare two character string according to their charset. */
extern
@@ -877,20 +857,18 @@ fts_valid_stopword_table(
name */
/****************************************************************//**
This function loads specified stopword into FTS cache
-@return TRUE if success */
-ibool
+@return true if success */
+bool
fts_load_stopword(
/*==============*/
const dict_table_t*
table, /*!< in: Table with FTS */
trx_t* trx, /*!< in: Transaction */
- const char* global_stopword_table, /*!< in: Global stopword table
- name */
const char* session_stopword_table, /*!< in: Session stopword table
name */
- ibool stopword_is_on, /*!< in: Whether stopword
+ bool stopword_is_on, /*!< in: Whether stopword
option is turned on/off */
- ibool reload); /*!< in: Whether it is during
+ bool reload); /*!< in: Whether it is during
reload of FTS table */
/****************************************************************//**
@@ -985,4 +963,20 @@ fts_trx_t*
fts_trx_create(
trx_t* trx);
+/** Clear all fts resources when there is no internal DOC_ID
+and there are no new fts index to add.
+@param[in,out] table table where fts is to be freed
+@param[in] trx transaction to drop all fts tables */
+void fts_clear_all(dict_table_t *table, trx_t *trx);
+
+/** Check whether the given name is fts auxiliary table
+and fetch the parent table id and index id
+@param[in] name table name
+@param[in,out] table_id parent table id
+@param[in,out] index_id index id
+@return true if it is auxilary table */
+bool fts_check_aux_table(const char *name,
+ table_id_t *table_id,
+ index_id_t *index_id);
+
#endif /*!< fts0fts.h */
diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h
index dd724aa12d4..2b7f31dfe54 100644
--- a/storage/innobase/include/fts0priv.h
+++ b/storage/innobase/include/fts0priv.h
@@ -239,7 +239,7 @@ Do a binary search for a doc id in the array
int
fts_bsearch(
/*========*/
- fts_update_t* array, /*!< in: array to sort */
+ doc_id_t* array, /*!< in: array to sort */
int lower, /*!< in: lower bound of array*/
int upper, /*!< in: upper bound of array*/
doc_id_t doc_id) /*!< in: doc id to lookup */
@@ -462,11 +462,7 @@ int
fts_write_object_id(
/*================*/
ib_id_t id, /*!< in: a table/index id */
- char* str, /*!< in: buffer to write the id to */
- bool hex_format MY_ATTRIBUTE((unused)))
- /*!< in: true for fixed hex format,
- false for old ambiguous format */
- MY_ATTRIBUTE((nonnull));
+ char* str); /*!< in: buffer to write the id to */
/******************************************************************//**
Read the table id from the string generated by fts_write_object_id().
@return TRUE if parse successful */
diff --git a/storage/innobase/include/fts0priv.ic b/storage/innobase/include/fts0priv.ic
index ed737e520d6..da14cfcb013 100644
--- a/storage/innobase/include/fts0priv.ic
+++ b/storage/innobase/include/fts0priv.ic
@@ -32,10 +32,7 @@ int
fts_write_object_id(
/*================*/
ib_id_t id, /* in: a table/index id */
- char* str, /* in: buffer to write the id to */
- bool hex_format MY_ATTRIBUTE((unused)))
- /* in: true for fixed hex format,
- false for old ambiguous format */
+ char* str) /* in: buffer to write the id to */
{
#ifdef _WIN32
@@ -60,11 +57,6 @@ fts_write_object_id(
#endif /* _WIN32 */
- /* As above, but this is only for those tables failing to rename. */
- if (!hex_format) {
- return(sprintf(str, "%016llu", (ulonglong) id));
- }
-
return(sprintf(str, "%016llx", (ulonglong) id));
}
diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h
index a08a60b9e95..f5760a16c0e 100644
--- a/storage/innobase/include/fts0types.h
+++ b/storage/innobase/include/fts0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -80,20 +80,6 @@ struct fts_index_cache_t {
CHARSET_INFO* charset; /*!< charset */
};
-/** For supporting the tracking of updates on multiple FTS indexes we need
-to track which FTS indexes need to be updated. For INSERT and DELETE we
-update all fts indexes. */
-struct fts_update_t {
- doc_id_t doc_id; /*!< The doc id affected */
-
- ib_vector_t* fts_indexes; /*!< The FTS indexes that need to be
- updated. A NULL value means all
- indexes need to be updated. This
- vector is not allocated on the heap
- and so must be freed explicitly,
- when we are done with it */
-};
-
/** Stop word control infotmation. */
struct fts_stopword_t {
ulint status; /*!< Status of the stopword tree */
@@ -145,8 +131,6 @@ struct fts_cache_t {
intialization, it has different
SYNC level as above cache lock */
- ib_mutex_t optimize_lock; /*!< Lock for OPTIMIZE */
-
ib_mutex_t deleted_lock; /*!< Lock covering deleted_doc_ids */
ib_mutex_t doc_id_lock; /*!< Lock covering Doc ID */
@@ -319,10 +303,9 @@ fts_ranking_doc_id_cmp(
const void* p2); /*!< in: id2 */
/******************************************************************//**
-Compare two fts_update_t instances doc_ids. */
+Compare two doc_ids. */
UNIV_INLINE
-int
-fts_update_doc_id_cmp(
+int fts_doc_id_cmp(
/*==================*/
/*!< out:
< 0 if n1 < n2,
diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.ic
index e388d6257f6..cf5cf35c48e 100644
--- a/storage/innobase/include/fts0types.ic
+++ b/storage/innobase/include/fts0types.ic
@@ -79,19 +79,18 @@ fts_ranking_doc_id_cmp(
}
/******************************************************************//**
-Compare two fts_update_t doc_ids.
+Compare two doc_ids.
@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
UNIV_INLINE
-int
-fts_update_doc_id_cmp(
+int fts_doc_id_cmp(
/*==================*/
const void* p1, /*!< in: id1 */
const void* p2) /*!< in: id2 */
{
- const fts_update_t* up1 = (const fts_update_t*) p1;
- const fts_update_t* up2 = (const fts_update_t*) p2;
+ const doc_id_t* up1 = static_cast<const doc_id_t*>(p1);
+ const doc_id_t* up2 = static_cast<const doc_id_t*>(p2);
- return((int)(up1->doc_id - up2->doc_id));
+ return static_cast<int>(*up1 - *up2);
}
/******************************************************************//**
diff --git a/storage/innobase/include/gis0geo.h b/storage/innobase/include/gis0geo.h
index 3b71815d0fe..dea6d63f4e0 100644
--- a/storage/innobase/include/gis0geo.h
+++ b/storage/innobase/include/gis0geo.h
@@ -54,19 +54,6 @@ enum wkbByteOrder
wkbNDR = 1 /* Little Endian */
};
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len);
-
/*************************************************************//**
Calculate minimal bounding rectangle (mbr) of the spatial object
stored in "well-known binary representation" (wkb) format.
diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h
index e5942b71c64..5e812d10451 100644
--- a/storage/innobase/include/gis0rtree.h
+++ b/storage/innobase/include/gis0rtree.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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,6 +28,7 @@ Created 2013/03/27 Jimmy Yang and Allen Lai
#define gis0rtree_h
#include "btr0cur.h"
+#include "rem0types.h"
/* Whether MBR 'a' contains 'b' */
#define MBR_CONTAIN_CMP(a, b) \
@@ -90,7 +91,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
- ulint** offsets,/*!< out: offsets on inserted record */
+ rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@@ -152,7 +153,7 @@ rtr_rec_cal_increase(
dtuple in some of the common fields, or which
has an equal number or more fields than
dtuple */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
double* area); /*!< out: increased area */
/****************************************************************//**
@@ -165,22 +166,6 @@ rtr_ins_enlarge_mbr(
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr); /*!< in: mtr */
-/********************************************************************//**
-*/
-void
-rtr_get_father_node(
-/*================*/
- dict_index_t* index, /*!< in: index */
- ulint level, /*!< in: the tree level of search */
- const dtuple_t* tuple, /*!< in: data tuple; NOTE: n_fields_cmp in
- tuple must be set so that it cannot get
- compared to the node ptr page number field! */
- btr_cur_t* sea_cur,/*!< in: search cursor */
- btr_cur_t* cursor, /*!< in/out: tree cursor; the cursor page is
- s- or x-latched */
- ulint page_no,/*!< in: current page no */
- mtr_t* mtr); /*!< in: mtr */
-
/**************************************************************//**
push a nonleaf index node to the search path */
UNIV_INLINE
@@ -276,7 +261,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
- const ulint* offsets,/*!< in: offsets array */
+ const rec_offs* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr); /*!< out MBR */
/****************************************************************//**
@@ -308,10 +293,10 @@ rtr_page_get_father(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
-ulint*
+rec_offs*
rtr_page_get_father_block(
/*======================*/
- ulint* offsets,/*!< in: work area for the return value */
+ rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@@ -418,8 +403,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
- ulint* offsets, /*!< in: rec offsets */
- ulint* offsets2, /*!< in: rec offsets */
+ rec_offs* offsets, /*!< in: rec offsets */
+ rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the child page. */
buf_block_t* merge_block, /*!< in: page to merge */
buf_block_t* block, /*!< in: page be merged */
@@ -444,8 +429,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
- ulint* offsets, /*!< in: rec offsets */
- ulint* offsets2, /*!< in: rec offsets */
+ rec_offs* offsets, /*!< in: rec offsets */
+ rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr, /*!< out: MBR to update */
buf_block_t* merge_block, /*!< in: page to merge */
buf_block_t* block, /*!< in: page be merged */
@@ -459,7 +444,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/
- ulint* offsets, /*!< in: offsets on rec. */
+ rec_offs* offsets, /*!< in: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to
diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic
index b9ab2ea57e8..696aa1e2f5f 100644
--- a/storage/innobase/include/gis0rtree.ic
+++ b/storage/innobase/include/gis0rtree.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -40,7 +40,7 @@ rtr_page_cal_mbr(
rec_t* rec;
byte* field;
ulint len;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
double bmin, bmax;
double* amin;
double* amax;
@@ -132,13 +132,9 @@ rtr_get_new_ssn_id(
/*===============*/
dict_index_t* index) /*!< in/out: the index struct */
{
- node_seq_t ssn;
-
- mutex_enter(&(index->rtr_ssn.mutex));
- ssn = ++index->rtr_ssn.seq_no;
- mutex_exit(&(index->rtr_ssn.mutex));
-
- return(ssn);
+ node_seq_t ssn= my_atomic_add32_explicit(&index->rtr_ssn, 1,
+ MY_MEMORY_ORDER_RELAXED);
+ return ssn + 1;
}
/*****************************************************************//**
Get the current Split Sequence Number.
@@ -149,13 +145,7 @@ rtr_get_current_ssn_id(
/*===================*/
dict_index_t* index) /*!< in: index struct */
{
- node_seq_t ssn;
-
- mutex_enter(&(index->rtr_ssn.mutex));
- ssn = index->rtr_ssn.seq_no;
- mutex_exit(&(index->rtr_ssn.mutex));
-
- return(ssn);
+ return my_atomic_load32_explicit(&index->rtr_ssn, MY_MEMORY_ORDER_RELAXED);
}
/*********************************************************************//**
diff --git a/storage/innobase/include/gis0type.h b/storage/innobase/include/gis0type.h
index ee350ea56ce..c5ea817c6bf 100644
--- a/storage/innobase/include/gis0type.h
+++ b/storage/innobase/include/gis0type.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -143,12 +143,6 @@ typedef struct rtr_info_track {
rtr_active */
} rtr_info_track_t;
-/* Node Sequence Number and mutex protects it. */
-typedef struct rtree_ssn {
- ib_mutex_t mutex; /*!< mutex protect the seq num */
- node_seq_t seq_no; /*!< the SSN (node sequence number) */
-} rtr_ssn_t;
-
/* This is to record the record movement between pages. Used for corresponding
lock movement */
typedef struct rtr_rec_move {
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 693dcd15163..05dc3f57df7 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -244,13 +244,7 @@ int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
unsigned int buf_length);
#endif /* WITH_WSREP */
-/**********************************************************************//**
-Determines the connection character set.
-@return connection character set */
-CHARSET_INFO*
-innobase_get_charset(
-/*=================*/
- THD* thd); /*!< in: MySQL thread handle */
+extern "C" struct charset_info_st *thd_charset(THD *thd);
/** Determines the current SQL statement.
Thread unsafe, can only be called from the thread owning the THD.
@@ -262,19 +256,6 @@ innobase_get_stmt_unsafe(
THD* thd,
size_t* length);
-/** Determines the current SQL statement.
-Thread safe, can be called from any thread as the string is copied
-into the provided buffer.
-@param[in] thd MySQL thread handle
-@param[out] buf Buffer containing SQL statement
-@param[in] buflen Length of provided buffer
-@return Length of the SQL statement */
-size_t
-innobase_get_stmt_safe(
- THD* thd,
- char* buf,
- size_t buflen);
-
/******************************************************************//**
This function is used to find the storage length in bytes of the first n
characters for prefix indexes using a multibyte character set. The function
diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h
index 16616e3fc9c..35a04163f43 100644
--- a/storage/innobase/include/handler0alter.h
+++ b/storage/innobase/include/handler0alter.h
@@ -22,6 +22,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
Smart ALTER TABLE
*******************************************************/
+#include "rem0types.h"
+
/*************************************************************//**
Copies an InnoDB record to table->record[0]. */
void
@@ -30,7 +32,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets)/*!< in: rec_get_offsets(
+ const rec_offs* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
MY_ATTRIBUTE((nonnull));
diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h
index 5d317a23d4e..4f55b051d80 100644
--- a/storage/innobase/include/hash0hash.h
+++ b/storage/innobase/include/hash0hash.h
@@ -184,6 +184,18 @@ do {\
HASH_INVALIDATE(DATA, NAME);\
} while (0)
+#define HASH_REPLACE(TYPE, NAME, TABLE, FOLD, DATA_OLD, DATA_NEW) \
+ do { \
+ (DATA_NEW)->NAME = (DATA_OLD)->NAME; \
+ \
+ hash_cell_t& cell3333 \
+ = TABLE->array[hash_calc_hash(FOLD, TABLE)]; \
+ TYPE** struct3333 = (TYPE**)&cell3333.node; \
+ while (*struct3333 != DATA_OLD) { \
+ struct3333 = &((*struct3333)->NAME); \
+ } \
+ *struct3333 = DATA_NEW; \
+ } while (0)
/*******************************************************************//**
Gets the first struct in a hash chain, NULL if none. */
diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h
index e7f5ca2b44f..a7289777e00 100644
--- a/storage/innobase/include/ib0mutex.h
+++ b/storage/innobase/include/ib0mutex.h
@@ -225,7 +225,7 @@ struct TTASFutexMutex {
return;
}
- ut_delay(ut_rnd_interval(0, max_delay));
+ ut_delay(max_delay);
}
for (n_waits= 0;; n_waits++) {
@@ -362,7 +362,7 @@ struct TTASMutex {
uint32_t n_spins = 0;
while (!try_lock()) {
- ut_delay(ut_rnd_interval(0, max_delay));
+ ut_delay(max_delay);
if (++n_spins == max_spins) {
os_thread_yield();
max_spins+= step;
@@ -516,7 +516,7 @@ struct TTASEventMutex {
sync_array_wait_event(sync_arr, cell);
}
} else {
- ut_delay(ut_rnd_interval(0, max_delay));
+ ut_delay(max_delay);
}
}
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 8369db8b879..edde6bf516e 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -317,7 +317,7 @@ lock_clust_rec_modify_check_and_lock(
const rec_t* rec, /*!< in: record which should be
modified */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
@@ -355,7 +355,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: secondary index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@@ -383,7 +383,7 @@ lock_clust_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@@ -432,7 +432,7 @@ lock_clust_rec_cons_read_sees(
const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ReadView* view); /*!< in: consistent read view */
/*********************************************************************//**
Checks that a non-clustered index record is seen in a consistent read.
@@ -571,13 +571,14 @@ lock_has_to_wait(
locks are record locks */
/*********************************************************************//**
Reports that a transaction id is insensible, i.e., in the future. */
+ATTRIBUTE_COLD
void
lock_report_trx_id_insanity(
/*========================*/
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */
trx_id_t max_trx_id); /*!< in: trx_sys_get_max_trx_id() */
/*********************************************************************//**
Prints info of locks for all transactions.
@@ -803,7 +804,7 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets) /*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************************//**
Check if the transaction holds any locks on the sys tables
@@ -1045,10 +1046,6 @@ std::string
lock_get_info(
const lock_t*);
-/*******************************************************************//**
-@return whether wsrep_on is true on trx->mysql_thd*/
-#define wsrep_on_trx(trx) ((trx)->mysql_thd && wsrep_on((trx)->mysql_thd))
-
#endif /* WITH_WSREP */
#include "lock0lock.ic"
diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h
index 9b80f593e30..1a950ac1cfa 100644
--- a/storage/innobase/include/lock0priv.h
+++ b/storage/innobase/include/lock0priv.h
@@ -35,6 +35,7 @@ those functions in lock/ */
#endif
#include "hash0hash.h"
+#include "rem0types.h"
#include "trx0trx.h"
#ifndef UINT32_MAX
@@ -468,7 +469,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic
index 80a63271256..8bb145e41fc 100644
--- a/storage/innobase/include/lock0priv.ic
+++ b/storage/innobase/include/lock0priv.ic
@@ -59,7 +59,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 0fd983a1a10..612a27976e7 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -56,12 +56,6 @@ step which modifies the database, is started */
#define LOG_CHECKPOINT_FREE_PER_THREAD (4 * UNIV_PAGE_SIZE)
#define LOG_CHECKPOINT_EXTRA_FREE (8 * UNIV_PAGE_SIZE)
-typedef ulint (*log_checksum_func_t)(const byte* log_block);
-
-/** Pointer to the log checksum calculation function. Protected with
-log_sys->mutex. */
-extern log_checksum_func_t log_checksum_algorithm_ptr;
-
/** Append a string to the log.
@param[in] str string
@param[in] len string length
@@ -295,14 +289,6 @@ log_block_set_data_len(
/*===================*/
byte* log_block, /*!< in/out: log block */
ulint len); /*!< in: data length */
-/************************************************************//**
-Calculates the checksum for a log block.
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum(
-/*====================*/
- const byte* block); /*!< in: log block */
/** Calculates the checksum for a log block using the CRC32 algorithm.
@param[in] block log block
@@ -312,13 +298,6 @@ ulint
log_block_calc_checksum_crc32(
const byte* block);
-/** Calculates the checksum for a log block using the "no-op" algorithm.
-@param[in] block the redo log block
-@return the calculated checksum value */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_none(const byte* block);
-
/************************************************************//**
Gets a log block checksum field value.
@return checksum */
@@ -403,7 +382,7 @@ log_group_close_all(void);
void
log_shutdown();
-/** Whether to generate and require checksums on the redo log pages */
+/** Whether to require checksums on the redo log pages */
extern my_bool innodb_log_checksums;
/* Values used as flags */
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 36caaedfaa2..c366affcdef 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -190,18 +190,6 @@ log_block_convert_lsn_to_no(
0xFUL, 0x3FFFFFFFUL)) + 1);
}
-/************************************************************//**
-Calculates the checksum for a log block.
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum(
-/*====================*/
- const byte* block) /*!< in: log block */
-{
- return(log_checksum_algorithm_ptr(block));
-}
-
/** Calculate the checksum for a log block using the pre-5.7.9 algorithm.
@param[in] block log block
@return checksum */
@@ -242,17 +230,6 @@ log_block_calc_checksum_crc32(
return(ut_crc32(block, OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE));
}
-/** Calculates the checksum for a log block using the "no-op" algorithm.
-@param[in] block log block
-@return checksum */
-UNIV_INLINE
-ulint
-log_block_calc_checksum_none(
- const byte* block)
-{
- return(LOG_NO_CHECKSUM_MAGIC);
-}
-
/************************************************************//**
Gets a log block checksum field value.
@return checksum */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 74aa4fcb517..6425e3c6c37 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -133,14 +133,19 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn);
/** Parse log records from a buffer and optionally store them to a
hash table to wait merging to file pages.
-@param[in] checkpoint_lsn the LSN of the latest checkpoint
-@param[in] store whether to store page operations
-@param[in] apply whether to apply the records
+@param[in] checkpoint_lsn the LSN of the latest checkpoint
+@param[in] store whether to store page operations
+@param[in] available_memory memory to read the redo logs
+@param[in] apply whether to apply the records
@return whether MLOG_CHECKPOINT record was seen the first time,
or corruption was noticed */
-bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply);
+bool recv_parse_log_recs(
+ lsn_t checkpoint_lsn,
+ store_t* store,
+ ulint available_memory,
+ bool apply);
-/** Moves the parsing buffer data left to the buffer start. */
+/** Moves the parsing buffer data left to the buffer start */
void recv_sys_justify_left_parsing_buf();
/** Report optimized DDL operation (without redo log),
@@ -190,23 +195,35 @@ struct recv_t{
rec_list;/*!< list of log records for this page */
};
-struct recv_dblwr_t {
- /** Add a page frame to the doublewrite recovery buffer. */
- void add(byte* page) {
- pages.push_back(page);
- }
-
- /** Find a doublewrite copy of a page.
- @param[in] space_id tablespace identifier
- @param[in] page_no page number
- @return page frame
- @retval NULL if no page was found */
- const byte* find_page(ulint space_id, ulint page_no);
-
- typedef std::list<byte*, ut_allocator<byte*> > list;
-
- /** Recovered doublewrite buffer page frames */
- list pages;
+struct recv_dblwr_t
+{
+ /** Add a page frame to the doublewrite recovery buffer. */
+ void add(byte *page) { pages.push_back(page); }
+
+ /** Validate the page.
+ @param page_id page identifier
+ @param page page contents
+ @param space the tablespace of the page (not available for page 0)
+ @param tmp_buf 2*srv_page_size for decrypting and decompressing any
+ page_compressed or encrypted pages
+ @return whether the page is valid */
+ bool validate_page(const page_id_t page_id, const byte *page,
+ const fil_space_t *space, byte *tmp_buf);
+
+ /** Find a doublewrite copy of a page.
+ @param page_id page identifier
+ @param space tablespace (not available for page_id.page_no()==0)
+ @param tmp_buf 2*srv_page_size for decrypting and decompressing any
+ page_compressed or encrypted pages
+ @return page frame
+ @retval NULL if no valid page for page_id was found */
+ byte* find_page(const page_id_t page_id, const fil_space_t *space= NULL,
+ byte *tmp_buf= NULL);
+
+ typedef std::list<byte*, ut_allocator<byte*> > list;
+
+ /** Recovered doublewrite buffer page frames */
+ list pages;
};
/** Recovery system data structure */
@@ -337,10 +354,22 @@ times! */
roll-forward */
#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
-/** This many frames must be left free in the buffer pool when we scan
-the log and store the scanned log records in the buffer pool: we will
-use these free frames to read in pages when we start applying the
-log records to the database. */
-extern ulint recv_n_pool_free_frames;
+/** This is a low level function for the recovery system
+to create a page which has buffered intialized redo log records.
+@param[in] page_id page to be created using redo logs
+@return whether the page creation successfully */
+buf_block_t* recv_recovery_create_page_low(const page_id_t page_id);
+
+/** Recovery system creates a page which has buffered intialized
+redo log records.
+@param[in] page_id page to be created using redo logs
+@return block which contains page was initialized */
+inline buf_block_t* recv_recovery_create_page(const page_id_t page_id)
+{
+ if (UNIV_LIKELY(!recv_recovery_on))
+ return NULL;
+
+ return recv_recovery_create_page_low(page_id);
+}
#endif
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 22c0a04e170..0cd15ebb261 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -287,13 +287,6 @@ mem_heap_printf(
const char* format, /*!< in: format string */
...) MY_ATTRIBUTE ((format (printf, 2, 3)));
-/** Checks that an object is a memory heap (or a block of it)
-@param[in] heap Memory heap to check */
-UNIV_INLINE
-void
-mem_block_validate(
- const mem_heap_t* heap);
-
#ifdef UNIV_DEBUG
/** Validates the contents of a memory heap.
Asserts that the memory heap is consistent
@@ -308,7 +301,6 @@ mem_heap_validate(
/** The info structure stored at the beginning of a heap block */
struct mem_block_info_t {
- ulint magic_n;/* magic number for debugging */
#ifdef UNIV_DEBUG
char file_name[8];/* file name where the mem heap was created */
unsigned line; /*!< line number where the mem heap was created */
@@ -343,9 +335,6 @@ struct mem_block_info_t {
otherwise, this is NULL */
};
-#define MEM_BLOCK_MAGIC_N 764741555
-#define MEM_FREED_BLOCK_MAGIC_N 547711122
-
/* Header size for a memory heap block */
#define MEM_BLOCK_HEADER_SIZE UT_CALC_ALIGN(sizeof(mem_block_info_t),\
UNIV_MEM_ALIGNMENT)
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index a44f2ff45fa..bd0db9bf503 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -144,16 +144,6 @@ mem_block_get_start(mem_block_t* block)
return(block->start);
}
-/** Checks that an object is a memory heap block
-@param[in] block Memory block to check. */
-UNIV_INLINE
-void
-mem_block_validate(
- const mem_block_t* block)
-{
- ut_a(block->magic_n == MEM_BLOCK_MAGIC_N);
-}
-
/** Allocates and zero-fills n bytes of memory from a memory heap.
@param[in] heap memory heap
@param[in] n number of bytes; if the heap is allowed to grow into
@@ -186,8 +176,6 @@ mem_heap_alloc(
byte* buf;
ulint free;
- ut_d(mem_block_validate(heap));
-
block = UT_LIST_GET_LAST(heap->base);
n += REDZONE_SIZE;
@@ -215,7 +203,7 @@ mem_heap_alloc(
mem_block_set_free(block, free + MEM_SPACE_NEEDED(n));
buf = buf + REDZONE_SIZE;
- UNIV_MEM_ALLOC(buf, n - REDZONE_SIZE);
+ MEM_UNDEFINED(buf, n - REDZONE_SIZE);
return(buf);
}
@@ -230,8 +218,6 @@ mem_heap_get_heap_top(
mem_block_t* block;
byte* buf;
- ut_d(mem_block_validate(heap));
-
block = UT_LIST_GET_LAST(heap->base);
buf = (byte*) block + mem_block_get_free(block);
@@ -281,7 +267,7 @@ mem_heap_free_heap_top(
mem_block_set_free(block, old_top - (byte*) block);
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
- UNIV_MEM_FREE(old_top, (byte*) block + block->len - old_top);
+ MEM_NOACCESS(old_top, (byte*) block + block->len - old_top);
/* If free == start, we may free the block if it is not the first
one */
@@ -321,8 +307,6 @@ mem_heap_get_top(
mem_block_t* block;
byte* buf;
- ut_d(mem_block_validate(heap));
-
block = UT_LIST_GET_LAST(heap->base);
buf = (byte*) block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n);
@@ -342,8 +326,6 @@ mem_heap_free_top(
{
mem_block_t* block;
- ut_d(mem_block_validate(heap));
-
n += REDZONE_SIZE;
block = UT_LIST_GET_LAST(heap->base);
@@ -359,7 +341,7 @@ mem_heap_free_top(
== mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
} else {
- UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n);
+ MEM_NOACCESS((byte*) block + mem_block_get_free(block), n);
}
}
@@ -419,8 +401,6 @@ mem_heap_free(
mem_block_t* block;
mem_block_t* prev_block;
- ut_d(mem_block_validate(heap));
-
block = UT_LIST_GET_LAST(heap->base);
if (heap->free_block) {
@@ -447,11 +427,7 @@ mem_heap_get_size(
/*==============*/
mem_heap_t* heap) /*!< in: heap */
{
- ulint size = 0;
-
- ut_d(mem_block_validate(heap));
-
- size = heap->total_size;
+ ulint size = heap->total_size;
if (heap->free_block) {
size += UNIV_PAGE_SIZE;
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 30d2e937f1f..5270cd671db 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -302,6 +302,12 @@ struct mtr_t {
const char* file,
unsigned line);
+ /** Exclusively aqcuire a tablespace latch.
+ @param space tablespace
+ @param file source code file name of the caller
+ @param line source code line number */
+ void x_lock_space(fil_space_t *space, const char *file, unsigned line);
+
/** Release an object in the memo stack.
@param object object
@param type object type: MTR_MEMO_S_LOCK, ...
@@ -428,6 +434,10 @@ struct mtr_t {
static inline bool is_block_dirtied(const buf_block_t* block)
MY_ATTRIBUTE((warn_unused_result));
+ /** Get the buffer fix count for the block added by this mtr.
+ @param[in] block block to be checked
+ @return number of buffer count added by this mtr */
+ int32_t get_fix_count(buf_block_t *block);
private:
/** Look up the system tablespace. */
void lookup_sys_space();
diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic
index 7175ede0d6a..a45d088d5d7 100644
--- a/storage/innobase/include/mtr0mtr.ic
+++ b/storage/innobase/include/mtr0mtr.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -48,7 +48,7 @@ mtr_t::memo_push(void* object, mtr_memo_type_t type)
ut_ad(is_active());
ut_ad(object != NULL);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
- ut_ad(type <= MTR_MEMO_SX_LOCK);
+ ut_ad(type <= MTR_MEMO_SPACE_X_LOCK);
ut_ad(ut_is_2pow(type));
/* If this mtr has x-fixed a clean page then we set
@@ -170,10 +170,10 @@ mtr_t::release_block_at_savepoint(
ut_a(slot->object == block);
- buf_block_unfix(reinterpret_cast<buf_block_t*>(block));
-
buf_page_release_latch(block, slot->type);
+ buf_block_unfix(reinterpret_cast<buf_block_t*>(block));
+
slot->object = NULL;
}
diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h
index 985ad7b81ea..2d4cd7b97ac 100644
--- a/storage/innobase/include/mtr0types.h
+++ b/storage/innobase/include/mtr0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -263,7 +263,10 @@ enum mtr_memo_type_t {
MTR_MEMO_X_LOCK = RW_X_LATCH << 5,
- MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5
+ MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5,
+
+ /** acquire X-latch on fil_space_t::latch */
+ MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1
};
#endif /* !UNIV_CHECKSUM */
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index e85bf74201a..82d1551de6c 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -161,6 +161,7 @@ static const ulint OS_FILE_NORMAL = 62;
static const ulint OS_DATA_FILE = 100;
static const ulint OS_LOG_FILE = 101;
static const ulint OS_DATA_TEMP_FILE = 102;
+static const ulint OS_DATA_FILE_NO_O_DIRECT = 103;
/* @} */
/** Error codes from os_file_get_last_error @{ */
diff --git a/storage/innobase/include/os0once.h b/storage/innobase/include/os0once.h
deleted file mode 100644
index ad72370eefa..00000000000
--- a/storage/innobase/include/os0once.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2014, Oracle and/or its affiliates. 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 Street, Fifth Floor, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/os0once.h
-A class that aids executing a given function exactly once in a multi-threaded
-environment.
-
-Created Feb 20, 2014 Vasil Dimov
-*******************************************************/
-
-#ifndef os0once_h
-#define os0once_h
-
-#include "univ.i"
-#include "ut0ut.h"
-
-/** Execute a given function exactly once in a multi-threaded environment
-or wait for the function to be executed by another thread.
-
-Example usage:
-First the user must create a control variable of type os_once::state_t and
-assign it os_once::NEVER_DONE.
-Then the user must pass this variable, together with a function to be
-executed to os_once::do_or_wait_for_done().
-
-Multiple threads can call os_once::do_or_wait_for_done() simultaneously with
-the same (os_once::state_t) control variable. The provided function will be
-called exactly once and when os_once::do_or_wait_for_done() returns then this
-function has completed execution, by this or another thread. In other words
-os_once::do_or_wait_for_done() will either execute the provided function or
-will wait for its execution to complete if it is already called by another
-thread or will do nothing if the function has already completed its execution
-earlier.
-
-This mimics pthread_once(3), but unfortunatelly pthread_once(3) does not
-support passing arguments to the init_routine() function. We should use
-std::call_once() when we start compiling with C++11 enabled. */
-class os_once {
-public:
- /** Control variables' state type */
- typedef ib_uint32_t state_t;
-
- /** Not yet executed. */
- static const state_t NEVER_DONE = 0;
-
- /** Currently being executed by this or another thread. */
- static const state_t IN_PROGRESS = 1;
-
- /** Finished execution. */
- static const state_t DONE = 2;
-
- /** Call a given function or wait its execution to complete if it is
- already called by another thread.
- @param[in,out] state control variable
- @param[in] do_func function to call
- @param[in,out] do_func_arg an argument to pass to do_func(). */
- static
- void
- do_or_wait_for_done(
- volatile state_t* state,
- void (*do_func)(void*),
- void* do_func_arg)
- {
- int32 oldval = NEVER_DONE;
-
- /* Avoid calling my_atomic_cas32() in the most common case. */
- if (*state == DONE) {
- return;
- }
-
- if (my_atomic_cas32((int32*) state, &oldval, IN_PROGRESS)) {
- /* We are the first. Call the function. */
-
- do_func(do_func_arg);
-
- my_atomic_store32((int32*) state, DONE);
- } else {
- /* The state is not NEVER_DONE, so either it is
- IN_PROGRESS (somebody is calling the function right
- now or DONE (it has already been called and completed).
- Wait for it to become DONE. */
- for (;;) {
- const state_t s = *state;
-
- switch (s) {
- case DONE:
- return;
- case IN_PROGRESS:
- break;
- case NEVER_DONE:
- /* fall through */
- default:
- ut_error;
- }
-
- UT_RELAX_CPU();
- }
- }
- }
-};
-
-#endif /* os0once_h */
diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h
index 18cc058ca6d..817902b6404 100644
--- a/storage/innobase/include/page0cur.h
+++ b/storage/innobase/include/page0cur.h
@@ -29,6 +29,7 @@ Created 10/4/1994 Heikki Tuuri
#include "buf0types.h"
#include "page0page.h"
+#include "rem0types.h"
#include "rem0rec.h"
#include "data0data.h"
#include "mtr0mtr.h"
@@ -151,7 +152,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr, /*!< in: mini-transaction handle, or NULL */
@@ -178,7 +179,7 @@ page_cur_rec_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const rec_t* rec, /*!< in: record to insert */
dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr); /*!< in: mini-transaction handle, or NULL */
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
@@ -192,7 +193,7 @@ page_cur_insert_rec_low(
which the new record is inserted */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
@@ -214,7 +215,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
/*************************************************************//**
@@ -240,7 +241,7 @@ page_cur_delete_rec(
/*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */
- const ulint* offsets,/*!< in: rec_get_offsets(
+ const rec_offs* offsets,/*!< in: rec_get_offsets(
cursor->rec, index) */
mtr_t* mtr); /*!< in: mini-transaction handle */
@@ -388,14 +389,14 @@ page_delete_rec(
page_cur_t* pcur, /*!< in/out: page cursor on record
to delete */
page_zip_des_t* page_zip,/*!< in: compressed page descriptor */
- const ulint* offsets);/*!< in: offsets for record */
+ const rec_offs* offsets);/*!< in: offsets for record */
/** Index page cursor */
struct page_cur_t{
const dict_index_t* index;
rec_t* rec; /*!< pointer to a record on page */
- ulint* offsets;
+ rec_offs* offsets;
buf_block_t* block; /*!< pointer to the block containing rec */
};
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 7c5737613c4..e57d3f9dee1 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -259,7 +259,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
- ulint** offsets,/*!< out: offsets on *rec */
+ rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr, /*!< in: mini-transaction handle, or NULL */
@@ -315,7 +315,7 @@ page_cur_rec_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const rec_t* rec, /*!< in: record to insert */
dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
if (buf_block_get_page_zip(cursor->block)) {
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 2e3bae2d7ff..a569912b82b 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2013, 2020, 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
@@ -32,6 +32,7 @@ Created 2/2/1994 Heikki Tuuri
#include "buf0buf.h"
#include "data0data.h"
#include "dict0dict.h"
+#include "rem0types.h"
#include "rem0rec.h"
#endif /* !UNIV_INNOCHECKSUM*/
#include "fsp0fsp.h"
@@ -813,6 +814,22 @@ page_rec_is_last(
MY_ATTRIBUTE((warn_unused_result));
/************************************************************//**
+true if distance between the records (measured in number of times we have to
+move to the next record) is at most the specified value
+@param[in] left_rec lefter record
+@param[in] right_rec righter record
+@param[in] val specified value to compare
+@return true if the distance is smaller than the value */
+UNIV_INLINE
+bool
+page_rec_distance_is_at_most(
+/*=========================*/
+ const rec_t* left_rec,
+ const rec_t* right_rec,
+ ulint val)
+ MY_ATTRIBUTE((warn_unused_result));
+
+/************************************************************//**
true if the record is the second last user record on a page.
@return true if the second last user record */
UNIV_INLINE
@@ -894,20 +911,6 @@ page_mem_alloc_free(
free record list */
ulint need); /*!< in: number of bytes allocated */
/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no);/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-/************************************************************//**
Puts a record to free list. */
UNIV_INLINE
void
@@ -919,7 +922,7 @@ page_mem_free(
rec_t* rec, /*!< in: pointer to the (origin of)
record */
const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets);/*!< in: array returned by
+ const rec_offs* offsets);/*!< in: array returned by
rec_get_offsets() */
/**********************************************************//**
Create an uncompressed B-tree index page.
@@ -1140,7 +1143,7 @@ void
page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets);/*!< in: record descriptor */
+ const rec_offs* offsets);/*!< in: record descriptor */
# ifdef UNIV_BTR_PRINT
/***************************************************************//**
This is used to print the contents of the directory for
@@ -1187,7 +1190,7 @@ ibool
page_rec_validate(
/*==============*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */
#ifdef UNIV_DEBUG
/***************************************************************//**
Checks that the first directory slot points to the infimum record and
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 6c12c43b237..5f69925a41a 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2016, 2020, 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
@@ -173,9 +173,6 @@ page_header_set_field(
{
ut_ad(page);
ut_ad(field <= PAGE_N_RECS);
-#if 0 /* FIXME: MDEV-19344 hits this */
- ut_ad(field != PAGE_N_RECS || val);
-#endif
ut_ad(field == PAGE_N_HEAP || val < srv_page_size);
ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size);
@@ -359,6 +356,26 @@ page_rec_is_last(
}
/************************************************************//**
+true if distance between the records (measured in number of times we have to
+move to the next record) is at most the specified value */
+UNIV_INLINE
+bool
+page_rec_distance_is_at_most(
+/*=========================*/
+ const rec_t* left_rec,
+ const rec_t* right_rec,
+ ulint val)
+{
+ for (ulint i = 0; i <= val; i++) {
+ if (left_rec == right_rec) {
+ return (true);
+ }
+ left_rec = page_rec_get_next_const(left_rec);
+ }
+ return (false);
+}
+
+/************************************************************//**
true if the record is the second last user record on a page.
@return true if the second last user record */
UNIV_INLINE
@@ -660,6 +677,7 @@ page_rec_get_next_low(
}
ut_ad(page_rec_is_infimum(rec)
+ || (!page_is_leaf(page) && !page_has_prev(page))
|| !(rec_get_info_bits(page + offs, comp)
& REC_INFO_MIN_REC_FLAG));
@@ -1004,7 +1022,7 @@ page_mem_free(
rec_t* rec, /*!< in: pointer to the
(origin of) record */
const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets) /*!< in: array returned by
+ const rec_offs* offsets) /*!< in: array returned by
rec_get_offsets() */
{
rec_t* free;
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h
index eb11db7781d..74fcfb106ea 100644
--- a/storage/innobase/include/page0size.h
+++ b/storage/innobase/include/page0size.h
@@ -34,7 +34,7 @@ Created Nov 14, 2013 Vasil Dimov
/** 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(). */
-extern const byte field_ref_zero[FIELD_REF_SIZE];
+extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX];
#define PAGE_SIZE_T_SIZE_BITS 17
diff --git a/storage/innobase/include/page0types.h b/storage/innobase/include/page0types.h
index 02d0cf29ec5..0fcaebd0e43 100644
--- a/storage/innobase/include/page0types.h
+++ b/storage/innobase/include/page0types.h
@@ -28,6 +28,7 @@ Created 2/2/1994 Heikki Tuuri
#include "dict0types.h"
#include "mtr0types.h"
+#include "rem0types.h"
#include <map>
@@ -184,7 +185,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets,/*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of the free list */
MY_ATTRIBUTE((nonnull(1,2,3,4)));
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index b4d4f0e980b..f411fd0eee9 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -2,7 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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,6 +47,7 @@ Created June 2005 by Marko Makela
#endif /* !UNIV_INNOCHECKSUM */
#include "buf0types.h"
+#include "rem0types.h"
#ifndef UNIV_INNOCHECKSUM
#include "dict0types.h"
@@ -287,7 +288,7 @@ page_zip_write_rec(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: the index the record belongs to */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint create) /*!< in: nonzero=insert, zero=update */
MY_ATTRIBUTE((nonnull));
@@ -312,7 +313,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being
written */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint n, /*!< in: column index */
mtr_t* mtr); /*!< in: mini-transaction handle,
or NULL if no logging is needed */
@@ -346,7 +347,7 @@ page_zip_write_trx_id_and_roll_ptr(
/*===============================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page */
byte* rec, /*!< in/out: record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint trx_id_col,/*!< in: column number of TRX_ID in rec */
trx_id_t trx_id, /*!< in: transaction identifier */
roll_ptr_t roll_ptr)/*!< in: roll_ptr */
@@ -394,7 +395,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of
the free list */
MY_ATTRIBUTE((nonnull(1,2,3,4)));
@@ -502,15 +503,11 @@ page_zip_calc_checksum(
#endif
);
-/**********************************************************************//**
-Verify a compressed page's checksum.
-@return TRUE if the stored checksum is valid according to the value of
-innodb_checksum_algorithm */
-ibool
-page_zip_verify_checksum(
-/*=====================*/
- const void* data, /*!< in: compressed page */
- ulint size); /*!< in: size of compressed page */
+/** Validate the checksum on a ROW_FORMAT=COMPRESSED page.
+@param data ROW_FORMAT=COMPRESSED page
+@param size size of the page, in bytes
+@return whether the stored checksum matches innodb_checksum_algorithm */
+bool page_zip_verify_checksum(const byte *data, size_t size);
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 5345aa19dd5..5a3b500e2c8 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -231,7 +231,7 @@ page_zip_get_trailer_len(
ulint uncompressed_size;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (!page_is_leaf(page_zip->data)) {
uncompressed_size = PAGE_ZIP_DIR_SLOT_SIZE
@@ -356,7 +356,7 @@ page_zip_write_header(
ulint pos;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
pos = page_offset(str);
diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h
index 90a7468bc9a..58d424abfdc 100644
--- a/storage/innobase/include/pars0grm.h
+++ b/storage/innobase/include/pars0grm.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.4.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ 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
@@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
#ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED
# define YY_YY_PARS0GRM_TAB_H_INCLUDED
/* Debug traces. */
@@ -58,91 +62,71 @@ extern int yydebug;
PARS_NE_TOKEN = 268,
PARS_PROCEDURE_TOKEN = 269,
PARS_IN_TOKEN = 270,
- PARS_OUT_TOKEN = 271,
- PARS_BINARY_TOKEN = 272,
- PARS_BLOB_TOKEN = 273,
- PARS_INT_TOKEN = 274,
- PARS_FLOAT_TOKEN = 275,
- PARS_CHAR_TOKEN = 276,
- PARS_IS_TOKEN = 277,
- PARS_BEGIN_TOKEN = 278,
- PARS_END_TOKEN = 279,
- PARS_IF_TOKEN = 280,
- PARS_THEN_TOKEN = 281,
- PARS_ELSE_TOKEN = 282,
- PARS_ELSIF_TOKEN = 283,
- PARS_LOOP_TOKEN = 284,
- PARS_WHILE_TOKEN = 285,
- PARS_RETURN_TOKEN = 286,
- PARS_SELECT_TOKEN = 287,
- PARS_SUM_TOKEN = 288,
- PARS_COUNT_TOKEN = 289,
- PARS_DISTINCT_TOKEN = 290,
- PARS_FROM_TOKEN = 291,
- PARS_WHERE_TOKEN = 292,
- PARS_FOR_TOKEN = 293,
- PARS_DDOT_TOKEN = 294,
- PARS_READ_TOKEN = 295,
- PARS_ORDER_TOKEN = 296,
- PARS_BY_TOKEN = 297,
- PARS_ASC_TOKEN = 298,
- PARS_DESC_TOKEN = 299,
- PARS_INSERT_TOKEN = 300,
- PARS_INTO_TOKEN = 301,
- PARS_VALUES_TOKEN = 302,
- PARS_UPDATE_TOKEN = 303,
- PARS_SET_TOKEN = 304,
- PARS_DELETE_TOKEN = 305,
- PARS_CURRENT_TOKEN = 306,
- PARS_OF_TOKEN = 307,
- PARS_CREATE_TOKEN = 308,
- PARS_TABLE_TOKEN = 309,
- PARS_INDEX_TOKEN = 310,
- PARS_UNIQUE_TOKEN = 311,
- PARS_CLUSTERED_TOKEN = 312,
- PARS_ON_TOKEN = 313,
- PARS_ASSIGN_TOKEN = 314,
- PARS_DECLARE_TOKEN = 315,
- PARS_CURSOR_TOKEN = 316,
- PARS_SQL_TOKEN = 317,
- PARS_OPEN_TOKEN = 318,
- PARS_FETCH_TOKEN = 319,
- PARS_CLOSE_TOKEN = 320,
- PARS_NOTFOUND_TOKEN = 321,
- PARS_TO_CHAR_TOKEN = 322,
- PARS_TO_NUMBER_TOKEN = 323,
- PARS_TO_BINARY_TOKEN = 324,
- PARS_BINARY_TO_NUMBER_TOKEN = 325,
- PARS_SUBSTR_TOKEN = 326,
- PARS_REPLSTR_TOKEN = 327,
- PARS_CONCAT_TOKEN = 328,
- PARS_INSTR_TOKEN = 329,
- PARS_LENGTH_TOKEN = 330,
- PARS_SYSDATE_TOKEN = 331,
- PARS_PRINTF_TOKEN = 332,
- PARS_ASSERT_TOKEN = 333,
- PARS_RND_TOKEN = 334,
- PARS_RND_STR_TOKEN = 335,
- PARS_ROW_PRINTF_TOKEN = 336,
- PARS_COMMIT_TOKEN = 337,
- PARS_ROLLBACK_TOKEN = 338,
- PARS_WORK_TOKEN = 339,
- PARS_UNSIGNED_TOKEN = 340,
- PARS_EXIT_TOKEN = 341,
- PARS_FUNCTION_TOKEN = 342,
- PARS_LOCK_TOKEN = 343,
- PARS_SHARE_TOKEN = 344,
- PARS_MODE_TOKEN = 345,
- PARS_LIKE_TOKEN = 346,
- PARS_LIKE_TOKEN_EXACT = 347,
- PARS_LIKE_TOKEN_PREFIX = 348,
- PARS_LIKE_TOKEN_SUFFIX = 349,
- PARS_LIKE_TOKEN_SUBSTR = 350,
- PARS_TABLE_NAME_TOKEN = 351,
- PARS_COMPACT_TOKEN = 352,
- PARS_BLOCK_SIZE_TOKEN = 353,
- PARS_BIGINT_TOKEN = 354,
- NEG = 355
+ PARS_INT_TOKEN = 271,
+ PARS_CHAR_TOKEN = 272,
+ PARS_IS_TOKEN = 273,
+ PARS_BEGIN_TOKEN = 274,
+ PARS_END_TOKEN = 275,
+ PARS_IF_TOKEN = 276,
+ PARS_THEN_TOKEN = 277,
+ PARS_ELSE_TOKEN = 278,
+ PARS_ELSIF_TOKEN = 279,
+ PARS_LOOP_TOKEN = 280,
+ PARS_WHILE_TOKEN = 281,
+ PARS_RETURN_TOKEN = 282,
+ PARS_SELECT_TOKEN = 283,
+ PARS_COUNT_TOKEN = 284,
+ PARS_FROM_TOKEN = 285,
+ PARS_WHERE_TOKEN = 286,
+ PARS_FOR_TOKEN = 287,
+ PARS_DDOT_TOKEN = 288,
+ PARS_ORDER_TOKEN = 289,
+ PARS_BY_TOKEN = 290,
+ PARS_ASC_TOKEN = 291,
+ PARS_DESC_TOKEN = 292,
+ PARS_INSERT_TOKEN = 293,
+ PARS_INTO_TOKEN = 294,
+ PARS_VALUES_TOKEN = 295,
+ PARS_UPDATE_TOKEN = 296,
+ PARS_SET_TOKEN = 297,
+ PARS_DELETE_TOKEN = 298,
+ PARS_CURRENT_TOKEN = 299,
+ PARS_OF_TOKEN = 300,
+ PARS_CREATE_TOKEN = 301,
+ PARS_TABLE_TOKEN = 302,
+ PARS_INDEX_TOKEN = 303,
+ PARS_UNIQUE_TOKEN = 304,
+ PARS_CLUSTERED_TOKEN = 305,
+ PARS_ON_TOKEN = 306,
+ PARS_ASSIGN_TOKEN = 307,
+ PARS_DECLARE_TOKEN = 308,
+ PARS_CURSOR_TOKEN = 309,
+ PARS_SQL_TOKEN = 310,
+ PARS_OPEN_TOKEN = 311,
+ PARS_FETCH_TOKEN = 312,
+ PARS_CLOSE_TOKEN = 313,
+ PARS_NOTFOUND_TOKEN = 314,
+ PARS_TO_BINARY_TOKEN = 315,
+ PARS_SUBSTR_TOKEN = 316,
+ PARS_CONCAT_TOKEN = 317,
+ PARS_INSTR_TOKEN = 318,
+ PARS_LENGTH_TOKEN = 319,
+ PARS_COMMIT_TOKEN = 320,
+ PARS_ROLLBACK_TOKEN = 321,
+ PARS_WORK_TOKEN = 322,
+ PARS_EXIT_TOKEN = 323,
+ PARS_FUNCTION_TOKEN = 324,
+ PARS_LOCK_TOKEN = 325,
+ PARS_SHARE_TOKEN = 326,
+ PARS_MODE_TOKEN = 327,
+ PARS_LIKE_TOKEN = 328,
+ PARS_LIKE_TOKEN_EXACT = 329,
+ PARS_LIKE_TOKEN_PREFIX = 330,
+ PARS_LIKE_TOKEN_SUFFIX = 331,
+ PARS_LIKE_TOKEN_SUBSTR = 332,
+ PARS_TABLE_NAME_TOKEN = 333,
+ PARS_BIGINT_TOKEN = 334,
+ NEG = 335
};
#endif
diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h
index f74d3700eca..f54c50e5b85 100644
--- a/storage/innobase/include/pars0pars.h
+++ b/storage/innobase/include/pars0pars.h
@@ -48,29 +48,15 @@ extern int yydebug;
NOT re-entrant */
extern sym_tab_t* pars_sym_tab_global;
-extern pars_res_word_t pars_to_char_token;
-extern pars_res_word_t pars_to_number_token;
extern pars_res_word_t pars_to_binary_token;
-extern pars_res_word_t pars_binary_to_number_token;
extern pars_res_word_t pars_substr_token;
-extern pars_res_word_t pars_replstr_token;
extern pars_res_word_t pars_concat_token;
extern pars_res_word_t pars_length_token;
extern pars_res_word_t pars_instr_token;
-extern pars_res_word_t pars_sysdate_token;
-extern pars_res_word_t pars_printf_token;
-extern pars_res_word_t pars_assert_token;
-extern pars_res_word_t pars_rnd_token;
-extern pars_res_word_t pars_rnd_str_token;
extern pars_res_word_t pars_count_token;
-extern pars_res_word_t pars_sum_token;
-extern pars_res_word_t pars_distinct_token;
-extern pars_res_word_t pars_binary_token;
-extern pars_res_word_t pars_blob_token;
extern pars_res_word_t pars_int_token;
extern pars_res_word_t pars_bigint_token;
extern pars_res_word_t pars_char_token;
-extern pars_res_word_t pars_float_token;
extern pars_res_word_t pars_update_token;
extern pars_res_word_t pars_asc_token;
extern pars_res_word_t pars_desc_token;
@@ -236,17 +222,6 @@ pars_insert_statement(
que_node_t* values_list, /*!< in: value expression list or NULL */
sel_node_t* select); /*!< in: select condition or NULL */
/*********************************************************************//**
-Parses a procedure parameter declaration.
-@return own: symbol table node of type SYM_VAR */
-sym_node_t*
-pars_parameter_declaration(
-/*=======================*/
- sym_node_t* node, /*!< in: symbol table node allocated for the
- id of the parameter */
- ulint param_type,
- /*!< in: PARS_INPUT or PARS_OUTPUT */
- pars_res_word_t* type); /*!< in: pointer to a type token */
-/*********************************************************************//**
Parses an elsif element.
@return elsif node */
elsif_node_t*
@@ -358,8 +333,6 @@ pars_column_def(
pars_res_word_t* type, /*!< in: data type */
sym_node_t* len, /*!< in: length of column, or
NULL */
- void* is_unsigned, /*!< in: if not NULL, column
- is of type UNSIGNED. */
void* is_not_null); /*!< in: if not NULL, column
is of type NOT NULL. */
/*********************************************************************//**
@@ -370,9 +343,7 @@ pars_create_table(
/*==============*/
sym_node_t* table_sym, /*!< in: table name node in the symbol
table */
- sym_node_t* column_defs, /*!< in: list of column names */
- sym_node_t* compact, /* in: non-NULL if COMPACT table. */
- sym_node_t* block_size); /* in: block size (can be NULL) */
+ sym_node_t* column_defs); /*!< in: list of column names */
/*********************************************************************//**
Parses an index creation operation.
@return index create subgraph */
@@ -394,7 +365,6 @@ pars_procedure_definition(
/*======================*/
sym_node_t* sym_node, /*!< in: procedure id node in the symbol
table */
- sym_node_t* param_list, /*!< in: parameter declaration list */
que_node_t* stat_list); /*!< in: statement list */
/*************************************************************//**
@@ -672,7 +642,6 @@ struct proc_node_t{
que_common_t common; /*!< type: QUE_NODE_PROC */
sym_node_t* proc_id; /*!< procedure name symbol in the symbol
table of this same procedure */
- sym_node_t* param_list; /*!< input and output parameters */
que_node_t* stat_list; /*!< statement list */
sym_tab_t* sym_tab; /*!< symbol table of this procedure */
};
@@ -747,7 +716,7 @@ struct col_assign_node_t{
#define PARS_FUNC_LOGICAL 2 /*!< AND, OR, NOT */
#define PARS_FUNC_CMP 3 /*!< comparison operators */
#define PARS_FUNC_PREDEFINED 4 /*!< TO_NUMBER, SUBSTR, ... */
-#define PARS_FUNC_AGGREGATE 5 /*!< COUNT, DISTINCT, SUM */
+#define PARS_FUNC_AGGREGATE 5 /*!< COUNT */
#define PARS_FUNC_OTHER 6 /*!< these are not real functions,
e.g., := */
/* @} */
diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h
index 8489551e64d..262be4d30a9 100644
--- a/storage/innobase/include/que0que.h
+++ b/storage/innobase/include/que0que.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -35,9 +35,6 @@ Created 5/27/1996 Heikki Tuuri
#include "row0types.h"
#include "pars0types.h"
-/** Mutex protecting the query threads. */
-extern ib_mutex_t que_thr_mutex;
-
/***********************************************************************//**
Creates a query graph fork node.
@return own: fork node */
@@ -169,16 +166,6 @@ trx_t*
thr_get_trx(
/*========*/
que_thr_t* thr); /*!< in: query thread */
-/*******************************************************************//**
-Determines if this thread is rolling back an incomplete transaction
-in crash recovery.
-@return TRUE if thr is rolling back an incomplete transaction in crash
-recovery */
-UNIV_INLINE
-ibool
-thr_is_recv(
-/*========*/
- const que_thr_t* thr); /*!< in: query thread */
/***********************************************************************//**
Gets the type of a graph node. */
UNIV_INLINE
diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.ic
index 5b775820df7..1c3ac242bf2 100644
--- a/storage/innobase/include/que0que.ic
+++ b/storage/innobase/include/que0que.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -36,20 +37,6 @@ thr_get_trx(
return(thr->graph->trx);
}
-/*******************************************************************//**
-Determines if this thread is rolling back an incomplete transaction
-in crash recovery.
-@return TRUE if thr is rolling back an incomplete transaction in crash
-recovery */
-UNIV_INLINE
-ibool
-thr_is_recv(
-/*========*/
- const que_thr_t* thr) /*!< in: query thread */
-{
- return(trx_is_recv(thr->graph->trx));
-}
-
/***********************************************************************//**
Gets the first thr in a fork. */
UNIV_INLINE
diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h
index 9582b0df393..65504d14416 100644
--- a/storage/innobase/include/rem0cmp.h
+++ b/storage/innobase/include/rem0cmp.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -80,7 +80,7 @@ cmp_dfield_dfield(
/** Compare a GIS data tuple to a physical record.
@param[in] dtuple data tuple
-@param[in] rec B-tree record
+@param[in] rec R-tree record
@param[in] offsets rec_get_offsets(rec)
@param[in] mode compare mode
@retval negative if dtuple is less than rec */
@@ -89,7 +89,7 @@ cmp_dtuple_rec_with_gis(
/*====================*/
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
page_cur_mode_t mode)
MY_ATTRIBUTE((nonnull));
@@ -105,7 +105,7 @@ int
cmp_dtuple_rec_with_gis_internal(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets);
+ const rec_offs* offsets);
/** Compare a data tuple to a physical record.
@param[in] dtuple data tuple
@@ -121,7 +121,7 @@ int
cmp_dtuple_rec_with_match_low(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint n_cmp,
ulint* matched_fields)
MY_ATTRIBUTE((nonnull));
@@ -145,7 +145,7 @@ cmp_dtuple_rec_with_match_bytes(
const dtuple_t* dtuple,
const rec_t* rec,
const dict_index_t* index,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint* matched_fields,
ulint* matched_bytes)
MY_ATTRIBUTE((warn_unused_result));
@@ -162,7 +162,7 @@ int
cmp_dtuple_rec(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets);
+ const rec_offs* offsets);
/**************************************************************//**
Checks if a dtuple is a prefix of a record. The last field in dtuple
is allowed to be a prefix of the corresponding field in the record.
@@ -172,7 +172,7 @@ cmp_dtuple_is_prefix_of_rec(
/*========================*/
const dtuple_t* dtuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */
/** Compare two physical records that contain the same number of columns,
none of which are stored externally.
@retval positive if rec1 (including non-ordering columns) is greater than rec2
@@ -183,58 +183,40 @@ cmp_rec_rec_simple(
/*===============*/
const rec_t* rec1, /*!< in: physical record */
const rec_t* rec2, /*!< in: physical record */
- const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
- const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+ const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+ const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const dict_index_t* index, /*!< in: data dictionary index */
struct TABLE* table) /*!< in: MySQL table, for reporting
duplicate key value if applicable,
or NULL */
MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
-/** Compare two B-tree records.
-@param[in] rec1 B-tree record
-@param[in] rec2 B-tree record
-@param[in] offsets1 rec_get_offsets(rec1, index)
-@param[in] offsets2 rec_get_offsets(rec2, index)
-@param[in] index B-tree index
-@param[in] nulls_unequal true if this is for index cardinality
-statistics estimation, and innodb_stats_method=nulls_unequal
-or innodb_stats_method=nulls_ignored
-@param[out] matched_fields number of completely matched fields
-within the first field not completely matched
-@return the comparison result
-@retval 0 if rec1 is equal to rec2
-@retval negative if rec1 is less than rec2
-@retval positive if rec2 is greater than rec2 */
-int
-cmp_rec_rec_with_match(
- const rec_t* rec1,
- const rec_t* rec2,
- const ulint* offsets1,
- const ulint* offsets2,
- const dict_index_t* index,
- bool nulls_unequal,
- ulint* matched_fields);
-/** Compare two B-tree records.
+/** Compare two B-tree or R-tree records.
Only the common first fields are compared, and externally stored field
are treated as equal.
-@param[in] rec1 B-tree record
-@param[in] rec2 B-tree record
+@param[in] rec1 record (possibly not on an index page)
+@param[in] rec2 B-tree or R-tree record in an index page
@param[in] offsets1 rec_get_offsets(rec1, index)
@param[in] offsets2 rec_get_offsets(rec2, index)
+@param[in] nulls_unequal true if this is for index cardinality
+ statistics estimation with
+ innodb_stats_method=nulls_unequal
+ or innodb_stats_method=nulls_ignored
@param[out] matched_fields number of completely matched fields
within the first field not completely matched
-@return positive, 0, negative if rec1 is greater, equal, less, than rec2,
-respectively */
-UNIV_INLINE
+@retval 0 if rec1 is equal to rec2
+@retval negative if rec1 is less than rec2
+@retval positive if rec1 is greater than rec2 */
int
cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
- const ulint* offsets1,
- const ulint* offsets2,
+ const rec_offs* offsets1,
+ const rec_offs* offsets2,
const dict_index_t* index,
- ulint* matched_fields = NULL);
+ bool nulls_unequal = false,
+ ulint* matched_fields = NULL)
+ MY_ATTRIBUTE((nonnull(1,2,3,4,5)));
/** Compare two data fields.
@param[in] dfield1 data field
diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic
index 2412d22e8fa..4230543615a 100644
--- a/storage/innobase/include/rem0cmp.ic
+++ b/storage/innobase/include/rem0cmp.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -52,40 +53,6 @@ cmp_dfield_dfield(
dfield_get_len(dfield2)));
}
-/** Compare two B-tree records.
-Only the common first fields are compared, and externally stored field
-are treated as equal.
-@param[in] rec1 B-tree record
-@param[in] rec2 B-tree record
-@param[in] offsets1 rec_get_offsets(rec1, index)
-@param[in] offsets2 rec_get_offsets(rec2, index)
-@param[out] matched_fields number of completely matched fields
- within the first field not completely matched
-@return positive, 0, negative if rec1 is greater, equal, less, than rec2,
-respectively */
-UNIV_INLINE
-int
-cmp_rec_rec(
- const rec_t* rec1,
- const rec_t* rec2,
- const ulint* offsets1,
- const ulint* offsets2,
- const dict_index_t* index,
- ulint* matched_fields)
-{
- ulint match_f;
- int ret;
-
- ret = cmp_rec_rec_with_match(
- rec1, rec2, offsets1, offsets2, index, false, &match_f);
-
- if (matched_fields != NULL) {
- *matched_fields = match_f;
- }
-
- return(ret);
-}
-
/** Compare two data fields.
@param[in] dfield1 data field
@param[in] dfield2 data field
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index c81f0479ce6..81a09afa3d8 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -71,29 +71,72 @@ The status is stored in the low-order bits. */
/* Length of a B-tree node pointer, in bytes */
#define REC_NODE_PTR_SIZE 4
+#ifndef UNIV_INNOCHECKSUM
/** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */
-#define REC_1BYTE_SQL_NULL_MASK 0x80UL
+static const rec_offs REC_1BYTE_SQL_NULL_MASK= 0x80;
/** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */
-#define REC_2BYTE_SQL_NULL_MASK 0x8000UL
+static const rec_offs REC_2BYTE_SQL_NULL_MASK= 0x8000;
/** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most
significant bit denotes that the tail of a field is stored off-page. */
-#define REC_2BYTE_EXTERN_MASK 0x4000UL
+static const rec_offs REC_2BYTE_EXTERN_MASK= 0x4000;
+
+static const size_t RECORD_OFFSET= 2;
+static const size_t INDEX_OFFSET=
+ RECORD_OFFSET + sizeof(rec_t *) / sizeof(rec_offs);
-#ifdef UNIV_DEBUG
-/* Length of the rec_get_offsets() header */
-# define REC_OFFS_HEADER_SIZE 4
-#else /* UNIV_DEBUG */
/* Length of the rec_get_offsets() header */
-# define REC_OFFS_HEADER_SIZE 2
+static const size_t REC_OFFS_HEADER_SIZE=
+#ifdef UNIV_DEBUG
+ sizeof(rec_t *) / sizeof(rec_offs) +
+ sizeof(dict_index_t *) / sizeof(rec_offs) +
#endif /* UNIV_DEBUG */
+ 2;
/* Number of elements that should be initially allocated for the
offsets[] array, first passed to rec_get_offsets() */
-#define REC_OFFS_NORMAL_SIZE OFFS_IN_REC_NORMAL_SIZE
-#define REC_OFFS_SMALL_SIZE 10
+static const size_t REC_OFFS_NORMAL_SIZE= 300;
+static const size_t REC_OFFS_SMALL_SIZE= 18;
+static const size_t REC_OFFS_SEC_INDEX_SIZE=
+ /* PK max key parts */ 16 + /* sec idx max key parts */ 16 +
+ /* child page number for non-leaf pages */ 1;
+
+/* Offset consists of two parts: 2 upper bits is type and all other bits is
+value */
+
+enum field_type_t
+{
+ /** normal field */
+ STORED_IN_RECORD= 0 << 14,
+ /** this field is stored off-page */
+ STORED_OFFPAGE= 1 << 14,
+ /** just an SQL NULL */
+ SQL_NULL= 2 << 14
+};
+
+/** without 2 upper bits */
+static const rec_offs DATA_MASK= 0x3fff;
+/** 2 upper bits */
+static const rec_offs TYPE_MASK= ~DATA_MASK;
+inline field_type_t get_type(rec_offs n)
+{
+ return static_cast<field_type_t>(n & TYPE_MASK);
+}
+inline void set_type(rec_offs &n, field_type_t type)
+{
+ n= (n & DATA_MASK) | static_cast<rec_offs>(type);
+}
+inline rec_offs get_value(rec_offs n) { return n & DATA_MASK; }
+inline rec_offs combine(rec_offs value, field_type_t type)
+{
+ return get_value(value) | static_cast<rec_offs>(type);
+}
+
+/** Compact flag ORed to the extra size returned by rec_offs_base()[0] */
+static const rec_offs REC_OFFS_COMPACT= 1 << 15;
+/** External flag in offsets returned by rec_offs_base()[0] */
+static const rec_offs REC_OFFS_EXTERNAL= 1 << 14;
-#ifndef UNIV_INNOCHECKSUM
/******************************************************//**
The following function is used to get the pointer of the next chained record
on the same page.
@@ -398,7 +441,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
value.
@return offset of the start of the field, SQL null flag ORed */
UNIV_INLINE
-ulint
+uint8_t
rec_1_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@@ -412,7 +455,7 @@ value.
@return offset of the start of the field, SQL null flag and extern
storage flag ORed */
UNIV_INLINE
-ulint
+rec_offs
rec_2_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@@ -453,11 +496,11 @@ rec_get_n_extern_new(
(ULINT_UNDEFINED to compute all offsets)
@param[in,out] heap memory heap
@return the new offsets */
-ulint*
+rec_offs*
rec_get_offsets_func(
const rec_t* rec,
const dict_index_t* index,
- ulint* offsets,
+ rec_offs* offsets,
#ifdef UNIV_DEBUG
bool leaf,
#endif /* UNIV_DEBUG */
@@ -494,7 +537,7 @@ rec_get_offsets_reverse(
const dict_index_t* index, /*!< in: record descriptor */
ulint node_ptr,/*!< in: nonzero=node pointer,
0=leaf node */
- ulint* offsets)/*!< in/out: array consisting of
+ rec_offs* offsets)/*!< in/out: array consisting of
offsets[0] allocated elements */
MY_ATTRIBUTE((nonnull));
#ifdef UNIV_DEBUG
@@ -507,7 +550,7 @@ rec_offs_validate(
/*==============*/
const rec_t* rec, /*!< in: record or NULL */
const dict_index_t* index, /*!< in: record descriptor or NULL */
- const ulint* offsets)/*!< in: array returned by
+ const rec_offs* offsets)/*!< in: array returned by
rec_get_offsets() */
MY_ATTRIBUTE((nonnull(3), warn_unused_result));
/************************************************************//**
@@ -519,7 +562,7 @@ rec_offs_make_valid(
/*================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in: array returned by
+ rec_offs* offsets)/*!< in: array returned by
rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
#else
@@ -557,10 +600,10 @@ The following function is used to get an offset to the nth
data field in a record.
@return offset from the origin of rec */
UNIV_INLINE
-ulint
+rec_offs
rec_get_nth_field_offs(
/*===================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index of the field */
ulint* len) /*!< out: length of the field; UNIV_SQL_NULL
if SQL null */
@@ -575,7 +618,7 @@ UNIV_INLINE
ulint
rec_offs_comp(
/*==========*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/******************************************************//**
Determine if the offsets are for a record containing
@@ -585,7 +628,7 @@ UNIV_INLINE
ulint
rec_offs_any_extern(
/*================*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/******************************************************//**
Determine if the offsets are for a record containing null BLOB pointers.
@@ -595,7 +638,7 @@ const byte*
rec_offs_any_null_extern(
/*=====================*/
const rec_t* rec, /*!< in: record */
- const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */
MY_ATTRIBUTE((warn_unused_result));
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@@ -604,7 +647,7 @@ UNIV_INLINE
ulint
rec_offs_nth_extern(
/*================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
MY_ATTRIBUTE((warn_unused_result));
@@ -613,7 +656,7 @@ rec_offs_nth_extern(
@param[in] n nth field */
void
rec_offs_make_nth_extern(
- ulint* offsets,
+ rec_offs* offsets,
const ulint n);
/******************************************************//**
Returns nonzero if the SQL NULL bit is set in nth field of rec.
@@ -622,7 +665,7 @@ UNIV_INLINE
ulint
rec_offs_nth_sql_null(
/*==================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
MY_ATTRIBUTE((warn_unused_result));
/******************************************************//**
@@ -632,7 +675,7 @@ UNIV_INLINE
ulint
rec_offs_nth_size(
/*==============*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
MY_ATTRIBUTE((warn_unused_result));
@@ -643,7 +686,7 @@ UNIV_INLINE
ulint
rec_offs_n_extern(
/*==============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//**
This is used to modify the value of an already existing field in a record.
@@ -656,7 +699,7 @@ void
rec_set_nth_field(
/*==============*/
rec_t* rec, /*!< in: record */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index number of the field */
const void* data, /*!< in: pointer to the data if not SQL null */
ulint len) /*!< in: length of the data or UNIV_SQL_NULL.
@@ -685,7 +728,7 @@ UNIV_INLINE
ulint
rec_offs_get_n_alloc(
/*=================*/
- const ulint* offsets)/*!< in: array for rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array for rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
The following function sets the number of allocated elements
@@ -694,7 +737,7 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
- ulint* offsets, /*!< out: array for rec_get_offsets(),
+ rec_offs*offsets, /*!< out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /*!< in: number of elements */
MY_ATTRIBUTE((nonnull));
@@ -707,7 +750,7 @@ UNIV_INLINE
ulint
rec_offs_n_fields(
/*==============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
The following function returns the data size of a physical
@@ -719,7 +762,7 @@ UNIV_INLINE
ulint
rec_offs_data_size(
/*===============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns the total size of record minus data size of record.
@@ -730,7 +773,7 @@ UNIV_INLINE
ulint
rec_offs_extra_size(
/*================*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns the total size of a physical record.
@@ -739,7 +782,7 @@ UNIV_INLINE
ulint
rec_offs_size(
/*==========*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
#ifdef UNIV_DEBUG
/**********************************************************//**
@@ -750,7 +793,7 @@ byte*
rec_get_start(
/*==========*/
const rec_t* rec, /*!< in: pointer to record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/**********************************************************//**
Returns a pointer to the end of the record.
@@ -760,7 +803,7 @@ byte*
rec_get_end(
/*========*/
const rec_t* rec, /*!< in: pointer to record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
#else /* UNIV_DEBUG */
# define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets))
@@ -777,7 +820,7 @@ rec_t*
rec_copy(
void* buf,
const rec_t* rec,
- const ulint* offsets);
+ const rec_offs* offsets);
/** Determine the size of a data tuple prefix in a temporary file.
@param[in] index clustered or secondary index
@@ -801,7 +844,7 @@ rec_init_offsets_temp(
/*==================*/
const rec_t* rec, /*!< in: temporary file record */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in/out: array of offsets;
+ rec_offs* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
MY_ATTRIBUTE((nonnull));
@@ -843,7 +886,7 @@ UNIV_INLINE
ulint
rec_fold(
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint n_fields,
ulint n_bytes,
index_id_t tree_id)
@@ -944,7 +987,7 @@ ibool
rec_validate(
/*=========*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints an old-style physical record. */
@@ -961,7 +1004,7 @@ rec_print_mbr_rec(
/*==========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints a physical record. */
@@ -970,7 +1013,7 @@ rec_print_new(
/*==========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Prints a physical record. */
@@ -992,7 +1035,7 @@ rec_print(
std::ostream& o,
const rec_t* rec,
ulint info,
- const ulint* offsets);
+ const rec_offs* offsets);
/** Wrapper for pretty-printing a record */
struct rec_index_print
@@ -1019,31 +1062,32 @@ operator<<(std::ostream& o, const rec_index_print& r);
struct rec_offsets_print
{
/** Constructor */
- rec_offsets_print(const rec_t* rec, const ulint* offsets) :
+ rec_offsets_print(const rec_t* rec, const rec_offs* offsets) :
m_rec(rec), m_offsets(offsets)
{}
/** Record */
const rec_t* m_rec;
/** Offsets to each field */
- const ulint* m_offsets;
+ const rec_offs* m_offsets;
};
/** Display a record.
@param[in,out] o output stream
@param[in] r record to display
@return the output stream */
+ATTRIBUTE_COLD
std::ostream&
operator<<(std::ostream& o, const rec_offsets_print& r);
-# ifndef DBUG_OFF
/** Pretty-printer of records and tuples */
class rec_printer : public std::ostringstream {
public:
/** Construct a pretty-printed record.
@param rec record with header
@param offsets rec_get_offsets(rec, ...) */
- rec_printer(const rec_t* rec, const ulint* offsets)
+ ATTRIBUTE_COLD
+ rec_printer(const rec_t* rec, const rec_offs* offsets)
:
std::ostringstream ()
{
@@ -1056,7 +1100,8 @@ public:
@param rec record, possibly lacking header
@param info rec_get_info_bits(rec)
@param offsets rec_get_offsets(rec, ...) */
- rec_printer(const rec_t* rec, ulint info, const ulint* offsets)
+ ATTRIBUTE_COLD
+ rec_printer(const rec_t* rec, ulint info, const rec_offs* offsets)
:
std::ostringstream ()
{
@@ -1065,6 +1110,7 @@ public:
/** Construct a pretty-printed tuple.
@param tuple data tuple */
+ ATTRIBUTE_COLD
rec_printer(const dtuple_t* tuple)
:
std::ostringstream ()
@@ -1075,6 +1121,7 @@ public:
/** Construct a pretty-printed tuple.
@param field array of data tuple fields
@param n number of fields */
+ ATTRIBUTE_COLD
rec_printer(const dfield_t* field, ulint n)
:
std::ostringstream ()
@@ -1091,7 +1138,7 @@ private:
/** Assignment operator */
rec_printer& operator=(const rec_printer& other);
};
-# endif /* !DBUG_OFF */
+
# ifdef UNIV_DEBUG
/** Read the DB_TRX_ID of a clustered index record.
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index 4d2c00de48f..f65bca8181d 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 2020, 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
@@ -30,15 +30,6 @@ Created 5/30/1994 Heikki Tuuri
#include "dict0boot.h"
#include "btr0types.h"
-/* Compact flag ORed to the extra size returned by rec_get_offsets() */
-#define REC_OFFS_COMPACT ((ulint) 1 << 31)
-/* SQL NULL flag in offsets returned by rec_get_offsets() */
-#define REC_OFFS_SQL_NULL ((ulint) 1 << 31)
-/* External flag in offsets returned by rec_get_offsets() */
-#define REC_OFFS_EXTERNAL ((ulint) 1 << 30)
-/* Mask for offsets returned by rec_get_offsets() */
-#define REC_OFFS_MASK (REC_OFFS_EXTERNAL - 1)
-
/* Offsets of the bit-fields in an old-style record. NOTE! In the table the
most significant bytes and bits are written below less significant.
@@ -873,7 +864,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
value.
@return offset of the start of the field, SQL null flag ORed */
UNIV_INLINE
-ulint
+uint8_t
rec_1_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@@ -892,7 +883,7 @@ value.
@return offset of the start of the field, SQL null flag and extern
storage flag ORed */
UNIV_INLINE
-ulint
+rec_offs
rec_2_get_field_end_info(
/*=====================*/
const rec_t* rec, /*!< in: record */
@@ -931,13 +922,13 @@ UNIV_INLINE
ulint
rec_offs_get_n_alloc(
/*=================*/
- const ulint* offsets)/*!< in: array for rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array for rec_get_offsets() */
{
ulint n_alloc;
ut_ad(offsets);
n_alloc = offsets[0];
ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
- UNIV_MEM_ASSERT_W(offsets, n_alloc * sizeof *offsets);
+ MEM_CHECK_ADDRESSABLE(offsets, n_alloc * sizeof *offsets);
return(n_alloc);
}
@@ -948,13 +939,13 @@ UNIV_INLINE
void
rec_offs_set_n_alloc(
/*=================*/
- ulint* offsets, /*!< out: array for rec_get_offsets(),
+ rec_offs*offsets, /*!< out: array for rec_get_offsets(),
must be allocated */
ulint n_alloc) /*!< in: number of elements */
{
ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
- UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets);
- offsets[0] = n_alloc;
+ MEM_UNDEFINED(offsets, n_alloc * sizeof *offsets);
+ offsets[0] = static_cast<rec_offs>(n_alloc);
}
/**********************************************************//**
@@ -964,7 +955,7 @@ UNIV_INLINE
ulint
rec_offs_n_fields(
/*==============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n_fields;
ut_ad(offsets);
@@ -985,22 +976,22 @@ rec_offs_validate(
/*==============*/
const rec_t* rec, /*!< in: record or NULL */
const dict_index_t* index, /*!< in: record descriptor or NULL */
- const ulint* offsets)/*!< in: array returned by
+ const rec_offs* offsets)/*!< in: array returned by
rec_get_offsets() */
{
ulint i = rec_offs_n_fields(offsets);
ulint last = ULINT_MAX;
- ulint comp = *rec_offs_base(offsets) & REC_OFFS_COMPACT;
+ bool comp = rec_offs_base(offsets)[0] & REC_OFFS_COMPACT;
if (rec) {
- ut_ad((ulint) rec == offsets[2]);
+ ut_ad(!memcmp(&rec, &offsets[RECORD_OFFSET], sizeof(rec)));
if (!comp) {
ut_a(rec_get_n_fields_old(rec) >= i);
}
}
if (index) {
ulint max_n_fields;
- ut_ad((ulint) index == offsets[3]);
+ ut_ad(!memcmp(&index, &offsets[INDEX_OFFSET], sizeof(index)));
max_n_fields = ut_max(
dict_index_get_n_fields(index),
dict_index_get_n_unique_in_tree(index) + 1);
@@ -1025,7 +1016,7 @@ rec_offs_validate(
ut_a(!index->n_def || i <= max_n_fields);
}
while (i--) {
- ulint curr = rec_offs_base(offsets)[1 + i] & REC_OFFS_MASK;
+ rec_offs curr = get_value(rec_offs_base(offsets)[1 + i]);
ut_a(curr <= last);
last = curr;
}
@@ -1041,15 +1032,15 @@ rec_offs_make_valid(
/*================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in: array returned by
+ rec_offs* offsets)/*!< in: array returned by
rec_get_offsets() */
{
ut_ad(rec);
ut_ad(index);
ut_ad(offsets);
ut_ad(rec_get_n_fields(rec, index) >= rec_offs_n_fields(offsets));
- offsets[2] = (ulint) rec;
- offsets[3] = (ulint) index;
+ memcpy(&offsets[RECORD_OFFSET], &rec, sizeof(rec));
+ memcpy(&offsets[INDEX_OFFSET], &index, sizeof(index));
}
#endif /* UNIV_DEBUG */
@@ -1058,34 +1049,26 @@ The following function is used to get an offset to the nth
data field in a record.
@return offset from the origin of rec */
UNIV_INLINE
-ulint
+rec_offs
rec_get_nth_field_offs(
/*===================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index of the field */
ulint* len) /*!< out: length of the field; UNIV_SQL_NULL
if SQL null */
{
- ulint offs;
- ulint length;
ut_ad(n < rec_offs_n_fields(offsets));
- if (n == 0) {
- offs = 0;
- } else {
- offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
- }
+ rec_offs offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]);
+ rec_offs next_offs = rec_offs_base(offsets)[1 + n];
- length = rec_offs_base(offsets)[1 + n];
-
- if (length & REC_OFFS_SQL_NULL) {
- length = UNIV_SQL_NULL;
+ if (get_type(next_offs) == SQL_NULL) {
+ *len = UNIV_SQL_NULL;
} else {
- length &= REC_OFFS_MASK;
- length -= offs;
+
+ *len = get_value(next_offs) - offs;
}
- *len = length;
return(offs);
}
@@ -1097,7 +1080,7 @@ UNIV_INLINE
ulint
rec_offs_comp(
/*==========*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return(*rec_offs_base(offsets) & REC_OFFS_COMPACT);
@@ -1111,7 +1094,7 @@ UNIV_INLINE
ulint
rec_offs_any_extern(
/*================*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
return(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL);
@@ -1125,7 +1108,7 @@ const byte*
rec_offs_any_null_extern(
/*=====================*/
const rec_t* rec, /*!< in: record */
- const ulint* offsets) /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */
{
ulint i;
ut_ad(rec_offs_validate(rec, NULL, offsets));
@@ -1160,12 +1143,12 @@ UNIV_INLINE
ulint
rec_offs_nth_extern(
/*================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
- return(rec_offs_base(offsets)[1 + n] & REC_OFFS_EXTERNAL);
+ return get_type(rec_offs_base(offsets)[1 + n]) == STORED_OFFPAGE;
}
/******************************************************//**
@@ -1175,12 +1158,12 @@ UNIV_INLINE
ulint
rec_offs_nth_sql_null(
/*==================*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
- return(rec_offs_base(offsets)[1 + n] & REC_OFFS_SQL_NULL);
+ return get_type(rec_offs_base(offsets)[1 + n]) == SQL_NULL;
}
/******************************************************//**
@@ -1190,16 +1173,16 @@ UNIV_INLINE
ulint
rec_offs_nth_size(
/*==============*/
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: nth field */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
if (!n) {
- return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
+ return get_value(rec_offs_base(offsets)[1 + n]);
}
- return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
- & REC_OFFS_MASK);
+ return get_value((rec_offs_base(offsets)[1 + n]))
+ - get_value(rec_offs_base(offsets)[n]);
}
/******************************************************//**
@@ -1209,7 +1192,7 @@ UNIV_INLINE
ulint
rec_offs_n_extern(
/*==============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n = 0;
@@ -1407,7 +1390,7 @@ void
rec_set_nth_field(
/*==============*/
rec_t* rec, /*!< in: record */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n, /*!< in: index number of the field */
const void* data, /*!< in: pointer to the data
if not SQL null */
@@ -1462,16 +1445,16 @@ UNIV_INLINE
void
rec_offs_set_n_fields(
/*==================*/
- ulint* offsets, /*!< in/out: array returned by
+ rec_offs* offsets, /*!< in/out: array returned by
rec_get_offsets() */
- ulint n_fields) /*!< in: number of fields */
+ ulint n_fields) /*!< in: number of fields */
{
ut_ad(offsets);
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
<= rec_offs_get_n_alloc(offsets));
- offsets[1] = n_fields;
+ offsets[1] = static_cast<rec_offs>(n_fields);
}
/**********************************************************//**
@@ -1484,13 +1467,12 @@ UNIV_INLINE
ulint
rec_offs_data_size(
/*===============*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint size;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
- size = rec_offs_base(offsets)[rec_offs_n_fields(offsets)]
- & REC_OFFS_MASK;
+ size = get_value(rec_offs_base(offsets)[rec_offs_n_fields(offsets)]);
ut_ad(size < UNIV_PAGE_SIZE);
return(size);
}
@@ -1504,7 +1486,7 @@ UNIV_INLINE
ulint
rec_offs_extra_size(
/*================*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint size;
ut_ad(rec_offs_validate(NULL, NULL, offsets));
@@ -1520,7 +1502,7 @@ UNIV_INLINE
ulint
rec_offs_size(
/*==========*/
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets));
}
@@ -1534,7 +1516,7 @@ byte*
rec_get_end(
/*========*/
const rec_t* rec, /*!< in: pointer to record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(const_cast<rec_t*>(rec + rec_offs_data_size(offsets)));
@@ -1548,7 +1530,7 @@ byte*
rec_get_start(
/*==========*/
const rec_t* rec, /*!< in: pointer to record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(const_cast<rec_t*>(rec - rec_offs_extra_size(offsets)));
@@ -1565,7 +1547,7 @@ rec_t*
rec_copy(
void* buf,
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
ulint extra_len;
ulint data_len;
@@ -1644,6 +1626,11 @@ rec_get_converted_size(
data_size = dtuple_get_data_size(dtuple, 0);
+ /* If primary key is being updated then the new record inherits
+ externally stored fields from the delete-marked old record.
+ In that case, n_ext may be less value than
+ dtuple_get_n_ext(tuple). */
+ ut_ad(n_ext <= dtuple_get_n_ext(dtuple));
extra_size = rec_get_converted_extra_size(
data_size, dtuple_get_n_fields(dtuple), n_ext);
@@ -1696,7 +1683,7 @@ UNIV_INLINE
ulint
rec_fold(
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint n_fields,
ulint n_bytes,
index_id_t tree_id)
diff --git a/storage/innobase/include/rem0types.h b/storage/innobase/include/rem0types.h
index cc59bd91076..9172385a802 100644
--- a/storage/innobase/include/rem0types.h
+++ b/storage/innobase/include/rem0types.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+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
@@ -29,6 +30,9 @@ Created 5/30/1994 Heikki Tuuri
/* We define the physical record simply as an array of bytes */
typedef byte rec_t;
+/** This type represents a field offset in a rec_t* */
+typedef unsigned short int rec_offs;
+
/* Maximum values for various fields (for non-blob tuples) */
#define REC_MAX_N_FIELDS (1024 - 1)
#define REC_MAX_HEAP_NO (2 * 8192 - 1)
diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h
index 1c1357e330b..84368374430 100644
--- a/storage/innobase/include/row0ftsort.h
+++ b/storage/innobase/include/row0ftsort.h
@@ -30,6 +30,7 @@ Created 10/13/2010 Jimmy Yang
#include "data0data.h"
#include "fts0fts.h"
#include "fts0priv.h"
+#include "rem0types.h"
#include "row0merge.h"
#include "btr0bulk.h"
@@ -247,7 +248,7 @@ row_merge_fts_sel_propagate(
int* sel_tree, /*<! in: selection tree */
ulint level, /*<! in: selection tree level */
const mrec_t** mrec, /*<! in: sort record */
- ulint** offsets, /*<! in: record offsets */
+ rec_offs** offsets, /*<! in: record offsets */
dict_index_t* index); /*<! in: FTS index */
/********************************************************************//**
Read sorted file containing index data tuples and insert these data
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 164f6fe1ddb..27fe442f6ff 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2019, 2020 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,6 +31,7 @@ Created 4/20/1996 Heikki Tuuri
#include "que0types.h"
#include "trx0types.h"
#include "row0types.h"
+#include <vector>
/***************************************************************//**
Checks if foreign key constraint fails for an index entry. Sets shared locks
@@ -159,7 +160,10 @@ row_ins_step(
/* Insert node structure */
struct ins_node_t{
- que_common_t common; /*!< node type: QUE_NODE_INSERT */
+ ins_node_t() : common(QUE_NODE_INSERT, NULL), entry(entry_list.end())
+ {
+ }
+ que_common_t common; /*!< node type: QUE_NODE_INSERT */
ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */
dtuple_t* row; /*!< row to insert */
dict_table_t* table; /*!< table where to insert */
@@ -169,11 +173,12 @@ struct ins_node_t{
ulint state; /*!< node execution state */
dict_index_t* index; /*!< NULL, or the next index where the index
entry should be inserted */
- dtuple_t* entry; /*!< NULL, or entry to insert in the index;
+ std::vector<dtuple_t*>
+ entry_list;/* list of entries, one for each index */
+ std::vector<dtuple_t*>::iterator
+ entry; /*!< NULL, or entry to insert in the index;
after a successful insert of the entry,
this should be reset to NULL */
- UT_LIST_BASE_NODE_T(dtuple_t)
- entry_list;/* list of entries, one for each index */
/** buffer for the system columns */
byte sys_buf[DATA_ROW_ID_LEN
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h
index 84b7ba891b2..383975c32d3 100644
--- a/storage/innobase/include/row0log.h
+++ b/storage/innobase/include/row0log.h
@@ -132,7 +132,7 @@ row_log_table_delete(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should
be logged, or NULL to use those in rec */
ATTRIBUTE_COLD __attribute__((nonnull(1,2,3)));
@@ -147,7 +147,7 @@ row_log_table_update(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
const dtuple_t* old_pk);/*!< in: row_log_table_get_pk()
before the update */
@@ -163,7 +163,7 @@ row_log_table_get_pk(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index),
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index),
or NULL */
byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for
row_log_table_delete(), or NULL */
@@ -180,7 +180,7 @@ row_log_table_insert(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets);/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets);/*!< in: rec_get_offsets(rec,index) */
/******************************************************//**
Notes that a BLOB is being freed during online ALTER TABLE. */
void
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index a1719e0448e..0d48fbd2e8a 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -203,18 +203,6 @@ row_merge_file_destroy_low(
int fd); /*!< in: merge file descriptor */
/*********************************************************************//**
-Provide a new pathname for a table that is being renamed if it belongs to
-a file-per-table tablespace. The caller is responsible for freeing the
-memory allocated for the return value.
-@return new pathname of tablespace file, or NULL if space = 0 */
-char*
-row_make_new_pathname(
-/*==================*/
- dict_table_t* table, /*!< in: table to be renamed */
- const char* new_name) /*!< in: new name */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
-/*********************************************************************//**
Rename the tables in the data dictionary. The data dictionary must
have been locked exclusively by the caller, because the transaction
will not be committed.
@@ -489,7 +477,7 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets,/*!< out: offsets of mrec */
+ rec_offs* offsets,/*!< out: offsets of mrec */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
MY_ATTRIBUTE((warn_unused_result));
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 60f53221c9a..d5cdd4a3f17 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -814,6 +814,8 @@ struct VCOL_STORAGE
byte *innobase_record;
byte *maria_record;
String *blob_value_storage;
+ VCOL_STORAGE(): maria_table(NULL), innobase_record(NULL),
+ maria_record(NULL), blob_value_storage(NULL) {}
};
/**
@@ -836,12 +838,48 @@ bool innobase_allocate_row_for_vcol(
dict_index_t* index,
mem_heap_t** heap,
TABLE** table,
- byte** record,
- VCOL_STORAGE** storage);
+ VCOL_STORAGE* storage);
/** Free memory allocated by innobase_allocate_row_for_vcol() */
void innobase_free_row_for_vcol(VCOL_STORAGE *storage);
+class ib_vcol_row
+{
+ VCOL_STORAGE storage;
+public:
+ mem_heap_t *heap;
+
+ ib_vcol_row(mem_heap_t *heap) : heap(heap) {}
+
+ byte *record(THD *thd, dict_index_t *index, TABLE **table)
+ {
+ if (!storage.innobase_record)
+ {
+ bool ok = innobase_allocate_row_for_vcol(thd, index, &heap, table,
+ &storage);
+ if (!ok)
+ return NULL;
+ }
+ return storage.innobase_record;
+ };
+
+ ~ib_vcol_row()
+ {
+ if (heap)
+ {
+ if (storage.innobase_record)
+ innobase_free_row_for_vcol(&storage);
+ mem_heap_free(heap);
+ }
+ }
+};
+
+/** Report virtual value computation failure in ib::error
+@param[in] row the data row
+*/
+ATTRIBUTE_COLD
+void innobase_report_computed_value_failed(dtuple_t *row);
+
/** Get the computed value by supplying the base column values.
@param[in,out] row the data row
@param[in] col virtual column
diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h
index 694604af408..1c7e40ac690 100644
--- a/storage/innobase/include/row0row.h
+++ b/storage/innobase/include/row0row.h
@@ -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, 2020, 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
@@ -44,7 +44,7 @@ ulint
row_get_trx_id_offset(
/*==================*/
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: record offsets */
+ const rec_offs* offsets)/*!< in: record offsets */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the trx id field from a clustered index record.
@@ -55,7 +55,7 @@ row_get_rec_trx_id(
/*===============*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the roll pointer field from a clustered index record.
@@ -66,7 +66,7 @@ row_get_rec_roll_ptr(
/*=================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/* Flags for row build type. */
@@ -138,7 +138,7 @@ row_build(
this record must be at least
s-latched and the latch held
as long as the row dtuple is used! */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index)
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index)
or NULL, in which case this function
will invoke rec_get_offsets() */
const dict_table_t* col_table,
@@ -189,7 +189,7 @@ row_build_w_add_vcol(
ulint type,
const dict_index_t* index,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
const dict_table_t* col_table,
const dtuple_t* add_cols,
const dict_add_v_col_t* add_v,
@@ -206,9 +206,7 @@ row_rec_to_index_entry_low(
/*=======================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
- ulint* n_ext, /*!< out: number of externally
- stored columns */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result));
@@ -221,9 +219,7 @@ row_rec_to_index_entry(
/*===================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in/out: rec_get_offsets(rec) */
- ulint* n_ext, /*!< out: number of externally
- stored columns */
+ const rec_offs* offsets,/*!< in/out: rec_get_offsets(rec) */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
MY_ATTRIBUTE((warn_unused_result));
@@ -266,7 +262,7 @@ row_build_row_ref_in_tuple(
held as long as the row
reference is used! */
const dict_index_t* index, /*!< in: secondary index */
- ulint* offsets,/*!< in: rec_get_offsets(rec, index)
+ rec_offs* offsets,/*!< in: rec_get_offsets(rec, index)
or NULL */
trx_t* trx) /*!< in: transaction or NULL */
MY_ATTRIBUTE((nonnull(1,2,3)));
@@ -285,7 +281,7 @@ row_build_row_ref_fast(
const rec_t* rec, /*!< in: record in the index; must be
preserved while ref is used, as we do
not copy field values to heap */
- const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */
/***************************************************************//**
Searches the clustered index record for a row, if we have the row
reference.
diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic
index 36a281d2fb9..a3dd51aaac2 100644
--- a/storage/innobase/include/row0row.ic
+++ b/storage/innobase/include/row0row.ic
@@ -36,7 +36,7 @@ ulint
row_get_trx_id_offset(
/*==================*/
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: record offsets */
+ const rec_offs* offsets)/*!< in: record offsets */
{
ulint pos;
ulint offset;
@@ -63,7 +63,7 @@ row_get_rec_trx_id(
/*===============*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
@@ -88,7 +88,7 @@ row_get_rec_roll_ptr(
/*=================*/
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
@@ -147,7 +147,7 @@ row_build_row_ref_fast(
const rec_t* rec, /*!< in: record in the index; must be
preserved while ref is used, as we do
not copy field values to heap */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
dfield_t* dfield;
const byte* field;
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index 7bca58037a6..b60770b01fb 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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,6 +28,7 @@ Created 12/27/1996 Heikki Tuuri
#define row0upd_h
#include "data0data.h"
+#include "rem0types.h"
#include "row0types.h"
#include "btr0types.h"
#include "trx0types.h"
@@ -123,7 +124,7 @@ row_upd_rec_sys_fields(
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr);/*!< in: DB_ROLL_PTR to the undo log */
/*********************************************************************//**
@@ -165,7 +166,7 @@ ibool
row_upd_changes_field_size_or_external(
/*===================================*/
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update);/*!< in: update vector */
/***********************************************************//**
Returns true if row update contains disowned external fields.
@@ -186,7 +187,7 @@ row_upd_rec_in_place(
/*=================*/
rec_t* rec, /*!< in/out: record where replaced */
dict_index_t* index, /*!< in: the index the record belongs to */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
page_zip_des_t* page_zip);/*!< in: compressed page with enough space
available, or NULL */
@@ -201,7 +202,7 @@ row_upd_build_sec_rec_difference_binary(
/*====================================*/
const rec_t* rec, /*!< in: secondary index record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const dtuple_t* entry, /*!< in: entry to insert */
mem_heap_t* heap) /*!< in: memory heap from which allocated */
MY_ATTRIBUTE((warn_unused_result, nonnull));
@@ -227,7 +228,7 @@ row_upd_build_difference_binary(
dict_index_t* index,
const dtuple_t* entry,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
bool no_sys,
trx_t* trx,
mem_heap_t* heap,
@@ -256,24 +257,18 @@ row_upd_index_replace_new_col_vals_index_pos(
mem_heap_t* heap) /*!< in: memory heap for allocating and
copying the new values */
MY_ATTRIBUTE((nonnull));
-/***********************************************************//**
-Replaces the new column values stored in the update vector to the index entry
-given. */
-void
-row_upd_index_replace_new_col_vals(
-/*===============================*/
- dtuple_t* entry, /*!< in/out: index entry where replaced;
- the clustered index record must be
- covered by a lock or a page latch to
- prevent deletion (rollback or purge) */
- dict_index_t* index, /*!< in: index; NOTE that this may also be a
- non-clustered index */
- const upd_t* update, /*!< in: an update vector built for the
- CLUSTERED index so that the field number in
- an upd_field is the clustered index position */
- mem_heap_t* heap) /*!< in: memory heap for allocating and
- copying the new values */
- MY_ATTRIBUTE((nonnull));
+/** Replace the new column values stored in the update vector,
+during trx_undo_prev_version_build().
+@param entry clustered index tuple where the values are replaced
+ (the clustered index leaf page latch must be held)
+@param index clustered index
+@param update update vector for the clustered index
+@param heap memory heap for allocating and copying values
+@return whether the previous version was built successfully */
+bool
+row_upd_index_replace_new_col_vals(dtuple_t *entry, const dict_index_t &index,
+ const upd_t *update, mem_heap_t *heap)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************//**
Replaces the new column values stored in the update vector. */
void
@@ -370,16 +365,6 @@ row_upd_changes_some_index_ord_field_binary(
/*========================================*/
const dict_table_t* table, /*!< in: table */
const upd_t* update);/*!< in: update vector for the row */
-/** Stores to the heap the row on which the node->pcur is positioned.
-@param[in] node row update node
-@param[in] thd mysql thread handle
-@param[in,out] mysql_table NULL, or mysql table object when
- user thread invokes dml */
-void
-row_upd_store_row(
- upd_node_t* node,
- THD* thd,
- TABLE* mysql_table);
/***********************************************************//**
Updates a row in a table. This is a high-level function used
in SQL execution graphs.
@@ -407,7 +392,7 @@ row_upd_rec_sys_fields_in_recovery(
/*===============================*/
rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint pos, /*!< in: TRX_ID position in rec */
trx_id_t trx_id, /*!< in: transaction id */
roll_ptr_t roll_ptr);/*!< in: roll ptr of the undo log record */
diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic
index 64f08cbb0b2..07e1c13d771 100644
--- a/storage/innobase/include/row0upd.ic
+++ b/storage/innobase/include/row0upd.ic
@@ -163,7 +163,7 @@ row_upd_rec_sys_fields(
page_zip_des_t* page_zip,/*!< in/out: compressed page whose
uncompressed part will be updated, or NULL */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const trx_t* trx, /*!< in: transaction */
roll_ptr_t roll_ptr)/*!< in: DB_ROLL_PTR to the undo log */
{
diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h
index 327bb546356..3b1f16ef15f 100644
--- a/storage/innobase/include/row0vers.h
+++ b/storage/innobase/include/row0vers.h
@@ -50,7 +50,7 @@ trx_t*
row_vers_impl_x_locked(
const rec_t* rec,
dict_index_t* index,
- const ulint* offsets);
+ const rec_offs* offsets);
/*****************************************************************//**
Finds out if we must preserve a delete marked earlier version of a clustered
@@ -112,7 +112,7 @@ row_vers_build_for_consistent_read(
mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will
also hold the latch on purge_view */
dict_index_t* index, /*!< in: the clustered index */
- ulint** offsets,/*!< in/out: offsets returned by
+ rec_offs** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
ReadView* view, /*!< in: the consistent read view */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
@@ -139,7 +139,7 @@ row_vers_build_for_semi_consistent_read(
of this records */
mtr_t* mtr, /*!< in: mtr holding the latch on rec */
dict_index_t* index, /*!< in: the clustered index */
- ulint** offsets,/*!< in/out: offsets returned by
+ rec_offs** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
the offsets are allocated */
diff --git a/storage/innobase/include/span.h b/storage/innobase/include/span.h
deleted file mode 100644
index faeb41029b8..00000000000
--- a/storage/innobase/include/span.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*****************************************************************************
-
-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 Street, Fifth Floor, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-#pragma once
-
-#include <cstddef>
-#include <iterator>
-
-namespace st_ {
-
-template <class ElementType> class span {
-public:
- typedef ElementType element_type;
- typedef ElementType value_type;
- typedef size_t index_type;
- typedef ptrdiff_t difference_type;
- typedef element_type* pointer;
- typedef const element_type* const_pointer;
- typedef element_type& reference;
- typedef const element_type& const_reference;
- typedef pointer iterator;
- typedef const pointer const_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- span() : data_(NULL), size_(0) {}
-
- span(pointer ptr, index_type count) : data_(ptr), size_(count) {}
-
- span(pointer first, pointer last) : data_(first), size_(last - first) {}
-
- template <size_t N> span(element_type (&arr)[N]) : data_(arr), size_(N)
- {
- }
-
- template <class Container>
- span(Container& cont) : data_(cont.begin()), size_(cont.size())
- {
- }
-
- template <class Container>
- span(const Container& cont) : data_(cont.begin()), size_(cont.size())
- {
- }
-
- span(const span& other) : data_(other.data_), size_(other.size_) {}
-
- ~span(){};
-
- span& operator=(const span& other)
- {
- data_ = other.data_;
- size_ = other.size_;
- return *this;
- }
-
- template <size_t Count> span<element_type> first() const
- {
- assert(!empty());
- return span(data_, 1);
- }
- template <size_t Count> span<element_type> last() const
- {
- assert(!empty());
- return span(data_ + size() - 1, 1);
- }
-
- span<element_type> first(index_type count) const
- {
- assert(!empty());
- return span(data_, 1);
- }
- span<element_type> last(index_type count) const
- {
- assert(!empty());
- return span(data_ + size() - 1, 1);
- }
- span<element_type> subspan(index_type offset, index_type count) const
- {
- assert(!empty());
- assert(size() >= offset + count);
- return span(data_ + offset, count);
- }
-
- index_type size() const { return size_; }
- index_type size_bytes() const { return size_ * sizeof(ElementType); }
- bool empty() const __attribute__((warn_unused_result))
- {
- return size_ == 0;
- }
-
- reference operator[](index_type idx) const
- {
- assert(size() > idx);
- return data_[idx];
- }
- reference front() const
- {
- assert(!empty());
- return data_[0];
- }
- reference back() const
- {
- assert(!empty());
- return data_[size() - 1];
- }
- pointer data() const
- {
- assert(!empty());
- return data_;
- }
-
- iterator begin() const { return data_; }
- iterator end() const { return data_ + size_; }
- reverse_iterator rbegin() const
- {
- return std::reverse_iterator<iterator>(std::advance(end(), -1));
- }
- reverse_iterator rend() const
- {
- return std::reverse_iterator<iterator>(
- std::advance(begin(), -1));
- }
-
-private:
- pointer data_;
- index_type size_;
-};
-
-} // namespace st_
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 343cb0e741a..ccc70206ede 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -652,14 +652,14 @@ Use MONITOR_DEC if appropriate mutex protection exists.
} \
}
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind_or_MSAN
# define MONITOR_CHECK_DEFINED(value) do { \
mon_type_t m = value; \
- UNIV_MEM_ASSERT_RW(&m, sizeof m); \
+ MEM_CHECK_DEFINED(&m, sizeof m); \
} while (0)
-#else /* UNIV_DEBUG_VALGRIND */
+#else /* HAVE_valgrind_or_MSAN */
# define MONITOR_CHECK_DEFINED(value) (void) 0
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind_or_MSAN */
#define MONITOR_INC_VALUE(monitor, value) \
MONITOR_CHECK_DEFINED(value); \
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index c1dcb2273e6..5214953f308 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -518,6 +518,8 @@ enum srv_operation_mode {
SRV_OPERATION_BACKUP,
/** Mariabackup restoring a backup for subsequent --copy-back */
SRV_OPERATION_RESTORE,
+ /** Mariabackup restoring a backup with rolling back prepared XA's*/
+ SRV_OPERATION_RESTORE_ROLLBACK_XA,
/** Mariabackup restoring the incremental part of a backup */
SRV_OPERATION_RESTORE_DELTA,
/** Mariabackup restoring a backup for subsequent --export */
@@ -527,6 +529,21 @@ enum srv_operation_mode {
/** Current mode of operation */
extern enum srv_operation_mode srv_operation;
+inline bool is_mariabackup_restore()
+{
+ /* To rollback XA's trx_sys must be initialized, the rest is the same
+ as regular backup restore, that is why we join this two operations in
+ the most cases. */
+ return srv_operation == SRV_OPERATION_RESTORE
+ || srv_operation == SRV_OPERATION_RESTORE_ROLLBACK_XA;
+}
+
+inline bool is_mariabackup_restore_or_export()
+{
+ return is_mariabackup_restore()
+ || srv_operation == SRV_OPERATION_RESTORE_EXPORT;
+}
+
extern my_bool srv_print_innodb_monitor;
extern my_bool srv_print_innodb_lock_monitor;
extern ibool srv_print_verbose_log;
@@ -1130,13 +1147,6 @@ struct srv_slot_t{
to do */
que_thr_t* thr; /*!< suspended query thread
(only used for user threads) */
-#ifdef UNIV_DEBUG
- struct debug_sync_t {
- UT_LIST_NODE_T(debug_sync_t) debug_sync_list;
- };
- UT_LIST_BASE_NODE_T(debug_sync_t) debug_sync;
- rw_lock_t debug_sync_lock;
-#endif
};
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index 8b39733335d..e559814b33d 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -113,6 +113,8 @@ extern ibool srv_start_raw_disk_in_use;
/** Shutdown state */
enum srv_shutdown_t {
SRV_SHUTDOWN_NONE = 0, /*!< Database running normally */
+ /** Shutdown initiated in srv_shutdown_bg_undo_sources() */
+ SRV_SHUTDOWN_INITIATED,
SRV_SHUTDOWN_CLEANUP, /*!< Cleaning up in
logs_empty_and_mark_files_at_shutdown() */
SRV_SHUTDOWN_FLUSH_PHASE,/*!< At this phase the master and the
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index e0451d66de1..b2a436804fe 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -577,12 +577,6 @@ struct rw_lock_t
/** number of granted SX locks. */
volatile ulint sx_recursive;
- /** This is TRUE if the writer field is RW_LOCK_X_WAIT; this field
- is located far from the memory update hotspot fields which are at
- the start of this struct, thus we can peek this field without
- causing much memory bus traffic */
- bool writer_is_wait_ex;
-
/** The value is typically set to thread id of a writer thread making
normal rw_locks recursive. In case of asynchronous IO, when a non-zero
value of 'pass' is passed then we keep the lock non-recursive.
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 0d8bd0a4509..037bf8047cd 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -3,6 +3,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -59,9 +60,7 @@ extern mysql_pfs_key_t dict_sys_mutex_key;
extern mysql_pfs_key_t file_format_max_mutex_key;
extern mysql_pfs_key_t fil_system_mutex_key;
extern mysql_pfs_key_t flush_list_mutex_key;
-extern mysql_pfs_key_t fts_bg_threads_mutex_key;
extern mysql_pfs_key_t fts_delete_mutex_key;
-extern mysql_pfs_key_t fts_optimize_mutex_key;
extern mysql_pfs_key_t fts_doc_id_mutex_key;
extern mysql_pfs_key_t fts_pll_tokenize_mutex_key;
extern mysql_pfs_key_t hash_table_mutex_key;
@@ -81,7 +80,6 @@ extern mysql_pfs_key_t recv_writer_mutex_key;
extern mysql_pfs_key_t rtr_active_mutex_key;
extern mysql_pfs_key_t rtr_match_mutex_key;
extern mysql_pfs_key_t rtr_path_mutex_key;
-extern mysql_pfs_key_t rtr_ssn_mutex_key;
extern mysql_pfs_key_t redo_rseg_mutex_key;
extern mysql_pfs_key_t noredo_rseg_mutex_key;
extern mysql_pfs_key_t page_zip_stat_per_index_mutex_key;
@@ -128,7 +126,6 @@ extern mysql_pfs_key_t trx_i_s_cache_lock_key;
extern mysql_pfs_key_t trx_purge_latch_key;
extern mysql_pfs_key_t index_tree_rw_lock_key;
extern mysql_pfs_key_t index_online_log_key;
-extern mysql_pfs_key_t dict_table_stats_key;
extern mysql_pfs_key_t trx_sys_rw_lock_key;
extern mysql_pfs_key_t hash_table_locks_key;
#endif /* UNIV_PFS_RWLOCK */
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 9b1443523c7..563176f4abe 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -219,7 +219,6 @@ enum latch_level_t {
SYNC_FTS_TOKENIZE,
SYNC_FTS_OPTIMIZE,
- SYNC_FTS_BG_THREADS,
SYNC_FTS_CACHE_INIT,
SYNC_RECV,
SYNC_LOG_FLUSH_ORDER,
@@ -228,7 +227,6 @@ enum latch_level_t {
SYNC_PAGE_CLEANER,
SYNC_PURGE_QUEUE,
SYNC_TRX_SYS_HEADER,
- SYNC_REC_LOCK,
SYNC_THREADS,
SYNC_TRX,
SYNC_TRX_SYS,
@@ -305,9 +303,7 @@ enum latch_id_t {
LATCH_ID_FILE_FORMAT_MAX,
LATCH_ID_FIL_SYSTEM,
LATCH_ID_FLUSH_LIST,
- LATCH_ID_FTS_BG_THREADS,
LATCH_ID_FTS_DELETE,
- LATCH_ID_FTS_OPTIMIZE,
LATCH_ID_FTS_DOC_ID,
LATCH_ID_FTS_PLL_TOKENIZE,
LATCH_ID_HASH_TABLE_MUTEX,
@@ -327,7 +323,6 @@ enum latch_id_t {
LATCH_ID_REDO_RSEG,
LATCH_ID_NOREDO_RSEG,
LATCH_ID_RW_LOCK_DEBUG,
- LATCH_ID_RTR_SSN_MUTEX,
LATCH_ID_RTR_ACTIVE_MUTEX,
LATCH_ID_RTR_MATCH_MUTEX,
LATCH_ID_RTR_PATH_MUTEX,
@@ -380,7 +375,6 @@ enum latch_id_t {
LATCH_ID_BTR_DEFRAGMENT_MUTEX,
LATCH_ID_MTFLUSH_THREAD_MUTEX,
LATCH_ID_MTFLUSH_MUTEX,
- LATCH_ID_FIL_CRYPT_MUTEX,
LATCH_ID_FIL_CRYPT_STAT_MUTEX,
LATCH_ID_FIL_CRYPT_DATA_MUTEX,
LATCH_ID_FIL_CRYPT_THREADS_MUTEX,
@@ -665,10 +659,10 @@ public:
}
/** Iterate over the counters */
- template <typename Callback>
- void iterate(Callback& callback) const
- UNIV_NOTHROW
+ template<typename C> void iterate(const C& callback) UNIV_NOTHROW
{
+ m_mutex.enter();
+
Counters::const_iterator end = m_counters.end();
for (Counters::const_iterator it = m_counters.begin();
@@ -677,6 +671,8 @@ public:
callback(*it);
}
+
+ m_mutex.exit();
}
/** Disable the monitoring */
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index ab9ae8a1f43..be06db4c954 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -207,7 +207,7 @@ trx_undo_report_row_operation(
const rec_t* rec, /*!< in: case of an update or delete
marking, the record in the clustered
index; NULL if insert */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
@@ -240,7 +240,7 @@ trx_undo_prev_version_build(
index_rec page and purge_view */
const rec_t* rec, /*!< in: version of a clustered index record */
dict_index_t* index, /*!< in: clustered index */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mem_heap_t* heap, /*!< in: memory heap from which the memory
needed is allocated */
rec_t** old_vers,/*!< out, own: previous version, or NULL if
diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h
index cae548d442b..0fd6973e551 100644
--- a/storage/innobase/include/trx0roll.h
+++ b/storage/innobase/include/trx0roll.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -35,15 +35,6 @@ extern bool trx_rollback_or_clean_is_active;
extern const trx_t* trx_roll_crash_recv_trx;
/*******************************************************************//**
-Determines if this transaction is rolling back an incomplete transaction
-in crash recovery.
-@return TRUE if trx is an incomplete transaction that is being rolled
-back in crash recovery */
-ibool
-trx_is_recv(
-/*========*/
- const trx_t* trx); /*!< in: transaction */
-/*******************************************************************//**
Returns a transaction savepoint taken at this point in time.
@return savepoint */
trx_savept_t
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 1d71920d6c5..4161d4d8563 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -73,12 +73,9 @@ Creates a transaction object for MySQL.
trx_t*
trx_allocate_for_mysql(void);
/*========================*/
-/********************************************************************//**
-Creates a transaction object for background operations by the master thread.
-@return own: transaction object */
-trx_t*
-trx_allocate_for_background(void);
-/*=============================*/
+
+/** @return allocated transaction object for internal operations */
+trx_t *trx_allocate_for_background();
/** Frees and initialize a transaction object instantinated during recovery.
@param trx trx object to free and initialize during recovery */
@@ -432,13 +429,6 @@ ibool
trx_is_interrupted(
/*===============*/
const trx_t* trx); /*!< in: transaction */
-/**********************************************************************//**
-Determines if the currently running transaction is in strict mode.
-@return TRUE if strict */
-ibool
-trx_is_strict(
-/*==========*/
- trx_t* trx); /*!< in: transaction */
/*******************************************************************//**
Calculates the "weight" of a transaction. The weight of one transaction
@@ -560,6 +550,7 @@ Check transaction state */
ut_ad(!(t)->id); \
ut_ad(!(t)->has_logged()); \
ut_ad(!(t)->is_referenced()); \
+ ut_ad(!(t)->is_wsrep()); \
ut_ad(!MVCC::is_view_active((t)->read_view)); \
ut_ad((t)->lock.wait_thr == NULL); \
ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \
@@ -880,6 +871,13 @@ public:
rolled back by trx_rollback_or_clean_recovered().
Protected by trx_t::mutex for transactions that are in trx_sys. */
bool is_recovered;
+#ifdef WITH_WSREP
+ /** whether wsrep_on(mysql_thd) held at the start of transaction */
+ bool wsrep;
+ bool is_wsrep() const { return UNIV_UNLIKELY(wsrep); }
+#else /* WITH_WSREP */
+ bool is_wsrep() const { return false; }
+#endif /* WITH_WSREP */
ReadView* read_view; /*!< consistent read view used in the
transaction, or NULL if not yet set */
@@ -916,7 +914,8 @@ public:
the coordinator using the XA API, and
is set to false after commit or
rollback. */
- unsigned active_commit_ordered:1;/* 1 if owns prepare mutex */
+ /** whether this is holding the prepare mutex */
+ bool active_commit_ordered;
/*------------------------------*/
bool check_unique_secondary;
/*!< normally TRUE, but if the user
@@ -1203,6 +1202,9 @@ public:
ut_ad(old_n_ref > 0);
}
+ /** Free the memory to trx_pools */
+ inline void free();
+
private:
/** Assign a rollback segment for modifying temporary tables.
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index bf2d3c7f7f7..99330453c33 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -424,8 +424,6 @@ struct trx_undo_t {
undo_no_t top_undo_no; /*!< undo number of the latest record */
buf_block_t* guess_block; /*!< guess for the buffer block where
the top page might reside */
- ulint withdraw_clock; /*!< the withdraw clock value of the
- buffer pool when guess_block was stored */
/*-----------------------------*/
UT_LIST_NODE_T(trx_undo_t) undo_list;
/*!< undo log objects in the rollback
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 7635cecbcd3..7819b0ae92b 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 7
-#define INNODB_VERSION_BUGFIX 28
+#define INNODB_VERSION_BUGFIX 32
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -178,10 +178,6 @@ command. */
#define UNIV_ENABLE_UNIT_TEST_ROW_RAW_FORMAT_INT
*/
-#if defined HAVE_valgrind && defined HAVE_VALGRIND_MEMCHECK_H
-# define UNIV_DEBUG_VALGRIND
-#endif
-
#ifdef DBUG_OFF
# undef UNIV_DEBUG
#elif !defined UNIV_DEBUG
@@ -189,8 +185,6 @@ command. */
#endif
#if 0
-#define UNIV_DEBUG_VALGRIND /* Enable extra
- Valgrind instrumentation */
#define UNIV_DEBUG_PRINT /* Enable the compilation of
some debug print functions */
#define UNIV_AHI_DEBUG /* Enable adaptive hash index
@@ -616,57 +610,6 @@ 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_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 { \
- const void* _p = (const void*) (ulint) \
- VALGRIND_CHECK_MEM_IS_DEFINED(addr, size); \
- if (UNIV_LIKELY_NULL(_p)) { \
- fprintf(stderr, "%s:%d: %p[%u] undefined at %ld\n", \
- __FILE__, __LINE__, \
- (const void*) (addr), (unsigned) (size), (long) \
- (((const char*) _p) - ((const char*) (addr)))); \
- if (should_abort) { \
- ut_error; \
- } \
- } \
-} while (0)
-# define UNIV_MEM_ASSERT_RW(addr, size) \
- UNIV_MEM_ASSERT_RW_LOW(addr, size, false)
-# define UNIV_MEM_ASSERT_RW_ABORT(addr, size) \
- UNIV_MEM_ASSERT_RW_LOW(addr, size, true)
-# define UNIV_MEM_ASSERT_W(addr, size) do { \
- const void* _p = (const void*) (ulint) \
- VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, size); \
- if (UNIV_LIKELY_NULL(_p)) \
- fprintf(stderr, "%s:%d: %p[%u] unwritable at %ld\n", \
- __FILE__, __LINE__, \
- (const void*) (addr), (unsigned) (size), (long) \
- (((const char*) _p) - ((const char*) (addr)))); \
- } while (0)
-# define UNIV_MEM_TRASH(addr, c, size) do { \
- ut_d(memset(addr, c, size)); \
- UNIV_MEM_INVALID(addr, size); \
- } while (0)
-#else
-# define UNIV_MEM_VALID(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)
-# define UNIV_MEM_ASSERT_RW(addr, size) do {} while(0)
-# define UNIV_MEM_ASSERT_RW_ABORT(addr, size) do {} while(0)
-# define UNIV_MEM_ASSERT_W(addr, size) do {} while(0)
-# define UNIV_MEM_TRASH(addr, c, size) do {} while(0)
-#endif
-
extern ulong srv_page_size_shift;
extern ulong srv_page_size;
diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h
index 1f99ee17a24..5375be0ed71 100644
--- a/storage/innobase/include/ut0mutex.h
+++ b/storage/innobase/include/ut0mutex.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, 2020, 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
@@ -142,16 +142,10 @@ public:
/* Some of the slots will be null in non-debug mode */
- if (*it == NULL) {
- continue;
- }
-
- latch_meta_t* latch_meta = *it;
-
- bool ret = callback(*latch_meta);
-
- if (!ret) {
- return(ret);
+ if (latch_meta_t* l= *it) {
+ if (!callback(*l)) {
+ return false;
+ }
}
}
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index f7bc4c5ebdf..749c4188edf 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2018, 2020, 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
@@ -86,11 +87,6 @@ struct Pool {
for (Element* elem = m_start; elem != m_last; ++elem) {
ut_ad(elem->m_pool == this);
- /* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
- /* Declare the contents as initialized for Valgrind;
- we checked this in mem_free(). */
- UNIV_MEM_VALID(&elem->m_type, sizeof elem->m_type);
Factory::destroy(&elem->m_type);
}
@@ -125,18 +121,6 @@ struct Pool {
elem = NULL;
}
-#if defined HAVE_valgrind || defined __SANITIZE_ADDRESS__
- if (elem) {
- /* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
- /* Declare the memory initialized for Valgrind.
- The trx_t that are released to the pool are
- actually initialized; we checked that by
- UNIV_MEM_ASSERT_RW() in mem_free() below. */
- UNIV_MEM_VALID(&elem->m_type, sizeof elem->m_type);
- }
-#endif
-
m_lock_strategy.exit();
return elem ? &elem->m_type : NULL;
}
@@ -149,12 +133,10 @@ struct Pool {
byte* p = reinterpret_cast<byte*>(ptr + 1);
elem = reinterpret_cast<Element*>(p - sizeof(*elem));
- UNIV_MEM_ASSERT_RW(&elem->m_type, sizeof elem->m_type);
elem->m_pool->m_lock_strategy.enter();
elem->m_pool->putl(elem);
- MEM_NOACCESS(&elem->m_type, sizeof elem->m_type);
elem->m_pool->m_lock_strategy.exit();
}
@@ -177,9 +159,6 @@ private:
void putl(Element* elem)
{
ut_ad(elem >= m_start && elem < m_last);
-
- ut_ad(Factory::debug(&elem->m_type));
-
m_pqueue.push(elem);
}
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index b6d4d4abbd2..9af8687bfd0 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+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
@@ -27,46 +28,48 @@ Created 1/20/1994 Heikki Tuuri
#define ut0rnd_h
#include "ut0byte.h"
+#include <my_sys.h>
#ifndef UNIV_INNOCHECKSUM
-/** The 'character code' for end of field or string (used
-in folding records */
-#define UT_END_OF_FIELD 257
-
-/********************************************************//**
-This is used to set the random number seed. */
-UNIV_INLINE
-void
-ut_rnd_set_seed(
-/*============*/
- ulint seed); /*!< in: seed */
-/********************************************************//**
-The following function generates a series of 'random' ulint integers.
-@return the next 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_next_ulint(
-/*==================*/
- ulint rnd); /*!< in: the previous random number value */
-/*********************************************************//**
-The following function generates 'random' ulint integers which
-enumerate the value space (let there be N of them) of ulint integers
-in a pseudo-random fashion. Note that the same integer is repeated
-always after N calls to the generator.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_ulint(void);
-/*==================*/
-/********************************************************//**
-Generates a random integer from a given interval.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_interval(
-/*============*/
- ulint low, /*!< in: low limit; can generate also this value */
- ulint high); /*!< in: high limit; can generate also this value */
+/** Seed value of ut_rnd_gen() */
+extern int32 ut_rnd_current;
+
+/** @return a pseudo-random 32-bit number */
+inline uint32_t ut_rnd_gen()
+{
+ /* This is a Galois linear-feedback shift register.
+ https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Galois_LFSRs
+ The generating primitive Galois Field polynomial is the Castagnoli
+ polynomial that was made popular by CRC-32C:
+ x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+
+ x^19+x^18+x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 */
+ const uint32_t crc32c= 0x1edc6f41;
+
+ uint32_t rnd= my_atomic_load32_explicit(&ut_rnd_current,
+ MY_MEMORY_ORDER_RELAXED);
+
+ if (UNIV_UNLIKELY(rnd == 0))
+ {
+ rnd= static_cast<uint32_t>(my_interval_timer());
+ if (!rnd) rnd= 1;
+ }
+ else
+ {
+ bool lsb= rnd & 1;
+ rnd>>= 1;
+ if (lsb)
+ rnd^= crc32c;
+ }
+
+ my_atomic_store32_explicit(&ut_rnd_current, rnd, MY_MEMORY_ORDER_RELAXED);
+ return rnd;
+}
+
+/** @return a random number between 0 and n-1, inclusive */
+inline ulint ut_rnd_interval(ulint n)
+{
+ return n > 1 ? static_cast<ulint>(ut_rnd_gen() % n) : 0;
+}
/*******************************************************//**
The following function generates a hash value for a ulint integer
diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
index 0003c42baad..c0105160a42 100644
--- a/storage/innobase/include/ut0rnd.ic
+++ b/storage/innobase/include/ut0rnd.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 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
@@ -29,98 +29,6 @@ Created 5/30/1994 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
-#define UT_RND1 151117737
-#define UT_RND2 119785373
-#define UT_RND3 85689495
-#define UT_RND4 76595339
-#define UT_SUM_RND2 98781234
-#define UT_SUM_RND3 126792457
-#define UT_SUM_RND4 63498502
-#define UT_XOR_RND1 187678878
-#define UT_XOR_RND2 143537923
-
-/** Seed value of ut_rnd_gen_ulint() */
-extern ulint ut_rnd_ulint_counter;
-
-/********************************************************//**
-This is used to set the random number seed. */
-UNIV_INLINE
-void
-ut_rnd_set_seed(
-/*============*/
- ulint seed) /*!< in: seed */
-{
- ut_rnd_ulint_counter = seed;
-}
-
-/********************************************************//**
-The following function generates a series of 'random' ulint integers.
-@return the next 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_next_ulint(
-/*==================*/
- ulint rnd) /*!< in: the previous random number value */
-{
- ulint n_bits;
-
- n_bits = 8 * sizeof(ulint);
-
- rnd = UT_RND2 * rnd + UT_SUM_RND3;
- rnd = UT_XOR_RND1 ^ rnd;
- rnd = (rnd << 20) + (rnd >> (n_bits - 20));
- rnd = UT_RND3 * rnd + UT_SUM_RND4;
- rnd = UT_XOR_RND2 ^ rnd;
- rnd = (rnd << 20) + (rnd >> (n_bits - 20));
- rnd = UT_RND1 * rnd + UT_SUM_RND2;
-
- return(rnd);
-}
-
-/********************************************************//**
-The following function generates 'random' ulint integers which
-enumerate the value space of ulint integers in a pseudo random
-fashion. Note that the same integer is repeated always after
-2 to power 32 calls to the generator (if ulint is 32-bit).
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_ulint(void)
-/*==================*/
-{
- ulint rnd;
-
- ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
-
- rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
-
- return(rnd);
-}
-
-/********************************************************//**
-Generates a random integer from a given interval.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_interval(
-/*============*/
- ulint low, /*!< in: low limit; can generate also this value */
- ulint high) /*!< in: high limit; can generate also this value */
-{
- ulint rnd;
-
- ut_ad(high >= low);
-
- if (low == high) {
-
- return(low);
- }
-
- rnd = ut_rnd_gen_ulint();
-
- return(low + (rnd % (high - low)));
-}
-
/*******************************************************//**
The following function generates a hash value for a ulint integer
to a hash table of size table_size, which should be a prime
diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h
index 000d8b6b379..a19f3db188d 100644
--- a/storage/innobase/include/ut0ut.h
+++ b/storage/innobase/include/ut0ut.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, 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
@@ -389,48 +389,41 @@ operator<<(
It contains a std::ostringstream object. The main purpose of this class is
to forward operator<< to the underlying std::ostringstream object. Do not
use this class directly, instead use one of the derived classes. */
-class logger {
-public:
- template<typename T>
- ATTRIBUTE_COLD
- logger& operator<<(const T& rhs)
- {
- m_oss << rhs;
- return(*this);
- }
-
- /** Write the given buffer to the internal string stream object.
- @param[in] buf the buffer whose contents will be logged.
- @param[in] count the length of the buffer buf.
- @return the output stream into which buffer was written. */
- ATTRIBUTE_COLD
- std::ostream&
- write(
- const char* buf,
- std::streamsize count)
- {
- return(m_oss.write(buf, count));
- }
-
- /** Write the given buffer to the internal string stream object.
- @param[in] buf the buffer whose contents will be logged.
- @param[in] count the length of the buffer buf.
- @return the output stream into which buffer was written. */
- ATTRIBUTE_COLD
- std::ostream&
- write(
- const byte* buf,
- std::streamsize count)
- {
- return(m_oss.write(reinterpret_cast<const char*>(buf), count));
- }
-
- std::ostringstream m_oss;
+class logger
+{
protected:
- /* This class must not be used directly, hence making the default
- constructor protected. */
- ATTRIBUTE_COLD
- logger() {}
+ /* This class must not be used directly */
+ ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() {}
+public:
+ template<typename T> ATTRIBUTE_COLD ATTRIBUTE_NOINLINE
+ logger& operator<<(const T& rhs)
+ {
+ m_oss << rhs;
+ return *this;
+ }
+
+ /** Handle a fixed character string in the same way as a pointer to
+ an unknown-length character string, to reduce object code bloat. */
+ template<size_t N> logger& operator<<(const char (&rhs)[N])
+ { return *this << static_cast<const char*>(rhs); }
+
+ /** Output an error code name */
+ ATTRIBUTE_COLD logger& operator<<(dberr_t err);
+
+ /** Append a string.
+ @param buf string buffer
+ @param size buffer size
+ @return the output stream */
+ ATTRIBUTE_COLD __attribute__((noinline))
+ std::ostream &write(const char *buf, std::streamsize size)
+ {
+ return m_oss.write(buf, size);
+ }
+
+ std::ostream &write(const byte *buf, std::streamsize size)
+ { return write(reinterpret_cast<const char*>(buf), size); }
+
+ std::ostringstream m_oss;
};
/** The class info is used to emit informational log messages. It is to be
@@ -464,6 +457,14 @@ class error : public logger {
public:
ATTRIBUTE_COLD
~error();
+ /** Indicates that error::~error() was invoked. Can be used to
+ determine if error messages were logged during innodb code execution.
+ @return true if there were error messages, false otherwise. */
+ static bool was_logged() { return logged; }
+
+private:
+ /** true if error::~error() was invoked, false otherwise */
+ static bool logged;
};
/** The class fatal is used to emit an error message and stop the server
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index dbe3f8881e7..523176b4530 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -100,7 +100,8 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR
- CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
+ CMAKE_SYSTEM_PROCESSOR MATCHES "i386" AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-fno-builtin-memcmp" HAVE_NO_BUILTIN_MEMCMP)
IF (HAVE_NO_BUILTIN_MEMCMP)
@@ -176,11 +177,6 @@ IF(NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
ENDIF()
- CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
- IF(HAVE_POSIX_MEMALIGN)
- ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
- ENDIF()
-
# Only use futexes on Linux if GCC atomics are available
IF(NOT MSVC AND NOT CMAKE_CROSSCOMPILING)
CHECK_C_SOURCE_RUNS(
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 9fdc8feee90..913c80027bf 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, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -320,17 +320,18 @@ static FILE* lock_latest_err_file;
/*********************************************************************//**
Reports that a transaction id is insensible, i.e., in the future. */
+ATTRIBUTE_COLD
void
lock_report_trx_id_insanity(
/*========================*/
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */
trx_id_t max_trx_id) /*!< in: trx_sys_get_max_trx_id() */
{
ib::error()
- << "Transaction id " << trx_id
+ << "Transaction id " << ib::hex(trx_id)
<< " associated with record" << rec_offsets_print(rec, offsets)
<< " in index " << index->name
<< " of table " << index->table->name
@@ -352,14 +353,14 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets) /*!< in: rec_get_offsets(rec, index) */
{
ut_ad(rec_offs_validate(rec, index, offsets));
trx_id_t max_trx_id = trx_sys_get_max_trx_id();
bool is_ok = trx_id < max_trx_id;
- if (!is_ok) {
+ if (UNIV_UNLIKELY(!is_ok)) {
lock_report_trx_id_insanity(
trx_id, rec, index, offsets, max_trx_id);
}
@@ -377,7 +378,7 @@ lock_clust_rec_cons_read_sees(
const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ReadView* view) /*!< in: consistent read view */
{
ut_ad(dict_index_is_clust(index));
@@ -643,6 +644,57 @@ lock_rec_get_insert_intention(
return(lock->type_mode & LOCK_INSERT_INTENTION);
}
+#ifdef WITH_WSREP
+/** Check if both conflicting lock and other record lock are brute force
+(BF). This case is a bug so report lock information and wsrep state.
+@param[in] lock_rec1 conflicting waiting record lock or NULL
+@param[in] lock_rec2 other waiting record lock
+@param[in] trx1 lock_rec1 can be NULL, trx
+*/
+static void wsrep_assert_no_bf_bf_wait(
+ const lock_t* lock_rec1,
+ const lock_t* lock_rec2,
+ const trx_t* trx1)
+{
+ ut_ad(!lock_rec1 || lock_get_type_low(lock_rec1) == LOCK_REC);
+ ut_ad(lock_get_type_low(lock_rec2) == LOCK_REC);
+
+ if (!trx1->is_wsrep() || !lock_rec2->trx->is_wsrep())
+ return;
+ if (UNIV_LIKELY(!wsrep_thd_is_BF(trx1->mysql_thd, FALSE)))
+ return;
+ if (UNIV_LIKELY(!wsrep_thd_is_BF(lock_rec2->trx->mysql_thd, FALSE)))
+ return;
+
+ mtr_t mtr;
+
+ if (lock_rec1) {
+ ib::error() << "Waiting lock on table: "
+ << lock_rec1->index->table->name
+ << " index: "
+ << lock_rec1->index->name()
+ << " that has conflicting lock ";
+ lock_rec_print(stderr, lock_rec1, mtr);
+ }
+
+ ib::error() << "Conflicting lock on table: "
+ << lock_rec2->index->table->name
+ << " index: "
+ << lock_rec2->index->name()
+ << " that has lock ";
+ lock_rec_print(stderr, lock_rec2, mtr);
+
+ ib::error() << "WSREP state: ";
+
+ wsrep_report_bf_lock_wait(trx1->mysql_thd,
+ trx1->id);
+ wsrep_report_bf_lock_wait(lock_rec2->trx->mysql_thd,
+ lock_rec2->trx->id);
+ /* BF-BF wait is a bug */
+ ut_error;
+}
+#endif /* WITH_WSREP */
+
/*********************************************************************//**
Checks if a lock request for a new lock has to wait for request lock2.
@return TRUE if new lock has to wait for lock2 to be removed */
@@ -750,69 +802,9 @@ lock_rec_has_to_wait(
}
#ifdef WITH_WSREP
- /* if BF thread is locking and has conflict with another BF
- thread, we need to look at trx ordering and lock types */
- if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
- wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) {
- mtr_t mtr;
-
- if (wsrep_debug) {
- ib::info() <<
- "BF-BF lock conflict, locking: " << for_locking;
- lock_rec_print(stderr, lock2, mtr);
- ib::info() << " SQL1: "
- << wsrep_thd_query(trx->mysql_thd);
- ib::info() << " SQL2: "
- << 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 &&
- (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X) {
- if (for_locking || wsrep_debug) {
- /* exclusive lock conflicts are not
- accepted */
- ib::info() <<
- "BF-BF X lock conflict,"
- "mode: " << type_mode <<
- " supremum: " << lock_is_on_supremum;
- ib::info() <<
- "conflicts states: my "
- << wsrep_thd_conflict_state(trx->mysql_thd, FALSE)
- << " locked "
- << wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE);
- lock_rec_print(stderr, lock2, mtr);
- ib::info() << " SQL1: "
- << wsrep_thd_query(trx->mysql_thd);
- ib::info() << " SQL2: "
- << wsrep_thd_query(lock2->trx->mysql_thd);
-
- if (for_locking) {
- return FALSE;
- }
- }
- } else {
- /* if lock2->index->n_uniq <=
- lock2->index->n_user_defined_cols
- operation is on uniq index
- */
- if (wsrep_debug) {
- ib::info() <<
- "BF conflict, modes: "
- << type_mode << ":" << lock2->type_mode
- << " idx: " << lock2->index->name()
- << " table: " << lock2->index->table->name.m_name
- << " n_uniq: " << lock2->index->n_uniq
- << " n_user: " << lock2->index->n_user_defined_cols;
- ib::info() << " SQL1: "
- << wsrep_thd_query(trx->mysql_thd);
- ib::info() << " SQL2: "
- << wsrep_thd_query(lock2->trx->mysql_thd);
- }
- return FALSE;
- }
- }
+ /* There should not be two conflicting locks that are
+ brute force. If there is it is a bug. */
+ wsrep_assert_no_bf_bf_wait(NULL, lock2, trx);
#endif /* WITH_WSREP */
return(TRUE);
@@ -1100,12 +1092,10 @@ wsrep_kill_victim(
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
- if (!wsrep_on(trx->mysql_thd)) {
- return;
- }
+ if (!trx->is_wsrep()) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
- my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
+ my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE);
mtr_t mtr;
if ((bf_this && !bf_other) ||
@@ -1113,7 +1103,7 @@ wsrep_kill_victim(
trx->mysql_thd, lock->trx->mysql_thd))) {
if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::info() << "WSREP: BF victim waiting\n";
}
/* cannot release lock, until our lock
@@ -1185,7 +1175,7 @@ lock_rec_other_has_conflicting(
if (lock_rec_has_to_wait(true, trx, mode, lock, is_supremum)) {
#ifdef WITH_WSREP
- if (wsrep_on_trx(trx)) {
+ if (trx->is_wsrep()) {
trx_mutex_enter(lock->trx);
/* Below function will roll back either trx
or lock->trx depending on priority of the
@@ -1214,7 +1204,7 @@ lock_sec_rec_some_has_impl(
/*=======================*/
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: secondary index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
trx_t* trx;
trx_id_t max_trx_id;
@@ -1346,13 +1336,14 @@ lock_number_of_tables_locked(
/*============== RECORD LOCK CREATION AND QUEUE MANAGEMENT =============*/
#ifdef WITH_WSREP
+ATTRIBUTE_COLD
static
void
wsrep_print_wait_locks(
/*===================*/
lock_t* c_lock) /* conflicting lock to print */
{
- if (wsrep_debug && c_lock->trx->lock.wait_lock != c_lock) {
+ if (c_lock->trx->lock.wait_lock != c_lock) {
mtr_t mtr;
ib::info() << "WSREP: c_lock != wait lock";
ib::info() << " SQL: "
@@ -1478,12 +1469,12 @@ lock_rec_create_low(
ut_ad(index->table->get_ref_count() > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
- if (c_lock && wsrep_on_trx(trx)
+ if (c_lock && trx->is_wsrep()
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
- while (hash && wsrep_thd_is_BF(hash->trx->mysql_thd, TRUE)
+ while (hash && wsrep_thd_is_BF(hash->trx->mysql_thd, FALSE)
&& wsrep_trx_order_before(hash->trx->mysql_thd,
trx->mysql_thd)) {
prev = hash;
@@ -1504,7 +1495,7 @@ lock_rec_create_low(
c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE;
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
wsrep_print_wait_locks(c_lock);
}
@@ -1531,12 +1522,9 @@ lock_rec_create_low(
trx_mutex_exit(c_lock->trx);
- if (wsrep_debug) {
- ib::info() << "WSREP: c_lock canceled "
- << ib::hex(c_lock->trx->id)
- << " SQL: "
- << wsrep_thd_query(
- c_lock->trx->mysql_thd);
+ if (UNIV_UNLIKELY(wsrep_debug)) {
+ wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id);
+ wsrep_report_bf_lock_wait(c_lock->trx->mysql_thd, c_lock->trx->id);
}
/* have to bail out here to avoid lock_set_lock... */
@@ -1615,6 +1603,7 @@ lock_rec_insert_by_trx_age(
hash_table_t* hash;
hash_cell_t* cell;
+ ut_ad(!in_lock->trx->is_wsrep());
space = in_lock->un_member.rec_lock.space;
page_no = in_lock->un_member.rec_lock.page_no;
rec_fold = lock_rec_fold(space, page_no);
@@ -1796,7 +1785,7 @@ lock_rec_enqueue_waiting(
transaction as a victim, it is possible that we
already have the lock now granted! */
#ifdef WITH_WSREP
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::info() << "WSREP: BF thread got lock granted early, ID " << ib::hex(trx->id)
<< " query: " << wsrep_thd_query(trx->mysql_thd);
}
@@ -1877,30 +1866,19 @@ lock_rec_add_to_queue(
= lock_rec_other_has_expl_req(
mode, block, false, heap_no, trx);
#ifdef WITH_WSREP
- //ut_a(!other_lock || (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
- // wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)));
- if (other_lock &&
- wsrep_on(trx->mysql_thd) &&
- !wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
- !wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)) {
-
- 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_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_trx_seqno(otrx->mysql_thd) << " SQL: " <<
- wsrep_thd_query(otrx->mysql_thd);
- }
-#else
- ut_a(!other_lock);
+ if (UNIV_UNLIKELY(other_lock && trx->is_wsrep())) {
+ /* Only BF transaction may be granted lock
+ before other conflicting lock request. */
+ if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)
+ && !wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)) {
+ /* If it is not BF, this case is a bug. */
+ wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id);
+ wsrep_report_bf_lock_wait(other_lock->trx->mysql_thd, other_lock->trx->id);
+ ut_error;
+ }
+ } else
#endif /* WITH_WSREP */
+ ut_ad(!other_lock);
}
#endif /* UNIV_DEBUG */
@@ -2191,6 +2169,7 @@ lock_rec_has_to_wait_in_queue(
ulint bit_offset;
hash_table_t* hash;
+ ut_ad(wait_lock);
ut_ad(lock_mutex_own());
ut_ad(lock_get_wait(wait_lock));
ut_ad(lock_get_type_low(wait_lock) == LOCK_REC);
@@ -2207,29 +2186,11 @@ lock_rec_has_to_wait_in_queue(
for (lock = lock_rec_get_first_on_page_addr(hash, space, page_no);
lock != wait_lock;
lock = lock_rec_get_next_on_page_const(lock)) {
-
const byte* p = (const byte*) &lock[1];
if (heap_no < lock_rec_get_n_bits(lock)
&& (p[bit_offset] & bit_mask)
&& lock_has_to_wait(wait_lock, lock)) {
-#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(wait_lock->trx->mysql_thd, FALSE) &&
- wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE)) {
- if (wsrep_debug) {
- mtr_t mtr;
- ib::info() << "WSREP: waiting BF trx: " << ib::hex(wait_lock->trx->id)
- << " query: " << wsrep_thd_query(wait_lock->trx->mysql_thd);
- lock_rec_print(stderr, wait_lock, mtr);
- ib::info() << "WSREP: do not wait another BF trx: " << ib::hex(lock->trx->id)
- << " query: " << wsrep_thd_query(lock->trx->mysql_thd);
- lock_rec_print(stderr, lock, mtr);
- }
- /* don't wait for another BF lock */
- continue;
- }
-#endif /* WITH_WSREP */
-
return(lock);
}
}
@@ -2350,6 +2311,7 @@ lock_grant_and_move_on_page(ulint rec_fold, ulint space, ulint page_no)
Move granted locks to the head of the list. */
while (lock) {
/* If the lock is a wait lock on this page, and it does not need to wait. */
+ ut_ad(!lock->trx->is_wsrep());
if (lock_get_wait(lock)
&& lock->un_member.rec_lock.space == space
&& lock->un_member.rec_lock.page_no == page_no
@@ -2415,11 +2377,18 @@ static void lock_rec_dequeue_from_page(lock_t* in_lock)
lock != NULL;
lock = lock_rec_get_next_on_page(lock)) {
- if (lock_get_wait(lock)
- && !lock_rec_has_to_wait_in_queue(lock)) {
+ if (!lock_get_wait(lock)) {
+ continue;
+ }
+ const lock_t* c = lock_rec_has_to_wait_in_queue(lock);
+ if (!c) {
/* Grant the lock */
ut_ad(lock->trx != in_lock->trx);
lock_grant(lock);
+#ifdef WITH_WSREP
+ } else {
+ wsrep_assert_no_bf_bf_wait(c, lock, c->trx);
+#endif /* WITH_WSREP */
}
}
} else {
@@ -3656,16 +3625,13 @@ lock_table_create(
UT_LIST_ADD_LAST(trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
- if (c_lock && wsrep_on_trx(trx)) {
+ if (c_lock && trx->is_wsrep()) {
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
ut_list_insert(table->locks, c_lock, lock,
TableLockGetNode());
- if (wsrep_debug) {
- ib::info() << "table lock BF conflict for "
- << ib::hex(c_lock->trx->id)
- << " SQL: "
- << wsrep_thd_query(
- c_lock->trx->mysql_thd);
+ if (UNIV_UNLIKELY(wsrep_debug)) {
+ wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id);
+ wsrep_report_bf_lock_wait(c_lock->trx->mysql_thd, c_lock->trx->id);
}
} else {
ut_list_append(table->locks, lock, TableLockGetNode());
@@ -3676,7 +3642,9 @@ lock_table_create(
if (c_lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
c_lock->trx->lock.was_chosen_as_deadlock_victim = TRUE;
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
+ wsrep_report_bf_lock_wait(trx->mysql_thd, trx->id);
+ wsrep_report_bf_lock_wait(c_lock->trx->mysql_thd, c_lock->trx->id);
wsrep_print_wait_locks(c_lock);
}
@@ -3686,14 +3654,6 @@ lock_table_create(
lock_cancel_waiting_and_release(
c_lock->trx->lock.wait_lock);
trx_mutex_enter(trx);
-
- if (wsrep_debug) {
- ib::info() << "WSREP: c_lock canceled "
- << ib::hex(c_lock->trx->id)
- << " SQL: "
- << wsrep_thd_query(
- c_lock->trx->mysql_thd);
- }
}
trx_mutex_exit(c_lock->trx);
@@ -3886,7 +3846,7 @@ lock_table_enqueue_waiting(
}
#ifdef WITH_WSREP
- if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
+ if (trx->is_wsrep() && trx->lock.was_chosen_as_deadlock_victim) {
return(DB_DEADLOCK);
}
#endif /* WITH_WSREP */
@@ -3959,10 +3919,10 @@ lock_table_other_has_incompatible(
&& (wait || !lock_get_wait(lock))) {
#ifdef WITH_WSREP
- if (wsrep_on(lock->trx->mysql_thd)) {
- if (wsrep_debug) {
+ if (lock->trx->is_wsrep()) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::info() << "WSREP: table lock abort for table:"
- << table->name.m_name;
+ << table->name;
ib::info() << " SQL: "
<< wsrep_thd_query(lock->trx->mysql_thd);
}
@@ -4253,8 +4213,8 @@ lock_grant_and_move_on_rec(
}
/* Grant locks if there are no conflicting locks ahead.
Move granted locks to the head of the list. */
- for (;lock != NULL;) {
-
+ while (lock) {
+ ut_ad(!lock->trx->is_wsrep());
/* If the lock is a wait lock on this page, and it does not need to wait. */
if (lock->un_member.rec_lock.space == space
&& lock->un_member.rec_lock.page_no == page_no
@@ -4349,12 +4309,18 @@ released:
for (lock = first_lock; lock != NULL;
lock = lock_rec_get_next(heap_no, lock)) {
- if (lock_get_wait(lock)
- && !lock_rec_has_to_wait_in_queue(lock)) {
-
+ if (!lock_get_wait(lock)) {
+ continue;
+ }
+ const lock_t* c = lock_rec_has_to_wait_in_queue(lock);
+ if (!c) {
/* Grant the lock */
ut_ad(trx != lock->trx);
lock_grant(lock);
+#ifdef WITH_WSREP
+ } else {
+ wsrep_assert_no_bf_bf_wait(c, lock, c->trx);
+#endif /* WITH_WSREP */
}
}
} else {
@@ -4793,8 +4759,8 @@ static void lock_rec_print(FILE* file, const lock_t* lock, mtr_t& mtr)
putc('\n', file);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
mtr.start();
@@ -5187,7 +5153,7 @@ lock_rec_queue_validate(
const buf_block_t* block, /*!< in: buffer block containing rec */
const rec_t* rec, /*!< in: record to look at */
const dict_index_t* index, /*!< in: index, or NULL if not known */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
const lock_t* lock;
ulint heap_no;
@@ -5253,24 +5219,28 @@ lock_rec_queue_validate(
explicit granted lock. */
#ifdef WITH_WSREP
- if (wsrep_on(other_lock->trx->mysql_thd)) {
- 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_trx_seqno(impl_trx->mysql_thd) << " SQL: " <<
- wsrep_thd_query(impl_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_trx_seqno(otrx->mysql_thd) << " SQL: " <<
- wsrep_thd_query(otrx->mysql_thd);
- }
+ /** Galera record locking rules:
+ * If there is no other record lock to the same record, we may grant
+ the lock request.
+ * If there is other record lock but this requested record lock is
+ compatible, we may grant the lock request.
+ * If there is other record lock and it is not compatible with
+ requested lock, all normal transactions must wait.
+ * BF (brute force) additional exceptions :
+ ** If BF already holds record lock for requested record, we may
+ grant new record lock even if there is conflicting record lock(s)
+ waiting on a queue.
+ ** If conflicting transaction holds requested record lock,
+ we will cancel this record lock and select conflicting transaction
+ for BF abort or kill victim.
+ ** If conflicting transaction is waiting for requested record lock
+ we will cancel this wait and select conflicting transaction
+ for BF abort or kill victim.
+ ** There should not be two BF transactions waiting for same record lock
+ */
+ if (other_lock->trx->is_wsrep() && !lock_get_wait(other_lock)) {
+ wsrep_report_bf_lock_wait(impl_trx->mysql_thd, impl_trx->id);
+ wsrep_report_bf_lock_wait(other_lock->trx->mysql_thd, other_lock->trx->id);
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no,
@@ -5279,9 +5249,11 @@ lock_rec_queue_validate(
}
} else
#endif /* WITH_WSREP */
- ut_ad(lock_get_wait(other_lock));
- ut_ad(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
- block, heap_no, impl_trx));
+ {
+ ut_ad(lock_get_wait(other_lock));
+ ut_ad(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
+ block, heap_no, impl_trx));
+ }
}
mutex_exit(&impl_trx->mutex);
@@ -5312,13 +5284,20 @@ lock_rec_queue_validate(
mode, block, false, heap_no,
lock->trx);
#ifdef WITH_WSREP
- ut_a(!other_lock
- || wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE)
- || wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE));
-
-#else
- ut_a(!other_lock);
+ if (UNIV_UNLIKELY(other_lock && lock->trx->is_wsrep())) {
+ /* Only BF transaction may be granted
+ lock before other conflicting lock
+ request. */
+ if (!wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE)
+ && !wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)) {
+ /* If no BF, this case is a bug. */
+ wsrep_report_bf_lock_wait(lock->trx->mysql_thd, lock->trx->id);
+ wsrep_report_bf_lock_wait(other_lock->trx->mysql_thd, other_lock->trx->id);
+ ut_error;
+ }
+ } else
#endif /* WITH_WSREP */
+ ut_ad(!other_lock);
} else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) {
ut_a(lock_rec_has_to_wait_in_queue(lock));
@@ -5352,8 +5331,8 @@ lock_rec_validate_page(
ulint nth_bit = 0;
ulint i;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!lock_mutex_own());
@@ -5738,8 +5717,8 @@ lock_rec_insert_check_and_lock(
#ifdef UNIV_DEBUG
{
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- const ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ const rec_offs* offsets;
rec_offs_init(offsets_);
offsets = rec_get_offsets(next_rec, index, offsets_, true,
@@ -5804,7 +5783,7 @@ lock_rec_convert_impl_to_expl(
const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: user record on page */
dict_index_t* index, /*!< in: index of record */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
trx_t* trx;
@@ -5859,7 +5838,7 @@ lock_clust_rec_modify_check_and_lock(
const rec_t* rec, /*!< in: record which should be
modified */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
@@ -5959,8 +5938,8 @@ lock_sec_rec_modify_check_and_lock(
#ifdef UNIV_DEBUG
{
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- const ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ const rec_offs* offsets;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets_, true,
@@ -6004,7 +5983,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: secondary index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@@ -6082,7 +6061,7 @@ lock_clust_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@@ -6166,8 +6145,8 @@ lock_clust_rec_read_check_and_lock_alt(
que_thr_t* thr) /*!< in: query thread */
{
mem_heap_t* tmp_heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
dberr_t err;
rec_offs_init(offsets_);
@@ -6639,7 +6618,8 @@ lock_table_locks_lookup(
ut_a(lock->trx == trx);
if (lock_get_type_low(lock) == LOCK_REC) {
- ut_ad(!dict_index_is_online_ddl(lock->index)
+ ut_ad(lock->index->online_status
+ != ONLINE_INDEX_CREATION
|| dict_index_is_clust(lock->index));
if (lock->index->table == table) {
break;
@@ -7038,7 +7018,7 @@ DeadlockChecker::select_victim() const
/* The joining transaction is 'smaller',
choose it as the victim and roll it back. */
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(m_start->mysql_thd, TRUE)) {
+ if (wsrep_thd_is_BF(m_start->mysql_thd, FALSE)) {
return(m_wait_lock->trx);
}
#endif /* WITH_WSREP */
@@ -7046,7 +7026,7 @@ DeadlockChecker::select_victim() const
}
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, TRUE)) {
+ if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, FALSE)) {
return(m_start);
}
#endif /* WITH_WSREP */
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index 947e56ebeee..5d0d41ef494 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -192,8 +192,7 @@ wsrep_is_BF_lock_timeout(
const trx_t* trx,
bool locked = true)
{
- if (wsrep_on_trx(trx)
- && wsrep_thd_is_BF(trx->mysql_thd, FALSE)
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)
&& trx->error_state != DB_DEADLOCK) {
ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id)
<< " query: " << wsrep_thd_query(trx->mysql_thd);
@@ -402,8 +401,9 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout
#ifdef WITH_WSREP
- && (!wsrep_on_trx(trx) ||
- (!wsrep_is_BF_lock_timeout(trx, false) && trx->error_state != DB_DEADLOCK))
+ && (!trx->is_wsrep()
+ || (!wsrep_is_BF_lock_timeout(trx, false)
+ && trx->error_state != DB_DEADLOCK))
#endif /* WITH_WSREP */
) {
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index c3eaa05b680..4c68f3743e9 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -83,12 +83,9 @@ reduce the size of the log.
/** Redo log system */
log_t* log_sys = NULL;
-/** Whether to generate and require checksums on the redo log pages */
+/** Whether to require checksums on the redo log pages */
my_bool innodb_log_checksums;
-/** Pointer to the log checksum calculation function */
-log_checksum_func_t log_checksum_algorithm_ptr;
-
/* Next log block number to do dummy record filling if no log records written
for a while */
static ulint next_lbn_to_pad = 0;
@@ -857,7 +854,7 @@ log_block_store_checksum(
/*=====================*/
byte* block) /*!< in/out: pointer to a log block */
{
- log_block_set_checksum(block, log_block_calc_checksum(block));
+ log_block_set_checksum(block, log_block_calc_checksum_crc32(block));
}
/******************************************************//**
@@ -1203,7 +1200,7 @@ loop:
}
}
- if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE)) {
+ if (UNIV_UNLIKELY(srv_shutdown_state > SRV_SHUTDOWN_INITIATED)) {
service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB log write: "
LSN_PF "," LSN_PF,
@@ -1430,7 +1427,7 @@ log_group_checkpoint(lsn_t end_lsn)
ut_ad(end_lsn == 0 || end_lsn >= log_sys->next_checkpoint_lsn);
ut_ad(end_lsn <= log_sys->lsn);
ut_ad(end_lsn + SIZE_OF_MLOG_CHECKPOINT <= log_sys->lsn
- || srv_shutdown_state != SRV_SHUTDOWN_NONE);
+ || srv_shutdown_state > SRV_SHUTDOWN_INITIATED);
DBUG_PRINT("ib_log", ("checkpoint " UINT64PF " at " LSN_PF
" written",
@@ -1600,7 +1597,7 @@ bool log_checkpoint(bool sync)
if (oldest_lsn
> log_sys->last_checkpoint_lsn + SIZE_OF_MLOG_CHECKPOINT) {
/* Some log has been written since the previous checkpoint. */
- } else if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ } else if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
/* MariaDB 10.3 startup expects the redo log file to be
logically empty (not even containing a MLOG_CHECKPOINT record)
after a clean shutdown. Perform an extra checkpoint at
@@ -1625,7 +1622,7 @@ bool log_checkpoint(bool sync)
lsn_t flush_lsn = oldest_lsn;
const lsn_t end_lsn = log_sys->lsn;
const bool do_write
- = srv_shutdown_state == SRV_SHUTDOWN_NONE
+ = srv_shutdown_state <= SRV_SHUTDOWN_INITIATED
|| flush_lsn != end_lsn;
if (fil_names_clear(flush_lsn, do_write)) {
@@ -1893,7 +1890,7 @@ wait_suspend_loop:
"Waiting for %s to exit", thread_name);
if (srv_print_verbose_log && count > COUNT_INTERVAL) {
ib::info() << "Waiting for " << thread_name
- << "to exit";
+ << " to exit";
count = 0;
}
goto loop;
@@ -1936,6 +1933,9 @@ wait_suspend_loop:
"Waiting for page cleaner");
ib::info() << "Waiting for page_cleaner to "
"finish flushing of buffer pool";
+ /* This is a workaround to avoid the InnoDB hang
+ when OS datetime changed backwards */
+ os_event_set(buf_flush_event);
count = 0;
}
}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 9a20c7f7d22..446e0afe576 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -57,6 +57,7 @@ Created 9/20/1997 Heikki Tuuri
#include "srv0start.h"
#include "trx0roll.h"
#include "row0merge.h"
+#include "fil0pagecompress.h"
/** Log records are stored in the hash table in chunks at most of this size;
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
@@ -103,14 +104,6 @@ static ulint recv_previous_parsed_rec_offset;
/** The 'multi' flag of the previous parsed redo log record */
static ulint recv_previous_parsed_rec_is_multi;
-/** This many frames must be left free in the buffer pool when we scan
-the log and store the scanned log records in the buffer pool: we will
-use these free frames to read in pages when we start applying the
-log records to the database.
-This is the default value. If the actual size of the buffer pool is
-larger than 10 MB we'll set this value to 512. */
-ulint recv_n_pool_free_frames;
-
/** The maximum lsn we see for a page during the recovery process. If this
is bigger than the lsn we are able to scan up to, that is an indication that
the recovery failed and the database may be corrupt. */
@@ -321,7 +314,7 @@ public:
if (!i->second.created) {
continue;
}
- if (buf_block_t* block = buf_page_get_gen(
+ if (buf_block_t* block = buf_page_get_low(
i->first, univ_page_size, RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr, NULL)) {
@@ -414,8 +407,7 @@ fil_name_process(
}
ut_ad(srv_operation == SRV_OPERATION_NORMAL
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
+ || is_mariabackup_restore_or_export());
/* We will also insert space=NULL into the map, so that
further checks can ensure that a MLOG_FILE_NAME record was
@@ -598,7 +590,7 @@ fil_name_parse(
ut_ad(0); // the caller checked this
/* fall through */
case MLOG_FILE_NAME:
- if (corrupt) {
+ if (UNIV_UNLIKELY(corrupt)) {
ib::error() << "MLOG_FILE_NAME incorrect:" << ptr;
recv_sys->found_corrupt_log = true;
break;
@@ -608,7 +600,7 @@ fil_name_parse(
reinterpret_cast<char*>(ptr), len, space_id, false);
break;
case MLOG_FILE_DELETE:
- if (corrupt) {
+ if (UNIV_UNLIKELY(corrupt)) {
ib::error() << "MLOG_FILE_DELETE incorrect:" << ptr;
recv_sys->found_corrupt_log = true;
break;
@@ -636,7 +628,7 @@ fil_name_parse(
}
break;
case MLOG_FILE_RENAME2:
- if (corrupt) {
+ if (UNIV_UNLIKELY(corrupt)) {
ib::error() << "MLOG_FILE_RENAME2 incorrect:" << ptr;
recv_sys->found_corrupt_log = true;
}
@@ -677,7 +669,7 @@ fil_name_parse(
}
}
- if (corrupt) {
+ if (UNIV_UNLIKELY(corrupt)) {
ib::error() << "MLOG_FILE_RENAME2 new_name incorrect:" << ptr
<< " new_name: " << new_name;
recv_sys->found_corrupt_log = true;
@@ -761,7 +753,6 @@ recv_sys_var_init(void)
recv_previous_parsed_rec_type = MLOG_SINGLE_REC_FLAG;
recv_previous_parsed_rec_offset = 0;
recv_previous_parsed_rec_is_multi = 0;
- recv_n_pool_free_frames = 256;
recv_max_page_lsn = 0;
}
@@ -841,17 +832,10 @@ recv_sys_init()
recv_sys->flush_end = os_event_create(0);
}
- ulint size = buf_pool_get_curr_size();
- /* Set appropriate value of recv_n_pool_free_frames. */
- if (size >= 10 << 20) {
- /* Buffer pool of size greater than 10 MB. */
- recv_n_pool_free_frames = 512;
- }
-
recv_sys->buf = static_cast<byte*>(
ut_malloc_nokey(RECV_PARSING_BUF_SIZE));
- recv_sys->addr_hash = hash_create(size / 512);
+ recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512);
recv_sys->progress_time = time(NULL);
recv_max_page_lsn = 0;
@@ -981,6 +965,8 @@ fail:
}
});
+ DBUG_EXECUTE_IF("log_checksum_mismatch", { cksum = crc + 1; });
+
if (crc != cksum) {
ib::error() << "Invalid log block checksum."
<< " block: " << block_number
@@ -1239,7 +1225,10 @@ recv_log_recover_10_3()
% univ_page_size.physical()),
OS_FILE_LOG_BLOCK_SIZE, buf, NULL);
- if (log_block_calc_checksum(buf) != log_block_get_checksum(buf)) {
+ const ulint cksum = log_block_get_checksum(buf);
+
+ if (cksum != LOG_NO_CHECKSUM_MAGIC
+ && cksum != log_block_calc_checksum_crc32(buf)) {
return(DB_CORRUPTION);
}
@@ -2309,14 +2298,105 @@ static void recv_read_in_area(const page_id_t page_id)
mutex_enter(&recv_sys->mutex);
}
+/** This is another low level function for the recovery system
+to create a page which has buffered page intialization redo log records.
+@param[in] page_id page to be created using redo logs
+@param[in,out] recv_addr Hashed redo logs for the given page id
+@return whether the page creation successfully */
+static buf_block_t* recv_recovery_create_page_low(const page_id_t page_id,
+ recv_addr_t* recv_addr)
+{
+ mtr_t mtr;
+ mlog_init_t::init& i = mlog_init.last(page_id);
+ const lsn_t end_lsn = UT_LIST_GET_LAST(recv_addr->rec_list)->end_lsn;
+
+ if (end_lsn < i.lsn)
+ {
+ DBUG_LOG("ib_log", "skip log for page "
+ << page_id
+ << " LSN " << end_lsn
+ << " < " << i.lsn);
+ recv_addr->state = RECV_PROCESSED;
+ignore:
+ ut_a(recv_sys->n_addrs);
+ recv_sys->n_addrs--;
+ return NULL;
+ }
+
+ fil_space_t* space = fil_space_acquire(recv_addr->space);
+ if (!space)
+ {
+ recv_addr->state = RECV_PROCESSED;
+ goto ignore;
+ }
+
+ if (space->enable_lsn)
+ {
+init_fail:
+ fil_space_release(space);
+ recv_addr->state = RECV_NOT_PROCESSED;
+ return NULL;
+ }
+
+ /* Determine if a tablespace could be for an internal table
+ for FULLTEXT INDEX. For those tables, no MLOG_INDEX_LOAD record
+ used to be written when redo logging was disabled. Hence, we
+ cannot optimize away page reads, because all the redo
+ log records for initializing and modifying the page in the
+ past could be older than the page in the data file.
+
+ The check is too broad, causing all
+ tables whose names start with FTS_ to skip the optimization. */
+
+ if (strstr(space->name, "/FTS_"))
+ goto init_fail;
+
+ mtr.start();
+ mtr.set_log_mode(MTR_LOG_NONE);
+ buf_block_t* block = buf_page_create(page_id, page_size_t(space->flags),
+ &mtr);
+ if (recv_addr->state == RECV_PROCESSED)
+ /* The page happened to exist in the buffer pool, or it was
+ just being read in. Before buf_page_get_with_no_latch() returned,
+ all changes must have been applied to the page already. */
+ mtr.commit();
+ else
+ {
+ i.created = true;
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+ recv_recover_page(block, mtr, recv_addr, i.lsn);
+ ut_ad(mtr.has_committed());
+ }
+
+ fil_space_release(space);
+ return block;
+}
+
+/** This is a low level function for the recovery system
+to create a page which has buffered intialized redo log records.
+@param[in] page_id page to be created using redo logs
+@return whether the page creation successfully */
+buf_block_t* recv_recovery_create_page_low(const page_id_t page_id)
+{
+ buf_block_t* block= NULL;
+ mutex_enter(&recv_sys->mutex);
+ recv_addr_t* recv_addr= recv_get_fil_addr_struct(page_id.space(),
+ page_id.page_no());
+ if (recv_addr && recv_addr->state == RECV_WILL_NOT_READ)
+ {
+ block= recv_recovery_create_page_low(page_id, recv_addr);
+ }
+ mutex_exit(&recv_sys->mutex);
+ return block;
+}
+
/** 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)
{
ut_ad(srv_operation == SRV_OPERATION_NORMAL
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
+ || is_mariabackup_restore_or_export());
mutex_enter(&recv_sys->mutex);
@@ -2334,9 +2414,8 @@ void recv_apply_hashed_log_recs(bool last_batch)
ut_ad(!last_batch == log_mutex_own());
- recv_no_ibuf_operations = !last_batch
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT;
+ recv_no_ibuf_operations
+ = !last_batch || is_mariabackup_restore_or_export();
ut_d(recv_no_log_write = recv_no_ibuf_operations);
@@ -2400,7 +2479,7 @@ ignore:
apply:
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
- if (buf_block_t* block = buf_page_get_gen(
+ if (buf_block_t* block = buf_page_get_low(
page_id, univ_page_size,
RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL,
@@ -2414,77 +2493,9 @@ apply:
mtr.commit();
recv_read_in_area(page_id);
}
- } else {
- mlog_init_t::init& i = mlog_init.last(page_id);
- const lsn_t end_lsn = UT_LIST_GET_LAST(
- recv_addr->rec_list)->end_lsn;
-
- if (end_lsn < i.lsn) {
- DBUG_LOG("ib_log", "skip log for page "
- << page_id
- << " LSN " << end_lsn
- << " < " << i.lsn);
-skip:
- recv_addr->state = RECV_PROCESSED;
- goto ignore;
- }
-
- fil_space_t* space = fil_space_acquire(
- recv_addr->space);
- if (!space) {
- goto skip;
- }
-
- if (space->enable_lsn) {
-do_read:
- fil_space_release(space);
- recv_addr->state = RECV_NOT_PROCESSED;
- goto apply;
- }
-
- /* Determine if a tablespace could be
- for an internal table for FULLTEXT INDEX.
- For those tables, no MLOG_INDEX_LOAD record
- used to be written when redo logging was
- disabled. Hence, we cannot optimize
- away page reads, because all the redo
- log records for initializing and
- modifying the page in the past could
- be older than the page in the data
- file.
-
- The check is too broad, causing all
- tables whose names start with FTS_ to
- skip the optimization. */
-
- if (strstr(space->name, "/FTS_")) {
- goto do_read;
- }
-
- mtr.start();
- mtr.set_log_mode(MTR_LOG_NONE);
- buf_block_t* block = buf_page_create(
- page_id, page_size_t(space->flags),
- &mtr);
- if (recv_addr->state == RECV_PROCESSED) {
- /* The page happened to exist
- in the buffer pool, or it was
- just being read in. Before
- buf_page_get_with_no_latch()
- returned, all changes must have
- been applied to the page already. */
- mtr.commit();
- } else {
- i.created = true;
- buf_block_dbg_add_level(
- block, SYNC_NO_ORDER_CHECK);
- mtr.x_latch_at_savepoint(0, block);
- recv_recover_page(block, mtr,
- recv_addr, i.lsn);
- ut_ad(mtr.has_committed());
- }
-
- fil_space_release(space);
+ } else if (!recv_recovery_create_page_low(
+ page_id, recv_addr)) {
+ goto apply;
}
}
}
@@ -2575,10 +2586,10 @@ recv_parse_log_rec(
*body = NULL;
- UNIV_MEM_INVALID(type, sizeof *type);
- UNIV_MEM_INVALID(space, sizeof *space);
- UNIV_MEM_INVALID(page_no, sizeof *page_no);
- UNIV_MEM_INVALID(body, sizeof *body);
+ MEM_UNDEFINED(type, sizeof *type);
+ MEM_UNDEFINED(space, sizeof *space);
+ MEM_UNDEFINED(page_no, sizeof *page_no);
+ MEM_UNDEFINED(body, sizeof *body);
if (ptr == end_ptr) {
@@ -2691,6 +2702,7 @@ recv_calc_lsn_on_data_add(
@param[in] space tablespace ID (could be garbage)
@param[in] page_no page number (could be garbage)
@return whether processing should continue */
+ATTRIBUTE_COLD
static
bool
recv_report_corrupt_log(
@@ -2707,7 +2719,8 @@ recv_report_corrupt_log(
ib::info() << "Log record type " << type << ", page " << space << ":"
<< page_no << ". Log parsing proceeded successfully up to "
<< recv_sys->recovered_lsn << ". Previous log record type "
- << recv_previous_parsed_rec_type << ", is multi "
+ << recv_previous_parsed_rec_type
+ << ", is multi "
<< recv_previous_parsed_rec_is_multi << " Recv offset "
<< ptr_offset << ", prev "
<< recv_previous_parsed_rec_offset;
@@ -2758,14 +2771,40 @@ recv_mlog_index_load(ulint space_id, ulint page_no, lsn_t lsn)
}
}
+/** Check whether read redo log memory exceeds the available memory
+of buffer pool. Store last_stored_lsn if it is not in last phase
+@param[in] store whether to store page operations
+@param[in] available_mem Available memory in buffer pool to
+ read redo logs. */
+static bool recv_sys_heap_check(store_t* store, ulint available_mem)
+{
+ if (*store != STORE_NO
+ && mem_heap_get_size(recv_sys->heap) >= available_mem)
+ {
+ if (*store == STORE_YES)
+ recv_sys->last_stored_lsn= recv_sys->recovered_lsn;
+
+ *store= STORE_NO;
+ DBUG_PRINT("ib_log",("Ran out of memory and last "
+ "stored lsn " LSN_PF " last stored offset "
+ ULINTPF "\n",recv_sys->recovered_lsn,
+ recv_sys->recovered_offset));
+ return true;
+ }
+
+ return false;
+}
+
/** Parse log records from a buffer and optionally store them to a
hash table to wait merging to file pages.
-@param[in] checkpoint_lsn the LSN of the latest checkpoint
-@param[in] store whether to store page operations
-@param[in] apply whether to apply the records
+@param[in] checkpoint_lsn the LSN of the latest checkpoint
+@param[in] store whether to store page operations
+@param[in] available_mem memory to read the redo logs
+@param[in] apply whether to apply the records
@return whether MLOG_CHECKPOINT record was seen the first time,
or corruption was noticed */
-bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
+bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t* store,
+ ulint available_mem, bool apply)
{
byte* ptr;
byte* end_ptr;
@@ -2777,6 +2816,7 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
ulint space;
ulint page_no;
byte* body;
+ const bool last_phase = (*store == STORE_IF_EXISTS);
ut_ad(log_mutex_own());
ut_ad(mutex_own(&recv_sys->mutex));
@@ -2791,6 +2831,12 @@ loop:
return(false);
}
+ /* Check for memory overflow and ignore the parsing of remaining
+ redo log records if InnoDB ran out of memory */
+ if (recv_sys_heap_check(store, available_mem) && last_phase) {
+ return false;
+ }
+
switch (*ptr) {
case MLOG_CHECKPOINT:
#ifdef UNIV_LOG_LSN_DEBUG
@@ -2814,12 +2860,12 @@ loop:
len = recv_parse_log_rec(&type, ptr, end_ptr, &space,
&page_no, apply, &body);
- if (recv_sys->found_corrupt_log) {
+ if (UNIV_UNLIKELY(recv_sys->found_corrupt_log)) {
recv_report_corrupt_log(ptr, type, space, page_no);
return(true);
}
- if (recv_sys->found_corrupt_fs) {
+ if (UNIV_UNLIKELY(recv_sys->found_corrupt_fs)) {
return(true);
}
@@ -2876,8 +2922,9 @@ loop:
if (lsn == checkpoint_lsn) {
if (recv_sys->mlog_checkpoint_lsn) {
- ut_ad(recv_sys->mlog_checkpoint_lsn
- <= recv_sys->recovered_lsn);
+ /* There can be multiple
+ MLOG_CHECKPOINT lsn for the
+ same checkpoint. */
break;
}
recv_sys->mlog_checkpoint_lsn
@@ -2893,7 +2940,7 @@ loop:
break;
#endif /* UNIV_LOG_LSN_DEBUG */
default:
- switch (store) {
+ switch (*store) {
case STORE_NO:
break;
case STORE_IF_EXISTS:
@@ -2943,7 +2990,7 @@ loop:
&type, ptr, end_ptr, &space, &page_no,
false, &body);
- if (recv_sys->found_corrupt_log) {
+ if (UNIV_UNLIKELY(recv_sys->found_corrupt_log)) {
corrupted_log:
recv_report_corrupt_log(
ptr, type, space, page_no);
@@ -3036,13 +3083,13 @@ corrupted_log:
&type, ptr, end_ptr, &space, &page_no,
apply, &body);
- if (recv_sys->found_corrupt_log
+ if (UNIV_UNLIKELY(recv_sys->found_corrupt_log)
&& !recv_report_corrupt_log(
ptr, type, space, page_no)) {
return(true);
}
- if (recv_sys->found_corrupt_fs) {
+ if (UNIV_UNLIKELY(recv_sys->found_corrupt_fs)) {
return(true);
}
@@ -3077,7 +3124,7 @@ corrupted_log:
recv_parse_or_apply_log_rec_body(). */
break;
default:
- switch (store) {
+ switch (*store) {
case STORE_NO:
break;
case STORE_IF_EXISTS:
@@ -3120,7 +3167,6 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn)
if (!recv_sys->parse_start_lsn) {
/* Cannot start parsing yet because no start point for
it found */
-
return(false);
}
@@ -3141,7 +3187,6 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn)
}
if (more_len == 0) {
-
return(false);
}
@@ -3176,8 +3221,9 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn)
/** Moves the parsing buffer data left to the buffer start. */
void recv_sys_justify_left_parsing_buf()
{
- ut_memmove(recv_sys->buf, recv_sys->buf + recv_sys->recovered_offset,
- recv_sys->len - recv_sys->recovered_offset);
+ memmove(recv_sys->buf,
+ recv_sys->buf + recv_sys->recovered_offset,
+ recv_sys->len - recv_sys->recovered_offset);
recv_sys->len -= recv_sys->recovered_offset;
@@ -3187,26 +3233,30 @@ void recv_sys_justify_left_parsing_buf()
/** Scan redo log from a buffer and stores new log data to the parsing buffer.
Parse and hash the log records if new data found.
Apply log records automatically when the hash table becomes full.
+@param[in] available_mem we let the hash table of recs to
+ grow to this size, at the maximum
+@param[in,out] store_to_hash whether the records should be
+ stored to the hash table; this is
+ reset if just debug checking is
+ needed, or when the available_mem
+ runs out
+@param[in] log_block log segment
+@param[in] checkpoint_lsn latest checkpoint LSN
+@param[in] start_lsn buffer start LSN
+@param[in] end_lsn buffer end LSN
+@param[in,out] contiguous_lsn it is known that all groups contain
+ contiguous log data upto this lsn
+@param[out] group_scanned_lsn scanning succeeded upto this lsn
@return true if not able to scan any more in this log group */
-static
-bool
-recv_scan_log_recs(
-/*===============*/
- ulint available_memory,/*!< in: we let the hash table of recs
- to grow to this size, at the maximum */
- store_t* store_to_hash, /*!< in,out: whether the records should be
- stored to the hash table; this is reset
- if just debug checking is needed, or
- when the available_memory runs out */
- const byte* log_block, /*!< in: log segment */
- lsn_t checkpoint_lsn, /*!< in: latest checkpoint LSN */
- lsn_t start_lsn, /*!< in: buffer start LSN */
- lsn_t end_lsn, /*!< in: buffer end LSN */
- lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
- groups contain contiguous log data up
- to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
- this lsn */
+static bool recv_scan_log_recs(
+ ulint available_mem,
+ store_t* store_to_hash,
+ const byte* log_block,
+ lsn_t checkpoint_lsn,
+ lsn_t start_lsn,
+ lsn_t end_lsn,
+ lsn_t* contiguous_lsn,
+ lsn_t* group_scanned_lsn)
{
lsn_t scanned_lsn = start_lsn;
bool finished = false;
@@ -3214,14 +3264,13 @@ recv_scan_log_recs(
bool more_data = false;
bool apply = recv_sys->mlog_checkpoint_lsn != 0;
ulint recv_parsing_buf_size = RECV_PARSING_BUF_SIZE;
-
+ const bool last_phase = (*store_to_hash == STORE_IF_EXISTS);
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(end_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(end_lsn >= start_lsn + OS_FILE_LOG_BLOCK_SIZE);
const byte* const log_end = log_block
+ ulint(end_lsn - start_lsn);
-
do {
ut_ad(!finished);
@@ -3332,6 +3381,13 @@ recv_scan_log_recs(
= log_block_get_checkpoint_no(log_block);
}
+ /* During last phase of scanning, there can be redo logs
+ left in recv_sys->buf to parse & store it in recv_sys->heap */
+ if (last_phase
+ && recv_sys->recovered_lsn < recv_sys->scanned_lsn) {
+ more_data = true;
+ }
+
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
/* Log data for this group ends here */
finished = true;
@@ -3349,7 +3405,8 @@ recv_scan_log_recs(
/* Try to parse more log records */
if (recv_parse_log_recs(checkpoint_lsn,
- *store_to_hash, apply)) {
+ store_to_hash, available_mem,
+ apply)) {
ut_ad(recv_sys->found_corrupt_log
|| recv_sys->found_corrupt_fs
|| recv_sys->mlog_checkpoint_lsn
@@ -3358,22 +3415,18 @@ recv_scan_log_recs(
goto func_exit;
}
- if (*store_to_hash != STORE_NO
- && mem_heap_get_size(recv_sys->heap) > available_memory) {
-
- DBUG_PRINT("ib_log", ("Ran out of memory and last "
- "stored lsn " LSN_PF,
- recv_sys->recovered_lsn));
-
- recv_sys->last_stored_lsn = recv_sys->recovered_lsn;
- *store_to_hash = STORE_NO;
- }
+ recv_sys_heap_check(store_to_hash, available_mem);
if (recv_sys->recovered_offset > recv_parsing_buf_size / 4) {
/* Move parsing buffer data to the buffer start */
-
recv_sys_justify_left_parsing_buf();
}
+
+ /* Need to re-parse the redo log which're stored
+ in recv_sys->buf */
+ if (last_phase && *store_to_hash == STORE_NO) {
+ finished = false;
+ }
}
func_exit:
@@ -3422,9 +3475,8 @@ recv_group_scan_log_recs(
lsn_t end_lsn;
store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0
? STORE_NO : (last_phase ? STORE_IF_EXISTS : STORE_YES);
- ulint available_mem = UNIV_PAGE_SIZE
- * (buf_pool_get_n_pages()
- - (recv_n_pool_free_frames * srv_buf_pool_instances));
+ ulint available_mem = (buf_pool_get_n_pages() * 2 / 3)
+ << srv_page_size_shift;
group->scanned_lsn = end_lsn = *contiguous_lsn = ut_uint64_align_down(
*contiguous_lsn, OS_FILE_LOG_BLOCK_SIZE);
@@ -3437,6 +3489,8 @@ recv_group_scan_log_recs(
redo log records before we have
finished the redo log scan. */
recv_apply_hashed_log_recs(false);
+ /* Rescan the redo logs from last stored lsn */
+ end_lsn = recv_sys->recovered_lsn;
}
start_lsn = ut_uint64_align_down(end_lsn,
@@ -3448,8 +3502,7 @@ recv_group_scan_log_recs(
} while (end_lsn != start_lsn
&& !recv_scan_log_recs(
available_mem, &store_to_hash, log_sys->buf,
- checkpoint_lsn,
- start_lsn, end_lsn,
+ checkpoint_lsn, start_lsn, end_lsn,
contiguous_lsn, &group->scanned_lsn));
if (recv_sys->found_corrupt_log || recv_sys->found_corrupt_fs) {
@@ -3471,8 +3524,7 @@ static
dberr_t
recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
{
- if (srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT) {
+ if (is_mariabackup_restore_or_export()) {
ib::warn() << "Tablespace " << i->first << " was not"
" found at " << i->second.name << " when"
" restoring a (partial?) backup. All redo log"
@@ -3553,7 +3605,7 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
for (recv_spaces_t::iterator i = recv_spaces.begin();
i != recv_spaces.end(); i++) {
- if (i->second.status != file_name_t::MISSING) {
+ if (UNIV_LIKELY(i->second.status != file_name_t::MISSING)) {
continue;
}
@@ -3649,8 +3701,7 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
dberr_t err = DB_SUCCESS;
ut_ad(srv_operation == SRV_OPERATION_NORMAL
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
+ || is_mariabackup_restore_or_export());
/* Initialize red-black tree for fast insertions into the
flush_list during recovery process. */
@@ -3864,6 +3915,8 @@ skip_apply:
rescan = true;
}
+ recv_sys->parse_start_lsn = checkpoint_lsn;
+
if (srv_operation == SRV_OPERATION_NORMAL) {
buf_dblwr_process();
}
@@ -4038,26 +4091,91 @@ recv_recovery_rollback_active(void)
}
}
-/** Find a doublewrite copy of a page.
-@param[in] space_id tablespace identifier
-@param[in] page_no page number
-@return page frame
-@retval NULL if no page was found */
-const byte*
-recv_dblwr_t::find_page(ulint space_id, ulint page_no)
+bool recv_dblwr_t::validate_page(const page_id_t page_id,
+ const byte *page,
+ const fil_space_t *space,
+ byte *tmp_buf)
+{
+ if (page_id.page_no() == 0)
+ {
+ ulint flags= fsp_header_get_flags(page);
+ if (!fsp_flags_is_valid(flags, page_id.space()))
+ {
+ ulint cflags= fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED)
+ {
+ ib::warn() << "Ignoring a doublewrite copy of page " << page_id
+ << "due to invalid flags " << ib::hex(flags);
+ return false;
+ }
+
+ flags= cflags;
+ }
+
+ /* Page 0 is never page_compressed or encrypted. */
+ return !buf_page_is_corrupted(true, page, page_size_t(flags));
+ }
+
+ ut_ad(tmp_buf);
+ byte *tmp_frame= tmp_buf;
+ byte *tmp_page= tmp_buf + srv_page_size;
+ const uint16_t page_type= mach_read_from_2(page + FIL_PAGE_TYPE);
+ const page_size_t page_size(space->flags);
+ const bool expect_encrypted= space->crypt_data &&
+ space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED;
+
+ if (expect_encrypted &&
+ mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION))
+ {
+ if (!fil_space_verify_crypt_checksum(page, page_size))
+ return false;
+ if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)
+ return true;
+ if (page_size.is_compressed())
+ return false;
+ memcpy(tmp_page, page, page_size.physical());
+ if (!fil_space_decrypt(space, tmp_frame, tmp_page))
+ return false;
+ }
+
+ switch (page_type) {
+ case FIL_PAGE_PAGE_COMPRESSED:
+ memcpy(tmp_page, page, page_size.physical());
+ /* fall through */
+ case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
+ if (page_size.is_compressed())
+ return false; /* ROW_FORMAT=COMPRESSED cannot be page_compressed */
+ ulint decomp= fil_page_decompress(tmp_frame, tmp_page);
+ if (!decomp)
+ return false; /* decompression failed */
+ if (decomp == srv_page_size)
+ return false; /* the page was not compressed (invalid page type) */
+ return !buf_page_is_corrupted(true, tmp_page, page_size, space);
+ }
+
+ return !buf_page_is_corrupted(true, page, page_size, space);
+}
+
+byte *recv_dblwr_t::find_page(const page_id_t page_id,
+ const fil_space_t *space, byte *tmp_buf)
{
- const byte *result= NULL;
+ byte *result= NULL;
lsn_t max_lsn= 0;
for (list::const_iterator i = pages.begin(); i != pages.end(); ++i)
{
- const byte *page= *i;
- if (page_get_page_no(page) != page_no ||
- page_get_space_id(page) != space_id)
+ byte *page= *i;
+ if (page_get_page_no(page) != page_id.page_no() ||
+ page_get_space_id(page) != page_id.space())
continue;
const lsn_t lsn= mach_read_from_8(page + FIL_PAGE_LSN);
- if (lsn <= max_lsn)
+ if (lsn <= max_lsn ||
+ !validate_page(page_id, page, space, tmp_buf))
+ {
+ /* Mark processed for subsequent iterations in buf_dblwr_process() */
+ memset(page + FIL_PAGE_LSN, 0, 8);
continue;
+ }
max_lsn= lsn;
result= page;
}
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index bcdb115812c..783451abbf2 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -222,8 +222,6 @@ mem_heap_validate(
block != NULL;
block = UT_LIST_GET_NEXT(list, block)) {
- mem_block_validate(block);
-
switch (block->type) {
case MEM_HEAP_DYNAMIC:
break;
@@ -278,7 +276,6 @@ mem_heap_create_block_func(
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
if (heap != NULL) {
- mem_block_validate(heap);
ut_d(mem_heap_validate(heap));
}
@@ -320,7 +317,6 @@ mem_heap_create_block_func(
block->buf_block = buf_block;
block->free_block = NULL;
- block->magic_n = MEM_BLOCK_MAGIC_N;
ut_d(ut_strlcpy_rev(block->file_name, file_name,
sizeof(block->file_name)));
ut_d(block->line = line);
@@ -338,8 +334,7 @@ mem_heap_create_block_func(
/* Not the first allocation for the heap. This block's
total_length field should be set to undefined. */
ut_d(block->total_size = ULINT_UNDEFINED);
- UNIV_MEM_INVALID(&block->total_size,
- sizeof block->total_size);
+ MEM_UNDEFINED(&block->total_size, sizeof block->total_size);
heap->total_size += len;
}
@@ -347,7 +342,7 @@ mem_heap_create_block_func(
/* Poison all available memory. Individual chunks will be unpoisoned on
every mem_heap_alloc() call. */
compile_time_assert(MEM_BLOCK_HEADER_SIZE >= sizeof *block);
- UNIV_MEM_FREE(block + 1, len - sizeof *block);
+ MEM_NOACCESS(block + 1, len - sizeof *block);
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
@@ -368,8 +363,6 @@ mem_heap_add_block(
mem_block_t* new_block;
ulint new_size;
- ut_d(mem_block_validate(heap));
-
block = UT_LIST_GET_LAST(heap->base);
/* We have to allocate a new block. The size is always at least
@@ -422,8 +415,6 @@ mem_heap_block_free(
buf_block = static_cast<buf_block_t*>(block->buf_block);
- mem_block_validate(block);
-
UT_LIST_REMOVE(heap->base, block);
ut_ad(heap->total_size >= block->len);
@@ -431,7 +422,6 @@ mem_heap_block_free(
type = heap->type;
len = block->len;
- block->magic_n = MEM_FREED_BLOCK_MAGIC_N;
if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) {
ut_ad(!buf_block);
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index b75a9c4cf02..bc30d6efd55 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -218,6 +218,13 @@ static void memo_slot_release(mtr_memo_slot_t *slot)
case MTR_MEMO_SX_LOCK:
rw_lock_sx_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
+ case MTR_MEMO_SPACE_X_LOCK:
+ {
+ fil_space_t *space= static_cast<fil_space_t*>(slot->object);
+ space->committed_size= space->size;
+ rw_lock_x_unlock(&space->latch);
+ }
+ break;
case MTR_MEMO_X_LOCK:
rw_lock_x_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
@@ -226,8 +233,8 @@ static void memo_slot_release(mtr_memo_slot_t *slot)
case MTR_MEMO_PAGE_SX_FIX:
case MTR_MEMO_PAGE_X_FIX:
buf_block_t *block= reinterpret_cast<buf_block_t*>(slot->object);
- buf_block_unfix(block);
buf_page_release_latch(block, slot->type);
+ buf_block_unfix(block);
break;
}
slot->object= NULL;
@@ -251,6 +258,13 @@ struct ReleaseLatches {
case MTR_MEMO_S_LOCK:
rw_lock_s_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
+ case MTR_MEMO_SPACE_X_LOCK:
+ {
+ fil_space_t *space= static_cast<fil_space_t*>(slot->object);
+ space->committed_size= space->size;
+ rw_lock_x_unlock(&space->latch);
+ }
+ break;
case MTR_MEMO_X_LOCK:
rw_lock_x_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
@@ -262,8 +276,8 @@ struct ReleaseLatches {
case MTR_MEMO_PAGE_SX_FIX:
case MTR_MEMO_PAGE_X_FIX:
buf_block_t *block= reinterpret_cast<buf_block_t*>(slot->object);
- buf_block_unfix(block);
buf_page_release_latch(block, slot->type);
+ buf_block_unfix(block);
break;
}
slot->object= NULL;
@@ -294,6 +308,24 @@ struct DebugCheck {
};
#endif
+/** Find buffer fix count of the given block acquired by the
+mini-transaction */
+struct FindBlock
+{
+ int32_t num_fix;
+ const buf_block_t *const block;
+
+ FindBlock(const buf_block_t *block_buf): num_fix(0), block(block_buf) {}
+
+ bool operator()(const mtr_memo_slot_t* slot)
+ {
+ if (slot->object == block)
+ ut_d(if (slot->type != MTR_MEMO_MODIFY))
+ num_fix++;
+ return true;
+ }
+};
+
/** Release a resource acquired by the mini-transaction. */
struct ReleaseBlocks {
/** Release specific object */
@@ -378,7 +410,7 @@ mtr_write_log(
/** Start a mini-transaction. */
void mtr_t::start()
{
- UNIV_MEM_INVALID(this, sizeof *this);
+ MEM_UNDEFINED(this, sizeof *this);
new(&m_memo) mtr_buf_t();
new(&m_log) mtr_buf_t();
@@ -564,13 +596,23 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
ut_ad(space);
ut_ad(space->id == space_id);
- x_lock(&space->latch, file, line);
+ x_lock_space(space, file, line);
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT
|| space->purpose == FIL_TYPE_TABLESPACE);
return(space);
}
+/** Exclusively aqcuire a tablespace latch.
+@param space tablespace
+@param file source code file name of the caller
+@param line source code line number */
+void mtr_t::x_lock_space(fil_space_t *space, const char *file, unsigned line)
+{
+ rw_lock_x_lock_inline(&space->latch, 0, file, line);
+ memo_push(space, MTR_MEMO_SPACE_X_LOCK);
+}
+
/** Look up the system tablespace. */
void
mtr_t::lookup_sys_space()
@@ -764,27 +806,28 @@ with index pages.
void
mtr_t::release_free_extents(ulint n_reserved)
{
- fil_space_t* space;
+ fil_space_t *space= m_user_space;
- ut_ad(!m_undo_space);
-
- if (m_user_space) {
-
- ut_ad(m_user_space->id == m_user_space_id);
- ut_ad(memo_contains(get_memo(), &m_user_space->latch,
- MTR_MEMO_X_LOCK));
-
- space = m_user_space;
- } else {
+ ut_ad(!m_undo_space);
- ut_ad(m_sys_space->id == TRX_SYS_SPACE);
- ut_ad(memo_contains(get_memo(), &m_sys_space->latch,
- MTR_MEMO_X_LOCK));
+ if (space)
+ ut_ad(m_user_space->id == m_user_space_id);
+ else
+ {
+ ut_ad(m_sys_space->id == TRX_SYS_SPACE);
+ space= m_sys_space;
+ }
- space = m_sys_space;
- }
+ ut_ad(memo_contains(get_memo(), space, MTR_MEMO_SPACE_X_LOCK));
+ space->release_free_extents(n_reserved);
+}
- space->release_free_extents(n_reserved);
+int32_t mtr_t::get_fix_count(buf_block_t *block)
+{
+ Iterate<FindBlock> iteration((FindBlock(block)));
+ if (m_memo.for_each_block(iteration))
+ return iteration.functor.num_fix;
+ return 0;
}
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index fc411dad564..5c6da7ad51c 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1,8 +1,8 @@
/***********************************************************************
-Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -413,7 +413,7 @@ public:
/** Accessor for the AIO context
@param[in] segment Segment for which to get the context
@return the AIO context for the segment */
- io_context* io_ctx(ulint segment)
+ io_context_t io_ctx(ulint segment)
MY_ATTRIBUTE((warn_unused_result))
{
ut_ad(segment < get_n_segments());
@@ -421,11 +421,11 @@ public:
return(m_aio_ctx[segment]);
}
- /** Creates an io_context for native linux AIO.
+ /** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
- static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx)
+ static bool linux_create_io_ctx(unsigned max_events, io_context_t& io_ctx)
MY_ATTRIBUTE((warn_unused_result));
/** Checks if the system supports native linux aio. On some kernel
@@ -622,7 +622,7 @@ private:
/** completion queue for IO. There is one such queue per
segment. Each thread will work on one ctx exclusively. */
- io_context_t* m_aio_ctx;
+ std::vector<io_context_t> m_aio_ctx;
/** The array to collect completed IOs. There is one such
event for each possible pending IO. The size of the array
@@ -1474,6 +1474,12 @@ os_file_get_parent_dir(
return(NULL);
}
+ if (last_slash - path < 0) {
+ /* Sanity check, it prevents gcc from trying to handle this case which
+ * results in warnings for some optimized builds */
+ return (NULL);
+ }
+
/* Non-trivial directory component */
return(mem_strdupl(path, last_slash - path));
@@ -1792,10 +1798,14 @@ LinuxAIOHandler::resubmit(Slot* slot)
iocb->data = slot;
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
/* Resubmit an I/O request */
int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb);
+ ut_a(ret != -EINVAL);
- if (ret < -1) {
+ if (ret < 0) {
errno = -ret;
}
@@ -1896,8 +1906,8 @@ LinuxAIOHandler::collect()
ut_ad(m_array != NULL);
ut_ad(m_segment < m_array->get_n_segments());
- /* Which io_context we are going to use. */
- io_context* io_ctx = m_array->io_ctx(m_segment);
+ /* Which io_context_t we are going to use. */
+ io_context_t io_ctx = m_array->io_ctx(m_segment);
/* Starting point of the m_segment we will be working on. */
ulint start_pos = m_segment * m_n_slots;
@@ -1924,6 +1934,8 @@ LinuxAIOHandler::collect()
int ret;
ret = io_getevents(io_ctx, 1, m_n_slots, events, &timeout);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
for (int i = 0; i < ret; ++i) {
@@ -2150,14 +2162,18 @@ AIO::linux_dispatch(Slot* slot)
/* Find out what we are going to work with.
The iocb struct is directly in the slot.
- The io_context is one per segment. */
+ The io_context_t is one per segment. */
ulint io_ctx_index;
struct iocb* iocb = &slot->control;
io_ctx_index = (slot->pos * m_n_segments) / m_slots.size();
- int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb);
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
+ int ret = io_submit(io_ctx(io_ctx_index), 1, &iocb);
+ ut_a(ret != -EINVAL);
/* io_submit() returns number of successfully queued requests
or -errno. */
@@ -2169,25 +2185,26 @@ AIO::linux_dispatch(Slot* slot)
return(ret == 1);
}
-/** Creates an io_context for native linux AIO.
+/** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
bool
AIO::linux_create_io_ctx(
unsigned max_events,
- io_context_t* io_ctx)
+ io_context_t& io_ctx)
{
ssize_t n_retries = 0;
for (;;) {
- memset(io_ctx, 0x0, sizeof(*io_ctx));
+ memset(&io_ctx, 0x0, sizeof(io_ctx));
/* Initialize the io_ctx. Tell it how many pending
IO requests this context will handle. */
- int ret = io_setup(max_events, io_ctx);
+ int ret = io_setup(max_events, &io_ctx);
+ ut_a(ret != -EINVAL);
if (ret == 0) {
/* Success. Return now. */
@@ -2221,14 +2238,14 @@ AIO::linux_create_io_ctx(
}
/* Have tried enough. Better call it a day. */
- ib::error()
+ ib::warn()
<< "io_setup() failed with EAGAIN after "
<< OS_AIO_IO_SETUP_RETRY_ATTEMPTS
<< " attempts.";
break;
case -ENOSYS:
- ib::error()
+ ib::warn()
<< "Linux Native AIO interface"
" is not supported on this platform. Please"
" check your OS documentation and install"
@@ -2237,7 +2254,7 @@ AIO::linux_create_io_ctx(
break;
default:
- ib::error()
+ ib::warn()
<< "Linux Native AIO setup"
<< " returned following error["
<< ret << "]";
@@ -2266,7 +2283,7 @@ AIO::is_linux_native_aio_supported()
io_context_t io_ctx;
char name[1000];
- if (!linux_create_io_ctx(1, &io_ctx)) {
+ if (!linux_create_io_ctx(1, io_ctx)) {
/* The platform does not support native aio. */
@@ -2282,6 +2299,10 @@ AIO::is_linux_native_aio_supported()
<< "Unable to create temp file to check"
" native AIO support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
} else {
@@ -2311,6 +2332,10 @@ AIO::is_linux_native_aio_supported()
<< " \"" << name << "\" to check native"
<< " AIO read support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != EINVAL);
+ ut_ad(ret != EFAULT);
+
return(false);
}
}
@@ -2335,15 +2360,19 @@ AIO::is_linux_native_aio_supported()
io_prep_pwrite(p_iocb, fd, ptr, UNIV_PAGE_SIZE, 0);
} else {
- ut_a(UNIV_PAGE_SIZE >= 512);
- io_prep_pread(p_iocb, fd, ptr, 512, 0);
+ ut_a(srv_page_size >= 4096);
+ io_prep_pread(p_iocb, fd, ptr, srv_page_size, 0);
}
+ ut_a(reinterpret_cast<size_t>(p_iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
int err = io_submit(io_ctx, 1, &p_iocb);
+ ut_a(err != -EINVAL);
if (err >= 1) {
/* Now collect the submitted IO request. */
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
+ ut_a(err != -EINVAL);
}
ut_free(buf);
@@ -2351,7 +2380,13 @@ AIO::is_linux_native_aio_supported()
switch (err) {
case 1:
- return(true);
+ {
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
+ return(true);
+ }
case -EINVAL:
case -ENOSYS:
@@ -2371,6 +2406,10 @@ AIO::is_linux_native_aio_supported()
<< "returned error[" << -err << "]";
}
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
@@ -2379,12 +2418,12 @@ AIO::is_linux_native_aio_supported()
/** Retrieves the last error number if an error occurs in a file io function.
The number should be retrieved before any other OS calls (because they may
overwrite the error number). If the number is not known to this program,
-the OS error number + 100 is returned.
+the OS error number + OS_FILE_ERROR_MAX is returned.
@param[in] report_all_errors true if we want an error message
printed of all errors
@param[in] on_error_silent true then don't print any diagnostic
to the log
-@return error number, or OS error number + 100 */
+@return error number, or OS error number + OS_FILE_ERROR_MAX */
static
ulint
os_file_get_last_error_low(
@@ -2968,7 +3007,8 @@ os_file_create_func(
ut_a(type == OS_LOG_FILE
|| type == OS_DATA_FILE
- || type == OS_DATA_TEMP_FILE);
+ || type == OS_DATA_TEMP_FILE
+ || type == OS_DATA_FILE_NO_O_DIRECT);
ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
@@ -3015,7 +3055,8 @@ os_file_create_func(
/* We disable OS caching (O_DIRECT) only on data files */
if (!read_only
&& *success
- && (type != OS_LOG_FILE && type != OS_DATA_TEMP_FILE)
+ && (type != OS_LOG_FILE && type != OS_DATA_TEMP_FILE
+ && type != OS_DATA_FILE_NO_O_DIRECT)
&& (srv_file_flush_method == SRV_O_DIRECT
|| srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC)) {
@@ -5396,7 +5437,7 @@ fallback:
? 0 : posix_fallocate(file, current_size,
size - current_size);
} while (err == EINTR
- && srv_shutdown_state == SRV_SHUTDOWN_NONE);
+ && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED);
switch (err) {
case 0:
@@ -5410,6 +5451,7 @@ fallback:
errno = err;
return false;
case EINVAL:
+ case EOPNOTSUPP:
/* fall back to the code below */
break;
}
@@ -5436,7 +5478,7 @@ fallback:
os_offset_t current_size = os_file_get_size(file);
while (current_size < size
- && srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ && srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
ulint n_bytes;
if (size - current_size < (os_offset_t) buf_size) {
@@ -5779,8 +5821,7 @@ AIO::AIO(
m_n_segments(segments),
m_n_reserved()
# ifdef LINUX_NATIVE_AIO
- ,m_aio_ctx(),
- m_events(m_slots.size())
+ ,m_events(m_slots.size())
# endif /* LINUX_NATIVE_AIO */
#ifdef WIN_ASYNC_IO
,m_completion_port(new_completion_port())
@@ -5836,29 +5877,20 @@ AIO::init_slots()
dberr_t
AIO::init_linux_native_aio()
{
- /* Initialize the io_context array. One io_context
- per segment in the array. */
-
- ut_a(m_aio_ctx == NULL);
- m_aio_ctx = static_cast<io_context**>(
- ut_zalloc_nokey(m_n_segments * sizeof(*m_aio_ctx)));
-
- if (m_aio_ctx == NULL) {
- return(DB_OUT_OF_MEMORY);
- }
+ /* Initialize the io_context_t array. One io_context_t
+ per segment in the array. */
+ m_aio_ctx.resize(get_n_segments());
- io_context** ctx = m_aio_ctx;
ulint max_events = slots_per_segment();
- for (ulint i = 0; i < m_n_segments; ++i, ++ctx) {
+ for (std::vector<io_context_t>::iterator it = m_aio_ctx.begin(),
+ end = m_aio_ctx.end();
+ it != end; ++it) {
- if (!linux_create_io_ctx(max_events, ctx)) {
+ if (!linux_create_io_ctx(max_events, *it)) {
/* If something bad happened during aio setup
we disable linux native aio.
- The disadvantage will be a small memory leak
- at shutdown but that's ok compared to a crash
- or a not working server.
This frequently happens when running the test suite
with many threads on a system with low fs.aio-max-nr!
*/
@@ -5870,8 +5902,15 @@ AIO::init_linux_native_aio()
<< "try increasing system "
<< "fs.aio-max-nr to 1048576 or larger or "
<< "setting innodb_use_native_aio = 0 in my.cnf";
- ut_free(m_aio_ctx);
- m_aio_ctx = 0;
+
+ for (std::vector<io_context_t>::iterator it2
+ = m_aio_ctx.begin();
+ it2 != it; ++it2) {
+ int ret = io_destroy(*it2);
+ ut_a(ret != -EINVAL);
+ }
+
+ m_aio_ctx.clear();
srv_use_native_aio = FALSE;
return(DB_SUCCESS);
}
@@ -5947,15 +5986,15 @@ AIO::~AIO()
#if defined(LINUX_NATIVE_AIO)
if (srv_use_native_aio) {
- m_events.clear();
- ut_free(m_aio_ctx);
+ for (ulint i = 0; i < m_aio_ctx.size(); i++) {
+ int ret = io_destroy(m_aio_ctx[i]);
+ ut_a(ret != -EINVAL);
+ }
}
#endif /* LINUX_NATIVE_AIO */
#if defined(WIN_ASYNC_IO)
CloseHandle(m_completion_port);
#endif
-
- m_slots.clear();
}
/** Initializes the asynchronous io system. Creates one array each for ibuf
@@ -6249,6 +6288,10 @@ AIO::reserve_slot(
os_offset_t offset,
ulint len)
{
+ ut_ad(reinterpret_cast<size_t>(buf) % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
+
#ifdef WIN_ASYNC_IO
ut_a((len & 0xFFFFFFFFUL) == len);
#endif /* WIN_ASYNC_IO */
diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc
index 70f389436fa..71cb88ae372 100644
--- a/storage/innobase/os/os0proc.cc
+++ b/storage/innobase/os/os0proc.cc
@@ -29,6 +29,7 @@ Created 9/30/1995 Heikki Tuuri
#ifdef HAVE_LINUX_LARGE_PAGES
# include "mysqld.h"
#endif
+#include "my_valgrind.h"
/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
MAP_ANON but MAP_ANON is marked as deprecated */
@@ -101,7 +102,7 @@ os_mem_alloc_large(
my_atomic_addlint(
&os_total_large_mem_allocated, size);
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
return(ptr);
}
@@ -125,7 +126,7 @@ skip:
} else {
my_atomic_addlint(
&os_total_large_mem_allocated, size);
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
}
#else
size = getpagesize();
@@ -141,7 +142,7 @@ skip:
} else {
my_atomic_addlint(
&os_total_large_mem_allocated, size);
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
}
#endif
return(ptr);
@@ -157,6 +158,14 @@ os_mem_free_large(
{
ut_a(os_total_large_mem_allocated >= size);
+#ifdef __SANITIZE_ADDRESS__
+ // We could have manually poisoned that memory for ASAN.
+ // And we must unpoison it by ourself as specified in documentation
+ // for __asan_poison_memory_region() in sanitizer/asan_interface.h
+ // munmap() doesn't do it for us automatically.
+ MEM_UNDEFINED(ptr, size);
+#endif /* __SANITIZE_ADDRESS__ */
+
#ifdef HAVE_LINUX_LARGE_PAGES
if (my_use_large_pages && opt_large_page_size && !shmdt(ptr)) {
my_atomic_addlint(
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index b34d875b759..2aac53f572d 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -125,11 +125,17 @@ os_thread_create_func(
pthread_attr_t attr;
- pthread_attr_init(&attr);
+ int ret = pthread_attr_init(&attr);
+ if (UNIV_UNLIKELY(ret)) {
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_init() returned %d\n",
+ ret);
+ abort();
+ }
my_atomic_addlint(&os_thread_count, 1);
- int ret = pthread_create(&new_thread_id, &attr, func, arg);
+ ret = pthread_create(&new_thread_id, &attr, func, arg);
ut_a(ret == 0);
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index b4ec3e6dcdf..6810edf6c33 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -35,38 +35,6 @@ Created 10/4/1994 Heikki Tuuri
#include <algorithm>
-/*******************************************************************//**
-This is a linear congruential generator PRNG. Returns a pseudo random
-number between 0 and 2^64-1 inclusive. The formula and the constants
-being used are:
-X[n+1] = (a * X[n] + c) mod m
-where:
-X[0] = my_interval_timer()
-a = 1103515245 (3^5 * 5 * 7 * 129749)
-c = 12345 (3 * 5 * 823)
-m = 18446744073709551616 (2^64)
-
-@return number between 0 and 2^64-1 */
-static
-ib_uint64_t
-page_cur_lcg_prng(void)
-/*===================*/
-{
-#define LCG_a 1103515245
-#define LCG_c 12345
- static uint64_t lcg_current;
-
- if (!lcg_current) {
- lcg_current = my_interval_timer();
- }
-
- /* no need to "% 2^64" explicitly because lcg_current is
- 64 bit and this will be done anyway */
- lcg_current = LCG_a * lcg_current + LCG_c;
-
- return(lcg_current);
-}
-
#ifdef BTR_CUR_HASH_ADAPT
# ifdef UNIV_SEARCH_PERF_STAT
static ulint page_cur_short_succ;
@@ -99,8 +67,8 @@ page_cur_try_search_shortcut(
ibool success = FALSE;
const page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_check_typed(tuple));
@@ -183,8 +151,8 @@ page_cur_try_search_shortcut_bytes(
ibool success = FALSE;
const page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_check_typed(tuple));
@@ -255,7 +223,7 @@ page_cur_rec_field_extends(
/*=======================*/
const dtuple_t* tuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: record */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: compare nth field */
{
const dtype_t* type;
@@ -331,8 +299,8 @@ page_cur_search_with_match(
const page_zip_des_t* page_zip = buf_block_get_page_zip(block);
#endif /* UNIV_ZIP_DEBUG */
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_validate(tuple));
@@ -594,8 +562,8 @@ page_cur_search_with_match_bytes(
const page_zip_des_t* page_zip = buf_block_get_page_zip(block);
#endif /* UNIV_ZIP_DEBUG */
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dtuple_validate(tuple));
@@ -814,8 +782,7 @@ page_cur_open_on_rnd_user_rec(
buf_block_t* block, /*!< in: page */
page_cur_t* cursor) /*!< out: page cursor */
{
- ulint rnd;
- ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
+ const ulint n_recs = page_get_n_recs(block->frame);
page_cur_set_before_first(block, cursor);
@@ -824,11 +791,8 @@ page_cur_open_on_rnd_user_rec(
return;
}
- rnd = (ulint) (page_cur_lcg_prng() % n_recs);
-
- do {
- page_cur_move_to_next(cursor);
- } while (rnd--);
+ cursor->rec = page_rec_get_nth(block->frame,
+ ut_rnd_interval(n_recs) + 1);
}
/** Write a redo log record of inserting a record into an index page.
@@ -868,11 +832,11 @@ page_cur_insert_rec_write_log(
{
mem_heap_t* heap = NULL;
- ulint cur_offs_[REC_OFFS_NORMAL_SIZE];
- ulint ins_offs_[REC_OFFS_NORMAL_SIZE];
+ rec_offs cur_offs_[REC_OFFS_NORMAL_SIZE];
+ rec_offs ins_offs_[REC_OFFS_NORMAL_SIZE];
- ulint* cur_offs;
- ulint* ins_offs;
+ rec_offs* cur_offs;
+ rec_offs* ins_offs;
rec_offs_init(cur_offs_);
rec_offs_init(ins_offs_);
@@ -1048,8 +1012,8 @@ page_cur_parse_insert_rec(
ulint info_and_status_bits = 0; /* remove warning */
page_cur_t cursor;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
page = block ? buf_block_get_frame(block) : NULL;
@@ -1212,6 +1176,52 @@ page_cur_parse_insert_rec(
return(const_cast<byte*>(ptr + end_seg_len));
}
+/************************************************************//**
+Allocates a block of memory from the heap of an index page.
+@return pointer to start of allocated buffer, or NULL if allocation fails */
+static
+byte*
+page_mem_alloc_heap(
+/*================*/
+ page_t* page, /*!< in/out: index page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
+ space available for inserting the record,
+ or NULL */
+ ulint need, /*!< in: total number of bytes needed */
+ ulint* heap_no)/*!< out: this contains the heap number
+ of the allocated record
+ if allocation succeeds */
+{
+ byte* block;
+ ulint avl_space;
+
+ ut_ad(page && heap_no);
+
+ avl_space = page_get_max_insert_size(page, 1);
+
+ if (avl_space >= need) {
+ const ulint h = page_dir_get_n_heap(page);
+ if (UNIV_UNLIKELY(h >= 8191)) {
+ /* At the minimum record size of 5+2 bytes,
+ we can only reach this condition when using
+ innodb_page_size=64k. */
+ ut_ad(srv_page_size == 65536);
+ return(NULL);
+ }
+ *heap_no = h;
+
+ block = page_header_get_ptr(page, PAGE_HEAP_TOP);
+
+ page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
+ block + need);
+ page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
+
+ return(block);
+ }
+
+ return(NULL);
+}
+
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
@@ -1224,7 +1234,7 @@ page_cur_insert_rec_low(
which the new record is inserted */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
byte* insert_buf;
@@ -1253,7 +1263,7 @@ page_cur_insert_rec_low(
/* 1. Get the size of the physical record in the page */
rec_size = rec_offs_size(offsets);
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind_or_MSAN
{
const void* rec_start
= rec - rec_offs_extra_size(offsets);
@@ -1264,19 +1274,19 @@ page_cur_insert_rec_low(
: REC_N_OLD_EXTRA_BYTES);
/* All data bytes of the record must be valid. */
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
/* The variable-length header must be valid. */
- UNIV_MEM_ASSERT_RW(rec_start, extra_size);
+ MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind_or_MSAN */
/* 2. Try to find suitable space from page memory management */
free_rec = page_header_get_ptr(page, PAGE_FREE);
if (UNIV_LIKELY_NULL(free_rec)) {
/* Try to allocate from the head of the free list. */
- ulint foffsets_[REC_OFFS_NORMAL_SIZE];
- ulint* foffsets = foffsets_;
+ rec_offs foffsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* foffsets = foffsets_;
mem_heap_t* heap = NULL;
rec_offs_init(foffsets_);
@@ -1376,8 +1386,8 @@ use_heap:
rec_set_heap_no_old(insert_rec, heap_no);
}
- UNIV_MEM_ASSERT_RW(rec_get_start(insert_rec, offsets),
- rec_offs_size(offsets));
+ MEM_CHECK_DEFINED(rec_get_start(insert_rec, offsets),
+ rec_offs_size(offsets));
/* 6. Update the last insertion info in page header */
last_insert = page_header_get_ptr(page, PAGE_LAST_INSERT);
@@ -1469,7 +1479,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */
{
byte* insert_buf;
@@ -1505,7 +1515,7 @@ page_cur_insert_rec_zip(
/* 1. Get the size of the physical record in the page */
rec_size = rec_offs_size(offsets);
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind_or_MSAN
{
const void* rec_start
= rec - rec_offs_extra_size(offsets);
@@ -1516,11 +1526,11 @@ page_cur_insert_rec_zip(
: REC_N_OLD_EXTRA_BYTES);
/* All data bytes of the record must be valid. */
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
/* The variable-length header must be valid. */
- UNIV_MEM_ASSERT_RW(rec_start, extra_size);
+ MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind_or_MSAN */
const bool reorg_before_insert = page_has_garbage(page)
&& rec_size > page_get_max_insert_size(page, 1)
@@ -1706,8 +1716,8 @@ page_cur_insert_rec_zip(
if (UNIV_LIKELY_NULL(free_rec)) {
/* Try to allocate from the head of the free list. */
lint extra_size_diff;
- ulint foffsets_[REC_OFFS_NORMAL_SIZE];
- ulint* foffsets = foffsets_;
+ rec_offs foffsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* foffsets = foffsets_;
mem_heap_t* heap = NULL;
rec_offs_init(foffsets_);
@@ -1845,8 +1855,8 @@ use_heap:
rec_set_n_owned_new(insert_rec, NULL, 0);
rec_set_heap_no_new(insert_rec, heap_no);
- UNIV_MEM_ASSERT_RW(rec_get_start(insert_rec, offsets),
- rec_offs_size(offsets));
+ MEM_CHECK_DEFINED(rec_get_start(insert_rec, offsets),
+ rec_offs_size(offsets));
page_zip_dir_insert(page_zip, cursor->rec, free_rec, insert_rec);
@@ -2038,8 +2048,8 @@ page_copy_rec_list_end_to_created_page(
byte* log_ptr;
ulint log_data_len;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW);
@@ -2260,7 +2270,7 @@ page_cur_parse_delete_rec(
if (block) {
page_t* page = buf_block_get_frame(block);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_t* rec = page + offset;
rec_offs_init(offsets_);
@@ -2288,7 +2298,7 @@ page_cur_delete_rec(
/*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */
- const ulint* offsets,/*!< in: rec_get_offsets(
+ const rec_offs* offsets,/*!< in: rec_get_offsets(
cursor->rec, index) */
mtr_t* mtr) /*!< in: mini-transaction handle
or NULL */
@@ -2426,18 +2436,17 @@ page_cur_delete_rec(
#ifdef UNIV_COMPILE_TEST_FUNCS
/*******************************************************************//**
-Print the first n numbers, generated by page_cur_lcg_prng() to make sure
+Print the first n numbers, generated by ut_rnd_gen() to make sure
(visually) that it works properly. */
void
-test_page_cur_lcg_prng(
-/*===================*/
+test_ut_rnd_gen(
int n) /*!< in: print first n numbers */
{
int i;
unsigned long long rnd;
for (i = 0; i < n; i++) {
- rnd = page_cur_lcg_prng();
+ rnd = ut_rnd_gen();
printf("%llu\t%%2=%llu %%3=%llu %%5=%llu %%7=%llu %%11=%llu\n",
rnd,
rnd % 2,
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index e316c8b1568..b078763c684 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -36,6 +36,7 @@ Created 2/2/1994 Heikki Tuuri
#include "fut0lst.h"
#include "btr0sea.h"
#include "trx0sys.h"
+#include <algorithm>
/* THE INDEX PAGE
==============
@@ -250,43 +251,6 @@ page_set_autoinc(
}
}
-/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no)/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-{
- byte* block;
- ulint avl_space;
-
- ut_ad(page && heap_no);
-
- avl_space = page_get_max_insert_size(page, 1);
-
- if (avl_space >= need) {
- block = page_header_get_ptr(page, PAGE_HEAP_TOP);
-
- page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
- block + need);
- *heap_no = page_dir_get_n_heap(page);
-
- page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
-
- return(block);
- }
-
- return(NULL);
-}
-
/**********************************************************//**
Writes a log record of page creation. */
UNIV_INLINE
@@ -582,8 +546,8 @@ page_copy_rec_list_end_no_locks(
page_cur_t cur1;
rec_t* cur2;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
page_cur_position(rec, block, &cur1);
@@ -814,8 +778,8 @@ page_copy_rec_list_start(
rtr_rec_move_t* rec_move = NULL;
rec_t* ret
= page_rec_get_prev(page_get_supremum_rec(new_page));
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
/* Here, "ret" may be pointing to a user record or the
@@ -1049,8 +1013,8 @@ page_delete_rec_list_end(
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
page_t* page = page_align(rec);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);
@@ -1250,8 +1214,8 @@ page_delete_rec_list_start(
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t cur1;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@@ -1738,7 +1702,7 @@ void
page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: record descriptor */
+ const rec_offs* offsets)/*!< in: record descriptor */
{
ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
rec_print_new(stderr, rec, offsets);
@@ -1813,8 +1777,8 @@ page_print_list(
ulint count;
ulint n_recs;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
@@ -1924,7 +1888,7 @@ ibool
page_rec_validate(
/*==============*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n_owned;
ulint heap_no;
@@ -2019,10 +1983,9 @@ page_simple_validate_old(
n_slots = page_dir_get_n_slots(page);
- if (UNIV_UNLIKELY(n_slots > UNIV_PAGE_SIZE / 4)) {
- ib::error() << "Nonsensical number " << n_slots
- << " of page dir slots";
-
+ if (UNIV_UNLIKELY(n_slots < 2 || n_slots > UNIV_PAGE_SIZE / 4)) {
+ ib::error() << "Nonsensical number of page dir slots: "
+ << n_slots;
goto func_exit;
}
@@ -2219,10 +2182,9 @@ page_simple_validate_new(
n_slots = page_dir_get_n_slots(page);
- if (UNIV_UNLIKELY(n_slots > UNIV_PAGE_SIZE / 4)) {
- ib::error() << "Nonsensical number " << n_slots
- << " of page dir slots";
-
+ if (UNIV_UNLIKELY(n_slots < 2 || n_slots > srv_page_size / 4)) {
+ ib::error() << "Nonsensical number of page dir slots: "
+ << n_slots;
goto func_exit;
}
@@ -2420,8 +2382,13 @@ page_validate(
ulint n_slots;
ibool ret = FALSE;
ulint i;
- ulint* offsets = NULL;
- ulint* old_offsets = NULL;
+ rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_1;
+ rec_offs* old_offsets = offsets_2;
+
+ rec_offs_init(offsets_1);
+ rec_offs_init(offsets_2);
#ifdef UNIV_GIS_DEBUG
if (dict_index_is_spatial(index)) {
@@ -2432,8 +2399,13 @@ page_validate(
if (UNIV_UNLIKELY((ibool) !!page_is_comp(page)
!= dict_table_is_comp(index->table))) {
ib::error() << "'compact format' flag mismatch";
- goto func_exit2;
+func_exit2:
+ ib::error() << "Apparent corruption in space "
+ << page_get_space_id(page) << " page "
+ << page_get_page_no(page) << " index " << index->name;
+ return FALSE;
}
+
if (page_is_comp(page)) {
if (UNIV_UNLIKELY(!page_simple_validate_new(page))) {
goto func_exit2;
@@ -2474,15 +2446,14 @@ page_validate(
n_slots = page_dir_get_n_slots(page);
- if (UNIV_UNLIKELY(!(page_header_get_ptr(page, PAGE_HEAP_TOP)
- <= page_dir_get_nth_slot(page, n_slots - 1)))) {
+ const void* top = page_header_get_ptr(page, PAGE_HEAP_TOP);
+ const void* last_slot = page_dir_get_nth_slot(page, n_slots - 1);
+ if (UNIV_UNLIKELY(top > last_slot)) {
ib::warn() << "Record heap and dir overlap on space "
<< page_get_space_id(page) << " page "
<< page_get_page_no(page) << " index " << index->name
- << ", " << page_header_get_ptr(page, PAGE_HEAP_TOP)
- << ", " << page_dir_get_nth_slot(page, n_slots - 1);
-
+ << ", " << top << ", " << last_slot;
goto func_exit;
}
@@ -2644,11 +2615,7 @@ page_validate(
}
/* set old_offsets to offsets; recycle offsets */
- {
- ulint* offs = old_offsets;
- old_offsets = offsets;
- offsets = offs;
- }
+ std::swap(old_offsets, offsets);
}
if (page_is_comp(page)) {
@@ -2745,10 +2712,7 @@ func_exit:
mem_heap_free(heap);
if (UNIV_UNLIKELY(ret == FALSE)) {
-func_exit2:
- ib::error() << "Apparent corruption in space "
- << page_get_space_id(page) << " page "
- << page_get_page_no(page) << " index " << index->name;
+ goto func_exit2;
}
return(ret);
@@ -2813,7 +2777,7 @@ page_delete_rec(
page_cur_t* pcur, /*!< in/out: page cursor on record
to delete */
page_zip_des_t* page_zip,/*!< in: compressed page descriptor */
- const ulint* offsets)/*!< in: offsets for record */
+ const rec_offs* offsets)/*!< in: offsets for record */
{
bool no_compress_needed;
buf_block_t* block = pcur->block;
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index d6abec57821..9664bda6fea 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -2,7 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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,16 +27,14 @@ Created June 2005 by Marko Makela
#include "page0size.h"
#include "page0zip.h"
+#include "span.h"
+
+using st_::span;
/** 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[FIELD_REF_SIZE] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
-};
+const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, };
#ifndef UNIV_INNOCHECKSUM
#include "page0page.h"
@@ -110,7 +108,7 @@ Compare at most sizeof(field_ref_zero) bytes.
/** Assert that a BLOB pointer is filled with zero bytes.
@param b in: BLOB pointer */
#define ASSERT_ZERO_BLOB(b) \
- ut_ad(!memcmp(b, field_ref_zero, sizeof field_ref_zero))
+ ut_ad(!memcmp(b, field_ref_zero, FIELD_REF_SIZE))
/* Enable some extra debugging output. This code can be enabled
independently of any UNIV_ debugging conditions. */
@@ -880,7 +878,7 @@ page_zip_compress_node_ptrs(
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err = Z_OK;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
do {
const rec_t* rec = *recs++;
@@ -890,9 +888,9 @@ page_zip_compress_node_ptrs(
/* Only leaf nodes may contain externally stored columns. */
ut_ad(!rec_offs_any_extern(offsets));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -955,8 +953,8 @@ page_zip_compress_sec(
- c_stream->next_in);
if (UNIV_LIKELY(c_stream->avail_in != 0)) {
- UNIV_MEM_ASSERT_RW(c_stream->next_in,
- c_stream->avail_in);
+ MEM_CHECK_DEFINED(c_stream->next_in,
+ c_stream->avail_in);
err = deflate(c_stream, Z_NO_FLUSH);
if (UNIV_UNLIKELY(err != Z_OK)) {
break;
@@ -985,7 +983,7 @@ page_zip_compress_clust_ext(
FILE_LOGFILE
z_stream* c_stream, /*!< in/out: compressed page stream */
const rec_t* rec, /*!< in: record */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col, /*!< in: position of of DB_TRX_ID */
byte* deleted, /*!< in: dense directory entry pointing
to the head of the free list */
@@ -998,9 +996,9 @@ page_zip_compress_clust_ext(
int err;
ulint i;
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
ulint len;
@@ -1124,7 +1122,7 @@ page_zip_compress_clust(
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err = Z_OK;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
/* BTR_EXTERN_FIELD_REF storage */
byte* externs = storage - n_dense
* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
@@ -1138,9 +1136,9 @@ page_zip_compress_clust(
ULINT_UNDEFINED, &heap);
ut_ad(rec_offs_n_fields(offsets)
== dict_index_get_n_fields(index));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -1187,9 +1185,9 @@ page_zip_compress_clust(
== rec_get_nth_field(rec, offsets,
trx_id_col + 1, &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress any preceding bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -1295,7 +1293,7 @@ page_zip_compress(
&& dict_table_is_comp(index->table)
&& !dict_index_is_ibuf(index)));
- UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+ MEM_CHECK_DEFINED(page, srv_page_size);
/* Check the data that will be omitted. */
ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - REC_N_NEW_EXTRA_BYTES),
@@ -1492,7 +1490,7 @@ page_zip_compress(
trx_id_col = ULINT_UNDEFINED;
}
- UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in);
+ MEM_CHECK_DEFINED(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FULL_FLUSH);
if (err != Z_OK) {
goto zlib_error;
@@ -1546,7 +1544,7 @@ page_zip_compress(
- (c_stream.next_in - page));
ut_a(c_stream.avail_in <= UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR);
- UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in);
+ MEM_CHECK_DEFINED(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FINISH);
if (UNIV_UNLIKELY(err != Z_STREAM_END)) {
@@ -1581,9 +1579,11 @@ err_exit:
ut_ad(buf + c_stream.total_out == c_stream.next_out);
ut_ad((ulint) (storage - c_stream.next_out) >= c_stream.avail_out);
+#ifdef HAVE_valgrind
/* Valgrind believes that zlib does not initialize some bits
in the last 7 or 8 bytes of the stream. Make Valgrind happy. */
- UNIV_MEM_VALID(buf, c_stream.total_out);
+ MEM_MAKE_DEFINED(buf, c_stream.total_out);
+#endif /* HAVE_valgrind */
/* Zero out the area reserved for the modification log.
Space for the end marker of the modification log is not
@@ -1615,7 +1615,7 @@ err_exit:
page_zip_compress_write_log(page_zip, page, index, mtr);
}
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
#ifdef PAGE_ZIP_COMPRESS_DBG
if (logfile) {
@@ -1656,7 +1656,7 @@ page_zip_fields_free(
{
if (index) {
dict_table_t* table = index->table;
- dict_index_zip_pad_mutex_destroy(index);
+ mysql_mutex_destroy(&index->zip_pad.mutex);
mem_heap_free(index->heap);
dict_mem_table_free(table);
@@ -1758,8 +1758,9 @@ page_zip_fields_decode(
if (!val) {
val = ULINT_UNDEFINED;
} else if (UNIV_UNLIKELY(val >= n)) {
+fail:
page_zip_fields_free(index);
- index = NULL;
+ return NULL;
} else {
index->type = DICT_CLUSTERED;
}
@@ -1768,8 +1769,7 @@ page_zip_fields_decode(
} else {
/* Decode the number of nullable fields. */
if (UNIV_UNLIKELY(index->n_nullable > val)) {
- page_zip_fields_free(index);
- index = NULL;
+ goto fail;
} else {
index->n_nullable = unsigned(val);
}
@@ -1984,7 +1984,7 @@ const byte*
page_zip_apply_log_ext(
/*===================*/
rec_t* rec, /*!< in/out: record */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col, /*!< in: position of of DB_TRX_ID */
const byte* data, /*!< in: modification log */
const byte* end) /*!< in: end of modification log */
@@ -2085,7 +2085,7 @@ page_zip_apply_log(
/*!< in: heap_no and status bits for
the next record to uncompress */
dict_index_t* index, /*!< in: index of the page */
- ulint* offsets)/*!< in/out: work area for
+ rec_offs* offsets)/*!< in/out: work area for
rec_get_offsets_reverse() */
{
const byte* const end = data + size;
@@ -2153,7 +2153,7 @@ page_zip_apply_log(
if (val & 1) {
/* Clear the data bytes of the record. */
mem_heap_t* heap = NULL;
- ulint* offs;
+ rec_offs* offs;
offs = rec_get_offsets(rec, index, offsets, is_leaf,
ULINT_UNDEFINED, &heap);
memset(rec, 0, rec_offs_data_size(offs));
@@ -2305,7 +2305,7 @@ page_zip_decompress_node_ptrs(
sorted by address */
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
- ulint* offsets, /*!< in/out: temporary offsets */
+ rec_offs* offsets, /*!< in/out: temporary offsets */
mem_heap_t* heap) /*!< in: temporary memory heap */
{
ulint heap_status = REC_STATUS_NODE_PTR
@@ -2494,7 +2494,7 @@ page_zip_decompress_sec(
sorted by address */
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
- ulint* offsets) /*!< in/out: temporary offsets */
+ rec_offs* offsets) /*!< in/out: temporary offsets */
{
ulint heap_status = REC_STATUS_ORDINARY
| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
@@ -2626,7 +2626,7 @@ page_zip_decompress_clust_ext(
/*==========================*/
z_stream* d_stream, /*!< in/out: compressed page stream */
rec_t* rec, /*!< in/out: record */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
ulint trx_id_col) /*!< in: position of of DB_TRX_ID */
{
ulint i;
@@ -2741,7 +2741,7 @@ page_zip_decompress_clust(
ulint n_dense, /*!< in: size of recs[] */
dict_index_t* index, /*!< in: the index of the page */
ulint trx_id_col, /*!< index of the trx_id column */
- ulint* offsets, /*!< in/out: temporary offsets */
+ rec_offs* offsets, /*!< in/out: temporary offsets */
mem_heap_t* heap) /*!< in: temporary memory heap */
{
int err;
@@ -3044,11 +3044,11 @@ page_zip_decompress_low(
ulint n_dense;/* number of user records on the page */
ulint trx_id_col = ULINT_UNDEFINED;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_ADDRESSABLE(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* The dense directory excludes the infimum and supremum records. */
n_dense = page_dir_get_n_heap(page_zip->data) - PAGE_HEAP_NO_USER_LOW;
@@ -3092,9 +3092,9 @@ page_zip_decompress_low(
#ifdef UNIV_ZIP_DEBUG
/* Clear the uncompressed page, except the header. */
- memset(PAGE_DATA + page, 0x55, UNIV_PAGE_SIZE - PAGE_DATA);
+ memset(PAGE_DATA + page, 0x55, srv_page_size - PAGE_DATA);
#endif /* UNIV_ZIP_DEBUG */
- UNIV_MEM_INVALID(PAGE_DATA + page, UNIV_PAGE_SIZE - PAGE_DATA);
+ MEM_UNDEFINED(PAGE_DATA + page, srv_page_size - PAGE_DATA);
/* Copy the page directory. */
if (UNIV_UNLIKELY(!page_zip_dir_decode(page_zip, page, recs,
@@ -3168,10 +3168,10 @@ zlib_error:
ulint n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
- offsets = static_cast<ulint*>(
+ offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, n * sizeof(ulint)));
- *offsets = n;
+ rec_offs_set_n_alloc(offsets, n);
}
/* Decompress the records in heap_no order. */
@@ -3224,7 +3224,7 @@ err_exit:
}
ut_a(page_is_comp(page));
- UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+ MEM_CHECK_DEFINED(page, srv_page_size);
page_zip_fields_free(index);
mem_heap_free(heap);
@@ -3336,7 +3336,19 @@ page_zip_validate_low(
FIL_PAGE_LSN - FIL_PAGE_PREV)
|| memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2)
|| memcmp(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA,
- PAGE_DATA - FIL_PAGE_DATA)) {
+ PAGE_ROOT_AUTO_INC)
+ /* The PAGE_ROOT_AUTO_INC can be updated while holding an SX-latch
+ on the clustered index root page (page number 3 in .ibd files).
+ That allows concurrent readers (holding buf_block_t::lock S-latch).
+ Because we do not know what type of a latch our caller is holding,
+ we will ignore the field on clustered index root pages in order
+ to avoid false positives. */
+ || (page_get_page_no(page) != 3/* clustered index root page */
+ && memcmp(&page_zip->data[FIL_PAGE_DATA + PAGE_ROOT_AUTO_INC],
+ &page[FIL_PAGE_DATA + PAGE_ROOT_AUTO_INC], 8))
+ || memcmp(&page_zip->data[FIL_PAGE_DATA + PAGE_HEADER_PRIV_END],
+ &page[FIL_PAGE_DATA + PAGE_HEADER_PRIV_END],
+ PAGE_DATA - FIL_PAGE_DATA - PAGE_HEADER_PRIV_END)) {
page_zip_fail(("page_zip_validate: page header\n"));
page_zip_hexdump(page_zip, sizeof *page_zip);
page_zip_hexdump(page_zip->data, page_zip_get_size(page_zip));
@@ -3355,8 +3367,8 @@ page_zip_validate_low(
temp_page_buf = static_cast<byte*>(ut_malloc_nokey(2 * UNIV_PAGE_SIZE));
temp_page = static_cast<byte*>(ut_align(temp_page_buf, UNIV_PAGE_SIZE));
- UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
temp_page_zip = *page_zip;
valid = page_zip_decompress_low(&temp_page_zip, temp_page, TRUE);
@@ -3395,7 +3407,7 @@ page_zip_validate_low(
committed. Let us tolerate that difference when we
are performing a sloppy validation. */
- ulint* offsets;
+ rec_offs* offsets;
mem_heap_t* heap;
const rec_t* rec;
const rec_t* trec;
@@ -3419,11 +3431,12 @@ page_zip_validate_low(
differed. Let us ignore it. */
page_zip_fail(("page_zip_validate:"
" min_rec_flag"
- " (%s%lu,%lu,0x%02lx)\n",
+ " (%s" ULINTPF "," ULINTPF
+ ",0x%02x)\n",
sloppy ? "ignored, " : "",
page_get_space_id(page),
page_get_page_no(page),
- (ulong) page[offset]));
+ page[offset]));
/* We don't check for spatial index, since
the "minimum record" could be deleted when
doing rtr_update_mbr_field.
@@ -3562,7 +3575,7 @@ page_zip_write_rec_ext(
const page_t* page, /*!< in: page containing rec */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: record descriptor */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */
ulint create, /*!< in: nonzero=insert, zero=update */
ulint trx_id_col, /*!< in: position of DB_TRX_ID */
ulint heap_no, /*!< in: heap number of rec */
@@ -3576,9 +3589,9 @@ page_zip_write_rec_ext(
ulint n_ext = rec_offs_n_extern(offsets);
ut_ad(rec_offs_validate(rec, index, offsets));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
externs -= (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)
* (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW);
@@ -3681,7 +3694,7 @@ page_zip_write_rec(
page_zip_des_t* page_zip,/*!< in/out: compressed page */
const byte* rec, /*!< in: record being written */
dict_index_t* index, /*!< in: the index the record belongs to */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint create) /*!< in: nonzero=insert, zero=update */
{
const page_t* page;
@@ -3703,10 +3716,10 @@ page_zip_write_rec(
ut_ad(page_zip_header_cmp(page_zip, page));
ut_ad(page_simple_validate_new((page_t*) page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
@@ -3931,7 +3944,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being
written */
dict_index_t* index, /*!< in: index of the page */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint n, /*!< in: column index */
mtr_t* mtr) /*!< in: mini-transaction handle,
or NULL if no logging is needed */
@@ -3961,10 +3974,10 @@ page_zip_write_blob_ptr(
ut_ad(page_is_leaf(page));
ut_ad(dict_index_is_clust(index));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
blob_no = page_zip_get_n_prev_extern(page_zip, rec, index)
+ rec_get_n_extern_new(rec, index, n);
@@ -4107,8 +4120,8 @@ page_zip_write_node_ptr(
ut_ad(!page_is_leaf(page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, size);
storage = page_zip_dir_start(page_zip)
- (rec_get_heap_no_new(rec) - 1) * REC_NODE_PTR_SIZE;
@@ -4149,7 +4162,7 @@ page_zip_write_trx_id_and_roll_ptr(
/*===============================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page */
byte* rec, /*!< in/out: record */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint trx_id_col,/*!< in: column number of TRX_ID in rec */
trx_id_t trx_id, /*!< in: transaction identifier */
roll_ptr_t roll_ptr)/*!< in: roll_ptr */
@@ -4173,7 +4186,7 @@ page_zip_write_trx_id_and_roll_ptr(
ut_ad(page_is_leaf(page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
storage = page_zip_dir_start(page_zip)
- (rec_get_heap_no_new(rec) - 1)
@@ -4200,10 +4213,10 @@ page_zip_write_trx_id_and_roll_ptr(
mach_write_to_7(field + DATA_TRX_ID_LEN, roll_ptr);
memcpy(storage, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
}
/**********************************************************************//**
@@ -4216,7 +4229,7 @@ page_zip_clear_rec(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: record to clear */
const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets) /*!< in: rec_get_offsets(rec, index) */
{
ulint heap_no;
page_t* page = page_align(rec);
@@ -4233,10 +4246,10 @@ page_zip_clear_rec(
heap_no = rec_get_heap_no_new(rec);
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
if (!page_is_leaf(page)) {
/* Clear node_ptr. On the compressed page,
@@ -4305,7 +4318,7 @@ page_zip_rec_set_deleted(
{
byte* slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (flag) {
*slot |= (PAGE_ZIP_DIR_SLOT_DEL >> 8);
} else {
@@ -4328,7 +4341,7 @@ page_zip_rec_set_owned(
{
byte* slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (flag) {
*slot |= (PAGE_ZIP_DIR_SLOT_OWNED >> 8);
} else {
@@ -4355,7 +4368,7 @@ page_zip_dir_insert(
ut_ad(page_rec_get_next((rec_t*) prev_rec) == rec);
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (page_rec_is_infimum(prev_rec)) {
/* Use the first slot. */
@@ -4422,7 +4435,7 @@ page_zip_dir_delete(
page_zip_des_t* page_zip, /*!< in/out: compressed page */
byte* rec, /*!< in: deleted record */
const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
const byte* free) /*!< in: previous start of
the free list */
{
@@ -4434,10 +4447,10 @@ page_zip_dir_delete(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_comp(offsets));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
@@ -4526,7 +4539,7 @@ page_zip_dir_add_slot(
byte* stored;
ut_ad(page_is_comp(page_zip->data));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* Read the old n_dense (n_heap has already been incremented). */
n_dense = page_dir_get_n_heap(page_zip->data)
@@ -4688,8 +4701,8 @@ page_zip_reorganize(
ut_ad(!dict_index_is_ibuf(index));
ut_ad(!dict_table_is_temporary(index->table));
/* Note that page_zip_validate(page_zip, page, index) may fail here. */
- UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* Disable logging */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@@ -4776,10 +4789,10 @@ page_zip_copy_recs(
ut_a(dict_index_is_clust(index));
}
- UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
- UNIV_MEM_ASSERT_W(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(src, UNIV_PAGE_SIZE);
- UNIV_MEM_ASSERT_RW(src_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_ADDRESSABLE(page, srv_page_size);
+ MEM_CHECK_ADDRESSABLE(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(src, srv_page_size);
+ MEM_CHECK_DEFINED(src_zip->data, page_zip_get_size(page_zip));
/* Copy those B-tree page header fields that are related to
the records stored in the page. Also copy the field
@@ -4973,61 +4986,26 @@ page_zip_calc_checksum(
return(0);
}
-/**********************************************************************//**
-Verify a compressed page's checksum.
-@return TRUE if the stored checksum is valid according to the value of
-innodb_checksum_algorithm */
-ibool
-page_zip_verify_checksum(
-/*=====================*/
- const void* data, /*!< in: compressed page */
- ulint size) /*!< in: size of compressed page */
+/** Validate the checksum on a ROW_FORMAT=COMPRESSED page.
+@param data ROW_FORMAT=COMPRESSED page
+@param size size of the page, in bytes
+@return whether the stored checksum matches innodb_checksum_algorithm */
+bool page_zip_verify_checksum(const byte *data, size_t size)
{
- const uint32_t stored = mach_read_from_4(
- static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM);
-
-#if FIL_PAGE_LSN % 8
-#error "FIL_PAGE_LSN must be 64 bit aligned"
-#endif
-
- /* Check if page is empty */
- if (stored == 0
- && *reinterpret_cast<const ib_uint64_t*>(static_cast<const char*>(
- data)
- + FIL_PAGE_LSN) == 0) {
- /* make sure that the page is really empty */
-#ifdef UNIV_INNOCHECKSUM
- ulint i;
- for (i = 0; i < size; i++) {
- if (*((const char*) data + i) != 0)
- break;
- }
- if (i >= size) {
- if (log_file) {
- fprintf(log_file, "Page::%llu is empty and"
- " uncorrupted\n", cur_page_num);
- }
-
- return(TRUE);
- }
-#else
- for (ulint i = 0; i < size; i++) {
- if (*((const char*) data + i) != 0) {
- return(FALSE);
- }
- }
- /* Empty page */
- return(TRUE);
-#endif /* UNIV_INNOCHECKSUM */
- }
-
const srv_checksum_algorithm_t curr_algo =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
- return(TRUE);
+ return true;
+ }
+
+ if (buf_is_zeroes(span<const byte>(data, size))) {
+ return true;
}
+ const uint32_t stored = mach_read_from_4(
+ data + FIL_PAGE_SPACE_OR_CHKSUM);
+
uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
#ifdef UNIV_INNOCHECKSUM
@@ -5042,7 +5020,6 @@ page_zip_verify_checksum(
}
if (!strict_verify) {
-
const uint32_t crc32 = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
diff --git a/storage/innobase/pars/lexyy.cc b/storage/innobase/pars/lexyy.cc
index e7f3981e0fe..1e93ec3ed50 100644
--- a/storage/innobase/pars/lexyy.cc
+++ b/storage/innobase/pars/lexyy.cc
@@ -356,8 +356,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 123
-#define YY_END_OF_BUFFER 124
+#define YY_NUM_RULES 102
+#define YY_END_OF_BUFFER 103
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -365,53 +365,42 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[404] =
+static const flex_int16_t yy_accept[307] =
{ 0,
- 0, 0, 118, 118, 0, 0, 0, 0, 124, 122,
- 121, 121, 8, 122, 113, 5, 102, 108, 111, 109,
- 106, 110, 122, 112, 1, 122, 107, 105, 103, 104,
- 116, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 114, 115, 118, 119, 6, 7, 9, 10, 121, 4,
- 97, 117, 2, 1, 3, 98, 99, 101, 100, 0,
- 95, 0, 95, 95, 95, 95, 95, 44, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 28, 17, 25, 95, 95, 95, 95,
-
- 95, 95, 54, 62, 95, 14, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 118, 119, 119, 120, 6, 7,
- 9, 10, 2, 0, 96, 13, 45, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 27, 95, 95, 95, 41,
- 95, 95, 95, 95, 21, 95, 95, 95, 95, 95,
- 15, 95, 95, 95, 18, 95, 95, 95, 95, 95,
- 81, 95, 95, 95, 51, 95, 12, 95, 36, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
-
- 0, 96, 95, 95, 95, 95, 20, 95, 24, 95,
- 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
- 46, 95, 30, 95, 88, 95, 95, 39, 95, 95,
- 95, 95, 95, 48, 95, 93, 90, 32, 92, 95,
- 11, 65, 95, 95, 95, 42, 95, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 29, 95, 95, 95,
- 95, 95, 95, 95, 95, 95, 86, 0, 95, 26,
- 95, 95, 95, 67, 95, 95, 95, 95, 37, 95,
- 95, 95, 95, 95, 95, 31, 66, 23, 95, 59,
- 95, 76, 95, 95, 95, 43, 95, 95, 95, 95,
-
- 95, 95, 95, 95, 91, 95, 95, 56, 95, 95,
- 95, 95, 95, 95, 95, 40, 33, 0, 80, 94,
- 19, 95, 95, 84, 95, 75, 55, 95, 64, 95,
- 52, 95, 95, 47, 95, 77, 95, 79, 95, 95,
- 34, 95, 95, 95, 35, 73, 95, 95, 95, 95,
- 60, 95, 50, 49, 95, 95, 95, 57, 53, 63,
- 95, 95, 22, 95, 95, 74, 82, 95, 95, 78,
- 95, 69, 95, 95, 95, 95, 95, 38, 89, 68,
- 95, 85, 95, 95, 95, 87, 95, 95, 61, 16,
- 95, 71, 70, 95, 58, 83, 95, 95, 95, 95,
-
- 95, 72, 0
+ 0, 0, 97, 97, 0, 0, 0, 0, 103, 101,
+ 100, 100, 8, 101, 92, 5, 81, 87, 90, 88,
+ 85, 89, 101, 91, 1, 101, 86, 84, 82, 83,
+ 95, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+ 93, 94, 97, 98, 6, 7, 9, 10, 100, 4,
+ 76, 96, 2, 1, 3, 77, 78, 80, 79, 0,
+ 74, 0, 74, 74, 74, 74, 36, 74, 74, 74,
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+ 23, 17, 20, 74, 74, 74, 74, 74, 74, 46,
+
+ 52, 74, 14, 74, 74, 74, 74, 74, 74, 74,
+ 74, 74, 74, 74, 74, 74, 74, 74, 97, 98,
+ 98, 99, 6, 7, 9, 10, 2, 0, 75, 13,
+ 37, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+ 74, 74, 74, 74, 74, 22, 74, 74, 34, 74,
+ 74, 74, 74, 18, 74, 74, 74, 74, 74, 15,
+ 74, 74, 74, 74, 74, 74, 74, 43, 74, 12,
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
+ 0, 75, 74, 74, 19, 74, 74, 74, 74, 74,
+ 74, 74, 74, 74, 74, 38, 25, 74, 67, 74,
+
+ 32, 74, 74, 74, 74, 40, 74, 72, 69, 27,
+ 71, 74, 11, 55, 74, 74, 74, 74, 74, 74,
+ 74, 74, 24, 74, 74, 74, 74, 74, 74, 66,
+ 0, 21, 74, 57, 74, 74, 74, 31, 74, 74,
+ 74, 74, 74, 26, 56, 74, 49, 74, 62, 74,
+ 74, 35, 74, 74, 74, 74, 70, 74, 48, 74,
+ 74, 74, 74, 33, 28, 0, 73, 74, 64, 61,
+ 47, 74, 54, 74, 44, 74, 39, 63, 74, 74,
+ 29, 74, 30, 60, 74, 50, 42, 41, 74, 45,
+ 53, 74, 74, 74, 74, 74, 74, 68, 58, 74,
+
+ 65, 74, 51, 16, 59, 0
} ;
static const YY_CHAR yy_ec[256] =
@@ -424,12 +413,12 @@ static const YY_CHAR yy_ec[256] =
17, 17, 17, 17, 17, 17, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 1, 1, 1, 1, 51, 1, 34, 34, 34, 34,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 34,
+ 1, 1, 1, 1, 50, 1, 34, 34, 34, 34,
- 34, 34, 34, 34, 34, 34, 34, 52, 34, 34,
- 34, 34, 53, 34, 54, 34, 34, 34, 34, 34,
- 34, 34, 55, 1, 56, 1, 1, 1, 1, 1,
+ 34, 34, 34, 34, 34, 34, 34, 51, 34, 34,
+ 34, 34, 52, 34, 53, 34, 34, 34, 34, 34,
+ 34, 34, 54, 1, 55, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -446,418 +435,324 @@ static const YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static const YY_CHAR yy_meta[57] =
+static const YY_CHAR yy_meta[56] =
{ 0,
1, 1, 1, 2, 3, 1, 1, 4, 1, 1,
5, 1, 1, 1, 1, 6, 7, 1, 1, 1,
8, 1, 1, 6, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 1, 1
+ 9, 9, 9, 1, 1
} ;
-static const flex_int16_t yy_base[417] =
+static const flex_int16_t yy_base[320] =
{ 0,
- 0, 0, 296, 281, 283, 280, 261, 252, 253, 1285,
- 55, 57, 1285, 0, 1285, 1285, 1285, 1285, 1285, 1285,
- 1285, 1285, 211, 213, 46, 202, 1285, 43, 1285, 199,
- 1285, 46, 50, 56, 52, 66, 64, 51, 81, 92,
- 91, 94, 96, 111, 113, 116, 130, 134, 53, 143,
- 1285, 1285, 0, 106, 0, 206, 0, 205, 141, 0,
- 1285, 1285, 177, 56, 152, 1285, 1285, 1285, 1285, 161,
- 140, 147, 152, 154, 155, 161, 167, 171, 177, 172,
- 184, 174, 188, 189, 191, 194, 203, 212, 217, 219,
- 222, 223, 228, 224, 226, 233, 235, 239, 244, 251,
-
- 256, 260, 261, 262, 265, 271, 266, 281, 277, 287,
- 282, 288, 303, 306, 307, 292, 310, 321, 322, 323,
- 324, 325, 335, 338, 0, 112, 173, 1285, 0, 152,
- 0, 145, 130, 59, 0, 339, 341, 353, 351, 354,
- 365, 367, 355, 372, 376, 383, 379, 386, 388, 385,
- 398, 392, 402, 401, 414, 415, 416, 417, 426, 430,
- 432, 437, 433, 439, 442, 443, 449, 456, 460, 461,
- 463, 470, 472, 473, 479, 483, 485, 489, 492, 495,
- 498, 499, 502, 508, 509, 514, 515, 518, 520, 527,
- 530, 534, 536, 541, 543, 553, 555, 557, 559, 568,
-
- 41, 0, 564, 569, 570, 573, 574, 585, 580, 589,
- 586, 595, 598, 600, 605, 610, 611, 617, 620, 615,
- 622, 627, 626, 631, 641, 642, 646, 647, 648, 651,
- 652, 653, 657, 662, 663, 667, 669, 673, 680, 682,
- 684, 685, 686, 687, 689, 696, 698, 700, 701, 703,
- 699, 710, 714, 716, 729, 732, 731, 733, 735, 734,
- 746, 747, 748, 752, 753, 759, 749, 39, 769, 770,
- 771, 773, 774, 780, 783, 784, 787, 785, 786, 802,
- 800, 803, 816, 817, 818, 819, 820, 823, 833, 835,
- 836, 837, 838, 839, 848, 849, 852, 853, 854, 859,
-
- 863, 870, 868, 872, 875, 884, 885, 887, 889, 890,
- 888, 904, 906, 907, 908, 918, 919, 73, 921, 922,
- 923, 924, 933, 934, 936, 937, 938, 939, 940, 949,
- 952, 955, 953, 965, 969, 970, 971, 972, 974, 975,
- 981, 984, 986, 988, 990, 991, 1000, 1006, 1004, 1009,
- 1016, 1018, 1020, 1021, 1025, 1027, 1032, 1034, 1038, 1039,
- 1041, 1043, 1048, 1050, 1052, 1055, 1059, 1064, 1066, 1068,
- 1071, 1073, 1077, 1084, 1086, 1087, 1091, 1093, 1098, 1100,
- 1102, 1104, 1105, 1111, 1114, 1116, 1117, 1118, 1120, 1127,
- 1129, 1130, 1134, 1139, 1141, 1145, 1146, 1148, 1150, 1151,
-
- 1155, 1157, 1285, 1197, 1206, 1215, 1218, 1221, 1225, 1234,
- 1243, 1252, 1261, 1268, 1272, 1275
+ 0, 0, 262, 259, 249, 244, 239, 234, 236, 960,
+ 54, 56, 960, 0, 960, 960, 960, 960, 960, 960,
+ 960, 960, 217, 220, 45, 186, 960, 42, 960, 184,
+ 960, 45, 49, 55, 51, 65, 80, 50, 69, 94,
+ 90, 92, 104, 60, 114, 116, 131, 134, 135, 149,
+ 960, 960, 0, 61, 0, 194, 0, 197, 133, 0,
+ 960, 960, 163, 53, 143, 960, 960, 960, 960, 147,
+ 125, 123, 138, 151, 152, 153, 155, 166, 169, 173,
+ 170, 171, 176, 180, 193, 182, 200, 204, 206, 209,
+ 210, 211, 213, 224, 225, 226, 235, 240, 242, 245,
+
+ 251, 252, 255, 256, 258, 261, 270, 274, 272, 277,
+ 289, 288, 276, 294, 295, 300, 304, 305, 0, 79,
+ 110, 960, 0, 116, 0, 113, 98, 58, 0, 306,
+ 315, 316, 318, 319, 322, 328, 329, 332, 334, 338,
+ 344, 353, 351, 354, 366, 360, 367, 369, 376, 378,
+ 381, 385, 388, 382, 394, 400, 403, 404, 406, 407,
+ 410, 417, 423, 424, 426, 429, 433, 440, 442, 443,
+ 444, 445, 454, 456, 459, 461, 472, 473, 474, 477,
+ 53, 0, 475, 478, 479, 490, 502, 504, 505, 507,
+ 508, 509, 511, 518, 520, 523, 524, 525, 529, 538,
+
+ 541, 542, 543, 545, 547, 544, 556, 557, 558, 559,
+ 560, 569, 572, 574, 578, 581, 579, 583, 588, 590,
+ 600, 601, 602, 607, 611, 613, 612, 618, 622, 629,
+ 41, 634, 636, 638, 639, 643, 645, 648, 649, 650,
+ 655, 659, 661, 660, 670, 675, 676, 679, 680, 682,
+ 686, 689, 691, 696, 693, 700, 705, 706, 709, 711,
+ 712, 716, 722, 723, 726, 72, 727, 736, 737, 738,
+ 739, 740, 742, 743, 752, 753, 755, 757, 758, 759,
+ 764, 770, 769, 771, 774, 784, 785, 786, 787, 789,
+ 790, 791, 796, 801, 802, 803, 806, 807, 812, 817,
+
+ 816, 823, 826, 828, 832, 960, 872, 881, 890, 893,
+ 896, 900, 909, 918, 927, 936, 943, 947, 950
} ;
-static const flex_int16_t yy_def[417] =
+static const flex_int16_t yy_def[320] =
{ 0,
- 403, 1, 404, 404, 405, 405, 406, 406, 403, 403,
- 403, 403, 403, 407, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 408, 403, 403, 403, 403,
- 403, 409, 409, 409, 409, 409, 34, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 403, 403, 410, 411, 412, 403, 413, 403, 403, 407,
- 403, 403, 403, 403, 408, 403, 403, 403, 403, 414,
- 409, 415, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
-
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 410, 411, 411, 403, 412, 403,
- 413, 403, 403, 403, 416, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
-
- 403, 416, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 403, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
-
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 403, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
- 409, 409, 409, 409, 409, 409, 409, 409, 409, 409,
-
- 409, 409, 0, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403
+ 306, 1, 307, 307, 308, 308, 309, 309, 306, 306,
+ 306, 306, 306, 310, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 311, 306, 306, 306, 306,
+ 306, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 306, 306, 313, 314, 315, 306, 316, 306, 306, 310,
+ 306, 306, 306, 306, 311, 306, 306, 306, 306, 317,
+ 312, 318, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 313, 314,
+ 314, 306, 315, 306, 316, 306, 306, 306, 319, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 306, 319, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 306, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 306, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
+
+ 312, 312, 312, 312, 312, 0, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306
} ;
-static const flex_int16_t yy_nxt[1342] =
+static const flex_int16_t yy_nxt[1016] =
{ 0,
10, 11, 12, 13, 10, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 10, 32, 33, 34, 35, 36, 37,
38, 38, 39, 38, 38, 40, 41, 42, 43, 44,
38, 45, 46, 47, 48, 49, 50, 38, 38, 38,
- 38, 38, 38, 38, 51, 52, 59, 59, 59, 59,
- 63, 70, 64, 67, 68, 70, 70, 70, 70, 72,
- 63, 70, 64, 72, 72, 72, 72, 122, 75, 72,
- 84, 70, 76, 73, 85, 77, 135, 79, 74, 72,
- 318, 80, 89, 268, 81, 71, 70, 82, 78, 90,
-
- 83, 86, 91, 87, 72, 92, 70, 70, 93, 70,
- 94, 70, 201, 88, 72, 72, 127, 72, 95, 72,
- 97, 128, 403, 96, 98, 103, 70, 403, 70, 100,
- 99, 70, 101, 104, 72, 105, 72, 106, 102, 72,
- 107, 109, 59, 59, 112, 70, 133, 113, 132, 70,
- 110, 111, 108, 72, 117, 70, 114, 72, 70, 130,
- 115, 118, 70, 72, 116, 134, 72, 70, 119, 70,
- 70, 120, 403, 121, 123, 72, 70, 72, 72, 136,
- 137, 124, 70, 127, 72, 139, 70, 70, 128, 70,
- 72, 140, 70, 133, 72, 72, 138, 72, 141, 70,
-
- 72, 143, 149, 70, 70, 142, 70, 72, 132, 70,
- 144, 72, 72, 130, 72, 151, 145, 72, 70, 69,
- 146, 147, 66, 62, 152, 61, 72, 70, 148, 150,
- 156, 153, 70, 154, 70, 72, 155, 70, 70, 70,
- 72, 70, 72, 70, 157, 72, 72, 72, 70, 72,
- 70, 72, 403, 163, 70, 58, 72, 159, 72, 70,
- 158, 161, 72, 160, 58, 162, 70, 72, 164, 165,
- 168, 70, 166, 167, 72, 70, 70, 70, 170, 72,
- 70, 70, 169, 72, 72, 72, 70, 56, 72, 72,
- 56, 54, 70, 173, 72, 172, 70, 70, 174, 171,
-
- 72, 178, 70, 70, 72, 72, 54, 70, 403, 175,
- 72, 72, 403, 176, 181, 72, 179, 182, 70, 177,
- 180, 70, 70, 184, 403, 70, 72, 186, 183, 72,
- 72, 185, 188, 72, 190, 191, 70, 70, 70, 70,
- 70, 187, 403, 189, 72, 72, 72, 72, 72, 192,
- 70, 196, 403, 70, 70, 194, 70, 403, 72, 403,
- 197, 72, 72, 198, 72, 195, 70, 199, 70, 70,
- 70, 403, 193, 403, 72, 403, 72, 72, 72, 200,
- 70, 203, 70, 204, 403, 403, 205, 70, 72, 206,
- 72, 70, 207, 208, 70, 72, 209, 403, 70, 72,
-
- 70, 70, 72, 70, 403, 214, 72, 70, 72, 72,
- 403, 72, 216, 70, 210, 72, 70, 70, 211, 212,
- 220, 72, 213, 215, 72, 72, 217, 218, 221, 70,
- 70, 70, 70, 219, 403, 403, 403, 72, 72, 72,
- 72, 70, 223, 226, 222, 70, 224, 70, 70, 72,
- 227, 403, 70, 72, 70, 72, 72, 70, 70, 225,
- 72, 230, 72, 229, 70, 72, 72, 231, 228, 403,
- 233, 70, 72, 235, 403, 70, 70, 236, 70, 72,
- 234, 403, 232, 72, 72, 70, 72, 70, 70, 239,
- 237, 403, 240, 72, 70, 72, 72, 403, 70, 238,
-
- 70, 243, 72, 403, 70, 241, 72, 70, 72, 242,
- 70, 245, 72, 70, 70, 72, 246, 70, 72, 403,
- 244, 72, 72, 70, 70, 72, 403, 247, 403, 70,
- 70, 72, 72, 70, 250, 70, 252, 72, 72, 248,
- 403, 72, 70, 72, 403, 70, 403, 403, 249, 70,
- 72, 70, 251, 72, 255, 253, 70, 72, 70, 72,
- 254, 258, 259, 403, 72, 256, 72, 403, 70, 403,
- 70, 257, 70, 260, 70, 262, 72, 263, 72, 70,
- 72, 261, 72, 70, 70, 70, 403, 72, 70, 70,
- 403, 72, 72, 72, 266, 70, 72, 72, 265, 264,
-
- 70, 70, 267, 72, 70, 269, 270, 271, 72, 72,
- 70, 403, 72, 70, 272, 70, 403, 274, 72, 273,
- 70, 72, 277, 72, 278, 70, 70, 276, 72, 275,
- 70, 403, 70, 72, 72, 70, 403, 70, 72, 281,
- 72, 70, 70, 72, 283, 72, 70, 403, 279, 72,
- 72, 403, 403, 280, 72, 282, 70, 70, 284, 285,
- 286, 70, 70, 70, 72, 72, 70, 70, 70, 72,
- 72, 72, 70, 287, 72, 72, 72, 70, 70, 403,
- 72, 403, 70, 403, 70, 72, 72, 293, 70, 288,
- 72, 289, 72, 291, 292, 70, 72, 70, 290, 70,
-
- 70, 70, 70, 72, 70, 72, 294, 72, 72, 72,
- 72, 70, 72, 70, 70, 70, 70, 298, 70, 72,
- 295, 72, 72, 72, 72, 70, 72, 296, 302, 70,
- 297, 70, 403, 72, 403, 403, 304, 72, 303, 72,
- 299, 300, 305, 301, 70, 403, 70, 70, 70, 70,
- 70, 403, 72, 307, 72, 72, 72, 72, 72, 306,
- 308, 70, 70, 70, 70, 309, 310, 70, 70, 72,
- 72, 72, 72, 403, 70, 72, 72, 313, 311, 403,
- 315, 316, 72, 403, 70, 70, 70, 317, 70, 70,
- 312, 314, 72, 72, 72, 70, 72, 72, 70, 70,
-
- 70, 70, 70, 72, 403, 403, 72, 72, 72, 72,
- 72, 323, 319, 325, 320, 70, 403, 70, 70, 403,
- 403, 321, 403, 72, 322, 72, 72, 324, 326, 403,
- 327, 70, 70, 70, 70, 70, 403, 328, 70, 72,
- 72, 72, 72, 72, 329, 331, 72, 403, 70, 403,
- 70, 70, 70, 70, 70, 332, 72, 330, 72, 72,
- 72, 72, 72, 70, 70, 333, 335, 70, 70, 70,
- 336, 72, 72, 403, 70, 72, 72, 72, 70, 334,
- 339, 338, 72, 70, 403, 70, 72, 70, 403, 403,
- 70, 72, 337, 72, 343, 72, 341, 340, 72, 70,
-
- 70, 403, 70, 70, 70, 70, 342, 72, 72, 344,
- 72, 72, 72, 72, 349, 345, 403, 403, 403, 70,
- 403, 70, 70, 70, 350, 346, 348, 72, 347, 72,
- 72, 72, 351, 70, 70, 353, 70, 70, 70, 70,
- 403, 72, 72, 352, 72, 72, 72, 72, 70, 70,
- 354, 70, 70, 70, 70, 70, 72, 72, 403, 72,
- 72, 72, 72, 72, 70, 403, 356, 70, 70, 403,
- 70, 403, 72, 355, 357, 72, 72, 360, 72, 358,
- 70, 361, 359, 403, 70, 70, 70, 70, 72, 70,
- 70, 362, 72, 72, 72, 72, 70, 72, 72, 70,
-
- 403, 70, 403, 70, 72, 70, 70, 72, 364, 72,
- 363, 72, 368, 72, 72, 70, 366, 403, 365, 70,
- 369, 70, 403, 72, 70, 367, 403, 72, 370, 72,
- 371, 70, 72, 70, 373, 70, 70, 403, 403, 72,
- 70, 72, 70, 72, 72, 372, 374, 70, 72, 70,
- 72, 403, 403, 70, 70, 72, 70, 72, 70, 376,
- 377, 72, 72, 70, 72, 70, 72, 70, 375, 403,
- 70, 72, 403, 72, 70, 72, 403, 380, 72, 70,
- 379, 70, 72, 70, 378, 403, 70, 72, 70, 72,
- 403, 72, 70, 381, 72, 403, 72, 403, 382, 70,
-
- 72, 70, 70, 383, 403, 385, 70, 72, 70, 72,
- 72, 386, 384, 70, 72, 70, 72, 70, 389, 70,
- 70, 72, 403, 72, 387, 72, 70, 72, 72, 70,
- 390, 70, 70, 70, 72, 70, 388, 72, 403, 72,
- 72, 72, 70, 72, 70, 70, 395, 403, 391, 70,
- 72, 403, 72, 72, 70, 393, 70, 72, 396, 392,
- 70, 70, 72, 70, 72, 70, 70, 394, 72, 72,
- 70, 72, 70, 72, 72, 400, 397, 403, 72, 401,
- 72, 403, 403, 403, 399, 403, 403, 403, 403, 403,
- 398, 403, 403, 403, 403, 403, 402, 53, 53, 53,
-
- 53, 53, 53, 53, 53, 53, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 60, 403, 60, 65, 65, 65,
- 71, 71, 403, 71, 125, 125, 125, 125, 403, 125,
- 125, 125, 125, 126, 126, 126, 126, 126, 126, 126,
- 126, 126, 129, 129, 129, 403, 129, 129, 129, 129,
- 129, 131, 403, 131, 131, 131, 131, 131, 131, 131,
- 135, 403, 403, 403, 403, 403, 135, 72, 72, 403,
- 72, 202, 403, 202, 9, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
-
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403
+ 38, 38, 38, 51, 52, 59, 59, 59, 59, 63,
+ 70, 64, 67, 68, 70, 70, 70, 63, 72, 64,
+ 70, 121, 72, 72, 72, 70, 122, 75, 72, 83,
+ 70, 76, 73, 72, 70, 129, 78, 74, 72, 306,
+ 79, 266, 72, 80, 306, 70, 81, 77, 91, 82,
+
+ 84, 104, 85, 72, 231, 70, 92, 70, 87, 70,
+ 181, 93, 86, 72, 127, 72, 126, 72, 88, 70,
+ 121, 89, 94, 124, 90, 122, 95, 72, 97, 70,
+ 98, 70, 96, 100, 59, 59, 99, 72, 70, 72,
+ 70, 101, 105, 102, 107, 103, 70, 108, 72, 70,
+ 70, 128, 106, 70, 72, 111, 109, 72, 72, 116,
+ 110, 72, 112, 306, 70, 130, 70, 70, 70, 113,
+ 70, 114, 72, 115, 72, 72, 72, 131, 72, 127,
+ 117, 70, 132, 133, 70, 70, 70, 118, 70, 72,
+ 134, 70, 72, 72, 72, 70, 72, 70, 140, 72,
+
+ 126, 124, 142, 72, 69, 72, 66, 135, 70, 137,
+ 138, 143, 141, 136, 147, 70, 72, 139, 144, 70,
+ 146, 70, 145, 72, 70, 70, 70, 72, 70, 72,
+ 62, 61, 72, 72, 72, 306, 72, 58, 152, 70,
+ 70, 70, 58, 148, 150, 149, 151, 72, 72, 72,
+ 70, 56, 157, 153, 154, 70, 56, 70, 72, 156,
+ 70, 155, 159, 72, 158, 72, 70, 70, 72, 54,
+ 70, 70, 54, 70, 72, 72, 70, 161, 72, 72,
+ 162, 72, 163, 160, 72, 70, 306, 70, 306, 70,
+ 306, 70, 70, 72, 164, 72, 166, 72, 169, 72,
+
+ 72, 165, 171, 70, 70, 167, 306, 170, 306, 70,
+ 70, 72, 72, 168, 172, 70, 173, 72, 72, 70,
+ 70, 70, 176, 72, 306, 174, 175, 72, 72, 72,
+ 70, 70, 178, 70, 70, 177, 179, 70, 72, 72,
+ 306, 72, 72, 70, 70, 72, 180, 70, 183, 70,
+ 184, 72, 72, 70, 306, 72, 306, 72, 189, 70,
+ 185, 72, 191, 306, 186, 188, 70, 72, 70, 70,
+ 187, 190, 306, 306, 72, 70, 72, 72, 306, 195,
+ 196, 70, 70, 72, 70, 192, 193, 306, 194, 72,
+ 72, 70, 72, 70, 197, 200, 70, 70, 198, 72,
+
+ 70, 72, 306, 70, 72, 72, 306, 202, 72, 70,
+ 199, 72, 306, 203, 201, 70, 204, 72, 70, 70,
+ 206, 70, 70, 72, 207, 70, 72, 72, 208, 72,
+ 72, 205, 70, 72, 211, 306, 212, 209, 70, 70,
+ 72, 70, 306, 210, 70, 213, 72, 72, 70, 72,
+ 216, 215, 72, 306, 214, 70, 72, 70, 70, 70,
+ 70, 219, 306, 72, 218, 72, 72, 72, 72, 70,
+ 217, 70, 306, 306, 70, 306, 70, 72, 306, 72,
+ 222, 224, 72, 220, 72, 226, 221, 70, 70, 70,
+ 70, 223, 70, 70, 70, 72, 72, 72, 72, 225,
+
+ 72, 72, 72, 306, 306, 70, 306, 306, 306, 229,
+ 306, 230, 232, 72, 228, 233, 227, 70, 234, 70,
+ 70, 306, 70, 70, 70, 72, 70, 72, 72, 237,
+ 72, 72, 72, 70, 72, 70, 236, 240, 70, 70,
+ 70, 72, 242, 72, 70, 235, 72, 72, 72, 241,
+ 238, 239, 72, 70, 244, 306, 70, 70, 70, 70,
+ 70, 72, 70, 243, 72, 72, 72, 72, 72, 245,
+ 72, 70, 70, 70, 70, 70, 306, 306, 306, 72,
+ 72, 72, 72, 72, 70, 246, 248, 70, 249, 70,
+ 247, 306, 72, 70, 70, 72, 70, 72, 70, 250,
+
+ 306, 72, 72, 70, 72, 70, 72, 251, 255, 253,
+ 306, 72, 306, 72, 256, 70, 70, 70, 257, 252,
+ 254, 306, 70, 72, 72, 72, 70, 70, 70, 259,
+ 72, 306, 306, 70, 72, 72, 72, 70, 306, 260,
+ 263, 72, 306, 258, 70, 72, 264, 306, 306, 70,
+ 265, 70, 72, 70, 70, 261, 262, 72, 70, 72,
+ 70, 72, 72, 70, 70, 70, 72, 268, 72, 306,
+ 70, 72, 72, 72, 70, 70, 70, 271, 72, 267,
+ 306, 306, 72, 72, 72, 70, 269, 272, 270, 275,
+ 70, 70, 306, 72, 70, 70, 273, 70, 72, 72,
+
+ 274, 70, 72, 72, 70, 72, 70, 276, 70, 72,
+ 306, 70, 72, 278, 72, 70, 72, 282, 280, 72,
+ 70, 70, 277, 72, 70, 306, 70, 70, 72, 72,
+ 279, 70, 72, 281, 72, 72, 306, 70, 70, 72,
+ 286, 70, 70, 283, 287, 72, 72, 284, 285, 72,
+ 72, 70, 70, 70, 70, 70, 306, 70, 70, 72,
+ 72, 72, 72, 72, 288, 72, 72, 70, 70, 306,
+ 70, 291, 70, 70, 70, 72, 72, 289, 72, 70,
+ 72, 72, 72, 290, 70, 70, 70, 72, 306, 70,
+ 306, 292, 72, 72, 72, 293, 295, 72, 296, 70,
+
+ 70, 70, 70, 294, 70, 70, 70, 72, 72, 72,
+ 72, 70, 72, 72, 72, 297, 70, 70, 70, 72,
+ 306, 70, 70, 299, 72, 72, 72, 70, 298, 72,
+ 72, 70, 70, 303, 306, 72, 301, 306, 70, 72,
+ 72, 70, 300, 70, 302, 304, 72, 70, 306, 72,
+ 306, 72, 306, 306, 306, 72, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 305, 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 57, 57, 57, 57, 57, 57, 57, 57, 57, 60,
+
+ 306, 60, 65, 65, 65, 71, 71, 306, 71, 119,
+ 119, 119, 119, 306, 119, 119, 119, 119, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 123, 123, 123,
+ 306, 123, 123, 123, 123, 123, 125, 306, 125, 125,
+ 125, 125, 125, 125, 125, 129, 306, 306, 306, 306,
+ 306, 129, 72, 72, 306, 72, 182, 306, 182, 9,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306
} ;
-static const flex_int16_t yy_chk[1342] =
+static const flex_int16_t yy_chk[1016] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 11, 11, 12, 12,
- 25, 32, 25, 28, 28, 33, 38, 35, 49, 32,
- 64, 34, 64, 33, 38, 35, 49, 49, 33, 34,
- 35, 36, 33, 32, 35, 33, 318, 34, 32, 36,
- 268, 34, 37, 201, 34, 37, 39, 34, 33, 37,
-
- 34, 36, 37, 36, 39, 37, 41, 40, 37, 42,
- 39, 43, 134, 36, 41, 40, 54, 42, 39, 43,
- 40, 54, 126, 39, 40, 43, 44, 126, 45, 41,
- 40, 46, 42, 43, 44, 43, 45, 43, 42, 46,
- 43, 45, 59, 59, 46, 47, 133, 46, 132, 48,
- 45, 45, 44, 47, 47, 71, 46, 48, 50, 130,
- 46, 47, 72, 71, 46, 70, 50, 73, 47, 74,
- 75, 48, 65, 48, 50, 73, 76, 74, 75, 73,
- 74, 50, 77, 127, 76, 75, 78, 80, 127, 82,
- 77, 76, 79, 63, 78, 80, 74, 82, 76, 81,
-
- 79, 79, 82, 83, 84, 77, 85, 81, 58, 86,
- 80, 83, 84, 56, 85, 84, 80, 86, 87, 30,
- 81, 81, 26, 24, 84, 23, 87, 88, 81, 83,
- 87, 84, 89, 85, 90, 88, 86, 91, 92, 94,
- 89, 95, 90, 93, 88, 91, 92, 94, 96, 95,
- 97, 93, 9, 95, 98, 8, 96, 90, 97, 99,
- 89, 92, 98, 91, 7, 93, 100, 99, 95, 95,
- 99, 101, 97, 98, 100, 102, 103, 104, 100, 101,
- 105, 107, 99, 102, 103, 104, 106, 6, 105, 107,
- 5, 4, 109, 105, 106, 102, 108, 111, 106, 101,
-
- 109, 109, 110, 112, 108, 111, 3, 116, 0, 107,
- 110, 112, 0, 108, 110, 116, 109, 111, 113, 108,
- 109, 114, 115, 112, 0, 117, 113, 113, 111, 114,
- 115, 112, 115, 117, 116, 117, 118, 119, 120, 121,
- 122, 114, 0, 115, 118, 119, 120, 121, 122, 118,
- 123, 121, 0, 124, 136, 120, 137, 0, 123, 0,
- 122, 124, 136, 123, 137, 120, 139, 123, 138, 140,
- 143, 0, 119, 0, 139, 0, 138, 140, 143, 124,
- 141, 138, 142, 139, 0, 0, 140, 144, 141, 141,
- 142, 145, 142, 142, 147, 144, 143, 0, 146, 145,
-
- 150, 148, 147, 149, 0, 147, 146, 152, 150, 148,
- 0, 149, 149, 151, 144, 152, 154, 153, 145, 146,
- 152, 151, 146, 148, 154, 153, 150, 150, 153, 155,
- 156, 157, 158, 151, 0, 0, 0, 155, 156, 157,
- 158, 159, 155, 158, 154, 160, 155, 161, 163, 159,
- 159, 0, 162, 160, 164, 161, 163, 165, 166, 157,
- 162, 163, 164, 162, 167, 165, 166, 164, 161, 0,
- 165, 168, 167, 166, 0, 169, 170, 167, 171, 168,
- 165, 0, 164, 169, 170, 172, 171, 173, 174, 170,
- 168, 0, 171, 172, 175, 173, 174, 0, 176, 169,
-
- 177, 174, 175, 0, 178, 172, 176, 179, 177, 173,
- 180, 177, 178, 181, 182, 179, 178, 183, 180, 0,
- 176, 181, 182, 184, 185, 183, 0, 179, 0, 186,
- 187, 184, 185, 188, 182, 189, 184, 186, 187, 180,
- 0, 188, 190, 189, 0, 191, 0, 0, 181, 192,
- 190, 193, 183, 191, 190, 186, 194, 192, 195, 193,
- 188, 193, 193, 0, 194, 191, 195, 0, 196, 0,
- 197, 192, 198, 193, 199, 195, 196, 196, 197, 203,
- 198, 194, 199, 200, 204, 205, 0, 203, 206, 207,
- 0, 200, 204, 205, 199, 209, 206, 207, 198, 197,
-
- 208, 211, 200, 209, 210, 203, 204, 205, 208, 211,
- 212, 0, 210, 213, 206, 214, 0, 210, 212, 208,
- 215, 213, 213, 214, 214, 216, 217, 212, 215, 211,
- 220, 0, 218, 216, 217, 219, 0, 221, 220, 217,
- 218, 223, 222, 219, 219, 221, 224, 0, 215, 223,
- 222, 0, 0, 216, 224, 218, 225, 226, 220, 222,
- 224, 227, 228, 229, 225, 226, 230, 231, 232, 227,
- 228, 229, 233, 226, 230, 231, 232, 234, 235, 0,
- 233, 0, 236, 0, 237, 234, 235, 233, 238, 227,
- 236, 229, 237, 231, 232, 239, 238, 240, 230, 241,
-
- 242, 243, 244, 239, 245, 240, 235, 241, 242, 243,
- 244, 246, 245, 247, 251, 248, 249, 245, 250, 246,
- 240, 247, 251, 248, 249, 252, 250, 243, 250, 253,
- 244, 254, 0, 252, 0, 0, 252, 253, 251, 254,
- 247, 248, 253, 249, 255, 0, 257, 256, 258, 260,
- 259, 0, 255, 255, 257, 256, 258, 260, 259, 254,
- 256, 261, 262, 263, 267, 258, 259, 264, 265, 261,
- 262, 263, 267, 0, 266, 264, 265, 262, 260, 0,
- 264, 265, 266, 0, 269, 270, 271, 266, 272, 273,
- 261, 263, 269, 270, 271, 274, 272, 273, 275, 276,
-
- 278, 279, 277, 274, 0, 0, 275, 276, 278, 279,
- 277, 275, 269, 277, 271, 281, 0, 280, 282, 0,
- 0, 272, 0, 281, 273, 280, 282, 276, 278, 0,
- 280, 283, 284, 285, 286, 287, 0, 281, 288, 283,
- 284, 285, 286, 287, 282, 284, 288, 0, 289, 0,
- 290, 291, 292, 293, 294, 285, 289, 283, 290, 291,
- 292, 293, 294, 295, 296, 289, 293, 297, 298, 299,
- 294, 295, 296, 0, 300, 297, 298, 299, 301, 291,
- 298, 297, 300, 303, 0, 302, 301, 304, 0, 0,
- 305, 303, 295, 302, 302, 304, 300, 299, 305, 306,
-
- 307, 0, 308, 311, 309, 310, 301, 306, 307, 303,
- 308, 311, 309, 310, 310, 304, 0, 0, 0, 312,
- 0, 313, 314, 315, 311, 306, 309, 312, 307, 313,
- 314, 315, 312, 316, 317, 314, 319, 320, 321, 322,
- 0, 316, 317, 313, 319, 320, 321, 322, 323, 324,
- 315, 325, 326, 327, 328, 329, 323, 324, 0, 325,
- 326, 327, 328, 329, 330, 0, 322, 331, 333, 0,
- 332, 0, 330, 321, 323, 331, 333, 330, 332, 325,
- 334, 332, 328, 0, 335, 336, 337, 338, 334, 339,
- 340, 333, 335, 336, 337, 338, 341, 339, 340, 342,
-
- 0, 343, 0, 344, 341, 345, 346, 342, 337, 343,
- 335, 344, 343, 345, 346, 347, 340, 0, 339, 349,
- 344, 348, 0, 347, 350, 342, 0, 349, 347, 348,
- 348, 351, 350, 352, 350, 353, 354, 0, 0, 351,
- 355, 352, 356, 353, 354, 349, 352, 357, 355, 358,
- 356, 0, 0, 359, 360, 357, 361, 358, 362, 356,
- 357, 359, 360, 363, 361, 364, 362, 365, 355, 0,
- 366, 363, 0, 364, 367, 365, 0, 364, 366, 368,
- 362, 369, 367, 370, 361, 0, 371, 368, 372, 369,
- 0, 370, 373, 365, 371, 0, 372, 0, 368, 374,
-
- 373, 375, 376, 369, 0, 373, 377, 374, 378, 375,
- 376, 374, 371, 379, 377, 380, 378, 381, 377, 382,
- 383, 379, 0, 380, 375, 381, 384, 382, 383, 385,
- 381, 386, 387, 388, 384, 389, 376, 385, 0, 386,
- 387, 388, 390, 389, 391, 392, 388, 0, 383, 393,
- 390, 0, 391, 392, 394, 385, 395, 393, 391, 384,
- 396, 397, 394, 398, 395, 399, 400, 387, 396, 397,
- 401, 398, 402, 399, 400, 399, 394, 0, 401, 400,
- 402, 0, 0, 0, 398, 0, 0, 0, 0, 0,
- 397, 0, 0, 0, 0, 0, 401, 404, 404, 404,
-
- 404, 404, 404, 404, 404, 404, 405, 405, 405, 405,
- 405, 405, 405, 405, 405, 406, 406, 406, 406, 406,
- 406, 406, 406, 406, 407, 0, 407, 408, 408, 408,
- 409, 409, 0, 409, 410, 410, 410, 410, 0, 410,
- 410, 410, 410, 411, 411, 411, 411, 411, 411, 411,
- 411, 411, 412, 412, 412, 0, 412, 412, 412, 412,
- 412, 413, 0, 413, 413, 413, 413, 413, 413, 413,
- 414, 0, 0, 0, 0, 0, 414, 415, 415, 0,
- 415, 416, 0, 416, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
-
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403, 403, 403, 403, 403, 403, 403, 403, 403, 403,
- 403
+ 1, 1, 1, 1, 1, 11, 11, 12, 12, 25,
+ 32, 25, 28, 28, 33, 38, 35, 64, 32, 64,
+ 34, 54, 33, 38, 35, 44, 54, 33, 34, 35,
+ 36, 33, 32, 44, 39, 266, 34, 32, 36, 120,
+ 34, 231, 39, 34, 120, 37, 34, 33, 39, 34,
+
+ 36, 44, 36, 37, 181, 41, 39, 42, 37, 40,
+ 128, 39, 36, 41, 127, 42, 126, 40, 37, 43,
+ 121, 37, 40, 124, 37, 121, 40, 43, 41, 45,
+ 42, 46, 40, 43, 59, 59, 42, 45, 72, 46,
+ 71, 43, 45, 43, 46, 43, 47, 46, 71, 48,
+ 49, 70, 45, 73, 47, 47, 46, 48, 49, 49,
+ 46, 73, 47, 65, 50, 73, 74, 75, 76, 47,
+ 77, 48, 50, 48, 74, 75, 76, 74, 77, 63,
+ 50, 78, 75, 76, 79, 81, 82, 50, 80, 78,
+ 78, 83, 79, 81, 82, 84, 80, 86, 81, 83,
+
+ 58, 56, 83, 84, 30, 86, 26, 79, 85, 80,
+ 80, 83, 82, 79, 86, 87, 85, 80, 83, 88,
+ 85, 89, 84, 87, 90, 91, 92, 88, 93, 89,
+ 24, 23, 90, 91, 92, 9, 93, 8, 92, 94,
+ 95, 96, 7, 87, 89, 88, 90, 94, 95, 96,
+ 97, 6, 96, 92, 92, 98, 5, 99, 97, 95,
+ 100, 94, 97, 98, 96, 99, 101, 102, 100, 4,
+ 103, 104, 3, 105, 101, 102, 106, 99, 103, 104,
+ 102, 105, 103, 98, 106, 107, 0, 109, 0, 108,
+ 0, 113, 110, 107, 104, 109, 106, 108, 108, 113,
+
+ 110, 105, 110, 112, 111, 107, 0, 109, 0, 114,
+ 115, 112, 111, 107, 111, 116, 112, 114, 115, 117,
+ 118, 130, 115, 116, 0, 113, 114, 117, 118, 130,
+ 131, 132, 117, 133, 134, 116, 117, 135, 131, 132,
+ 0, 133, 134, 136, 137, 135, 118, 138, 132, 139,
+ 133, 136, 137, 140, 0, 138, 0, 139, 138, 141,
+ 134, 140, 140, 0, 135, 137, 143, 141, 142, 144,
+ 136, 139, 0, 0, 143, 146, 142, 144, 0, 143,
+ 144, 145, 147, 146, 148, 141, 141, 0, 142, 145,
+ 147, 149, 148, 150, 145, 148, 151, 154, 145, 149,
+
+ 152, 150, 0, 153, 151, 154, 0, 151, 152, 155,
+ 147, 153, 0, 152, 150, 156, 153, 155, 157, 158,
+ 154, 159, 160, 156, 155, 161, 157, 158, 156, 159,
+ 160, 153, 162, 161, 159, 0, 160, 157, 163, 164,
+ 162, 165, 0, 158, 166, 161, 163, 164, 167, 165,
+ 164, 163, 166, 0, 162, 168, 167, 169, 170, 171,
+ 172, 167, 0, 168, 166, 169, 170, 171, 172, 173,
+ 165, 174, 0, 0, 175, 0, 176, 173, 0, 174,
+ 172, 174, 175, 169, 176, 176, 171, 177, 178, 179,
+ 183, 173, 180, 184, 185, 177, 178, 179, 183, 175,
+
+ 180, 184, 185, 0, 0, 186, 0, 0, 0, 179,
+ 0, 180, 183, 186, 178, 184, 177, 187, 186, 188,
+ 189, 0, 190, 191, 192, 187, 193, 188, 189, 189,
+ 190, 191, 192, 194, 193, 195, 188, 192, 196, 197,
+ 198, 194, 194, 195, 199, 187, 196, 197, 198, 193,
+ 190, 191, 199, 200, 198, 0, 201, 202, 203, 206,
+ 204, 200, 205, 195, 201, 202, 203, 206, 204, 200,
+ 205, 207, 208, 209, 210, 211, 0, 0, 0, 207,
+ 208, 209, 210, 211, 212, 202, 204, 213, 205, 214,
+ 203, 0, 212, 215, 217, 213, 216, 214, 218, 207,
+
+ 0, 215, 217, 219, 216, 220, 218, 212, 218, 216,
+ 0, 219, 0, 220, 219, 221, 222, 223, 220, 215,
+ 217, 0, 224, 221, 222, 223, 225, 227, 226, 222,
+ 224, 0, 0, 228, 225, 227, 226, 229, 0, 224,
+ 227, 228, 0, 221, 230, 229, 228, 0, 0, 232,
+ 229, 233, 230, 234, 235, 225, 226, 232, 236, 233,
+ 237, 234, 235, 238, 239, 240, 236, 235, 237, 0,
+ 241, 238, 239, 240, 242, 244, 243, 239, 241, 233,
+ 0, 0, 242, 244, 243, 245, 236, 240, 237, 243,
+ 246, 247, 0, 245, 248, 249, 241, 250, 246, 247,
+
+ 242, 251, 248, 249, 252, 250, 253, 246, 255, 251,
+ 0, 254, 252, 250, 253, 256, 255, 255, 253, 254,
+ 257, 258, 248, 256, 259, 0, 260, 261, 257, 258,
+ 251, 262, 259, 254, 260, 261, 0, 263, 264, 262,
+ 261, 265, 267, 256, 262, 263, 264, 258, 260, 265,
+ 267, 268, 269, 270, 271, 272, 0, 273, 274, 268,
+ 269, 270, 271, 272, 263, 273, 274, 275, 276, 0,
+ 277, 274, 278, 279, 280, 275, 276, 268, 277, 281,
+ 278, 279, 280, 272, 283, 282, 284, 281, 0, 285,
+ 0, 276, 283, 282, 284, 279, 282, 285, 285, 286,
+
+ 287, 288, 289, 280, 290, 291, 292, 286, 287, 288,
+ 289, 293, 290, 291, 292, 289, 294, 295, 296, 293,
+ 0, 297, 298, 293, 294, 295, 296, 299, 292, 297,
+ 298, 301, 300, 297, 0, 299, 295, 0, 302, 301,
+ 300, 303, 294, 304, 296, 300, 302, 305, 0, 303,
+ 0, 304, 0, 0, 0, 305, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 302, 307, 307, 307, 307, 307, 307, 307, 307,
+ 307, 308, 308, 308, 308, 308, 308, 308, 308, 308,
+ 309, 309, 309, 309, 309, 309, 309, 309, 309, 310,
+
+ 0, 310, 311, 311, 311, 312, 312, 0, 312, 313,
+ 313, 313, 313, 0, 313, 313, 313, 313, 314, 314,
+ 314, 314, 314, 314, 314, 314, 314, 315, 315, 315,
+ 0, 315, 315, 315, 315, 315, 316, 0, 316, 316,
+ 316, 316, 316, 316, 316, 317, 0, 0, 0, 0,
+ 0, 317, 318, 318, 0, 318, 319, 0, 319, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+
+ 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
+ 306, 306, 306, 306, 306
} ;
static yy_state_type yy_last_accepting_state;
@@ -961,9 +856,9 @@ string_append(
stringbuf_len += len;
}
-#line 964 "lexyy.cc"
+#line 859 "lexyy.cc"
-#line 966 "lexyy.cc"
+#line 861 "lexyy.cc"
#define INITIAL 0
#define comment 1
@@ -1184,7 +1079,7 @@ YY_DECL
#line 112 "pars0lex.l"
-#line 1187 "lexyy.cc"
+#line 1082 "lexyy.cc"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1211,13 +1106,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 404 )
+ if ( yy_current_state >= 307 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_current_state != 403 );
+ while ( yy_current_state != 306 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
@@ -1436,554 +1331,407 @@ case 18:
YY_RULE_SETUP
#line 252 "pars0lex.l"
{
- return(PARS_OUT_TOKEN);
+ return(PARS_INT_TOKEN);
}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 256 "pars0lex.l"
{
- return(PARS_BINARY_TOKEN);
+ return(PARS_CHAR_TOKEN);
}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 260 "pars0lex.l"
{
- return(PARS_BLOB_TOKEN);
+ return(PARS_IS_TOKEN);
}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 264 "pars0lex.l"
{
- return(PARS_INT_TOKEN);
+ return(PARS_BEGIN_TOKEN);
}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 268 "pars0lex.l"
{
- return(PARS_INT_TOKEN);
+ return(PARS_END_TOKEN);
}
YY_BREAK
case 23:
YY_RULE_SETUP
#line 272 "pars0lex.l"
{
- return(PARS_FLOAT_TOKEN);
+ return(PARS_IF_TOKEN);
}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 276 "pars0lex.l"
{
- return(PARS_CHAR_TOKEN);
+ return(PARS_THEN_TOKEN);
}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 280 "pars0lex.l"
{
- return(PARS_IS_TOKEN);
+ return(PARS_ELSE_TOKEN);
}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 284 "pars0lex.l"
{
- return(PARS_BEGIN_TOKEN);
+ return(PARS_ELSIF_TOKEN);
}
YY_BREAK
case 27:
YY_RULE_SETUP
#line 288 "pars0lex.l"
{
- return(PARS_END_TOKEN);
+ return(PARS_LOOP_TOKEN);
}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 292 "pars0lex.l"
{
- return(PARS_IF_TOKEN);
+ return(PARS_WHILE_TOKEN);
}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 296 "pars0lex.l"
{
- return(PARS_THEN_TOKEN);
+ return(PARS_RETURN_TOKEN);
}
YY_BREAK
case 30:
YY_RULE_SETUP
#line 300 "pars0lex.l"
{
- return(PARS_ELSE_TOKEN);
+ return(PARS_SELECT_TOKEN);
}
YY_BREAK
case 31:
YY_RULE_SETUP
#line 304 "pars0lex.l"
{
- return(PARS_ELSIF_TOKEN);
+ return(PARS_COUNT_TOKEN);
}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 308 "pars0lex.l"
{
- return(PARS_LOOP_TOKEN);
+ return(PARS_FROM_TOKEN);
}
YY_BREAK
case 33:
YY_RULE_SETUP
#line 312 "pars0lex.l"
{
- return(PARS_WHILE_TOKEN);
+ return(PARS_WHERE_TOKEN);
}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 316 "pars0lex.l"
{
- return(PARS_RETURN_TOKEN);
+ return(PARS_FOR_TOKEN);
}
YY_BREAK
case 35:
YY_RULE_SETUP
#line 320 "pars0lex.l"
{
- return(PARS_SELECT_TOKEN);
+ return(PARS_ORDER_TOKEN);
}
YY_BREAK
case 36:
YY_RULE_SETUP
#line 324 "pars0lex.l"
{
- return(PARS_SUM_TOKEN);
+ return(PARS_BY_TOKEN);
}
YY_BREAK
case 37:
YY_RULE_SETUP
#line 328 "pars0lex.l"
{
- return(PARS_COUNT_TOKEN);
+ return(PARS_ASC_TOKEN);
}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 332 "pars0lex.l"
{
- return(PARS_DISTINCT_TOKEN);
+ return(PARS_DESC_TOKEN);
}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 336 "pars0lex.l"
{
- return(PARS_FROM_TOKEN);
+ return(PARS_INSERT_TOKEN);
}
YY_BREAK
case 40:
YY_RULE_SETUP
#line 340 "pars0lex.l"
{
- return(PARS_WHERE_TOKEN);
+ return(PARS_INTO_TOKEN);
}
YY_BREAK
case 41:
YY_RULE_SETUP
#line 344 "pars0lex.l"
{
- return(PARS_FOR_TOKEN);
+ return(PARS_VALUES_TOKEN);
}
YY_BREAK
case 42:
YY_RULE_SETUP
#line 348 "pars0lex.l"
{
- return(PARS_READ_TOKEN);
+ return(PARS_UPDATE_TOKEN);
}
YY_BREAK
case 43:
YY_RULE_SETUP
#line 352 "pars0lex.l"
{
- return(PARS_ORDER_TOKEN);
+ return(PARS_SET_TOKEN);
}
YY_BREAK
case 44:
YY_RULE_SETUP
#line 356 "pars0lex.l"
{
- return(PARS_BY_TOKEN);
+ return(PARS_DELETE_TOKEN);
}
YY_BREAK
case 45:
YY_RULE_SETUP
#line 360 "pars0lex.l"
{
- return(PARS_ASC_TOKEN);
+ return(PARS_CURRENT_TOKEN);
}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 364 "pars0lex.l"
{
- return(PARS_DESC_TOKEN);
+ return(PARS_OF_TOKEN);
}
YY_BREAK
case 47:
YY_RULE_SETUP
#line 368 "pars0lex.l"
{
- return(PARS_INSERT_TOKEN);
+ return(PARS_CREATE_TOKEN);
}
YY_BREAK
case 48:
YY_RULE_SETUP
#line 372 "pars0lex.l"
{
- return(PARS_INTO_TOKEN);
+ return(PARS_TABLE_TOKEN);
}
YY_BREAK
case 49:
YY_RULE_SETUP
#line 376 "pars0lex.l"
{
- return(PARS_VALUES_TOKEN);
+ return(PARS_INDEX_TOKEN);
}
YY_BREAK
case 50:
YY_RULE_SETUP
#line 380 "pars0lex.l"
{
- return(PARS_UPDATE_TOKEN);
+ return(PARS_UNIQUE_TOKEN);
}
YY_BREAK
case 51:
YY_RULE_SETUP
#line 384 "pars0lex.l"
{
- return(PARS_SET_TOKEN);
+ return(PARS_CLUSTERED_TOKEN);
}
YY_BREAK
case 52:
YY_RULE_SETUP
#line 388 "pars0lex.l"
{
- return(PARS_DELETE_TOKEN);
+ return(PARS_ON_TOKEN);
}
YY_BREAK
case 53:
YY_RULE_SETUP
#line 392 "pars0lex.l"
{
- return(PARS_CURRENT_TOKEN);
+ return(PARS_DECLARE_TOKEN);
}
YY_BREAK
case 54:
YY_RULE_SETUP
#line 396 "pars0lex.l"
{
- return(PARS_OF_TOKEN);
+ return(PARS_CURSOR_TOKEN);
}
YY_BREAK
case 55:
YY_RULE_SETUP
#line 400 "pars0lex.l"
{
- return(PARS_CREATE_TOKEN);
+ return(PARS_OPEN_TOKEN);
}
YY_BREAK
case 56:
YY_RULE_SETUP
#line 404 "pars0lex.l"
{
- return(PARS_TABLE_TOKEN);
+ return(PARS_FETCH_TOKEN);
}
YY_BREAK
case 57:
YY_RULE_SETUP
#line 408 "pars0lex.l"
{
- return(PARS_COMPACT_TOKEN);
+ return(PARS_CLOSE_TOKEN);
}
YY_BREAK
case 58:
YY_RULE_SETUP
#line 412 "pars0lex.l"
{
- return(PARS_BLOCK_SIZE_TOKEN);
+ return(PARS_NOTFOUND_TOKEN);
}
YY_BREAK
case 59:
YY_RULE_SETUP
#line 416 "pars0lex.l"
{
- return(PARS_INDEX_TOKEN);
+ return(PARS_TO_BINARY_TOKEN);
}
YY_BREAK
case 60:
YY_RULE_SETUP
#line 420 "pars0lex.l"
{
- return(PARS_UNIQUE_TOKEN);
+ return(PARS_SUBSTR_TOKEN);
}
YY_BREAK
case 61:
YY_RULE_SETUP
#line 424 "pars0lex.l"
{
- return(PARS_CLUSTERED_TOKEN);
+ return(PARS_CONCAT_TOKEN);
}
YY_BREAK
case 62:
YY_RULE_SETUP
#line 428 "pars0lex.l"
{
- return(PARS_ON_TOKEN);
+ return(PARS_INSTR_TOKEN);
}
YY_BREAK
case 63:
YY_RULE_SETUP
#line 432 "pars0lex.l"
{
- return(PARS_DECLARE_TOKEN);
+ return(PARS_LENGTH_TOKEN);
}
YY_BREAK
case 64:
YY_RULE_SETUP
#line 436 "pars0lex.l"
{
- return(PARS_CURSOR_TOKEN);
+ return(PARS_COMMIT_TOKEN);
}
YY_BREAK
case 65:
YY_RULE_SETUP
#line 440 "pars0lex.l"
{
- return(PARS_OPEN_TOKEN);
+ return(PARS_ROLLBACK_TOKEN);
}
YY_BREAK
case 66:
YY_RULE_SETUP
#line 444 "pars0lex.l"
{
- return(PARS_FETCH_TOKEN);
+ return(PARS_WORK_TOKEN);
}
YY_BREAK
case 67:
YY_RULE_SETUP
#line 448 "pars0lex.l"
{
- return(PARS_CLOSE_TOKEN);
+ return(PARS_EXIT_TOKEN);
}
YY_BREAK
case 68:
YY_RULE_SETUP
#line 452 "pars0lex.l"
{
- return(PARS_NOTFOUND_TOKEN);
+ return(PARS_FUNCTION_TOKEN);
}
YY_BREAK
case 69:
YY_RULE_SETUP
#line 456 "pars0lex.l"
{
- return(PARS_TO_CHAR_TOKEN);
+ return(PARS_LOCK_TOKEN);
}
YY_BREAK
case 70:
YY_RULE_SETUP
#line 460 "pars0lex.l"
{
- return(PARS_TO_NUMBER_TOKEN);
+ return(PARS_SHARE_TOKEN);
}
YY_BREAK
case 71:
YY_RULE_SETUP
#line 464 "pars0lex.l"
{
- return(PARS_TO_BINARY_TOKEN);
+ return(PARS_MODE_TOKEN);
}
YY_BREAK
case 72:
YY_RULE_SETUP
#line 468 "pars0lex.l"
{
- return(PARS_BINARY_TO_NUMBER_TOKEN);
+ return(PARS_LIKE_TOKEN);
}
YY_BREAK
case 73:
YY_RULE_SETUP
#line 472 "pars0lex.l"
{
- return(PARS_SUBSTR_TOKEN);
+ return(PARS_BIGINT_TOKEN);
}
YY_BREAK
case 74:
YY_RULE_SETUP
#line 476 "pars0lex.l"
{
- return(PARS_REPLSTR_TOKEN);
-}
- YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 480 "pars0lex.l"
-{
- return(PARS_CONCAT_TOKEN);
-}
- YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 484 "pars0lex.l"
-{
- return(PARS_INSTR_TOKEN);
-}
- YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 488 "pars0lex.l"
-{
- return(PARS_LENGTH_TOKEN);
-}
- YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 492 "pars0lex.l"
-{
- return(PARS_SYSDATE_TOKEN);
-}
- YY_BREAK
-case 79:
-YY_RULE_SETUP
-#line 496 "pars0lex.l"
-{
- return(PARS_PRINTF_TOKEN);
-}
- YY_BREAK
-case 80:
-YY_RULE_SETUP
-#line 500 "pars0lex.l"
-{
- return(PARS_ASSERT_TOKEN);
-}
- YY_BREAK
-case 81:
-YY_RULE_SETUP
-#line 504 "pars0lex.l"
-{
- return(PARS_RND_TOKEN);
-}
- YY_BREAK
-case 82:
-YY_RULE_SETUP
-#line 508 "pars0lex.l"
-{
- return(PARS_RND_STR_TOKEN);
-}
- YY_BREAK
-case 83:
-YY_RULE_SETUP
-#line 512 "pars0lex.l"
-{
- return(PARS_ROW_PRINTF_TOKEN);
-}
- YY_BREAK
-case 84:
-YY_RULE_SETUP
-#line 516 "pars0lex.l"
-{
- return(PARS_COMMIT_TOKEN);
-}
- YY_BREAK
-case 85:
-YY_RULE_SETUP
-#line 520 "pars0lex.l"
-{
- return(PARS_ROLLBACK_TOKEN);
-}
- YY_BREAK
-case 86:
-YY_RULE_SETUP
-#line 524 "pars0lex.l"
-{
- return(PARS_WORK_TOKEN);
-}
- YY_BREAK
-case 87:
-YY_RULE_SETUP
-#line 528 "pars0lex.l"
-{
- return(PARS_UNSIGNED_TOKEN);
-}
- YY_BREAK
-case 88:
-YY_RULE_SETUP
-#line 532 "pars0lex.l"
-{
- return(PARS_EXIT_TOKEN);
-}
- YY_BREAK
-case 89:
-YY_RULE_SETUP
-#line 536 "pars0lex.l"
-{
- return(PARS_FUNCTION_TOKEN);
-}
- YY_BREAK
-case 90:
-YY_RULE_SETUP
-#line 540 "pars0lex.l"
-{
- return(PARS_LOCK_TOKEN);
-}
- YY_BREAK
-case 91:
-YY_RULE_SETUP
-#line 544 "pars0lex.l"
-{
- return(PARS_SHARE_TOKEN);
-}
- YY_BREAK
-case 92:
-YY_RULE_SETUP
-#line 548 "pars0lex.l"
-{
- return(PARS_MODE_TOKEN);
-}
- YY_BREAK
-case 93:
-YY_RULE_SETUP
-#line 552 "pars0lex.l"
-{
- return(PARS_LIKE_TOKEN);
-}
- YY_BREAK
-case 94:
-YY_RULE_SETUP
-#line 556 "pars0lex.l"
-{
- return(PARS_BIGINT_TOKEN);
-}
- YY_BREAK
-case 95:
-YY_RULE_SETUP
-#line 560 "pars0lex.l"
-{
yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*) yytext,
ut_strlen(yytext));
return(PARS_ID_TOKEN);
}
YY_BREAK
-case 96:
+case 75:
YY_RULE_SETUP
-#line 567 "pars0lex.l"
+#line 483 "pars0lex.l"
{
yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*) yytext,
@@ -1991,192 +1739,192 @@ YY_RULE_SETUP
return(PARS_TABLE_NAME_TOKEN);
}
YY_BREAK
-case 97:
+case 76:
YY_RULE_SETUP
-#line 574 "pars0lex.l"
+#line 490 "pars0lex.l"
{
return(PARS_DDOT_TOKEN);
}
YY_BREAK
-case 98:
+case 77:
YY_RULE_SETUP
-#line 578 "pars0lex.l"
+#line 494 "pars0lex.l"
{
return(PARS_ASSIGN_TOKEN);
}
YY_BREAK
-case 99:
+case 78:
YY_RULE_SETUP
-#line 582 "pars0lex.l"
+#line 498 "pars0lex.l"
{
return(PARS_LE_TOKEN);
}
YY_BREAK
-case 100:
+case 79:
YY_RULE_SETUP
-#line 586 "pars0lex.l"
+#line 502 "pars0lex.l"
{
return(PARS_GE_TOKEN);
}
YY_BREAK
-case 101:
+case 80:
YY_RULE_SETUP
-#line 590 "pars0lex.l"
+#line 506 "pars0lex.l"
{
return(PARS_NE_TOKEN);
}
YY_BREAK
-case 102:
+case 81:
YY_RULE_SETUP
-#line 594 "pars0lex.l"
+#line 510 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 103:
+case 82:
YY_RULE_SETUP
-#line 599 "pars0lex.l"
+#line 515 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 104:
+case 83:
YY_RULE_SETUP
-#line 604 "pars0lex.l"
+#line 520 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 105:
+case 84:
YY_RULE_SETUP
-#line 609 "pars0lex.l"
+#line 525 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 106:
+case 85:
YY_RULE_SETUP
-#line 614 "pars0lex.l"
+#line 530 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 107:
+case 86:
YY_RULE_SETUP
-#line 619 "pars0lex.l"
+#line 535 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 108:
+case 87:
YY_RULE_SETUP
-#line 624 "pars0lex.l"
+#line 540 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 109:
+case 88:
YY_RULE_SETUP
-#line 629 "pars0lex.l"
+#line 545 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 110:
+case 89:
YY_RULE_SETUP
-#line 634 "pars0lex.l"
+#line 550 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 111:
+case 90:
YY_RULE_SETUP
-#line 639 "pars0lex.l"
+#line 555 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 112:
+case 91:
YY_RULE_SETUP
-#line 644 "pars0lex.l"
+#line 560 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 113:
+case 92:
YY_RULE_SETUP
-#line 649 "pars0lex.l"
+#line 565 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 114:
+case 93:
YY_RULE_SETUP
-#line 654 "pars0lex.l"
+#line 570 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 115:
+case 94:
YY_RULE_SETUP
-#line 659 "pars0lex.l"
+#line 575 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 116:
+case 95:
YY_RULE_SETUP
-#line 664 "pars0lex.l"
+#line 580 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
-case 117:
+case 96:
YY_RULE_SETUP
-#line 669 "pars0lex.l"
+#line 585 "pars0lex.l"
BEGIN(comment); /* eat up comment */
YY_BREAK
-case 118:
-/* rule 118 can match eol */
+case 97:
+/* rule 97 can match eol */
YY_RULE_SETUP
-#line 671 "pars0lex.l"
+#line 587 "pars0lex.l"
YY_BREAK
-case 119:
-/* rule 119 can match eol */
+case 98:
+/* rule 98 can match eol */
YY_RULE_SETUP
-#line 672 "pars0lex.l"
+#line 588 "pars0lex.l"
YY_BREAK
-case 120:
+case 99:
YY_RULE_SETUP
-#line 673 "pars0lex.l"
+#line 589 "pars0lex.l"
BEGIN(INITIAL);
YY_BREAK
-case 121:
-/* rule 121 can match eol */
+case 100:
+/* rule 100 can match eol */
YY_RULE_SETUP
-#line 675 "pars0lex.l"
+#line 591 "pars0lex.l"
/* eat up whitespace */
YY_BREAK
-case 122:
+case 101:
YY_RULE_SETUP
-#line 678 "pars0lex.l"
+#line 594 "pars0lex.l"
{
fprintf(stderr,"Unrecognized character: %02x\n",
*yytext);
@@ -2186,12 +1934,12 @@ YY_RULE_SETUP
return(0);
}
YY_BREAK
-case 123:
+case 102:
YY_RULE_SETUP
-#line 687 "pars0lex.l"
+#line 603 "pars0lex.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 2194 "lexyy.cc"
+#line 1942 "lexyy.cc"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(comment):
case YY_STATE_EOF(quoted):
@@ -2492,7 +2240,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 404 )
+ if ( yy_current_state >= 307 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -2520,11 +2268,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 404 )
+ if ( yy_current_state >= 307 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 403);
+ yy_is_jam = (yy_current_state == 306);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -3077,7 +2825,7 @@ static void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 687 "pars0lex.l"
+#line 603 "pars0lex.l"
/**********************************************************************
diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc
index a0a09771106..7e10a783310 100644
--- a/storage/innobase/pars/pars0grm.cc
+++ b/storage/innobase/pars/pars0grm.cc
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.4.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+ 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
@@ -40,11 +41,14 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.4.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -61,8 +65,8 @@
-/* Copy the first part of user declarations. */
-#line 29 "pars0grm.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 29 "pars0grm.y"
/* The value of the semantic attribute is a pointer to a query tree node
que_node_t */
@@ -81,13 +85,17 @@ que_node_t */
int
yylex(void);
-#line 85 "pars0grm.cc" /* yacc.c:339 */
+#line 89 "pars0grm.cc"
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
@@ -99,8 +107,8 @@ yylex(void);
# define YYERROR_VERBOSE 0
#endif
-/* In a future release of Bison, this section will be replaced
- by #include "pars0grm.tab.h". */
+/* Use api.header.include to #include this header
+ instead of duplicating it here. */
#ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED
# define YY_YY_PARS0GRM_TAB_H_INCLUDED
/* Debug traces. */
@@ -129,91 +137,71 @@ extern int yydebug;
PARS_NE_TOKEN = 268,
PARS_PROCEDURE_TOKEN = 269,
PARS_IN_TOKEN = 270,
- PARS_OUT_TOKEN = 271,
- PARS_BINARY_TOKEN = 272,
- PARS_BLOB_TOKEN = 273,
- PARS_INT_TOKEN = 274,
- PARS_FLOAT_TOKEN = 275,
- PARS_CHAR_TOKEN = 276,
- PARS_IS_TOKEN = 277,
- PARS_BEGIN_TOKEN = 278,
- PARS_END_TOKEN = 279,
- PARS_IF_TOKEN = 280,
- PARS_THEN_TOKEN = 281,
- PARS_ELSE_TOKEN = 282,
- PARS_ELSIF_TOKEN = 283,
- PARS_LOOP_TOKEN = 284,
- PARS_WHILE_TOKEN = 285,
- PARS_RETURN_TOKEN = 286,
- PARS_SELECT_TOKEN = 287,
- PARS_SUM_TOKEN = 288,
- PARS_COUNT_TOKEN = 289,
- PARS_DISTINCT_TOKEN = 290,
- PARS_FROM_TOKEN = 291,
- PARS_WHERE_TOKEN = 292,
- PARS_FOR_TOKEN = 293,
- PARS_DDOT_TOKEN = 294,
- PARS_READ_TOKEN = 295,
- PARS_ORDER_TOKEN = 296,
- PARS_BY_TOKEN = 297,
- PARS_ASC_TOKEN = 298,
- PARS_DESC_TOKEN = 299,
- PARS_INSERT_TOKEN = 300,
- PARS_INTO_TOKEN = 301,
- PARS_VALUES_TOKEN = 302,
- PARS_UPDATE_TOKEN = 303,
- PARS_SET_TOKEN = 304,
- PARS_DELETE_TOKEN = 305,
- PARS_CURRENT_TOKEN = 306,
- PARS_OF_TOKEN = 307,
- PARS_CREATE_TOKEN = 308,
- PARS_TABLE_TOKEN = 309,
- PARS_INDEX_TOKEN = 310,
- PARS_UNIQUE_TOKEN = 311,
- PARS_CLUSTERED_TOKEN = 312,
- PARS_ON_TOKEN = 313,
- PARS_ASSIGN_TOKEN = 314,
- PARS_DECLARE_TOKEN = 315,
- PARS_CURSOR_TOKEN = 316,
- PARS_SQL_TOKEN = 317,
- PARS_OPEN_TOKEN = 318,
- PARS_FETCH_TOKEN = 319,
- PARS_CLOSE_TOKEN = 320,
- PARS_NOTFOUND_TOKEN = 321,
- PARS_TO_CHAR_TOKEN = 322,
- PARS_TO_NUMBER_TOKEN = 323,
- PARS_TO_BINARY_TOKEN = 324,
- PARS_BINARY_TO_NUMBER_TOKEN = 325,
- PARS_SUBSTR_TOKEN = 326,
- PARS_REPLSTR_TOKEN = 327,
- PARS_CONCAT_TOKEN = 328,
- PARS_INSTR_TOKEN = 329,
- PARS_LENGTH_TOKEN = 330,
- PARS_SYSDATE_TOKEN = 331,
- PARS_PRINTF_TOKEN = 332,
- PARS_ASSERT_TOKEN = 333,
- PARS_RND_TOKEN = 334,
- PARS_RND_STR_TOKEN = 335,
- PARS_ROW_PRINTF_TOKEN = 336,
- PARS_COMMIT_TOKEN = 337,
- PARS_ROLLBACK_TOKEN = 338,
- PARS_WORK_TOKEN = 339,
- PARS_UNSIGNED_TOKEN = 340,
- PARS_EXIT_TOKEN = 341,
- PARS_FUNCTION_TOKEN = 342,
- PARS_LOCK_TOKEN = 343,
- PARS_SHARE_TOKEN = 344,
- PARS_MODE_TOKEN = 345,
- PARS_LIKE_TOKEN = 346,
- PARS_LIKE_TOKEN_EXACT = 347,
- PARS_LIKE_TOKEN_PREFIX = 348,
- PARS_LIKE_TOKEN_SUFFIX = 349,
- PARS_LIKE_TOKEN_SUBSTR = 350,
- PARS_TABLE_NAME_TOKEN = 351,
- PARS_COMPACT_TOKEN = 352,
- PARS_BLOCK_SIZE_TOKEN = 353,
- PARS_BIGINT_TOKEN = 354,
- NEG = 355
+ PARS_INT_TOKEN = 271,
+ PARS_CHAR_TOKEN = 272,
+ PARS_IS_TOKEN = 273,
+ PARS_BEGIN_TOKEN = 274,
+ PARS_END_TOKEN = 275,
+ PARS_IF_TOKEN = 276,
+ PARS_THEN_TOKEN = 277,
+ PARS_ELSE_TOKEN = 278,
+ PARS_ELSIF_TOKEN = 279,
+ PARS_LOOP_TOKEN = 280,
+ PARS_WHILE_TOKEN = 281,
+ PARS_RETURN_TOKEN = 282,
+ PARS_SELECT_TOKEN = 283,
+ PARS_COUNT_TOKEN = 284,
+ PARS_FROM_TOKEN = 285,
+ PARS_WHERE_TOKEN = 286,
+ PARS_FOR_TOKEN = 287,
+ PARS_DDOT_TOKEN = 288,
+ PARS_ORDER_TOKEN = 289,
+ PARS_BY_TOKEN = 290,
+ PARS_ASC_TOKEN = 291,
+ PARS_DESC_TOKEN = 292,
+ PARS_INSERT_TOKEN = 293,
+ PARS_INTO_TOKEN = 294,
+ PARS_VALUES_TOKEN = 295,
+ PARS_UPDATE_TOKEN = 296,
+ PARS_SET_TOKEN = 297,
+ PARS_DELETE_TOKEN = 298,
+ PARS_CURRENT_TOKEN = 299,
+ PARS_OF_TOKEN = 300,
+ PARS_CREATE_TOKEN = 301,
+ PARS_TABLE_TOKEN = 302,
+ PARS_INDEX_TOKEN = 303,
+ PARS_UNIQUE_TOKEN = 304,
+ PARS_CLUSTERED_TOKEN = 305,
+ PARS_ON_TOKEN = 306,
+ PARS_ASSIGN_TOKEN = 307,
+ PARS_DECLARE_TOKEN = 308,
+ PARS_CURSOR_TOKEN = 309,
+ PARS_SQL_TOKEN = 310,
+ PARS_OPEN_TOKEN = 311,
+ PARS_FETCH_TOKEN = 312,
+ PARS_CLOSE_TOKEN = 313,
+ PARS_NOTFOUND_TOKEN = 314,
+ PARS_TO_BINARY_TOKEN = 315,
+ PARS_SUBSTR_TOKEN = 316,
+ PARS_CONCAT_TOKEN = 317,
+ PARS_INSTR_TOKEN = 318,
+ PARS_LENGTH_TOKEN = 319,
+ PARS_COMMIT_TOKEN = 320,
+ PARS_ROLLBACK_TOKEN = 321,
+ PARS_WORK_TOKEN = 322,
+ PARS_EXIT_TOKEN = 323,
+ PARS_FUNCTION_TOKEN = 324,
+ PARS_LOCK_TOKEN = 325,
+ PARS_SHARE_TOKEN = 326,
+ PARS_MODE_TOKEN = 327,
+ PARS_LIKE_TOKEN = 328,
+ PARS_LIKE_TOKEN_EXACT = 329,
+ PARS_LIKE_TOKEN_PREFIX = 330,
+ PARS_LIKE_TOKEN_SUFFIX = 331,
+ PARS_LIKE_TOKEN_SUBSTR = 332,
+ PARS_TABLE_NAME_TOKEN = 333,
+ PARS_BIGINT_TOKEN = 334,
+ NEG = 335
};
#endif
@@ -231,9 +219,7 @@ int yyparse (void);
#endif /* !YY_YY_PARS0GRM_TAB_H_INCLUDED */
-/* Copy the second part of user declarations. */
-#line 237 "pars0grm.cc" /* yacc.c:358 */
#ifdef short
# undef short
@@ -254,13 +240,13 @@ typedef signed char yytype_int8;
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
-typedef short int yytype_int16;
+typedef short yytype_int16;
#endif
#ifndef YYSIZE_T
@@ -272,7 +258,7 @@ typedef short int yytype_int16;
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
@@ -308,15 +294,6 @@ typedef short int yytype_int16;
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -324,7 +301,7 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
@@ -344,6 +321,8 @@ typedef short int yytype_int16;
#endif
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -475,42 +454,42 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 780
+#define YYLAST 603
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 116
+#define YYNTOKENS 96
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 72
+#define YYNNTS 64
/* YYNRULES -- Number of rules. */
-#define YYNRULES 178
+#define YYNRULES 150
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 345
+#define YYNSTATES 300
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 355
+#define YYMAXUTOK 335
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
+ as returned by yylex. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 108, 2, 2,
- 110, 111, 105, 104, 113, 103, 2, 106, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 109,
- 101, 100, 102, 112, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 88, 2, 2,
+ 90, 91, 85, 84, 93, 83, 2, 86, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 89,
+ 81, 80, 82, 92, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 114, 2, 115, 2, 2, 2, 2,
+ 2, 2, 2, 94, 2, 95, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -531,33 +510,29 @@ static const yytype_uint8 yytranslate[] =
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 107
+ 75, 76, 77, 78, 79, 87
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 160, 160, 163, 164, 165, 166, 167, 168, 169,
- 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
- 180, 181, 182, 183, 184, 188, 189, 194, 195, 197,
- 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 211, 212, 213, 214, 215, 216, 217, 218,
- 219, 221, 226, 227, 228, 229, 231, 232, 233, 234,
- 235, 236, 237, 240, 242, 243, 247, 253, 258, 259,
- 260, 264, 268, 269, 274, 275, 276, 281, 282, 283,
- 287, 288, 293, 299, 306, 307, 308, 313, 315, 318,
- 322, 323, 327, 328, 333, 334, 339, 340, 341, 345,
- 346, 353, 368, 373, 376, 384, 390, 391, 396, 402,
- 411, 419, 427, 434, 442, 450, 456, 463, 469, 470,
- 475, 476, 478, 482, 489, 495, 505, 509, 513, 520,
- 527, 531, 539, 548, 549, 554, 555, 560, 561, 567,
- 568, 574, 575, 580, 581, 586, 597, 598, 603, 604,
- 608, 609, 613, 627, 628, 632, 637, 642, 643, 644,
- 645, 646, 650, 655, 663, 664, 665, 670, 676, 678,
- 679, 683, 691, 697, 698, 701, 703, 704, 708
+ 0, 140, 140, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 166, 167, 172, 173, 175, 176, 177,
+ 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
+ 189, 190, 191, 192, 193, 194, 195, 196, 197, 199,
+ 204, 205, 206, 207, 208, 211, 213, 214, 218, 224,
+ 228, 229, 234, 235, 236, 241, 242, 243, 247, 248,
+ 256, 257, 258, 263, 265, 268, 272, 273, 277, 278,
+ 283, 284, 289, 290, 291, 295, 296, 303, 318, 323,
+ 326, 334, 340, 341, 346, 352, 361, 369, 377, 384,
+ 392, 400, 407, 413, 414, 419, 420, 422, 426, 433,
+ 439, 449, 453, 457, 464, 471, 475, 483, 492, 493,
+ 498, 499, 504, 505, 511, 519, 520, 525, 526, 530,
+ 531, 535, 549, 550, 554, 559, 564, 565, 566, 570,
+ 576, 578, 579, 583, 591, 597, 598, 601, 603, 604,
+ 608
};
#endif
@@ -570,39 +545,30 @@ static const char *const yytname[] =
"PARS_STR_LIT", "PARS_NULL_LIT", "PARS_ID_TOKEN", "PARS_AND_TOKEN",
"PARS_OR_TOKEN", "PARS_NOT_TOKEN", "PARS_GE_TOKEN", "PARS_LE_TOKEN",
"PARS_NE_TOKEN", "PARS_PROCEDURE_TOKEN", "PARS_IN_TOKEN",
- "PARS_OUT_TOKEN", "PARS_BINARY_TOKEN", "PARS_BLOB_TOKEN",
- "PARS_INT_TOKEN", "PARS_FLOAT_TOKEN", "PARS_CHAR_TOKEN", "PARS_IS_TOKEN",
- "PARS_BEGIN_TOKEN", "PARS_END_TOKEN", "PARS_IF_TOKEN", "PARS_THEN_TOKEN",
- "PARS_ELSE_TOKEN", "PARS_ELSIF_TOKEN", "PARS_LOOP_TOKEN",
- "PARS_WHILE_TOKEN", "PARS_RETURN_TOKEN", "PARS_SELECT_TOKEN",
- "PARS_SUM_TOKEN", "PARS_COUNT_TOKEN", "PARS_DISTINCT_TOKEN",
+ "PARS_INT_TOKEN", "PARS_CHAR_TOKEN", "PARS_IS_TOKEN", "PARS_BEGIN_TOKEN",
+ "PARS_END_TOKEN", "PARS_IF_TOKEN", "PARS_THEN_TOKEN", "PARS_ELSE_TOKEN",
+ "PARS_ELSIF_TOKEN", "PARS_LOOP_TOKEN", "PARS_WHILE_TOKEN",
+ "PARS_RETURN_TOKEN", "PARS_SELECT_TOKEN", "PARS_COUNT_TOKEN",
"PARS_FROM_TOKEN", "PARS_WHERE_TOKEN", "PARS_FOR_TOKEN",
- "PARS_DDOT_TOKEN", "PARS_READ_TOKEN", "PARS_ORDER_TOKEN",
- "PARS_BY_TOKEN", "PARS_ASC_TOKEN", "PARS_DESC_TOKEN",
- "PARS_INSERT_TOKEN", "PARS_INTO_TOKEN", "PARS_VALUES_TOKEN",
- "PARS_UPDATE_TOKEN", "PARS_SET_TOKEN", "PARS_DELETE_TOKEN",
- "PARS_CURRENT_TOKEN", "PARS_OF_TOKEN", "PARS_CREATE_TOKEN",
- "PARS_TABLE_TOKEN", "PARS_INDEX_TOKEN", "PARS_UNIQUE_TOKEN",
- "PARS_CLUSTERED_TOKEN", "PARS_ON_TOKEN", "PARS_ASSIGN_TOKEN",
- "PARS_DECLARE_TOKEN", "PARS_CURSOR_TOKEN", "PARS_SQL_TOKEN",
- "PARS_OPEN_TOKEN", "PARS_FETCH_TOKEN", "PARS_CLOSE_TOKEN",
- "PARS_NOTFOUND_TOKEN", "PARS_TO_CHAR_TOKEN", "PARS_TO_NUMBER_TOKEN",
- "PARS_TO_BINARY_TOKEN", "PARS_BINARY_TO_NUMBER_TOKEN",
- "PARS_SUBSTR_TOKEN", "PARS_REPLSTR_TOKEN", "PARS_CONCAT_TOKEN",
- "PARS_INSTR_TOKEN", "PARS_LENGTH_TOKEN", "PARS_SYSDATE_TOKEN",
- "PARS_PRINTF_TOKEN", "PARS_ASSERT_TOKEN", "PARS_RND_TOKEN",
- "PARS_RND_STR_TOKEN", "PARS_ROW_PRINTF_TOKEN", "PARS_COMMIT_TOKEN",
- "PARS_ROLLBACK_TOKEN", "PARS_WORK_TOKEN", "PARS_UNSIGNED_TOKEN",
- "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN", "PARS_LOCK_TOKEN",
- "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN", "PARS_LIKE_TOKEN",
- "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX",
+ "PARS_DDOT_TOKEN", "PARS_ORDER_TOKEN", "PARS_BY_TOKEN", "PARS_ASC_TOKEN",
+ "PARS_DESC_TOKEN", "PARS_INSERT_TOKEN", "PARS_INTO_TOKEN",
+ "PARS_VALUES_TOKEN", "PARS_UPDATE_TOKEN", "PARS_SET_TOKEN",
+ "PARS_DELETE_TOKEN", "PARS_CURRENT_TOKEN", "PARS_OF_TOKEN",
+ "PARS_CREATE_TOKEN", "PARS_TABLE_TOKEN", "PARS_INDEX_TOKEN",
+ "PARS_UNIQUE_TOKEN", "PARS_CLUSTERED_TOKEN", "PARS_ON_TOKEN",
+ "PARS_ASSIGN_TOKEN", "PARS_DECLARE_TOKEN", "PARS_CURSOR_TOKEN",
+ "PARS_SQL_TOKEN", "PARS_OPEN_TOKEN", "PARS_FETCH_TOKEN",
+ "PARS_CLOSE_TOKEN", "PARS_NOTFOUND_TOKEN", "PARS_TO_BINARY_TOKEN",
+ "PARS_SUBSTR_TOKEN", "PARS_CONCAT_TOKEN", "PARS_INSTR_TOKEN",
+ "PARS_LENGTH_TOKEN", "PARS_COMMIT_TOKEN", "PARS_ROLLBACK_TOKEN",
+ "PARS_WORK_TOKEN", "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN",
+ "PARS_LOCK_TOKEN", "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN",
+ "PARS_LIKE_TOKEN", "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX",
"PARS_LIKE_TOKEN_SUFFIX", "PARS_LIKE_TOKEN_SUBSTR",
- "PARS_TABLE_NAME_TOKEN", "PARS_COMPACT_TOKEN", "PARS_BLOCK_SIZE_TOKEN",
- "PARS_BIGINT_TOKEN", "'='", "'<'", "'>'", "'-'", "'+'", "'*'", "'/'",
- "NEG", "'%'", "';'", "'('", "')'", "'?'", "','", "'{'", "'}'", "$accept",
- "top_statement", "statement", "statement_list", "exp", "function_name",
- "question_mark_list", "stored_procedure_call",
- "predefined_procedure_call", "predefined_procedure_name",
+ "PARS_TABLE_NAME_TOKEN", "PARS_BIGINT_TOKEN", "'='", "'<'", "'>'", "'-'",
+ "'+'", "'*'", "'/'", "NEG", "'%'", "';'", "'('", "')'", "'?'", "','",
+ "'{'", "'}'", "$accept", "top_statement", "statement", "statement_list",
+ "exp", "function_name", "question_mark_list", "stored_procedure_call",
"user_function_call", "table_list", "variable_list", "exp_list",
"select_item", "select_item_list", "select_list", "search_condition",
"for_update_clause", "lock_shared_clause", "order_direction",
@@ -611,16 +577,14 @@ static const char *const yytname[] =
"cursor_positioned", "update_statement_start",
"update_statement_searched", "update_statement_positioned",
"delete_statement_start", "delete_statement_searched",
- "delete_statement_positioned", "row_printf_statement",
- "assignment_statement", "elsif_element", "elsif_list", "else_part",
- "if_statement", "while_statement", "for_statement", "exit_statement",
- "return_statement", "open_cursor_statement", "close_cursor_statement",
- "fetch_statement", "column_def", "column_def_list", "opt_column_len",
- "opt_unsigned", "opt_not_null", "compact", "block_size", "create_table",
- "column_list", "unique_def", "clustered_def", "create_index",
- "table_name", "commit_statement", "rollback_statement", "type_name",
- "parameter_declaration", "parameter_declaration_list",
- "variable_declaration", "variable_declaration_list",
+ "delete_statement_positioned", "assignment_statement", "elsif_element",
+ "elsif_list", "else_part", "if_statement", "while_statement",
+ "for_statement", "exit_statement", "return_statement",
+ "open_cursor_statement", "close_cursor_statement", "fetch_statement",
+ "column_def", "column_def_list", "opt_column_len", "opt_not_null",
+ "create_table", "column_list", "unique_def", "clustered_def",
+ "create_index", "table_name", "commit_statement", "rollback_statement",
+ "type_name", "variable_declaration", "variable_declaration_list",
"cursor_declaration", "function_declaration", "declaration",
"declaration_list", "procedure_definition", YY_NULLPTR
};
@@ -639,17 +603,15 @@ static const yytype_uint16 yytoknum[] =
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
- 61, 60, 62, 45, 43, 42, 47, 355, 37, 59,
+ 61, 60, 62, 45, 43, 42, 47, 335, 37, 59,
40, 41, 63, 44, 123, 125
};
# endif
-#define YYPACT_NINF -176
+#define YYPACT_NINF -129
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-176)))
+ (!!((Yystate) == (-129)))
#define YYTABLE_NINF -1
@@ -660,41 +622,36 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- 20, 21, 41, -64, -59, -176, -176, 48, 54, -176,
- -74, 12, 12, 45, 48, -176, -176, -176, -176, -176,
- -176, -176, 69, -176, 12, -176, 8, -32, -43, -176,
- -176, -176, -176, -13, -176, 72, 81, 445, -176, 75,
- -11, 42, 530, 530, -176, 16, 99, 67, -3, 78,
- -14, 108, 109, 110, -176, -176, -176, 86, 36, 44,
- -176, 122, -176, 216, -176, 22, 23, 25, 6, 26,
- 93, 27, 33, 93, 46, 51, 53, 56, 61, 63,
- 64, 66, 68, 70, 71, 76, 79, 89, 94, 95,
- 86, -176, 530, -176, -176, -176, -176, 43, 530, 49,
- -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
- -176, 530, 530, 570, 77, 603, 80, 96, -176, 674,
- -176, -38, 118, 161, -3, -176, -176, 129, -3, -3,
- -176, 148, -176, 163, -176, -176, -176, -176, 97, -176,
- -176, -176, 530, -176, 100, -176, -176, 481, -176, -176,
- -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
- -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
- 102, 674, 149, 220, 155, 14, 91, 530, 530, 530,
- 530, 530, 445, 219, 530, 530, 530, 530, 530, 530,
- 530, 530, 445, 530, -24, 218, 267, -3, 530, -176,
- 221, -176, 117, -176, 179, 228, 124, 674, -65, 530,
- 185, 674, -176, -176, -176, -176, 220, 220, 19, 19,
- 674, 136, -176, 19, 19, 19, 3, 3, 14, 14,
- -57, 326, 554, 231, 128, -176, 130, -176, -1, -176,
- 610, 142, -176, 131, 238, 242, 141, -176, 130, -176,
- -52, -176, 530, -51, 246, 445, 530, -176, 227, 233,
- -176, 229, -176, 151, -176, 252, 530, -3, 225, 530,
- 530, 221, 12, -176, -48, 207, 156, 153, 164, 674,
- -176, -176, 445, 626, -176, 250, -176, -176, -176, -176,
- 230, 194, 655, 674, -176, 173, 187, 238, -3, -176,
- -176, -176, 445, -176, -176, 270, 245, 445, 284, 204,
- -176, 192, -176, 181, 445, 203, 253, -176, 386, 193,
- -176, 286, 205, -176, 296, 217, 299, 279, -176, 303,
- -176, 307, -176, -47, -176, 30, -176, -176, -176, -176,
- 305, -176, -176, -176, -176
+ 5, 34, 46, -28, -41, -129, -129, -12, 45, 57,
+ 23, -129, 9, -129, -129, -129, 20, -9, -129, -129,
+ -129, -129, 2, -129, 83, 87, 278, -129, 93, 28,
+ 71, 427, 427, -129, 335, 105, 85, -1, 104, -27,
+ 129, 132, 133, 76, 77, -129, 141, -129, 149, -129,
+ 61, 19, 62, 118, 65, 66, 118, 68, 69, 70,
+ 72, 73, 74, 75, 78, 79, 82, 84, 89, 90,
+ 91, 94, 138, -129, 427, -129, -129, -129, -129, 86,
+ 427, 96, -129, -129, -129, -129, -129, 427, 427, 438,
+ 92, 454, 95, -129, 1, -129, -24, 130, 157, -1,
+ -129, -129, 144, -1, -1, -129, 139, -129, 154, -129,
+ -129, -129, 98, -129, -129, -129, 108, -129, -129, 345,
+ -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+ -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+ -129, 112, 1, 135, 285, 143, -8, 15, 427, 427,
+ 427, 427, 427, 278, 203, 427, 427, 427, 427, 427,
+ 427, 427, 427, 278, 124, 204, 381, -1, 427, -129,
+ 209, -129, 120, -129, 173, 215, 131, 427, 180, 1,
+ -129, -129, -129, -129, 285, 285, 30, 30, 1, 10,
+ -129, 30, 30, 30, 60, 60, -8, -8, 1, -39,
+ 192, 137, -129, 136, -129, -13, -129, 472, 146, -129,
+ 147, 225, 227, 151, -129, 136, -129, -21, 0, 229,
+ 278, 427, -129, 213, 219, -129, 427, 220, -129, 237,
+ 427, -1, 214, 427, 427, 209, 23, -129, 14, 196,
+ 160, 158, 162, -129, -129, 278, 486, -129, 231, 1,
+ -129, -129, -129, 218, 194, 517, 1, -129, 175, -129,
+ 225, -1, -129, -129, -129, 278, -129, -129, 251, 234,
+ 278, 266, 260, -129, 181, 278, 201, 239, -129, 235,
+ 184, 271, -129, 272, 208, 275, 258, -129, -129, -129,
+ 17, -129, -7, -129, -129, 277, -129, -129, -129, -129
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -702,67 +659,60 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 0, 0, 0, 1, 2, 164, 0, 165,
- 0, 0, 0, 0, 0, 160, 161, 157, 159, 158,
- 162, 163, 168, 166, 0, 169, 175, 0, 0, 170,
- 173, 174, 176, 0, 167, 0, 0, 0, 177, 0,
- 0, 0, 0, 0, 127, 84, 0, 0, 0, 0,
- 148, 0, 0, 0, 68, 69, 70, 0, 0, 0,
- 126, 0, 25, 0, 3, 0, 0, 0, 0, 0,
- 90, 0, 0, 90, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 0, 0, 140,
+ 0, 141, 147, 136, 138, 137, 0, 0, 142, 145,
+ 146, 148, 0, 139, 0, 0, 0, 149, 0, 0,
+ 0, 0, 0, 112, 70, 0, 0, 0, 0, 127,
+ 0, 0, 0, 0, 0, 111, 0, 23, 0, 3,
+ 0, 0, 0, 76, 0, 0, 76, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 172, 0, 29, 30, 31, 32, 27, 0, 33,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 0, 0, 0, 0, 0, 0, 0, 87, 80,
- 85, 89, 0, 0, 0, 153, 154, 0, 0, 0,
- 149, 150, 128, 0, 129, 115, 155, 156, 0, 178,
- 26, 4, 77, 11, 0, 104, 12, 0, 110, 111,
- 16, 17, 113, 114, 14, 15, 13, 10, 8, 5,
- 6, 7, 9, 18, 20, 19, 23, 24, 21, 22,
- 0, 116, 0, 49, 0, 38, 0, 0, 0, 0,
+ 0, 0, 0, 144, 0, 27, 28, 29, 30, 25,
+ 0, 31, 50, 51, 52, 53, 54, 0, 0, 0,
+ 0, 0, 0, 73, 68, 71, 75, 0, 0, 0,
+ 132, 133, 0, 0, 0, 128, 129, 113, 0, 114,
+ 134, 135, 0, 150, 24, 10, 0, 90, 11, 0,
+ 96, 97, 14, 15, 99, 100, 12, 13, 9, 7,
+ 4, 5, 6, 8, 16, 18, 17, 21, 22, 19,
+ 20, 0, 101, 0, 47, 0, 36, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 77, 0, 0, 0, 74, 0, 0, 0, 102,
- 0, 112, 0, 151, 0, 74, 63, 78, 0, 77,
- 0, 91, 171, 50, 51, 39, 47, 48, 44, 45,
- 46, 120, 41, 40, 42, 43, 35, 34, 36, 37,
- 0, 0, 0, 0, 0, 75, 88, 86, 90, 72,
- 0, 0, 106, 109, 0, 0, 75, 131, 130, 64,
- 0, 67, 0, 0, 0, 0, 0, 118, 122, 0,
- 28, 0, 83, 0, 81, 0, 0, 0, 92, 0,
- 0, 0, 0, 133, 0, 0, 0, 0, 0, 79,
- 103, 108, 121, 0, 119, 0, 124, 82, 76, 73,
- 0, 94, 0, 105, 107, 135, 141, 0, 0, 71,
- 66, 65, 0, 123, 93, 0, 99, 0, 0, 137,
- 142, 143, 134, 0, 117, 0, 0, 101, 0, 0,
- 138, 139, 0, 145, 0, 0, 0, 0, 136, 0,
- 132, 0, 146, 0, 95, 96, 125, 140, 144, 152,
- 0, 97, 98, 100, 147
+ 0, 0, 65, 0, 0, 62, 0, 0, 0, 88,
+ 0, 98, 0, 130, 0, 62, 55, 65, 0, 77,
+ 143, 48, 49, 37, 45, 46, 42, 43, 44, 105,
+ 39, 38, 40, 41, 33, 32, 34, 35, 66, 0,
+ 0, 0, 63, 74, 72, 76, 60, 0, 0, 92,
+ 95, 0, 0, 63, 116, 115, 56, 0, 0, 0,
+ 0, 0, 103, 107, 0, 26, 0, 0, 69, 0,
+ 0, 0, 78, 0, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 89, 94, 106, 0, 104, 0, 67,
+ 109, 64, 61, 0, 80, 0, 91, 93, 120, 124,
+ 0, 0, 59, 58, 57, 0, 108, 79, 0, 85,
+ 0, 0, 122, 119, 0, 102, 0, 0, 87, 0,
+ 0, 0, 117, 0, 0, 0, 0, 121, 123, 125,
+ 0, 81, 82, 110, 131, 0, 83, 84, 86, 126
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -176, -176, -62, -175, -40, -176, -176, -176, -176, -176,
- -176, -176, 111, -166, 119, -176, -176, -67, -176, -176,
- -176, -176, -33, -176, -176, 47, -176, 240, -176, -176,
- -176, -176, -176, -176, -176, -176, 59, -176, -176, -176,
- -176, -176, -176, -176, -176, -176, -176, 17, -176, -176,
- -176, -176, -176, -176, -176, -176, -176, -176, -176, -115,
- -176, -176, -12, 313, -176, 293, -176, -176, -176, 295,
- -176, -176
+ -129, -129, -48, -128, -30, -129, -129, -129, -129, -129,
+ 113, 110, 123, -129, -129, -52, -129, -129, -129, -129,
+ -40, -129, -129, 55, -129, 238, -129, -129, -129, -129,
+ -129, -129, -129, 88, -129, -129, -129, -129, -129, -129,
+ -129, -129, -129, -129, 35, -129, -129, -129, -129, -129,
+ -129, -129, -129, -96, -129, -129, 81, 290, -129, -129,
+ -129, 286, -129, -129
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 2, 62, 63, 207, 114, 250, 64, 65, 66,
- 247, 238, 236, 208, 120, 121, 122, 148, 291, 306,
- 343, 317, 67, 68, 69, 242, 243, 149, 70, 71,
- 72, 73, 74, 75, 76, 77, 257, 258, 259, 78,
- 79, 80, 81, 82, 83, 84, 85, 273, 274, 309,
- 321, 330, 311, 323, 86, 333, 131, 204, 87, 127,
- 88, 89, 20, 9, 10, 25, 26, 30, 31, 32,
- 33, 3
+ -1, 2, 47, 48, 94, 90, 217, 49, 214, 205,
+ 203, 199, 95, 96, 97, 120, 254, 269, 298, 278,
+ 50, 51, 52, 209, 210, 121, 53, 54, 55, 56,
+ 57, 58, 59, 222, 223, 224, 60, 61, 62, 63,
+ 64, 65, 66, 67, 237, 238, 272, 282, 68, 290,
+ 106, 174, 69, 102, 70, 71, 16, 11, 12, 19,
+ 20, 21, 22, 3
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -770,232 +720,189 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint16 yytable[] =
{
- 21, 140, 113, 115, 125, 119, 152, 221, 195, 199,
- 37, 233, 27, 201, 202, 24, 181, 231, 35, 93,
- 94, 95, 96, 97, 135, 230, 98, 181, 4, 15,
- 16, 17, 181, 18, 1, 145, 266, 13, 45, 14,
- 129, 5, 130, 253, 36, 6, 251, 28, 252, 116,
- 117, 7, 171, 144, 260, 8, 252, 170, 173, 277,
- 280, 278, 252, 296, 339, 297, 340, 22, 28, 11,
- 12, 175, 176, 341, 342, 196, 24, 34, 99, 39,
- 282, 234, 239, 100, 101, 102, 103, 104, 40, 105,
- 106, 107, 108, 126, 183, 109, 110, 90, 91, 177,
- 178, 92, 179, 180, 181, 183, 123, 211, 189, 190,
- 183, 19, 267, 124, 128, 132, 133, 134, 45, 111,
- 136, 118, 187, 188, 189, 190, 112, 314, 137, 138,
- 147, 141, 318, 142, 143, 146, 150, 216, 217, 218,
- 219, 220, 151, 41, 223, 224, 225, 226, 227, 228,
- 229, 172, 289, 232, 197, 154, 119, 174, 240, 140,
- 155, 42, 156, 255, 256, 157, 43, 44, 45, 140,
- 158, 268, 159, 160, 46, 161, 198, 162, 200, 163,
- 164, 47, 183, 313, 48, 165, 49, 191, 166, 50,
- 193, 184, 185, 186, 187, 188, 189, 190, 167, 51,
- 52, 53, 215, 168, 169, 203, 194, 206, 54, 205,
- 209, 212, 279, 55, 56, 213, 283, 57, 58, 59,
- 140, 214, 60, 41, 222, 235, 211, 244, 241, 292,
- 293, 179, 180, 181, 245, 246, 249, 254, 263, 264,
- 139, 42, 270, 265, 271, 272, 43, 44, 45, 275,
- 61, 276, 140, 281, 46, 256, 140, 285, 286, 288,
- 295, 47, 287, 290, 48, 298, 49, 299, 300, 50,
- 93, 94, 95, 96, 97, 303, 301, 98, 304, 51,
- 52, 53, 305, 308, 310, 315, 316, 319, 54, 320,
- 322, 324, 325, 55, 56, 326, 329, 57, 58, 59,
- 116, 117, 60, 332, 328, 331, 335, 334, 336, 337,
- 338, 183, 344, 153, 312, 237, 248, 284, 294, 29,
- 184, 185, 186, 187, 188, 189, 190, 23, 38, 99,
- 61, 0, 0, 41, 100, 101, 102, 103, 104, 0,
- 105, 106, 107, 108, 0, 0, 109, 110, 0, 0,
- 261, 42, 0, 0, 0, 0, 43, 44, 45, 0,
- 0, 0, 0, 0, 46, 0, 0, 0, 0, 0,
- 111, 47, 0, 0, 48, 0, 49, 112, 0, 50,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
- 52, 53, 0, 41, 0, 0, 0, 0, 54, 0,
- 0, 0, 0, 55, 56, 0, 0, 57, 58, 59,
- 327, 42, 60, 0, 0, 0, 43, 44, 45, 0,
- 0, 0, 0, 0, 46, 0, 0, 0, 0, 0,
- 0, 47, 0, 0, 48, 0, 49, 0, 0, 50,
- 61, 0, 0, 0, 0, 0, 0, 0, 0, 51,
- 52, 53, 41, 0, 0, 0, 0, 0, 54, 0,
- 0, 0, 0, 55, 56, 0, 0, 57, 58, 59,
- 42, 0, 60, 0, 0, 43, 44, 45, 0, 0,
- 0, 0, 0, 46, 93, 94, 95, 96, 97, 0,
- 47, 98, 0, 48, 0, 49, 0, 0, 50, 0,
- 61, 0, 0, 0, 0, 0, 0, 0, 51, 52,
- 53, 0, 0, 0, 0, 0, 0, 54, 0, 0,
- 0, 0, 55, 56, 0, 0, 57, 58, 59, 0,
- 0, 60, 210, 93, 94, 95, 96, 97, 0, 0,
- 98, 0, 0, 99, 0, 0, 0, 0, 100, 101,
- 102, 103, 104, 0, 105, 106, 107, 108, 0, 61,
- 109, 110, 177, 178, 0, 179, 180, 181, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 177, 178,
- 0, 179, 180, 181, 111, 0, 0, 0, 0, 0,
- 0, 112, 99, 0, 0, 0, 182, 100, 101, 102,
- 103, 104, 0, 105, 106, 107, 108, 0, 0, 109,
- 110, 177, 178, 0, 179, 180, 181, 0, 177, 178,
- 0, 179, 180, 181, 0, 0, 0, 0, 0, 0,
- 0, 0, 192, 111, 177, 178, 0, 179, 180, 181,
- 112, 0, 0, 0, 0, 183, 0, 0, 0, 269,
- 0, 0, 302, 0, 184, 185, 186, 187, 188, 189,
- 190, 183, 0, 177, 178, 262, 179, 180, 181, 0,
- 184, 185, 186, 187, 188, 189, 190, 0, 0, 0,
- 0, 0, 177, 178, 307, 179, 180, 181, 0, 0,
- 0, 0, 0, 0, 183, 0, 0, 0, 0, 0,
- 0, 183, 0, 184, 185, 186, 187, 188, 189, 190,
- 184, 185, 186, 187, 188, 189, 190, 183, 0, 0,
- 0, 0, 0, 0, 0, 0, 184, 185, 186, 187,
- 188, 189, 190, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 183, 0, 0, 0,
- 0, 0, 0, 0, 0, 184, 185, 186, 187, 188,
- 189, 190, 0, 0, 0, 183, 0, 0, 0, 0,
- 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
- 190
+ 114, 89, 91, 169, 124, 152, 100, 171, 172, 148,
+ 149, 117, 150, 151, 152, 165, 10, 30, 230, 1,
+ 104, 26, 105, 148, 149, 189, 150, 151, 152, 296,
+ 297, 31, 141, 220, 221, 200, 32, 33, 34, 13,
+ 14, 4, 35, 152, 142, 24, 5, 34, 36, 7,
+ 144, 37, 225, 38, 226, 17, 39, 146, 147, 116,
+ 25, 6, 17, 9, 10, 154, 40, 41, 42, 166,
+ 241, 206, 242, 152, 154, 43, 44, 101, 45, 8,
+ 231, 155, 156, 157, 158, 159, 160, 161, 154, 179,
+ 28, 243, 245, 226, 29, 155, 156, 157, 158, 159,
+ 160, 161, 15, 154, 46, 259, 183, 260, 294, 23,
+ 295, 72, 98, 158, 159, 160, 161, 73, 184, 185,
+ 186, 187, 188, 74, 99, 191, 192, 193, 194, 195,
+ 196, 197, 198, 154, 103, 252, 107, 275, 207, 108,
+ 109, 114, 279, 110, 111, 160, 161, 198, 112, 119,
+ 115, 118, 114, 232, 122, 123, 30, 126, 127, 128,
+ 167, 129, 130, 131, 132, 274, 34, 133, 134, 113,
+ 31, 135, 168, 136, 143, 32, 33, 34, 137, 138,
+ 139, 35, 162, 140, 145, 164, 170, 36, 176, 173,
+ 37, 246, 38, 175, 181, 39, 249, 114, 177, 30,
+ 179, 180, 182, 255, 256, 40, 41, 42, 190, 201,
+ 211, 202, 227, 31, 43, 44, 208, 45, 32, 33,
+ 34, 212, 213, 216, 35, 219, 234, 114, 228, 229,
+ 36, 114, 236, 37, 239, 38, 244, 221, 39, 248,
+ 235, 240, 30, 46, 251, 250, 253, 261, 40, 41,
+ 42, 262, 266, 263, 264, 286, 31, 43, 44, 267,
+ 45, 32, 33, 34, 268, 271, 276, 35, 277, 280,
+ 281, 283, 284, 36, 285, 287, 37, 288, 38, 289,
+ 291, 39, 292, 293, 299, 30, 46, 218, 215, 204,
+ 257, 40, 41, 42, 125, 273, 150, 151, 152, 31,
+ 43, 44, 18, 45, 32, 33, 34, 0, 27, 0,
+ 35, 247, 0, 0, 0, 0, 36, 258, 0, 37,
+ 0, 38, 0, 0, 39, 0, 0, 0, 0, 46,
+ 0, 0, 0, 0, 40, 41, 42, 0, 75, 76,
+ 77, 78, 79, 43, 44, 80, 45, 0, 75, 76,
+ 77, 78, 79, 0, 0, 80, 0, 0, 154, 0,
+ 0, 0, 0, 0, 92, 155, 156, 157, 158, 159,
+ 160, 161, 46, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 75, 76, 77, 78, 79, 178,
+ 81, 80, 0, 0, 0, 82, 83, 84, 85, 86,
+ 81, 0, 0, 0, 0, 82, 83, 84, 85, 86,
+ 92, 0, 0, 0, 0, 0, 0, 0, 87, 0,
+ 93, 0, 0, 0, 0, 88, 0, 0, 87, 0,
+ 75, 76, 77, 78, 79, 88, 81, 80, 0, 0,
+ 0, 82, 83, 84, 85, 86, 148, 149, 0, 150,
+ 151, 152, 0, 0, 0, 0, 0, 0, 0, 0,
+ 153, 0, 148, 149, 87, 150, 151, 152, 0, 0,
+ 0, 88, 0, 0, 0, 0, 0, 0, 0, 163,
+ 148, 149, 81, 150, 151, 152, 0, 82, 83, 84,
+ 85, 86, 0, 0, 148, 149, 0, 150, 151, 152,
+ 0, 0, 0, 0, 0, 233, 0, 0, 265, 0,
+ 87, 154, 0, 0, 0, 0, 0, 88, 155, 156,
+ 157, 158, 159, 160, 161, 148, 149, 154, 150, 151,
+ 152, 0, 0, 0, 155, 156, 157, 158, 159, 160,
+ 161, 0, 270, 0, 0, 154, 0, 0, 0, 0,
+ 0, 0, 155, 156, 157, 158, 159, 160, 161, 154,
+ 0, 0, 0, 0, 0, 0, 155, 156, 157, 158,
+ 159, 160, 161, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 154, 0, 0, 0, 0, 0, 0, 155, 156, 157,
+ 158, 159, 160, 161
};
static const yytype_int16 yycheck[] =
{
- 12, 63, 42, 43, 7, 45, 73, 182, 46, 124,
- 23, 35, 24, 128, 129, 7, 13, 192, 61, 3,
- 4, 5, 6, 7, 57, 191, 10, 13, 7, 17,
- 18, 19, 13, 21, 14, 68, 37, 111, 32, 113,
- 54, 0, 56, 209, 87, 109, 111, 60, 113, 33,
- 34, 110, 92, 47, 111, 7, 113, 90, 98, 111,
- 111, 113, 113, 111, 111, 113, 113, 22, 60, 15,
- 16, 111, 112, 43, 44, 113, 7, 109, 62, 7,
- 255, 105, 197, 67, 68, 69, 70, 71, 7, 73,
- 74, 75, 76, 96, 91, 79, 80, 22, 109, 8,
- 9, 59, 11, 12, 13, 91, 7, 147, 105, 106,
- 91, 99, 113, 46, 36, 7, 7, 7, 32, 103,
- 84, 105, 103, 104, 105, 106, 110, 302, 84, 7,
- 37, 109, 307, 110, 109, 109, 109, 177, 178, 179,
- 180, 181, 109, 7, 184, 185, 186, 187, 188, 189,
- 190, 108, 267, 193, 36, 109, 196, 108, 198, 221,
- 109, 25, 109, 27, 28, 109, 30, 31, 32, 231,
- 109, 238, 109, 109, 38, 109, 15, 109, 49, 109,
- 109, 45, 91, 298, 48, 109, 50, 110, 109, 53,
- 110, 100, 101, 102, 103, 104, 105, 106, 109, 63,
- 64, 65, 111, 109, 109, 57, 110, 110, 72, 46,
- 110, 109, 252, 77, 78, 66, 256, 81, 82, 83,
- 282, 66, 86, 7, 5, 7, 266, 110, 7, 269,
- 270, 11, 12, 13, 55, 7, 112, 52, 7, 111,
- 24, 25, 100, 113, 113, 7, 30, 31, 32, 7,
- 114, 110, 314, 7, 38, 28, 318, 24, 29, 7,
- 272, 45, 111, 38, 48, 58, 50, 111, 115, 53,
- 3, 4, 5, 6, 7, 25, 112, 10, 48, 63,
- 64, 65, 88, 110, 97, 15, 41, 3, 72, 85,
- 98, 110, 89, 77, 78, 42, 10, 81, 82, 83,
- 33, 34, 86, 7, 111, 100, 7, 90, 29, 6,
- 3, 91, 7, 73, 297, 196, 205, 258, 271, 26,
- 100, 101, 102, 103, 104, 105, 106, 14, 33, 62,
- 114, -1, -1, 7, 67, 68, 69, 70, 71, -1,
- 73, 74, 75, 76, -1, -1, 79, 80, -1, -1,
- 24, 25, -1, -1, -1, -1, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, -1, -1, -1, -1, -1,
- 103, 45, -1, -1, 48, -1, 50, 110, -1, 53,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
- 64, 65, -1, 7, -1, -1, -1, -1, 72, -1,
- -1, -1, -1, 77, 78, -1, -1, 81, 82, 83,
- 24, 25, 86, -1, -1, -1, 30, 31, 32, -1,
- -1, -1, -1, -1, 38, -1, -1, -1, -1, -1,
- -1, 45, -1, -1, 48, -1, 50, -1, -1, 53,
- 114, -1, -1, -1, -1, -1, -1, -1, -1, 63,
- 64, 65, 7, -1, -1, -1, -1, -1, 72, -1,
- -1, -1, -1, 77, 78, -1, -1, 81, 82, 83,
- 25, -1, 86, -1, -1, 30, 31, 32, -1, -1,
- -1, -1, -1, 38, 3, 4, 5, 6, 7, -1,
- 45, 10, -1, 48, -1, 50, -1, -1, 53, -1,
- 114, -1, -1, -1, -1, -1, -1, -1, 63, 64,
- 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
- -1, -1, 77, 78, -1, -1, 81, 82, 83, -1,
- -1, 86, 51, 3, 4, 5, 6, 7, -1, -1,
- 10, -1, -1, 62, -1, -1, -1, -1, 67, 68,
- 69, 70, 71, -1, 73, 74, 75, 76, -1, 114,
- 79, 80, 8, 9, -1, 11, 12, 13, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
- -1, 11, 12, 13, 103, -1, -1, -1, -1, -1,
- -1, 110, 62, -1, -1, -1, 26, 67, 68, 69,
- 70, 71, -1, 73, 74, 75, 76, -1, -1, 79,
- 80, 8, 9, -1, 11, 12, 13, -1, 8, 9,
- -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 29, 103, 8, 9, -1, 11, 12, 13,
- 110, -1, -1, -1, -1, 91, -1, -1, -1, 39,
- -1, -1, 26, -1, 100, 101, 102, 103, 104, 105,
- 106, 91, -1, 8, 9, 111, 11, 12, 13, -1,
- 100, 101, 102, 103, 104, 105, 106, -1, -1, -1,
- -1, -1, 8, 9, 29, 11, 12, 13, -1, -1,
- -1, -1, -1, -1, 91, -1, -1, -1, -1, -1,
- -1, 91, -1, 100, 101, 102, 103, 104, 105, 106,
- 100, 101, 102, 103, 104, 105, 106, 91, -1, -1,
- -1, -1, -1, -1, -1, -1, 100, 101, 102, 103,
- 104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 91, -1, -1, -1,
- -1, -1, -1, -1, -1, 100, 101, 102, 103, 104,
- 105, 106, -1, -1, -1, 91, -1, -1, -1, -1,
- -1, -1, -1, -1, 100, 101, 102, 103, 104, 105,
- 106
+ 48, 31, 32, 99, 56, 13, 7, 103, 104, 8,
+ 9, 51, 11, 12, 13, 39, 7, 7, 31, 14,
+ 47, 19, 49, 8, 9, 153, 11, 12, 13, 36,
+ 37, 21, 72, 23, 24, 163, 26, 27, 28, 16,
+ 17, 7, 32, 13, 74, 54, 0, 28, 38, 90,
+ 80, 41, 91, 43, 93, 53, 46, 87, 88, 40,
+ 69, 89, 53, 18, 7, 73, 56, 57, 58, 93,
+ 91, 167, 93, 13, 73, 65, 66, 78, 68, 91,
+ 93, 80, 81, 82, 83, 84, 85, 86, 73, 119,
+ 7, 91, 220, 93, 7, 80, 81, 82, 83, 84,
+ 85, 86, 79, 73, 94, 91, 91, 93, 91, 89,
+ 93, 18, 7, 83, 84, 85, 86, 89, 148, 149,
+ 150, 151, 152, 52, 39, 155, 156, 157, 158, 159,
+ 160, 161, 162, 73, 30, 231, 7, 265, 168, 7,
+ 7, 189, 270, 67, 67, 85, 86, 177, 7, 31,
+ 89, 89, 200, 205, 89, 89, 7, 89, 89, 89,
+ 30, 89, 89, 89, 89, 261, 28, 89, 89, 20,
+ 21, 89, 15, 89, 88, 26, 27, 28, 89, 89,
+ 89, 32, 90, 89, 88, 90, 42, 38, 90, 50,
+ 41, 221, 43, 39, 59, 46, 226, 245, 90, 7,
+ 230, 89, 59, 233, 234, 56, 57, 58, 5, 85,
+ 90, 7, 20, 21, 65, 66, 7, 68, 26, 27,
+ 28, 48, 7, 92, 32, 45, 80, 275, 91, 93,
+ 38, 279, 7, 41, 7, 43, 7, 24, 46, 20,
+ 93, 90, 7, 94, 7, 25, 32, 51, 56, 57,
+ 58, 91, 21, 95, 92, 20, 21, 65, 66, 41,
+ 68, 26, 27, 28, 70, 90, 15, 32, 34, 3,
+ 10, 90, 71, 38, 35, 91, 41, 6, 43, 7,
+ 72, 46, 7, 25, 7, 7, 94, 177, 175, 166,
+ 235, 56, 57, 58, 56, 260, 11, 12, 13, 21,
+ 65, 66, 12, 68, 26, 27, 28, -1, 22, -1,
+ 32, 223, -1, -1, -1, -1, 38, 236, -1, 41,
+ -1, 43, -1, -1, 46, -1, -1, -1, -1, 94,
+ -1, -1, -1, -1, 56, 57, 58, -1, 3, 4,
+ 5, 6, 7, 65, 66, 10, 68, -1, 3, 4,
+ 5, 6, 7, -1, -1, 10, -1, -1, 73, -1,
+ -1, -1, -1, -1, 29, 80, 81, 82, 83, 84,
+ 85, 86, 94, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 3, 4, 5, 6, 7, 44,
+ 55, 10, -1, -1, -1, 60, 61, 62, 63, 64,
+ 55, -1, -1, -1, -1, 60, 61, 62, 63, 64,
+ 29, -1, -1, -1, -1, -1, -1, -1, 83, -1,
+ 85, -1, -1, -1, -1, 90, -1, -1, 83, -1,
+ 3, 4, 5, 6, 7, 90, 55, 10, -1, -1,
+ -1, 60, 61, 62, 63, 64, 8, 9, -1, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
+ 22, -1, 8, 9, 83, 11, 12, 13, -1, -1,
+ -1, 90, -1, -1, -1, -1, -1, -1, -1, 25,
+ 8, 9, 55, 11, 12, 13, -1, 60, 61, 62,
+ 63, 64, -1, -1, 8, 9, -1, 11, 12, 13,
+ -1, -1, -1, -1, -1, 33, -1, -1, 22, -1,
+ 83, 73, -1, -1, -1, -1, -1, 90, 80, 81,
+ 82, 83, 84, 85, 86, 8, 9, 73, 11, 12,
+ 13, -1, -1, -1, 80, 81, 82, 83, 84, 85,
+ 86, -1, 25, -1, -1, 73, -1, -1, -1, -1,
+ -1, -1, 80, 81, 82, 83, 84, 85, 86, 73,
+ -1, -1, -1, -1, -1, -1, 80, 81, 82, 83,
+ 84, 85, 86, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 73, -1, -1, -1, -1, -1, -1, 80, 81, 82,
+ 83, 84, 85, 86
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 14, 117, 187, 7, 0, 109, 110, 7, 179,
- 180, 15, 16, 111, 113, 17, 18, 19, 21, 99,
- 178, 178, 22, 179, 7, 181, 182, 178, 60, 181,
- 183, 184, 185, 186, 109, 61, 87, 23, 185, 7,
- 7, 7, 25, 30, 31, 32, 38, 45, 48, 50,
- 53, 63, 64, 65, 72, 77, 78, 81, 82, 83,
- 86, 114, 118, 119, 123, 124, 125, 138, 139, 140,
- 144, 145, 146, 147, 148, 149, 150, 151, 155, 156,
- 157, 158, 159, 160, 161, 162, 170, 174, 176, 177,
- 22, 109, 59, 3, 4, 5, 6, 7, 10, 62,
- 67, 68, 69, 70, 71, 73, 74, 75, 76, 79,
- 80, 103, 110, 120, 121, 120, 33, 34, 105, 120,
- 130, 131, 132, 7, 46, 7, 96, 175, 36, 54,
- 56, 172, 7, 7, 7, 138, 84, 84, 7, 24,
- 118, 109, 110, 109, 47, 138, 109, 37, 133, 143,
- 109, 109, 133, 143, 109, 109, 109, 109, 109, 109,
- 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
- 138, 120, 108, 120, 108, 120, 120, 8, 9, 11,
- 12, 13, 26, 91, 100, 101, 102, 103, 104, 105,
- 106, 110, 29, 110, 110, 46, 113, 36, 15, 175,
- 49, 175, 175, 57, 173, 46, 110, 120, 129, 110,
- 51, 120, 109, 66, 66, 111, 120, 120, 120, 120,
- 120, 119, 5, 120, 120, 120, 120, 120, 120, 120,
- 129, 119, 120, 35, 105, 7, 128, 130, 127, 175,
- 120, 7, 141, 142, 110, 55, 7, 126, 128, 112,
- 122, 111, 113, 129, 52, 27, 28, 152, 153, 154,
- 111, 24, 111, 7, 111, 113, 37, 113, 133, 39,
- 100, 113, 7, 163, 164, 7, 110, 111, 113, 120,
- 111, 7, 119, 120, 152, 24, 29, 111, 7, 175,
- 38, 134, 120, 120, 141, 178, 111, 113, 58, 111,
- 115, 112, 26, 25, 48, 88, 135, 29, 110, 165,
- 97, 168, 163, 175, 119, 15, 41, 137, 119, 3,
- 85, 166, 98, 169, 110, 89, 42, 24, 111, 10,
- 167, 100, 7, 171, 90, 7, 29, 6, 3, 111,
- 113, 43, 44, 136, 7
+ 0, 14, 97, 159, 7, 0, 89, 90, 91, 18,
+ 7, 153, 154, 16, 17, 79, 152, 53, 153, 155,
+ 156, 157, 158, 89, 54, 69, 19, 157, 7, 7,
+ 7, 21, 26, 27, 28, 32, 38, 41, 43, 46,
+ 56, 57, 58, 65, 66, 68, 94, 98, 99, 103,
+ 116, 117, 118, 122, 123, 124, 125, 126, 127, 128,
+ 132, 133, 134, 135, 136, 137, 138, 139, 144, 148,
+ 150, 151, 18, 89, 52, 3, 4, 5, 6, 7,
+ 10, 55, 60, 61, 62, 63, 64, 83, 90, 100,
+ 101, 100, 29, 85, 100, 108, 109, 110, 7, 39,
+ 7, 78, 149, 30, 47, 49, 146, 7, 7, 7,
+ 67, 67, 7, 20, 98, 89, 40, 116, 89, 31,
+ 111, 121, 89, 89, 111, 121, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 116, 100, 88, 100, 88, 100, 100, 8, 9,
+ 11, 12, 13, 22, 73, 80, 81, 82, 83, 84,
+ 85, 86, 90, 25, 90, 39, 93, 30, 15, 149,
+ 42, 149, 149, 50, 147, 39, 90, 90, 44, 100,
+ 89, 59, 59, 91, 100, 100, 100, 100, 100, 99,
+ 5, 100, 100, 100, 100, 100, 100, 100, 100, 107,
+ 99, 85, 7, 106, 108, 105, 149, 100, 7, 119,
+ 120, 90, 48, 7, 104, 106, 92, 102, 107, 45,
+ 23, 24, 129, 130, 131, 91, 93, 20, 91, 93,
+ 31, 93, 111, 33, 80, 93, 7, 140, 141, 7,
+ 90, 91, 93, 91, 7, 99, 100, 129, 20, 100,
+ 25, 7, 149, 32, 112, 100, 100, 119, 152, 91,
+ 93, 51, 91, 95, 92, 22, 21, 41, 70, 113,
+ 25, 90, 142, 140, 149, 99, 15, 34, 115, 99,
+ 3, 10, 143, 90, 71, 35, 20, 91, 6, 7,
+ 145, 72, 7, 25, 91, 93, 36, 37, 114, 7
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 116, 117, 118, 118, 118, 118, 118, 118, 118,
- 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
- 118, 118, 118, 118, 118, 119, 119, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 121, 121, 121, 121, 121, 121, 121, 121,
- 121, 121, 121, 122, 122, 122, 123, 124, 125, 125,
- 125, 126, 127, 127, 128, 128, 128, 129, 129, 129,
- 130, 130, 130, 130, 131, 131, 131, 132, 132, 132,
- 133, 133, 134, 134, 135, 135, 136, 136, 136, 137,
- 137, 138, 139, 140, 140, 141, 142, 142, 143, 144,
- 145, 146, 147, 148, 149, 150, 151, 152, 153, 153,
- 154, 154, 154, 155, 156, 157, 158, 159, 160, 161,
- 162, 162, 163, 164, 164, 165, 165, 166, 166, 167,
- 167, 168, 168, 169, 169, 170, 171, 171, 172, 172,
- 173, 173, 174, 175, 175, 176, 177, 178, 178, 178,
- 178, 178, 179, 179, 180, 180, 180, 181, 182, 182,
- 182, 183, 184, 185, 185, 186, 186, 186, 187
+ 0, 96, 97, 98, 98, 98, 98, 98, 98, 98,
+ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
+ 98, 98, 98, 99, 99, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 101, 101, 101, 101, 101, 102, 102, 102, 103, 104,
+ 105, 105, 106, 106, 106, 107, 107, 107, 108, 108,
+ 109, 109, 109, 110, 110, 110, 111, 111, 112, 112,
+ 113, 113, 114, 114, 114, 115, 115, 116, 117, 118,
+ 118, 119, 120, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 130, 131, 131, 131, 132, 133,
+ 134, 135, 136, 137, 138, 139, 139, 140, 141, 141,
+ 142, 142, 143, 143, 144, 145, 145, 146, 146, 147,
+ 147, 148, 149, 149, 150, 151, 152, 152, 152, 153,
+ 154, 154, 154, 155, 156, 157, 157, 158, 158, 158,
+ 159
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -1003,22 +910,20 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 2, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 2, 1, 4, 1,
- 1, 1, 1, 1, 3, 3, 3, 3, 2, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 1, 3, 6, 4, 1, 1,
- 1, 3, 1, 3, 0, 1, 3, 0, 1, 3,
- 1, 4, 5, 4, 0, 1, 3, 1, 3, 1,
- 0, 2, 0, 2, 0, 4, 0, 1, 1, 0,
- 4, 8, 3, 5, 2, 3, 1, 3, 4, 4,
- 2, 2, 3, 2, 2, 2, 3, 4, 1, 2,
- 0, 2, 1, 7, 6, 10, 1, 1, 2, 2,
- 4, 4, 5, 1, 3, 0, 3, 0, 1, 0,
- 2, 0, 1, 0, 3, 8, 1, 3, 0, 1,
- 0, 1, 10, 1, 1, 2, 2, 1, 1, 1,
- 1, 1, 3, 3, 0, 1, 3, 3, 0, 1,
- 2, 6, 4, 1, 1, 0, 1, 2, 11
+ 2, 2, 2, 1, 2, 1, 4, 1, 1, 1,
+ 1, 1, 3, 3, 3, 3, 2, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
+ 1, 1, 1, 1, 1, 0, 1, 3, 6, 3,
+ 1, 3, 0, 1, 3, 0, 1, 3, 1, 4,
+ 0, 1, 3, 1, 3, 1, 0, 2, 0, 2,
+ 0, 4, 0, 1, 1, 0, 4, 8, 3, 5,
+ 2, 3, 1, 3, 4, 4, 2, 2, 3, 2,
+ 2, 3, 4, 1, 2, 0, 2, 1, 7, 6,
+ 10, 1, 1, 2, 2, 4, 4, 4, 1, 3,
+ 0, 3, 0, 2, 6, 1, 3, 0, 1, 0,
+ 1, 10, 1, 1, 2, 2, 1, 1, 1, 3,
+ 0, 1, 2, 6, 4, 1, 1, 0, 1, 2,
+ 10
};
@@ -1034,22 +939,22 @@ static const yytype_uint8 yyr2[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
/* Error token number */
#define YYTERROR 1
@@ -1089,37 +994,39 @@ do { \
} while (0)
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
# endif
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
{
- YYFPRINTF (yyoutput, "%s %s (",
+ YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yytype, yyvaluep);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -1153,7 +1060,7 @@ do { \
static void
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
- unsigned long int yylno = yyrline[yyrule];
+ unsigned long yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -1164,7 +1071,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr,
yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
+ &yyvsp[(yyi + 1) - (yynrhs)]
);
YYFPRINTF (stderr, "\n");
}
@@ -1268,7 +1175,10 @@ yytnamerr (char *yyres, const char *yystr)
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
- /* Fall through. */
+ else
+ goto append;
+
+ append:
default:
if (yyres)
yyres[yyn] = *yyp;
@@ -1286,7 +1196,7 @@ yytnamerr (char *yyres, const char *yystr)
if (! yyres)
return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
+ return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1364,10 +1274,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
}
}
@@ -1379,6 +1289,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
case N: \
yyformat = S; \
break
+ default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1390,9 +1301,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
return 2;
- yysize = yysize1;
}
if (*yymsg_alloc < yysize)
@@ -1518,23 +1430,33 @@ yyparse (void)
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+ *yyssp = (yytype_int16) yystate;
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
-#ifdef yyoverflow
+# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
@@ -1550,14 +1472,10 @@ yyparse (void)
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
-
yyss = yyss1;
yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
@@ -1573,35 +1491,33 @@ yyparse (void)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
@@ -1659,7 +1575,6 @@ yybackup:
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
-
goto yynewstate;
@@ -1674,7 +1589,7 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
@@ -1694,953 +1609,779 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 25:
-#line 188 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1701 "pars0grm.cc" /* yacc.c:1646 */
+ case 23:
+#line 166 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1616 "pars0grm.cc"
+ break;
+
+ case 24:
+#line 168 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-1], yyvsp[0]); }
+#line 1622 "pars0grm.cc"
+ break;
+
+ case 25:
+#line 172 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1628 "pars0grm.cc"
break;
case 26:
-#line 190 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 1707 "pars0grm.cc" /* yacc.c:1646 */
+#line 174 "pars0grm.y"
+ { yyval = pars_func(yyvsp[-3], yyvsp[-1]); }
+#line 1634 "pars0grm.cc"
break;
case 27:
-#line 194 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1713 "pars0grm.cc" /* yacc.c:1646 */
+#line 175 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1640 "pars0grm.cc"
break;
case 28:
-#line 196 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_func((yyvsp[-3]), (yyvsp[-1])); }
-#line 1719 "pars0grm.cc" /* yacc.c:1646 */
+#line 176 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1646 "pars0grm.cc"
break;
case 29:
-#line 197 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1725 "pars0grm.cc" /* yacc.c:1646 */
+#line 177 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1652 "pars0grm.cc"
break;
case 30:
-#line 198 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1731 "pars0grm.cc" /* yacc.c:1646 */
+#line 178 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1658 "pars0grm.cc"
break;
case 31:
-#line 199 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1737 "pars0grm.cc" /* yacc.c:1646 */
+#line 179 "pars0grm.y"
+ { yyval = yyvsp[0];}
+#line 1664 "pars0grm.cc"
break;
case 32:
-#line 200 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1743 "pars0grm.cc" /* yacc.c:1646 */
+#line 180 "pars0grm.y"
+ { yyval = pars_op('+', yyvsp[-2], yyvsp[0]); }
+#line 1670 "pars0grm.cc"
break;
case 33:
-#line 201 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1749 "pars0grm.cc" /* yacc.c:1646 */
+#line 181 "pars0grm.y"
+ { yyval = pars_op('-', yyvsp[-2], yyvsp[0]); }
+#line 1676 "pars0grm.cc"
break;
case 34:
-#line 202 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('+', (yyvsp[-2]), (yyvsp[0])); }
-#line 1755 "pars0grm.cc" /* yacc.c:1646 */
+#line 182 "pars0grm.y"
+ { yyval = pars_op('*', yyvsp[-2], yyvsp[0]); }
+#line 1682 "pars0grm.cc"
break;
case 35:
-#line 203 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('-', (yyvsp[-2]), (yyvsp[0])); }
-#line 1761 "pars0grm.cc" /* yacc.c:1646 */
+#line 183 "pars0grm.y"
+ { yyval = pars_op('/', yyvsp[-2], yyvsp[0]); }
+#line 1688 "pars0grm.cc"
break;
case 36:
-#line 204 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('*', (yyvsp[-2]), (yyvsp[0])); }
-#line 1767 "pars0grm.cc" /* yacc.c:1646 */
+#line 184 "pars0grm.y"
+ { yyval = pars_op('-', yyvsp[0], NULL); }
+#line 1694 "pars0grm.cc"
break;
case 37:
-#line 205 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('/', (yyvsp[-2]), (yyvsp[0])); }
-#line 1773 "pars0grm.cc" /* yacc.c:1646 */
+#line 185 "pars0grm.y"
+ { yyval = yyvsp[-1]; }
+#line 1700 "pars0grm.cc"
break;
case 38:
-#line 206 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('-', (yyvsp[0]), NULL); }
-#line 1779 "pars0grm.cc" /* yacc.c:1646 */
+#line 186 "pars0grm.y"
+ { yyval = pars_op('=', yyvsp[-2], yyvsp[0]); }
+#line 1706 "pars0grm.cc"
break;
case 39:
-#line 207 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 1785 "pars0grm.cc" /* yacc.c:1646 */
+#line 188 "pars0grm.y"
+ { yyval = pars_op(PARS_LIKE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1712 "pars0grm.cc"
break;
case 40:
-#line 208 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('=', (yyvsp[-2]), (yyvsp[0])); }
-#line 1791 "pars0grm.cc" /* yacc.c:1646 */
+#line 189 "pars0grm.y"
+ { yyval = pars_op('<', yyvsp[-2], yyvsp[0]); }
+#line 1718 "pars0grm.cc"
break;
case 41:
-#line 210 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1797 "pars0grm.cc" /* yacc.c:1646 */
+#line 190 "pars0grm.y"
+ { yyval = pars_op('>', yyvsp[-2], yyvsp[0]); }
+#line 1724 "pars0grm.cc"
break;
case 42:
-#line 211 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('<', (yyvsp[-2]), (yyvsp[0])); }
-#line 1803 "pars0grm.cc" /* yacc.c:1646 */
+#line 191 "pars0grm.y"
+ { yyval = pars_op(PARS_GE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1730 "pars0grm.cc"
break;
case 43:
-#line 212 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('>', (yyvsp[-2]), (yyvsp[0])); }
-#line 1809 "pars0grm.cc" /* yacc.c:1646 */
+#line 192 "pars0grm.y"
+ { yyval = pars_op(PARS_LE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1736 "pars0grm.cc"
break;
case 44:
-#line 213 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1815 "pars0grm.cc" /* yacc.c:1646 */
+#line 193 "pars0grm.y"
+ { yyval = pars_op(PARS_NE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1742 "pars0grm.cc"
break;
case 45:
-#line 214 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1821 "pars0grm.cc" /* yacc.c:1646 */
+#line 194 "pars0grm.y"
+ { yyval = pars_op(PARS_AND_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1748 "pars0grm.cc"
break;
case 46:
-#line 215 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1827 "pars0grm.cc" /* yacc.c:1646 */
+#line 195 "pars0grm.y"
+ { yyval = pars_op(PARS_OR_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1754 "pars0grm.cc"
break;
case 47:
-#line 216 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1833 "pars0grm.cc" /* yacc.c:1646 */
+#line 196 "pars0grm.y"
+ { yyval = pars_op(PARS_NOT_TOKEN, yyvsp[0], NULL); }
+#line 1760 "pars0grm.cc"
break;
case 48:
-#line 217 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1839 "pars0grm.cc" /* yacc.c:1646 */
+#line 198 "pars0grm.y"
+ { yyval = pars_op(PARS_NOTFOUND_TOKEN, yyvsp[-2], NULL); }
+#line 1766 "pars0grm.cc"
break;
case 49:
-#line 218 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[0]), NULL); }
-#line 1845 "pars0grm.cc" /* yacc.c:1646 */
+#line 200 "pars0grm.y"
+ { yyval = pars_op(PARS_NOTFOUND_TOKEN, yyvsp[-2], NULL); }
+#line 1772 "pars0grm.cc"
break;
case 50:
-#line 220 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1851 "pars0grm.cc" /* yacc.c:1646 */
+#line 204 "pars0grm.y"
+ { yyval = &pars_to_binary_token; }
+#line 1778 "pars0grm.cc"
break;
case 51:
-#line 222 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1857 "pars0grm.cc" /* yacc.c:1646 */
+#line 205 "pars0grm.y"
+ { yyval = &pars_substr_token; }
+#line 1784 "pars0grm.cc"
break;
case 52:
-#line 226 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_char_token; }
-#line 1863 "pars0grm.cc" /* yacc.c:1646 */
+#line 206 "pars0grm.y"
+ { yyval = &pars_concat_token; }
+#line 1790 "pars0grm.cc"
break;
case 53:
-#line 227 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_number_token; }
-#line 1869 "pars0grm.cc" /* yacc.c:1646 */
+#line 207 "pars0grm.y"
+ { yyval = &pars_instr_token; }
+#line 1796 "pars0grm.cc"
break;
case 54:
-#line 228 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_binary_token; }
-#line 1875 "pars0grm.cc" /* yacc.c:1646 */
+#line 208 "pars0grm.y"
+ { yyval = &pars_length_token; }
+#line 1802 "pars0grm.cc"
break;
- case 55:
-#line 230 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_binary_to_number_token; }
-#line 1881 "pars0grm.cc" /* yacc.c:1646 */
+ case 58:
+#line 219 "pars0grm.y"
+ { yyval = pars_stored_procedure_call(
+ static_cast<sym_node_t*>(yyvsp[-4])); }
+#line 1809 "pars0grm.cc"
break;
- case 56:
-#line 231 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_substr_token; }
-#line 1887 "pars0grm.cc" /* yacc.c:1646 */
+ case 59:
+#line 224 "pars0grm.y"
+ { yyval = yyvsp[-2]; }
+#line 1815 "pars0grm.cc"
break;
- case 57:
-#line 232 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_concat_token; }
-#line 1893 "pars0grm.cc" /* yacc.c:1646 */
+ case 60:
+#line 228 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1821 "pars0grm.cc"
break;
- case 58:
-#line 233 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_instr_token; }
-#line 1899 "pars0grm.cc" /* yacc.c:1646 */
+ case 61:
+#line 230 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1827 "pars0grm.cc"
break;
- case 59:
-#line 234 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_length_token; }
-#line 1905 "pars0grm.cc" /* yacc.c:1646 */
+ case 62:
+#line 234 "pars0grm.y"
+ { yyval = NULL; }
+#line 1833 "pars0grm.cc"
break;
- case 60:
-#line 235 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_sysdate_token; }
-#line 1911 "pars0grm.cc" /* yacc.c:1646 */
+ case 63:
+#line 235 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1839 "pars0grm.cc"
break;
- case 61:
-#line 236 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_rnd_token; }
-#line 1917 "pars0grm.cc" /* yacc.c:1646 */
+ case 64:
+#line 237 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1845 "pars0grm.cc"
break;
- case 62:
-#line 237 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_rnd_str_token; }
-#line 1923 "pars0grm.cc" /* yacc.c:1646 */
+ case 65:
+#line 241 "pars0grm.y"
+ { yyval = NULL; }
+#line 1851 "pars0grm.cc"
break;
case 66:
-#line 248 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_stored_procedure_call(
- static_cast<sym_node_t*>((yyvsp[-4]))); }
-#line 1930 "pars0grm.cc" /* yacc.c:1646 */
+#line 242 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]);}
+#line 1857 "pars0grm.cc"
break;
case 67:
-#line 254 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_procedure_call((yyvsp[-3]), (yyvsp[-1])); }
-#line 1936 "pars0grm.cc" /* yacc.c:1646 */
+#line 243 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1863 "pars0grm.cc"
break;
case 68:
-#line 258 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_replstr_token; }
-#line 1942 "pars0grm.cc" /* yacc.c:1646 */
+#line 247 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 1869 "pars0grm.cc"
break;
case 69:
-#line 259 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_printf_token; }
-#line 1948 "pars0grm.cc" /* yacc.c:1646 */
+#line 249 "pars0grm.y"
+ { yyval = pars_func(&pars_count_token,
+ que_node_list_add_last(NULL,
+ sym_tab_add_int_lit(
+ pars_sym_tab_global, 1))); }
+#line 1878 "pars0grm.cc"
break;
case 70:
-#line 260 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_assert_token; }
-#line 1954 "pars0grm.cc" /* yacc.c:1646 */
+#line 256 "pars0grm.y"
+ { yyval = NULL; }
+#line 1884 "pars0grm.cc"
break;
case 71:
-#line 264 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-2]); }
-#line 1960 "pars0grm.cc" /* yacc.c:1646 */
+#line 257 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1890 "pars0grm.cc"
break;
case 72:
-#line 268 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1966 "pars0grm.cc" /* yacc.c:1646 */
+#line 259 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1896 "pars0grm.cc"
break;
case 73:
-#line 270 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 1972 "pars0grm.cc" /* yacc.c:1646 */
+#line 263 "pars0grm.y"
+ { yyval = pars_select_list(&pars_star_denoter,
+ NULL); }
+#line 1903 "pars0grm.cc"
break;
case 74:
-#line 274 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 1978 "pars0grm.cc" /* yacc.c:1646 */
+#line 266 "pars0grm.y"
+ { yyval = pars_select_list(
+ yyvsp[-2], static_cast<sym_node_t*>(yyvsp[0])); }
+#line 1910 "pars0grm.cc"
break;
case 75:
-#line 275 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1984 "pars0grm.cc" /* yacc.c:1646 */
+#line 268 "pars0grm.y"
+ { yyval = pars_select_list(yyvsp[0], NULL); }
+#line 1916 "pars0grm.cc"
break;
case 76:
-#line 277 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 1990 "pars0grm.cc" /* yacc.c:1646 */
+#line 272 "pars0grm.y"
+ { yyval = NULL; }
+#line 1922 "pars0grm.cc"
break;
case 77:
-#line 281 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 1996 "pars0grm.cc" /* yacc.c:1646 */
+#line 273 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 1928 "pars0grm.cc"
break;
case 78:
-#line 282 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0]));}
-#line 2002 "pars0grm.cc" /* yacc.c:1646 */
+#line 277 "pars0grm.y"
+ { yyval = NULL; }
+#line 1934 "pars0grm.cc"
break;
case 79:
-#line 283 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2008 "pars0grm.cc" /* yacc.c:1646 */
+#line 279 "pars0grm.y"
+ { yyval = &pars_update_token; }
+#line 1940 "pars0grm.cc"
break;
case 80:
-#line 287 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2014 "pars0grm.cc" /* yacc.c:1646 */
+#line 283 "pars0grm.y"
+ { yyval = NULL; }
+#line 1946 "pars0grm.cc"
break;
case 81:
-#line 289 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_func(&pars_count_token,
- que_node_list_add_last(NULL,
- sym_tab_add_int_lit(
- pars_sym_tab_global, 1))); }
-#line 2023 "pars0grm.cc" /* yacc.c:1646 */
+#line 285 "pars0grm.y"
+ { yyval = &pars_share_token; }
+#line 1952 "pars0grm.cc"
break;
case 82:
-#line 294 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_func(&pars_count_token,
- que_node_list_add_last(NULL,
- pars_func(&pars_distinct_token,
- que_node_list_add_last(
- NULL, (yyvsp[-1]))))); }
-#line 2033 "pars0grm.cc" /* yacc.c:1646 */
+#line 289 "pars0grm.y"
+ { yyval = &pars_asc_token; }
+#line 1958 "pars0grm.cc"
break;
case 83:
-#line 300 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_func(&pars_sum_token,
- que_node_list_add_last(NULL,
- (yyvsp[-1]))); }
-#line 2041 "pars0grm.cc" /* yacc.c:1646 */
+#line 290 "pars0grm.y"
+ { yyval = &pars_asc_token; }
+#line 1964 "pars0grm.cc"
break;
case 84:
-#line 306 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2047 "pars0grm.cc" /* yacc.c:1646 */
+#line 291 "pars0grm.y"
+ { yyval = &pars_desc_token; }
+#line 1970 "pars0grm.cc"
break;
case 85:
-#line 307 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2053 "pars0grm.cc" /* yacc.c:1646 */
+#line 295 "pars0grm.y"
+ { yyval = NULL; }
+#line 1976 "pars0grm.cc"
break;
case 86:
-#line 309 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2059 "pars0grm.cc" /* yacc.c:1646 */
+#line 297 "pars0grm.y"
+ { yyval = pars_order_by(
+ static_cast<sym_node_t*>(yyvsp[-1]),
+ static_cast<pars_res_word_t*>(yyvsp[0])); }
+#line 1984 "pars0grm.cc"
break;
case 87:
-#line 313 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_select_list(&pars_star_denoter,
- NULL); }
-#line 2066 "pars0grm.cc" /* yacc.c:1646 */
+#line 308 "pars0grm.y"
+ { yyval = pars_select_statement(
+ static_cast<sel_node_t*>(yyvsp[-6]),
+ static_cast<sym_node_t*>(yyvsp[-4]),
+ static_cast<que_node_t*>(yyvsp[-3]),
+ static_cast<pars_res_word_t*>(yyvsp[-2]),
+ static_cast<pars_res_word_t*>(yyvsp[-1]),
+ static_cast<order_node_t*>(yyvsp[0])); }
+#line 1996 "pars0grm.cc"
break;
case 88:
-#line 316 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_select_list(
- (yyvsp[-2]), static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2073 "pars0grm.cc" /* yacc.c:1646 */
+#line 319 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2002 "pars0grm.cc"
break;
case 89:
-#line 318 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_select_list((yyvsp[0]), NULL); }
-#line 2079 "pars0grm.cc" /* yacc.c:1646 */
+#line 324 "pars0grm.y"
+ { yyval = pars_insert_statement(
+ static_cast<sym_node_t*>(yyvsp[-4]), yyvsp[-1], NULL); }
+#line 2009 "pars0grm.cc"
break;
case 90:
-#line 322 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2085 "pars0grm.cc" /* yacc.c:1646 */
+#line 327 "pars0grm.y"
+ { yyval = pars_insert_statement(
+ static_cast<sym_node_t*>(yyvsp[-1]),
+ NULL,
+ static_cast<sel_node_t*>(yyvsp[0])); }
+#line 2018 "pars0grm.cc"
break;
case 91:
-#line 323 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2091 "pars0grm.cc" /* yacc.c:1646 */
+#line 334 "pars0grm.y"
+ { yyval = pars_column_assignment(
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ static_cast<que_node_t*>(yyvsp[0])); }
+#line 2026 "pars0grm.cc"
break;
case 92:
-#line 327 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2097 "pars0grm.cc" /* yacc.c:1646 */
+#line 340 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2032 "pars0grm.cc"
break;
case 93:
-#line 329 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_update_token; }
-#line 2103 "pars0grm.cc" /* yacc.c:1646 */
+#line 342 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2038 "pars0grm.cc"
break;
case 94:
-#line 333 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2109 "pars0grm.cc" /* yacc.c:1646 */
+#line 348 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2044 "pars0grm.cc"
break;
case 95:
-#line 335 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_share_token; }
-#line 2115 "pars0grm.cc" /* yacc.c:1646 */
+#line 354 "pars0grm.y"
+ { yyval = pars_update_statement_start(
+ FALSE,
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ static_cast<col_assign_node_t*>(yyvsp[0])); }
+#line 2053 "pars0grm.cc"
break;
case 96:
-#line 339 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_asc_token; }
-#line 2121 "pars0grm.cc" /* yacc.c:1646 */
+#line 362 "pars0grm.y"
+ { yyval = pars_update_statement(
+ static_cast<upd_node_t*>(yyvsp[-1]),
+ NULL,
+ static_cast<que_node_t*>(yyvsp[0])); }
+#line 2062 "pars0grm.cc"
break;
case 97:
-#line 340 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_asc_token; }
-#line 2127 "pars0grm.cc" /* yacc.c:1646 */
+#line 370 "pars0grm.y"
+ { yyval = pars_update_statement(
+ static_cast<upd_node_t*>(yyvsp[-1]),
+ static_cast<sym_node_t*>(yyvsp[0]),
+ NULL); }
+#line 2071 "pars0grm.cc"
break;
case 98:
-#line 341 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_desc_token; }
-#line 2133 "pars0grm.cc" /* yacc.c:1646 */
+#line 378 "pars0grm.y"
+ { yyval = pars_update_statement_start(
+ TRUE,
+ static_cast<sym_node_t*>(yyvsp[0]), NULL); }
+#line 2079 "pars0grm.cc"
break;
case 99:
-#line 345 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2139 "pars0grm.cc" /* yacc.c:1646 */
+#line 385 "pars0grm.y"
+ { yyval = pars_update_statement(
+ static_cast<upd_node_t*>(yyvsp[-1]),
+ NULL,
+ static_cast<que_node_t*>(yyvsp[0])); }
+#line 2088 "pars0grm.cc"
break;
case 100:
-#line 347 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_order_by(
- static_cast<sym_node_t*>((yyvsp[-1])),
- static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2147 "pars0grm.cc" /* yacc.c:1646 */
+#line 393 "pars0grm.y"
+ { yyval = pars_update_statement(
+ static_cast<upd_node_t*>(yyvsp[-1]),
+ static_cast<sym_node_t*>(yyvsp[0]),
+ NULL); }
+#line 2097 "pars0grm.cc"
break;
case 101:
-#line 358 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_select_statement(
- static_cast<sel_node_t*>((yyvsp[-6])),
- static_cast<sym_node_t*>((yyvsp[-4])),
- static_cast<que_node_t*>((yyvsp[-3])),
- static_cast<pars_res_word_t*>((yyvsp[-2])),
- static_cast<pars_res_word_t*>((yyvsp[-1])),
- static_cast<order_node_t*>((yyvsp[0]))); }
-#line 2159 "pars0grm.cc" /* yacc.c:1646 */
+#line 401 "pars0grm.y"
+ { yyval = pars_assignment_statement(
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ static_cast<que_node_t*>(yyvsp[0])); }
+#line 2105 "pars0grm.cc"
break;
case 102:
-#line 369 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2165 "pars0grm.cc" /* yacc.c:1646 */
+#line 409 "pars0grm.y"
+ { yyval = pars_elsif_element(yyvsp[-2], yyvsp[0]); }
+#line 2111 "pars0grm.cc"
break;
case 103:
-#line 374 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_insert_statement(
- static_cast<sym_node_t*>((yyvsp[-4])), (yyvsp[-1]), NULL); }
-#line 2172 "pars0grm.cc" /* yacc.c:1646 */
+#line 413 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2117 "pars0grm.cc"
break;
case 104:
-#line 377 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_insert_statement(
- static_cast<sym_node_t*>((yyvsp[-1])),
- NULL,
- static_cast<sel_node_t*>((yyvsp[0]))); }
-#line 2181 "pars0grm.cc" /* yacc.c:1646 */
+#line 415 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-1], yyvsp[0]); }
+#line 2123 "pars0grm.cc"
break;
case 105:
-#line 384 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_column_assignment(
- static_cast<sym_node_t*>((yyvsp[-2])),
- static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2189 "pars0grm.cc" /* yacc.c:1646 */
+#line 419 "pars0grm.y"
+ { yyval = NULL; }
+#line 2129 "pars0grm.cc"
break;
case 106:
-#line 390 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2195 "pars0grm.cc" /* yacc.c:1646 */
+#line 421 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2135 "pars0grm.cc"
break;
case 107:
-#line 392 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2201 "pars0grm.cc" /* yacc.c:1646 */
+#line 422 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2141 "pars0grm.cc"
break;
case 108:
-#line 398 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2207 "pars0grm.cc" /* yacc.c:1646 */
+#line 429 "pars0grm.y"
+ { yyval = pars_if_statement(yyvsp[-5], yyvsp[-3], yyvsp[-2]); }
+#line 2147 "pars0grm.cc"
break;
case 109:
-#line 404 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement_start(
- FALSE,
- static_cast<sym_node_t*>((yyvsp[-2])),
- static_cast<col_assign_node_t*>((yyvsp[0]))); }
-#line 2216 "pars0grm.cc" /* yacc.c:1646 */
+#line 435 "pars0grm.y"
+ { yyval = pars_while_statement(yyvsp[-4], yyvsp[-2]); }
+#line 2153 "pars0grm.cc"
break;
case 110:
-#line 412 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement(
- static_cast<upd_node_t*>((yyvsp[-1])),
- NULL,
- static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2225 "pars0grm.cc" /* yacc.c:1646 */
+#line 443 "pars0grm.y"
+ { yyval = pars_for_statement(
+ static_cast<sym_node_t*>(yyvsp[-8]),
+ yyvsp[-6], yyvsp[-4], yyvsp[-2]); }
+#line 2161 "pars0grm.cc"
break;
case 111:
-#line 420 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement(
- static_cast<upd_node_t*>((yyvsp[-1])),
- static_cast<sym_node_t*>((yyvsp[0])),
- NULL); }
-#line 2234 "pars0grm.cc" /* yacc.c:1646 */
+#line 449 "pars0grm.y"
+ { yyval = pars_exit_statement(); }
+#line 2167 "pars0grm.cc"
break;
case 112:
-#line 428 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement_start(
- TRUE,
- static_cast<sym_node_t*>((yyvsp[0])), NULL); }
-#line 2242 "pars0grm.cc" /* yacc.c:1646 */
+#line 453 "pars0grm.y"
+ { yyval = pars_return_statement(); }
+#line 2173 "pars0grm.cc"
break;
case 113:
-#line 435 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement(
- static_cast<upd_node_t*>((yyvsp[-1])),
- NULL,
- static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2251 "pars0grm.cc" /* yacc.c:1646 */
+#line 458 "pars0grm.y"
+ { yyval = pars_open_statement(
+ ROW_SEL_OPEN_CURSOR,
+ static_cast<sym_node_t*>(yyvsp[0])); }
+#line 2181 "pars0grm.cc"
break;
case 114:
-#line 443 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_update_statement(
- static_cast<upd_node_t*>((yyvsp[-1])),
- static_cast<sym_node_t*>((yyvsp[0])),
- NULL); }
-#line 2260 "pars0grm.cc" /* yacc.c:1646 */
+#line 465 "pars0grm.y"
+ { yyval = pars_open_statement(
+ ROW_SEL_CLOSE_CURSOR,
+ static_cast<sym_node_t*>(yyvsp[0])); }
+#line 2189 "pars0grm.cc"
break;
case 115:
-#line 451 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_row_printf_statement(
- static_cast<sel_node_t*>((yyvsp[0]))); }
-#line 2267 "pars0grm.cc" /* yacc.c:1646 */
+#line 472 "pars0grm.y"
+ { yyval = pars_fetch_statement(
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ static_cast<sym_node_t*>(yyvsp[0]), NULL); }
+#line 2197 "pars0grm.cc"
break;
case 116:
-#line 457 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_assignment_statement(
- static_cast<sym_node_t*>((yyvsp[-2])),
- static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2275 "pars0grm.cc" /* yacc.c:1646 */
+#line 476 "pars0grm.y"
+ { yyval = pars_fetch_statement(
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ NULL,
+ static_cast<sym_node_t*>(yyvsp[0])); }
+#line 2206 "pars0grm.cc"
break;
case 117:
-#line 465 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_elsif_element((yyvsp[-2]), (yyvsp[0])); }
-#line 2281 "pars0grm.cc" /* yacc.c:1646 */
+#line 484 "pars0grm.y"
+ { yyval = pars_column_def(
+ static_cast<sym_node_t*>(yyvsp[-3]),
+ static_cast<pars_res_word_t*>(yyvsp[-2]),
+ static_cast<sym_node_t*>(yyvsp[-1]),
+ yyvsp[0]); }
+#line 2216 "pars0grm.cc"
break;
case 118:
-#line 469 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2287 "pars0grm.cc" /* yacc.c:1646 */
+#line 492 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2222 "pars0grm.cc"
break;
case 119:
-#line 471 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 2293 "pars0grm.cc" /* yacc.c:1646 */
+#line 494 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2228 "pars0grm.cc"
break;
case 120:
-#line 475 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2299 "pars0grm.cc" /* yacc.c:1646 */
+#line 498 "pars0grm.y"
+ { yyval = NULL; }
+#line 2234 "pars0grm.cc"
break;
case 121:
-#line 477 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2305 "pars0grm.cc" /* yacc.c:1646 */
+#line 500 "pars0grm.y"
+ { yyval = yyvsp[-1]; }
+#line 2240 "pars0grm.cc"
break;
case 122:
-#line 478 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2311 "pars0grm.cc" /* yacc.c:1646 */
+#line 504 "pars0grm.y"
+ { yyval = NULL; }
+#line 2246 "pars0grm.cc"
break;
case 123:
-#line 485 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_if_statement((yyvsp[-5]), (yyvsp[-3]), (yyvsp[-2])); }
-#line 2317 "pars0grm.cc" /* yacc.c:1646 */
+#line 506 "pars0grm.y"
+ { yyval = &pars_int_token;
+ /* pass any non-NULL pointer */ }
+#line 2253 "pars0grm.cc"
break;
case 124:
-#line 491 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_while_statement((yyvsp[-4]), (yyvsp[-2])); }
-#line 2323 "pars0grm.cc" /* yacc.c:1646 */
+#line 513 "pars0grm.y"
+ { yyval = pars_create_table(
+ static_cast<sym_node_t*>(yyvsp[-3]),
+ static_cast<sym_node_t*>(yyvsp[-1])); }
+#line 2261 "pars0grm.cc"
break;
case 125:
-#line 499 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_for_statement(
- static_cast<sym_node_t*>((yyvsp[-8])),
- (yyvsp[-6]), (yyvsp[-4]), (yyvsp[-2])); }
-#line 2331 "pars0grm.cc" /* yacc.c:1646 */
+#line 519 "pars0grm.y"
+ { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2267 "pars0grm.cc"
break;
case 126:
-#line 505 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_exit_statement(); }
-#line 2337 "pars0grm.cc" /* yacc.c:1646 */
+#line 521 "pars0grm.y"
+ { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2273 "pars0grm.cc"
break;
case 127:
-#line 509 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_return_statement(); }
-#line 2343 "pars0grm.cc" /* yacc.c:1646 */
+#line 525 "pars0grm.y"
+ { yyval = NULL; }
+#line 2279 "pars0grm.cc"
break;
case 128:
-#line 514 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_open_statement(
- ROW_SEL_OPEN_CURSOR,
- static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2351 "pars0grm.cc" /* yacc.c:1646 */
+#line 526 "pars0grm.y"
+ { yyval = &pars_unique_token; }
+#line 2285 "pars0grm.cc"
break;
case 129:
-#line 521 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_open_statement(
- ROW_SEL_CLOSE_CURSOR,
- static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2359 "pars0grm.cc" /* yacc.c:1646 */
+#line 530 "pars0grm.y"
+ { yyval = NULL; }
+#line 2291 "pars0grm.cc"
break;
case 130:
-#line 528 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_fetch_statement(
- static_cast<sym_node_t*>((yyvsp[-2])),
- static_cast<sym_node_t*>((yyvsp[0])), NULL); }
-#line 2367 "pars0grm.cc" /* yacc.c:1646 */
+#line 531 "pars0grm.y"
+ { yyval = &pars_clustered_token; }
+#line 2297 "pars0grm.cc"
break;
case 131:
-#line 532 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_fetch_statement(
- static_cast<sym_node_t*>((yyvsp[-2])),
- NULL,
- static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2376 "pars0grm.cc" /* yacc.c:1646 */
+#line 540 "pars0grm.y"
+ { yyval = pars_create_index(
+ static_cast<pars_res_word_t*>(yyvsp[-8]),
+ static_cast<pars_res_word_t*>(yyvsp[-7]),
+ static_cast<sym_node_t*>(yyvsp[-5]),
+ static_cast<sym_node_t*>(yyvsp[-3]),
+ static_cast<sym_node_t*>(yyvsp[-1])); }
+#line 2308 "pars0grm.cc"
break;
case 132:
-#line 540 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_column_def(
- static_cast<sym_node_t*>((yyvsp[-4])),
- static_cast<pars_res_word_t*>((yyvsp[-3])),
- static_cast<sym_node_t*>((yyvsp[-2])),
- (yyvsp[-1]), (yyvsp[0])); }
-#line 2386 "pars0grm.cc" /* yacc.c:1646 */
+#line 549 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2314 "pars0grm.cc"
break;
case 133:
-#line 548 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2392 "pars0grm.cc" /* yacc.c:1646 */
+#line 550 "pars0grm.y"
+ { yyval = yyvsp[0]; }
+#line 2320 "pars0grm.cc"
break;
case 134:
-#line 550 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2398 "pars0grm.cc" /* yacc.c:1646 */
+#line 555 "pars0grm.y"
+ { yyval = pars_commit_statement(); }
+#line 2326 "pars0grm.cc"
break;
case 135:
-#line 554 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2404 "pars0grm.cc" /* yacc.c:1646 */
+#line 560 "pars0grm.y"
+ { yyval = pars_rollback_statement(); }
+#line 2332 "pars0grm.cc"
break;
case 136:
-#line 556 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 2410 "pars0grm.cc" /* yacc.c:1646 */
+#line 564 "pars0grm.y"
+ { yyval = &pars_int_token; }
+#line 2338 "pars0grm.cc"
break;
case 137:
-#line 560 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2416 "pars0grm.cc" /* yacc.c:1646 */
+#line 565 "pars0grm.y"
+ { yyval = &pars_bigint_token; }
+#line 2344 "pars0grm.cc"
break;
case 138:
-#line 562 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_int_token;
- /* pass any non-NULL pointer */ }
-#line 2423 "pars0grm.cc" /* yacc.c:1646 */
+#line 566 "pars0grm.y"
+ { yyval = &pars_char_token; }
+#line 2350 "pars0grm.cc"
break;
case 139:
-#line 567 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2429 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 140:
-#line 569 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_int_token;
- /* pass any non-NULL pointer */ }
-#line 2436 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 141:
-#line 574 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2442 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 142:
-#line 575 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_int_token;
- /* pass any non-NULL pointer */ }
-#line 2449 "pars0grm.cc" /* yacc.c:1646 */
+#line 571 "pars0grm.y"
+ { yyval = pars_variable_declaration(
+ static_cast<sym_node_t*>(yyvsp[-2]),
+ static_cast<pars_res_word_t*>(yyvsp[-1])); }
+#line 2358 "pars0grm.cc"
break;
case 143:
-#line 580 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2455 "pars0grm.cc" /* yacc.c:1646 */
+#line 585 "pars0grm.y"
+ { yyval = pars_cursor_declaration(
+ static_cast<sym_node_t*>(yyvsp[-3]),
+ static_cast<sel_node_t*>(yyvsp[-1])); }
+#line 2366 "pars0grm.cc"
break;
case 144:
-#line 582 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2461 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 145:
-#line 589 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_create_table(
- static_cast<sym_node_t*>((yyvsp[-5])),
- static_cast<sym_node_t*>((yyvsp[-3])),
- static_cast<sym_node_t*>((yyvsp[-1])),
- static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2471 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 146:
-#line 597 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2477 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 147:
-#line 599 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2483 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 148:
-#line 603 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2489 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 149:
-#line 604 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_unique_token; }
-#line 2495 "pars0grm.cc" /* yacc.c:1646 */
+#line 592 "pars0grm.y"
+ { yyval = pars_function_declaration(
+ static_cast<sym_node_t*>(yyvsp[-1])); }
+#line 2373 "pars0grm.cc"
break;
case 150:
-#line 608 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2501 "pars0grm.cc" /* yacc.c:1646 */
+#line 614 "pars0grm.y"
+ { yyval = pars_procedure_definition(
+ static_cast<sym_node_t*>(yyvsp[-8]), yyvsp[-1]); }
+#line 2380 "pars0grm.cc"
break;
- case 151:
-#line 609 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_clustered_token; }
-#line 2507 "pars0grm.cc" /* yacc.c:1646 */
- break;
- case 152:
-#line 618 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_create_index(
- static_cast<pars_res_word_t*>((yyvsp[-8])),
- static_cast<pars_res_word_t*>((yyvsp[-7])),
- static_cast<sym_node_t*>((yyvsp[-5])),
- static_cast<sym_node_t*>((yyvsp[-3])),
- static_cast<sym_node_t*>((yyvsp[-1]))); }
-#line 2518 "pars0grm.cc" /* yacc.c:1646 */
- break;
+#line 2384 "pars0grm.cc"
- case 153:
-#line 627 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2524 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 154:
-#line 628 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2530 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 155:
-#line 633 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_commit_statement(); }
-#line 2536 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 156:
-#line 638 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_rollback_statement(); }
-#line 2542 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 157:
-#line 642 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_int_token; }
-#line 2548 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 158:
-#line 643 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_bigint_token; }
-#line 2554 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 159:
-#line 644 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_char_token; }
-#line 2560 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 160:
-#line 645 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_binary_token; }
-#line 2566 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 161:
-#line 646 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_blob_token; }
-#line 2572 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 162:
-#line 651 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_parameter_declaration(
- static_cast<sym_node_t*>((yyvsp[-2])),
- PARS_INPUT,
- static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2581 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 163:
-#line 656 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_parameter_declaration(
- static_cast<sym_node_t*>((yyvsp[-2])),
- PARS_OUTPUT,
- static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2590 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 164:
-#line 663 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2596 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 165:
-#line 664 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2602 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 166:
-#line 666 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2608 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 167:
-#line 671 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_variable_declaration(
- static_cast<sym_node_t*>((yyvsp[-2])),
- static_cast<pars_res_word_t*>((yyvsp[-1]))); }
-#line 2616 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 171:
-#line 685 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_cursor_declaration(
- static_cast<sym_node_t*>((yyvsp[-3])),
- static_cast<sel_node_t*>((yyvsp[-1]))); }
-#line 2624 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 172:
-#line 692 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_function_declaration(
- static_cast<sym_node_t*>((yyvsp[-1]))); }
-#line 2631 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 178:
-#line 714 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_procedure_definition(
- static_cast<sym_node_t*>((yyvsp[-9])),
- static_cast<sym_node_t*>((yyvsp[-7])),
- (yyvsp[-1])); }
-#line 2640 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
-
-#line 2644 "pars0grm.cc" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2665,14 +2406,13 @@ yyreduce:
/* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
@@ -2755,12 +2495,10 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
/* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
@@ -2822,6 +2560,7 @@ yyacceptlab:
yyresult = 0;
goto yyreturn;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
@@ -2829,6 +2568,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
+
#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
@@ -2839,6 +2579,10 @@ yyexhaustedlab:
/* Fall through. */
#endif
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
yyreturn:
if (yychar != YYEMPTY)
{
@@ -2868,5 +2612,5 @@ yyreturn:
#endif
return yyresult;
}
-#line 720 "pars0grm.y" /* yacc.c:1906 */
+#line 618 "pars0grm.y"
diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y
index 27638e06a66..625ed41bbd4 100644
--- a/storage/innobase/pars/pars0grm.y
+++ b/storage/innobase/pars/pars0grm.y
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 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
@@ -58,11 +58,7 @@ yylex(void);
%token PARS_NE_TOKEN
%token PARS_PROCEDURE_TOKEN
%token PARS_IN_TOKEN
-%token PARS_OUT_TOKEN
-%token PARS_BINARY_TOKEN
-%token PARS_BLOB_TOKEN
%token PARS_INT_TOKEN
-%token PARS_FLOAT_TOKEN
%token PARS_CHAR_TOKEN
%token PARS_IS_TOKEN
%token PARS_BEGIN_TOKEN
@@ -75,14 +71,11 @@ yylex(void);
%token PARS_WHILE_TOKEN
%token PARS_RETURN_TOKEN
%token PARS_SELECT_TOKEN
-%token PARS_SUM_TOKEN
%token PARS_COUNT_TOKEN
-%token PARS_DISTINCT_TOKEN
%token PARS_FROM_TOKEN
%token PARS_WHERE_TOKEN
%token PARS_FOR_TOKEN
%token PARS_DDOT_TOKEN
-%token PARS_READ_TOKEN
%token PARS_ORDER_TOKEN
%token PARS_BY_TOKEN
%token PARS_ASC_TOKEN
@@ -109,25 +102,14 @@ yylex(void);
%token PARS_FETCH_TOKEN
%token PARS_CLOSE_TOKEN
%token PARS_NOTFOUND_TOKEN
-%token PARS_TO_CHAR_TOKEN
-%token PARS_TO_NUMBER_TOKEN
%token PARS_TO_BINARY_TOKEN
-%token PARS_BINARY_TO_NUMBER_TOKEN
%token PARS_SUBSTR_TOKEN
-%token PARS_REPLSTR_TOKEN
%token PARS_CONCAT_TOKEN
%token PARS_INSTR_TOKEN
%token PARS_LENGTH_TOKEN
-%token PARS_SYSDATE_TOKEN
-%token PARS_PRINTF_TOKEN
-%token PARS_ASSERT_TOKEN
-%token PARS_RND_TOKEN
-%token PARS_RND_STR_TOKEN
-%token PARS_ROW_PRINTF_TOKEN
%token PARS_COMMIT_TOKEN
%token PARS_ROLLBACK_TOKEN
%token PARS_WORK_TOKEN
-%token PARS_UNSIGNED_TOKEN
%token PARS_EXIT_TOKEN
%token PARS_FUNCTION_TOKEN
%token PARS_LOCK_TOKEN
@@ -139,8 +121,6 @@ yylex(void);
%token PARS_LIKE_TOKEN_SUFFIX
%token PARS_LIKE_TOKEN_SUBSTR
%token PARS_TABLE_NAME_TOKEN
-%token PARS_COMPACT_TOKEN
-%token PARS_BLOCK_SIZE_TOKEN
%token PARS_BIGINT_TOKEN
%left PARS_AND_TOKEN PARS_OR_TOKEN
@@ -161,7 +141,6 @@ top_statement:
statement:
stored_procedure_call
- | predefined_procedure_call ';'
| while_statement ';'
| for_statement ';'
| exit_statement ';'
@@ -170,7 +149,6 @@ statement:
| assignment_statement ';'
| select_statement ';'
| insert_statement ';'
- | row_printf_statement ';'
| delete_statement_searched ';'
| delete_statement_positioned ';'
| update_statement_searched ';'
@@ -223,18 +201,11 @@ exp:
;
function_name:
- PARS_TO_CHAR_TOKEN { $$ = &pars_to_char_token; }
- | PARS_TO_NUMBER_TOKEN { $$ = &pars_to_number_token; }
- | PARS_TO_BINARY_TOKEN { $$ = &pars_to_binary_token; }
- | PARS_BINARY_TO_NUMBER_TOKEN
- { $$ = &pars_binary_to_number_token; }
+ PARS_TO_BINARY_TOKEN { $$ = &pars_to_binary_token; }
| PARS_SUBSTR_TOKEN { $$ = &pars_substr_token; }
| PARS_CONCAT_TOKEN { $$ = &pars_concat_token; }
| PARS_INSTR_TOKEN { $$ = &pars_instr_token; }
| PARS_LENGTH_TOKEN { $$ = &pars_length_token; }
- | PARS_SYSDATE_TOKEN { $$ = &pars_sysdate_token; }
- | PARS_RND_TOKEN { $$ = &pars_rnd_token; }
- | PARS_RND_STR_TOKEN { $$ = &pars_rnd_str_token; }
;
question_mark_list:
@@ -249,17 +220,6 @@ stored_procedure_call:
static_cast<sym_node_t*>($2)); }
;
-predefined_procedure_call:
- predefined_procedure_name '(' exp_list ')'
- { $$ = pars_procedure_call($1, $3); }
-;
-
-predefined_procedure_name:
- PARS_REPLSTR_TOKEN { $$ = &pars_replstr_token; }
- | PARS_PRINTF_TOKEN { $$ = &pars_printf_token; }
- | PARS_ASSERT_TOKEN { $$ = &pars_assert_token; }
-;
-
user_function_call:
PARS_ID_TOKEN '(' ')' { $$ = $1; }
;
@@ -287,19 +247,9 @@ select_item:
exp { $$ = $1; }
| PARS_COUNT_TOKEN '(' '*' ')'
{ $$ = pars_func(&pars_count_token,
- que_node_list_add_last(NULL,
+ que_node_list_add_last(NULL,
sym_tab_add_int_lit(
pars_sym_tab_global, 1))); }
- | PARS_COUNT_TOKEN '(' PARS_DISTINCT_TOKEN PARS_ID_TOKEN ')'
- { $$ = pars_func(&pars_count_token,
- que_node_list_add_last(NULL,
- pars_func(&pars_distinct_token,
- que_node_list_add_last(
- NULL, $4)))); }
- | PARS_SUM_TOKEN '(' exp ')'
- { $$ = pars_func(&pars_sum_token,
- que_node_list_add_last(NULL,
- $3)); }
;
select_item_list:
@@ -446,12 +396,6 @@ delete_statement_positioned:
NULL); }
;
-row_printf_statement:
- PARS_ROW_PRINTF_TOKEN select_statement
- { $$ = pars_row_printf_statement(
- static_cast<sel_node_t*>($2)); }
-;
-
assignment_statement:
PARS_ID_TOKEN PARS_ASSIGN_TOKEN exp
{ $$ = pars_assignment_statement(
@@ -536,12 +480,12 @@ fetch_statement:
;
column_def:
- PARS_ID_TOKEN type_name opt_column_len opt_unsigned opt_not_null
+ PARS_ID_TOKEN type_name opt_column_len opt_not_null
{ $$ = pars_column_def(
static_cast<sym_node_t*>($1),
static_cast<pars_res_word_t*>($2),
static_cast<sym_node_t*>($3),
- $4, $5); }
+ $4); }
;
column_def_list:
@@ -556,13 +500,6 @@ opt_column_len:
{ $$ = $2; }
;
-opt_unsigned:
- /* Nothing */ { $$ = NULL; }
- | PARS_UNSIGNED_TOKEN
- { $$ = &pars_int_token;
- /* pass any non-NULL pointer */ }
-;
-
opt_not_null:
/* Nothing */ { $$ = NULL; }
| PARS_NOT_TOKEN PARS_NULL_LIT
@@ -570,27 +507,12 @@ opt_not_null:
/* pass any non-NULL pointer */ }
;
-compact:
- /* Nothing */ { $$ = NULL; }
- | PARS_COMPACT_TOKEN { $$ = &pars_int_token;
- /* pass any non-NULL pointer */ }
-;
-
-block_size:
- /* Nothing */ { $$ = NULL; }
- | PARS_BLOCK_SIZE_TOKEN '=' PARS_INT_LIT
- { $$ = $3; }
-;
-
create_table:
PARS_CREATE_TOKEN PARS_TABLE_TOKEN
table_name '(' column_def_list ')'
- compact block_size
{ $$ = pars_create_table(
static_cast<sym_node_t*>($3),
- static_cast<sym_node_t*>($5),
- static_cast<sym_node_t*>($7),
- static_cast<sym_node_t*>($8)); }
+ static_cast<sym_node_t*>($5)); }
;
column_list:
@@ -642,28 +564,6 @@ type_name:
PARS_INT_TOKEN { $$ = &pars_int_token; }
| PARS_BIGINT_TOKEN { $$ = &pars_bigint_token; }
| PARS_CHAR_TOKEN { $$ = &pars_char_token; }
- | PARS_BINARY_TOKEN { $$ = &pars_binary_token; }
- | PARS_BLOB_TOKEN { $$ = &pars_blob_token; }
-;
-
-parameter_declaration:
- PARS_ID_TOKEN PARS_IN_TOKEN type_name
- { $$ = pars_parameter_declaration(
- static_cast<sym_node_t*>($1),
- PARS_INPUT,
- static_cast<pars_res_word_t*>($3)); }
- | PARS_ID_TOKEN PARS_OUT_TOKEN type_name
- { $$ = pars_parameter_declaration(
- static_cast<sym_node_t*>($1),
- PARS_OUTPUT,
- static_cast<pars_res_word_t*>($3)); }
-;
-
-parameter_declaration_list:
- /* Nothing */ { $$ = NULL; }
- | parameter_declaration { $$ = que_node_list_add_last(NULL, $1); }
- | parameter_declaration_list ',' parameter_declaration
- { $$ = que_node_list_add_last($1, $3); }
;
variable_declaration:
@@ -705,16 +605,14 @@ declaration_list:
;
procedure_definition:
- PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' parameter_declaration_list ')'
+ PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' ')'
PARS_IS_TOKEN
variable_declaration_list
declaration_list
PARS_BEGIN_TOKEN
statement_list
PARS_END_TOKEN { $$ = pars_procedure_definition(
- static_cast<sym_node_t*>($2),
- static_cast<sym_node_t*>($4),
- $10); }
+ static_cast<sym_node_t*>($2), $9); }
;
%%
diff --git a/storage/innobase/pars/pars0lex.l b/storage/innobase/pars/pars0lex.l
index 2d0e56f400d..8b2df6b7940 100644
--- a/storage/innobase/pars/pars0lex.l
+++ b/storage/innobase/pars/pars0lex.l
@@ -249,30 +249,10 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_IN_TOKEN);
}
-"OUT" {
- return(PARS_OUT_TOKEN);
-}
-
-"BINARY" {
- return(PARS_BINARY_TOKEN);
-}
-
-"BLOB" {
- return(PARS_BLOB_TOKEN);
-}
-
"INT" {
return(PARS_INT_TOKEN);
}
-"INTEGER" {
- return(PARS_INT_TOKEN);
-}
-
-"FLOAT" {
- return(PARS_FLOAT_TOKEN);
-}
-
"CHAR" {
return(PARS_CHAR_TOKEN);
}
@@ -321,18 +301,10 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_SELECT_TOKEN);
}
-"SUM" {
- return(PARS_SUM_TOKEN);
-}
-
"COUNT" {
return(PARS_COUNT_TOKEN);
}
-"DISTINCT" {
- return(PARS_DISTINCT_TOKEN);
-}
-
"FROM" {
return(PARS_FROM_TOKEN);
}
@@ -345,10 +317,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FOR_TOKEN);
}
-"READ" {
- return(PARS_READ_TOKEN);
-}
-
"ORDER" {
return(PARS_ORDER_TOKEN);
}
@@ -405,14 +373,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_TABLE_TOKEN);
}
-"COMPACT" {
- return(PARS_COMPACT_TOKEN);
-}
-
-"BLOCK_SIZE" {
- return(PARS_BLOCK_SIZE_TOKEN);
-}
-
"INDEX" {
return(PARS_INDEX_TOKEN);
}
@@ -453,30 +413,14 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_NOTFOUND_TOKEN);
}
-"TO_CHAR" {
- return(PARS_TO_CHAR_TOKEN);
-}
-
-"TO_NUMBER" {
- return(PARS_TO_NUMBER_TOKEN);
-}
-
"TO_BINARY" {
return(PARS_TO_BINARY_TOKEN);
}
-"BINARY_TO_NUMBER" {
- return(PARS_BINARY_TO_NUMBER_TOKEN);
-}
-
"SUBSTR" {
return(PARS_SUBSTR_TOKEN);
}
-"REPLSTR" {
- return(PARS_REPLSTR_TOKEN);
-}
-
"CONCAT" {
return(PARS_CONCAT_TOKEN);
}
@@ -489,30 +433,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_LENGTH_TOKEN);
}
-"SYSDATE" {
- return(PARS_SYSDATE_TOKEN);
-}
-
-"PRINTF" {
- return(PARS_PRINTF_TOKEN);
-}
-
-"ASSERT" {
- return(PARS_ASSERT_TOKEN);
-}
-
-"RND" {
- return(PARS_RND_TOKEN);
-}
-
-"RND_STR" {
- return(PARS_RND_STR_TOKEN);
-}
-
-"ROW_PRINTF" {
- return(PARS_ROW_PRINTF_TOKEN);
-}
-
"COMMIT" {
return(PARS_COMMIT_TOKEN);
}
@@ -525,10 +445,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_WORK_TOKEN);
}
-"UNSIGNED" {
- return(PARS_UNSIGNED_TOKEN);
-}
-
"EXIT" {
return(PARS_EXIT_TOKEN);
}
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index 3f671adfdfc..280c4ee1815 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -50,29 +50,15 @@ sym_tab_t* pars_sym_tab_global;
/* Global variables used to denote certain reserved words, used in
constructing the parsing tree */
-pars_res_word_t pars_to_char_token = {PARS_TO_CHAR_TOKEN};
-pars_res_word_t pars_to_number_token = {PARS_TO_NUMBER_TOKEN};
pars_res_word_t pars_to_binary_token = {PARS_TO_BINARY_TOKEN};
-pars_res_word_t pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN};
pars_res_word_t pars_substr_token = {PARS_SUBSTR_TOKEN};
-pars_res_word_t pars_replstr_token = {PARS_REPLSTR_TOKEN};
pars_res_word_t pars_concat_token = {PARS_CONCAT_TOKEN};
pars_res_word_t pars_instr_token = {PARS_INSTR_TOKEN};
pars_res_word_t pars_length_token = {PARS_LENGTH_TOKEN};
-pars_res_word_t pars_sysdate_token = {PARS_SYSDATE_TOKEN};
-pars_res_word_t pars_printf_token = {PARS_PRINTF_TOKEN};
-pars_res_word_t pars_assert_token = {PARS_ASSERT_TOKEN};
-pars_res_word_t pars_rnd_token = {PARS_RND_TOKEN};
-pars_res_word_t pars_rnd_str_token = {PARS_RND_STR_TOKEN};
pars_res_word_t pars_count_token = {PARS_COUNT_TOKEN};
-pars_res_word_t pars_sum_token = {PARS_SUM_TOKEN};
-pars_res_word_t pars_distinct_token = {PARS_DISTINCT_TOKEN};
-pars_res_word_t pars_binary_token = {PARS_BINARY_TOKEN};
-pars_res_word_t pars_blob_token = {PARS_BLOB_TOKEN};
pars_res_word_t pars_int_token = {PARS_INT_TOKEN};
pars_res_word_t pars_bigint_token = {PARS_BIGINT_TOKEN};
pars_res_word_t pars_char_token = {PARS_CHAR_TOKEN};
-pars_res_word_t pars_float_token = {PARS_FLOAT_TOKEN};
pars_res_word_t pars_update_token = {PARS_UPDATE_TOKEN};
pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN};
pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN};
@@ -195,24 +181,15 @@ pars_func_get_class(
case PARS_AND_TOKEN: case PARS_OR_TOKEN: case PARS_NOT_TOKEN:
return(PARS_FUNC_LOGICAL);
- case PARS_COUNT_TOKEN: case PARS_SUM_TOKEN:
+ case PARS_COUNT_TOKEN:
return(PARS_FUNC_AGGREGATE);
- case PARS_TO_CHAR_TOKEN:
- case PARS_TO_NUMBER_TOKEN:
case PARS_TO_BINARY_TOKEN:
- case PARS_BINARY_TO_NUMBER_TOKEN:
case PARS_SUBSTR_TOKEN:
case PARS_CONCAT_TOKEN:
case PARS_LENGTH_TOKEN:
case PARS_INSTR_TOKEN:
- case PARS_SYSDATE_TOKEN:
case PARS_NOTFOUND_TOKEN:
- case PARS_PRINTF_TOKEN:
- case PARS_ASSERT_TOKEN:
- case PARS_RND_TOKEN:
- case PARS_RND_STR_TOKEN:
- case PARS_REPLSTR_TOKEN:
return(PARS_FUNC_PREDEFINED);
default:
@@ -499,7 +476,6 @@ pars_resolve_func_data_type(
arg = node->args;
switch (node->func) {
- case PARS_SUM_TOKEN:
case '+': case '-': case '*': case '/':
/* Inherit the data type from the first argument (which must
not be the SQL null literal whose type is DATA_ERROR) */
@@ -516,13 +492,6 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
break;
- case PARS_TO_CHAR_TOKEN:
- case PARS_RND_STR_TOKEN:
- ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
- dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
- DATA_ENGLISH, 0);
- break;
-
case PARS_TO_BINARY_TOKEN:
if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
@@ -533,19 +502,12 @@ pars_resolve_func_data_type(
}
break;
- case PARS_TO_NUMBER_TOKEN:
- case PARS_BINARY_TO_NUMBER_TOKEN:
case PARS_LENGTH_TOKEN:
case PARS_INSTR_TOKEN:
ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
break;
- case PARS_SYSDATE_TOKEN:
- ut_a(arg == NULL);
- dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
- break;
-
case PARS_SUBSTR_TOKEN:
case PARS_CONCAT_TOKEN:
ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
@@ -566,11 +528,6 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
break;
- case PARS_RND_TOKEN:
- ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
- dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
- break;
-
case PARS_LIKE_TOKEN_EXACT:
case PARS_LIKE_TOKEN_PREFIX:
case PARS_LIKE_TOKEN_SUFFIX:
@@ -1355,9 +1312,7 @@ pars_set_dfield_type(
pars_res_word_t* type, /*!< in: pointer to a type
token */
ulint len, /*!< in: length, or 0 */
- ibool is_unsigned, /*!< in: if TRUE, column is
- UNSIGNED. */
- ibool is_not_null) /*!< in: if TRUE, column is
+ bool is_not_null) /*!< in: whether the column is
NOT NULL. */
{
ulint flags = 0;
@@ -1366,10 +1321,6 @@ pars_set_dfield_type(
flags |= DATA_NOT_NULL;
}
- if (is_unsigned) {
- flags |= DATA_UNSIGNED;
- }
-
if (type == &pars_bigint_token) {
ut_a(len == 0);
@@ -1384,16 +1335,6 @@ pars_set_dfield_type(
dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
DATA_ENGLISH | flags, len);
- } else if (type == &pars_binary_token) {
- ut_a(len != 0);
-
- dtype_set(dfield_get_type(dfield), DATA_FIXBINARY,
- DATA_BINARY_TYPE | flags, len);
- } else if (type == &pars_blob_token) {
- ut_a(len == 0);
-
- dtype_set(dfield_get_type(dfield), DATA_BLOB,
- DATA_BINARY_TYPE | flags, 0);
} else {
ut_error;
}
@@ -1414,28 +1355,7 @@ pars_variable_declaration(
node->param_type = PARS_NOT_PARAM;
- pars_set_dfield_type(que_node_get_val(node), type, 0, FALSE, FALSE);
-
- return(node);
-}
-
-/*********************************************************************//**
-Parses a procedure parameter declaration.
-@return own: symbol table node of type SYM_VAR */
-sym_node_t*
-pars_parameter_declaration(
-/*=======================*/
- sym_node_t* node, /*!< in: symbol table node allocated for the
- id of the parameter */
- ulint param_type,
- /*!< in: PARS_INPUT or PARS_OUTPUT */
- pars_res_word_t* type) /*!< in: pointer to a type token */
-{
- ut_a((param_type == PARS_INPUT) || (param_type == PARS_OUTPUT));
-
- pars_variable_declaration(node, type);
-
- node->param_type = param_type;
+ pars_set_dfield_type(que_node_get_val(node), type, 0, false);
return(node);
}
@@ -1821,8 +1741,6 @@ pars_column_def(
pars_res_word_t* type, /*!< in: data type */
sym_node_t* len, /*!< in: length of column, or
NULL */
- void* is_unsigned, /*!< in: if not NULL, column
- is of type UNSIGNED. */
void* is_not_null) /*!< in: if not NULL, column
is of type NOT NULL. */
{
@@ -1835,7 +1753,7 @@ pars_column_def(
}
pars_set_dfield_type(que_node_get_val(sym_node), type, len2,
- is_unsigned != NULL, is_not_null != NULL);
+ is_not_null != NULL);
return(sym_node);
}
@@ -1848,9 +1766,7 @@ pars_create_table(
/*==============*/
sym_node_t* table_sym, /*!< in: table name node in the symbol
table */
- sym_node_t* column_defs, /*!< in: list of column names */
- sym_node_t* compact, /* in: non-NULL if COMPACT table. */
- sym_node_t* block_size) /* in: block size (can be NULL) */
+ sym_node_t* column_defs) /*!< in: list of column names */
{
dict_table_t* table;
sym_node_t* column;
@@ -1858,57 +1774,11 @@ pars_create_table(
const dtype_t* dtype;
ulint n_cols;
ulint flags = 0;
- ulint flags2 = 0;
-
- if (compact != NULL) {
-
- /* System tables currently only use the REDUNDANT row
- format therefore the check for srv_file_per_table should be
- safe for now. */
-
- flags |= DICT_TF_COMPACT;
-
- /* FIXME: Ideally this should be part of the SQL syntax
- or use some other mechanism. We want to reduce dependency
- on global variables. There is an inherent race here but
- that has always existed around this variable. */
- if (srv_file_per_table) {
- flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
- }
- }
-
- if (block_size != NULL) {
- ulint size;
- dfield_t* dfield;
+ ulint flags2 = DICT_TF2_FTS_AUX_HEX_NAME;
- dfield = que_node_get_val(block_size);
-
- ut_a(dfield_get_len(dfield) == 4);
- size = mach_read_from_4(static_cast<byte*>(
- dfield_get_data(dfield)));
-
-
- switch (size) {
- case 0:
- break;
-
- case 1: case 2: case 4: case 8: case 16:
- flags |= DICT_TF_COMPACT;
- /* FTS-FIXME: needs the zip changes */
- /* flags |= size << DICT_TF_COMPRESSED_SHIFT; */
- break;
-
- default:
- ut_error;
- }
- }
-
- /* Set the flags2 when create table or alter tables */
- flags2 |= DICT_TF2_FTS_AUX_HEX_NAME;
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
flags2 &= ~DICT_TF2_FTS_AUX_HEX_NAME;);
-
n_cols = que_node_list_get_len(column_defs);
table = dict_mem_table_create(
@@ -2001,7 +1871,6 @@ pars_procedure_definition(
/*======================*/
sym_node_t* sym_node, /*!< in: procedure id node in the symbol
table */
- sym_node_t* param_list, /*!< in: parameter declaration list */
que_node_t* stat_list) /*!< in: statement list */
{
proc_node_t* node;
@@ -2026,7 +1895,6 @@ pars_procedure_definition(
sym_node->resolved = TRUE;
node->proc_id = sym_node;
- node->param_list = param_list;
node->stat_list = stat_list;
pars_set_parent_in_list(stat_list, node);
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index 1d3d1573299..3ad948af4d2 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2018, 2020 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
@@ -460,6 +460,8 @@ que_graph_free_recursive(
que_graph_free_recursive(ins->select);
ins->select = NULL;
+ ins->~ins_node_t();
+
if (ins->entry_sys_heap != NULL) {
mem_heap_free(ins->entry_sys_heap);
ins->entry_sys_heap = NULL;
diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc
index 9449274321e..ed44e91711c 100644
--- a/storage/innobase/rem/rem0cmp.cc
+++ b/storage/innobase/rem/rem0cmp.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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,6 +26,7 @@ Created 7/1/1994 Heikki Tuuri
#include "rem0cmp.h"
#include "rem0rec.h"
+#include "page0page.h"
#include "dict0mem.h"
#include "handler0alter.h"
@@ -534,7 +536,7 @@ cmp_data(
/** Compare a GIS data tuple to a physical record.
@param[in] dtuple data tuple
-@param[in] rec B-tree record
+@param[in] rec R-tree record
@param[in] offsets rec_get_offsets(rec)
@param[in] mode compare mode
@retval negative if dtuple is less than rec */
@@ -546,7 +548,7 @@ cmp_dtuple_rec_with_gis(
dtuple in some of the common fields, or which
has an equal number or more fields than
dtuple */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
page_cur_mode_t mode) /*!< in: compare mode */
{
const dfield_t* dtuple_field; /* current field in logical record */
@@ -579,7 +581,7 @@ int
cmp_dtuple_rec_with_gis_internal(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
const dfield_t* dtuple_field; /* current field in logical record */
ulint dtuple_f_len; /* the length of the current field
@@ -650,7 +652,7 @@ int
cmp_dtuple_rec_with_match_low(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint n_cmp,
ulint* matched_fields)
{
@@ -779,7 +781,7 @@ cmp_dtuple_rec_with_match_bytes(
const dtuple_t* dtuple,
const rec_t* rec,
const dict_index_t* index,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint* matched_fields,
ulint* matched_bytes)
{
@@ -942,7 +944,7 @@ int
cmp_dtuple_rec(
const dtuple_t* dtuple,
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
ulint matched_fields = 0;
@@ -960,7 +962,7 @@ cmp_dtuple_is_prefix_of_rec(
/*========================*/
const dtuple_t* dtuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint n_fields;
ulint matched_fields = 0;
@@ -988,8 +990,8 @@ cmp_rec_rec_simple_field(
/*=====================*/
const rec_t* rec1, /*!< in: physical record */
const rec_t* rec2, /*!< in: physical record */
- const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
- const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+ const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+ const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const dict_index_t* index, /*!< in: data dictionary index */
ulint n) /*!< in: field to compare */
{
@@ -1019,8 +1021,8 @@ cmp_rec_rec_simple(
/*===============*/
const rec_t* rec1, /*!< in: physical record */
const rec_t* rec2, /*!< in: physical record */
- const ulint* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
- const ulint* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+ const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+ const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const dict_index_t* index, /*!< in: data dictionary index */
struct TABLE* table) /*!< in: MySQL table, for reporting
duplicate key value if applicable,
@@ -1086,42 +1088,40 @@ cmp_rec_rec_simple(
return(0);
}
-/** Compare two B-tree records.
-@param[in] rec1 B-tree record
-@param[in] rec2 B-tree record
-@param[in] offsets1 rec_get_offsets(rec1, index)
-@param[in] offsets2 rec_get_offsets(rec2, index)
-@param[in] index B-tree index
-@param[in] nulls_unequal true if this is for index cardinality
-statistics estimation, and innodb_stats_method=nulls_unequal
-or innodb_stats_method=nulls_ignored
-@param[out] matched_fields number of completely matched fields
-within the first field not completely matched
-@return the comparison result
+/** Compare two B-tree or R-tree records.
+Only the common first fields are compared, and externally stored field
+are treated as equal.
+@param[in] rec1 record (possibly not on an index page)
+@param[in] rec2 B-tree or R-tree record in an index page
+@param[in] offsets1 rec_get_offsets(rec1, index)
+@param[in] offsets2 rec_get_offsets(rec2, index)
+@param[in] nulls_unequal true if this is for index cardinality
+ statistics estimation with
+ innodb_stats_method=nulls_unequal
+ or innodb_stats_method=nulls_ignored
+@param[out] matched_fields number of completely matched fields
+ within the first field not completely matched
@retval 0 if rec1 is equal to rec2
@retval negative if rec1 is less than rec2
-@retval positive if rec2 is greater than rec2 */
+@retval positive if rec1 is greater than rec2 */
int
-cmp_rec_rec_with_match(
+cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
- const ulint* offsets1,
- const ulint* offsets2,
+ const rec_offs* offsets1,
+ const rec_offs* offsets2,
const dict_index_t* index,
bool nulls_unequal,
ulint* matched_fields)
{
- ulint rec1_n_fields; /* the number of fields in rec */
ulint rec1_f_len; /* length of current field in rec */
const byte* rec1_b_ptr; /* pointer to the current byte
in rec field */
- ulint rec2_n_fields; /* the number of fields in rec */
ulint rec2_f_len; /* length of current field in rec */
const byte* rec2_b_ptr; /* pointer to the current byte
in rec field */
ulint cur_field = 0; /* current field number */
int ret = 0; /* return value */
- ulint comp;
ut_ad(rec1 != NULL);
ut_ad(rec2 != NULL);
@@ -1129,10 +1129,12 @@ cmp_rec_rec_with_match(
ut_ad(rec_offs_validate(rec1, index, offsets1));
ut_ad(rec_offs_validate(rec2, index, offsets2));
ut_ad(rec_offs_comp(offsets1) == rec_offs_comp(offsets2));
+ ut_ad(fil_page_index_page_check(page_align(rec2)));
+ ut_ad(!!dict_index_is_spatial(index)
+ == (fil_page_get_type(page_align(rec2)) == FIL_PAGE_RTREE));
- comp = rec_offs_comp(offsets1);
- rec1_n_fields = rec_offs_n_fields(offsets1);
- rec2_n_fields = rec_offs_n_fields(offsets2);
+ ulint comp = rec_offs_comp(offsets1);
+ ulint n_fields;
/* Test if rec is the predefined minimum record */
if (UNIV_UNLIKELY(rec_get_info_bits(rec1, comp)
@@ -1149,37 +1151,41 @@ cmp_rec_rec_with_match(
goto order_resolved;
}
- /* Match fields in a loop */
+ /* For non-leaf spatial index records, the
+ dict_index_get_n_unique_in_tree() does include the child page
+ number, because spatial index node pointers only contain
+ the MBR (minimum bounding rectangle) and the child page number.
- for (; cur_field < rec1_n_fields && cur_field < rec2_n_fields;
- cur_field++) {
+ For B-tree node pointers, the key alone (secondary index
+ columns and PRIMARY KEY columns) must be unique, and there is
+ no need to compare the child page number. */
+ n_fields = std::min(rec_offs_n_fields(offsets1),
+ rec_offs_n_fields(offsets2));
+ n_fields = std::min(n_fields, dict_index_get_n_unique_in_tree(index));
+ for (; cur_field < n_fields; cur_field++) {
ulint mtype;
ulint prtype;
- /* If this is node-ptr records then avoid comparing node-ptr
- field. Only key field needs to be compared. */
- if (cur_field == dict_index_get_n_unique_in_tree(index)) {
- break;
- }
-
- if (dict_index_is_ibuf(index)) {
+ if (UNIV_UNLIKELY(dict_index_is_ibuf(index))) {
/* This is for the insert buffer B-tree. */
mtype = DATA_BINARY;
prtype = 0;
} else {
- const dict_col_t* col;
-
- col = dict_index_get_nth_col(index, cur_field);
-
+ const dict_col_t* col = dict_index_get_nth_col(
+ index, cur_field);
mtype = col->mtype;
prtype = col->prtype;
- /* If the index is spatial index, we mark the
- prtype of the first field as MBR field. */
- if (cur_field == 0 && dict_index_is_spatial(index)) {
+ if (UNIV_LIKELY(!dict_index_is_spatial(index))) {
+ } else if (cur_field == 0) {
ut_ad(DATA_GEOMETRY_MTYPE(mtype));
prtype |= DATA_GIS_MBR;
+ } else if (!page_rec_is_leaf(rec2)) {
+ /* Compare the child page number. */
+ ut_ad(cur_field == 1);
+ mtype = DATA_SYS_CHILD;
+ prtype = 0;
}
}
@@ -1215,8 +1221,10 @@ cmp_rec_rec_with_match(
to the common fields */
ut_ad(ret == 0);
order_resolved:
- *matched_fields = cur_field;
- return(ret);
+ if (matched_fields) {
+ *matched_fields = cur_field;
+ }
+ return ret;
}
#ifdef UNIV_COMPILE_TEST_FUNCS
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index b0fb4e0f113..962de60f555 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -242,12 +242,12 @@ rec_init_offsets_comp_ordinary(
format for temporary files in
index creation */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in/out: array of offsets;
+ rec_offs* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
{
ulint i = 0;
- ulint offs = 0;
- ulint any_ext = 0;
+ rec_offs offs = 0;
+ rec_offs any_ext = 0;
ulint n_null = index->n_nullable;
const byte* nulls = temp
? rec - 1
@@ -259,8 +259,8 @@ rec_init_offsets_comp_ordinary(
/* We cannot invoke rec_offs_make_valid() here if temp=true.
Similarly, rec_offs_validate() will fail in that case, because
it invokes rec_get_status(). */
- offsets[2] = (ulint) rec;
- offsets[3] = (ulint) index;
+ memcpy(&offsets[RECORD_OFFSET], &rec, sizeof(rec));
+ memcpy(&offsets[INDEX_OFFSET], &index, sizeof(index));
#endif /* UNIV_DEBUG */
ut_ad(temp || dict_table_is_comp(index->table));
@@ -277,7 +277,7 @@ rec_init_offsets_comp_ordinary(
= dict_index_get_nth_field(index, i);
const dict_col_t* col
= dict_field_get_col(field);
- ulint len;
+ rec_offs len;
if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
@@ -294,7 +294,7 @@ rec_init_offsets_comp_ordinary(
We do not advance offs, and we set
the length to zero and enable the
SQL NULL flag in offsets[]. */
- len = offs | REC_OFFS_SQL_NULL;
+ len = combine(offs, SQL_NULL);
goto resolved;
}
null_mask <<= 1;
@@ -317,14 +317,14 @@ rec_init_offsets_comp_ordinary(
len <<= 8;
len |= *lens--;
- offs += len & 0x3fff;
+ offs += get_value(len);
if (UNIV_UNLIKELY(len
& 0x4000)) {
ut_ad(dict_index_is_clust
(index));
any_ext = REC_OFFS_EXTERNAL;
- len = offs
- | REC_OFFS_EXTERNAL;
+ len = combine(offs,
+ STORED_OFFPAGE);
} else {
len = offs;
}
@@ -341,8 +341,8 @@ resolved:
rec_offs_base(offsets)[i + 1] = len;
} while (++i < rec_offs_n_fields(offsets));
- *rec_offs_base(offsets)
- = (rec - (lens + 1)) | REC_OFFS_COMPACT | any_ext;
+ *rec_offs_base(offsets) = static_cast<rec_offs>(rec - (lens + 1))
+ | REC_OFFS_COMPACT | any_ext;
}
/******************************************************//**
@@ -355,21 +355,20 @@ to the extra size (if REC_OFFS_COMPACT is set, the record is in the
new format; if REC_OFFS_EXTERNAL is set, the record contains externally
stored columns), and rec_offs_base(offsets)[1..n_fields] will be set to
offsets past the end of fields 0..n_fields, or to the beginning of
-fields 1..n_fields+1. When the high-order bit of the offset at [i+1]
-is set (REC_OFFS_SQL_NULL), the field i is NULL. When the second
-high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the
-field i is being stored externally. */
+fields 1..n_fields+1. When the type of the offset at [i+1]
+is (SQL_NULL), the field i is NULL. When the type of the offset at [i+1]
+is (STORED_OFFPAGE), the field i is stored externally. */
static
void
rec_init_offsets(
/*=============*/
const rec_t* rec, /*!< in: physical record */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in/out: array of offsets;
+ rec_offs* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
{
ulint i = 0;
- ulint offs;
+ rec_offs offs;
rec_offs_make_valid(rec, index, offsets);
@@ -407,7 +406,7 @@ rec_init_offsets(
/* read the lengths of fields 0..n */
do {
- ulint len;
+ rec_offs len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
len = offs += REC_NODE_PTR_SIZE;
goto resolved;
@@ -429,7 +428,7 @@ rec_init_offsets(
We do not advance offs, and we set
the length to zero and enable the
SQL NULL flag in offsets[]. */
- len = offs | REC_OFFS_SQL_NULL;
+ len = combine(offs, SQL_NULL);
goto resolved;
}
null_mask <<= 1;
@@ -461,7 +460,7 @@ rec_init_offsets(
stored columns. Thus
the "e" flag must be 0. */
ut_a(!(len & 0x4000));
- offs += len & 0x3fff;
+ offs += get_value(len);
len = offs;
goto resolved;
@@ -476,36 +475,39 @@ resolved:
rec_offs_base(offsets)[i + 1] = len;
} while (++i < rec_offs_n_fields(offsets));
- *rec_offs_base(offsets)
- = (rec - (lens + 1)) | REC_OFFS_COMPACT;
+ *rec_offs_base(offsets) = static_cast<rec_offs>(
+ (rec - (lens + 1)) | REC_OFFS_COMPACT);
} else {
/* Old-style record: determine extra size and end offsets */
offs = REC_N_OLD_EXTRA_BYTES;
if (rec_get_1byte_offs_flag(rec)) {
- offs += rec_offs_n_fields(offsets);
+ offs += static_cast<rec_offs>(
+ rec_offs_n_fields(offsets));
*rec_offs_base(offsets) = offs;
/* Determine offsets to fields */
do {
offs = rec_1_get_field_end_info(rec, i);
if (offs & REC_1BYTE_SQL_NULL_MASK) {
offs &= ~REC_1BYTE_SQL_NULL_MASK;
- offs |= REC_OFFS_SQL_NULL;
+ set_type(offs, SQL_NULL);
}
rec_offs_base(offsets)[1 + i] = offs;
} while (++i < rec_offs_n_fields(offsets));
} else {
- offs += 2 * rec_offs_n_fields(offsets);
+ offs += 2
+ * static_cast<rec_offs>(
+ rec_offs_n_fields(offsets));
*rec_offs_base(offsets) = offs;
/* Determine offsets to fields */
do {
offs = rec_2_get_field_end_info(rec, i);
if (offs & REC_2BYTE_SQL_NULL_MASK) {
offs &= ~REC_2BYTE_SQL_NULL_MASK;
- offs |= REC_OFFS_SQL_NULL;
+ set_type(offs, SQL_NULL);
}
if (offs & REC_2BYTE_EXTERN_MASK) {
offs &= ~REC_2BYTE_EXTERN_MASK;
- offs |= REC_OFFS_EXTERNAL;
+ set_type(offs, STORED_OFFPAGE);
*rec_offs_base(offsets) |= REC_OFFS_EXTERNAL;
}
rec_offs_base(offsets)[1 + i] = offs;
@@ -524,11 +526,11 @@ resolved:
(ULINT_UNDEFINED to compute all offsets)
@param[in,out] heap memory heap
@return the new offsets */
-ulint*
+rec_offs*
rec_get_offsets_func(
const rec_t* rec,
const dict_index_t* index,
- ulint* offsets,
+ rec_offs* offsets,
#ifdef UNIV_DEBUG
bool leaf,
#endif /* UNIV_DEBUG */
@@ -606,11 +608,11 @@ rec_get_offsets_func(
if (UNIV_UNLIKELY(!offsets)
|| UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
if (UNIV_UNLIKELY(!*heap)) {
- *heap = mem_heap_create_at(size * sizeof(ulint),
+ *heap = mem_heap_create_at(size * sizeof(*offsets),
file, line);
}
- offsets = static_cast<ulint*>(
- mem_heap_alloc(*heap, size * sizeof(ulint)));
+ offsets = static_cast<rec_offs*>(
+ mem_heap_alloc(*heap, size * sizeof(*offsets)));
rec_offs_set_n_alloc(offsets, size);
}
@@ -633,13 +635,13 @@ rec_get_offsets_reverse(
const dict_index_t* index, /*!< in: record descriptor */
ulint node_ptr,/*!< in: nonzero=node pointer,
0=leaf node */
- ulint* offsets)/*!< in/out: array consisting of
+ rec_offs* offsets)/*!< in/out: array consisting of
offsets[0] allocated elements */
{
ulint n;
ulint i;
- ulint offs;
- ulint any_ext;
+ rec_offs offs;
+ rec_offs any_ext = 0;
const byte* nulls;
const byte* lens;
dict_field_t* field;
@@ -664,11 +666,10 @@ rec_get_offsets_reverse(
lens = nulls + UT_BITS_IN_BYTES(index->n_nullable);
i = offs = 0;
null_mask = 1;
- any_ext = 0;
/* read the lengths of fields 0..n */
do {
- ulint len;
+ rec_offs len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
len = offs += REC_NODE_PTR_SIZE;
goto resolved;
@@ -689,7 +690,7 @@ rec_get_offsets_reverse(
We do not advance offs, and we set
the length to zero and enable the
SQL NULL flag in offsets[]. */
- len = offs | REC_OFFS_SQL_NULL;
+ len = combine(offs, SQL_NULL);
goto resolved;
}
null_mask <<= 1;
@@ -713,10 +714,11 @@ rec_get_offsets_reverse(
len <<= 8;
len |= *lens++;
- offs += len & 0x3fff;
+ offs += get_value(len);
if (UNIV_UNLIKELY(len & 0x4000)) {
any_ext = REC_OFFS_EXTERNAL;
- len = offs | REC_OFFS_EXTERNAL;
+ len = combine(offs,
+ STORED_OFFPAGE);
} else {
len = offs;
}
@@ -727,15 +729,16 @@ rec_get_offsets_reverse(
len = offs += len;
} else {
- len = offs += field->fixed_len;
+ len = offs += static_cast<rec_offs>(field->fixed_len);
}
resolved:
rec_offs_base(offsets)[i + 1] = len;
} while (++i < rec_offs_n_fields(offsets));
ut_ad(lens >= extra);
- *rec_offs_base(offsets) = (lens - extra + REC_N_NEW_EXTRA_BYTES)
- | REC_OFFS_COMPACT | any_ext;
+ *rec_offs_base(offsets)
+ = static_cast<rec_offs>((lens - extra + REC_N_NEW_EXTRA_BYTES)
+ | REC_OFFS_COMPACT | any_ext);
}
/************************************************************//**
@@ -1397,7 +1400,7 @@ rec_init_offsets_temp(
/*==================*/
const rec_t* rec, /*!< in: temporary file record */
const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets)/*!< in/out: array of offsets;
+ rec_offs* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
{
rec_init_offsets_comp_ordinary(rec, true, index, offsets);
@@ -1436,8 +1439,8 @@ rec_copy_prefix_to_dtuple_func(
ulint n_fields,
mem_heap_t* heap)
{
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(is_leaf || n_fields
@@ -1697,7 +1700,7 @@ ibool
rec_validate(
/*=========*/
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint len;
ulint n_fields;
@@ -1799,7 +1802,7 @@ rec_print_comp(
/*===========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ulint i;
@@ -1919,7 +1922,7 @@ rec_print_mbr_rec(
/*==============*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
@@ -1986,7 +1989,7 @@ rec_print_new(
/*==========*/
FILE* file, /*!< in: file where to print */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
@@ -2026,7 +2029,7 @@ rec_print(
return;
} else {
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
rec_print_new(file, rec,
@@ -2049,7 +2052,7 @@ rec_print(
std::ostream& o,
const rec_t* rec,
ulint info,
- const ulint* offsets)
+ const rec_offs* offsets)
{
const ulint comp = rec_offs_comp(offsets);
const ulint n = rec_offs_n_fields(offsets);
@@ -2101,7 +2104,7 @@ std::ostream&
operator<<(std::ostream& o, const rec_index_print& r)
{
mem_heap_t* heap = NULL;
- ulint* offsets = rec_get_offsets(
+ rec_offs* offsets = rec_get_offsets(
r.m_rec, r.m_index, NULL, page_rec_is_leaf(r.m_rec),
ULINT_UNDEFINED, &heap);
rec_print(o, r.m_rec,
@@ -2139,9 +2142,9 @@ rec_get_trx_id(
const byte* trx_id;
ulint len;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
+ rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
rec_offs_init(offsets_);
- ulint* offsets = offsets_;
+ rec_offs* offsets = offsets_;
ut_ad(trx_id_col <= MAX_REF_PARTS);
ut_ad(dict_index_is_clust(index));
@@ -2168,11 +2171,11 @@ rec_get_trx_id(
@param[in] n nth field */
void
rec_offs_make_nth_extern(
- ulint* offsets,
+ rec_offs* offsets,
const ulint n)
{
ut_ad(!rec_offs_nth_sql_null(offsets, n));
- rec_offs_base(offsets)[1 + n] |= REC_OFFS_EXTERNAL;
+ set_type(rec_offs_base(offsets)[1 +n ], STORED_OFFPAGE);
}
#ifdef WITH_WSREP
# include "ha_prototypes.h"
@@ -2192,8 +2195,8 @@ wsrep_rec_get_foreign_key(
ulint i;
uint key_parts;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- const ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ const rec_offs* offsets;
ut_ad(index_for);
ut_ad(index_ref);
diff --git a/storage/innobase/row/row0ext.cc b/storage/innobase/row/row0ext.cc
index f7e28981939..32e9aad9896 100644
--- a/storage/innobase/row/row0ext.cc
+++ b/storage/innobase/row/row0ext.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -119,11 +120,6 @@ row_ext_create(
ret->buf = static_cast<byte*>(
mem_heap_alloc(heap, n_ext * ret->max_len));
-#ifdef UNIV_DEBUG
- memset(ret->buf, 0xaa, n_ext * ret->max_len);
- UNIV_MEM_ALLOC(ret->buf, n_ext * ret->max_len);
-#endif
-
/* Fetch the BLOB prefixes */
for (i = 0; i < n_ext; i++) {
const dfield_t* dfield;
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 2b751170886..4085ff17bd3 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, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -864,7 +864,8 @@ loop:
num_doc_processed++;
- if (fts_enable_diag_print && num_doc_processed % 10000 == 1) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)
+ && num_doc_processed % 10000 == 1) {
ib::info() << "Number of documents processed: "
<< num_doc_processed;
#ifdef FTS_INTERNAL_DIAG_PRINT
@@ -902,7 +903,7 @@ loop:
goto func_exit;
}
- UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
+ MEM_UNDEFINED(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;
@@ -996,12 +997,14 @@ exit:
goto func_exit;
}
- UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(block[i], srv_sort_buf_size);
if (crypt_block[i]) {
- UNIV_MEM_INVALID(crypt_block[i],
- srv_sort_buf_size);
+ MEM_UNDEFINED(crypt_block[i],
+ srv_sort_buf_size);
}
+#endif /* HAVE_valgrind_or_MSAN */
}
buf[i] = row_merge_buf_empty(buf[i]);
@@ -1009,7 +1012,7 @@ exit:
}
}
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
DEBUG_FTS_SORT_PRINT(" InnoDB_FTS: start merge sort\n");
}
@@ -1040,7 +1043,7 @@ exit:
}
func_exit:
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
DEBUG_FTS_SORT_PRINT(" InnoDB_FTS: complete merge sort\n");
}
@@ -1215,11 +1218,9 @@ row_merge_write_fts_word(
error = row_merge_write_fts_node(ins_ctx, &word->text, fts_node);
- if (error != DB_SUCCESS) {
- ib::error() << "Failed to write word "
- << word->text.f_str << " to FTS auxiliary"
- " index table, error (" << ut_strerr(error)
- << ")";
+ if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
+ ib::error() << "Failed to write word to FTS auxiliary"
+ " index table, error " << error;
ret = error;
}
@@ -1371,7 +1372,7 @@ row_fts_sel_tree_propagate(
int propogated, /*<! in: tree node propagated */
int* sel_tree, /*<! in: selection tree */
const mrec_t** mrec, /*<! in: sort record */
- ulint** offsets, /*<! in: record offsets */
+ rec_offs** offsets, /*<! in: record offsets */
dict_index_t* index) /*<! in/out: FTS index */
{
ulint parent;
@@ -1421,7 +1422,7 @@ row_fts_sel_tree_update(
ulint propagated, /*<! in: node to propagate up */
ulint height, /*<! in: tree height */
const mrec_t** mrec, /*<! in: sort record */
- ulint** offsets, /*<! in: record offsets */
+ rec_offs** offsets, /*<! in: record offsets */
dict_index_t* index) /*<! in: index dictionary */
{
ulint i;
@@ -1443,7 +1444,7 @@ row_fts_build_sel_tree_level(
int* sel_tree, /*<! in/out: selection tree */
ulint level, /*<! in: selection tree level */
const mrec_t** mrec, /*<! in: sort record */
- ulint** offsets, /*<! in: record offsets */
+ rec_offs** offsets, /*<! in: record offsets */
dict_index_t* index) /*<! in: index dictionary */
{
ulint start;
@@ -1503,7 +1504,7 @@ row_fts_build_sel_tree(
/*===================*/
int* sel_tree, /*<! in/out: selection tree */
const mrec_t** mrec, /*<! in: sort record */
- ulint** offsets, /*<! in: record offsets */
+ rec_offs** offsets, /*<! in: record offsets */
dict_index_t* index) /*<! in: index dictionary */
{
ulint treelevel = 1;
@@ -1553,7 +1554,7 @@ row_fts_merge_insert(
mem_heap_t* heap;
dberr_t error = DB_SUCCESS;
ulint* foffs;
- ulint** offsets;
+ rec_offs** offsets;
fts_tokenizer_word_t new_word;
ib_vector_t* positions;
doc_id_t last_doc_id;
@@ -1593,7 +1594,7 @@ row_fts_merge_insert(
heap, sizeof (*b) * fts_sort_pll_degree);
foffs = (ulint*) mem_heap_alloc(
heap, sizeof(*foffs) * fts_sort_pll_degree);
- offsets = (ulint**) mem_heap_alloc(
+ offsets = (rec_offs**) mem_heap_alloc(
heap, sizeof(*offsets) * fts_sort_pll_degree);
buf = (mrec_buf_t**) mem_heap_alloc(
heap, sizeof(*buf) * fts_sort_pll_degree);
@@ -1617,10 +1618,10 @@ row_fts_merge_insert(
num = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
- offsets[i] = static_cast<ulint*>(mem_heap_zalloc(
+ offsets[i] = static_cast<rec_offs*>(mem_heap_zalloc(
heap, num * sizeof *offsets[i]));
- offsets[i][0] = num;
- offsets[i][1] = dict_index_get_n_fields(index);
+ rec_offs_set_n_alloc(offsets[i], num);
+ rec_offs_set_n_fields(offsets[i], dict_index_get_n_fields(index));
block[i] = psort_info[i].merge_block[id];
crypt_block[i] = psort_info[i].crypt_block[id];
b[i] = psort_info[i].merge_block[id];
@@ -1633,7 +1634,7 @@ row_fts_merge_insert(
count_diag += (int) psort_info[i].merge_file[id]->n_rec;
}
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "InnoDB_FTS: to insert " << count_diag
<< " records";
}
@@ -1720,7 +1721,6 @@ row_fts_merge_insert(
corresponding FTS index auxiliary tables */
for (;;) {
dtuple_t* dtuple;
- ulint n_ext;
int min_rec = 0;
if (fts_sort_pll_degree <= 2) {
@@ -1763,7 +1763,7 @@ row_fts_merge_insert(
}
dtuple = row_rec_to_index_entry_low(
- mrec[min_rec], index, offsets[min_rec], &n_ext,
+ mrec[min_rec], index, offsets[min_rec],
tuple_heap);
row_fts_insert_tuple(
@@ -1802,7 +1802,7 @@ exit:
mem_heap_free(heap);
- if (fts_enable_diag_print) {
+ if (UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "InnoDB_FTS: inserted " << count << " records";
}
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 6d0d77c9f5b..981c5046de1 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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,6 +26,9 @@ Created 2012-02-08 by Sunny Bains.
#include "row0import.h"
#include "btr0pcur.h"
+#ifdef BTR_CUR_HASH_ADAPT
+# include "btr0sea.h"
+#endif
#include "que0que.h"
#include "dict0boot.h"
#include "dict0load.h"
@@ -264,7 +267,7 @@ public:
bool remove(
const dict_index_t* index,
page_zip_des_t* page_zip,
- ulint* offsets) UNIV_NOTHROW
+ rec_offs* offsets) UNIV_NOTHROW
{
/* We can't end up with an empty page unless it is root. */
if (page_get_n_recs(m_cur.block->frame) <= 1) {
@@ -524,14 +527,6 @@ protected:
/** Space id of the file being iterated over. */
ulint m_space;
- /** Minimum page number for which the free list has not been
- initialized: the pages >= this limit are, by definition, free;
- note that in a single-table tablespace where size < 64 pages,
- this number is 64, i.e., we have initialized the space about
- the first extent, but have not physically allocted those pages
- to the file. @see FSP_LIMIT. */
- ulint m_free_limit;
-
/** Current size of the space in pages */
ulint m_size;
@@ -591,7 +586,6 @@ AbstractCallback::init(
ut_a(m_space == ULINT_UNDEFINED);
m_size = mach_read_from_4(page + FSP_SIZE);
- m_free_limit = mach_read_from_4(page + FSP_FREE_LIMIT);
m_space = mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SPACE_ID);
return set_current_xdes(0, page);
@@ -845,7 +839,7 @@ private:
@return DB_SUCCESS or error code */
dberr_t adjust_cluster_index_blob_column(
rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint i) UNIV_NOTHROW;
/** Adjusts the BLOB reference in the clustered index row for all
@@ -855,7 +849,7 @@ private:
@return DB_SUCCESS or error code */
dberr_t adjust_cluster_index_blob_columns(
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW;
+ const rec_offs* offsets) UNIV_NOTHROW;
/** In the clustered index, adjist the BLOB pointers as needed.
Also update the BLOB reference, write the new space id.
@@ -864,13 +858,13 @@ private:
@return DB_SUCCESS or error code */
dberr_t adjust_cluster_index_blob_ref(
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW;
+ const rec_offs* offsets) UNIV_NOTHROW;
/** Purge delete-marked records, only if it is possible to do
so without re-organising the B+tree.
@param offsets current row offsets.
@retval true if purged */
- bool purge(const ulint* offsets) UNIV_NOTHROW;
+ bool purge(const rec_offs* offsets) UNIV_NOTHROW;
/** Adjust the BLOB references and sys fields for the current record.
@param index the index being converted
@@ -880,7 +874,7 @@ private:
dberr_t adjust_cluster_record(
const dict_index_t* index,
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW;
+ const rec_offs* offsets) UNIV_NOTHROW;
/** Find an index with the matching id.
@return row_index_t* instance or 0 */
@@ -914,10 +908,10 @@ private:
RecIterator m_rec_iter;
/** Record offset */
- ulint m_offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs m_offsets_[REC_OFFS_NORMAL_SIZE];
/** Pointer to m_offsets_ */
- ulint* m_offsets;
+ rec_offs* m_offsets;
/** Memory heap for the record offsets */
mem_heap_t* m_heap;
@@ -1154,60 +1148,82 @@ row_import::match_table_columns(
if (cfg_col->prtype != col->prtype) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s precise type mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s precise type mismatch,"
+ " it's 0X%X in the table and 0X%X"
+ " in the tablespace meta file",
+ col_name, col->prtype, cfg_col->prtype);
err = DB_ERROR;
}
if (cfg_col->mtype != col->mtype) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s main type mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s main type mismatch,"
+ " it's 0X%X in the table and 0X%X"
+ " in the tablespace meta file",
+ col_name, col->mtype, cfg_col->mtype);
err = DB_ERROR;
}
if (cfg_col->len != col->len) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s length mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s length mismatch,"
+ " it's %u in the table and %u"
+ " in the tablespace meta file",
+ col_name, col->len, cfg_col->len);
err = DB_ERROR;
}
if (cfg_col->mbminlen != col->mbminlen
|| cfg_col->mbmaxlen != col->mbmaxlen) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s multi-byte len mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s multi-byte len mismatch,"
+ " it's %u-%u in the table and %u-%u"
+ " in the tablespace meta file",
+ col_name, col->mbminlen, col->mbmaxlen,
+ cfg_col->mbminlen, cfg_col->mbmaxlen);
err = DB_ERROR;
}
if (cfg_col->ind != col->ind) {
+ ib_errf(thd,
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s position mismatch,"
+ " it's %u in the table and %u"
+ " in the tablespace meta file",
+ col_name, col->ind, cfg_col->ind);
err = DB_ERROR;
}
if (cfg_col->ord_part != col->ord_part) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s ordering mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s ordering mismatch,"
+ " it's %u in the table and %u"
+ " in the tablespace meta file",
+ col_name, col->ord_part,
+ cfg_col->ord_part);
err = DB_ERROR;
}
if (cfg_col->max_prefix != col->max_prefix) {
ib_errf(thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s max prefix mismatch.",
- col_name);
+ IB_LOG_LEVEL_ERROR,
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s max prefix mismatch"
+ " it's %u in the table and %u"
+ " in the tablespace meta file",
+ col_name, col->max_prefix,
+ cfg_col->max_prefix);
err = DB_ERROR;
}
}
@@ -1502,13 +1518,70 @@ IndexPurge::next() UNIV_NOTHROW
mtr_set_log_mode(&m_mtr, MTR_LOG_NO_REDO);
btr_pcur_restore_position(BTR_MODIFY_LEAF, &m_pcur, &m_mtr);
+ /* The following is based on btr_pcur_move_to_next_user_rec(). */
+ m_pcur.old_stored = false;
+ ut_ad(m_pcur.latch_mode == BTR_MODIFY_LEAF);
+ do {
+ if (btr_pcur_is_after_last_on_page(&m_pcur)) {
+ if (btr_pcur_is_after_last_in_tree(&m_pcur, &m_mtr)) {
+ return DB_END_OF_INDEX;
+ }
- if (!btr_pcur_move_to_next_user_rec(&m_pcur, &m_mtr)) {
+ buf_block_t* block = btr_pcur_get_block(&m_pcur);
+ uint32_t next_page = btr_page_get_next(block->frame);
- return(DB_END_OF_INDEX);
- }
+ /* MDEV-13542 FIXME: Make these checks part of
+ btr_pcur_move_to_next_page(), and introduce a
+ return status that will be checked in all callers! */
+ switch (next_page) {
+ default:
+ if (next_page != block->page.id.page_no()) {
+ break;
+ }
+ /* MDEV-20931 FIXME: Check that
+ next_page is within the tablespace
+ bounds! Also check that it is not a
+ change buffer bitmap page. */
+ /* fall through */
+ case 0:
+ case 1:
+ case FIL_NULL:
+ return DB_CORRUPTION;
+ }
- return(DB_SUCCESS);
+ dict_index_t* index = m_pcur.btr_cur.index;
+ buf_block_t* next_block = btr_block_get(
+ page_id_t(block->page.id.space(), next_page),
+ block->page.size, BTR_MODIFY_LEAF, index,
+ &m_mtr);
+
+ if (UNIV_UNLIKELY(!next_block
+ || !fil_page_index_page_check(
+ next_block->frame)
+ || !!dict_index_is_spatial(index)
+ != (fil_page_get_type(
+ next_block->frame)
+ == FIL_PAGE_RTREE)
+ || page_is_comp(next_block->frame)
+ != page_is_comp(block->frame)
+ || btr_page_get_prev(
+ next_block->frame)
+ != block->page.id.page_no())) {
+ return DB_CORRUPTION;
+ }
+
+ btr_leaf_page_release(block, BTR_MODIFY_LEAF, &m_mtr);
+
+ page_cur_set_before_first(next_block,
+ &m_pcur.btr_cur.page_cur);
+
+ ut_d(page_check_dir(next_block->frame));
+ } else {
+ btr_pcur_move_to_next_on_page(&m_pcur);
+ }
+ } while (!btr_pcur_is_on_user_rec(&m_pcur));
+
+ return DB_SUCCESS;
}
/**
@@ -1583,7 +1656,7 @@ inline
dberr_t
PageConverter::adjust_cluster_index_blob_column(
rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint i) UNIV_NOTHROW
{
ulint len;
@@ -1627,7 +1700,7 @@ inline
dberr_t
PageConverter::adjust_cluster_index_blob_columns(
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW
+ const rec_offs* offsets) UNIV_NOTHROW
{
ut_ad(rec_offs_any_extern(offsets));
@@ -1660,7 +1733,7 @@ inline
dberr_t
PageConverter::adjust_cluster_index_blob_ref(
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW
+ const rec_offs* offsets) UNIV_NOTHROW
{
if (rec_offs_any_extern(offsets)) {
dberr_t err;
@@ -1681,7 +1754,7 @@ re-organising the B+tree.
@return true if purge succeeded */
inline
bool
-PageConverter::purge(const ulint* offsets) UNIV_NOTHROW
+PageConverter::purge(const rec_offs* offsets) UNIV_NOTHROW
{
const dict_index_t* index = m_index->m_srv_index;
@@ -1707,7 +1780,7 @@ dberr_t
PageConverter::adjust_cluster_record(
const dict_index_t* index,
rec_t* rec,
- const ulint* offsets) UNIV_NOTHROW
+ const rec_offs* offsets) UNIV_NOTHROW
{
dberr_t err;
@@ -1803,7 +1876,7 @@ PageConverter::update_index_page(
row_index_t* index = find_index(id);
- if (index == 0) {
+ if (UNIV_UNLIKELY(!index)) {
ib::error() << "Page for tablespace " << m_space
<< " is index page with id " << id
<< " but that index is not found from"
@@ -1823,6 +1896,23 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
+ if (m_index && block->page.id.page_no() == m_index->m_page_no) {
+ byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE
+ + page;
+ mach_write_to_4(b, block->page.id.space());
+
+ memcpy(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + FSEG_HDR_SPACE
+ + page, b, 4);
+ if (UNIV_LIKELY_NULL(block->page.zip.data)) {
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_TOP
+ + FSEG_HDR_SPACE], b, 4);
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_LEAF
+ + FSEG_HDR_SPACE], b, 4);
+ }
+ }
+
#ifdef UNIV_ZIP_DEBUG
ut_a(!is_compressed_table()
|| page_zip_validate(m_page_zip_ptr, page, m_index->m_srv_index));
@@ -2033,7 +2123,7 @@ row_import_discard_changes(
ib::info() << "Discarding tablespace of table "
<< prebuilt->table->name
- << ": " << ut_strerr(err);
+ << ": " << err;
if (trx->dict_operation_lock_mode != RW_X_LATCH) {
ut_a(trx->dict_operation_lock_mode == 0);
@@ -2273,8 +2363,8 @@ row_import_set_sys_max_row_id(
ulint len;
const byte* field;
mem_heap_t* heap = NULL;
- ulint offsets_[1 + REC_OFFS_HEADER_SIZE];
- ulint* offsets;
+ rec_offs offsets_[1 + REC_OFFS_HEADER_SIZE];
+ rec_offs* offsets;
rec_offs_init(offsets_);
@@ -3921,15 +4011,12 @@ row_import_for_mysql(
index entries that point to cached garbage pages in the buffer
pool, because PageConverter::operator() only evicted those
pages that were replaced by the imported pages. We must
- discard all remaining adaptive hash index entries, because the
+ detach any remaining adaptive hash index entries, because the
adaptive hash index must be a subset of the table contents;
false positives are not tolerated. */
- while (buf_LRU_drop_page_hash_for_tablespace(table)) {
- if (trx_is_interrupted(trx)
- || srv_shutdown_state != SRV_SHUTDOWN_NONE) {
- err = DB_INTERRUPTED;
- break;
- }
+ for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes); index;
+ index = UT_LIST_GET_NEXT(indexes, index)) {
+ index = index->clone_if_needed();
}
#endif /* BTR_CUR_HASH_ADAPT */
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 17c45503cc1..ca04be71953 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -73,8 +73,8 @@ ins_node_create(
{
ins_node_t* node;
- node = static_cast<ins_node_t*>(
- mem_heap_alloc(heap, sizeof(ins_node_t)));
+ node = new (static_cast<ins_node_t*>(
+ mem_heap_alloc(heap, sizeof(ins_node_t)))) ins_node_t;
node->common.type = QUE_NODE_INSERT;
@@ -83,7 +83,6 @@ ins_node_create(
node->state = INS_NODE_SET_IX_LOCK;
node->table = table;
node->index = NULL;
- node->entry = NULL;
node->select = NULL;
@@ -96,35 +95,22 @@ ins_node_create(
return(node);
}
-/***********************************************************//**
-Creates an entry template for each index of a table. */
-static
-void
-ins_node_create_entry_list(
-/*=======================*/
- ins_node_t* node) /*!< in: row insert node */
+/** Create an row template for each index of a table. */
+static void ins_node_create_entry_list(ins_node_t *node)
{
- dict_index_t* index;
- dtuple_t* entry;
-
- ut_ad(node->entry_sys_heap);
-
- UT_LIST_INIT(node->entry_list, &dtuple_t::tuple_list);
-
- /* We will include all indexes (include those corrupted
- secondary indexes) in the entry list. Filteration of
- these corrupted index will be done in row_ins() */
-
- for (index = dict_table_get_first_index(node->table);
- index != 0;
- index = dict_table_get_next_index(index)) {
-
- entry = row_build_index_entry_low(
- node->row, NULL, index, node->entry_sys_heap,
- ROW_BUILD_FOR_INSERT);
-
- UT_LIST_ADD_LAST(node->entry_list, entry);
- }
+ node->entry_list.reserve(UT_LIST_GET_LEN(node->table->indexes));
+
+ for (dict_index_t *index= dict_table_get_first_index(node->table); index;
+ index= dict_table_get_next_index(index))
+ {
+ /* Corrupted or incomplete secondary indexes will be filtered out in
+ row_ins(). */
+ dtuple_t *entry= index->online_status >= ONLINE_INDEX_ABORTED
+ ? dtuple_create(node->entry_sys_heap, 0)
+ : row_build_index_entry_low(node->row, NULL, index, node->entry_sys_heap,
+ ROW_BUILD_FOR_INSERT);
+ node->entry_list.push_back(entry);
+ }
}
/*****************************************************************//**
@@ -189,7 +175,8 @@ ins_node_set_new_row(
{
node->state = INS_NODE_SET_IX_LOCK;
node->index = NULL;
- node->entry = NULL;
+ node->entry_list.clear();
+ node->entry = node->entry_list.end();
node->row = row;
@@ -223,7 +210,7 @@ row_ins_sec_index_entry_by_modify(
depending on whether mtr holds just a leaf
latch or also a tree latch */
btr_cur_t* cursor, /*!< in: B-tree cursor */
- ulint** offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< in/out: offsets on cursor->page_cur.rec */
mem_heap_t* offsets_heap,
/*!< in/out: memory heap that can be emptied */
mem_heap_t* heap, /*!< in/out: memory heap */
@@ -318,7 +305,7 @@ row_ins_clust_index_entry_by_modify(
ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE,
depending on whether mtr holds just a leaf
latch or also a tree latch */
- ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
+ rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap that can
be emptied, or NULL */
@@ -509,7 +496,7 @@ row_ins_cascade_calc_update_vec(
n_fields_updated = 0;
- bool affects_fulltext = false;
+ bool affects_fulltext = foreign->affects_fulltext();
if (table->fts) {
doc_id_pos = dict_table_get_nth_col_pos(
@@ -630,17 +617,6 @@ row_ins_cascade_calc_update_vec(
padded_data, min_size);
}
- /* Check whether the current column has
- FTS index on it */
- if (table->fts
- && dict_table_is_fts_column(
- table->fts->indexes,
- dict_col_get_no(col),
- dict_col_is_virtual(col))
- != ULINT_UNDEFINED) {
- affects_fulltext = true;
- }
-
/* If Doc ID is updated, check whether the
Doc ID is valid */
if (table->fts
@@ -929,28 +905,24 @@ row_ins_invalidate_query_cache(
@param[in] index clustered index of child table
@param[in] node parent update node
@param[in] foreign foreign key information
-@param[out] err error code. */
+@return error code. */
static
-void
+dberr_t
row_ins_foreign_fill_virtual(
upd_node_t* cascade,
const rec_t* rec,
dict_index_t* index,
upd_node_t* node,
- dict_foreign_t* foreign,
- dberr_t* err)
+ dict_foreign_t* foreign)
{
THD* thd = current_thd;
row_ext_t* ext;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
- const ulint* offsets =
+ const rec_offs* offsets =
rec_get_offsets(rec, index, offsets_, true,
ULINT_UNDEFINED, &cascade->heap);
- mem_heap_t* v_heap = NULL;
TABLE* mysql_table= NULL;
- VCOL_STORAGE* vcol_storage= NULL;
- byte* record;
upd_t* update = cascade->update;
ulint n_v_fld = index->table->n_v_def;
ulint n_diff;
@@ -962,20 +934,16 @@ row_ins_foreign_fill_virtual(
&ext, cascade->heap);
n_diff = update->n_fields;
- update->n_fields += n_v_fld;
-
if (index->table->vc_templ == NULL) {
/** This can occur when there is a cascading
delete or update after restart. */
innobase_init_vc_templ(index->table);
}
- if (innobase_allocate_row_for_vcol(thd, index, &v_heap,
- &mysql_table,
- &record, &vcol_storage)) {
- if (v_heap) mem_heap_free(v_heap);
- *err = DB_OUT_OF_MEMORY;
- goto func_exit;
+ ib_vcol_row vc(NULL);
+ uchar *record = vc.record(thd, index, &mysql_table);
+ if (!record) {
+ return DB_OUT_OF_MEMORY;
}
for (ulint i = 0; i < n_v_fld; i++) {
@@ -991,15 +959,14 @@ row_ins_foreign_fill_virtual(
dfield_t* vfield = innobase_get_computed_value(
update->old_vrow, col, index,
- &v_heap, update->heap, NULL, thd, mysql_table,
+ &vc.heap, update->heap, NULL, thd, mysql_table,
record, NULL, NULL, NULL);
if (vfield == NULL) {
- *err = DB_COMPUTE_VALUE_FAILED;
- goto func_exit;
+ return DB_COMPUTE_VALUE_FAILED;
}
- upd_field = upd_get_nth_field(update, n_diff);
+ upd_field = update->fields + n_diff;
upd_field->old_v_val = static_cast<dfield_t*>(
mem_heap_alloc(cascade->heap,
@@ -1009,42 +976,31 @@ row_ins_foreign_fill_virtual(
upd_field_set_v_field_no(upd_field, i, index);
- if (node->is_delete
- ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
- : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) {
-
- dfield_set_null(&upd_field->new_val);
- }
-
- if (!node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
-
- dfield_t* new_vfield = innobase_get_computed_value(
- update->old_vrow, col, index,
- &v_heap, update->heap, NULL, thd,
- mysql_table, record, NULL,
- node->update, foreign);
+ bool set_null =
+ node->is_delete
+ ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
+ : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL);
- if (new_vfield == NULL) {
- *err = DB_COMPUTE_VALUE_FAILED;
- goto func_exit;
- }
+ dfield_t* new_vfield = innobase_get_computed_value(
+ update->old_vrow, col, index,
+ &vc.heap, update->heap, NULL, thd,
+ mysql_table, record, NULL,
+ set_null ? update : node->update, foreign);
- dfield_copy(&(upd_field->new_val), new_vfield);
+ if (new_vfield == NULL) {
+ return DB_COMPUTE_VALUE_FAILED;
}
- n_diff++;
+ dfield_copy(&upd_field->new_val, new_vfield);
+
+ if (!dfield_datas_are_binary_equal(
+ upd_field->old_v_val,
+ &upd_field->new_val, 0))
+ n_diff++;
}
update->n_fields = n_diff;
- *err = DB_SUCCESS;
-
-func_exit:
- if (v_heap) {
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
- mem_heap_free(v_heap);
- }
+ return DB_SUCCESS;
}
#ifdef WITH_WSREP
@@ -1285,10 +1241,10 @@ row_ins_foreign_check_on_constraint(
update->info_bits = 0;
update->n_fields = foreign->n_fields;
- UNIV_MEM_INVALID(update->fields,
- update->n_fields * sizeof *update->fields);
-
- bool affects_fulltext = false;
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(update->fields,
+ update->n_fields * sizeof *update->fields);
+#endif /* HAVE_valgrind_or_MSAN */
for (ulint i = 0; i < foreign->n_fields; i++) {
upd_field_t* ufield = &update->fields[i];
@@ -1305,51 +1261,25 @@ row_ins_foreign_check_on_constraint(
ufield->orig_len = 0;
ufield->exp = NULL;
dfield_set_null(&ufield->new_val);
-
- if (!affects_fulltext
- && table->fts && dict_table_is_fts_column(
- table->fts->indexes,
- dict_index_get_nth_col_no(index, i),
- dict_col_is_virtual(
- dict_index_get_nth_col(index, i)))
- != ULINT_UNDEFINED) {
- affects_fulltext = true;
- }
}
- if (affects_fulltext) {
+ if (foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
if (foreign->v_cols != NULL
&& foreign->v_cols->size() > 0) {
- row_ins_foreign_fill_virtual(
+ err = row_ins_foreign_fill_virtual(
cascade, clust_rec, clust_index,
- node, foreign, &err);
+ node, foreign);
if (err != DB_SUCCESS) {
goto nonstandard_exit_func;
}
}
- } else if (table->fts && cascade->is_delete) {
- /* DICT_FOREIGN_ON_DELETE_CASCADE case */
- bool affects_fulltext = false;
-
- for (ulint i = 0; i < foreign->n_fields; i++) {
- if (dict_table_is_fts_column(
- table->fts->indexes,
- dict_index_get_nth_col_no(index, i),
- dict_col_is_virtual(
- dict_index_get_nth_col(index, i)))
- != ULINT_UNDEFINED) {
- affects_fulltext = true;
- break;
- }
- }
-
- if (affects_fulltext) {
- fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
- }
+ } else if (table->fts && cascade->is_delete
+ && foreign->affects_fulltext()) {
+ fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
if (!node->is_delete
@@ -1362,9 +1292,9 @@ row_ins_foreign_check_on_constraint(
node, foreign, tmp_heap, trx);
if (foreign->v_cols && !foreign->v_cols->empty()) {
- row_ins_foreign_fill_virtual(
+ err = row_ins_foreign_fill_virtual(
cascade, clust_rec, clust_index,
- node, foreign, &err);
+ node, foreign);
if (err != DB_SUCCESS) {
goto nonstandard_exit_func;
@@ -1413,20 +1343,20 @@ row_ins_foreign_check_on_constraint(
btr_pcur_store_position(cascade->pcur, mtr);
}
+#ifdef WITH_WSREP
+ err = wsrep_append_foreign_key(trx, foreign, clust_rec, clust_index,
+ FALSE, WSREP_KEY_EXCLUSIVE);
+ if (err != DB_SUCCESS) {
+ ib::info() << "WSREP: foreign key append failed: " << err;
+ goto nonstandard_exit_func;
+ }
+#endif /* WITH_WSREP */
mtr_commit(mtr);
ut_a(cascade->pcur->rel_pos == BTR_PCUR_ON);
cascade->state = UPD_NODE_UPDATE_CLUSTERED;
-#ifdef WITH_WSREP
- err = wsrep_append_foreign_key(trx, foreign, cascade->pcur->old_rec, clust_index,
- FALSE, WSREP_KEY_EXCLUSIVE);
- if (err != DB_SUCCESS) {
- fprintf(stderr,
- "WSREP: foreign key append failed: %d\n", err);
- } else
-#endif /* WITH_WSREP */
err = row_update_cascade_for_mysql(thr, cascade,
foreign->foreign_table);
@@ -1483,7 +1413,7 @@ row_ins_set_shared_rec_lock(
const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
@@ -1514,7 +1444,7 @@ row_ins_set_exclusive_rec_lock(
const buf_block_t* block, /*!< in: buffer block of rec */
const rec_t* rec, /*!< in: record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
@@ -1561,8 +1491,8 @@ row_ins_check_foreign_constraint(
mtr_t mtr;
trx_t* trx = thr_get_trx(thr);
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
bool skip_gap_lock;
@@ -1779,7 +1709,7 @@ row_ins_check_foreign_constraint(
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
- if (!wsrep_on(trx->mysql_thd)) {
+ if (!trx->is_wsrep()) {
goto end_scan;
}
enum wsrep_key_type key_type;
@@ -1931,6 +1861,39 @@ exit_func:
DBUG_RETURN(err);
}
+/** Sets the values of the dtuple fields in ref_entry from the values of
+foreign columns in entry.
+@param[in] foreign foreign key constraint
+@param[in] index clustered index
+@param[in] entry tuple of clustered index
+@param[in] ref_entry tuple of foreign columns
+@return true if all foreign key fields present in clustered index */
+static
+bool row_ins_foreign_index_entry(dict_foreign_t *foreign,
+ const dict_index_t *index,
+ const dtuple_t *entry,
+ dtuple_t *ref_entry)
+{
+ for (ulint i= 0; i < foreign->n_fields; i++)
+ {
+ for (ulint j= 0; j < index->n_fields; j++)
+ {
+ const char *col_name= dict_table_get_col_name(
+ index->table, dict_index_get_nth_col_no(index, j));
+ if (0 == innobase_strcasecmp(col_name, foreign->foreign_col_names[i]))
+ {
+ dfield_copy(&ref_entry->fields[i], &entry->fields[j]);
+ goto got_match;
+ }
+ }
+ return false;
+got_match:
+ continue;
+ }
+
+ return true;
+}
+
/***************************************************************//**
Checks if foreign key constraints fail for an index entry. If index
is not mentioned in any constraint, this function does nothing,
@@ -1949,9 +1912,10 @@ row_ins_check_foreign_constraints(
que_thr_t* thr) /*!< in: query thread */
{
dict_foreign_t* foreign;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
trx_t* trx;
ibool got_s_lock = FALSE;
+ mem_heap_t* heap = NULL;
DBUG_ASSERT(index->is_primary() == pk);
@@ -1961,13 +1925,36 @@ row_ins_check_foreign_constraints(
"foreign_constraint_check_for_ins");
for (dict_foreign_set::iterator it = table->foreign_set.begin();
- it != table->foreign_set.end();
+ err == DB_SUCCESS && it != table->foreign_set.end();
++it) {
foreign = *it;
if (foreign->foreign_index == index
|| (pk && !foreign->foreign_index)) {
+
+ dtuple_t* ref_tuple = entry;
+ if (UNIV_UNLIKELY(!foreign->foreign_index)) {
+ /* Change primary key entry to
+ foreign key index entry */
+ if (!heap) {
+ heap = mem_heap_create(1000);
+ } else {
+ mem_heap_empty(heap);
+ }
+
+ ref_tuple = dtuple_create(
+ heap, foreign->n_fields);
+ dtuple_set_n_fields_cmp(
+ ref_tuple, foreign->n_fields);
+ if (!row_ins_foreign_index_entry(
+ foreign, index, entry, ref_tuple)) {
+ err = DB_NO_REFERENCED_ROW;
+ break;
+ }
+
+ }
+
dict_table_t* ref_table = NULL;
dict_table_t* referenced_table
= foreign->referenced_table;
@@ -1997,7 +1984,7 @@ row_ins_check_foreign_constraints(
table from being dropped while the check is running. */
err = row_ins_check_foreign_constraint(
- TRUE, foreign, table, entry, thr);
+ TRUE, foreign, table, ref_tuple, thr);
if (referenced_table) {
my_atomic_addlint(
@@ -2012,15 +1999,14 @@ row_ins_check_foreign_constraints(
if (ref_table != NULL) {
dict_table_close(ref_table, FALSE, FALSE);
}
-
- if (err != DB_SUCCESS) {
-
- return(err);
- }
}
}
- return(DB_SUCCESS);
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
+ return err;
}
/***************************************************************//**
@@ -2036,7 +2022,7 @@ row_ins_dupl_error_with_rec(
the record! */
const dtuple_t* entry, /*!< in: entry to insert */
dict_index_t* index, /*!< in: index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint matched_fields;
ulint n_unique;
@@ -2095,9 +2081,11 @@ row_ins_scan_sec_index_for_duplicate(
btr_pcur_t pcur;
dberr_t err = DB_SUCCESS;
ulint allow_duplicates;
- ulint* offsets = NULL;
+ rec_offs offsets_[REC_OFFS_SEC_INDEX_SIZE];
+ rec_offs* offsets = offsets_;
DBUG_ENTER("row_ins_scan_sec_index_for_duplicate");
+ rec_offs_init(offsets_);
ut_ad(s_latch == rw_lock_own_flagged(
&index->lock, RW_LOCK_FLAG_S | RW_LOCK_FLAG_SX));
@@ -2227,7 +2215,7 @@ row_ins_duplicate_online(
ulint n_uniq, /*!< in: offset of DB_TRX_ID */
const dtuple_t* entry, /*!< in: entry that is being inserted */
const rec_t* rec, /*!< in: clustered index record */
- ulint* offsets)/*!< in/out: rec_get_offsets(rec) */
+ rec_offs* offsets)/*!< in/out: rec_get_offsets(rec) */
{
ulint fields = 0;
@@ -2266,7 +2254,7 @@ row_ins_duplicate_error_in_clust_online(
ulint n_uniq, /*!< in: offset of DB_TRX_ID */
const dtuple_t* entry, /*!< in: entry that is being inserted */
const btr_cur_t*cursor, /*!< in: cursor on insert position */
- ulint** offsets,/*!< in/out: rec_get_offsets(rec) */
+ rec_offs** offsets,/*!< in/out: rec_get_offsets(rec) */
mem_heap_t** heap) /*!< in/out: heap for offsets */
{
dberr_t err = DB_SUCCESS;
@@ -2313,8 +2301,8 @@ row_ins_duplicate_error_in_clust(
ulint n_unique;
trx_t* trx = thr_get_trx(thr);
mem_heap_t*heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(dict_index_is_clust(cursor->index));
@@ -2487,7 +2475,7 @@ dberr_t
row_ins_index_entry_big_rec(
const dtuple_t* entry,
const big_rec_t* big_rec,
- ulint* offsets,
+ rec_offs* offsets,
mem_heap_t** heap,
dict_index_t* index,
const void* thd __attribute__((unused)))
@@ -2562,8 +2550,8 @@ row_ins_clust_index_entry_low(
mtr_t mtr;
ib_uint64_t auto_inc = 0;
mem_heap_t* offsets_heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
DBUG_ENTER("row_ins_clust_index_entry_low");
@@ -2841,8 +2829,8 @@ row_ins_sec_index_entry_low(
dberr_t err = DB_SUCCESS;
ulint n_unique;
mtr_t mtr;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
rtr_info_t rtr_info;
@@ -2905,7 +2893,7 @@ row_ins_sec_index_entry_low(
err = btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_RTREE_INSERT,
search_mode,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
if (mode == BTR_MODIFY_LEAF && rtr_info.mbr_adj) {
mtr_commit(&mtr);
@@ -2920,7 +2908,7 @@ row_ins_sec_index_entry_low(
err = btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_RTREE_INSERT,
search_mode,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
mode = BTR_MODIFY_TREE;
}
@@ -2932,7 +2920,7 @@ row_ins_sec_index_entry_low(
err = btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_LE,
search_mode,
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
}
if (err != DB_SUCCESS) {
@@ -3026,7 +3014,7 @@ row_ins_sec_index_entry_low(
index, 0, entry, PAGE_CUR_LE,
(search_mode
& ~(BTR_INSERT | BTR_IGNORE_SEC_UNIQUE)),
- &cursor, 0, __FILE__, __LINE__, &mtr);
+ &cursor, 0, __FILE__, __LINE__, &mtr, 0);
}
if (row_ins_must_modify_rec(&cursor)) {
@@ -3411,15 +3399,16 @@ row_ins_index_entry_step(
ut_ad(dtuple_check_typed(node->row));
- err = row_ins_index_entry_set_vals(node->index, node->entry, node->row);
+ err = row_ins_index_entry_set_vals(node->index, *node->entry,
+ node->row);
if (err != DB_SUCCESS) {
DBUG_RETURN(err);
}
- ut_ad(dtuple_check_typed(node->entry));
+ ut_ad(dtuple_check_typed(*node->entry));
- err = row_ins_index_entry(node->index, node->entry, thr);
+ err = row_ins_index_entry(node->index, *node->entry, thr);
DEBUG_SYNC_C_IF_THD(thr_get_trx(thr)->mysql_thd,
"after_row_ins_index_entry_step");
@@ -3537,7 +3526,8 @@ row_ins(
row_ins_alloc_row_id_step(node);
node->index = dict_table_get_first_index(node->table);
- node->entry = UT_LIST_GET_FIRST(node->entry_list);
+ ut_ad(node->entry_list.empty() == false);
+ node->entry = node->entry_list.begin();
if (node->ins_type == INS_SEARCHED) {
@@ -3563,20 +3553,16 @@ row_ins(
}
node->index = dict_table_get_next_index(node->index);
- node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry);
-
- DBUG_EXECUTE_IF(
- "row_ins_skip_sec",
- node->index = NULL; node->entry = NULL; break;);
+ ++node->entry;
/* Skip corrupted secondary index and its entry */
while (node->index && node->index->is_corrupted()) {
node->index = dict_table_get_next_index(node->index);
- node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry);
+ ++node->entry;
}
}
- ut_ad(node->entry == NULL);
+ ut_ad(node->entry == node->entry_list.end());
node->state = INS_NODE_ALLOC_ROW_ID;
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 6da08872a9a..986cac54540 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -323,7 +323,9 @@ row_log_online_op(
goto err_exit;
}
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
+#endif /* HAVE_valgrind_or_MSAN */
ut_ad(log->tail.bytes < srv_sort_buf_size);
avail_size = srv_sort_buf_size - log->tail.bytes;
@@ -373,7 +375,7 @@ row_log_online_op(
log->tail.buf, avail_size);
}
- UNIV_MEM_ASSERT_RW(buf, srv_sort_buf_size);
+ MEM_CHECK_DEFINED(buf, srv_sort_buf_size);
if (row_log_tmpfile(log) < 0) {
log->error = DB_OUT_OF_MEMORY;
@@ -407,8 +409,10 @@ write_failed:
index->type |= DICT_CORRUPT;
}
- UNIV_MEM_INVALID(log->tail.block, srv_sort_buf_size);
- UNIV_MEM_INVALID(buf, srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
+ MEM_UNDEFINED(buf, srv_sort_buf_size);
+#endif /* HAVE_valgrind_or_MSAN */
memcpy(log->tail.block, log->tail.buf + avail_size,
mrec_size - avail_size);
@@ -418,7 +422,9 @@ write_failed:
ut_ad(b == log->tail.block + log->tail.bytes);
}
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
+#endif /* HAVE_valgrind_or_MSAN */
err_exit:
mutex_exit(&log->mutex);
}
@@ -450,7 +456,9 @@ row_log_table_open(
{
mutex_enter(&log->mutex);
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
+#endif /* HAVE_valgrind_or_MSAN */
if (log->error != DB_SUCCESS) {
err_exit:
@@ -510,7 +518,7 @@ row_log_table_close_func(
memcpy(buf + log->tail.bytes, log->tail.buf, avail);
}
- UNIV_MEM_ASSERT_RW(buf, srv_sort_buf_size);
+ MEM_CHECK_DEFINED(buf, srv_sort_buf_size);
if (row_log_tmpfile(log) < 0) {
log->error = DB_OUT_OF_MEMORY;
@@ -541,8 +549,10 @@ row_log_table_close_func(
write_failed:
log->error = DB_ONLINE_LOG_TOO_BIG;
}
- UNIV_MEM_INVALID(log->tail.block, srv_sort_buf_size);
- UNIV_MEM_INVALID(buf, srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
+ MEM_UNDEFINED(buf, srv_sort_buf_size);
+#endif /* HAVE_valgrind_or_MSAN */
memcpy(log->tail.block, log->tail.buf + avail, size - avail);
log->tail.bytes = size - avail;
} else {
@@ -551,7 +561,9 @@ write_failed:
}
log->tail.total += size;
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
+#endif /* HAVE_valgrind_or_MSAN */
err_exit:
mutex_exit(&log->mutex);
@@ -592,7 +604,7 @@ row_log_table_delete(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should
be logged, or NULL to use those in rec */
{
@@ -835,7 +847,7 @@ row_log_table_low(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
bool insert, /*!< in: true if insert, false if update */
const dtuple_t* old_pk) /*!< in: old PRIMARY KEY value (if !insert
and a PRIMARY KEY is being created) */
@@ -948,7 +960,7 @@ row_log_table_update(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
const dtuple_t* old_pk) /*!< in: row_log_table_get_pk()
before the update */
{
@@ -999,7 +1011,7 @@ row_log_table_get_pk_col(
dfield_t* dfield,
mem_heap_t* heap,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
ulint i,
const page_size_t& page_size,
ulint max_len)
@@ -1053,7 +1065,7 @@ row_log_table_get_pk(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */
byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for
row_log_table_delete(), or NULL */
mem_heap_t** heap) /*!< in/out: memory heap where allocated */
@@ -1246,7 +1258,7 @@ row_log_table_insert(
page X-latched */
dict_index_t* index, /*!< in/out: clustered index, S-latched
or X-latched */
- const ulint* offsets)/*!< in: rec_get_offsets(rec,index) */
+ const rec_offs* offsets)/*!< in: rec_get_offsets(rec,index) */
{
row_log_table_low(rec, index, offsets, true, NULL);
}
@@ -1337,7 +1349,7 @@ row_log_table_apply_convert_mrec(
/*=============================*/
const mrec_t* mrec, /*!< in: merge record */
dict_index_t* index, /*!< in: index of mrec */
- const ulint* offsets, /*!< in: offsets of mrec */
+ const rec_offs* offsets, /*!< in: offsets of mrec */
const row_log_t* log, /*!< in: rebuild context */
mem_heap_t* heap, /*!< in/out: memory heap */
trx_id_t trx_id, /*!< in: DB_TRX_ID of mrec */
@@ -1569,7 +1581,7 @@ row_log_table_apply_insert(
/*=======================*/
que_thr_t* thr, /*!< in: query graph */
const mrec_t* mrec, /*!< in: record to insert */
- const ulint* offsets, /*!< in: offsets of mrec */
+ const rec_offs* offsets, /*!< in: offsets of mrec */
mem_heap_t* offsets_heap, /*!< in/out: memory heap
that can be emptied */
mem_heap_t* heap, /*!< in/out: memory heap */
@@ -1621,7 +1633,7 @@ row_log_table_apply_delete_low(
/*===========================*/
btr_pcur_t* pcur, /*!< in/out: B-tree cursor,
will be trashed */
- const ulint* offsets, /*!< in: offsets on pcur */
+ const rec_offs* offsets, /*!< in: offsets on pcur */
mem_heap_t* heap, /*!< in/out: memory heap */
mtr_t* mtr) /*!< in/out: mini-transaction,
will be committed */
@@ -1714,7 +1726,7 @@ row_log_table_apply_delete(
DB_TRX_ID in the new
clustered index */
const mrec_t* mrec, /*!< in: merge record */
- const ulint* moffsets, /*!< in: offsets of mrec */
+ const rec_offs* moffsets, /*!< in: offsets of mrec */
mem_heap_t* offsets_heap, /*!< in/out: memory heap
that can be emptied */
mem_heap_t* heap, /*!< in/out: memory heap */
@@ -1725,7 +1737,7 @@ row_log_table_apply_delete(
dtuple_t* old_pk;
mtr_t mtr;
btr_pcur_t pcur;
- ulint* offsets;
+ rec_offs* offsets;
ut_ad(rec_offs_n_fields(moffsets)
== dict_index_get_n_unique(index) + 2);
@@ -1835,7 +1847,7 @@ row_log_table_apply_update(
DB_TRX_ID in the new
clustered index */
const mrec_t* mrec, /*!< in: new value */
- const ulint* offsets, /*!< in: offsets of mrec */
+ const rec_offs* offsets, /*!< in: offsets of mrec */
mem_heap_t* offsets_heap, /*!< in/out: memory heap
that can be emptied */
mem_heap_t* heap, /*!< in/out: memory heap */
@@ -1973,7 +1985,7 @@ func_exit_committed:
}
/* Prepare to update (or delete) the record. */
- ulint* cur_offsets = rec_get_offsets(
+ rec_offs* cur_offsets = rec_get_offsets(
btr_pcur_get_rec(&pcur), index, NULL, true,
ULINT_UNDEFINED, &offsets_heap);
@@ -2213,7 +2225,7 @@ row_log_table_apply_op(
mem_heap_t* heap, /*!< in/out: memory heap */
const mrec_t* mrec, /*!< in: merge record */
const mrec_t* mrec_end, /*!< in: end of buffer */
- ulint* offsets) /*!< in/out: work area
+ rec_offs* offsets) /*!< in/out: work area
for parsing mrec */
{
row_log_t* log = dup->index->online_log;
@@ -2531,7 +2543,7 @@ row_log_table_apply_ops(
const mrec_t* next_mrec_end;
mem_heap_t* heap;
mem_heap_t* offsets_heap;
- ulint* offsets;
+ rec_offs* offsets;
bool has_index_lock;
dict_index_t* index = const_cast<dict_index_t*>(
dup->index);
@@ -2557,11 +2569,13 @@ row_log_table_apply_ops(
ut_ad(new_trx_id_col > 0);
ut_ad(new_trx_id_col != ULINT_UNDEFINED);
- UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
+#endif /* HAVE_valgrind_or_MSAN */
- offsets = static_cast<ulint*>(ut_malloc_nokey(i * sizeof *offsets));
- offsets[0] = i;
- offsets[1] = dict_index_get_n_fields(index);
+ offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
+ rec_offs_set_n_alloc(offsets, i);
+ rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
heap = mem_heap_create(UNIV_PAGE_SIZE);
offsets_heap = mem_heap_create(UNIV_PAGE_SIZE);
@@ -3073,7 +3087,7 @@ row_log_apply_op_low(
{
mtr_t mtr;
btr_cur_t cursor;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
ut_ad(!dict_index_is_clust(index));
@@ -3102,7 +3116,7 @@ row_log_apply_op_low(
? BTR_MODIFY_TREE
: BTR_MODIFY_LEAF,
&cursor, 0, __FILE__, __LINE__,
- &mtr);
+ &mtr, 0);
ut_ad(dict_index_get_n_unique(index) > 0);
/* This test is somewhat similar to row_ins_must_modify_rec(),
@@ -3151,7 +3165,7 @@ row_log_apply_op_low(
btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, 0);
/* No other thread than the current one
is allowed to modify the index tree.
@@ -3254,7 +3268,7 @@ insert_the_rec:
btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_LE,
BTR_MODIFY_TREE, &cursor, 0,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, 0);
}
/* We already determined that the
@@ -3307,14 +3321,13 @@ row_log_apply_op(
in exclusive mode */
const mrec_t* mrec, /*!< in: merge record */
const mrec_t* mrec_end, /*!< in: end of buffer */
- ulint* offsets) /*!< in/out: work area for
+ rec_offs* offsets) /*!< in/out: work area for
rec_init_offsets_temp() */
{
enum row_op op;
ulint extra_size;
ulint data_size;
- ulint n_ext;
dtuple_t* entry;
trx_id_t trx_id;
@@ -3392,10 +3405,10 @@ corrupted:
}
entry = row_rec_to_index_entry_low(
- mrec - data_size, index, offsets, &n_ext, heap);
+ mrec - data_size, index, offsets, heap);
/* Online index creation is only implemented for secondary
indexes, which never contain off-page columns. */
- ut_ad(n_ext == 0);
+ ut_ad(dtuple_get_n_ext(entry) == 0);
row_log_apply_op_low(index, dup, error, offsets_heap,
has_index_lock, op, trx_id, entry);
@@ -3426,7 +3439,7 @@ row_log_apply_ops(
const mrec_t* next_mrec_end;
mem_heap_t* offsets_heap;
mem_heap_t* heap;
- ulint* offsets;
+ rec_offs* offsets;
bool has_index_lock;
const ulint i = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
@@ -3435,11 +3448,13 @@ row_log_apply_ops(
ut_ad(!index->is_committed());
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_X));
ut_ad(index->online_log);
- UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
+#endif /* HAVE_valgrind_or_MSAN */
- offsets = static_cast<ulint*>(ut_malloc_nokey(i * sizeof *offsets));
- offsets[0] = i;
- offsets[1] = dict_index_get_n_fields(index);
+ offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
+ rec_offs_set_n_alloc(offsets, i);
+ rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
offsets_heap = mem_heap_create(UNIV_PAGE_SIZE);
heap = mem_heap_create(UNIV_PAGE_SIZE);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 1e7a6156479..6571a7fbfec 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -46,6 +46,9 @@ Completed by Sunny Bains and Marko Makela
#include "row0vers.h"
#include "handler0alter.h"
#include "btr0bulk.h"
+#ifdef BTR_CUR_ADAPT
+# include "btr0sea.h"
+#endif /* BTR_CUR_ADAPT */
#include "ut0stage.h"
#include "fil0crypt.h"
@@ -120,7 +123,7 @@ public:
btr_cur_t ins_cur;
mtr_t mtr;
rtr_info_t rtr_info;
- ulint* ins_offsets = NULL;
+ rec_offs* ins_offsets = NULL;
dberr_t error = DB_SUCCESS;
dtuple_t* dtuple;
ulint count = 0;
@@ -162,7 +165,7 @@ public:
PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_LEAF, &ins_cur,
0, __FILE__, __LINE__,
- &mtr);
+ &mtr, 0);
/* It need to update MBR in parent entry,
so change search mode to BTR_MODIFY_TREE */
@@ -178,7 +181,7 @@ public:
m_index, 0, dtuple,
PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_TREE, &ins_cur, 0,
- __FILE__, __LINE__, &mtr);
+ __FILE__, __LINE__, &mtr, 0);
}
error = btr_cur_optimistic_insert(
@@ -201,8 +204,7 @@ public:
PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_TREE,
&ins_cur, 0,
- __FILE__, __LINE__, &mtr);
-
+ __FILE__, __LINE__, &mtr, 0);
error = btr_cur_pessimistic_insert(
flag, &ins_cur, &ins_offsets,
@@ -518,8 +520,7 @@ row_merge_buf_add(
ulint bucket = 0;
doc_id_t write_doc_id;
ulint n_row_added = 0;
- VCOL_STORAGE* vcol_storage= 0;
- byte* record;
+ VCOL_STORAGE vcol_storage;
DBUG_ENTER("row_merge_buf_add");
if (buf->n_tuples >= buf->max_tuples) {
@@ -553,23 +554,16 @@ row_merge_buf_add(
for (i = 0; i < n_fields; i++, field++, ifield++) {
ulint len;
- const dict_col_t* col;
- ulint col_no;
ulint fixed_len;
const dfield_t* row_field;
-
- col = ifield->col;
- const dict_v_col_t* v_col = NULL;
- if (dict_col_is_virtual(col)) {
- v_col = reinterpret_cast<const dict_v_col_t*>(col);
- }
-
- col_no = dict_col_get_no(col);
+ const dict_col_t* const col = ifield->col;
+ const dict_v_col_t* const v_col = col->is_virtual()
+ ? reinterpret_cast<const dict_v_col_t*>(col)
+ : NULL;
/* Process the Doc ID column */
- if (*doc_id > 0
- && col_no == index->table->fts->doc_col
- && !dict_col_is_virtual(col)) {
+ if (!v_col && *doc_id
+ && col->ind == index->table->fts->doc_col) {
fts_write_doc_id((byte*) &write_doc_id, *doc_id);
/* Note: field->data now points to a value on the
@@ -588,12 +582,15 @@ row_merge_buf_add(
field->type.len = ifield->col->len;
} else {
/* Use callback to get the virtual column value */
- if (dict_col_is_virtual(col)) {
+ if (v_col) {
dict_index_t* clust_index
= dict_table_get_first_index(new_table);
- if (!vcol_storage &&
- innobase_allocate_row_for_vcol(trx->mysql_thd, clust_index, v_heap, &my_table, &record, &vcol_storage)) {
+ if (!vcol_storage.innobase_record &&
+ !innobase_allocate_row_for_vcol(
+ trx->mysql_thd, clust_index,
+ v_heap, &my_table,
+ &vcol_storage)) {
*err = DB_OUT_OF_MEMORY;
goto error;
}
@@ -601,8 +598,8 @@ row_merge_buf_add(
row_field = innobase_get_computed_value(
row, v_col, clust_index,
v_heap, NULL, ifield, trx->mysql_thd,
- my_table, record, old_table, NULL,
- NULL);
+ my_table, vcol_storage.innobase_record,
+ old_table, NULL, NULL);
if (row_field == NULL) {
*err = DB_COMPUTE_VALUE_FAILED;
@@ -610,7 +607,8 @@ row_merge_buf_add(
}
dfield_copy(field, row_field);
} else {
- row_field = dtuple_get_nth_field(row, col_no);
+ row_field = dtuple_get_nth_field(row,
+ col->ind);
dfield_copy(field, row_field);
}
@@ -716,7 +714,7 @@ row_merge_buf_add(
} else if (!ext) {
} else if (dict_index_is_clust(index)) {
/* Flag externally stored fields. */
- const byte* buf = row_ext_lookup(ext, col_no,
+ const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);
@@ -727,9 +725,9 @@ row_merge_buf_add(
len = dfield_get_len(field);
}
}
- } else if (!dict_col_is_virtual(col)) {
+ } else if (!v_col) {
/* Only non-virtual column are stored externally */
- const byte* buf = row_ext_lookup(ext, col_no,
+ const byte* buf = row_ext_lookup(ext, col->ind,
&len);
if (UNIV_LIKELY_NULL(buf)) {
ut_a(buf != field_ref_zero);
@@ -844,13 +842,13 @@ row_merge_buf_add(
}
end:
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
+ if (vcol_storage.innobase_record)
+ innobase_free_row_for_vcol(&vcol_storage);
DBUG_RETURN(n_row_added);
error:
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
+ if (vcol_storage.innobase_record)
+ innobase_free_row_for_vcol(&vcol_storage);
DBUG_RETURN(0);
}
@@ -1025,11 +1023,11 @@ row_merge_buf_write(
ut_a(b < &block[srv_sort_buf_size]);
ut_a(b == &block[0] + buf->total_size);
*b++ = 0;
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind_or_MSAN
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, &block[srv_sort_buf_size] - b);
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind_or_MSAN */
DBUG_LOG("ib_merge_sort",
"write " << reinterpret_cast<const void*>(b) << ','
<< of->fd << ',' << of->offset << " EOF");
@@ -1046,8 +1044,8 @@ row_merge_heap_create(
/*==================*/
const dict_index_t* index, /*!< in: record descriptor */
mrec_buf_t** buf, /*!< out: 3 buffers */
- ulint** offsets1, /*!< out: offsets */
- ulint** offsets2) /*!< out: offsets */
+ rec_offs** offsets1, /*!< out: offsets */
+ rec_offs** offsets2) /*!< out: offsets */
{
ulint i = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
@@ -1056,13 +1054,15 @@ row_merge_heap_create(
*buf = static_cast<mrec_buf_t*>(
mem_heap_alloc(heap, 3 * sizeof **buf));
- *offsets1 = static_cast<ulint*>(
+ *offsets1 = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof **offsets1));
- *offsets2 = static_cast<ulint*>(
+ *offsets2 = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof **offsets2));
- (*offsets1)[0] = (*offsets2)[0] = i;
- (*offsets1)[1] = (*offsets2)[1] = dict_index_get_n_fields(index);
+ rec_offs_set_n_alloc(*offsets1, i);
+ rec_offs_set_n_alloc(*offsets2, i);
+ rec_offs_set_n_fields(*offsets1, dict_index_get_n_fields(index));
+ rec_offs_set_n_fields(*offsets2, dict_index_get_n_fields(index));
return(heap);
}
@@ -1179,7 +1179,7 @@ row_merge_read_rec(
const mrec_t** mrec, /*!< out: pointer to merge record,
or NULL on end of list
(non-NULL on I/O error) */
- ulint* offsets,/*!< out: offsets of mrec */
+ rec_offs* offsets,/*!< out: offsets of mrec */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
{
@@ -1190,7 +1190,7 @@ row_merge_read_rec(
ut_ad(b >= &block[0]);
ut_ad(b < &block[srv_sort_buf_size]);
- ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+ ut_ad(rec_offs_get_n_alloc(offsets) == 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index));
DBUG_ENTER("row_merge_read_rec");
@@ -1297,12 +1297,7 @@ err_exit:
memcpy(*buf, b, avail_size);
*mrec = *buf + extra_size;
- /* We cannot invoke rec_offs_make_valid() here, because there
- are no REC_N_NEW_EXTRA_BYTES between extra_size and data_size.
- Similarly, rec_offs_validate() would fail, because it invokes
- rec_get_status(). */
- ut_d(offsets[2] = (ulint) *mrec);
- ut_d(offsets[3] = (ulint) index);
+ rec_init_offsets_temp(*mrec, index, offsets);
if (!row_merge_read(fd, ++(*foffs), block,
crypt_block,
@@ -1341,7 +1336,7 @@ row_merge_write_rec_low(
ulint foffs, /*!< in: file offset */
#endif /* !DBUG_OFF */
const mrec_t* mrec, /*!< in: record to write */
- const ulint* offsets)/*!< in: offsets of mrec */
+ const rec_offs* offsets)/*!< in: offsets of mrec */
#ifdef DBUG_OFF
# define row_merge_write_rec_low(b, e, size, fd, foffs, mrec, offsets) \
row_merge_write_rec_low(b, e, mrec, offsets)
@@ -1383,7 +1378,7 @@ row_merge_write_rec(
int fd, /*!< in: file descriptor */
ulint* foffs, /*!< in/out: file offset */
const mrec_t* mrec, /*!< in: record to write */
- const ulint* offsets,/*!< in: offsets of mrec */
+ const rec_offs* offsets,/*!< in: offsets of mrec */
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
{
@@ -1426,7 +1421,9 @@ row_merge_write_rec(
return(NULL);
}
- UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&block[0], srv_sort_buf_size);
+#endif /* HAVE_valgrind_or_MSAN */
/* Copy the rest. */
b = &block[0];
@@ -1467,20 +1464,19 @@ row_merge_write_eof(
",fd=" << fd << ',' << *foffs);
*b++ = 0;
- UNIV_MEM_ASSERT_RW(&block[0], b - &block[0]);
- UNIV_MEM_ASSERT_W(&block[0], srv_sort_buf_size);
+ MEM_CHECK_DEFINED(&block[0], b - &block[0]);
+ MEM_CHECK_ADDRESSABLE(&block[0], srv_sort_buf_size);
-#ifdef UNIV_DEBUG_VALGRIND
- /* The rest of the block is uninitialized. Initialize it
- to avoid bogus warnings. */
- memset(b, 0xff, &block[srv_sort_buf_size] - b);
-#endif /* UNIV_DEBUG_VALGRIND */
+ /* The rest of the block is uninitialized. Silence warnings. */
+ MEM_MAKE_DEFINED(b, &block[srv_sort_buf_size] - b);
if (!row_merge_write(fd, (*foffs)++, block, crypt_block, space)) {
DBUG_RETURN(NULL);
}
- UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&block[0], srv_sort_buf_size);
+#endif
DBUG_RETURN(&block[0]);
}
@@ -1899,7 +1895,7 @@ row_merge_read_clustered_index(
}
const rec_t* rec;
- ulint* offsets;
+ rec_offs* offsets;
dtuple_t* row;
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
@@ -2551,8 +2547,10 @@ write_buffers:
break;
}
- UNIV_MEM_INVALID(
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(
&block[0], srv_sort_buf_size);
+#endif /* HAVE_valgrind_or_MSAN */
}
}
merge_buf[i] = row_merge_buf_empty(buf);
@@ -2821,8 +2819,8 @@ row_merge_blocks(
const mrec_t* mrec0; /*!< merge rec, points to block[0] or buf[0] */
const mrec_t* mrec1; /*!< merge rec, points to
block[srv_sort_buf_size] or buf[1] */
- ulint* offsets0;/* offsets of mrec0 */
- ulint* offsets1;/* offsets of mrec1 */
+ rec_offs* offsets0;/* offsets of mrec0 */
+ rec_offs* offsets1;/* offsets of mrec1 */
DBUG_ENTER("row_merge_blocks");
DBUG_LOG("ib_merge_sort",
@@ -2939,8 +2937,8 @@ row_merge_blocks_copy(
const byte* b0; /*!< pointer to block[0] */
byte* b2; /*!< pointer to block[2 * srv_sort_buf_size] */
const mrec_t* mrec0; /*!< merge rec, points to block[0] */
- ulint* offsets0;/* offsets of mrec0 */
- ulint* offsets1;/* dummy offsets */
+ rec_offs* offsets0;/* offsets of mrec0 */
+ rec_offs* offsets1;/* dummy offsets */
DBUG_ENTER("row_merge_blocks_copy");
DBUG_LOG("ib_merge_sort",
@@ -3035,10 +3033,10 @@ row_merge(
ulint n_run = 0;
/*!< num of runs generated from this merge */
- UNIV_MEM_ASSERT_W(&block[0], 3 * srv_sort_buf_size);
+ MEM_CHECK_ADDRESSABLE(&block[0], 3 * srv_sort_buf_size);
if (crypt_block) {
- UNIV_MEM_ASSERT_W(&crypt_block[0], 3 * srv_sort_buf_size);
+ MEM_CHECK_ADDRESSABLE(&crypt_block[0], 3 * srv_sort_buf_size);
}
ut_ad(ihalf < file->offset);
@@ -3059,7 +3057,9 @@ row_merge(
foffs0 = 0;
foffs1 = ihalf;
- UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(run_offset, *num_run * sizeof *run_offset);
+#endif /* HAVE_valgrind_or_MSAN */
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
@@ -3140,7 +3140,9 @@ row_merge(
*tmpfd = file->fd;
*file = of;
- UNIV_MEM_INVALID(&block[0], 3 * srv_sort_buf_size);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&block[0], 3 * srv_sort_buf_size);
+#endif /* HAVE_valgrind_or_MSAN */
return(DB_SUCCESS);
}
@@ -3253,7 +3255,7 @@ row_merge_sort(
break;
}
- UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
+ MEM_CHECK_DEFINED(run_offset, num_runs * sizeof *run_offset);
} while (num_runs > 1);
ut_free(run_offset);
@@ -3279,7 +3281,7 @@ static
void
row_merge_copy_blobs(
const mrec_t* mrec,
- const ulint* offsets,
+ const rec_offs* offsets,
const page_size_t& page_size,
dtuple_t* tuple,
mem_heap_t* heap)
@@ -3388,7 +3390,7 @@ row_merge_insert_index_tuples(
mem_heap_t* tuple_heap;
dberr_t error = DB_SUCCESS;
ulint foffs = 0;
- ulint* offsets;
+ rec_offs* offsets;
mrec_buf_t* buf;
ulint n_rows = 0;
dtuple_t* dtuple;
@@ -3396,7 +3398,6 @@ row_merge_insert_index_tuples(
double curr_progress = 0;
dict_index_t* old_index = NULL;
const mrec_t* mrec = NULL;
- ulint n_ext = 0;
mtr_t mtr;
@@ -3416,10 +3417,10 @@ row_merge_insert_index_tuples(
ulint i = 1 + REC_OFFS_HEADER_SIZE
+ dict_index_get_n_fields(index);
heap = mem_heap_create(sizeof *buf + i * sizeof *offsets);
- offsets = static_cast<ulint*>(
+ offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof *offsets));
- offsets[0] = i;
- offsets[1] = dict_index_get_n_fields(index);
+ rec_offs_set_n_alloc(offsets, i);
+ rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
}
if (row_buf != NULL) {
@@ -3462,8 +3463,6 @@ row_merge_insert_index_tuples(
row buffer to data tuple record */
row_merge_mtuple_to_dtuple(
index, dtuple, &row_buf->tuples[n_rows]);
-
- n_ext = dtuple_get_n_ext(dtuple);
n_rows++;
/* BLOB pointers must be copied from dtuple */
mrec = NULL;
@@ -3482,7 +3481,7 @@ row_merge_insert_index_tuples(
}
dtuple = row_rec_to_index_entry_low(
- mrec, index, offsets, &n_ext, tuple_heap);
+ mrec, index, offsets, tuple_heap);
}
old_index = dict_table_get_first_index(old_table);
@@ -3495,10 +3494,7 @@ row_merge_insert_index_tuples(
}
}
- if (!n_ext) {
- /* There are no externally stored columns. */
- } else {
- ut_ad(dict_index_is_clust(index));
+ if (dict_index_is_clust(index) && dtuple_get_n_ext(dtuple)) {
/* Off-page columns can be fetched safely
when concurrent modifications to the table
are disabled. (Purge can process delete-marked
@@ -3779,6 +3775,9 @@ row_merge_drop_indexes(
we should exclude FTS entries from
prebuilt->ins_node->entry_list
in ins_node_create_entry_list(). */
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!index->search_info->ref_count);
+#endif /* BTR_CUR_HASH_ADAPT */
dict_index_remove_from_cache(
table, index);
index = prev;
@@ -3819,6 +3818,7 @@ row_merge_drop_indexes(
ut_error;
}
+ fts_clear_all(table, trx);
return;
}
@@ -3871,6 +3871,7 @@ row_merge_drop_indexes(
}
}
+ fts_clear_all(table, trx);
table->drop_aborted = FALSE;
ut_d(dict_table_check_for_dup_indexes(table, CHECK_ALL_COMPLETE));
}
@@ -4158,6 +4159,7 @@ Provide a new pathname for a table that is being renamed if it belongs to
a file-per-table tablespace. The caller is responsible for freeing the
memory allocated for the return value.
@return new pathname of tablespace file, or NULL if space = 0 */
+static
char*
row_make_new_pathname(
/*==================*/
@@ -4920,7 +4922,8 @@ wait_again:
goto func_exit;
}
- if (indexes[i]->type & DICT_FTS && fts_enable_diag_print) {
+ if (indexes[i]->type & DICT_FTS
+ && UNIV_UNLIKELY(fts_enable_diag_print)) {
ib::info() << "Finished building full-text index "
<< indexes[i]->name;
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index dabdeeec68b..312c35c58a3 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, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -100,7 +100,7 @@ static UT_LIST_BASE_NODE_T(row_mysql_drop_t) row_mysql_drop_list;
static ib_mutex_t row_drop_list_mutex;
/** Flag: has row_mysql_drop_list been initialized? */
-static ibool row_mysql_drop_list_inited = FALSE;
+static bool row_mysql_drop_list_inited;
/*******************************************************************//**
Determine if the given name is a name reserved for MySQL system tables.
@@ -297,9 +297,7 @@ row_mysql_store_geometry(
{
/* MySQL might assume the field is set to zero except the length and
the pointer fields */
- UNIV_MEM_ASSERT_RW(src, src_len);
- UNIV_MEM_ASSERT_W(dest, dest_len);
- UNIV_MEM_INVALID(dest, dest_len);
+ MEM_CHECK_DEFINED(src, src_len);
memset(dest, '\0', dest_len);
@@ -782,8 +780,7 @@ handle_new_error:
" foreign constraints and try again";
goto rollback_to_savept;
default:
- ib::fatal() << "Unknown error code " << err << ": "
- << ut_strerr(err);
+ ib::fatal() << "Unknown error " << err;
}
if (trx->error_state != DB_SUCCESS) {
@@ -1033,7 +1030,7 @@ row_prebuilt_free(
rtr_clean_rtr_info(prebuilt->rtr_info, true);
}
if (prebuilt->table) {
- dict_table_close(prebuilt->table, dict_locked, TRUE);
+ dict_table_close(prebuilt->table, dict_locked, FALSE);
}
mem_heap_free(prebuilt->heap);
@@ -1092,7 +1089,7 @@ row_get_prebuilt_insert_row(
may need to rebuild the row insert template. */
if (prebuilt->trx_id == table->def_trx_id
- && UT_LIST_GET_LEN(prebuilt->ins_node->entry_list)
+ && prebuilt->ins_node->entry_list.size()
== UT_LIST_GET_LEN(table->indexes)) {
return(prebuilt->ins_node->row);
@@ -1515,7 +1512,7 @@ error_exit:
srv_stats.n_rows_inserted.inc(size_t(trx->id));
}
- /* Not protected by dict_table_stats_lock() for performance
+ /* Not protected by dict_sys->mutex for performance
reasons, we would rather get garbage in stat_n_rows (which is
just an estimate anyway) than protecting the following code
with a latch. */
@@ -1526,7 +1523,7 @@ error_exit:
memcpy(prebuilt->row_id, node->sys_buf, DATA_ROW_ID_LEN);
}
- dict_stats_update_if_needed(table, trx->mysql_thd);
+ dict_stats_update_if_needed(table, *trx);
trx->op_info = "";
if (blob_heap != NULL) {
@@ -1873,7 +1870,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
ut_ad(node->is_delete == is_delete);
if (/*node->*/is_delete) {
- /* Not protected by dict_table_stats_lock() for performance
+ /* Not protected by dict_sys->mutex for performance
reasons, we would rather get garbage in stat_n_rows (which is
just an estimate anyway) than protecting the following code
with a latch. */
@@ -1898,7 +1895,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt)
}
if (update_statistics) {
- dict_stats_update_if_needed(prebuilt->table, trx->mysql_thd);
+ dict_stats_update_if_needed(prebuilt->table, *trx);
} else {
/* Always update the table modification counter. */
prebuilt->table->stat_modified_counter++;
@@ -2003,8 +2000,8 @@ row_unlock_for_mysql(
+ index->trx_id_offset);
} else {
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index, offsets, true,
@@ -2134,7 +2131,7 @@ row_update_cascade_for_mysql(
if (node->is_delete) {
/* Not protected by
- dict_table_stats_lock() for
+ dict_sys->mutex for
performance reasons, we would rather
get garbage in stat_n_rows (which is
just an estimate anyway) than
@@ -2151,8 +2148,7 @@ row_update_cascade_for_mysql(
}
if (stats) {
- dict_stats_update_if_needed(node->table,
- trx->mysql_thd);
+ dict_stats_update_if_needed(node->table, *trx);
} else {
/* Always update the table
modification counter. */
@@ -2460,6 +2456,9 @@ row_create_index_for_mysql(
index->table = table;
err = dict_create_index_tree_in_mem(index, trx);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!index->search_info->ref_count);
+#endif /* BTR_CUR_HASH_ADAPT */
if (err != DB_SUCCESS) {
dict_index_remove_from_cache(table, index);
@@ -2571,15 +2570,33 @@ next:
ut_a(!table->can_be_evicted);
+ bool skip = false;
+
if (!table->to_be_dropped) {
+skip:
dict_table_close(table, FALSE, FALSE);
mutex_enter(&row_drop_list_mutex);
UT_LIST_REMOVE(row_mysql_drop_list, drop);
- UT_LIST_ADD_LAST(row_mysql_drop_list, drop);
+ if (!skip) {
+ UT_LIST_ADD_LAST(row_mysql_drop_list, drop);
+ } else {
+ ut_free(drop);
+ }
goto next;
}
+ if (!srv_fast_shutdown && !trx_sys_any_active_transactions()) {
+ lock_mutex_enter();
+ skip = UT_LIST_GET_LEN(table->locks) != 0;
+ lock_mutex_exit();
+ if (skip) {
+ /* We cannot drop tables that are locked by XA
+ PREPARE transactions. */
+ goto skip;
+ }
+ }
+
char* name = mem_strdup(table->name.m_name);
dict_table_close(table, FALSE, FALSE);
@@ -3056,6 +3073,16 @@ row_discard_tablespace_for_mysql(
err = DB_ERROR;
} else {
+ bool fts_exist = (dict_table_has_fts_index(table)
+ || DICT_TF2_FLAG_IS_SET(
+ table, DICT_TF2_FTS_HAS_DOC_ID));
+
+ if (fts_exist) {
+ row_mysql_unlock_data_dictionary(trx);
+ fts_optimize_remove_table(table);
+ row_mysql_lock_data_dictionary(trx);
+ }
+
/* Do foreign key constraint checks. */
err = row_discard_tablespace_foreign_key_checks(trx, table);
@@ -3063,6 +3090,10 @@ row_discard_tablespace_for_mysql(
if (err == DB_SUCCESS) {
err = row_discard_tablespace(trx, table);
}
+
+ if (fts_exist && err != DB_SUCCESS) {
+ fts_optimize_add_table(table);
+ }
}
return(row_discard_tablespace_end(trx, table, err));
@@ -3145,10 +3176,10 @@ row_drop_ancillary_fts_tables(
dberr_t err = fts_drop_tables(trx, table);
- if (err != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << " Unable to remove ancillary FTS"
" tables for table "
- << table->name << " : " << ut_strerr(err);
+ << table->name << " : " << err;
return(err);
}
@@ -3359,35 +3390,6 @@ row_drop_table_for_mysql(
if (!dict_table_is_temporary(table)) {
if (table->space != TRX_SYS_SPACE) {
-#ifdef BTR_CUR_HASH_ADAPT
- /* On DISCARD TABLESPACE, we would not drop the
- adaptive hash index entries. If the tablespace is
- missing here, delete-marking the record in SYS_INDEXES
- would not free any pages in the buffer pool. Thus,
- dict_index_remove_from_cache() would hang due to
- adaptive hash index entries existing in the buffer
- pool. To prevent this hang, and also to guarantee
- that btr_search_drop_page_hash_when_freed() will avoid
- calling btr_search_drop_page_hash_index() while we
- hold the InnoDB dictionary lock, we will drop any
- adaptive hash index entries upfront. */
- const bool immune = is_temp_name
- || create_failed
- || sqlcom == SQLCOM_CREATE_TABLE
- || strstr(table->name.m_name, "/FTS");
-
- while (buf_LRU_drop_page_hash_for_tablespace(table)) {
- if ((!immune && trx_is_interrupted(trx))
- || srv_shutdown_state
- != SRV_SHUTDOWN_NONE) {
- err = DB_INTERRUPTED;
- table->to_be_dropped = false;
- dict_table_close(table, true, false);
- goto funct_exit;
- }
- }
-#endif /* BTR_CUR_HASH_ADAPT */
-
/* Delete the link file if used. */
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
RemoteDatafile::delete_link_file(name);
@@ -3404,15 +3406,15 @@ row_drop_table_for_mysql(
btr_defragment_remove_table(table);
}
- /* Remove stats for this table and all of its indexes from the
- persistent storage if it exists and if there are stats for this
- table in there. This function creates its own trx and commits
- it. */
- char errstr[1024];
- err = dict_stats_drop_table(name, errstr, sizeof(errstr));
-
- if (err != DB_SUCCESS) {
- ib::warn() << errstr;
+ if (UNIV_LIKELY(!strstr(name, "/" TEMP_FILE_PREFIX_INNODB))) {
+ /* Remove any persistent statistics for this table,
+ in a separate transaction. */
+ char errstr[1024];
+ err = dict_stats_drop_table(name, errstr,
+ sizeof errstr);
+ if (err != DB_SUCCESS) {
+ ib::warn() << errstr;
+ }
}
}
@@ -3711,10 +3713,12 @@ do_drop:
dict_table_t. Free this memory before returning. */
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
dict_get_and_save_data_dir_path(table, true);
- ut_a(table->data_dir_path);
+ ut_ad(table->data_dir_path
+ || dict_table_is_discarded(table));
filepath = fil_make_filepath(
table->data_dir_path,
- table->name.m_name, IBD, true);
+ table->name.m_name, IBD,
+ table->data_dir_path != NULL);
} else {
filepath = fil_make_filepath(
NULL, table->name.m_name, IBD, false);
@@ -3806,6 +3810,11 @@ funct_exit:
trx_commit_for_mysql(trx);
}
+ /* Add the table to fts queue if drop table fails */
+ if (err != DB_SUCCESS && table->fts) {
+ fts_optimize_add_table(table);
+ }
+
row_mysql_unlock_data_dictionary(trx);
}
@@ -3931,9 +3940,21 @@ loop:
avoid accessing dropped fts aux tables in information
scheam when parent table still exists.
Note: Drop parent table will drop fts aux tables. */
- char* parent_table_name;
- parent_table_name = fts_get_parent_table_name(
- table_name, strlen(table_name));
+ char* parent_table_name = NULL;
+ table_id_t table_id;
+ index_id_t index_id;
+
+ if (fts_check_aux_table(
+ table_name, &table_id, &index_id)) {
+ dict_table_t* parent_table = dict_table_open_on_id(
+ table_id, TRUE, DICT_TABLE_OP_NORMAL);
+ if (parent_table != NULL) {
+ parent_table_name = mem_strdupl(
+ parent_table->name.m_name,
+ strlen(parent_table->name.m_name));
+ dict_table_close(parent_table, TRUE, FALSE);
+ }
+ }
if (parent_table_name != NULL) {
ut_free(table_name);
@@ -4015,10 +4036,10 @@ loop:
table_name, trx, SQLCOM_DROP_DB);
trx_commit_for_mysql(trx);
- if (err != DB_SUCCESS) {
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::error() << "DROP DATABASE "
<< ut_get_name(trx, name) << " failed"
- " with error (" << ut_strerr(err) << ") for"
+ " with error (" << err << ") for"
" table " << ut_get_name(trx, table_name);
ut_free(table_name);
break;
@@ -4285,11 +4306,9 @@ row_rename_table_for_mysql(
/* SYS_TABLESPACES and SYS_DATAFILES need to be updated if
the table is in a single-table tablespace. */
- if (err == DB_SUCCESS
- && dict_table_is_file_per_table(table)) {
- /* Make a new pathname to update SYS_DATAFILES. */
- char* new_path = row_make_new_pathname(table, new_name);
- char* old_path = fil_space_get_first_path(table->space);
+ if (err != DB_SUCCESS || !dict_table_is_file_per_table(table)) {
+ } else if (char* old_path = fil_space_get_first_path(table->space)) {
+ char* new_path = os_file_make_new_pathname(old_path, new_name);
/* If old path and new path are the same means tablename
has not changed and only the database name holding the table
@@ -4529,12 +4548,20 @@ end:
if (err != DB_SUCCESS) {
if (old_is_tmp) {
- ib::error() << "In ALTER TABLE "
+ /* In case of copy alter, ignore the
+ loading of foreign key constraint
+ when foreign_key_check is disabled */
+ ib::error_or_warn(trx->check_foreigns)
+ << "In ALTER TABLE "
<< ut_get_name(trx, new_name)
<< " has or is referenced in foreign"
" key constraints which are not"
" compatible with the new table"
" definition.";
+ if (!trx->check_foreigns) {
+ err = DB_SUCCESS;
+ goto funct_exit;
+ }
} else {
ib::error() << "In RENAME TABLE table "
<< ut_get_name(trx, new_name)
@@ -4652,9 +4679,8 @@ row_scan_index_for_mysql(
ulint i;
ulint cnt;
mem_heap_t* heap = NULL;
- ulint n_ext;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets;
rec_offs_init(offsets_);
*n_rows = 0;
@@ -4786,14 +4812,14 @@ not_ok:
tmp_heap = mem_heap_create(size);
- offsets = static_cast<ulint*>(
+ offsets = static_cast<rec_offs*>(
mem_heap_dup(tmp_heap, offsets, size));
}
mem_heap_empty(heap);
prev_entry = row_rec_to_index_entry(
- rec, index, offsets, &n_ext, heap);
+ rec, index, offsets, heap);
if (UNIV_LIKELY_NULL(tmp_heap)) {
mem_heap_free(tmp_heap);
@@ -4818,19 +4844,22 @@ row_mysql_init(void)
row_mysql_drop_list,
&row_mysql_drop_t::row_mysql_drop_list);
- row_mysql_drop_list_inited = TRUE;
+ row_mysql_drop_list_inited = true;
}
-/*********************************************************************//**
-Close this module */
-void
-row_mysql_close(void)
-/*================*/
+void row_mysql_close()
{
- ut_a(UT_LIST_GET_LEN(row_mysql_drop_list) == 0);
-
- if (row_mysql_drop_list_inited) {
- mutex_free(&row_drop_list_mutex);
- row_mysql_drop_list_inited = FALSE;
- }
+ ut_ad(!UT_LIST_GET_LEN(row_mysql_drop_list) ||
+ srv_force_recovery >= SRV_FORCE_NO_BACKGROUND);
+ if (row_mysql_drop_list_inited)
+ {
+ row_mysql_drop_list_inited= false;
+ mutex_free(&row_drop_list_mutex);
+
+ while (row_mysql_drop_t *drop= UT_LIST_GET_FIRST(row_mysql_drop_list))
+ {
+ UT_LIST_REMOVE(row_mysql_drop_list, drop);
+ ut_free(drop);
+ }
+ }
}
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 42aa6123cd6..e79784a5a5f 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -46,7 +46,6 @@ Created 3/14/1997 Heikki Tuuri
#include "handler.h"
#include "ha_innodb.h"
#include "fil0fil.h"
-#include "debug_sync.h"
/*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there
@@ -108,8 +107,8 @@ row_purge_remove_clust_if_poss_low(
mtr_t mtr;
rec_t* rec;
mem_heap_t* heap = NULL;
- ulint* offsets;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_S)
@@ -1005,7 +1004,7 @@ try_again:
dict_table_close(node->table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return(false);
}
os_thread_sleep(1000000);
@@ -1103,8 +1102,7 @@ row_purge_record_func(
if (node->table->stat_initialized
&& srv_stats_include_delete_marked) {
dict_stats_update_if_needed(
- node->table,
- thr->graph->trx->mysql_thd);
+ node->table, *thr->graph->trx);
}
MONITOR_INC(MONITOR_N_DEL_ROW_PURGE);
}
@@ -1169,7 +1167,7 @@ row_purge(
ut_ad(!rw_lock_own(&dict_operation_lock, RW_LOCK_S));
if (purged
- || srv_shutdown_state != SRV_SHUTDOWN_NONE
+ || srv_shutdown_state > SRV_SHUTDOWN_INITIATED
|| node->vcol_op_failed()) {
return;
}
@@ -1210,26 +1208,6 @@ row_purge_step(
node->start();
-#ifdef UNIV_DEBUG
- srv_slot_t *slot = thr->thread_slot;
- ut_ad(slot);
-
- rw_lock_x_lock(&slot->debug_sync_lock);
- while (UT_LIST_GET_LEN(slot->debug_sync)) {
- srv_slot_t::debug_sync_t *sync =
- UT_LIST_GET_FIRST(slot->debug_sync);
- const char* sync_str = reinterpret_cast<char*>(&sync[1]);
- bool result = debug_sync_set_action(current_thd,
- sync_str,
- strlen(sync_str));
- ut_a(!result);
-
- UT_LIST_REMOVE(slot->debug_sync, sync);
- ut_free(sync);
- }
- rw_lock_x_unlock(&slot->debug_sync_lock);
-#endif
-
if (!(node->undo_recs == NULL || ib_vector_is_empty(node->undo_recs))) {
trx_purge_rec_t*purge_rec;
@@ -1284,7 +1262,7 @@ purge_node_t::validate_pcur()
dict_index_t* clust_index = pcur.btr_cur.index;
- ulint* offsets = rec_get_offsets(
+ rec_offs* offsets = rec_get_offsets(
pcur.old_rec, clust_index, NULL, true,
pcur.old_n_fields, &heap);
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index 3e65dc1d28b..774794be225 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -372,7 +372,7 @@ row_build_low(
ulint type,
const dict_index_t* index,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
const dict_table_t* col_table,
const dtuple_t* add_cols,
const dict_add_v_col_t* add_v,
@@ -388,7 +388,7 @@ row_build_low(
byte* buf;
ulint j;
mem_heap_t* tmp_heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
ut_ad(index != NULL);
@@ -435,7 +435,7 @@ row_build_low(
}
/* Avoid a debug assertion in rec_offs_validate(). */
- rec_offs_make_valid(copy, index, const_cast<ulint*>(offsets));
+ rec_offs_make_valid(copy, index, const_cast<rec_offs*>(offsets));
if (!col_table) {
ut_ad(!col_map);
@@ -525,7 +525,7 @@ row_build_low(
}
}
- rec_offs_make_valid(rec, index, const_cast<ulint*>(offsets));
+ rec_offs_make_valid(rec, index, const_cast<rec_offs*>(offsets));
ut_ad(dtuple_check_typed(row));
@@ -578,7 +578,7 @@ row_build(
this record must be at least
s-latched and the latch held
as long as the row dtuple is used! */
- const ulint* offsets,/*!< in: rec_get_offsets(rec,index)
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index)
or NULL, in which case this function
will invoke rec_get_offsets() */
const dict_table_t* col_table,
@@ -631,7 +631,7 @@ row_build_w_add_vcol(
ulint type,
const dict_index_t* index,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
const dict_table_t* col_table,
const dtuple_t* add_cols,
const dict_add_v_col_t* add_v,
@@ -652,9 +652,7 @@ row_rec_to_index_entry_low(
/*=======================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
- ulint* n_ext, /*!< out: number of externally
- stored columns */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
{
@@ -672,8 +670,6 @@ row_rec_to_index_entry_low(
/* Because this function may be invoked by row0merge.cc
on a record whose header is in different format, the check
rec_offs_validate(rec, index, offsets) must be avoided here. */
- ut_ad(n_ext);
- *n_ext = 0;
rec_len = rec_offs_n_fields(offsets);
@@ -698,7 +694,6 @@ row_rec_to_index_entry_low(
if (rec_offs_nth_extern(offsets, i)) {
dfield_set_ext(dfield);
- (*n_ext)++;
}
}
@@ -716,9 +711,7 @@ row_rec_to_index_entry(
/*===================*/
const rec_t* rec, /*!< in: record in the index */
const dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec) */
- ulint* n_ext, /*!< out: number of externally
- stored columns */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
mem_heap_t* heap) /*!< in: memory heap from which
the memory needed is allocated */
{
@@ -737,10 +730,10 @@ row_rec_to_index_entry(
copy_rec = rec_copy(buf, rec, offsets);
- rec_offs_make_valid(copy_rec, index, const_cast<ulint*>(offsets));
+ rec_offs_make_valid(copy_rec, index, const_cast<rec_offs*>(offsets));
entry = row_rec_to_index_entry_low(
- copy_rec, index, offsets, n_ext, heap);
- rec_offs_make_valid(rec, index, const_cast<ulint*>(offsets));
+ copy_rec, index, offsets, heap);
+ rec_offs_make_valid(rec, index, const_cast<rec_offs*>(offsets));
dtuple_set_info_bits(entry,
rec_get_info_bits(rec, rec_offs_comp(offsets)));
@@ -782,8 +775,8 @@ row_build_row_ref(
ulint clust_col_prefix_len;
ulint i;
mem_heap_t* tmp_heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(index != NULL);
@@ -878,7 +871,7 @@ row_build_row_ref_in_tuple(
held as long as the row
reference is used! */
const dict_index_t* index, /*!< in: secondary index */
- ulint* offsets,/*!< in: rec_get_offsets(rec, index)
+ rec_offs* offsets,/*!< in: rec_get_offsets(rec, index)
or NULL */
trx_t* trx) /*!< in: transaction */
{
@@ -891,7 +884,7 @@ row_build_row_ref_in_tuple(
ulint clust_col_prefix_len;
ulint i;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
ut_ad(!dict_index_is_clust(index));
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index dae51354196..0451a240ffc 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -154,11 +154,15 @@ fields are compared with collation!
must be protected by a page s-latch
@param[in] clust_index clustered index
@param[in] thr query thread
-@return TRUE if the secondary record is equal to the corresponding
-fields in the clustered record, when compared with collation;
-FALSE if not equal or if the clustered record has been marked for deletion */
+@retval DB_COMPUTE_VALUE_FAILED in case of virtual column value computation
+ failure.
+@retval DB_SUCCESS_LOCKED_REC if the secondary record is equal to the
+ corresponding fields in the clustered record, when compared with
+ collation;
+@retval DB_SUCCESS if not equal or if the clustered record has been marked
+ for deletion */
static
-ibool
+dberr_t
row_sel_sec_rec_is_for_clust_rec(
const rec_t* sec_rec,
dict_index_t* sec_index,
@@ -172,13 +176,10 @@ row_sel_sec_rec_is_for_clust_rec(
ulint n;
ulint i;
mem_heap_t* heap = NULL;
- ulint clust_offsets_[REC_OFFS_NORMAL_SIZE];
- ulint sec_offsets_[REC_OFFS_SMALL_SIZE];
- ulint* clust_offs = clust_offsets_;
- ulint* sec_offs = sec_offsets_;
- ibool is_equal = TRUE;
- VCOL_STORAGE* vcol_storage= 0;
- byte* record;
+ rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs sec_offsets_[REC_OFFS_SMALL_SIZE];
+ rec_offs* clust_offs = clust_offsets_;
+ rec_offs* sec_offs = sec_offsets_;
rec_offs_init(clust_offsets_);
rec_offs_init(sec_offsets_);
@@ -193,10 +194,11 @@ row_sel_sec_rec_is_for_clust_rec(
it is not visible in the read view. Besides,
if there are any externally stored columns,
some of them may have already been purged. */
- return(FALSE);
+ return DB_SUCCESS;
}
heap = mem_heap_create(256);
+ ib_vcol_row vc(heap);
clust_offs = rec_get_offsets(clust_rec, clust_index, clust_offs,
true, ULINT_UNDEFINED, &heap);
@@ -225,16 +227,9 @@ row_sel_sec_rec_is_for_clust_rec(
dfield_t* vfield;
row_ext_t* ext;
- if (!vcol_storage)
- {
- TABLE *mysql_table= thr->prebuilt->m_mysql_table;
- innobase_allocate_row_for_vcol(thr_get_trx(thr)->mysql_thd,
- clust_index,
- &heap,
- &mysql_table,
- &record,
- &vcol_storage);
- }
+ byte *record = vc.record(thr_get_trx(thr)->mysql_thd,
+ clust_index,
+ &thr->prebuilt->m_mysql_table);
v_col = reinterpret_cast<const dict_v_col_t*>(col);
@@ -251,6 +246,10 @@ row_sel_sec_rec_is_for_clust_rec(
thr->prebuilt->m_mysql_table,
record, NULL, NULL, NULL);
+ if (vfield == NULL) {
+ innobase_report_computed_value_failed(row);
+ return DB_COMPUTE_VALUE_FAILED;
+ }
clust_len = vfield->len;
clust_field = static_cast<byte*>(vfield->data);
} else {
@@ -284,7 +283,7 @@ row_sel_sec_rec_is_for_clust_rec(
sec_field, sec_len,
ifield->prefix_len,
clust_index->table)) {
- goto inequal;
+ return DB_SUCCESS;
}
continue;
@@ -320,28 +319,19 @@ row_sel_sec_rec_is_for_clust_rec(
rtr_read_mbr(sec_field, &sec_mbr);
if (!MBR_EQUAL_CMP(&sec_mbr, &tmp_mbr)) {
- is_equal = FALSE;
- goto func_exit;
+ return DB_SUCCESS;
}
} else {
if (0 != cmp_data_data(col->mtype, col->prtype,
clust_field, len,
sec_field, sec_len)) {
-inequal:
- is_equal = FALSE;
- goto func_exit;
+ return DB_SUCCESS;
}
}
}
-func_exit:
- if (UNIV_LIKELY_NULL(heap)) {
- if (UNIV_LIKELY_NULL(vcol_storage))
- innobase_free_row_for_vcol(vcol_storage);
- mem_heap_free(heap);
- }
- return(is_equal);
+ return DB_SUCCESS_LOCKED_REC;
}
/*********************************************************************//**
@@ -494,7 +484,7 @@ row_sel_fetch_columns(
dict_index_t* index, /*!< in: record index */
const rec_t* rec, /*!< in: record in a clustered or non-clustered
index; must be protected by a page latch */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
sym_node_t* column) /*!< in: first column in a column list, or
NULL */
{
@@ -761,7 +751,7 @@ row_sel_build_prev_vers(
ReadView* read_view, /*!< in: read view */
dict_index_t* index, /*!< in: plan node for table */
rec_t* rec, /*!< in: record in a clustered index */
- ulint** offsets, /*!< in/out: offsets returned by
+ rec_offs** offsets, /*!< in/out: offsets returned by
rec_get_offsets(rec, plan->index) */
mem_heap_t** offset_heap, /*!< in/out: memory heap from which
the offsets are allocated */
@@ -796,7 +786,7 @@ row_sel_build_committed_vers_for_mysql(
dict_index_t* clust_index, /*!< in: clustered index */
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
const rec_t* rec, /*!< in: record in a clustered index */
- ulint** offsets, /*!< in/out: offsets returned by
+ rec_offs** offsets, /*!< in/out: offsets returned by
rec_get_offsets(rec, clust_index) */
mem_heap_t** offset_heap, /*!< in/out: memory heap from which
the offsets are allocated */
@@ -908,10 +898,10 @@ row_sel_get_clust_rec(
dict_index_t* index;
rec_t* clust_rec;
rec_t* old_vers;
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
*out_rec = NULL;
@@ -950,7 +940,7 @@ row_sel_get_clust_rec(
clustered index record did not exist in the read view of
trx. */
- goto func_exit;
+ goto err_exit;
}
offsets = rec_get_offsets(clust_rec, index, offsets, true,
@@ -984,9 +974,11 @@ row_sel_get_clust_rec(
switch (err) {
case DB_SUCCESS:
case DB_SUCCESS_LOCKED_REC:
- /* Declare the variable uninitialized in Valgrind.
+#ifdef HAVE_valgrind_or_MSAN
+ /* Declare the variable uninitialized.
It should be set to DB_SUCCESS at func_exit. */
- UNIV_MEM_INVALID(&err, sizeof err);
+ MEM_UNDEFINED(&err, sizeof err);
+#endif /* HAVE_valgrind_or_MSAN */
break;
default:
goto err_exit;
@@ -1013,7 +1005,7 @@ row_sel_get_clust_rec(
clust_rec = old_vers;
if (clust_rec == NULL) {
- goto func_exit;
+ goto err_exit;
}
}
@@ -1030,13 +1022,14 @@ row_sel_get_clust_rec(
visit through secondary index records that would not really
exist in our snapshot. */
- if ((old_vers
- || rec_get_deleted_flag(rec, dict_table_is_comp(
- plan->table)))
- && !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
- clust_rec, index,
- thr)) {
- goto func_exit;
+ if (old_vers || rec_get_deleted_flag(rec, dict_table_is_comp(
+ plan->table))) {
+ err = row_sel_sec_rec_is_for_clust_rec(rec,
+ plan->index, clust_rec,
+ index, thr);
+ if (err != DB_SUCCESS_LOCKED_REC) {
+ goto err_exit;
+ }
}
}
@@ -1049,7 +1042,6 @@ row_sel_get_clust_rec(
row_sel_fetch_columns(index, clust_rec, offsets,
UT_LIST_GET_FIRST(plan->columns));
*out_rec = clust_rec;
-func_exit:
err = DB_SUCCESS;
err_exit:
if (UNIV_LIKELY_NULL(heap)) {
@@ -1070,7 +1062,7 @@ sel_set_rtr_rec_lock(
btr_pcur_t* pcur, /*!< in: cursor */
const rec_t* first_rec,/*!< in: record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */
@@ -1082,8 +1074,8 @@ sel_set_rtr_rec_lock(
dberr_t err = DB_SUCCESS;
trx_t* trx = thr_get_trx(thr);
buf_block_t* cur_block = btr_pcur_get_block(pcur);
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* my_offsets = const_cast<ulint*>(offsets);
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* my_offsets = const_cast<rec_offs*>(offsets);
rec_t* rec = const_cast<rec_t*>(first_rec);
rtr_rec_vector* match_rec;
rtr_rec_vector::iterator end;
@@ -1235,7 +1227,7 @@ sel_set_rec_lock(
btr_pcur_t* pcur, /*!< in: cursor */
const rec_t* rec, /*!< in: record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint mode, /*!< in: lock mode */
ulint type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or
LOC_REC_NOT_GAP */
@@ -1289,23 +1281,17 @@ void
row_sel_open_pcur(
/*==============*/
plan_t* plan, /*!< in: table plan */
- ibool search_latch_locked,
- /*!< in: TRUE if the thread currently
- has the search latch locked in
- s-mode */
+#ifdef BTR_CUR_HASH_ADAPT
+ ulint has_search_latch,
+#endif
mtr_t* mtr) /*!< in: mtr */
{
dict_index_t* index;
func_node_t* cond;
que_node_t* exp;
ulint n_fields;
- ulint has_search_latch = 0; /* RW_S_LATCH or 0 */
ulint i;
- if (search_latch_locked) {
- has_search_latch = RW_S_LATCH;
- }
-
index = plan->index;
/* Calculate the value of the search tuple: the exact match columns
@@ -1357,6 +1343,11 @@ row_sel_open_pcur(
plan->pcur_is_open = TRUE;
}
+#ifndef BTR_CUR_HASH_ADAPT
+# define row_sel_open_pcur(plan, has_search_latch, mtr) \
+ row_sel_open_pcur(plan, mtr)
+#endif /* !BTR_CUR_HASH_ADAPT */
+
/*********************************************************************//**
Restores a stored pcur position to a table index.
@return TRUE if the cursor should be moved to the next record after we
@@ -1486,8 +1477,8 @@ row_sel_try_search_shortcut(
dict_index_t* index;
rec_t* rec;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
ulint ret;
rec_offs_init(offsets_);
@@ -1612,18 +1603,12 @@ row_sel(
to the next non-clustered record */
dberr_t err;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(thr->run_node == node);
-#ifdef BTR_CUR_HASH_ADAPT
- ibool search_latch_locked = FALSE;
-#else /* BTR_CUR_HASH_ADAPT */
-# define search_latch_locked false
-#endif /* BTR_CUR_HASH_ADAPT */
-
if (node->read_view) {
/* In consistent reads, we try to do with the hash index and
not to use the buffer page get. This is to reduce memory bus
@@ -1648,6 +1633,10 @@ table_loop:
plan = sel_node_get_nth_plan(node, node->fetch_table);
index = plan->index;
+#ifdef BTR_CUR_HASH_ADAPT
+ ulint has_search_latch = 0;
+ rw_lock_t* const latch = btr_get_search_latch(index);
+#endif /* BTR_CUR_HASH_ADAPT */
if (plan->n_rows_prefetched > 0) {
sel_dequeue_prefetched_row(plan);
@@ -1672,26 +1661,22 @@ table_loop:
#ifdef BTR_CUR_HASH_ADAPT
if (consistent_read && plan->unique_search && !plan->pcur_is_open
&& !plan->must_get_clust) {
- if (!search_latch_locked) {
- btr_search_s_lock(index);
-
- search_latch_locked = TRUE;
- } else if (rw_lock_get_writer(btr_get_search_latch(index))
- == RW_LOCK_X_WAIT) {
-
+ if (!has_search_latch) {
+ has_search_latch = RW_S_LATCH;
+ rw_lock_s_lock(latch);
+ } else if (rw_lock_get_writer(latch) == RW_LOCK_X_WAIT) {
/* There is an x-latch request waiting: release the
s-latch for a moment; as an s-latch here is often
kept for some 10 searches before being released,
a waiting x-latch request would block other threads
from acquiring an s-latch for a long time, lowering
performance significantly in multiprocessors. */
-
- btr_search_s_unlock(index);
- btr_search_s_lock(index);
+ rw_lock_s_unlock(latch);
+ rw_lock_s_lock(latch);
}
switch (row_sel_try_search_shortcut(node, plan,
- search_latch_locked,
+ has_search_latch,
&mtr)) {
case SEL_FOUND:
goto next_table;
@@ -1709,10 +1694,9 @@ table_loop:
mtr.start();
}
- if (search_latch_locked) {
- btr_search_s_unlock(index);
-
- search_latch_locked = FALSE;
+ if (has_search_latch) {
+ has_search_latch = 0;
+ rw_lock_s_unlock(latch);
}
#endif /* BTR_CUR_HASH_ADAPT */
@@ -1720,7 +1704,7 @@ table_loop:
/* Evaluate the expressions to build the search tuple and
open the cursor */
- row_sel_open_pcur(plan, search_latch_locked, &mtr);
+ row_sel_open_pcur(plan, has_search_latch, &mtr);
cursor_just_opened = TRUE;
@@ -2117,7 +2101,9 @@ skip_lock:
}
next_rec:
- ut_ad(!search_latch_locked);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!has_search_latch);
+#endif /* BTR_CUR_HASH_ADAPT */
if (mtr_has_extra_clust_latch) {
@@ -2156,8 +2142,9 @@ next_table:
plan->cursor_at_end = TRUE;
} else {
- ut_ad(!search_latch_locked);
-
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!has_search_latch);
+#endif /* BTR_CUR_HASH_ADAPT */
plan->stored_cursor_rec_processed = TRUE;
btr_pcur_store_position(&(plan->pcur), &mtr);
@@ -2248,8 +2235,9 @@ stop_for_a_while:
inserted new records which should have appeared in the result set,
which would result in the phantom problem. */
- ut_ad(!search_latch_locked);
-
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!has_search_latch);
+#endif /* BTR_CUR_HASH_ADAPT */
plan->stored_cursor_rec_processed = FALSE;
btr_pcur_store_position(&(plan->pcur), &mtr);
@@ -2266,7 +2254,9 @@ commit_mtr_for_a_while:
plan->stored_cursor_rec_processed = TRUE;
- ut_ad(!search_latch_locked);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!has_search_latch);
+#endif /* BTR_CUR_HASH_ADAPT */
btr_pcur_store_position(&(plan->pcur), &mtr);
mtr.commit();
@@ -2280,7 +2270,9 @@ lock_wait_or_error:
/* See the note at stop_for_a_while: the same holds for this case */
ut_ad(!btr_pcur_is_before_first_on_page(&plan->pcur) || !node->asc);
- ut_ad(!search_latch_locked);
+#ifdef BTR_CUR_HASH_ADAPT
+ ut_ad(!has_search_latch);
+#endif /* BTR_CUR_HASH_ADAPT */
plan->stored_cursor_rec_processed = FALSE;
btr_pcur_store_position(&(plan->pcur), &mtr);
@@ -2289,8 +2281,8 @@ lock_wait_or_error:
func_exit:
#ifdef BTR_CUR_HASH_ADAPT
- if (search_latch_locked) {
- btr_search_s_unlock(index);
+ if (has_search_latch) {
+ rw_lock_s_unlock(latch);
}
#endif /* BTR_CUR_HASH_ADAPT */
ut_ad(!sync_check_iterate(dict_sync_check()));
@@ -2760,7 +2752,7 @@ 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
+ const rec_offs* offsets) /*!< in: rec_get_offsets
(index_rec, index) */
{
const byte* data;
@@ -2811,9 +2803,11 @@ row_sel_field_store_in_mysql_format_func(
#endif /* UNIV_DEBUG */
ut_ad(len != UNIV_SQL_NULL);
- UNIV_MEM_ASSERT_RW(data, len);
- UNIV_MEM_ASSERT_W(dest, templ->mysql_col_len);
- UNIV_MEM_INVALID(dest, templ->mysql_col_len);
+ MEM_CHECK_DEFINED(data, len);
+ MEM_CHECK_ADDRESSABLE(dest, templ->mysql_col_len);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(dest, templ->mysql_col_len);
+#endif /* HAVE_valgrind_or_MSAN */
switch (templ->type) {
const byte* field_end;
@@ -2996,7 +2990,7 @@ row_sel_store_mysql_field_func(
#ifdef UNIV_DEBUG
const dict_index_t* index,
#endif
- const ulint* offsets,
+ const rec_offs* offsets,
ulint field_no,
const mysql_row_templ_t*templ)
{
@@ -3075,9 +3069,9 @@ row_sel_store_mysql_field_func(
NULL value is set to the default value. */
ut_ad(templ->mysql_null_bit_mask);
- UNIV_MEM_ASSERT_RW(prebuilt->default_rec
- + templ->mysql_col_offset,
- templ->mysql_col_len);
+ MEM_CHECK_DEFINED(prebuilt->default_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
memcpy(mysql_rec + templ->mysql_col_offset,
@@ -3152,7 +3146,7 @@ static bool row_sel_store_mysql_rec(
const dtuple_t* vrow,
bool rec_clust,
const dict_index_t* index,
- const ulint* offsets)
+ const rec_offs* offsets)
{
DBUG_ENTER("row_sel_store_mysql_rec");
@@ -3283,7 +3277,7 @@ row_sel_build_prev_vers_for_mysql(
dict_index_t* clust_index, /*!< in: clustered index */
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
const rec_t* rec, /*!< in: record in a clustered index */
- ulint** offsets, /*!< in/out: offsets returned by
+ rec_offs** offsets, /*!< in/out: offsets returned by
rec_get_offsets(rec, clust_index) */
mem_heap_t** offset_heap, /*!< in/out: memory heap from which
the offsets are allocated */
@@ -3309,20 +3303,46 @@ row_sel_build_prev_vers_for_mysql(
return(err);
}
-/** Helper class to cache clust_rec and old_ver */
+/** Helper class to cache clust_rec and old_vers */
class Row_sel_get_clust_rec_for_mysql
{
- const rec_t *cached_clust_rec;
- rec_t *cached_old_vers;
+ const rec_t *cached_clust_rec;
+ rec_t *cached_old_vers;
+ lsn_t cached_lsn;
+ page_id_t cached_page_id;
-public:
- Row_sel_get_clust_rec_for_mysql() :
- cached_clust_rec(NULL), cached_old_vers(NULL) {}
+#ifdef UNIV_DEBUG
+ void check_eq(const dict_index_t *index, const rec_offs *offsets) const
+ {
+ rec_offs vers_offs[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS];
+ rec_offs_init(vers_offs);
+ mem_heap_t *heap= NULL;
+
+ ut_ad(rec_offs_validate(cached_clust_rec, index, offsets));
+ ut_ad(index->first_user_field() <= rec_offs_n_fields(offsets));
+ ut_ad(vers_offs == rec_get_offsets(cached_old_vers, index, vers_offs, true,
+ index->db_trx_id(), &heap));
+ ut_ad(!heap);
+ for (unsigned n= index->db_trx_id(); n--; )
+ {
+ const dict_col_t *col= dict_index_get_nth_col(index, n);
+ ulint len1, len2;
+ const byte *b1= rec_get_nth_field(cached_clust_rec, offsets, n, &len1);
+ const byte *b2= rec_get_nth_field(cached_old_vers, vers_offs, n, &len2);
+ ut_ad(!cmp_data_data(col->mtype, col->prtype, b1, len1, b2, len2));
+ }
+ }
+#endif
- dberr_t operator()(row_prebuilt_t *prebuilt, dict_index_t *sec_index,
- const rec_t *rec, que_thr_t *thr, const rec_t **out_rec,
- ulint **offsets, mem_heap_t **offset_heap,
- dtuple_t **vrow, mtr_t *mtr);
+public:
+ Row_sel_get_clust_rec_for_mysql() :
+ cached_clust_rec(NULL), cached_old_vers(NULL), cached_lsn(0),
+ cached_page_id(page_id_t(0,0)) {}
+
+ dberr_t operator()(row_prebuilt_t *prebuilt, dict_index_t *sec_index,
+ const rec_t *rec, que_thr_t *thr, const rec_t **out_rec,
+ rec_offs **offsets, mem_heap_t **offset_heap,
+ dtuple_t **vrow, mtr_t *mtr);
};
/*********************************************************************//**
@@ -3344,7 +3364,7 @@ Row_sel_get_clust_rec_for_mysql::operator()(
it, NULL if the old version did not exist
in the read view, i.e., it was a fresh
inserted version */
- ulint** offsets,/*!< in: offsets returned by
+ rec_offs** offsets,/*!< in: offsets returned by
rec_get_offsets(rec, sec_index);
out: offsets returned by
rec_get_offsets(out_rec, clust_index) */
@@ -3522,8 +3542,18 @@ Row_sel_get_clust_rec_for_mysql::operator()(
&& !lock_clust_rec_cons_read_sees(
clust_rec, clust_index, *offsets,
trx_get_read_view(trx))) {
+ const buf_page_t& bpage = btr_pcur_get_block(
+ prebuilt->clust_pcur)->page;
+
+ lsn_t lsn = bpage.newest_modification;
+ if (!lsn) {
+ lsn = mach_read_from_8(
+ page_align(clust_rec) + FIL_PAGE_LSN);
+ }
- if (clust_rec != cached_clust_rec) {
+ if (lsn != cached_lsn
+ || bpage.id != cached_page_id
+ || clust_rec != cached_clust_rec) {
/* The following call returns 'offsets' associated with
'old_vers' */
err = row_sel_build_prev_vers_for_mysql(
@@ -3535,6 +3565,8 @@ Row_sel_get_clust_rec_for_mysql::operator()(
goto err_exit;
}
+ cached_lsn = lsn;
+ cached_page_id = bpage.id;
cached_clust_rec = clust_rec;
cached_old_vers = old_vers;
} else {
@@ -3545,7 +3577,8 @@ Row_sel_get_clust_rec_for_mysql::operator()(
version of clust_rec and its old version
old_vers. Re-calculate the offsets for old_vers. */
- if (old_vers != NULL) {
+ if (old_vers) {
+ ut_d(check_eq(clust_index, *offsets));
*offsets = rec_get_offsets(
old_vers, clust_index, *offsets,
true, ULINT_UNDEFINED, offset_heap);
@@ -3579,10 +3612,18 @@ Row_sel_get_clust_rec_for_mysql::operator()(
|| trx->isolation_level <= TRX_ISO_READ_UNCOMMITTED
|| dict_index_is_spatial(sec_index)
|| rec_get_deleted_flag(rec, dict_table_is_comp(
- sec_index->table)))
- && !row_sel_sec_rec_is_for_clust_rec(
- rec, sec_index, clust_rec, clust_index, thr)) {
- clust_rec = NULL;
+ sec_index->table)))) {
+ err = row_sel_sec_rec_is_for_clust_rec(rec, sec_index,
+ clust_rec, clust_index, thr);
+ switch (err) {
+ case DB_SUCCESS:
+ clust_rec = NULL;
+ break;
+ case DB_SUCCESS_LOCKED_REC:
+ break;
+ default:
+ goto err_exit;
+ }
}
err = DB_SUCCESS;
@@ -3715,7 +3756,7 @@ row_sel_copy_cached_field_for_mysql(
buf += templ->mysql_col_offset;
cache += templ->mysql_col_offset;
- UNIV_MEM_ASSERT_W(buf, templ->mysql_col_len);
+ MEM_CHECK_ADDRESSABLE(buf, templ->mysql_col_len);
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR
&& (templ->type != DATA_INT)) {
@@ -3725,7 +3766,9 @@ row_sel_copy_cached_field_for_mysql(
row_mysql_read_true_varchar(
&len, cache, templ->mysql_length_bytes);
len += templ->mysql_length_bytes;
- UNIV_MEM_INVALID(buf, templ->mysql_col_len);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(buf, templ->mysql_col_len);
+#endif /* HAVE_valgrind_or_MSAN */
} else {
len = templ->mysql_col_len;
}
@@ -3784,7 +3827,7 @@ row_sel_dequeue_cached_row_for_mysql(
ut_ad(prebuilt->n_fetch_cached > 0);
ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
- UNIV_MEM_ASSERT_W(buf, prebuilt->mysql_row_len);
+ MEM_CHECK_ADDRESSABLE(buf, prebuilt->mysql_row_len);
cached_rec = prebuilt->fetch_cache[prebuilt->fetch_cache_first];
@@ -3794,7 +3837,9 @@ row_sel_dequeue_cached_row_for_mysql(
/* The record is long. Copy it field by field, in case
there are some long VARCHAR column of which only a
small length is being used. */
- UNIV_MEM_INVALID(buf, prebuilt->mysql_prefix_len);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(buf, prebuilt->mysql_prefix_len);
+#endif /* HAVE_valgrind_or_MSAN */
/* First copy the NULL bits. */
ut_memcpy(buf, cached_rec, prebuilt->null_bitmap_len);
@@ -3878,8 +3923,10 @@ row_sel_fetch_last_buf(
}
ut_ad(prebuilt->fetch_cache_first == 0);
- UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
- prebuilt->mysql_row_len);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+ prebuilt->mysql_row_len);
+#endif /* HAVE_valgrind_or_MSAN */
return(prebuilt->fetch_cache[prebuilt->n_fetch_cached]);
}
@@ -3918,7 +3965,7 @@ row_sel_try_search_shortcut_for_mysql(
/*==================================*/
const rec_t** out_rec,/*!< out: record if found */
row_prebuilt_t* prebuilt,/*!< in: prebuilt struct */
- ulint** offsets,/*!< in/out: for rec_get_offsets(*out_rec) */
+ rec_offs** offsets,/*!< in/out: for rec_get_offsets(*out_rec) */
mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */
mtr_t* mtr) /*!< in: started mtr */
{
@@ -3977,7 +4024,7 @@ row_sel_try_search_shortcut_for_mysql(
/*********************************************************************//**
Check a pushed-down index condition.
-@return ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
+@return ICP_ABORTED_BY_USER, ICP_NO_MATCH, ICP_MATCH, or ICP_OUT_OF_RANGE */
static
ICP_RESULT
row_search_idx_cond_check(
@@ -3989,7 +4036,7 @@ row_search_idx_cond_check(
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct
for the table handle */
const rec_t* rec, /*!< in: InnoDB record */
- const ulint* offsets) /*!< in: rec_get_offsets() */
+ const rec_offs* offsets) /*!< in: rec_get_offsets() */
{
ICP_RESULT result;
ulint i;
@@ -4077,8 +4124,8 @@ row_sel_fill_vrow(
dtuple_t** vrow,
mem_heap_t* heap)
{
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!(*vrow));
@@ -4129,7 +4176,7 @@ rec_field_len_in_chars(
const dict_col_t* col,
const ulint field_no,
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
const ulint cset = dtype_get_charset_coll(col->prtype);
const CHARSET_INFO* cs = all_charsets[cset];
@@ -4156,11 +4203,15 @@ static
bool row_search_with_covering_prefix(
row_prebuilt_t* prebuilt,
const rec_t* rec,
- const ulint* offsets)
+ const rec_offs* offsets)
{
const dict_index_t* index = prebuilt->index;
ut_ad(!dict_index_is_clust(index));
+ if (dict_index_is_spatial(index)) {
+ return false;
+ }
+
if (!srv_prefix_index_cluster_optimization) {
return false;
}
@@ -4171,9 +4222,16 @@ bool row_search_with_covering_prefix(
return false;
}
+ /* We can avoid a clustered index lookup if
+ all of the following hold:
+ (1) all columns are in the secondary index
+ (2) all values for columns that are prefix-only
+ indexes are shorter than the prefix size
+ This optimization can avoid many IOs for certain schemas. */
for (ulint i = 0; i < prebuilt->n_template; i++) {
mysql_row_templ_t* templ = prebuilt->mysql_template + i;
ulint j = templ->rec_prefix_field_no;
+ ut_ad(!templ->mbminlen == !templ->mbmaxlen);
/** Condition (1) : is the field in the index. */
if (j == ULINT_UNDEFINED) {
@@ -4183,33 +4241,29 @@ bool row_search_with_covering_prefix(
/** Condition (2): If this is a prefix index then
row's value size shorter than prefix length. */
- if (!templ->rec_field_is_prefix) {
+ if (!templ->rec_field_is_prefix
+ || rec_offs_nth_sql_null(offsets, j)) {
continue;
}
- ulint rec_size = rec_offs_nth_size(offsets, j);
const dict_field_t* field = dict_index_get_nth_field(index, j);
- ulint max_chars = field->prefix_len / templ->mbmaxlen;
-
- ut_a(field->prefix_len > 0);
- if (rec_size < max_chars) {
- /* Record in bytes shorter than the index
- prefix length in char. */
+ if (!field->prefix_len) {
continue;
}
- if (rec_size * templ->mbminlen >= field->prefix_len) {
+ const ulint rec_size = rec_offs_nth_size(offsets, j);
+
+ if (rec_size >= field->prefix_len) {
/* Shortest representation string by the
byte length of the record is longer than the
maximum possible index prefix. */
return false;
}
- size_t num_chars = rec_field_len_in_chars(
- field->col, j, rec, offsets);
-
- if (num_chars >= max_chars) {
+ if (templ->mbminlen != templ->mbmaxlen
+ && rec_field_len_in_chars(field->col, j, rec, offsets)
+ >= field->prefix_len / templ->mbmaxlen) {
/* No of chars to store the record exceeds
the index prefix character length. */
return false;
@@ -4285,8 +4339,8 @@ row_search_mvcc(
ibool same_user_rec;
mtr_t mtr;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
ibool table_lock_waited = FALSE;
byte* next_buf = 0;
bool spatial_search = false;
@@ -4460,7 +4514,6 @@ row_search_mvcc(
&& !prebuilt->templ_contains_blob
&& !prebuilt->used_in_HANDLER
&& (prebuilt->mysql_row_len < UNIV_PAGE_SIZE / 8)) {
-
mode = PAGE_CUR_GE;
if (trx->mysql_n_tables_locked == 0
@@ -4480,7 +4533,8 @@ row_search_mvcc(
and if we try that, we can deadlock on the adaptive
hash index semaphore! */
- rw_lock_s_lock(btr_get_search_latch(index));
+ rw_lock_t* const latch = btr_get_search_latch(index);
+ rw_lock_s_lock(latch);
switch (row_sel_try_search_shortcut_for_mysql(
&rec, prebuilt, &offsets, &heap,
@@ -4497,10 +4551,13 @@ row_search_mvcc(
switch (row_search_idx_cond_check(
buf, prebuilt,
rec, offsets)) {
- case ICP_NO_MATCH:
- case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
+ mtr_commit(&mtr);
+ err = DB_INTERRUPTED;
+ goto unlock_and_exit;
case ICP_ERROR:
+ case ICP_NO_MATCH:
+ case ICP_OUT_OF_RANGE:
goto shortcut_mismatch;
case ICP_MATCH:
goto shortcut_match;
@@ -4528,14 +4585,11 @@ row_search_mvcc(
shortcut_match:
mtr.commit();
-
+ err = DB_SUCCESS;
+ unlock_and_exit:
/* NOTE that we do NOT store the cursor
position */
-
- err = DB_SUCCESS;
-
- rw_lock_s_unlock(btr_get_search_latch(index));
-
+ rw_lock_s_unlock(latch);
goto func_exit;
case SEL_EXHAUSTED:
@@ -4543,13 +4597,7 @@ row_search_mvcc(
mtr.commit();
err = DB_RECORD_NOT_FOUND;
-
- rw_lock_s_unlock(btr_get_search_latch(index));
-
- /* NOTE that we do NOT store the cursor
- position */
-
- goto func_exit;
+ goto unlock_and_exit;
case SEL_RETRY:
break;
@@ -4561,7 +4609,7 @@ row_search_mvcc(
mtr.commit();
mtr.start();
- rw_lock_s_unlock(btr_get_search_latch(index));
+ rw_lock_s_unlock(latch);
}
}
#endif /* BTR_CUR_HASH_ADAPT */
@@ -5282,8 +5330,10 @@ no_gap_lock:
buf, prebuilt, rec, offsets)) {
case ICP_NO_MATCH:
goto next_rec;
- case ICP_OUT_OF_RANGE:
case ICP_ABORTED_BY_USER:
+ err = DB_INTERRUPTED;
+ goto idx_cond_failed;
+ case ICP_OUT_OF_RANGE:
case ICP_ERROR:
err = DB_RECORD_NOT_FOUND;
goto idx_cond_failed;
@@ -5342,9 +5392,11 @@ locks_ok_del_marked:
row_unlock_for_mysql(prebuilt, TRUE);
}
goto next_rec;
+ case ICP_ABORTED_BY_USER:
+ err = DB_INTERRUPTED;
+ goto idx_cond_failed;
case ICP_OUT_OF_RANGE:
- case ICP_ABORTED_BY_USER:
- case ICP_ERROR:
+ case ICP_ERROR:
err = DB_RECORD_NOT_FOUND;
goto idx_cond_failed;
case ICP_MATCH:
@@ -5995,8 +6047,8 @@ row_search_autoinc_read_column(
const byte* data;
ib_uint64_t value;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(page_rec_is_leaf(rec));
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 5e512c602e6..618e161bee4 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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,6 +39,7 @@ Created 2013-04-12 Sunny Bains
#include "os0file.h"
#include "que0que.h"
#include "trx0undo.h"
+#include "btr0sea.h"
/* FIXME: For temporary tables, use a simple approach of btr_free()
and btr_create() of each index tree. */
@@ -1953,7 +1954,6 @@ dberr_t row_truncate_table_for_mysql(dict_table_t* table, trx_t* trx)
for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
index != NULL;
index = UT_LIST_GET_NEXT(indexes, index)) {
-
err = dict_truncate_index_tree_in_mem(index);
if (err != DB_SUCCESS) {
@@ -2003,6 +2003,15 @@ dberr_t row_truncate_table_for_mysql(dict_table_t* table, trx_t* trx)
os_thread_sleep(2000000);
DBUG_SUICIDE(););
+#ifdef BTR_CUR_HASH_ADAPT
+ dict_table_x_unlock_indexes(table);
+ for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes); index;
+ index = UT_LIST_GET_NEXT(indexes, index)) {
+ index = index->clone_if_needed();
+ }
+ dict_table_x_lock_indexes(table);
+#endif /* BTR_CUR_HASH_ADAPT */
+
/* Step-10: Re-create new indexes. */
if (!dict_table_is_temporary(table)) {
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 7d0664006bb..915d4b99d16 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -114,7 +114,7 @@ row_undo_ins_remove_clust_rec(
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(
+ const rec_offs* offsets = rec_get_offsets(
rec, index, NULL, true, ULINT_UNDEFINED, &heap);
row_log_table_delete(rec, index, offsets, NULL);
mem_heap_free(heap);
@@ -524,7 +524,7 @@ row_undo_ins(
}
if (err == DB_SUCCESS && node->table->stat_initialized) {
- /* Not protected by dict_table_stats_lock() for
+ /* Not protected by dict_sys->mutex for
performance reasons, we would rather get garbage
in stat_n_rows (which is just an estimate anyway)
than protecting the following code with a latch. */
@@ -536,8 +536,8 @@ row_undo_ins(
already be holding dict_sys->mutex, which
would be acquired when updating statistics. */
if (!dict_locked) {
- dict_stats_update_if_needed(
- node->table, node->trx->mysql_thd);
+ dict_stats_update_if_needed(node->table,
+ *node->trx);
}
}
}
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 3d4065cbab6..80d90f40379 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -75,7 +75,7 @@ dberr_t
row_undo_mod_clust_low(
/*===================*/
undo_node_t* node, /*!< in: row undo node */
- ulint** offsets,/*!< out: rec_get_offsets() on the record */
+ rec_offs** offsets,/*!< out: rec_get_offsets() on the record */
mem_heap_t** offsets_heap,
/*!< in/out: memory heap that can be emptied */
mem_heap_t* heap, /*!< in/out: memory heap */
@@ -169,12 +169,15 @@ row_undo_mod_remove_clust_low(
/* Find out if the record has been purged already
or if we can remove it. */
- if (!btr_pcur_restore_position(mode, &node->pcur, mtr)
- || row_vers_must_preserve_del_marked(node->new_trx_id,
- node->table->name,
- mtr)) {
+ if (!btr_pcur_restore_position(mode, &node->pcur, mtr)) {
+ return DB_SUCCESS;
+ }
- return(DB_SUCCESS);
+ DEBUG_SYNC_C("rollback_purge_clust");
+
+ if (row_vers_must_preserve_del_marked(node->new_trx_id,
+ node->table->name, mtr)) {
+ return DB_SUCCESS;
}
btr_cur = btr_pcur_get_btr_cur(&node->pcur);
@@ -184,7 +187,7 @@ row_undo_mod_remove_clust_low(
if (!trx_id_offset) {
mem_heap_t* heap = NULL;
ulint trx_id_col;
- const ulint* offsets;
+ const rec_offs* offsets;
ulint len;
trx_id_col = dict_index_get_sys_col_pos(
@@ -285,7 +288,7 @@ row_undo_mod_clust(
mem_heap_t* heap = mem_heap_create(1024);
mem_heap_t* offsets_heap = NULL;
- ulint* offsets = NULL;
+ rec_offs* offsets = NULL;
const dtuple_t* rebuilt_old_pk;
byte sys[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
@@ -361,6 +364,7 @@ row_undo_mod_clust(
== node->new_trx_id);
btr_pcur_commit_specify_mtr(pcur, &mtr);
+ DEBUG_SYNC_C("rollback_undo_pk");
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) {
@@ -665,7 +669,7 @@ try_again:
switch (search_result) {
mem_heap_t* heap;
mem_heap_t* offsets_heap;
- ulint* offsets;
+ rec_offs* offsets;
case ROW_BUFFERED:
case ROW_NOT_DELETED_REF:
/* These are invalid outcomes, because the mode passed
@@ -880,7 +884,7 @@ row_undo_mod_upd_del_sec(
does not exist. However, this situation may
only occur during the rollback of incomplete
transactions. */
- ut_a(thr_is_recv(thr));
+ ut_a(thr_get_trx(thr) == trx_roll_crash_recv_trx);
} else {
err = row_undo_mod_del_mark_or_remove_sec(
node, thr, index, entry);
@@ -1297,8 +1301,8 @@ row_undo_mod(
already be holding dict_sys->mutex, which
would be acquired when updating statistics. */
if (update_statistics && !dict_locked) {
- dict_stats_update_if_needed(
- node->table, node->trx->mysql_thd);
+ dict_stats_update_if_needed(node->table,
+ *node->trx);
} else {
node->table->stat_modified_counter++;
}
diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc
index 7a245f8279c..b65b173fedb 100644
--- a/storage/innobase/row/row0undo.cc
+++ b/storage/innobase/row/row0undo.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -167,8 +167,8 @@ row_undo_search_clust_to_pcur(
row_ext_t** ext;
const rec_t* rec;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets = offsets_;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!node->table->skip_alter_undo);
@@ -350,17 +350,16 @@ row_undo_step(
err = row_undo(node, thr);
- trx->error_state = err;
-
- if (err != DB_SUCCESS) {
- /* SQL error detected */
+#ifdef ENABLED_DEBUG_SYNC
+ if (trx->mysql_thd) {
+ DEBUG_SYNC_C("trx_after_rollback_row");
+ }
+#endif /* ENABLED_DEBUG_SYNC */
- if (err == DB_OUT_OF_FILE_SPACE) {
- ib::fatal() << "Out of tablespace during rollback."
- " Consider increasing your tablespace.";
- }
+ trx->error_state = err;
- ib::fatal() << "Error (" << ut_strerr(err) << ") in rollback.";
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
+ ib::fatal() << "Error (" << err << ") in rollback.";
}
return(thr);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 0153d618ab8..10156c7d3ab 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -214,7 +214,7 @@ row_upd_check_references_constraints(
cursor position is lost in this function! */
dict_table_t* table, /*!< in: table in question */
dict_index_t* index, /*!< in: index of the cursor */
- ulint* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
{
@@ -223,7 +223,6 @@ row_upd_check_references_constraints(
dtuple_t* entry;
trx_t* trx;
const rec_t* rec;
- ulint n_ext;
dberr_t err;
ibool got_s_lock = FALSE;
@@ -240,7 +239,7 @@ row_upd_check_references_constraints(
heap = mem_heap_create(500);
- entry = row_rec_to_index_entry(rec, index, offsets, &n_ext, heap);
+ entry = row_rec_to_index_entry(rec, index, offsets, heap);
mtr_commit(mtr);
@@ -364,7 +363,7 @@ wsrep_row_upd_check_foreign_constraints(
cursor position is lost in this function! */
dict_table_t* table, /*!< in: table in question */
dict_index_t* index, /*!< in: index of the cursor */
- ulint* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
que_thr_t* thr, /*!< in: query thread */
mtr_t* mtr) /*!< in: mtr */
{
@@ -373,7 +372,6 @@ wsrep_row_upd_check_foreign_constraints(
dtuple_t* entry;
trx_t* trx;
const rec_t* rec;
- ulint n_ext;
dberr_t err;
ibool got_s_lock = FALSE;
ibool opened = FALSE;
@@ -391,8 +389,7 @@ wsrep_row_upd_check_foreign_constraints(
heap = mem_heap_create(500);
- entry = row_rec_to_index_entry(rec, index, offsets,
- &n_ext, heap);
+ entry = row_rec_to_index_entry(rec, index, offsets, heap);
mtr_commit(mtr);
@@ -467,7 +464,7 @@ func_exit:
inline bool wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx)
{
- if (!wsrep_on_trx(trx)) {
+ if (!trx->is_wsrep()) {
return false;
}
return que_node_get_type(node->common.parent) != QUE_NODE_UPDATE
@@ -505,7 +502,7 @@ row_upd_rec_sys_fields_in_recovery(
/*===============================*/
rec_t* rec, /*!< in/out: record */
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint pos, /*!< in: TRX_ID position in rec */
trx_id_t trx_id, /*!< in: transaction id */
roll_ptr_t roll_ptr)/*!< in: roll ptr of the undo log record */
@@ -571,7 +568,7 @@ ibool
row_upd_changes_field_size_or_external(
/*===================================*/
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update) /*!< in: update vector */
{
const upd_field_t* upd_field;
@@ -686,7 +683,7 @@ row_upd_rec_in_place(
/*=================*/
rec_t* rec, /*!< in/out: record where replaced */
dict_index_t* index, /*!< in: the index the record belongs to */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
page_zip_des_t* page_zip)/*!< in: compressed page with enough space
available, or NULL */
@@ -964,7 +961,7 @@ row_upd_build_sec_rec_difference_binary(
/*====================================*/
const rec_t* rec, /*!< in: secondary index record */
dict_index_t* index, /*!< in: index */
- const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const dtuple_t* entry, /*!< in: entry to insert */
mem_heap_t* heap) /*!< in: memory heap from which allocated */
{
@@ -1044,7 +1041,7 @@ row_upd_build_difference_binary(
dict_index_t* index,
const dtuple_t* entry,
const rec_t* rec,
- const ulint* offsets,
+ const rec_offs* offsets,
bool no_sys,
trx_t* trx,
mem_heap_t* heap,
@@ -1057,7 +1054,7 @@ row_upd_build_difference_binary(
ulint n_diff;
ulint trx_id_pos;
ulint i;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
ulint n_fld = dtuple_get_n_fields(entry);
ulint n_v_fld = dtuple_get_n_v_fields(entry);
rec_offs_init(offsets_);
@@ -1119,10 +1116,6 @@ row_upd_build_difference_binary(
for purge/mvcc purpose) */
if (n_v_fld > 0) {
row_ext_t* ext;
- mem_heap_t* v_heap = NULL;
- byte* record;
- VCOL_STORAGE* vcol_storage;
-
THD* thd;
if (trx == NULL) {
@@ -1133,9 +1126,8 @@ row_upd_build_difference_binary(
ut_ad(!update->old_vrow);
- innobase_allocate_row_for_vcol(thd, index, &v_heap,
- &mysql_table,
- &record, &vcol_storage);
+ ib_vcol_row vc(NULL);
+ uchar *record = vc.record(thd, index, &mysql_table);
for (i = 0; i < n_v_fld; i++) {
const dict_v_col_t* col
@@ -1153,10 +1145,9 @@ row_upd_build_difference_binary(
dfield_t* vfield = innobase_get_computed_value(
update->old_vrow, col, index,
- &v_heap, heap, NULL, thd, mysql_table, record,
+ &vc.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);
}
@@ -1185,12 +1176,6 @@ row_upd_build_difference_binary(
}
}
-
- if (v_heap) {
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
- mem_heap_free(v_heap);
- }
}
update->n_fields = n_diff;
@@ -1209,7 +1194,9 @@ containing also the reference to the external part
@param[in,out] len input - length of prefix to
fetch; output: fetched length of the prefix
@param[in,out] heap heap where to allocate
-@return BLOB prefix */
+@return BLOB prefix
+@retval NULL if the record is incomplete (should only happen
+in row_vers_vc_matches_cluster() executed concurrently with another purge) */
static
byte*
row_upd_ext_fetch(
@@ -1224,10 +1211,7 @@ row_upd_ext_fetch(
*len = btr_copy_externally_stored_field_prefix(
buf, *len, page_size, data, local_len);
- /* We should never update records containing a half-deleted BLOB. */
- ut_a(*len);
-
- return(buf);
+ return *len ? buf : NULL;
}
/** Replaces the new column value stored in the update vector in
@@ -1238,9 +1222,11 @@ the given index entry field.
@param[in] uf update field
@param[in,out] heap memory heap for allocating and copying
the new value
-@param[in] page_size page size */
+@param[in] page_size page size
+@return whether the previous version was built successfully */
+MY_ATTRIBUTE((nonnull, warn_unused_result))
static
-void
+bool
row_upd_index_replace_new_col_val(
dfield_t* dfield,
const dict_field_t* field,
@@ -1255,7 +1241,7 @@ row_upd_index_replace_new_col_val(
dfield_copy_data(dfield, &uf->new_val);
if (dfield_is_null(dfield)) {
- return;
+ return true;
}
len = dfield_get_len(dfield);
@@ -1273,6 +1259,9 @@ row_upd_index_replace_new_col_val(
data = row_upd_ext_fetch(data, l, page_size,
&len, heap);
+ if (UNIV_UNLIKELY(!data)) {
+ return false;
+ }
}
len = dtype_get_at_most_n_mbchars(col->prtype,
@@ -1286,7 +1275,7 @@ row_upd_index_replace_new_col_val(
dfield_dup(dfield, heap);
}
- return;
+ return true;
}
switch (uf->orig_len) {
@@ -1325,6 +1314,8 @@ row_upd_index_replace_new_col_val(
dfield_set_ext(dfield);
break;
}
+
+ return true;
}
/***********************************************************//**
@@ -1382,68 +1373,57 @@ row_upd_index_replace_new_col_vals_index_pos(
update, i, false);
}
- if (uf) {
- row_upd_index_replace_new_col_val(
- dtuple_get_nth_field(entry, i),
- field, col, uf, heap, page_size);
+ if (uf && UNIV_UNLIKELY(!row_upd_index_replace_new_col_val(
+ dtuple_get_nth_field(entry, i),
+ field, col, uf, heap,
+ page_size))) {
+ ut_error;
}
}
}
-/***********************************************************//**
-Replaces the new column values stored in the update vector to the index entry
-given. */
-void
-row_upd_index_replace_new_col_vals(
-/*===============================*/
- dtuple_t* entry, /*!< in/out: index entry where replaced;
- the clustered index record must be
- covered by a lock or a page latch to
- prevent deletion (rollback or purge) */
- dict_index_t* index, /*!< in: index; NOTE that this may also be a
- non-clustered index */
- const upd_t* update, /*!< in: an update vector built for the
- CLUSTERED index so that the field number in
- an upd_field is the clustered index position */
- mem_heap_t* heap) /*!< in: memory heap for allocating and
- copying the new values */
+/** Replace the new column values stored in the update vector,
+during trx_undo_prev_version_build().
+@param entry clustered index tuple where the values are replaced
+ (the clustered index leaf page latch must be held)
+@param index clustered index
+@param update update vector for the clustered index
+@param heap memory heap for allocating and copying values
+@return whether the previous version was built successfully */
+bool
+row_upd_index_replace_new_col_vals(dtuple_t *entry, const dict_index_t &index,
+ const upd_t *update, mem_heap_t *heap)
{
- ulint i;
- const dict_index_t* clust_index
- = dict_table_get_first_index(index->table);
- const page_size_t& page_size = dict_table_page_size(index->table);
-
- ut_ad(!index->table->skip_alter_undo);
-
- dtuple_set_info_bits(entry, update->info_bits);
-
- for (i = 0; i < dict_index_get_n_fields(index); i++) {
- const dict_field_t* field;
- const dict_col_t* col;
- const upd_field_t* uf;
-
- field = dict_index_get_nth_field(index, i);
- col = dict_field_get_col(field);
- if (dict_col_is_virtual(col)) {
- const dict_v_col_t* vcol = reinterpret_cast<
- const dict_v_col_t*>(
- col);
-
- uf = upd_get_field_by_field_no(
- update, vcol->v_pos, true);
- } else {
- uf = upd_get_field_by_field_no(
- update,
- dict_col_get_clust_pos(col, clust_index),
- false);
- }
-
- if (uf) {
- row_upd_index_replace_new_col_val(
- dtuple_get_nth_field(entry, i),
- field, col, uf, heap, page_size);
- }
- }
+ ut_ad(index.is_primary());
+ const page_size_t& page_size= dict_table_page_size(index.table);
+
+ ut_ad(!index.table->skip_alter_undo);
+ dtuple_set_info_bits(entry, update->info_bits);
+
+ for (ulint i= 0; i < index.n_fields; i++)
+ {
+ const dict_field_t *field= &index.fields[i];
+ const dict_col_t* col= dict_field_get_col(field);
+ const upd_field_t *uf;
+
+ if (col->is_virtual())
+ {
+ const dict_v_col_t *vcol= reinterpret_cast<const dict_v_col_t*>(col);
+ uf= upd_get_field_by_field_no(update, vcol->v_pos, true);
+ }
+ else
+ uf= upd_get_field_by_field_no(update, dict_col_get_clust_pos(col, &index),
+ false);
+
+ if (!uf)
+ continue;
+
+ if (!row_upd_index_replace_new_col_val(dtuple_get_nth_field(entry, i),
+ field, col, uf, heap, page_size))
+ return false;
+ }
+
+ return true;
}
/** Replaces the virtual column values stored in the update vector.
@@ -1870,7 +1850,9 @@ row_upd_changes_ord_field_binary_func(
/* Silence a compiler warning without
silencing a Valgrind error. */
dfield_len = 0;
- UNIV_MEM_INVALID(&dfield_len, sizeof dfield_len);
+#ifdef HAVE_valgrind_or_MSAN
+ MEM_UNDEFINED(&dfield_len, sizeof dfield_len);
+#endif /* HAVE_valgrind_or_MSAN */
/* See if the column is stored externally. */
buf = row_ext_lookup(ext, col_no, &dfield_len);
@@ -1885,7 +1867,8 @@ row_upd_changes_ord_field_binary_func(
when the server had crashed before
storing the field. */
ut_ad(thr->graph->trx->is_recovered);
- ut_ad(trx_is_recv(thr->graph->trx));
+ ut_ad(thr->graph->trx
+ == trx_roll_crash_recv_trx);
return(TRUE);
}
@@ -2070,7 +2053,7 @@ void
row_upd_copy_columns(
/*=================*/
rec_t* rec, /*!< in: record in a clustered index */
- const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
+ const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
sym_node_t* column) /*!< in: first column in a column list, or
NULL */
{
@@ -2118,23 +2101,19 @@ row_upd_eval_new_vals(
@param[in,out] node row update node
@param[in] update an update vector if it is update
@param[in] thd mysql thread handle
-@param[in,out] mysql_table mysql table object */
+@param[in,out] mysql_table mysql table object
+@return true if success
+ false if virtual column value computation fails. */
static
-void
+bool
row_upd_store_v_row(
upd_node_t* node,
const upd_t* update,
THD* thd,
TABLE* mysql_table)
{
- mem_heap_t* heap = NULL;
dict_index_t* index = dict_table_get_first_index(node->table);
- byte* record= 0;
- VCOL_STORAGE *vcol_storage= 0;
-
- if (!update)
- innobase_allocate_row_for_vcol(thd, index, &heap, &mysql_table,
- &record, &vcol_storage);
+ ib_vcol_row vc(NULL);
for (ulint col_no = 0; col_no < dict_table_get_n_v_cols(node->table);
col_no++) {
@@ -2184,32 +2163,37 @@ row_upd_store_v_row(
dfield_dup(dfield, node->heap);
}
} else {
+ uchar *record = vc.record(thd, index,
+ &mysql_table);
/* Need to compute, this happens when
deleting row */
- innobase_get_computed_value(
- node->row, col, index,
- &heap, node->heap, NULL,
- thd, mysql_table, record, NULL,
- NULL, NULL);
+ dfield_t* vfield =
+ innobase_get_computed_value(
+ node->row, col, index,
+ &vc.heap, node->heap,
+ NULL, thd, mysql_table,
+ record, NULL, NULL,
+ NULL);
+ if (vfield == NULL) {
+ return false;
+ }
}
}
}
}
- if (heap) {
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
- mem_heap_free(heap);
- }
-
+ return true;
}
/** Stores to the heap the row on which the node->pcur is positioned.
@param[in] node row update node
@param[in] thd mysql thread handle
@param[in,out] mysql_table NULL, or mysql table object when
- user thread invokes dml */
-void
+ user thread invokes dml
+@return false if virtual column value computation fails
+ true otherwise. */
+static
+bool
row_upd_store_row(
upd_node_t* node,
THD* thd,
@@ -2219,8 +2203,8 @@ row_upd_store_row(
rec_t* rec;
mem_heap_t* heap = NULL;
row_ext_t** ext;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- const ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ const rec_offs* offsets;
rec_offs_init(offsets_);
ut_ad(node->pcur->latch_mode != BTR_NO_LATCHES);
@@ -2253,8 +2237,12 @@ row_upd_store_row(
NULL, NULL, NULL, ext, node->heap);
if (node->table->n_v_cols) {
- row_upd_store_v_row(node, node->is_delete ? NULL : node->update,
+ bool ok = row_upd_store_v_row(node,
+ node->is_delete ? NULL : node->update,
thd, mysql_table);
+ if (!ok) {
+ return false;
+ }
}
if (node->is_delete) {
@@ -2269,6 +2257,7 @@ row_upd_store_row(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
+ return true;
}
/***********************************************************//**
@@ -2437,7 +2426,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, false) == DB_SUCCESS);
ut_ad(0);
#endif /* UNIV_DEBUG */
break;
@@ -2459,7 +2448,7 @@ row_upd_sec_index_entry(
&& wsrep_must_process_fk(node, trx)
&& !wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
- ulint* offsets = rec_get_offsets(
+ rec_offs* offsets = rec_get_offsets(
rec, index, NULL, true,
ULINT_UNDEFINED, &heap);
@@ -2473,7 +2462,7 @@ row_upd_sec_index_entry(
err = DB_SUCCESS;
break;
case DB_LOCK_WAIT:
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::warn() << "WSREP: sec index FK lock wait"
<< " index " << index->name
<< " table " << index->table->name
@@ -2481,7 +2470,7 @@ row_upd_sec_index_entry(
}
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name
@@ -2489,7 +2478,7 @@ row_upd_sec_index_entry(
}
break;
default:
- ib::error() << "WSREP: referenced FK check fail: " << ut_strerr(err)
+ ib::error() << "WSREP: referenced FK check fail: " << err
<< " index " << index->name
<< " table " << index->table->name
<< " query " << wsrep_thd_query(trx->mysql_thd);
@@ -2504,7 +2493,7 @@ row_upd_sec_index_entry(
if (referenced) {
- ulint* offsets;
+ rec_offs* offsets;
offsets = rec_get_offsets(
rec, index, NULL, true, ULINT_UNDEFINED,
@@ -2586,7 +2575,7 @@ row_upd_clust_rec_by_insert_inherit_func(
/*=====================================*/
const rec_t* rec, /*!< in: old record, or NULL */
#ifdef UNIV_DEBUG
- const ulint* offsets,/*!< in: rec_get_offsets(rec), or NULL */
+ const rec_offs* offsets,/*!< in: rec_get_offsets(rec), or NULL */
#endif /* UNIV_DEBUG */
dtuple_t* entry, /*!< in/out: updated entry to be
inserted into the clustered index */
@@ -2687,10 +2676,13 @@ row_upd_clust_rec_by_insert(
dtuple_t* entry;
dberr_t err;
rec_t* rec;
- ulint* offsets = NULL;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets = offsets_;
ut_ad(dict_index_is_clust(index));
+ rec_offs_init(offsets_);
+
trx = thr_get_trx(thr);
table = node->table;
pcur = node->pcur;
@@ -2718,7 +2710,7 @@ row_upd_clust_rec_by_insert(
we update the primary key. Delete-mark the old record
in the clustered index and prepare to insert a new entry. */
rec = btr_cur_get_rec(btr_cur);
- offsets = rec_get_offsets(rec, index, NULL, true,
+ offsets = rec_get_offsets(rec, index, offsets, true,
ULINT_UNDEFINED, &heap);
ut_ad(page_rec_is_user_rec(rec));
@@ -2785,14 +2777,14 @@ check_fk:
err = DB_SUCCESS;
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name;
}
goto err_exit;
default:
- ib::error() << "WSREP: referenced FK check fail: " << ut_strerr(err)
+ ib::error() << "WSREP: referenced FK check fail: " << err
<< " index " << index->name
<< " table " << index->table->name;
goto err_exit;
@@ -2804,8 +2796,7 @@ check_fk:
mtr_commit(mtr);
err = row_ins_clust_index_entry(
- index, entry, thr,
- node->upd_ext ? node->upd_ext->n_ext : 0);
+ index, entry, thr, dtuple_get_n_ext(entry));
node->state = UPD_NODE_INSERT_CLUSTERED;
mem_heap_free(heap);
@@ -2825,7 +2816,7 @@ row_upd_clust_rec(
ulint flags, /*!< in: undo logging and locking flags */
upd_node_t* node, /*!< in: row update node */
dict_index_t* index, /*!< in: clustered index */
- ulint* offsets,/*!< in: rec_get_offsets() on node->pcur */
+ rec_offs* offsets,/*!< in: rec_get_offsets() on node->pcur */
mem_heap_t** offsets_heap,
/*!< in/out: memory heap, can be emptied */
que_thr_t* thr, /*!< in: query thread */
@@ -2956,7 +2947,7 @@ row_upd_del_mark_clust_rec(
/*=======================*/
upd_node_t* node, /*!< in: row update node */
dict_index_t* index, /*!< in: clustered index */
- ulint* offsets,/*!< in/out: rec_get_offsets() for the
+ rec_offs* offsets,/*!< in/out: rec_get_offsets() for the
record under the cursor */
que_thr_t* thr, /*!< in: query thread */
ibool referenced,
@@ -2982,9 +2973,12 @@ row_upd_del_mark_clust_rec(
/* Store row because we have to build also the secondary index
entries */
- row_upd_store_row(node, trx->mysql_thd,
+ if (!row_upd_store_row(node, trx->mysql_thd,
thr->prebuilt && thr->prebuilt->table == node->table
- ? thr->prebuilt->m_mysql_table : NULL);
+ ? thr->prebuilt->m_mysql_table : NULL)) {
+ err = DB_COMPUTE_VALUE_FAILED;
+ return err;
+ }
/* Mark the clustered index record deleted; we do not have to check
locks, because we assume that we have an x-lock on the record */
@@ -3012,14 +3006,14 @@ row_upd_del_mark_clust_rec(
err = DB_SUCCESS;
break;
case DB_DEADLOCK:
- if (wsrep_debug) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
<< " table " << index->table->name;
}
break;
default:
- ib::error() << "WSREP: referenced FK check fail: " << ut_strerr(err)
+ ib::error() << "WSREP: referenced FK check fail: " << err
<< " index " << index->name
<< " table " << index->table->name;
@@ -3051,8 +3045,8 @@ row_upd_clust_step(
mtr_t mtr;
rec_t* rec;
mem_heap_t* heap = NULL;
- ulint offsets_[REC_OFFS_NORMAL_SIZE];
- ulint* offsets;
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets;
ibool referenced;
trx_t* trx = thr_get_trx(thr);
@@ -3193,8 +3187,11 @@ row_upd_clust_step(
goto exit_func;
}
- row_upd_store_row(node, trx->mysql_thd,
- thr->prebuilt ? thr->prebuilt->m_mysql_table : NULL);
+ if(!row_upd_store_row(node, trx->mysql_thd,
+ thr->prebuilt ? thr->prebuilt->m_mysql_table : NULL)) {
+ err = DB_COMPUTE_VALUE_FAILED;
+ goto exit_func;
+ }
if (row_upd_changes_ord_field_binary(index, node->update, thr,
node->row, node->ext)) {
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index f2a574b8331..2d8704764d1 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -86,24 +86,27 @@ row_vers_impl_x_locked_low(
dict_index_t* clust_index,
const rec_t* rec,
dict_index_t* index,
- const ulint* offsets,
+ const rec_offs* offsets,
mtr_t* mtr)
{
rec_t* prev_version = NULL;
- ulint* clust_offsets;
+ rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs* clust_offsets;
mem_heap_t* heap;
dtuple_t* ientry = NULL;
mem_heap_t* v_heap = NULL;
dtuple_t* cur_vrow = NULL;
+ rec_offs_init(clust_offsets_);
+
DBUG_ENTER("row_vers_impl_x_locked_low");
ut_ad(rec_offs_validate(rec, index, offsets));
heap = mem_heap_create(1024);
- clust_offsets = rec_get_offsets(
- clust_rec, clust_index, NULL, true, ULINT_UNDEFINED, &heap);
+ clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets_,
+ true, ULINT_UNDEFINED, &heap);
const trx_id_t trx_id = row_get_rec_trx_id(
clust_rec, clust_index, clust_offsets);
@@ -116,7 +119,7 @@ row_vers_impl_x_locked_low(
if (trx == 0) {
/* The transaction that modified or inserted clust_rec is no
longer active, or it is corrupt: no implicit lock on rec */
- if (corrupt) {
+ if (UNIV_UNLIKELY(corrupt)) {
lock_report_trx_id_insanity(
trx_id, clust_rec, clust_index, clust_offsets,
trx_sys_get_max_trx_id());
@@ -133,15 +136,13 @@ row_vers_impl_x_locked_low(
const ulint rec_del = rec_get_deleted_flag(rec, comp);
if (dict_index_has_virtual(index)) {
- ulint n_ext;
ulint est_size = DTUPLE_EST_ALLOC(index->n_fields);
/* Allocate the dtuple for virtual columns extracted from undo
log with its own heap, so to avoid it being freed as we
iterating in the version loop below. */
v_heap = mem_heap_create(est_size);
- ientry = row_rec_to_index_entry(
- rec, index, offsets, &n_ext, v_heap);
+ ientry = row_rec_to_index_entry(rec, index, offsets, v_heap);
}
/* We look up if some earlier version, which was modified by
@@ -221,7 +222,7 @@ not_locked:
}
clust_offsets = rec_get_offsets(
- prev_version, clust_index, NULL, true,
+ prev_version, clust_index, clust_offsets_, true,
ULINT_UNDEFINED, &heap);
vers_del = rec_get_deleted_flag(prev_version, comp);
@@ -368,7 +369,7 @@ trx_t*
row_vers_impl_x_locked(
const rec_t* rec,
dict_index_t* index,
- const ulint* offsets)
+ const rec_offs* offsets)
{
mtr_t mtr;
trx_t* trx;
@@ -444,9 +445,11 @@ row_vers_must_preserve_del_marked(
@param[in] clust_index clustered index
@param[in] index the secondary index
@param[in] heap heap used to build virtual dtuple
-@param[in,out] vcol_info virtual column information. */
+@param[in,out] vcol_info virtual column information.
+@return true in case of success
+ false if virtual column computation fails */
static
-void
+bool
row_vers_build_clust_v_col(
dtuple_t* row,
dict_index_t* clust_index,
@@ -454,11 +457,8 @@ row_vers_build_clust_v_col(
mem_heap_t* heap,
purge_vcol_info_t* vcol_info)
{
- mem_heap_t* local_heap = NULL;
- VCOL_STORAGE *vcol_storage= NULL;
THD* thd= current_thd;
TABLE* maria_table= 0;
- byte* record= 0;
ut_ad(dict_index_has_virtual(index));
ut_ad(index->table == clust_index->table);
@@ -467,17 +467,14 @@ row_vers_build_clust_v_col(
vcol_info->set_used();
maria_table = vcol_info->table();
}
- DEBUG_SYNC(current_thd, "ib_clust_v_col_before_row_allocated");
- innobase_allocate_row_for_vcol(thd, index,
- &local_heap,
- &maria_table,
- &record,
- &vcol_storage);
+ ib_vcol_row vc(NULL);
+ byte *record = vc.record(thd, index, &maria_table);
if (vcol_info && !vcol_info->table()) {
vcol_info->set_table(maria_table);
- goto func_exit;
+ // wait for second fetch
+ return true;
}
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
@@ -490,19 +487,18 @@ row_vers_build_clust_v_col(
col = reinterpret_cast<const dict_v_col_t*>(
ind_field->col);
- innobase_get_computed_value(
- row, col, clust_index, &local_heap,
+ dfield_t *vfield = innobase_get_computed_value(
+ row, col, clust_index, &vc.heap,
heap, NULL, thd, maria_table, record, NULL,
NULL, NULL);
+ if (vfield == NULL) {
+ innobase_report_computed_value_failed(row);
+ ut_ad(0);
+ return false;
+ }
}
}
-
-func_exit:
- if (local_heap) {
- if (vcol_storage)
- innobase_free_row_for_vcol(vcol_storage);
- mem_heap_free(local_heap);
- }
+ return true;
}
/** Build latest virtual column data from undo log
@@ -522,7 +518,7 @@ row_vers_build_cur_vrow_low(
bool in_purge,
const rec_t* rec,
dict_index_t* clust_index,
- ulint* clust_offsets,
+ rec_offs* clust_offsets,
dict_index_t* index,
roll_ptr_t roll_ptr,
trx_id_t trx_id,
@@ -618,7 +614,6 @@ row_vers_build_cur_vrow_low(
/** Check a virtual column value index secondary virtual index matches
that of current cluster index record, which is recreated from information
stored in undo log
-@param[in] in_purge called by purge thread
@param[in] rec record in the clustered index
@param[in] icentry the index entry built from a cluster row
@param[in] clust_index cluster index
@@ -634,11 +629,10 @@ stored in undo log
static
bool
row_vers_vc_matches_cluster(
- bool in_purge,
const rec_t* rec,
const dtuple_t* icentry,
dict_index_t* clust_index,
- ulint* clust_offsets,
+ rec_offs* clust_offsets,
dict_index_t* index,
const dtuple_t* ientry,
roll_ptr_t roll_ptr,
@@ -695,12 +689,6 @@ row_vers_vc_matches_cluster(
version = rec;
- /* If this is called by purge thread, set TRX_UNDO_PREV_IN_PURGE
- bit to search the undo log until we hit the current undo log with
- roll_ptr */
- ulint status = (in_purge ? TRX_UNDO_PREV_IN_PURGE : 0)
- | TRX_UNDO_GET_OLD_V_VALUE;
-
while (n_cmp_v_col < n_fields - n_non_v_col) {
heap2 = heap;
heap = mem_heap_create(1024);
@@ -708,11 +696,12 @@ row_vers_vc_matches_cluster(
version, clust_index, clust_offsets);
ut_ad(cur_roll_ptr != 0);
- ut_ad(in_purge == (roll_ptr != 0));
+ ut_ad(roll_ptr != 0);
trx_undo_prev_version_build(
rec, mtr, version, clust_index, clust_offsets,
- heap, &prev_version, NULL, vrow, status);
+ heap, &prev_version, NULL, vrow,
+ TRX_UNDO_PREV_IN_PURGE | TRX_UNDO_GET_OLD_V_VALUE);
if (heap2) {
mem_heap_free(heap2);
@@ -814,7 +803,7 @@ row_vers_build_cur_vrow(
bool in_purge,
const rec_t* rec,
dict_index_t* clust_index,
- ulint** clust_offsets,
+ rec_offs** clust_offsets,
dict_index_t* index,
const dtuple_t* ientry,
roll_ptr_t roll_ptr,
@@ -846,8 +835,11 @@ row_vers_build_cur_vrow(
mtr->commit();
}
- row_vers_build_clust_v_col(
+ bool res = row_vers_build_clust_v_col(
row, clust_index, index, heap, vcol_info);
+ if (!res) {
+ return NULL;
+ }
if (vcol_info != NULL && vcol_info->is_first_fetch()) {
return NULL;
@@ -899,7 +891,7 @@ row_vers_old_has_index_entry(
const rec_t* version;
rec_t* prev_version;
dict_index_t* clust_index;
- ulint* clust_offsets;
+ rec_offs* clust_offsets;
mem_heap_t* heap;
mem_heap_t* heap2;
dtuple_t* row;
@@ -968,10 +960,14 @@ row_vers_old_has_index_entry(
mtr->commit();
}
- row_vers_build_clust_v_col(
+ bool res = row_vers_build_clust_v_col(
row, clust_index, index, heap,
vcol_info);
+ if (!res) {
+ goto unsafe_to_purge;
+ }
+
if (vcol_info && vcol_info->is_first_fetch()) {
goto unsafe_to_purge;
}
@@ -996,7 +992,7 @@ row_vers_old_has_index_entry(
secondary indexes.) */
if (entry && row_vers_vc_matches_cluster(
- also_curr, rec, entry,
+ rec, entry,
clust_index, clust_offsets,
index, ientry, roll_ptr,
trx_id, NULL, &vrow, mtr)) {
@@ -1157,7 +1153,7 @@ row_vers_build_for_consistent_read(
of this records */
mtr_t* mtr, /*!< in: mtr holding the latch on rec */
dict_index_t* index, /*!< in: the clustered index */
- ulint** offsets,/*!< in/out: offsets returned by
+ rec_offs** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
ReadView* view, /*!< in: the consistent read view */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
@@ -1272,7 +1268,7 @@ row_vers_build_for_semi_consistent_read(
of this records */
mtr_t* mtr, /*!< in: mtr holding the latch on rec */
dict_index_t* index, /*!< in: the clustered index */
- ulint** offsets,/*!< in/out: offsets returned by
+ rec_offs** offsets,/*!< in/out: offsets returned by
rec_get_offsets(rec, index) */
mem_heap_t** offset_heap,/*!< in/out: memory heap from which
the offsets are allocated */
diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc
index 347e604479a..b420ca6d8ee 100644
--- a/storage/innobase/srv/srv0conc.cc
+++ b/storage/innobase/srv/srv0conc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -122,9 +122,8 @@ srv_conc_enter_innodb_with_atomics(
for (;;) {
ulint sleep_in_us;
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_trx_is_aborting(trx->mysql_thd)) {
- if (wsrep_debug) {
+ if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
+ if (UNIV_UNLIKELY(wsrep_debug)) {
ib::info() <<
"srv_conc_enter due to MUST_ABORT";
}
@@ -325,14 +324,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 (UNIV_UNLIKELY(wsrep_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 (UNIV_UNLIKELY(wsrep_debug)) {
ib::info() << "WSREP: conc slot cancel";
}
os_event_set(trx->wsrep_event);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 2c33496ca52..f1216dcd51e 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, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -507,7 +507,9 @@ current_time % 60 == 0 and no tasks will be performed when
current_time % 5 != 0. */
# define SRV_MASTER_CHECKPOINT_INTERVAL (7)
-# define SRV_MASTER_PURGE_INTERVAL (10)
+#ifdef MEM_PERIODIC_CHECK
+# define SRV_MASTER_MEM_VALIDATE_INTERVAL (13)
+#endif /* MEM_PERIODIC_CHECK */
# define SRV_MASTER_DICT_LRU_INTERVAL (47)
/** Simulate compression failures. */
@@ -1331,7 +1333,8 @@ srv_printf_innodb_monitor(
ibuf_print(file);
#ifdef BTR_CUR_HASH_ADAPT
- for (ulint i = 0; i < btr_ahi_parts; ++i) {
+ btr_search_x_lock_all();
+ for (ulint i = 0; i < btr_ahi_parts && btr_search_enabled; ++i) {
const hash_table_t* table = btr_search_sys->hash_tables[i];
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
@@ -1355,6 +1358,7 @@ srv_printf_innodb_monitor(
", node heap has " ULINTPF " buffer(s)\n",
table->n_cells, heap->base.count - !heap->free_block);
}
+ btr_search_x_unlock_all();
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
@@ -1798,7 +1802,7 @@ loop:
srv_refresh_innodb_monitor_stats();
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
goto exit_func;
}
@@ -1910,7 +1914,7 @@ loop:
os_event_wait_time_low(srv_error_event, 1000000, sig_count);
- if (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
goto loop;
}
@@ -1960,7 +1964,7 @@ srv_get_active_thread_type(void)
srv_sys_mutex_exit();
- if (ret == SRV_NONE && srv_shutdown_state != SRV_SHUTDOWN_NONE
+ if (ret == SRV_NONE && srv_shutdown_state > SRV_SHUTDOWN_INITIATED
&& purge_sys != NULL) {
/* Check only on shutdown. */
switch (trx_purge_state()) {
@@ -2215,7 +2219,7 @@ srv_master_do_active_tasks(void)
ut_d(srv_master_do_disabled_loop());
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2240,7 +2244,7 @@ srv_master_do_active_tasks(void)
/* Now see if various tasks that are performed at defined
intervals need to be performed. */
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2265,7 +2269,7 @@ srv_master_do_active_tasks(void)
early and often to avoid those situations. */
DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;);
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2308,7 +2312,7 @@ srv_master_do_idle_tasks(void)
ut_d(srv_master_do_disabled_loop());
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2324,7 +2328,7 @@ srv_master_do_idle_tasks(void)
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time);
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2352,7 +2356,7 @@ srv_master_do_idle_tasks(void)
early and often to avoid those situations. */
DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;);
- if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
return;
}
@@ -2361,6 +2365,10 @@ srv_master_do_idle_tasks(void)
log_checkpoint(true);
MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND,
counter_time);
+
+ /* This is a workaround to avoid the InnoDB hang when OS datetime
+ changed backwards.*/
+ os_event_set(buf_flush_event);
}
/** Perform shutdown tasks.
@@ -2450,8 +2458,7 @@ DECLARE_THREAD(srv_master_thread)(
ut_a(slot == srv_sys.sys_threads);
loop:
- while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
-
+ while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED) {
srv_master_sleep();
MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
@@ -2466,6 +2473,7 @@ loop:
switch (srv_shutdown_state) {
case SRV_SHUTDOWN_NONE:
+ case SRV_SHUTDOWN_INITIATED:
break;
case SRV_SHUTDOWN_FLUSH_PHASE:
case SRV_SHUTDOWN_LAST_PHASE:
@@ -2504,8 +2512,7 @@ static
bool
srv_purge_should_exit(ulint n_purged)
{
- ut_ad(srv_shutdown_state == SRV_SHUTDOWN_NONE
- || srv_shutdown_state == SRV_SHUTDOWN_CLEANUP);
+ ut_ad(srv_shutdown_state <= SRV_SHUTDOWN_CLEANUP);
if (srv_undo_sources) {
return(false);
@@ -2514,18 +2521,20 @@ srv_purge_should_exit(ulint n_purged)
return(true);
}
/* Slow shutdown was requested. */
- if (n_purged) {
-#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
+ if (ulint history_size = n_purged ? trx_sys->rseg_history_len : 0) {
static time_t progress_time;
time_t now = time(NULL);
if (now - progress_time >= 15) {
progress_time = now;
+#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY
service_manager_extend_timeout(
INNODB_EXTEND_TIMEOUT_INTERVAL,
"InnoDB: to purge " ULINTPF " transactions",
- trx_sys->rseg_history_len);
- }
+ history_size);
#endif
+ ib::info() << "to purge " << history_size
+ << " transactions";
+ }
/* The previous round still did some work. */
return(false);
}
@@ -2598,13 +2607,6 @@ DECLARE_THREAD(srv_worker_thread)(
slot = srv_reserve_slot(SRV_WORKER);
-#ifdef UNIV_DEBUG
- UT_LIST_INIT(slot->debug_sync,
- &srv_slot_t::debug_sync_t::debug_sync_list);
- rw_lock_create(PFS_NOT_INSTRUMENTED, &slot->debug_sync_lock,
- SYNC_NO_ORDER_CHECK);
-#endif
-
ut_a(srv_n_purge_threads > 1);
ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER]))
< srv_n_purge_threads);
@@ -2782,7 +2784,7 @@ srv_purge_coordinator_suspend(
rw_lock_x_lock(&purge_sys->latch);
- stop = (srv_shutdown_state == SRV_SHUTDOWN_NONE
+ stop = (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED
&& purge_sys->state == PURGE_STATE_STOP);
if (!stop) {
@@ -2852,19 +2854,13 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
slot = srv_reserve_slot(SRV_PURGE);
-#ifdef UNIV_DEBUG
- UT_LIST_INIT(slot->debug_sync,
- &srv_slot_t::debug_sync_t::debug_sync_list);
- rw_lock_create(PFS_NOT_INSTRUMENTED, &slot->debug_sync_lock,
- SYNC_NO_ORDER_CHECK);
-#endif
ulint rseg_history_len = trx_sys->rseg_history_len;
do {
/* If there are no records to purge or the last
purge didn't purge any records then wait for activity. */
- if (srv_shutdown_state == SRV_SHUTDOWN_NONE
+ if (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED
&& srv_undo_sources
&& (purge_sys->state == PURGE_STATE_STOP
|| n_total_purged == 0)) {
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 75bdf17eab7..0d8ebbe98cd 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -696,6 +696,7 @@ static bool srv_undo_tablespace_open(const char* name, ulint space_id,
if (create_new_db) {
space->size = file->size = ulint(size >> srv_page_size_shift);
space->size_in_header = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
+ space->committed_size = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
} else {
success = file->read_page0(true);
if (!success) {
@@ -874,6 +875,7 @@ srv_undo_tablespaces_init(bool create_new_db)
break;
}
/* fall through */
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
ut_ad(!create_new_db);
@@ -1043,7 +1045,7 @@ srv_undo_tablespaces_init(bool create_new_db)
fsp_header_init(
*it, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
- mtr_x_lock(fil_space_get_latch(*it, NULL), &mtr);
+ mtr_x_lock_space(*it, &mtr);
for (ulint i = 0; i < TRX_SYS_N_RSEGS; i++) {
@@ -1091,7 +1093,7 @@ srv_start_wait_for_purge_to_start()
ut_a(state != PURGE_STATE_DISABLED);
- while (srv_shutdown_state == SRV_SHUTDOWN_NONE
+ while (srv_shutdown_state <= SRV_SHUTDOWN_INITIATED
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND
&& state == PURGE_STATE_INIT) {
@@ -1280,6 +1282,7 @@ srv_shutdown_all_bg_threads()
case SRV_OPERATION_RESTORE_DELTA:
break;
case SRV_OPERATION_NORMAL:
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
if (!buf_page_cleaner_is_active
@@ -1327,7 +1330,7 @@ srv_init_abort_low(
#ifdef UNIV_DEBUG
" at " << innobase_basename(file) << "[" << line << "]"
#endif /* UNIV_DEBUG */
- " with error " << ut_strerr(err) << ". You may need"
+ " with error " << err << ". You may need"
" to delete the ibdata1 file before trying to start"
" up again.";
} else {
@@ -1335,7 +1338,7 @@ srv_init_abort_low(
#ifdef UNIV_DEBUG
" at " << innobase_basename(file) << "[" << line << "]"
#endif /* UNIV_DEBUG */
- " with error " << ut_strerr(err);
+ " with error " << err;
}
srv_shutdown_all_bg_threads();
@@ -1471,8 +1474,7 @@ innobase_start_or_create_for_mysql()
unsigned i = 0;
ut_ad(srv_operation == SRV_OPERATION_NORMAL
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
+ || is_mariabackup_restore_or_export());
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
srv_read_only_mode = true;
@@ -1950,14 +1952,9 @@ innobase_start_or_create_for_mysql()
srv_read_only_mode);
if (err == DB_NOT_FOUND) {
- if (i == 0) {
- if (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT) {
- return(DB_SUCCESS);
- }
- }
+ if (i == 0
+ && is_mariabackup_restore_or_export())
+ return (DB_SUCCESS);
/* opened all files */
break;
@@ -1984,10 +1981,7 @@ innobase_start_or_create_for_mysql()
if (i == 0) {
if (size == 0
- && (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT)) {
+ && is_mariabackup_restore_or_export()) {
/* Tolerate an empty ib_logfile0
from a previous run of
mariabackup --prepare. */
@@ -2217,6 +2211,7 @@ files_checked:
switch (srv_operation) {
case SRV_OPERATION_NORMAL:
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE_EXPORT:
/* Initialize the change buffer. */
err = dict_boot();
@@ -2321,8 +2316,7 @@ files_checked:
recv_recovery_from_checkpoint_finish();
- if (srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT) {
+ if (is_mariabackup_restore_or_export()) {
/* After applying the redo log from
SRV_OPERATION_BACKUP, flush the changes
to the data files and truncate or delete the log.
@@ -2337,8 +2331,7 @@ files_checked:
fil_close_log_files(true);
log_group_close_all();
if (err == DB_SUCCESS) {
- bool trunc = srv_operation
- == SRV_OPERATION_RESTORE;
+ bool trunc = is_mariabackup_restore();
/* Delete subsequent log files. */
delete_log_files(logfilename, dirnamelen,
srv_n_log_files_found, trunc);
@@ -2632,7 +2625,9 @@ files_checked:
srv_start_state_set(SRV_START_STATE_MASTER);
}
- if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL
+ if (!srv_read_only_mode
+ && (srv_operation == SRV_OPERATION_NORMAL
+ || srv_operation == SRV_OPERATION_RESTORE_ROLLBACK_XA)
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
srv_undo_sources = true;
/* Create the dict stats gathering thread */
@@ -2763,6 +2758,7 @@ srv_shutdown_bg_undo_sources()
{
if (srv_undo_sources) {
ut_ad(!srv_read_only_mode);
+ srv_shutdown_state = SRV_SHUTDOWN_INITIATED;
fts_optimize_shutdown();
dict_stats_shutdown();
while (row_get_background_drop_list_len_low()) {
@@ -2783,6 +2779,11 @@ innodb_shutdown()
ut_ad(!srv_undo_sources);
switch (srv_operation) {
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
+ if (dberr_t err = fil_write_flushed_lsn(log_sys->lsn))
+ ib::error() << "Writing flushed lsn " << log_sys->lsn
+ << " failed; error=" << err;
+ /* fall through */
case SRV_OPERATION_BACKUP:
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_DELTA:
@@ -2848,7 +2849,7 @@ innodb_shutdown()
#ifdef BTR_CUR_HASH_ADAPT
if (dict_sys) {
- btr_search_disable(true);
+ btr_search_disable();
}
#endif /* BTR_CUR_HASH_ADAPT */
if (ibuf) {
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 0c942ada430..27650cb1639 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -979,9 +979,9 @@ sync_array_print_long_waits_low(
return(false);
}
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
/* Increase the timeouts if running under valgrind because it executes
- extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that
+ extremely slowly. HAVE_valgrind does not necessary mean that
we are running under valgrind but we have no better way to tell.
See Bug#58432 innodb.innodb_bug56143 fails under valgrind
for an example */
@@ -1078,7 +1078,7 @@ sync_array_print_long_waits(
sync_array_exit(arr);
}
- if (noticed) {
+ if (noticed && srv_monitor_event) {
ibool old_val;
fprintf(stderr,
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index 3e65c234cd0..89db512da2a 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -383,8 +383,7 @@ private:
{
return(latch->get_id() == LATCH_ID_RTR_ACTIVE_MUTEX
|| latch->get_id() == LATCH_ID_RTR_PATH_MUTEX
- || latch->get_id() == LATCH_ID_RTR_MATCH_MUTEX
- || latch->get_id() == LATCH_ID_RTR_SSN_MUTEX);
+ || latch->get_id() == LATCH_ID_RTR_MATCH_MUTEX);
}
private:
@@ -465,7 +464,6 @@ LatchDebug::LatchDebug()
LEVEL_MAP_INSERT(SYNC_WORK_QUEUE);
LEVEL_MAP_INSERT(SYNC_FTS_TOKENIZE);
LEVEL_MAP_INSERT(SYNC_FTS_OPTIMIZE);
- LEVEL_MAP_INSERT(SYNC_FTS_BG_THREADS);
LEVEL_MAP_INSERT(SYNC_FTS_CACHE_INIT);
LEVEL_MAP_INSERT(SYNC_RECV);
LEVEL_MAP_INSERT(SYNC_LOG_FLUSH_ORDER);
@@ -474,7 +472,6 @@ LatchDebug::LatchDebug()
LEVEL_MAP_INSERT(SYNC_PAGE_CLEANER);
LEVEL_MAP_INSERT(SYNC_PURGE_QUEUE);
LEVEL_MAP_INSERT(SYNC_TRX_SYS_HEADER);
- LEVEL_MAP_INSERT(SYNC_REC_LOCK);
LEVEL_MAP_INSERT(SYNC_THREADS);
LEVEL_MAP_INSERT(SYNC_TRX);
LEVEL_MAP_INSERT(SYNC_TRX_SYS);
@@ -744,7 +741,6 @@ LatchDebug::check_order(
case SYNC_MONITOR_MUTEX:
case SYNC_RECV:
- case SYNC_FTS_BG_THREADS:
case SYNC_WORK_QUEUE:
case SYNC_FTS_TOKENIZE:
case SYNC_FTS_OPTIMIZE:
@@ -846,15 +842,6 @@ LatchDebug::check_order(
}
break;
- case SYNC_REC_LOCK:
-
- if (find(latches, SYNC_LOCK_SYS) != 0) {
- basic_check(latches, level, SYNC_REC_LOCK - 1);
- } else {
- basic_check(latches, level, SYNC_REC_LOCK);
- }
- break;
-
case SYNC_IBUF_BITMAP:
/* Either the thread must own the master mutex to all
@@ -1316,14 +1303,8 @@ sync_latch_meta_init()
LATCH_ADD_MUTEX(FLUSH_LIST, SYNC_BUF_FLUSH_LIST, flush_list_mutex_key);
- LATCH_ADD_MUTEX(FTS_BG_THREADS, SYNC_FTS_BG_THREADS,
- fts_bg_threads_mutex_key);
-
LATCH_ADD_MUTEX(FTS_DELETE, SYNC_FTS_OPTIMIZE, fts_delete_mutex_key);
- LATCH_ADD_MUTEX(FTS_OPTIMIZE, SYNC_FTS_OPTIMIZE,
- fts_optimize_mutex_key);
-
LATCH_ADD_MUTEX(FTS_DOC_ID, SYNC_FTS_OPTIMIZE, fts_doc_id_mutex_key);
LATCH_ADD_MUTEX(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE,
@@ -1375,8 +1356,6 @@ sync_latch_meta_init()
rw_lock_debug_mutex_key);
#endif /* UNIV_DEBUG */
- LATCH_ADD_MUTEX(RTR_SSN_MUTEX, SYNC_ANY_LATCH, rtr_ssn_mutex_key);
-
LATCH_ADD_MUTEX(RTR_ACTIVE_MUTEX, SYNC_ANY_LATCH,
rtr_active_mutex_key);
@@ -1494,9 +1473,6 @@ sync_latch_meta_init()
LATCH_ADD_RWLOCK(INDEX_TREE, SYNC_INDEX_TREE, index_tree_rw_lock_key);
- LATCH_ADD_RWLOCK(DICT_TABLE_STATS, SYNC_INDEX_TREE,
- dict_table_stats_key);
-
LATCH_ADD_RWLOCK(HASH_TABLE_RW_LOCK, SYNC_BUF_PAGE_HASH,
hash_table_locks_key);
@@ -1514,8 +1490,6 @@ sync_latch_meta_init()
PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(MTFLUSH_MUTEX, SYNC_NO_ORDER_CHECK,
PFS_NOT_INSTRUMENTED);
- LATCH_ADD_MUTEX(FIL_CRYPT_MUTEX, SYNC_NO_ORDER_CHECK,
- PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(FIL_CRYPT_STAT_MUTEX, SYNC_NO_ORDER_CHECK,
PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(FIL_CRYPT_DATA_MUTEX, SYNC_NO_ORDER_CHECK,
@@ -1580,7 +1554,7 @@ struct CreateTracker {
~CreateTracker()
UNIV_NOTHROW
{
- ut_d(m_files.empty());
+ ut_ad(m_files.empty());
m_mutex.destroy();
}
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 96108ab0bf1..b46126bde58 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -293,15 +293,15 @@ rw_lock_s_lock_spin(
ut_ad(rw_lock_validate(lock));
+ rw_lock_stats.rw_s_spin_wait_count.inc();
+
lock_loop:
/* Spin waiting for the writer field to become free */
HMT_low();
+ ulint j = i;
while (i < srv_n_spin_wait_rounds && lock->lock_word <= 0) {
- if (srv_spin_wait_delay) {
- ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
- }
-
+ ut_delay(srv_spin_wait_delay);
i++;
}
@@ -310,7 +310,7 @@ lock_loop:
os_thread_yield();
}
- ++spin_count;
+ spin_count += lint(i - j);
/* We try once again to obtain the lock */
if (rw_lock_s_lock_low(lock, pass, file_name, line)) {
@@ -420,13 +420,9 @@ rw_lock_x_lock_wait_func(
ut_ad(lock->lock_word <= threshold);
+ HMT_low();
while (lock->lock_word < threshold) {
-
-
- HMT_low();
- if (srv_spin_wait_delay) {
- ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
- }
+ ut_delay(srv_spin_wait_delay);
if (i < srv_n_spin_wait_rounds) {
i++;
@@ -435,7 +431,7 @@ rw_lock_x_lock_wait_func(
HMT_medium();
/* If there is still a reader, then go to sleep.*/
- ++n_spins;
+ n_spins += i;
sync_cell_t* cell;
@@ -661,6 +657,12 @@ rw_lock_x_lock_func(
ut_ad(rw_lock_validate(lock));
ut_ad(!rw_lock_own(lock, RW_LOCK_S));
+ if (rw_lock_x_lock_low(lock, pass, file_name, line)) {
+ /* Locking succeeded */
+ return;
+ }
+ rw_lock_stats.rw_x_spin_wait_count.inc();
+
lock_loop:
if (rw_lock_x_lock_low(lock, pass, file_name, line)) {
@@ -680,19 +682,16 @@ lock_loop:
/* Spin waiting for the lock_word to become free */
HMT_low();
+ ulint j = i;
while (i < srv_n_spin_wait_rounds
&& lock->lock_word <= X_LOCK_HALF_DECR) {
- if (srv_spin_wait_delay) {
- ut_delay(ut_rnd_interval(
- 0, srv_spin_wait_delay));
- }
-
+ ut_delay(srv_spin_wait_delay);
i++;
}
HMT_medium();
- spin_count += i;
+ spin_count += lint(i - j);
if (i >= srv_n_spin_wait_rounds) {
@@ -760,11 +759,17 @@ rw_lock_sx_lock_func(
sync_array_t* sync_arr;
ulint spin_count = 0;
uint64_t count_os_wait = 0;
- ulint spin_wait_count = 0;
ut_ad(rw_lock_validate(lock));
ut_ad(!rw_lock_own(lock, RW_LOCK_S));
+ if (rw_lock_sx_lock_low(lock, pass, file_name, line)) {
+ /* Locking succeeded */
+ return;
+ }
+
+ rw_lock_stats.rw_sx_spin_wait_count.inc();
+
lock_loop:
if (rw_lock_sx_lock_low(lock, pass, file_name, line)) {
@@ -776,28 +781,22 @@ lock_loop:
}
rw_lock_stats.rw_sx_spin_round_count.add(spin_count);
- rw_lock_stats.rw_sx_spin_wait_count.add(spin_wait_count);
/* Locking succeeded */
return;
} else {
- ++spin_wait_count;
-
/* Spin waiting for the lock_word to become free */
+ ulint j = i;
while (i < srv_n_spin_wait_rounds
&& lock->lock_word <= X_LOCK_HALF_DECR) {
- if (srv_spin_wait_delay) {
- ut_delay(ut_rnd_interval(
- 0, srv_spin_wait_delay));
- }
-
+ ut_delay(srv_spin_wait_delay);
i++;
}
- spin_count += i;
+ spin_count += lint(i - j);
if (i >= srv_n_spin_wait_rounds) {
@@ -829,7 +828,6 @@ lock_loop:
}
rw_lock_stats.rw_sx_spin_round_count.add(spin_count);
- rw_lock_stats.rw_sx_spin_wait_count.add(spin_wait_count);
/* Locking succeeded */
return;
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index 0a81f9c00e7..81bce39df33 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -45,9 +46,7 @@ mysql_pfs_key_t dict_sys_mutex_key;
mysql_pfs_key_t file_format_max_mutex_key;
mysql_pfs_key_t fil_system_mutex_key;
mysql_pfs_key_t flush_list_mutex_key;
-mysql_pfs_key_t fts_bg_threads_mutex_key;
mysql_pfs_key_t fts_delete_mutex_key;
-mysql_pfs_key_t fts_optimize_mutex_key;
mysql_pfs_key_t fts_doc_id_mutex_key;
mysql_pfs_key_t fts_pll_tokenize_mutex_key;
mysql_pfs_key_t hash_table_mutex_key;
@@ -73,7 +72,6 @@ mysql_pfs_key_t rw_lock_debug_mutex_key;
mysql_pfs_key_t rtr_active_mutex_key;
mysql_pfs_key_t rtr_match_mutex_key;
mysql_pfs_key_t rtr_path_mutex_key;
-mysql_pfs_key_t rtr_ssn_mutex_key;
mysql_pfs_key_t rw_lock_list_mutex_key;
mysql_pfs_key_t rw_lock_mutex_key;
mysql_pfs_key_t srv_innodb_monitor_mutex_key;
@@ -104,7 +102,6 @@ mysql_pfs_key_t buf_block_debug_latch_key;
# endif /* UNIV_DEBUG */
mysql_pfs_key_t checkpoint_lock_key;
mysql_pfs_key_t dict_operation_lock_key;
-mysql_pfs_key_t dict_table_stats_key;
mysql_pfs_key_t hash_table_locks_key;
mysql_pfs_key_t index_tree_rw_lock_key;
mysql_pfs_key_t index_online_log_key;
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index 6dba53dee6b..2b9d6c96acd 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -450,7 +450,6 @@ fill_trx_row(
which to copy volatile
strings */
{
- size_t stmt_len;
const char* s;
ut_ad(lock_mutex_own());
@@ -485,16 +484,14 @@ fill_trx_row(
row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
- stmt_len = innobase_get_stmt_safe(trx->mysql_thd, query, sizeof(query));
-
- if (stmt_len > 0) {
-
+ if (size_t stmt_len = thd_query_safe(trx->mysql_thd, query,
+ sizeof query)) {
row->trx_query = static_cast<const char*>(
ha_storage_put_memlim(
cache->storage, query, stmt_len + 1,
MAX_ALLOWED_FOR_STORAGE(cache)));
- row->trx_query_cs = innobase_get_charset(trx->mysql_thd);
+ row->trx_query_cs = thd_charset(trx->mysql_thd);
if (row->trx_query == NULL) {
@@ -599,7 +596,7 @@ put_nth_field(
ulint n, /*!< in: number of field */
const dict_index_t* index, /*!< in: index */
const rec_t* rec, /*!< in: record */
- const ulint* offsets)/*!< in: record offsets, returned
+ const rec_offs* offsets)/*!< in: record offsets, returned
by rec_get_offsets() */
{
const byte* data;
@@ -680,8 +677,8 @@ fill_lock_data(
const dict_index_t* index;
ulint n_fields;
mem_heap_t* heap;
- ulint offsets_onstack[REC_OFFS_NORMAL_SIZE];
- ulint* offsets;
+ rec_offs offsets_onstack[REC_OFFS_NORMAL_SIZE];
+ rec_offs* offsets;
char buf[TRX_I_S_LOCK_DATA_MAX_LEN];
ulint buf_used;
ulint i;
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 732435ccefb..2025ac70beb 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -383,7 +383,7 @@ trx_purge_free_segment(trx_rseg_t* rseg, fil_addr_t hdr_addr)
}
if (fseg_free_step_not_header(
- seg_hdr + TRX_UNDO_FSEG_HEADER, false, &mtr)) {
+ seg_hdr + TRX_UNDO_FSEG_HEADER, &mtr)) {
break;
}
@@ -413,7 +413,7 @@ trx_purge_free_segment(trx_rseg_t* rseg, fil_addr_t hdr_addr)
is not flooded with bufferfixed pages: see the note in
fsp0fsp.cc. */
- } while (!fseg_free_step(seg_hdr + TRX_UNDO_FSEG_HEADER, false, &mtr));
+ } while (!fseg_free_step(seg_hdr + TRX_UNDO_FSEG_HEADER, &mtr));
hist_size = mtr_read_ulint(rseg_hdr + TRX_RSEG_HISTORY_SIZE,
MLOG_4BYTES, &mtr);
@@ -698,12 +698,11 @@ namespace undo {
os_file_close(handle);
- if (err != DB_SUCCESS) {
-
+ if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
ib::info()
<< "Unable to read '"
<< log_file_name << "' : "
- << ut_strerr(err);
+ << err;
os_file_delete(
innodb_log_file_key, log_file_name);
@@ -996,7 +995,7 @@ trx_purge_initiate_truncate(
mtr_t mtr;
const ulint size = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
mtr.start();
- mtr_x_lock(&space->latch, &mtr);
+ mtr.x_lock_space(space, __FILE__, __LINE__);
fil_truncate_log(space, size, &mtr);
fsp_header_init(space_id, size, &mtr);
mutex_enter(&fil_system->mutex);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index e23f29fa735..4aecc8ae610 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 2020, 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
@@ -848,7 +848,7 @@ trx_undo_page_report_modify(
delete marking is done */
const rec_t* rec, /*!< in: clustered index record which
has NOT yet been modified */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector which tells the
columns to be updated; in the case of
a delete, this should be set to NULL */
@@ -1565,9 +1565,7 @@ trx_undo_update_rec_get_update(
<< " fields " << BUG_REPORT_MSG
<< ". Run also CHECK TABLE "
<< index->table->name << "."
- " n_fields = " << n_fields << ", i = " << i
- << ", ptr " << ptr;
-
+ " n_fields = " << n_fields << ", i = " << i;
ut_ad(0);
*upd = NULL;
return(NULL);
@@ -1952,8 +1950,7 @@ dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
buf_block_t* block = buf_page_get_gen(
page_id_t(undo->space, undo->last_page_no),
univ_page_size, RW_X_LATCH,
- buf_pool_is_obsolete(undo->withdraw_clock)
- ? NULL : undo->guess_block,
+ undo->guess_block,
BUF_GET, __FILE__, __LINE__, &mtr, &err);
ut_ad((err == DB_SUCCESS) == !!block);
@@ -1964,7 +1961,6 @@ dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
if (ulint offset = trx_undo_page_report_rename(
trx, table, block, &mtr)) {
- undo->withdraw_clock = buf_withdraw_clock;
undo->empty = FALSE;
undo->top_page_no = undo->last_page_no;
undo->top_offset = offset;
@@ -2017,7 +2013,7 @@ trx_undo_report_row_operation(
const rec_t* rec, /*!< in: case of an update or delete
marking, the record in the clustered
index; NULL if insert */
- const ulint* offsets, /*!< in: rec_get_offsets(rec) */
+ const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
{
@@ -2086,8 +2082,7 @@ trx_undo_report_row_operation(
undo_block = buf_page_get_gen(
page_id_t(undo->space, page_no), univ_page_size, RW_X_LATCH,
- buf_pool_is_obsolete(undo->withdraw_clock)
- ? NULL : undo->guess_block, BUF_GET, __FILE__, __LINE__,
+ undo->guess_block, BUF_GET, __FILE__, __LINE__,
&mtr, &err);
buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
@@ -2140,14 +2135,13 @@ trx_undo_report_row_operation(
mtr_commit(&mtr);
} else {
/* Success */
- undo->withdraw_clock = buf_withdraw_clock;
+ undo->guess_block = undo_block;
mtr_commit(&mtr);
undo->empty = FALSE;
undo->top_page_no = page_no;
undo->top_offset = offset;
undo->top_undo_no = trx->undo_no++;
- undo->guess_block = undo_block;
trx->undo_rseg_space = rseg->space;
@@ -2292,7 +2286,7 @@ trx_undo_prev_version_build(
index_rec page and purge_view */
const rec_t* rec, /*!< in: version of a clustered index record */
dict_index_t* index, /*!< in: clustered index */
- ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */
+ rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mem_heap_t* heap, /*!< in: memory heap from which the memory
needed is allocated */
rec_t** old_vers,/*!< out, own: previous version, or NULL if
@@ -2404,8 +2398,6 @@ trx_undo_prev_version_build(
ut_a(ptr);
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
- ulint n_ext;
-
/* We should confirm the existence of disowned external data,
if the previous version record is delete marked. If the trx_id
of the previous record is seen by purge view, we should treat
@@ -2446,13 +2438,18 @@ trx_undo_prev_version_build(
those fields that update updates to become externally stored
fields. Store the info: */
- entry = row_rec_to_index_entry(
- rec, index, offsets, &n_ext, heap);
- n_ext += btr_push_update_extern_fields(entry, update, heap);
+ entry = row_rec_to_index_entry(rec, index, offsets, heap);
/* The page containing the clustered index record
corresponding to entry is latched in mtr. Thus the
following call is safe. */
- row_upd_index_replace_new_col_vals(entry, index, update, heap);
+ if (!row_upd_index_replace_new_col_vals(entry, *index, update,
+ heap)) {
+ ut_a(v_status & TRX_UNDO_PREV_IN_PURGE);
+ return false;
+ }
+
+ /* Get number of externally stored columns in updated record */
+ const ulint n_ext = dtuple_get_n_ext(entry);
buf = static_cast<byte*>(mem_heap_alloc(
heap, rec_get_converted_size(index, entry, n_ext)));
@@ -2476,8 +2473,10 @@ trx_undo_prev_version_build(
}
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+ rec_offs offsets_dbg[REC_OFFS_NORMAL_SIZE];
+ rec_offs_init(offsets_dbg);
ut_a(!rec_offs_any_null_extern(
- *old_vers, rec_get_offsets(*old_vers, index, NULL, true,
+ *old_vers, rec_get_offsets(*old_vers, index, offsets_dbg, true,
ULINT_UNDEFINED, &heap)));
#endif // defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 20798323802..c5f70452bf2 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -189,6 +189,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
case TRX_STATE_NOT_STARTED:
trx->will_lock = 0;
ut_ad(trx->in_mysql_trx_list);
+#ifdef WITH_WSREP
+ trx->wsrep = false;
+#endif
return(DB_SUCCESS);
case TRX_STATE_ACTIVE:
@@ -200,10 +203,21 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
case TRX_STATE_PREPARED_RECOVERED:
ut_ad(!trx_is_autocommit_non_locking(trx));
if (trx->has_logged_persistent()) {
- /* Change the undo log state back from
- TRX_UNDO_PREPARED to TRX_UNDO_ACTIVE
- so that if the system gets killed,
- recovery will perform the rollback. */
+ /* The XA ROLLBACK of a XA PREPARE transaction
+ will consist of multiple mini-transactions.
+
+ As the very first step of XA ROLLBACK, we must
+ change the undo log state back from
+ TRX_UNDO_PREPARED to TRX_UNDO_ACTIVE, in order
+ to ensure that recovery will complete the
+ rollback.
+
+ Failure to perform this step could cause a
+ situation where we would roll back part of
+ a XA PREPARE transaction, the server would be
+ killed, and finally, the transaction would be
+ recovered in XA PREPARE state, with some of
+ the actions already having been rolled back. */
trx_undo_ptr_t* undo_ptr = &trx->rsegs.m_redo;
mtr_t mtr;
mtr.start();
@@ -219,29 +233,15 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
true, &mtr);
}
mutex_exit(&trx->rsegs.m_redo.rseg->mutex);
- /* Persist the XA ROLLBACK, so that crash
- recovery will replay the rollback in case
- the redo log gets applied past this point. */
+ /* Write the redo log for the XA ROLLBACK
+ state change to the global buffer. It is
+ not necessary to flush the redo log. If
+ a durable log write of a later mini-transaction
+ takes place for whatever reason, then this state
+ change will be durable as well. */
mtr.commit();
ut_ad(mtr.commit_lsn() > 0);
}
-#ifdef ENABLED_DEBUG_SYNC
- if (trx->mysql_thd == NULL) {
- /* We could be executing XA ROLLBACK after
- XA PREPARE and a server restart. */
- } else if (!trx->has_logged_persistent()) {
- /* innobase_close_connection() may roll back a
- transaction that did not generate any
- persistent undo log. The DEBUG_SYNC
- would cause an assertion failure for a
- disconnected thread.
-
- NOTE: InnoDB will not know about the XID
- if no persistent undo log was generated. */
- } else {
- DEBUG_SYNC_C("trx_xa_rollback");
- }
-#endif /* ENABLED_DEBUG_SYNC */
return(trx_rollback_for_mysql_low(trx));
case TRX_STATE_COMMITTED_IN_MEMORY:
@@ -412,9 +412,8 @@ trx_rollback_to_savepoint_for_mysql_low(
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;
+ if (trx->is_wsrep()) {
+ trx->lock.was_chosen_as_deadlock_victim = false;
}
#endif
return(err);
@@ -553,19 +552,6 @@ trx_release_savepoint_for_mysql(
}
/*******************************************************************//**
-Determines if this transaction is rolling back an incomplete transaction
-in crash recovery.
-@return TRUE if trx is an incomplete transaction that is being rolled
-back in crash recovery */
-ibool
-trx_is_recv(
-/*========*/
- const trx_t* trx) /*!< in: transaction */
-{
- return(trx == trx_roll_crash_recv_trx);
-}
-
-/*******************************************************************//**
Returns a transaction savepoint taken at this point in time.
@return savepoint */
trx_savept_t
@@ -628,7 +614,7 @@ trx_rollback_active(
if (trx->error_state != DB_SUCCESS) {
ut_ad(trx->error_state == DB_INTERRUPTED);
- ut_ad(!srv_is_being_started);
+ ut_ad(srv_shutdown_state != SRV_SHUTDOWN_NONE);
ut_ad(!srv_undo_sources);
ut_ad(srv_fast_shutdown);
ut_ad(!dictionary_locked);
@@ -718,7 +704,7 @@ func_exit:
trx_free_resurrected(trx);
return(TRUE);
case TRX_STATE_ACTIVE:
- if (!srv_is_being_started
+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE
&& !srv_undo_sources && srv_fast_shutdown) {
fake_prepared:
trx->state = TRX_STATE_PREPARED;
@@ -764,7 +750,7 @@ trx_roll_must_shutdown()
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
if (trx_get_dict_operation(trx) == TRX_DICT_OP_NONE
- && !srv_is_being_started
+ && srv_shutdown_state != SRV_SHUTDOWN_NONE
&& !srv_undo_sources && srv_fast_shutdown) {
return true;
}
@@ -935,12 +921,6 @@ trx_roll_try_truncate(trx_t* trx)
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 */
}
/***********************************************************************//**
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index e76695b7e43..ac946adc8b5 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -53,11 +53,11 @@ trx_rseg_header_create(
buf_block_t* block;
ut_ad(mtr);
- ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
- MTR_MEMO_X_LOCK));
+ ut_ad(mtr_memo_contains(mtr, fil_space_get(space),
+ MTR_MEMO_SPACE_X_LOCK));
/* Allocate a new file segment for the rollback segment */
- block = fseg_create(space, 0, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
+ block = fseg_create(space, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
if (block == NULL) {
/* No space left */
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 415afc4a90b..8d00bd824a2 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -422,7 +422,7 @@ trx_sysf_create(
mtr_x_lock_space(TRX_SYS_SPACE, mtr);
/* Create the trx sys file block in a new allocated file segment */
- block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
+ block = fseg_create(TRX_SYS_SPACE, TRX_SYS + TRX_SYS_FSEG_HEADER,
mtr);
buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 7e72b909e2d..13b4efb973b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -105,7 +105,7 @@ trx_init(
trx->op_info = "";
- trx->active_commit_ordered = 0;
+ trx->active_commit_ordered = false;
trx->isolation_level = TRX_ISO_REPEATABLE_READ;
@@ -202,6 +202,15 @@ struct TrxFactory {
@param trx the transaction for which to release resources */
static void destroy(trx_t* trx)
{
+#ifdef __SANITIZE_ADDRESS__
+ /* Unpoison the memory for AddressSanitizer */
+ MEM_UNDEFINED(trx, sizeof *trx);
+#else
+ /* Declare the contents as initialized for Valgrind;
+ we checked this in trx_t::free(). */
+ MEM_MAKE_DEFINED(trx, sizeof *trx);
+#endif
+
ut_a(trx->magic_n == TRX_MAGIC_N);
ut_ad(!trx->in_rw_trx_list);
ut_ad(!trx->in_mysql_trx_list);
@@ -229,39 +238,6 @@ struct TrxFactory {
trx->lock.table_locks.~lock_list();
}
-
- /** Enforce any invariants here, this is called before the transaction
- is added to the pool.
- @return true if all OK */
- static bool debug(const trx_t* trx)
- {
- ut_a(trx->error_state == DB_SUCCESS);
-
- ut_a(trx->magic_n == TRX_MAGIC_N);
-
- ut_ad(!trx->read_only);
-
- ut_ad(trx->state == TRX_STATE_NOT_STARTED);
-
- ut_ad(trx->dict_operation == TRX_DICT_OP_NONE);
-
- ut_ad(trx->mysql_thd == 0);
-
- ut_ad(!trx->in_rw_trx_list);
- ut_ad(!trx->in_mysql_trx_list);
-
- ut_a(trx->lock.wait_thr == NULL);
- ut_a(trx->lock.wait_lock == NULL);
- ut_a(trx->dict_operation_lock_mode == 0);
-
- ut_a(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0);
-
- ut_ad(trx->autoinc_locks == NULL);
-
- ut_ad(trx->lock.table_locks.empty());
-
- return(true);
- }
};
/** The lock strategy for TrxPool */
@@ -338,13 +314,23 @@ trx_pool_close()
trx_pools = 0;
}
-/** @return a trx_t instance from trx_pools. */
-static
-trx_t*
-trx_create_low()
+/** @return allocated transaction object for internal operations */
+trx_t *trx_allocate_for_background()
{
trx_t* trx = trx_pools->get();
+#ifdef __SANITIZE_ADDRESS__
+ /* Unpoison the memory for AddressSanitizer.
+ It may have been poisoned in trx_t::free().*/
+ MEM_UNDEFINED(trx, sizeof *trx);
+#else
+ /* Declare the memory initialized for Valgrind.
+ The trx_t that are released to the pool are
+ actually initialized; we checked that by
+ MEM_CHECK_DEFINED() in trx_t::free(). */
+ MEM_MAKE_DEFINED(trx, sizeof *trx);
+#endif
+
assert_trx_is_free(trx);
mem_heap_t* heap;
@@ -360,14 +346,9 @@ trx_create_low()
alloc = ib_heap_allocator_create(heap);
- /* Remember to free the vector explicitly in trx_free(). */
trx->autoinc_locks = ib_vector_create(alloc, sizeof(void**), 4);
- /* Should have been either just initialized or .clear()ed by
- trx_free(). */
ut_ad(trx->mod_tables.empty());
- ut_ad(trx->lock.table_locks.empty());
- ut_ad(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0);
ut_ad(trx->lock.n_rec_locks == 0);
ut_ad(trx->lock.table_cached == 0);
ut_ad(trx->lock.rec_cached == 0);
@@ -379,59 +360,119 @@ trx_create_low()
return(trx);
}
-/**
-Release a trx_t instance back to the pool.
-@param trx the instance to release. */
-static
-void
-trx_free(trx_t*& trx)
+/** Free the memory to trx_pools */
+inline void trx_t::free()
{
- assert_trx_is_free(trx);
-
- trx->mysql_thd = 0;
- trx->mysql_log_file_name = 0;
-
- // FIXME: We need to avoid this heap free/alloc for each commit.
- if (trx->autoinc_locks != NULL) {
- ut_ad(ib_vector_is_empty(trx->autoinc_locks));
- /* We allocated a dedicated heap for the vector. */
- ib_vector_free(trx->autoinc_locks);
- trx->autoinc_locks = NULL;
- }
+ assert_trx_is_inactive(this);
- trx->mod_tables.clear();
-
- ut_ad(trx->read_view == NULL);
+ MEM_CHECK_DEFINED(this, sizeof *this);
- /* trx locking state should have been reset before returning trx
- to pool */
- ut_ad(trx->will_lock == 0);
+ ut_ad(!read_view);
+ ut_ad(!will_lock);
+ ut_ad(error_state == DB_SUCCESS);
+ ut_ad(magic_n == TRX_MAGIC_N);
+ ut_ad(!read_only);
+ ut_ad(!in_mysql_trx_list);
+ ut_ad(!lock.wait_lock);
- trx_pools->mem_free(trx);
- /* Unpoison the memory for innodb_monitor_set_option;
- it is operating also on the freed transaction objects. */
- MEM_UNDEFINED(&trx->mutex, sizeof trx->mutex);
- MEM_UNDEFINED(&trx->undo_mutex, sizeof trx->undo_mutex);
- /* Declare the contents as initialized for Valgrind;
- we checked that it was initialized in trx_pools->mem_free(trx). */
- UNIV_MEM_VALID(&trx->mutex, sizeof trx->mutex);
- UNIV_MEM_VALID(&trx->undo_mutex, sizeof trx->undo_mutex);
-
- trx = NULL;
-}
+ mysql_thd= NULL;
+ mysql_log_file_name= NULL;
-/********************************************************************//**
-Creates a transaction object for background operations by the master thread.
-@return own: transaction object */
-trx_t*
-trx_allocate_for_background(void)
-/*=============================*/
-{
- trx_t* trx;
+ // FIXME: We need to avoid this heap free/alloc for each commit.
+ if (autoinc_locks)
+ {
+ ut_ad(ib_vector_is_empty(autoinc_locks));
+ /* We allocated a dedicated heap for the vector. */
+ ib_vector_free(autoinc_locks);
+ autoinc_locks= NULL;
+ }
- trx = trx_create_low();
+ mod_tables.clear();
- return(trx);
+ MEM_NOACCESS(&n_ref, sizeof n_ref);
+ /* do not poison mutex */
+ MEM_NOACCESS(&id, sizeof id);
+ MEM_NOACCESS(&no, sizeof no);
+ /* state is accessed by innobase_kill_connection() */
+ MEM_NOACCESS(&is_recovered, sizeof is_recovered);
+#ifdef WITH_WSREP
+ MEM_NOACCESS(&wsrep, sizeof wsrep);
+#endif
+ MEM_NOACCESS(&read_view, sizeof read_view);
+ MEM_NOACCESS(&trx_list, sizeof trx_list);
+ MEM_NOACCESS(&no_list, sizeof no_list);
+ MEM_NOACCESS(&lock, sizeof lock);
+ MEM_NOACCESS(&op_info, sizeof op_info);
+ MEM_NOACCESS(&isolation_level, sizeof isolation_level);
+ MEM_NOACCESS(&check_foreigns, sizeof check_foreigns);
+ MEM_NOACCESS(&is_registered, sizeof is_registered);
+ MEM_NOACCESS(&active_commit_ordered, sizeof active_commit_ordered);
+ MEM_NOACCESS(&check_unique_secondary, sizeof check_unique_secondary);
+ MEM_NOACCESS(&flush_log_later, sizeof flush_log_later);
+ MEM_NOACCESS(&must_flush_log_later, sizeof must_flush_log_later);
+ MEM_NOACCESS(&duplicates, sizeof duplicates);
+ MEM_NOACCESS(&dict_operation, sizeof dict_operation);
+ MEM_NOACCESS(&declared_to_be_inside_innodb, sizeof declared_to_be_inside_innodb);
+ MEM_NOACCESS(&n_tickets_to_enter_innodb, sizeof n_tickets_to_enter_innodb);
+ MEM_NOACCESS(&dict_operation_lock_mode, sizeof dict_operation_lock_mode);
+ MEM_NOACCESS(&start_time, sizeof start_time);
+ MEM_NOACCESS(&start_time_micro, sizeof start_time_micro);
+ MEM_NOACCESS(&commit_lsn, sizeof commit_lsn);
+ MEM_NOACCESS(&table_id, sizeof table_id);
+ /* mysql_thd is accessed by innobase_kill_connection() */
+ MEM_NOACCESS(&mysql_log_file_name, sizeof mysql_log_file_name);
+ MEM_NOACCESS(&mysql_log_offset, sizeof mysql_log_offset);
+ MEM_NOACCESS(&n_mysql_tables_in_use, sizeof n_mysql_tables_in_use);
+ MEM_NOACCESS(&mysql_n_tables_locked, sizeof mysql_n_tables_locked);
+#ifdef UNIV_DEBUG
+ MEM_NOACCESS(&in_rw_trx_list, sizeof in_rw_trx_list);
+#endif /* UNIV_DEBUG */
+ MEM_NOACCESS(&mysql_trx_list, sizeof mysql_trx_list);
+#ifdef UNIV_DEBUG
+ MEM_NOACCESS(&in_mysql_trx_list, sizeof in_mysql_trx_list);
+#endif /* UNIV_DEBUG */
+ MEM_NOACCESS(&error_state, sizeof error_state);
+ MEM_NOACCESS(&error_info, sizeof error_info);
+ MEM_NOACCESS(&error_key_num, sizeof error_key_num);
+ MEM_NOACCESS(&graph, sizeof graph);
+ MEM_NOACCESS(&trx_savepoints, sizeof trx_savepoints);
+ /* do not poison undo_mutex */
+ MEM_NOACCESS(&undo_no, sizeof undo_no);
+ MEM_NOACCESS(&undo_rseg_space, sizeof undo_rseg_space);
+ MEM_NOACCESS(&last_sql_stat_start, sizeof last_sql_stat_start);
+ MEM_NOACCESS(&rsegs, sizeof rsegs);
+ MEM_NOACCESS(&roll_limit, sizeof roll_limit);
+#ifdef UNIV_DEBUG
+ MEM_NOACCESS(&in_rollback, sizeof in_rollback);
+#endif /* UNIV_DEBUG */
+ MEM_NOACCESS(&pages_undone, sizeof pages_undone);
+ MEM_NOACCESS(&n_autoinc_rows, sizeof n_autoinc_rows);
+ MEM_NOACCESS(&autoinc_locks, sizeof autoinc_locks);
+ MEM_NOACCESS(&read_only, sizeof read_only);
+ MEM_NOACCESS(&auto_commit, sizeof auto_commit);
+ MEM_NOACCESS(&will_lock, sizeof will_lock);
+ MEM_NOACCESS(&fts_trx, sizeof fts_trx);
+ MEM_NOACCESS(&fts_next_doc_id, sizeof fts_next_doc_id);
+ MEM_NOACCESS(&flush_tables, sizeof flush_tables);
+ MEM_NOACCESS(&ddl, sizeof ddl);
+ MEM_NOACCESS(&internal, sizeof internal);
+#ifdef UNIV_DEBUG
+ MEM_NOACCESS(&start_line, sizeof start_line);
+ MEM_NOACCESS(&start_file, sizeof start_file);
+#endif /* UNIV_DEBUG */
+ MEM_NOACCESS(&xid, sizeof xid);
+ MEM_NOACCESS(&mod_tables, sizeof mod_tables);
+ MEM_NOACCESS(&detailed_error, sizeof detailed_error);
+ MEM_NOACCESS(&flush_observer, sizeof flush_observer);
+ MEM_NOACCESS(&n_rec_lock_waits, sizeof n_rec_lock_waits);
+ MEM_NOACCESS(&n_table_lock_waits, sizeof n_table_lock_waits);
+ MEM_NOACCESS(&total_rec_lock_wait_time, sizeof total_rec_lock_wait_time);
+ MEM_NOACCESS(&total_table_lock_wait_time, sizeof total_table_lock_wait_time);
+#ifdef WITH_WSREP
+ MEM_NOACCESS(&wsrep_event, sizeof wsrep_event);
+#endif /* WITH_WSREP */
+ MEM_NOACCESS(&magic_n, sizeof magic_n);
+ trx_pools->mem_free(this);
}
/********************************************************************//**
@@ -466,9 +507,8 @@ trx_validate_state_before_free(trx_t* trx)
ut_ad(!trx->mysql_n_tables_locked);
ut_ad(!trx->internal);
- if (trx->declared_to_be_inside_innodb) {
-
- ib::error() << "Freeing a trx (" << trx << ", "
+ if (UNIV_UNLIKELY(trx->declared_to_be_inside_innodb)) {
+ ib::error() << "Freeing a trx ("
<< trx_get_id_for_print(trx) << ") which is declared"
" to be processing inside InnoDB";
@@ -506,8 +546,7 @@ trx_free_resurrected(trx_t* trx)
trx_validate_state_before_free(trx);
trx_init(trx);
-
- trx_free(trx);
+ trx->free();
}
/** Free a transaction that was allocated by background or user threads.
@@ -516,8 +555,7 @@ void
trx_free_for_background(trx_t* trx)
{
trx_validate_state_before_free(trx);
-
- trx_free(trx);
+ trx->free();
}
/** Transition to committed state, to release implicit locks. */
@@ -584,9 +622,7 @@ trx_free_prepared(
|| (trx->is_recovered
&& (trx_state_eq(trx, TRX_STATE_ACTIVE)
|| trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY))
- && (!srv_was_started
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT
+ && (!srv_was_started || is_mariabackup_restore_or_export()
|| srv_read_only_mode
|| srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO)));
ut_a(trx->magic_n == TRX_MAGIC_N);
@@ -608,8 +644,7 @@ trx_free_prepared(
trx->state = TRX_STATE_NOT_STARTED;
ut_ad(!UT_LIST_GET_LEN(trx->lock.trx_locks));
trx->id = 0;
-
- trx_free(trx);
+ trx->free();
}
/** Disconnect a transaction from MySQL and optionally mark it as if
@@ -1816,15 +1851,13 @@ 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;
- }
-#endif
+ trx->lock.was_chosen_as_deadlock_victim = false;
DBUG_LOG("trx", "Commit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED;
+#ifdef WITH_WSREP
+ trx->wsrep = false;
+#endif
/* trx->in_mysql_trx_list would hold between
trx_allocate_for_mysql() and trx_free_for_mysql(). It does not
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index 336506c7b65..5e8467af298 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -446,9 +446,9 @@ trx_undo_seg_create(
}
/* Allocate a new file segment for the undo log */
- block = fseg_create_general(space, 0,
+ block = fseg_create_general(space,
TRX_UNDO_SEG_HDR
- + TRX_UNDO_FSEG_HEADER, TRUE, mtr);
+ + TRX_UNDO_FSEG_HEADER, TRUE, mtr, NULL);
fil_space_release_free_extents(space, n_reserved);
@@ -869,7 +869,7 @@ trx_undo_free_page(
undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
fseg_free_page(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER,
- space, page_no, false, mtr);
+ space, page_no, mtr);
last_addr = flst_get_last(header_page + TRX_UNDO_SEG_HDR
+ TRX_UNDO_PAGE_LIST, mtr);
@@ -1092,7 +1092,7 @@ trx_undo_seg_free(
file_seg = seg_header + TRX_UNDO_FSEG_HEADER;
- finished = fseg_free_step(file_seg, false, &mtr);
+ finished = fseg_free_step(file_seg, &mtr);
if (finished) {
/* Update the rseg header */
@@ -1338,7 +1338,6 @@ trx_undo_mem_create(
undo->empty = TRUE;
undo->top_page_no = page_no;
undo->guess_block = NULL;
- undo->withdraw_clock = 0;
return(undo);
}
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 44b1c4b30b4..5c62309ee89 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -84,6 +84,7 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include <string.h>
#include "ut0crc32.h"
+#include "my_valgrind.h"
#ifdef _MSC_VER
#include <intrin.h>
@@ -200,15 +201,17 @@ ut_crc32_8_hw(
const byte** data,
ulint* len)
{
-#ifdef _MSC_VER
+# ifdef _MSC_VER
*crc = _mm_crc32_u8(*crc, (*data)[0]);
-#else
+# elif __has_feature(memory_sanitizer)
+ *crc = __builtin_ia32_crc32qi(*crc, (*data)[0]);
+# else
asm("crc32b %1, %0"
/* output operands */
: "+r" (*crc)
/* input operands */
: "rm" ((*data)[0]));
-#endif
+# endif
(*data)++;
(*len)--;
@@ -225,22 +228,24 @@ ut_crc32_64_low_hw(
uint64_t data)
{
uint64_t crc_64bit = crc;
-#ifdef _MSC_VER
-#ifdef _M_X64
+# ifdef _MSC_VER
+# ifdef _M_X64
crc_64bit = _mm_crc32_u64(crc_64bit, data);
-#elif defined(_M_IX86)
+# elif defined(_M_IX86)
crc = _mm_crc32_u32(crc, static_cast<uint32_t>(data));
crc_64bit = _mm_crc32_u32(crc, static_cast<uint32_t>(data >> 32));
-#else
-#error Not Supported processors type.
-#endif
-#else
+# else
+# error Not Supported processors type.
+# endif
+# elif __has_feature(memory_sanitizer)
+ crc_64bit = __builtin_ia32_crc32di(crc_64bit, data);
+# else
asm("crc32q %1, %0"
/* output operands */
: "+r" (crc_64bit)
/* input operands */
: "rm" (data));
-#endif
+# endif
return(static_cast<uint32_t>(crc_64bit));
}
diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc
index 3c1e51536a1..8265121ef2e 100644
--- a/storage/innobase/ut/ut0rnd.cc
+++ b/storage/innobase/ut/ut0rnd.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+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
@@ -25,6 +26,9 @@ Created 5/11/1994 Heikki Tuuri
#include "ut0rnd.h"
+/** Seed value of ut_rnd_gen() */
+int32 ut_rnd_current;
+
/** These random numbers are used in ut_find_prime */
/*@{*/
#define UT_RANDOM_1 1.0412321
@@ -32,9 +36,6 @@ Created 5/11/1994 Heikki Tuuri
#define UT_RANDOM_3 1.0132677
/*@}*/
-/** Seed value of ut_rnd_gen_ulint(). */
-ulint ut_rnd_ulint_counter = 65654363;
-
/***********************************************************//**
Looks for a prime number slightly greater than the given argument.
The prime is chosen so that it is not near any power of 2.
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 252f3a50ae1..1b3d100f9ee 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -168,8 +168,6 @@ ut_print_buf(
const byte* data;
ulint i;
- UNIV_MEM_ASSERT_RW(buf, len);
-
fprintf(file, " len " ULINTPF "; hex ", len);
for (data = (const byte*) buf, i = 0; i < len; i++) {
@@ -204,8 +202,6 @@ ut_print_buf_hex(
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
- UNIV_MEM_ASSERT_RW(buf, len);
-
o << "(0x";
for (data = static_cast<const byte*>(buf), i = 0; i < len; i++) {
@@ -228,8 +224,6 @@ ut_print_buf(
const byte* data;
ulint i;
- UNIV_MEM_ASSERT_RW(buf, len);
-
for (data = static_cast<const byte*>(buf), i = 0; i < len; i++) {
int c = static_cast<int>(*data++);
o << (isprint(c) ? static_cast<char>(c) : ' ');
@@ -614,6 +608,12 @@ ut_basename_noext(
namespace ib {
+ATTRIBUTE_COLD logger& logger::operator<<(dberr_t err)
+{
+ m_oss << ut_strerr(err);
+ return *this;
+}
+
info::~info()
{
sql_print_information("InnoDB: %s", m_oss.str().c_str());
@@ -624,9 +624,13 @@ warn::~warn()
sql_print_warning("InnoDB: %s", m_oss.str().c_str());
}
+/** true if error::~error() was invoked, false otherwise */
+bool error::logged;
+
error::~error()
{
sql_print_error("InnoDB: %s", m_oss.str().c_str());
+ logged = true;
}
#ifdef _MSC_VER
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index e82c76fd938..f1cabfd2039 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -296,7 +296,7 @@ static MYSQL_SYSVAR_BOOL(encrypt_tables, maria_encrypt_tables, PLUGIN_VAR_OPCMDA
"and not FIXED/DYNAMIC)",
0, 0, 0);
-#ifdef HAVE_PSI_INTERFACE
+#if defined HAVE_PSI_INTERFACE && !defined EMBEDDED_LIBRARY
static PSI_mutex_info all_aria_mutexes[]=
{
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index ad6d085b12a..ef529a4be3d 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -1288,6 +1288,7 @@ static my_bool allocate_head(MARIA_FILE_BITMAP *bitmap, uint size,
uint byte= 6 * (last_insert_page / 16);
first_pattern= last_insert_page % 16;
data= bitmap->map+byte;
+ first_found= 0; /* Don't update full_head_size */
DBUG_ASSERT(data <= end);
}
else
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index c6858ff63b8..2795528a044 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3199,6 +3199,7 @@ static int write_page(MARIA_SHARE *share, File file,
args.page= buff;
args.pageno= (pgcache_page_no_t) (pos / share->block_size);
args.data= (uchar*) share;
+ args.crypt_buf= NULL;
(* share->kfile.pre_write_hook)(&args);
res= my_pwrite(file, args.page, block_size, pos, myf_rw);
(* share->kfile.post_write_hook)(res, &args);
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index 03501dc49cf..7d4271c794c 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
-#include "maria_def.h"
+#include "ma_ftdefs.h"
#include "ma_crypt.h"
int maria_close(register MARIA_HA *info)
@@ -86,6 +86,7 @@ int maria_close(register MARIA_HA *info)
share->open_list= list_delete(share->open_list, &info->share_list);
}
+ maria_ftparser_call_deinitializer(info);
my_free(info->rec_buff);
(*share->end)(info);
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 2c9c15d8a2a..dc041b79f06 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -75,7 +75,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
uint max_field_lengths, extra_header_size, column_nr;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr;
+ char kfilename[FN_REFLEN], klinkname[FN_REFLEN], *klinkname_ptr= NullS;
char dfilename[FN_REFLEN], dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
@@ -318,7 +318,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
options|= HA_OPTION_TMP_TABLE;
tmp_table= TRUE;
- create_mode|= O_NOFOLLOW;
+ create_mode|= O_NOFOLLOW | (internal_table ? 0 : O_EXCL);
/* "CREATE TEMPORARY" tables are not crash-safe (dropped at restart) */
ci->transactional= FALSE;
flags&= ~HA_CREATE_PAGE_CHECKSUM;
@@ -886,10 +886,9 @@ int maria_create(const char *name, enum data_file_type datafile_type,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MARIA_NAME_IEXT);
- fn_format(kfilename, name, "", MARIA_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
+ fn_format(kfilename, name, "", MARIA_NAME_IEXT, MY_UNPACK_FILENAME |
+ (internal_table ? 0 : MY_RETURN_REAL_PATH) |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
- klinkname_ptr= NullS;
/*
Replace the current file.
Don't sync dir now if the data file has the same path.
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 1d5bfba182d..b98fbe29e1f 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2007 MySQL AB & Sanja Belkin. 2010 Monty Program Ab.
+ Copyright (c) 2020, 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
@@ -3613,7 +3614,8 @@ my_bool translog_init_with_table(const char *directory,
int old_log_was_recovered= 0, logs_found= 0;
uint old_flags= flags;
uint32 start_file_num= 1;
- TRANSLOG_ADDRESS sure_page, last_page, last_valid_page, checkpoint_lsn;
+ TRANSLOG_ADDRESS UNINIT_VAR(sure_page), last_page, last_valid_page,
+ checkpoint_lsn;
my_bool version_changed= 0;
DBUG_ENTER("translog_init_with_table");
@@ -5440,15 +5442,15 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
src + 1 + LSN_STORE_SIZE));
DBUG_RETURN(src + 1 + LSN_STORE_SIZE);
}
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src));
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) | *((uint8*)src));
break;
case 1:
diff= uint2korr(src);
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) + diff);
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 16) | diff);
break;
case 2:
diff= uint3korr(src);
- rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) + diff);
+ rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 24) | diff);
break;
case 3:
{
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index e2c1e353616..eab079f4fb8 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+ Copyright (c) 2020, 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
@@ -1157,10 +1158,10 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
bit_buff->error=1;
return; /* Can't be right */
}
- bit_buff->current_byte= (bit_buff->current_byte << 32) +
- ((((uint) bit_buff->pos[3])) +
- (((uint) bit_buff->pos[2]) << 8) +
- (((uint) bit_buff->pos[1]) << 16) +
+ bit_buff->current_byte= (bit_buff->current_byte << 32) |
+ ((((uint) bit_buff->pos[3])) |
+ (((uint) bit_buff->pos[2]) << 8) |
+ (((uint) bit_buff->pos[1]) << 16) |
(((uint) bit_buff->pos[0]) << 24));
bit_buff->pos+=4;
bits+=32;
@@ -1251,23 +1252,23 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
return; /* Can't be right */
}
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
if (bits) /* We must have at leasts 9 bits */
{
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos++;
bits+=8;
}
else
{
- bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
+ bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
((uint) ((uchar) bit_buff->pos[1]));
bit_buff->pos+=2;
bits+=16;
@@ -1291,14 +1292,14 @@ static void decode_bytes(MARIA_COLUMNDEF *rec, MARIA_BIT_BUFF *bit_buff,
if (bits < 8)
{ /* We don't need to check end */
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos+=1;
bits+=8;
@@ -1488,25 +1489,25 @@ static void fill_buffer(MARIA_BIT_BUFF *bit_buff)
return;
}
#if BITS_SAVED == 64
- bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
- (((uint) ((uchar) bit_buff->pos[6])) << 8) +
- (((uint) ((uchar) bit_buff->pos[5])) << 16) +
- (((uint) ((uchar) bit_buff->pos[4])) << 24) +
+ bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
+ (((uint) ((uchar) bit_buff->pos[6])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[5])) << 16) |
+ (((uint) ((uchar) bit_buff->pos[4])) << 24) |
((ulonglong)
- ((((uint) ((uchar) bit_buff->pos[3]))) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ ((((uint) ((uchar) bit_buff->pos[3]))) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
bit_buff->pos+=8;
#else
#if BITS_SAVED == 32
- bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24));
bit_buff->pos+=4;
#else
- bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
+ bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
(((uint) ((uchar) bit_buff->pos[0])) << 8));
bit_buff->pos+=2;
#endif
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index 9cd68a208b9..e55c5288d1d 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+ Copyright (c) 2020, 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
@@ -112,7 +113,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
if (lock != PAGECACHE_LOCK_LEFT_UNLOCKED)
{
- DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || PAGECACHE_LOCK_READ);
+ DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE || lock == PAGECACHE_LOCK_READ);
page_link.unlock= (lock == PAGECACHE_LOCK_WRITE ?
PAGECACHE_LOCK_WRITE_UNLOCK :
PAGECACHE_LOCK_READ_UNLOCK);
diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c
index b0c02e60929..4d73ced3b11 100644
--- a/storage/maria/ma_pagecrc.c
+++ b/storage/maria/ma_pagecrc.c
@@ -251,7 +251,8 @@ my_bool maria_page_crc_check_index(int res, PAGECACHE_IO_HOOK_ARGS *args)
if (length > share->block_size - CRC_SIZE)
{
DBUG_PRINT("error", ("Wrong page length: %u", length));
- return (my_errno= HA_ERR_WRONG_CRC);
+ my_errno= HA_ERR_WRONG_CRC;
+ return 1;
}
return maria_page_crc_check(page, (uint32) page_no, share,
MARIA_NO_CRC_NORMAL_PAGE,
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index c8031030361..96b678b8695 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -949,6 +949,7 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
char *old_name, *new_name;
int error= 1;
MARIA_HA *info= NULL;
+ my_bool from_table_is_crashed= 0;
DBUG_ENTER("exec_REDO_LOGREC_REDO_RENAME_TABLE");
if (skip_DDLs)
@@ -1018,15 +1019,15 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
}
if (maria_is_crashed(info))
{
- tprint(tracef, ", is crashed, can't rename it");
- ALERT_USER();
- goto end;
+ tprint(tracef, "is crashed, can't be used for rename ; new-name table ");
+ from_table_is_crashed= 1;
}
if (close_one_table(info->s->open_file_name.str, rec->lsn) ||
maria_close(info))
goto end;
info= NULL;
- tprint(tracef, ", is ok for renaming; new-name table ");
+ if (!from_table_is_crashed)
+ tprint(tracef, "is ok for renaming; new-name table ");
}
else /* one or two files absent, or header corrupted... */
{
@@ -1091,11 +1092,19 @@ prototype_redo_exec_hook(REDO_RENAME_TABLE)
goto end;
info= NULL;
/* abnormal situation */
- tprint(tracef, ", exists but is older than record, can't rename it");
+ tprint(tracef, "exists but is older than record, can't rename it");
goto end;
}
else /* one or two files absent, or header corrupted... */
- tprint(tracef, ", can't be opened, probably does not exist");
+ tprint(tracef, "can't be opened, probably does not exist");
+
+ if (from_table_is_crashed)
+ {
+ eprint(tracef, "Aborting rename as old table was crashed");
+ ALERT_USER();
+ goto end;
+ }
+
tprint(tracef, ", renaming '%s'", old_name);
if (maria_rename(old_name, new_name))
{
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 126554fffdb..826ff40baaf 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -335,12 +335,6 @@ err:
my_errno == HA_ERR_NULL_IN_SPATIAL ||
my_errno == HA_ERR_OUT_OF_MEM)
{
- if (info->bulk_insert)
- {
- uint j;
- for (j=0 ; j < share->base.keys ; j++)
- maria_flush_bulk_insert(info, j);
- }
info->errkey= i < share->base.keys ? (int) i : -1;
/*
We delete keys in the reverse order of insertion. This is the order that
@@ -366,6 +360,7 @@ err:
{
if (_ma_ft_del(info,i,buff,record,filepos))
{
+ fatal_error= 1;
if (local_lock_tree)
mysql_rwlock_unlock(&keyinfo->root_lock);
break;
@@ -380,6 +375,7 @@ err:
filepos,
info->trn->trid)))
{
+ fatal_error= 1;
if (local_lock_tree)
mysql_rwlock_unlock(&keyinfo->root_lock);
break;
@@ -399,6 +395,13 @@ err:
fatal_error= 1;
}
+ if (info->bulk_insert)
+ {
+ uint j;
+ for (j=0 ; j < share->base.keys ; j++)
+ maria_flush_bulk_insert(info, j);
+ }
+
if (fatal_error)
{
maria_print_error(info->s, HA_ERR_CRASHED);
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 5166ae63758..6f2d9fe8a5d 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -782,27 +782,29 @@ static HUFF_COUNTS *init_huff_count(MARIA_HA *info,my_off_t records)
for (i=0 ; i < info->s->base.fields ; i++)
{
enum en_fieldtype type;
- count[i].field_length=info->s->columndef[i].length;
- type= count[i].field_type= (enum en_fieldtype) info->s->columndef[i].type;
+ uint col_nr = info->s->columndef[i].column_nr;
+ count[col_nr].field_length=info->s->columndef[i].length;
+ type= count[col_nr].field_type=
+ (enum en_fieldtype) info->s->columndef[i].type;
if (type == FIELD_INTERVALL ||
type == FIELD_CONSTANT ||
type == FIELD_ZERO)
type = FIELD_NORMAL;
- if (count[i].field_length <= 8 &&
+ if (count[col_nr].field_length <= 8 &&
(type == FIELD_NORMAL ||
type == FIELD_SKIP_ZERO))
- count[i].max_zero_fill= count[i].field_length;
+ count[col_nr].max_zero_fill= count[col_nr].field_length;
/*
For every column initialize a tree, which is used to detect distinct
column values. 'int_tree' works together with 'tree_buff' and
'tree_pos'. It's keys are implemented by pointers into 'tree_buff'.
This is accomplished by '-1' as the element size.
*/
- init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree, NULL,
+ init_tree(&count[col_nr].int_tree,0,0,-1,(qsort_cmp2) compare_tree, NULL,
NULL, MYF(0));
if (records && type != FIELD_BLOB && type != FIELD_VARCHAR)
- count[i].tree_pos=count[i].tree_buff =
- my_malloc(count[i].field_length > 1 ? tree_buff_length : 2,
+ count[col_nr].tree_pos=count[col_nr].tree_buff =
+ my_malloc(count[col_nr].field_length > 1 ? tree_buff_length : 2,
MYF(MY_WME));
}
}
diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp
index dfa28222de5..9db992bb86d 100644
--- a/storage/mroonga/mrn_table.cpp
+++ b/storage/mroonga/mrn_table.cpp
@@ -932,7 +932,7 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
share->wrap_key_info = NULL;
share->wrap_primary_key = MAX_KEY;
}
- memcpy(wrap_table_share, table->s, sizeof(*wrap_table_share));
+ *wrap_table_share= *table->s;
mrn_init_sql_alloc(current_thd, &(wrap_table_share->mem_root));
wrap_table_share->keys = share->wrap_keys;
wrap_table_share->key_info = share->wrap_key_info;
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result
index 015afdb5cf6..cb8a1c61306 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result
@@ -30,7 +30,7 @@ c2 c3
123.456000000000000000000000000000 0.000000000000000000000000000001
98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000
insert into t1 values(6,123.456,0.000000000000000000000000000001);
-ERROR 23000: Duplicate entry '123.456000000000000000000000000000-0.000000000000000000000000000' for key 'uk1'
+ERROR 23000: Duplicate entry '123.456000000000000000000000000000-0.000000000000000000000000...' for key 'uk1'
delete from t1 where c1 = 1;
insert into t1 values(1,123.456,0.000000000000000000000000000001);
drop table t1;
diff --git a/storage/mroonga/vendor/groonga/lib/db.c b/storage/mroonga/vendor/groonga/lib/db.c
index cba22aa0e64..f3769f9aa4c 100644
--- a/storage/mroonga/vendor/groonga/lib/db.c
+++ b/storage/mroonga/vendor/groonga/lib/db.c
@@ -445,6 +445,9 @@ grn_db_close(grn_ctx *ctx, grn_obj *db)
ctx_used_db = ctx->impl && ctx->impl->db == db;
if (ctx_used_db) {
+#ifdef GRN_WITH_MECAB
+ grn_db_fin_mecab_tokenizer(ctx);
+#endif
grn_ctx_loader_clear(ctx);
if (ctx->impl->parser) {
grn_expr_parser_close(ctx);
diff --git a/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h b/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
index e90dbfc0b31..81ac2ab6c46 100644
--- a/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
+++ b/storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
@@ -30,6 +30,7 @@ grn_rc grn_tokenizers_init(void);
grn_rc grn_tokenizers_fin(void);
grn_rc grn_db_init_mecab_tokenizer(grn_ctx *ctx);
+void grn_db_fin_mecab_tokenizer(grn_ctx *ctx);
grn_rc grn_db_init_builtin_tokenizers(grn_ctx *ctx);
#ifdef __cplusplus
diff --git a/storage/mroonga/vendor/groonga/lib/tokenizers.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c
index 11f274e72db..3daacce7ef9 100644
--- a/storage/mroonga/vendor/groonga/lib/tokenizers.c
+++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c
@@ -797,6 +797,36 @@ grn_db_init_mecab_tokenizer(grn_ctx *ctx)
}
}
+void
+grn_db_fin_mecab_tokenizer(grn_ctx *ctx)
+{
+ switch (GRN_CTX_GET_ENCODING(ctx)) {
+ case GRN_ENC_EUC_JP :
+ case GRN_ENC_UTF8 :
+ case GRN_ENC_SJIS :
+#if defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB)
+ {
+ GRN_PLUGIN_DECLARE_FUNCTIONS(tokenizers_mecab);
+ GRN_PLUGIN_IMPL_NAME_TAGGED(fin, tokenizers_mecab)(ctx);
+ }
+#else /* defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB) */
+ {
+ const char *mecab_plugin_name = "tokenizers/mecab";
+ char *path;
+ path = grn_plugin_find_path(ctx, mecab_plugin_name);
+ if (path) {
+ GRN_FREE(path);
+ grn_plugin_unregister(ctx, mecab_plugin_name);
+ }
+ }
+#endif /* defined(GRN_EMBEDDED) && defined(GRN_WITH_MECAB) */
+ break;
+ default :
+ break;
+ }
+ return;
+}
+
#define DEF_TOKENIZER(name, init, next, fin, vars)\
(grn_proc_create(ctx, (name), (sizeof(name) - 1),\
GRN_PROC_TOKENIZER, (init), (next), (fin), 3, (vars)))
diff --git a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
index 3dd969a89c5..cabf2c94e53 100644
--- a/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
+++ b/storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <ctype.h>
+static unsigned int sole_mecab_init_counter = 0;
static mecab_t *sole_mecab = NULL;
static grn_plugin_mutex *sole_mecab_mutex = NULL;
static grn_encoding sole_mecab_encoding = GRN_ENC_NONE;
@@ -563,6 +564,11 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
grn_rc
GRN_PLUGIN_INIT(grn_ctx *ctx)
{
+ ++sole_mecab_init_counter;
+ if (sole_mecab_init_counter > 1)
+ {
+ return GRN_SUCCESS;
+ }
{
char env[GRN_ENV_BUFFER_SIZE];
@@ -636,6 +642,11 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx)
grn_rc
GRN_PLUGIN_FIN(grn_ctx *ctx)
{
+ --sole_mecab_init_counter;
+ if (sole_mecab_init_counter > 0)
+ {
+ return GRN_SUCCESS;
+ }
if (sole_mecab) {
mecab_destroy(sole_mecab);
sole_mecab = NULL;
diff --git a/storage/myisam/ftbench/Ecompare.pl b/storage/myisam/ftbench/Ecompare.pl
index 07132ef9001..a97f126e64e 100755
--- a/storage/myisam/ftbench/Ecompare.pl
+++ b/storage/myisam/ftbench/Ecompare.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/ftbench/Ecreate.pl b/storage/myisam/ftbench/Ecreate.pl
index 86af9f9c0a5..78962466c80 100755
--- a/storage/myisam/ftbench/Ecreate.pl
+++ b/storage/myisam/ftbench/Ecreate.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/ftbench/Ereport.pl b/storage/myisam/ftbench/Ereport.pl
index d3f8961ec85..a8c7c57e1be 100755
--- a/storage/myisam/ftbench/Ereport.pl
+++ b/storage/myisam/ftbench/Ereport.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index b18ffb99a11..d9b9bb5af4a 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -1586,6 +1586,8 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info,
sort_param.filepos=new_header_length;
param->read_cache.end_of_file=sort_info.filelength=
mysql_file_seek(info->dfile, 0L, MY_SEEK_END, MYF(0));
+ if (info->state->data_file_length == 0)
+ info->state->data_file_length= sort_info.filelength;
sort_info.dupp=0;
sort_param.fix_datafile= (my_bool) (! rep_quick);
sort_param.master=1;
@@ -2290,6 +2292,8 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info,
sort_info.buff=0;
param->read_cache.end_of_file=sort_info.filelength=
mysql_file_seek(param->read_cache.file, 0L, MY_SEEK_END, MYF(0));
+ if (info->state->data_file_length == 0)
+ info->state->data_file_length= sort_info.filelength;
sort_param.wordlist=NULL;
init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0,
@@ -2757,6 +2761,8 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
sort_info.buff=0;
param->read_cache.end_of_file=sort_info.filelength=
mysql_file_seek(param->read_cache.file, 0L, MY_SEEK_END, MYF(0));
+ if (info->state->data_file_length == 0)
+ info->state->data_file_length= sort_info.filelength;
if (share->data_file_type == DYNAMIC_RECORD)
rec_length=MY_MAX(share->base.min_pack_length+1,share->base.min_block_length);
diff --git a/storage/myisam/mi_close.c b/storage/myisam/mi_close.c
index e09219e1c85..ca5c7355812 100644
--- a/storage/myisam/mi_close.c
+++ b/storage/myisam/mi_close.c
@@ -20,7 +20,7 @@
to open other files during the time we flush the cache and close this file
*/
-#include "myisamdef.h"
+#include "ftdefs.h"
int mi_close(register MI_INFO *info)
{
@@ -60,6 +60,8 @@ int mi_close(register MI_INFO *info)
mysql_mutex_unlock(&share->intern_lock);
my_free(mi_get_rec_buff_ptr(info, info->rec_buff));
+ ftparser_call_deinitializer(info);
+
if (flag)
{
DBUG_EXECUTE_IF("crash_before_flush_keys",
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index fd230698acc..de516d9fb6a 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -46,7 +46,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
uint aligned_key_start, block_length, res;
uint internal_table= flags & HA_CREATE_INTERNAL_TABLE;
ulong reclength, real_reclength,min_pack_length;
- char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr;
+ char kfilename[FN_REFLEN],klinkname[FN_REFLEN], *klinkname_ptr= 0;
char dfilename[FN_REFLEN],dlinkname[FN_REFLEN], *dlinkname_ptr= 0;
ulong pack_reclength;
ulonglong tot_length,max_rows, tmp;
@@ -184,7 +184,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (flags & HA_CREATE_TMP_TABLE)
{
options|= HA_OPTION_TMP_TABLE;
- create_mode|= O_NOFOLLOW;
+ create_mode|= O_NOFOLLOW | (internal_table ? 0 : O_EXCL);
}
if (flags & HA_CREATE_CHECKSUM || (options & HA_OPTION_CHECKSUM))
{
@@ -619,10 +619,9 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
char *iext= strrchr(name, '.');
int have_iext= iext && !strcmp(iext, MI_NAME_IEXT);
- fn_format(kfilename, name, "", MI_NAME_IEXT,
- MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH |
+ fn_format(kfilename, name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME |
+ (internal_table ? 0 : MY_RETURN_REAL_PATH) |
(have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT));
- klinkname_ptr= 0;
/* Replace the current file */
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
}
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index 72ce17b6a78..572fe690da8 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2020, 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
@@ -1111,10 +1112,10 @@ static void decode_bytes(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,uchar *to,
bit_buff->error=1;
return; /* Can't be right */
}
- bit_buff->current_byte= (bit_buff->current_byte << 32) +
- ((((uint) bit_buff->pos[3])) +
- (((uint) bit_buff->pos[2]) << 8) +
- (((uint) bit_buff->pos[1]) << 16) +
+ bit_buff->current_byte= (bit_buff->current_byte << 32) |
+ ((((uint) bit_buff->pos[3])) |
+ (((uint) bit_buff->pos[2]) << 8) |
+ (((uint) bit_buff->pos[1]) << 16) |
(((uint) bit_buff->pos[0]) << 24));
bit_buff->pos+=4;
bits+=32;
@@ -1205,23 +1206,23 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
return; /* Can't be right */
}
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
if (bits) /* We must have at leasts 9 bits */
{
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos++;
bits+=8;
}
else
{
- bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) +
+ bit_buff->current_byte= ((uint) ((uchar) bit_buff->pos[0]) << 8) |
((uint) ((uchar) bit_buff->pos[1]));
bit_buff->pos+=2;
bits+=16;
@@ -1245,14 +1246,14 @@ static void decode_bytes(MI_COLUMNDEF *rec, MI_BIT_BUFF *bit_buff, uchar *to,
if (bits < 8)
{ /* We don't need to check end */
#if BITS_SAVED == 32
- bit_buff->current_byte= (bit_buff->current_byte << 24) +
- (((uint) ((uchar) bit_buff->pos[2]))) +
- (((uint) ((uchar) bit_buff->pos[1])) << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 24) |
+ (((uint) ((uchar) bit_buff->pos[2]))) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 8) |
(((uint) ((uchar) bit_buff->pos[0])) << 16);
bit_buff->pos+=3;
bits+=24;
#else
- bit_buff->current_byte= (bit_buff->current_byte << 8) +
+ bit_buff->current_byte= (bit_buff->current_byte << 8) |
(uint) ((uchar) bit_buff->pos[0]);
bit_buff->pos+=1;
bits+=8;
@@ -1439,25 +1440,25 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
}
#if BITS_SAVED == 64
- bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
- (((uint) ((uchar) bit_buff->pos[6])) << 8) +
- (((uint) ((uchar) bit_buff->pos[5])) << 16) +
- (((uint) ((uchar) bit_buff->pos[4])) << 24) +
+ bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) |
+ (((uint) ((uchar) bit_buff->pos[6])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[5])) << 16) |
+ (((uint) ((uchar) bit_buff->pos[4])) << 24) |
((ulonglong)
- ((((uint) ((uchar) bit_buff->pos[3]))) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ ((((uint) ((uchar) bit_buff->pos[3]))) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24)) << 32));
bit_buff->pos+=8;
#else
#if BITS_SAVED == 32
- bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) +
- (((uint) ((uchar) bit_buff->pos[2])) << 8) +
- (((uint) ((uchar) bit_buff->pos[1])) << 16) +
+ bit_buff->current_byte= (((uint) ((uchar) bit_buff->pos[3])) |
+ (((uint) ((uchar) bit_buff->pos[2])) << 8) |
+ (((uint) ((uchar) bit_buff->pos[1])) << 16) |
(((uint) ((uchar) bit_buff->pos[0])) << 24));
bit_buff->pos+=4;
#else
- bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1]))+
+ bit_buff->current_byte= (uint) (((uint) ((uchar) bit_buff->pos[1])) |
(((uint) ((uchar) bit_buff->pos[0])) << 8));
bit_buff->pos+=2;
#endif
diff --git a/storage/myisammrg/myrg_extra.c b/storage/myisammrg/myrg_extra.c
index 43dfc18c710..2b3861b9f7f 100644
--- a/storage/myisammrg/myrg_extra.c
+++ b/storage/myisammrg/myrg_extra.c
@@ -31,7 +31,7 @@ int myrg_extra(MYRG_INFO *info,enum ha_extra_function function,
DBUG_PRINT("info",("function: %lu", (ulong) function));
if (!info->children_attached)
- DBUG_RETURN(1);
+ DBUG_RETURN(0);
if (function == HA_EXTRA_CACHE)
{
info->cache_in_use=1;
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 46a801802a1..bf91213dbb0 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates
+ Copyright (c) 2010, 2020, 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
@@ -38,7 +39,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
int save_errno,errpos=0;
uint files= 0, i, dir_length, length, UNINIT_VAR(key_parts), min_keys= 0;
ulonglong file_offset=0;
- char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
+ char name_buff[FN_REFLEN*2],buff[FN_REFLEN];
MYRG_INFO *m_info=0;
File fd;
IO_CACHE file;
@@ -62,8 +63,9 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
dir_length=dirname_part(name_buff, name, &name_buff_length);
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
- if ((end=buff+length)[-1] == '\n')
- end[-1]='\0';
+ char *end= &buff[length - 1];
+ if (*end == '\n')
+ *end= '\0';
if (buff[0] && buff[0] != '#')
files++;
}
@@ -71,8 +73,9 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
my_b_seek(&file, 0);
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
- if ((end=buff+length)[-1] == '\n')
- *--end='\0';
+ char *end= &buff[length - 1];
+ if (*end == '\n')
+ *end= '\0';
if (!buff[0])
continue; /* Skip empty lines */
if (buff[0] == '#')
diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt
index 7db67700fac..e1839bc5b00 100644
--- a/storage/perfschema/CMakeLists.txt
+++ b/storage/perfschema/CMakeLists.txt
@@ -1,13 +1,20 @@
-# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2019, Oracle and/or its affiliates. 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.
+# it under the terms of the GNU General Public License, version 2.0,
+# as published by the Free Software Foundation.
+#
+# This program is also distributed with certain software (including
+# but not limited to OpenSSL) that is licensed under separate terms,
+# as designated in a particular file or component or in included license
+# documentation. The authors of MySQL hereby grant you an additional
+# permission to link the program and your derivative works with the
+# separately licensed software that they have included with MySQL.
#
# 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.
+# GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/cursor_by_account.cc b/storage/perfschema/cursor_by_account.cc
index 2e75b8d51bd..f26318c42fc 100644
--- a/storage/perfschema/cursor_by_account.cc
+++ b/storage/perfschema/cursor_by_account.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_account.h b/storage/perfschema/cursor_by_account.h
index 150615b9c54..c14a563b712 100644
--- a/storage/perfschema/cursor_by_account.h
+++ b/storage/perfschema/cursor_by_account.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_host.cc b/storage/perfschema/cursor_by_host.cc
index d16f8b24b8e..c3397234e2e 100644
--- a/storage/perfschema/cursor_by_host.cc
+++ b/storage/perfschema/cursor_by_host.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_host.h b/storage/perfschema/cursor_by_host.h
index db33bbad808..ac68acf3945 100644
--- a/storage/perfschema/cursor_by_host.h
+++ b/storage/perfschema/cursor_by_host.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_thread.cc b/storage/perfschema/cursor_by_thread.cc
index 2fa9202fcf0..afdc9010b1f 100644
--- a/storage/perfschema/cursor_by_thread.cc
+++ b/storage/perfschema/cursor_by_thread.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_thread.h b/storage/perfschema/cursor_by_thread.h
index 5a77edf325f..db130088920 100644
--- a/storage/perfschema/cursor_by_thread.h
+++ b/storage/perfschema/cursor_by_thread.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_thread_connect_attr.cc b/storage/perfschema/cursor_by_thread_connect_attr.cc
index 2d5399cdac1..90a200b809a 100644
--- a/storage/perfschema/cursor_by_thread_connect_attr.cc
+++ b/storage/perfschema/cursor_by_thread_connect_attr.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/cursor_by_thread_connect_attr.h b/storage/perfschema/cursor_by_thread_connect_attr.h
index b5059918f7f..69d1b5ec0c0 100644
--- a/storage/perfschema/cursor_by_thread_connect_attr.h
+++ b/storage/perfschema/cursor_by_thread_connect_attr.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/cursor_by_user.cc b/storage/perfschema/cursor_by_user.cc
index 37ecbf17fee..273d186b01c 100644
--- a/storage/perfschema/cursor_by_user.cc
+++ b/storage/perfschema/cursor_by_user.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/cursor_by_user.h b/storage/perfschema/cursor_by_user.h
index d6e997766b6..06554ebb228 100644
--- a/storage/perfschema/cursor_by_user.h
+++ b/storage/perfschema/cursor_by_user.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/gen_pfs_lex_token.cc b/storage/perfschema/gen_pfs_lex_token.cc
index dcf25c79706..5a51a8aeb2f 100644
--- a/storage/perfschema/gen_pfs_lex_token.cc
+++ b/storage/perfschema/gen_pfs_lex_token.cc
@@ -2,13 +2,20 @@
Copyright (c) 2011, 2014, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 864c41e5a05..17d33aeadb7 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h
index 9c56fc1928e..0fbfdeba325 100644
--- a/storage/perfschema/ha_perfschema.h
+++ b/storage/perfschema/ha_perfschema.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 8d55e1b0393..dbad7e966a5 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h
index da5e11edab7..8e0d9b760ed 100644
--- a/storage/perfschema/pfs.h
+++ b/storage/perfschema/pfs.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 5ac16b7636e..be2153e84ae 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_account.h b/storage/perfschema/pfs_account.h
index 544abf913ae..cd7b1520df5 100644
--- a/storage/perfschema/pfs_account.h
+++ b/storage/perfschema/pfs_account.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h
index def9339d06d..00d1197970b 100644
--- a/storage/perfschema/pfs_atomic.h
+++ b/storage/perfschema/pfs_atomic.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_autosize.cc b/storage/perfschema/pfs_autosize.cc
index 2d1723c177a..43c754939a4 100644
--- a/storage/perfschema/pfs_autosize.cc
+++ b/storage/perfschema/pfs_autosize.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h
index ef657b38707..09fce551402 100644
--- a/storage/perfschema/pfs_column_types.h
+++ b/storage/perfschema/pfs_column_types.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc
index 87fa9f0b639..697010e46b8 100644
--- a/storage/perfschema/pfs_column_values.cc
+++ b/storage/perfschema/pfs_column_values.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h
index eb25a5977e3..55ffa139fe0 100644
--- a/storage/perfschema/pfs_column_values.h
+++ b/storage/perfschema/pfs_column_values.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_con_slice.cc b/storage/perfschema/pfs_con_slice.cc
index bce4918ae9e..9f9deb0919c 100644
--- a/storage/perfschema/pfs_con_slice.cc
+++ b/storage/perfschema/pfs_con_slice.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_con_slice.h b/storage/perfschema/pfs_con_slice.h
index f83764339c3..ed17de5f2b0 100644
--- a/storage/perfschema/pfs_con_slice.h
+++ b/storage/perfschema/pfs_con_slice.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_defaults.cc b/storage/perfschema/pfs_defaults.cc
index ec2da41e30b..f879c527b4f 100644
--- a/storage/perfschema/pfs_defaults.cc
+++ b/storage/perfschema/pfs_defaults.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_defaults.h b/storage/perfschema/pfs_defaults.h
index d95c4914e9d..7751b55b83b 100644
--- a/storage/perfschema/pfs_defaults.h
+++ b/storage/perfschema/pfs_defaults.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index 1362ef2676b..7d66731ce3a 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
index 543fa7858a4..352f495a80c 100644
--- a/storage/perfschema/pfs_digest.h
+++ b/storage/perfschema/pfs_digest.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 8e521dcd486..08c0fe8ecfe 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h
index d3c4a0e43e6..c53cd205d71 100644
--- a/storage/perfschema/pfs_engine_table.h
+++ b/storage/perfschema/pfs_engine_table.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_events.h b/storage/perfschema/pfs_events.h
index 09c3935816f..ca2fd8582ad 100644
--- a/storage/perfschema/pfs_events.h
+++ b/storage/perfschema/pfs_events.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_events_stages.cc b/storage/perfschema/pfs_events_stages.cc
index 673d2cb95f5..a68b0729e96 100644
--- a/storage/perfschema/pfs_events_stages.cc
+++ b/storage/perfschema/pfs_events_stages.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_events_stages.h b/storage/perfschema/pfs_events_stages.h
index ea879bcd211..f61a7c3c077 100644
--- a/storage/perfschema/pfs_events_stages.h
+++ b/storage/perfschema/pfs_events_stages.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_events_statements.cc b/storage/perfschema/pfs_events_statements.cc
index 66a98e3f7d8..1942787665a 100644
--- a/storage/perfschema/pfs_events_statements.cc
+++ b/storage/perfschema/pfs_events_statements.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_events_statements.h b/storage/perfschema/pfs_events_statements.h
index a56423d3863..e47e2e79280 100644
--- a/storage/perfschema/pfs_events_statements.h
+++ b/storage/perfschema/pfs_events_statements.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc
index f99a1f31bd9..c3961461f34 100644
--- a/storage/perfschema/pfs_events_waits.cc
+++ b/storage/perfschema/pfs_events_waits.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index 25784fd52ba..702f7e3ce07 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -2,13 +2,20 @@
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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index 25dd817b149..afa31ffa903 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index d8636a09d57..9c85506d7c2 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 2d24a5f4b97..d6461ef3851 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_host.h b/storage/perfschema/pfs_host.h
index 4e6b24bf6c6..d52207d3571 100644
--- a/storage/perfschema/pfs_host.h
+++ b/storage/perfschema/pfs_host.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index d52af3e80df..675679f9b4d 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index 76eeabb99da..12447c0c4e7 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index f4b32c4a438..c75418b28e9 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -1,13 +1,21 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2020, 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
@@ -612,6 +620,7 @@ static void init_instr_class(PFS_instr_class *klass,
DBUG_ASSERT(name_length <= PFS_MAX_INFO_NAME_LENGTH);
memset(klass, 0, sizeof(PFS_instr_class));
strncpy(klass->m_name, name, name_length);
+ klass->m_name[PFS_MAX_INFO_NAME_LENGTH - 1]= '\0';
klass->m_name_length= name_length;
klass->m_flags= flags;
klass->m_enabled= true;
diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h
index 038814b07e2..9d256fac78a 100644
--- a/storage/perfschema/pfs_instr_class.h
+++ b/storage/perfschema/pfs_instr_class.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index 4011cba2070..b74131c79e1 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index 9dd6fbf4762..77574f1ce49 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h
index aea86a576cc..0532dcb7eba 100644
--- a/storage/perfschema/pfs_server.h
+++ b/storage/perfschema/pfs_server.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_setup_actor.cc b/storage/perfschema/pfs_setup_actor.cc
index 42c32b12411..c4cec6c9ff8 100644
--- a/storage/perfschema/pfs_setup_actor.cc
+++ b/storage/perfschema/pfs_setup_actor.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_setup_actor.h b/storage/perfschema/pfs_setup_actor.h
index 92a1617c304..613d5454a9c 100644
--- a/storage/perfschema/pfs_setup_actor.h
+++ b/storage/perfschema/pfs_setup_actor.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc
index 128091a398b..f33030e927f 100644
--- a/storage/perfschema/pfs_setup_object.cc
+++ b/storage/perfschema/pfs_setup_object.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_setup_object.h b/storage/perfschema/pfs_setup_object.h
index 0d343f552b2..ee40742941c 100644
--- a/storage/perfschema/pfs_setup_object.h
+++ b/storage/perfschema/pfs_setup_object.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h
index 9e4da7957f6..8a049e3013b 100644
--- a/storage/perfschema/pfs_stat.h
+++ b/storage/perfschema/pfs_stat.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc
index 5e2c27c217b..8533dffcb27 100644
--- a/storage/perfschema/pfs_timer.cc
+++ b/storage/perfschema/pfs_timer.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h
index a4f55c20994..738e0b365fb 100644
--- a/storage/perfschema/pfs_timer.h
+++ b/storage/perfschema/pfs_timer.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index d923d4158a5..14b86e1478e 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_user.h b/storage/perfschema/pfs_user.h
index f2b1c4409c7..3d0457eae59 100644
--- a/storage/perfschema/pfs_user.h
+++ b/storage/perfschema/pfs_user.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/pfs_visitor.cc b/storage/perfschema/pfs_visitor.cc
index 3df7ef91bb3..097965fde17 100644
--- a/storage/perfschema/pfs_visitor.cc
+++ b/storage/perfschema/pfs_visitor.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/pfs_visitor.h b/storage/perfschema/pfs_visitor.h
index c3ada2f4e0b..120b5928045 100644
--- a/storage/perfschema/pfs_visitor.h
+++ b/storage/perfschema/pfs_visitor.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_accounts.cc b/storage/perfschema/table_accounts.cc
index 007fcb25550..708f8269a69 100644
--- a/storage/perfschema/table_accounts.cc
+++ b/storage/perfschema/table_accounts.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_accounts.h b/storage/perfschema/table_accounts.h
index f72eb39ed39..dfc2cc322e0 100644
--- a/storage/perfschema/table_accounts.h
+++ b/storage/perfschema/table_accounts.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc
index 05ec9f09c11..d48028b1539 100644
--- a/storage/perfschema/table_all_instr.cc
+++ b/storage/perfschema/table_all_instr.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h
index 7c9d5d9b0d6..072221ba86e 100644
--- a/storage/perfschema/table_all_instr.h
+++ b/storage/perfschema/table_all_instr.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.cc b/storage/perfschema/table_esgs_by_account_by_event_name.cc
index 3bc76f899ad..22e4e0040f1 100644
--- a/storage/perfschema/table_esgs_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_account_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.h b/storage/perfschema/table_esgs_by_account_by_event_name.h
index 5afd68cd7d9..ee855d42818 100644
--- a/storage/perfschema/table_esgs_by_account_by_event_name.h
+++ b/storage/perfschema/table_esgs_by_account_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.cc b/storage/perfschema/table_esgs_by_host_by_event_name.cc
index bbef6a8d16d..86cc2eb1b86 100644
--- a/storage/perfschema/table_esgs_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_host_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.h b/storage/perfschema/table_esgs_by_host_by_event_name.h
index afc6d529428..6042e6396af 100644
--- a/storage/perfschema/table_esgs_by_host_by_event_name.h
+++ b/storage/perfschema/table_esgs_by_host_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.cc b/storage/perfschema/table_esgs_by_thread_by_event_name.cc
index 57ef634acad..dfda9702abb 100644
--- a/storage/perfschema/table_esgs_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_thread_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.h b/storage/perfschema/table_esgs_by_thread_by_event_name.h
index 7db8d1be408..6ff677a95e2 100644
--- a/storage/perfschema/table_esgs_by_thread_by_event_name.h
+++ b/storage/perfschema/table_esgs_by_thread_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.cc b/storage/perfschema/table_esgs_by_user_by_event_name.cc
index f8e8518bde3..af73c1fc5fd 100644
--- a/storage/perfschema/table_esgs_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esgs_by_user_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.h b/storage/perfschema/table_esgs_by_user_by_event_name.h
index 8f48747c8c8..bc545c2438a 100644
--- a/storage/perfschema/table_esgs_by_user_by_event_name.h
+++ b/storage/perfschema/table_esgs_by_user_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_global_by_event_name.cc b/storage/perfschema/table_esgs_global_by_event_name.cc
index 83a4dbf43fd..6c5f0866671 100644
--- a/storage/perfschema/table_esgs_global_by_event_name.cc
+++ b/storage/perfschema/table_esgs_global_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esgs_global_by_event_name.h b/storage/perfschema/table_esgs_global_by_event_name.h
index 2b0ac8b6218..b8884355676 100644
--- a/storage/perfschema/table_esgs_global_by_event_name.h
+++ b/storage/perfschema/table_esgs_global_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_account_by_event_name.cc b/storage/perfschema/table_esms_by_account_by_event_name.cc
index d8f04d7af23..7afdabcbbfe 100644
--- a/storage/perfschema/table_esms_by_account_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_account_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_account_by_event_name.h b/storage/perfschema/table_esms_by_account_by_event_name.h
index ff212291760..64f2053cff6 100644
--- a/storage/perfschema/table_esms_by_account_by_event_name.h
+++ b/storage/perfschema/table_esms_by_account_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_digest.cc b/storage/perfschema/table_esms_by_digest.cc
index ae648378b2a..5295c29dc40 100644
--- a/storage/perfschema/table_esms_by_digest.cc
+++ b/storage/perfschema/table_esms_by_digest.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_digest.h b/storage/perfschema/table_esms_by_digest.h
index 682dc70ab10..903b86110f6 100644
--- a/storage/perfschema/table_esms_by_digest.h
+++ b/storage/perfschema/table_esms_by_digest.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_host_by_event_name.cc b/storage/perfschema/table_esms_by_host_by_event_name.cc
index 7233b340bd2..42629ab6c09 100644
--- a/storage/perfschema/table_esms_by_host_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_host_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_host_by_event_name.h b/storage/perfschema/table_esms_by_host_by_event_name.h
index def5e19ecdc..a6985b48149 100644
--- a/storage/perfschema/table_esms_by_host_by_event_name.h
+++ b/storage/perfschema/table_esms_by_host_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.cc b/storage/perfschema/table_esms_by_thread_by_event_name.cc
index f62d974aa76..0a7cf46986c 100644
--- a/storage/perfschema/table_esms_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_thread_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.h b/storage/perfschema/table_esms_by_thread_by_event_name.h
index 7c50307c483..72645d03389 100644
--- a/storage/perfschema/table_esms_by_thread_by_event_name.h
+++ b/storage/perfschema/table_esms_by_thread_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_user_by_event_name.cc b/storage/perfschema/table_esms_by_user_by_event_name.cc
index 66afe288f12..f8708ac9a14 100644
--- a/storage/perfschema/table_esms_by_user_by_event_name.cc
+++ b/storage/perfschema/table_esms_by_user_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_by_user_by_event_name.h b/storage/perfschema/table_esms_by_user_by_event_name.h
index 65284122043..d1d1e5df85d 100644
--- a/storage/perfschema/table_esms_by_user_by_event_name.h
+++ b/storage/perfschema/table_esms_by_user_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_global_by_event_name.cc b/storage/perfschema/table_esms_global_by_event_name.cc
index 96957bf028e..7d9584752b0 100644
--- a/storage/perfschema/table_esms_global_by_event_name.cc
+++ b/storage/perfschema/table_esms_global_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_esms_global_by_event_name.h b/storage/perfschema/table_esms_global_by_event_name.h
index 7453d635848..b90c14c0c0f 100644
--- a/storage/perfschema/table_esms_global_by_event_name.h
+++ b/storage/perfschema/table_esms_global_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_events_stages.cc b/storage/perfschema/table_events_stages.cc
index 757c42b59c4..0a09d2c83fa 100644
--- a/storage/perfschema/table_events_stages.cc
+++ b/storage/perfschema/table_events_stages.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_stages.h b/storage/perfschema/table_events_stages.h
index cbc0f9a42bb..ae8760cd953 100644
--- a/storage/perfschema/table_events_stages.h
+++ b/storage/perfschema/table_events_stages.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index 4470e5bda43..392f1f747f2 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h
index 6f8bc1621d0..cec28628f3e 100644
--- a/storage/perfschema/table_events_statements.h
+++ b/storage/perfschema/table_events_statements.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index b16688e3983..d6955a46984 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h
index 3e09fa487ad..90c1d341e5d 100644
--- a/storage/perfschema/table_events_waits.h
+++ b/storage/perfschema/table_events_waits.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc
index 2f5c83d57d3..03477f6d542 100644
--- a/storage/perfschema/table_events_waits_summary.cc
+++ b/storage/perfschema/table_events_waits_summary.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h
index a4f063bb66a..53f1bed7987 100644
--- a/storage/perfschema/table_events_waits_summary.h
+++ b/storage/perfschema/table_events_waits_summary.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_ews_by_account_by_event_name.cc b/storage/perfschema/table_ews_by_account_by_event_name.cc
index 0b86a4ac1dc..fa6258ec9ac 100644
--- a/storage/perfschema/table_ews_by_account_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_account_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_account_by_event_name.h b/storage/perfschema/table_ews_by_account_by_event_name.h
index b46008e2675..7cde09183e3 100644
--- a/storage/perfschema/table_ews_by_account_by_event_name.h
+++ b/storage/perfschema/table_ews_by_account_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_host_by_event_name.cc b/storage/perfschema/table_ews_by_host_by_event_name.cc
index e82c734431c..e3ef7ca3720 100644
--- a/storage/perfschema/table_ews_by_host_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_host_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_host_by_event_name.h b/storage/perfschema/table_ews_by_host_by_event_name.h
index c631da36ec5..8ce44a96617 100644
--- a/storage/perfschema/table_ews_by_host_by_event_name.h
+++ b/storage/perfschema/table_ews_by_host_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.cc b/storage/perfschema/table_ews_by_thread_by_event_name.cc
index 7b3e220e973..33f9765310b 100644
--- a/storage/perfschema/table_ews_by_thread_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.h b/storage/perfschema/table_ews_by_thread_by_event_name.h
index cf94e7a81a2..b67664bfced 100644
--- a/storage/perfschema/table_ews_by_thread_by_event_name.h
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_user_by_event_name.cc b/storage/perfschema/table_ews_by_user_by_event_name.cc
index 577a9ef6676..cb99f749a9c 100644
--- a/storage/perfschema/table_ews_by_user_by_event_name.cc
+++ b/storage/perfschema/table_ews_by_user_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_by_user_by_event_name.h b/storage/perfschema/table_ews_by_user_by_event_name.h
index e987cf1bcec..f4f29534be4 100644
--- a/storage/perfschema/table_ews_by_user_by_event_name.h
+++ b/storage/perfschema/table_ews_by_user_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_ews_global_by_event_name.cc b/storage/perfschema/table_ews_global_by_event_name.cc
index 9a5ba4f2375..7420c6351fd 100644
--- a/storage/perfschema/table_ews_global_by_event_name.cc
+++ b/storage/perfschema/table_ews_global_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_ews_global_by_event_name.h b/storage/perfschema/table_ews_global_by_event_name.h
index 57e3459e373..8157d274112 100644
--- a/storage/perfschema/table_ews_global_by_event_name.h
+++ b/storage/perfschema/table_ews_global_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc
index 7914664e2e0..b323df83ad2 100644
--- a/storage/perfschema/table_file_instances.cc
+++ b/storage/perfschema/table_file_instances.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h
index e07017911de..5b44e63028e 100644
--- a/storage/perfschema/table_file_instances.h
+++ b/storage/perfschema/table_file_instances.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_summary_by_event_name.cc b/storage/perfschema/table_file_summary_by_event_name.cc
index e98bc528995..459b2bf99a6 100644
--- a/storage/perfschema/table_file_summary_by_event_name.cc
+++ b/storage/perfschema/table_file_summary_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_summary_by_event_name.h b/storage/perfschema/table_file_summary_by_event_name.h
index 7a13fcdc4d9..b8cb293cb07 100644
--- a/storage/perfschema/table_file_summary_by_event_name.h
+++ b/storage/perfschema/table_file_summary_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_summary_by_instance.cc b/storage/perfschema/table_file_summary_by_instance.cc
index b80811d0a5b..3a30984405c 100644
--- a/storage/perfschema/table_file_summary_by_instance.cc
+++ b/storage/perfschema/table_file_summary_by_instance.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_file_summary_by_instance.h b/storage/perfschema/table_file_summary_by_instance.h
index 872698f8e58..0e7ce6958b2 100644
--- a/storage/perfschema/table_file_summary_by_instance.h
+++ b/storage/perfschema/table_file_summary_by_instance.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011 Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_helper.cc b/storage/perfschema/table_helper.cc
index 0dbeeb259c1..d6bdd894483 100644
--- a/storage/perfschema/table_helper.cc
+++ b/storage/perfschema/table_helper.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_helper.h b/storage/perfschema/table_helper.h
index b57abe9c4e6..62f94826754 100644
--- a/storage/perfschema/table_helper.h
+++ b/storage/perfschema/table_helper.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_host_cache.cc b/storage/perfschema/table_host_cache.cc
index 758a2c6dea6..430dcf2763d 100644
--- a/storage/perfschema/table_host_cache.cc
+++ b/storage/perfschema/table_host_cache.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_host_cache.h b/storage/perfschema/table_host_cache.h
index 47abb42444e..8add0b5049c 100644
--- a/storage/perfschema/table_host_cache.h
+++ b/storage/perfschema/table_host_cache.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_hosts.cc b/storage/perfschema/table_hosts.cc
index 2c5377db4ac..8bc5310817c 100644
--- a/storage/perfschema/table_hosts.cc
+++ b/storage/perfschema/table_hosts.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_hosts.h b/storage/perfschema/table_hosts.h
index 60b70ae803e..422b6449b25 100644
--- a/storage/perfschema/table_hosts.h
+++ b/storage/perfschema/table_hosts.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_os_global_by_type.cc b/storage/perfschema/table_os_global_by_type.cc
index cd2ace50c85..b549b0c22e7 100644
--- a/storage/perfschema/table_os_global_by_type.cc
+++ b/storage/perfschema/table_os_global_by_type.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_os_global_by_type.h b/storage/perfschema/table_os_global_by_type.h
index a434961b65b..2b9293ece06 100644
--- a/storage/perfschema/table_os_global_by_type.h
+++ b/storage/perfschema/table_os_global_by_type.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc
index 8d31c017832..a77f005ab62 100644
--- a/storage/perfschema/table_performance_timers.cc
+++ b/storage/perfschema/table_performance_timers.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h
index e1dc93fcbe4..93210ac9882 100644
--- a/storage/perfschema/table_performance_timers.h
+++ b/storage/perfschema/table_performance_timers.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_account_connect_attrs.cc b/storage/perfschema/table_session_account_connect_attrs.cc
index c00f72e36b4..59a36e1cdb0 100644
--- a/storage/perfschema/table_session_account_connect_attrs.cc
+++ b/storage/perfschema/table_session_account_connect_attrs.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_account_connect_attrs.h b/storage/perfschema/table_session_account_connect_attrs.h
index d56d571fb79..483001fcb91 100644
--- a/storage/perfschema/table_session_account_connect_attrs.h
+++ b/storage/perfschema/table_session_account_connect_attrs.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_connect.cc b/storage/perfschema/table_session_connect.cc
index 737ff514555..47dd63a9f49 100644
--- a/storage/perfschema/table_session_connect.cc
+++ b/storage/perfschema/table_session_connect.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_connect.h b/storage/perfschema/table_session_connect.h
index 91d24ab7075..ee1019fe7f2 100644
--- a/storage/perfschema/table_session_connect.h
+++ b/storage/perfschema/table_session_connect.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2012, 2013, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_connect_attrs.cc b/storage/perfschema/table_session_connect_attrs.cc
index 859c6f2f8b8..a4bb651f291 100644
--- a/storage/perfschema/table_session_connect_attrs.cc
+++ b/storage/perfschema/table_session_connect_attrs.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_session_connect_attrs.h b/storage/perfschema/table_session_connect_attrs.h
index de18085d8ac..927c3a92af2 100644
--- a/storage/perfschema/table_session_connect_attrs.h
+++ b/storage/perfschema/table_session_connect_attrs.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_actors.cc b/storage/perfschema/table_setup_actors.cc
index fcb32b9cb35..305cfd32169 100644
--- a/storage/perfschema/table_setup_actors.cc
+++ b/storage/perfschema/table_setup_actors.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_actors.h b/storage/perfschema/table_setup_actors.h
index 550e196c8d1..3082c9c3922 100644
--- a/storage/perfschema/table_setup_actors.h
+++ b/storage/perfschema/table_setup_actors.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc
index f00e1fff48d..afd7f41260a 100644
--- a/storage/perfschema/table_setup_consumers.cc
+++ b/storage/perfschema/table_setup_consumers.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h
index b27c8873550..608ee880435 100644
--- a/storage/perfschema/table_setup_consumers.h
+++ b/storage/perfschema/table_setup_consumers.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc
index 8adea1d3604..4741e944ee0 100644
--- a/storage/perfschema/table_setup_instruments.cc
+++ b/storage/perfschema/table_setup_instruments.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h
index b2711578d7f..433fdaf056b 100644
--- a/storage/perfschema/table_setup_instruments.h
+++ b/storage/perfschema/table_setup_instruments.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_objects.cc b/storage/perfschema/table_setup_objects.cc
index 8049fcdf48c..168c51cfdda 100644
--- a/storage/perfschema/table_setup_objects.cc
+++ b/storage/perfschema/table_setup_objects.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h
index 943cc4a1ad5..66f9fb2c8e8 100644
--- a/storage/perfschema/table_setup_objects.h
+++ b/storage/perfschema/table_setup_objects.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index 26539da2e27..be1ac58cc3e 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h
index 9eb2f95836c..667c1d94889 100644
--- a/storage/perfschema/table_setup_timers.h
+++ b/storage/perfschema/table_setup_timers.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_instances.cc b/storage/perfschema/table_socket_instances.cc
index 419e19349f4..920531136d5 100644
--- a/storage/perfschema/table_socket_instances.cc
+++ b/storage/perfschema/table_socket_instances.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_instances.h b/storage/perfschema/table_socket_instances.h
index b5e5edb36ed..41b5ee3fd21 100644
--- a/storage/perfschema/table_socket_instances.h
+++ b/storage/perfschema/table_socket_instances.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_summary_by_event_name.cc b/storage/perfschema/table_socket_summary_by_event_name.cc
index 2da45c0d2cd..c813d45b732 100644
--- a/storage/perfschema/table_socket_summary_by_event_name.cc
+++ b/storage/perfschema/table_socket_summary_by_event_name.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_summary_by_event_name.h b/storage/perfschema/table_socket_summary_by_event_name.h
index 9bdeb3104b4..4f679d89b09 100644
--- a/storage/perfschema/table_socket_summary_by_event_name.h
+++ b/storage/perfschema/table_socket_summary_by_event_name.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_summary_by_instance.cc b/storage/perfschema/table_socket_summary_by_instance.cc
index 693f65e4843..a4b1477aa90 100644
--- a/storage/perfschema/table_socket_summary_by_instance.cc
+++ b/storage/perfschema/table_socket_summary_by_instance.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_socket_summary_by_instance.h b/storage/perfschema/table_socket_summary_by_instance.h
index deb8ffab554..a9eab8d18b6 100644
--- a/storage/perfschema/table_socket_summary_by_instance.h
+++ b/storage/perfschema/table_socket_summary_by_instance.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc
index 6e48468e6c3..f0c7800d24a 100644
--- a/storage/perfschema/table_sync_instances.cc
+++ b/storage/perfschema/table_sync_instances.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h
index c6a2ed8adaa..6f7e1bf5523 100644
--- a/storage/perfschema/table_sync_instances.h
+++ b/storage/perfschema/table_sync_instances.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index aff2e818f70..eccf41db971 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2014, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h
index 823f66bf713..927438eec61 100644
--- a/storage/perfschema/table_threads.h
+++ b/storage/perfschema/table_threads.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_tiws_by_index_usage.cc b/storage/perfschema/table_tiws_by_index_usage.cc
index 5d24fcc689b..b49e9280469 100644
--- a/storage/perfschema/table_tiws_by_index_usage.cc
+++ b/storage/perfschema/table_tiws_by_index_usage.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_tiws_by_index_usage.h b/storage/perfschema/table_tiws_by_index_usage.h
index f6d935365b2..a284bc7f0bc 100644
--- a/storage/perfschema/table_tiws_by_index_usage.h
+++ b/storage/perfschema/table_tiws_by_index_usage.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_tiws_by_table.cc b/storage/perfschema/table_tiws_by_table.cc
index 78535fd6512..db00fd2409e 100644
--- a/storage/perfschema/table_tiws_by_table.cc
+++ b/storage/perfschema/table_tiws_by_table.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_tiws_by_table.h b/storage/perfschema/table_tiws_by_table.h
index 9a86d39196c..7427ca797fa 100644
--- a/storage/perfschema/table_tiws_by_table.h
+++ b/storage/perfschema/table_tiws_by_table.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_tlws_by_table.cc b/storage/perfschema/table_tlws_by_table.cc
index 5299e7f6a56..d802127d10d 100644
--- a/storage/perfschema/table_tlws_by_table.cc
+++ b/storage/perfschema/table_tlws_by_table.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_tlws_by_table.h b/storage/perfschema/table_tlws_by_table.h
index 757adc3f5f5..b5872a07762 100644
--- a/storage/perfschema/table_tlws_by_table.h
+++ b/storage/perfschema/table_tlws_by_table.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/table_users.cc b/storage/perfschema/table_users.cc
index 6d6bfc5bfaf..883ebd36633 100644
--- a/storage/perfschema/table_users.cc
+++ b/storage/perfschema/table_users.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/table_users.h b/storage/perfschema/table_users.h
index 1b24dfb9039..912f0f43714 100644
--- a/storage/perfschema/table_users.h
+++ b/storage/perfschema/table_users.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt
index b449640b374..7b8c906a4e6 100644
--- a/storage/perfschema/unittest/CMakeLists.txt
+++ b/storage/perfschema/unittest/CMakeLists.txt
@@ -1,13 +1,20 @@
-# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2019, Oracle and/or its affiliates. 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.
+# it under the terms of the GNU General Public License, version 2.0,
+# as published by the Free Software Foundation.
+#
+# This program is also distributed with certain software (including
+# but not limited to OpenSSL) that is licensed under separate terms,
+# as designated in a particular file or component or in included license
+# documentation. The authors of MySQL hereby grant you an additional
+# permission to link the program and your derivative works with the
+# separately licensed software that they have included with MySQL.
#
# 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.
+# GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt
index 8a14b9ed14b..f84ba3317b1 100644
--- a/storage/perfschema/unittest/conf.txt
+++ b/storage/perfschema/unittest/conf.txt
@@ -1,13 +1,20 @@
# Copyright (c) 2009, 2010, Oracle and/or its affiliates.
#
# 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.
+# it under the terms of the GNU General Public License, version 2.0,
+# as published by the Free Software Foundation.
+#
+# This program is also distributed with certain software (including
+# but not limited to OpenSSL) that is licensed under separate terms,
+# as designated in a particular file or component or in included license
+# documentation. The authors of MySQL hereby grant you an additional
+# permission to link the program and your derivative works with the
+# separately licensed software that they have included with MySQL.
#
# 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.
+# GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index e2ff73699ec..6e46d772380 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2018, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_account-oom-t.cc b/storage/perfschema/unittest/pfs_account-oom-t.cc
index 71c089ab0f5..1ca66445e0c 100644
--- a/storage/perfschema/unittest/pfs_account-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_account-oom-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_connect_attr-t.cc b/storage/perfschema/unittest/pfs_connect_attr-t.cc
index 3dd62ca5662..7ebfb0c8294 100644
--- a/storage/perfschema/unittest/pfs_connect_attr-t.cc
+++ b/storage/perfschema/unittest/pfs_connect_attr-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_host-oom-t.cc b/storage/perfschema/unittest/pfs_host-oom-t.cc
index e2eba7e6aff..14af1af0352 100644
--- a/storage/perfschema/unittest/pfs_host-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_host-oom-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc
index a18902dc3db..231fd1e100b 100644
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc
index 47a91d9bb9a..c9f4bac1171 100644
--- a/storage/perfschema/unittest/pfs_instr-t.cc
+++ b/storage/perfschema/unittest/pfs_instr-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
index bdb2648c2f3..7eb21a33bd7 100644
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc
index 0d8ec38525d..f1e246dc387 100644
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_misc-t.cc b/storage/perfschema/unittest/pfs_misc-t.cc
index c308cf4b82d..7d274c0820d 100644
--- a/storage/perfschema/unittest/pfs_misc-t.cc
+++ b/storage/perfschema/unittest/pfs_misc-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2015, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc
index 3c4b864d742..db1600faf9f 100644
--- a/storage/perfschema/unittest/pfs_server_stubs.cc
+++ b/storage/perfschema/unittest/pfs_server_stubs.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc
index 9ef111f531c..139454b8649 100644
--- a/storage/perfschema/unittest/pfs_timer-t.cc
+++ b/storage/perfschema/unittest/pfs_timer-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/pfs_user-oom-t.cc b/storage/perfschema/unittest/pfs_user-oom-t.cc
index 6e81df8d5e2..ca451f3e457 100644
--- a/storage/perfschema/unittest/pfs_user-oom-t.cc
+++ b/storage/perfschema/unittest/pfs_user-oom-t.cc
@@ -1,13 +1,20 @@
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/stub_pfs_defaults.h b/storage/perfschema/unittest/stub_pfs_defaults.h
index 6b4ee3f0e15..951508733e2 100644
--- a/storage/perfschema/unittest/stub_pfs_defaults.h
+++ b/storage/perfschema/unittest/stub_pfs_defaults.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2010, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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
diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h
index a665ed39704..8a1f9216ba2 100644
--- a/storage/perfschema/unittest/stub_pfs_global.h
+++ b/storage/perfschema/unittest/stub_pfs_global.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h
index 476a6c0e901..2cd2ad5b03c 100644
--- a/storage/perfschema/unittest/stub_print_error.h
+++ b/storage/perfschema/unittest/stub_print_error.h
@@ -1,13 +1,20 @@
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. 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.
+ it under the terms of the GNU General Public License, version 2.0,
+ as published by the Free Software Foundation.
+
+ This program is also distributed with certain software (including
+ but not limited to OpenSSL) that is licensed under separate terms,
+ as designated in a particular file or component or in included license
+ documentation. The authors of MySQL hereby grant you an additional
+ permission to link the program and your derivative works with the
+ separately licensed software that they have included with MySQL.
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.
+ GNU General Public License, version 2.0, 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,
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index fa564a603e6..f9384848243 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -54,6 +54,9 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
ENDIF()
SET(CXX11_FLAGS "-std=c++11")
+ IF (GCC_VERSION VERSION_LESS 5.0)
+ SET(CXX11_FLAGS "-std=c++11 -Wno-missing-field-initializers")
+ ENDIF()
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
(CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
@@ -108,9 +111,15 @@ SET(ROCKSDB_SE_SOURCES
# This is a strong requirement coming from RocksDB. No conditional checks here.
#ADD_DEFINITIONS(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX
#)
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+ SET(ATOMIC_EXTRA_LIBS -latomic)
+else()
+ SET(ATOMIC_EXTRA_LIBS)
+endif()
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} MODULE_ONLY STORAGE_ENGINE
MODULE_OUTPUT_NAME ha_rocksdb
+ LINK_LIBRARIES ${ATOMIC_EXTRA_LIBS}
COMPONENT rocksdb-engine)
IF(NOT TARGET rocksdb)
@@ -161,6 +170,7 @@ TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
if (UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt)
endif()
+TARGET_LINK_LIBRARIES(rocksdb_aux_lib ${ATOMIC_EXTRA_LIBS})
# IF (WITH_JEMALLOC)
# FIND_LIBRARY(JEMALLOC_LIBRARY
@@ -253,7 +263,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/myrocks_hotbackup.py
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)
+ SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS "-frtti -Wno-error")
ENDIF()
IF(MSVC)
# RocksDB, the storage engine, overdoes "const" by adding
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index ac1307f1037..883ee15f74c 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -18,25 +18,24 @@ if(WIN32)
# include(${ROCKSDB_SOURCE_DIR}/thirdparty.inc)
else()
option(WITH_ROCKSDB_JEMALLOC "build RocksDB with JeMalloc" OFF)
- if(WITH_ROCKSDB_JEMALLOC)
- find_package(JeMalloc REQUIRED)
- add_definitions(-DROCKSDB_JEMALLOC)
- ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
- include_directories(${JEMALLOC_INCLUDE_DIR})
- endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD has jemaloc as default malloc
add_definitions(-DROCKSDB_JEMALLOC)
ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
set(WITH_JEMALLOC ON)
+ elseif(WITH_ROCKSDB_JEMALLOC)
+ find_package(JeMalloc REQUIRED)
+ add_definitions(-DROCKSDB_JEMALLOC)
+ ADD_DEFINITIONS(-DROCKSDB_MALLOC_USABLE_SIZE)
+ include_directories(${JEMALLOC_INCLUDE_DIR})
endif()
endif()
# Optional compression libraries.
-foreach(compression_lib LZ4 BZIP2 ZSTD snappy)
- FIND_PACKAGE(${compression_lib} QUIET)
+foreach(compression_lib LZ4 BZip2 ZSTD snappy)
+ FIND_PACKAGE(${compression_lib})
SET(WITH_ROCKSDB_${compression_lib} AUTO CACHE STRING
"Build RocksDB with ${compression_lib} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
@@ -54,16 +53,16 @@ if(LZ4_FOUND AND (NOT WITH_ROCKSDB_LZ4 STREQUAL "OFF"))
list(APPEND THIRDPARTY_LIBS ${LZ4_LIBRARY})
endif()
-if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZIP2 STREQUAL "OFF"))
+if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZip2 STREQUAL "OFF"))
add_definitions(-DBZIP2)
include_directories(${BZIP2_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES})
endif()
-if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF"))
+if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_snappy STREQUAL "OFF"))
add_definitions(-DSNAPPY)
- include_directories(${SNAPPY_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES})
+ include_directories(${snappy_INCLUDE_DIR})
+ list(APPEND THIRDPARTY_LIBS ${snappy_LIBRARIES})
endif()
include(CheckFunctionExists)
@@ -132,6 +131,10 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
+ set(SYSTEM_LIBS ${SYSTEM_LIBS} -latomic)
+endif()
+
option(WITH_FALLOCATE "build with fallocate" ON)
if(WITH_FALLOCATE AND UNIX)
@@ -189,31 +192,32 @@ set(ROCKSDB_SOURCES
cache/clock_cache.cc
cache/lru_cache.cc
cache/sharded_cache.cc
+ db/arena_wrapped_db_iter.cc
db/builder.cc
db/c.cc
db/column_family.cc
db/compacted_db_impl.cc
db/compaction/compaction.cc
db/compaction/compaction_iterator.cc
- db/compaction/compaction_job.cc
db/compaction/compaction_picker.cc
+ db/compaction/compaction_job.cc
db/compaction/compaction_picker_fifo.cc
db/compaction/compaction_picker_level.cc
db/compaction/compaction_picker_universal.cc
db/convenience.cc
db/db_filesnapshot.cc
- db/dbformat.cc
db/db_impl/db_impl.cc
+ db/db_impl/db_impl_write.cc
db/db_impl/db_impl_compaction_flush.cc
- db/db_impl/db_impl_debug.cc
- db/db_impl/db_impl_experimental.cc
db/db_impl/db_impl_files.cc
db/db_impl/db_impl_open.cc
+ db/db_impl/db_impl_debug.cc
+ db/db_impl/db_impl_experimental.cc
db/db_impl/db_impl_readonly.cc
db/db_impl/db_impl_secondary.cc
- db/db_impl/db_impl_write.cc
db/db_info_dumper.cc
db/db_iter.cc
+ db/dbformat.cc
db/error_handler.cc
db/event_helpers.cc
db/experimental.cc
@@ -222,9 +226,10 @@ set(ROCKSDB_SOURCES
db/flush_job.cc
db/flush_scheduler.cc
db/forward_iterator.cc
+ db/import_column_family_job.cc
db/internal_stats.cc
- db/log_reader.cc
db/logs_with_prep_tracker.cc
+ db/log_reader.cc
db/log_writer.cc
db/malloc_stats.cc
db/memtable.cc
@@ -238,22 +243,31 @@ set(ROCKSDB_SOURCES
db/table_cache.cc
db/table_properties_collector.cc
db/transaction_log_impl.cc
+ db/trim_history_scheduler.cc
db/version_builder.cc
db/version_edit.cc
db/version_set.cc
db/wal_manager.cc
- db/write_batch_base.cc
db/write_batch.cc
+ db/write_batch_base.cc
db/write_controller.cc
db/write_thread.cc
env/env.cc
env/env_chroot.cc
+ env/env_encryption.cc
env/env_hdfs.cc
+ env/file_system.cc
env/mock_env.cc
file/delete_scheduler.cc
- file/filename.cc
+ file/file_prefetch_buffer.cc
file/file_util.cc
+ file/filename.cc
+ file/random_access_file_reader.cc
+ file/read_write_util.cc
+ file/readahead_raf.cc
+ file/sequence_file_reader.cc
file/sst_file_manager_impl.cc
+ file/writable_file_writer.cc
logging/auto_roll_logger.cc
logging/event_logger.cc
logging/log_buffer.cc
@@ -268,8 +282,8 @@ set(ROCKSDB_SOURCES
memtable/write_buffer_manager.cc
monitoring/histogram.cc
monitoring/histogram_windowing.cc
- monitoring/instrumented_mutex.cc
monitoring/in_memory_stats_history.cc
+ monitoring/instrumented_mutex.cc
monitoring/iostats_context.cc
monitoring/perf_context.cc
monitoring/perf_level.cc
@@ -277,7 +291,6 @@ set(ROCKSDB_SOURCES
monitoring/statistics.cc
monitoring/thread_status_impl.cc
monitoring/thread_status_updater.cc
- monitoring/thread_status_updater_debug.cc
monitoring/thread_status_util.cc
monitoring/thread_status_util_debug.cc
options/cf_options.cc
@@ -288,21 +301,24 @@ set(ROCKSDB_SOURCES
options/options_sanity_check.cc
port/stack_trace.cc
table/adaptive/adaptive_table_factory.cc
+ table/block_based/block.cc
table/block_based/block_based_filter_block.cc
table/block_based/block_based_table_builder.cc
table/block_based/block_based_table_factory.cc
table/block_based/block_based_table_reader.cc
table/block_based/block_builder.cc
- table/block_based/block.cc
table/block_based/block_prefix_index.cc
- table/block_based/data_block_footer.cc
table/block_based/data_block_hash_index.cc
+ table/block_based/data_block_footer.cc
+ table/block_based/filter_block_reader_common.cc
+ table/block_based/filter_policy.cc
table/block_based/flush_block_policy.cc
table/block_based/full_filter_block.cc
table/block_based/index_builder.cc
+ table/block_based/parsed_full_filter_block.cc
table/block_based/partitioned_filter_block.cc
+ table/block_based/uncompression_dict_reader.cc
table/block_fetcher.cc
- table/bloom_block.cc
table/cuckoo/cuckoo_table_builder.cc
table/cuckoo/cuckoo_table_factory.cc
table/cuckoo/cuckoo_table_reader.cc
@@ -312,6 +328,7 @@ set(ROCKSDB_SOURCES
table/merging_iterator.cc
table/meta_blocks.cc
table/persistent_cache_helper.cc
+ table/plain/plain_table_bloom.cc
table/plain/plain_table_builder.cc
table/plain/plain_table_factory.cc
table/plain/plain_table_index.cc
@@ -323,23 +340,34 @@ set(ROCKSDB_SOURCES
table/two_level_iterator.cc
test_util/sync_point.cc
test_util/sync_point_impl.cc
+ test_util/testutil.cc
+ test_util/transaction_test_util.cc
+ tools/block_cache_analyzer/block_cache_trace_analyzer.cc
+ tools/dump/db_dump_tool.cc
tools/ldb_cmd.cc
tools/ldb_tool.cc
tools/sst_dump_tool.cc
- trace_replay/block_cache_tracer.cc
+ tools/trace_analyzer_tool.cc
trace_replay/trace_replay.cc
- util/bloom.cc
+ trace_replay/block_cache_tracer.cc
util/coding.cc
util/compaction_job_stats_impl.cc
util/comparator.cc
util/compression_context_cache.cc
util/concurrent_task_limiter_impl.cc
- util/crc32c_arm64.cc
util/crc32c.cc
util/dynamic_bloom.cc
- util/file_reader_writer.cc
- util/filter_policy.cc
util/hash.cc
+ util/murmurhash.cc
+ util/random.cc
+ util/rate_limiter.cc
+ util/slice.cc
+ util/file_checksum_helper.cc
+ util/status.cc
+ util/string_util.cc
+ util/thread_local.cc
+ util/threadpool_imp.cc
+ util/xxhash.cc
utilities/backupable/backupable_db.cc
utilities/blob_db/blob_compaction_filter.cc
utilities/blob_db/blob_db.cc
@@ -347,12 +375,11 @@ set(ROCKSDB_SOURCES
utilities/blob_db/blob_db_impl_filesnapshot.cc
utilities/blob_db/blob_dump_tool.cc
utilities/blob_db/blob_file.cc
- utilities/blob_db/blob_log_format.cc
utilities/blob_db/blob_log_reader.cc
utilities/blob_db/blob_log_writer.cc
+ utilities/blob_db/blob_log_format.cc
utilities/checkpoint/checkpoint_impl.cc
utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc
- utilities/convenience/info_log_finder.cc
utilities/debug.cc
utilities/env_mirror.cc
utilities/env_timed.cc
@@ -361,9 +388,11 @@ set(ROCKSDB_SOURCES
utilities/merge_operators/bytesxor.cc
utilities/merge_operators/max.cc
utilities/merge_operators/put.cc
- utilities/merge_operators/string_append/stringappend2.cc
+ utilities/merge_operators/sortlist.cc
utilities/merge_operators/string_append/stringappend.cc
+ utilities/merge_operators/string_append/stringappend2.cc
utilities/merge_operators/uint64add.cc
+ utilities/object_registry.cc
utilities/option_change_migration/option_change_migration.cc
utilities/options/options_util.cc
utilities/persistent_cache/block_cache_tier.cc
@@ -371,11 +400,12 @@ set(ROCKSDB_SOURCES
utilities/persistent_cache/block_cache_tier_metadata.cc
utilities/persistent_cache/persistent_cache_tier.cc
utilities/persistent_cache/volatile_tier_impl.cc
+ utilities/simulator_cache/cache_simulator.cc
utilities/simulator_cache/sim_cache.cc
utilities/table_properties_collectors/compact_on_deletion_collector.cc
utilities/trace/file_trace_reader_writer.cc
- utilities/transactions/optimistic_transaction.cc
utilities/transactions/optimistic_transaction_db_impl.cc
+ utilities/transactions/optimistic_transaction.cc
utilities/transactions/pessimistic_transaction.cc
utilities/transactions/pessimistic_transaction_db.cc
utilities/transactions/snapshot_checker.cc
@@ -390,15 +420,6 @@ set(ROCKSDB_SOURCES
utilities/ttl/db_ttl_impl.cc
utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc
- util/murmurhash.cc
- util/random.cc
- util/rate_limiter.cc
- util/slice.cc
- util/status.cc
- util/string_util.cc
- util/thread_local.cc
- util/threadpool_imp.cc
- util/xxhash.cc
)
@@ -415,7 +436,8 @@ else()
list(APPEND ROCKSDB_SOURCES
port/port_posix.cc
env/env_posix.cc
- env/io_posix.cc)
+ env/io_posix.cc
+ env/fs_posix.cc)
# ppc64 or ppc64le
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
enable_language(ASM)
@@ -423,6 +445,17 @@ else()
util/crc32c_ppc.c
util/crc32c_ppc_asm.S)
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+ # aarch
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
+ INCLUDE(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("-march=armv8-a+crc+crypto" HAS_ARMV8_CRC)
+ if(HAS_ARMV8_CRC)
+ message(STATUS " HAS_ARMV8_CRC yes")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crc+crypto -Wno-unused-function")
+ list(APPEND ROCKSDB_SOURCES
+ util/crc32c_arm64.cc)
+ endif(HAS_ARMV8_CRC)
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
endif()
SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES})
@@ -471,6 +504,6 @@ list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/build_version.cc)
ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -frtti")
+ set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -frtti -Wno-error")
endif()
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index bf9183d7dea..5cbe4c162a8 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -114,7 +114,6 @@ int thd_binlog_format(const MYSQL_THD thd);
bool thd_binlog_filter_ok(const MYSQL_THD thd);
}
-MYSQL_PLUGIN_IMPORT bool my_disable_leak_check;
extern my_bool opt_core_file;
// Needed in rocksdb_init_func
@@ -5688,13 +5687,6 @@ static int rocksdb_init_func(void *const p) {
}
#endif
- /**
- Rocksdb does not always shutdown its threads, when
- plugin is shut down. Disable server's leak check
- at exit to avoid crash.
- */
- my_disable_leak_check = true;
-
err = my_error_register(rdb_get_error_messages, HA_ERR_ROCKSDB_FIRST,
HA_ERR_ROCKSDB_LAST);
if (err != 0) {
diff --git a/storage/rocksdb/mysql-test/rocksdb/include/restart_mysqld_with_option.inc b/storage/rocksdb/mysql-test/rocksdb/include/restart_mysqld_with_option.inc
index 4250b368b1a..81cd2200ae0 100644
--- a/storage/rocksdb/mysql-test/rocksdb/include/restart_mysqld_with_option.inc
+++ b/storage/rocksdb/mysql-test/rocksdb/include/restart_mysqld_with_option.inc
@@ -15,7 +15,7 @@ if ($rpl_inited)
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
-shutdown_server 10;
+shutdown_server;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart:$_mysqld_option" > $_expect_file_name
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/check_ignore_unknown_options.test b/storage/rocksdb/mysql-test/rocksdb/t/check_ignore_unknown_options.test
index c8c12626139..15a7d319c04 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/check_ignore_unknown_options.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/check_ignore_unknown_options.test
@@ -41,7 +41,7 @@ perl;
EOF
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
+--shutdown_server
--error 1
--exec $MYSQLD_CMD --plugin_load=$HA_ROCKSDB_SO --rocksdb_ignore_unknown_options=0 --log-error=$error_log
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/concurrent_alter.test b/storage/rocksdb/mysql-test/rocksdb/t/concurrent_alter.test
index 3ebdd67a1a6..aee653830e2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/concurrent_alter.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/concurrent_alter.test
@@ -30,7 +30,7 @@ $MYSQL_SLAP --silent --delimiter=";" --query="select * from a1 where b=1" --conc
wait
EOF
---exec bash $MYSQL_TMP_DIR/concurrent_alter.sh
+--exec sh $MYSQL_TMP_DIR/concurrent_alter.sh
let $server_charset=`select @@character_set_server`;
--replace_result $server_charset DEFAULT_CHARSET
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/insert_optimized_config.test b/storage/rocksdb/mysql-test/rocksdb/t/insert_optimized_config.test
index 46ea7f0eb0a..a24851d9d8c 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/insert_optimized_config.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/insert_optimized_config.test
@@ -8,7 +8,7 @@ DROP TABLE IF EXISTS t1;
# reload with load optimized config
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_write_disable_wal=1 --rocksdb_flush_log_at_trx_commit=0 --rocksdb_default_cf_options=write_buffer_size=16k;target_file_size_base=16k;level0_file_num_compaction_trigger=4;level0_slowdown_writes_trigger=256;level0_stop_writes_trigger=256;max_write_buffer_number=16;compression_per_level=kNoCompression;memtable=vector:1024 --rocksdb_override_cf_options=__system__={memtable=skip_list:16} --rocksdb_compaction_sequential_deletes=0 --rocksdb_compaction_sequential_deletes_window=0 --rocksdb_allow_concurrent_memtable_write=0" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
@@ -39,7 +39,7 @@ select count(*), sum(id), sum(i1), sum(i2) from t1;
# reload without load optimized config
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_write_disable_wal=0 --rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mysqldump2.test b/storage/rocksdb/mysql-test/rocksdb/t/mysqldump2.test
index ca9eb5d2ecf..4f4f5ed092b 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mysqldump2.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mysqldump2.test
@@ -21,7 +21,7 @@ optimize table t1;
#wiping block cache
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;disable_auto_compactions=true;level0_stop_writes_trigger=1000 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.test b/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.test
index 7a8f4fc7085..50df3f9c102 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.test
@@ -32,7 +32,7 @@ while ($t <= 6) {
# Disable auto compaction so that effects of optimize table are stable
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;disable_auto_compactions=true;level0_stop_writes_trigger=1000 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/persistent_cache.test b/storage/rocksdb/mysql-test/rocksdb/t/persistent_cache.test
index 03d1d0a60bc..49e5e5c1172 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/persistent_cache.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/persistent_cache.test
@@ -10,7 +10,7 @@ DROP TABLE IF EXISTS t1;
--exec echo "wait" >$_expect_file_name
# restart server with correct parameters
-shutdown_server 10;
+shutdown_server;
--exec echo "restart:--rocksdb_persistent_cache_path=$_cache_file_name --rocksdb_persistent_cache_size_mb=100" >$_expect_file_name
--sleep 5
--enable_reconnect
@@ -28,7 +28,7 @@ select * from t1 where a = 1;
# restart server to re-read cache
--exec echo "wait" >$_expect_file_name
-shutdown_server 10;
+shutdown_server;
--exec echo "restart:--rocksdb_persistent_cache_path=$_cache_file_name --rocksdb_persistent_cache_size_mb=100" >$_expect_file_name
--sleep 5
--enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/shutdown.test b/storage/rocksdb/mysql-test/rocksdb/t/shutdown.test
index ba625deb514..f76bc9f6153 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/shutdown.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/shutdown.test
@@ -23,7 +23,7 @@ while ($i <= $max) {
# Restart the server
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
---shutdown_server 10
+--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/validate_datadic.test b/storage/rocksdb/mysql-test/rocksdb/t/validate_datadic.test
index ec48dc03ec8..e7ab37d2658 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/validate_datadic.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/validate_datadic.test
@@ -25,7 +25,7 @@ CREATE TABLE t2 (pk int primary key) ENGINE=ROCKSDB PARTITION BY KEY(pk) PARTITI
# Send shutdown to the connected server and give it 10 seconds to die before
# zapping it
-shutdown_server 10;
+shutdown_server;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" >$_expect_file_name
@@ -42,7 +42,7 @@ shutdown_server 10;
# Now shut down again and rename one of the .frm files
--exec echo "wait" >$_expect_file_name
-shutdown_server 10;
+shutdown_server;
# Rename the file
--move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp
@@ -70,7 +70,7 @@ shutdown_server 10;
# Now shut down again and rename one the .frm file back and make a copy of it
--exec echo "wait" >$_expect_file_name
-shutdown_server 10;
+shutdown_server;
--remove_file $LOG
# Rename the file
--move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm
@@ -92,7 +92,7 @@ shutdown_server 10;
# Shut down an clean up
--exec echo "wait" >$_expect_file_name
-shutdown_server 10;
+shutdown_server;
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_dummy.frm
--exec echo "restart" >$_expect_file_name
--enable_reconnect
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_compaction_readahead_size_basic.result b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_compaction_readahead_size_basic.result
index d971396f9e8..206cfa8188e 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_compaction_readahead_size_basic.result
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_compaction_readahead_size_basic.result
@@ -7,7 +7,7 @@ INSERT INTO invalid_values VALUES('\'aaa\'');
INSERT INTO invalid_values VALUES('\'bbb\'');
SET @@global.rocksdb_compaction_readahead_size = -1;
Warnings:
-Warning 1292 Truncated incorrect rocksdb_compaction_readahead_siz value: '-1'
+Warning 1292 Truncated incorrect rocksdb_compaction_readahead_... value: '-1'
SELECT @@global.rocksdb_compaction_readahead_size;
@@global.rocksdb_compaction_readahead_size
0
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_force_index_records_in_range_basic.result b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_force_index_records_in_range_basic.result
index 1a7a21c3a9f..d4768cfde1e 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_force_index_records_in_range_basic.result
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_force_index_records_in_range_basic.result
@@ -7,7 +7,7 @@ INSERT INTO invalid_values VALUES('\'aaa\'');
INSERT INTO invalid_values VALUES('\'bbb\'');
SET @@session.rocksdb_force_index_records_in_range = -1;
Warnings:
-Warning 1292 Truncated incorrect rocksdb_force_index_records_in_r value: '-1'
+Warning 1292 Truncated incorrect rocksdb_force_index_records_i... value: '-1'
SELECT @@session.rocksdb_force_index_records_in_range;
@@session.rocksdb_force_index_records_in_range
0
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_rate_limiter_bytes_per_sec_basic.result b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_rate_limiter_bytes_per_sec_basic.result
index 94eb9e34057..9d194ad718c 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_rate_limiter_bytes_per_sec_basic.result
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_rate_limiter_bytes_per_sec_basic.result
@@ -97,5 +97,5 @@ Warnings:
Warning 1210 RocksDB: rocksdb_rate_limiter_bytes_per_sec cannot be dynamically changed to or from 0. Do a clean shutdown if you want to change it from or to 0.
SET @@global.rocksdb_rate_limiter_bytes_per_sec = -1;
Warnings:
-Warning 1292 Truncated incorrect rocksdb_rate_limiter_bytes_per_s value: '-1'
+Warning 1292 Truncated incorrect rocksdb_rate_limiter_bytes_pe... value: '-1'
Warning 1210 RocksDB: rocksdb_rate_limiter_bytes_per_sec cannot be dynamically changed to or from 0. Do a clean shutdown if you want to change it from or to 0.
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test
index 8277011831a..743f942af9c 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_rate_limiter_bytes_per_sec_basic.test
@@ -13,7 +13,7 @@ SET @@global.rocksdb_rate_limiter_bytes_per_sec = 10000;
# Send shutdown to the connected server and give it 10 seconds to die before
# zapping it
-shutdown_server 10;
+shutdown_server;
# Attempt to restart the server with the rate limiter on
--exec echo "restart:--rocksdb_rate_limiter_bytes_per_sec=10000" >$_expect_file_name
@@ -53,7 +53,7 @@ SET @@global.rocksdb_rate_limiter_bytes_per_sec = -1;
# Restart the server without the rate limiter
--exec echo "wait" >$_expect_file_name
-shutdown_server 10;
+shutdown_server;
--exec echo "restart" >$_expect_file_name
--sleep 5
diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc
index 8b7886667eb..f7e944c2e39 100644
--- a/storage/rocksdb/rdb_sst_info.cc
+++ b/storage/rocksdb/rdb_sst_info.cc
@@ -507,7 +507,7 @@ void Rdb_sst_info::set_error_msg(const std::string &sst_file_name,
void Rdb_sst_info::report_error_msg(const rocksdb::Status &s,
const char *sst_file_name) {
if (s.IsInvalidArgument() &&
- strcmp(s.getState(), "Keys must be added in order") == 0) {
+ strcmp(s.getState(), "Keys must be added in strict ascending order.") == 0) {
my_printf_error(ER_KEYS_OUT_OF_ORDER,
"Rows must be inserted in primary key order "
"during bulk load operation",
diff --git a/storage/rocksdb/rocksdb b/storage/rocksdb/rocksdb
-Subproject e731f4402258554812c46334dc0d9483e6cc769
+Subproject bba5e7bc21093d7cfa765e1280a7c4fdcd28428
diff --git a/storage/rocksdb/ut0counter.h b/storage/rocksdb/ut0counter.h
index cfa474e7a99..3a7ee85d01c 100644
--- a/storage/rocksdb/ut0counter.h
+++ b/storage/rocksdb/ut0counter.h
@@ -23,7 +23,7 @@ Created 2012/04/12 by Sunny Bains
#include <string.h>
/** CPU cache line size */
-#define CACHE_LINE_SIZE 64
+#define UT_CACHE_LINE_SIZE 64
/** Default number of slots to use in ib_counter_t */
#define IB_N_SLOTS 64
@@ -43,7 +43,7 @@ struct generic_indexer_t {
/** @return offset within m_counter */
size_t offset(size_t index) const {
- return(((index % N) + 1) * (CACHE_LINE_SIZE / sizeof(Type)));
+ return(((index % N) + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type)));
}
};
@@ -90,7 +90,7 @@ struct single_indexer_t {
/** @return offset within m_counter */
size_t offset(size_t index) const {
DBUG_ASSERT(N == 1);
- return((CACHE_LINE_SIZE / sizeof(Type)));
+ return((UT_CACHE_LINE_SIZE / sizeof(Type)));
}
/* @return 1 */
@@ -103,7 +103,7 @@ struct single_indexer_t {
/** Class for using fuzzy counters. The counter is not protected by any
mutex and the results are not guaranteed to be 100% accurate but close
enough. Creates an array of counters and separates each element by the
-CACHE_LINE_SIZE bytes */
+UT_CACHE_LINE_SIZE bytes */
template <
typename Type,
int N = IB_N_SLOTS,
@@ -119,7 +119,7 @@ public:
bool validate() {
#ifdef UNIV_DEBUG
- size_t n = (CACHE_LINE_SIZE / sizeof(Type));
+ size_t n = (UT_CACHE_LINE_SIZE / sizeof(Type));
/* Check that we aren't writing outside our defined bounds. */
for (size_t i = 0; i < UT_ARRAY_SIZE(m_counter); i += n) {
@@ -197,7 +197,7 @@ private:
Indexer<Type, N>m_policy;
/** Slot 0 is unused. */
- Type m_counter[(N + 1) * (CACHE_LINE_SIZE / sizeof(Type))];
+ Type m_counter[(N + 1) * (UT_CACHE_LINE_SIZE / sizeof(Type))];
};
#endif /* UT0COUNTER_H */
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index fb453ddc637..5e7b5a1e8ce 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -2258,6 +2258,7 @@ int ha_spider::index_read_map_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -2265,6 +2266,11 @@ int ha_spider::index_read_map_internal(
}
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -2286,11 +2292,15 @@ int ha_spider::index_read_map_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -2325,6 +2335,8 @@ int ha_spider::index_read_map_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -2351,6 +2363,8 @@ int ha_spider::index_read_map_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -2750,6 +2764,7 @@ int ha_spider::index_read_last_map_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -2757,6 +2772,11 @@ int ha_spider::index_read_last_map_internal(
}
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -2775,11 +2795,15 @@ int ha_spider::index_read_last_map_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -2814,6 +2838,8 @@ int ha_spider::index_read_last_map_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -2840,6 +2866,8 @@ int ha_spider::index_read_last_map_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -3216,6 +3244,7 @@ int ha_spider::index_first_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -3224,6 +3253,11 @@ int ha_spider::index_first_internal(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -3242,11 +3276,15 @@ int ha_spider::index_first_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -3281,6 +3319,8 @@ int ha_spider::index_first_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -3307,6 +3347,8 @@ int ha_spider::index_first_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -3600,6 +3642,7 @@ int ha_spider::index_last_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -3608,6 +3651,11 @@ int ha_spider::index_last_internal(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -3626,11 +3674,15 @@ int ha_spider::index_last_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -3665,6 +3717,8 @@ int ha_spider::index_last_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -3691,6 +3745,8 @@ int ha_spider::index_last_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -4044,6 +4100,7 @@ int ha_spider::read_range_first_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -4051,6 +4108,11 @@ int ha_spider::read_range_first_internal(
}
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -4069,11 +4131,15 @@ int ha_spider::read_range_first_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -4108,6 +4174,8 @@ int ha_spider::read_range_first_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -4134,6 +4202,8 @@ int ha_spider::read_range_first_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -4670,6 +4740,7 @@ int ha_spider::read_multi_range_first_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -4678,6 +4749,11 @@ int ha_spider::read_multi_range_first_internal(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -4702,11 +4778,15 @@ int ha_spider::read_multi_range_first_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -4742,6 +4822,8 @@ int ha_spider::read_multi_range_first_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -4770,6 +4852,8 @@ int ha_spider::read_multi_range_first_internal(
if (!error_num)
{
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -5463,6 +5547,7 @@ int ha_spider::read_multi_range_first_internal(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -5471,6 +5556,11 @@ int ha_spider::read_multi_range_first_internal(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -5496,11 +5586,15 @@ int ha_spider::read_multi_range_first_internal(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5542,6 +5636,8 @@ int ha_spider::read_multi_range_first_internal(
-1,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -5577,6 +5673,8 @@ int ha_spider::read_multi_range_first_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -5603,6 +5701,8 @@ int ha_spider::read_multi_range_first_internal(
break;
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -6110,6 +6210,7 @@ int ha_spider::read_multi_range_next(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -6118,6 +6219,11 @@ int ha_spider::read_multi_range_next(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -6142,11 +6248,15 @@ int ha_spider::read_multi_range_next(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6182,6 +6292,8 @@ int ha_spider::read_multi_range_next(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -6210,6 +6322,8 @@ int ha_spider::read_multi_range_next(
if (!error_num)
{
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -6907,6 +7021,7 @@ int ha_spider::read_multi_range_next(
}
#endif
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -6915,6 +7030,11 @@ int ha_spider::read_multi_range_next(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -6940,11 +7060,15 @@ int ha_spider::read_multi_range_next(
} else {
#endif
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6986,6 +7110,8 @@ int ha_spider::read_multi_range_next(
-1,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -7021,6 +7147,8 @@ int ha_spider::read_multi_range_next(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -7047,6 +7175,8 @@ int ha_spider::read_multi_range_next(
break;
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -7524,6 +7654,7 @@ int ha_spider::rnd_next_internal(
sql_type = SPIDER_SQL_TYPE_HANDLER;
}
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -7532,6 +7663,11 @@ int ha_spider::rnd_next_internal(
if ((error_num =
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -7541,11 +7677,15 @@ int ha_spider::rnd_next_internal(
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn,
roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -7580,6 +7720,8 @@ int ha_spider::rnd_next_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -7606,6 +7748,8 @@ int ha_spider::rnd_next_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -8116,6 +8260,7 @@ int ha_spider::ft_read_internal(
uint dbton_id = share->use_sql_dbton_ids[roop_count];
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
SPIDER_CONN *conn = conns[roop_count];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_SELECT_SQL))
{
@@ -8125,6 +8270,12 @@ int ha_spider::ft_read_internal(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_SELECT_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_SELECT_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -8134,10 +8285,14 @@ int ha_spider::ft_read_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
conn->need_mon = &need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(this, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -8171,6 +8326,8 @@ int ha_spider::ft_read_internal(
result_list.quick_mode,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -8197,6 +8354,8 @@ int ha_spider::ft_read_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -10455,9 +10614,12 @@ void ha_spider::bulk_req_exec()
if (conn->bulk_access_requests)
{
spider_bg_conn_wait(conn);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
/* currently only used for HS */
@@ -10475,6 +10637,8 @@ void ha_spider::bulk_req_exec()
conn->bulk_access_sended += conn->bulk_access_requests;
*/
conn->bulk_access_requests = 0;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -12217,6 +12381,7 @@ int ha_spider::drop_tmp_tables()
uint dbton_id = share->use_sql_dbton_ids[roop_count];
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
SPIDER_CONN *conn = conns[roop_count];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_TMP_SQL))
{
@@ -12226,6 +12391,12 @@ int ha_spider::drop_tmp_tables()
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_TMP_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_TMP_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -12235,10 +12406,14 @@ int ha_spider::drop_tmp_tables()
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((tmp_error_num = spider_db_set_names(this, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -12275,6 +12450,8 @@ int ha_spider::drop_tmp_tables()
-1,
&need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
tmp_error_num = spider_db_errorno(conn);
@@ -12300,6 +12477,8 @@ int ha_spider::drop_tmp_tables()
}
error_num = tmp_error_num;
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
diff --git a/storage/spider/mysql-test/spider/r/pushdown_not_like.result b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
new file mode 100644
index 00000000000..cd926962180
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
@@ -0,0 +1,63 @@
+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;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2018-11-01 10:21:39'),
+(2, 'b', '2015-06-30 23:59:59'),
+(3, 'c', '2013-11-01 01:01:01');
+
+spider not like bug fix test
+connection master_1;
+select * from ta_l where b not like 'a%';
+a b c
+2 b 2015-06-30 23:59:59
+3 c 2013-11-01 01:01:01
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%';
+argument
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r` where (`b` not like 'a%')
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%'
+
+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/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
new file mode 100644
index 00000000000..95e4fa6eea8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
@@ -0,0 +1,138 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+
+--echo
+--echo create table select test
+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)
+ {
+ SET @old_log_output = @@global.log_output;
+ TRUNCATE TABLE mysql.general_log;
+ set global log_output = 'TABLE';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2018-11-01 10:21:39'),
+ (2, 'b', '2015-06-30 23:59:59'),
+ (3, 'c', '2013-11-01 01:01:01');
+
+--echo
+--echo spider not like bug fix 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 * from ta_l where b not like 'a%';
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%';
+ }
+}
+
+
+--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;
+ SET GLOBAL log_output = @old_log_output;
+}
+
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index c1c2ce07476..30296215952 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -2385,6 +2385,7 @@ void *spider_bg_conn_action(
sql_type = SPIDER_SQL_TYPE_SELECT_HS;
}
#endif
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -2414,6 +2415,8 @@ void *spider_bg_conn_action(
if (!result_list->bgs_error)
{
conn->need_mon = &spider->need_mons[conn->link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
#ifdef HA_CAN_BULK_ACCESS
@@ -2491,6 +2494,8 @@ void *spider_bg_conn_action(
#ifdef HA_CAN_BULK_ACCESS
}
#endif
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -2501,11 +2506,14 @@ void *spider_bg_conn_action(
}
} else {
spider->connection_ids[conn->link_idx] = conn->connection_id;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_unlock_later = TRUE;
result_list->bgs_error =
spider_db_store_result(spider, conn->link_idx, result_list->table);
if ((result_list->bgs_error_with_message = thd->is_error()))
strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_unlock_later = FALSE;
}
conn->bg_search = FALSE;
@@ -2569,12 +2577,26 @@ void *spider_bg_conn_action(
{
DBUG_PRINT("info",("spider bg exec sql start"));
spider = (ha_spider*) conn->bg_target;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[conn->link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
*conn->bg_error_num = spider_db_query_with_set_names(
conn->bg_sql_type,
spider,
conn,
conn->link_idx
);
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
conn->bg_exec_sql = FALSE;
continue;
}
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 13ff6c568de..f77603d0d3a 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -208,23 +208,14 @@ int spider_db_ping(
DBUG_PRINT("info", ("spider thd->query_id is %lld",
spider->trx->thd->query_id));
#endif
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
if (conn->server_lost || conn->queued_connect)
{
if ((error_num = spider_db_connect(spider->share, conn,
spider->conn_link_idx[link_idx])))
{
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
conn->server_lost = FALSE;
@@ -238,11 +229,7 @@ int spider_db_ping(
{
DBUG_PRINT("info", ("spider conn=%p SERVER_LOST", conn));
conn->server_lost = TRUE;
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
if((error_num = conn->db_conn->ping()))
@@ -250,20 +237,12 @@ int spider_db_ping(
spider_db_disconnect(conn);
DBUG_PRINT("info", ("spider conn=%p SERVER_LOST", conn));
conn->server_lost = TRUE;
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
}
conn->ping_time = (time_t) time((time_t*) 0);
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(0);
}
@@ -303,6 +282,7 @@ int spider_db_conn_queue_action(
conn->queued_connect = FALSE;
}
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
{
@@ -551,7 +531,6 @@ int spider_db_before_query(
int *need_mon
) {
int error_num;
- bool tmp_mta_conn_mutex_lock_already;
DBUG_ENTER("spider_db_before_query");
DBUG_ASSERT(need_mon);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -559,25 +538,18 @@ int spider_db_before_query(
spider_bg_conn_break(conn, NULL);
#endif
conn->in_before_query = TRUE;
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
if ((error_num = spider_db_conn_queue_action(conn)))
{
conn->in_before_query = FALSE;
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
if (conn->server_lost)
{
conn->in_before_query = FALSE;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(CR_SERVER_GONE_ERROR);
}
DBUG_PRINT("info", ("spider conn[%p]->quick_target=%p",
@@ -604,6 +576,7 @@ int spider_db_before_query(
) {
conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
conn->in_before_query = FALSE;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
}
@@ -619,6 +592,7 @@ int spider_db_before_query(
}
}
conn->in_before_query = FALSE;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_RETURN(0);
}
@@ -631,6 +605,7 @@ int spider_db_query(
) {
int error_num;
DBUG_ENTER("spider_db_query");
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
{
@@ -673,6 +648,7 @@ int spider_db_errorno(
int error_num;
DBUG_ENTER("spider_db_errorno");
DBUG_ASSERT(conn->need_mon);
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
{
@@ -687,6 +663,7 @@ int spider_db_errorno(
}
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -708,6 +685,7 @@ int spider_db_errorno(
}
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -720,6 +698,7 @@ int spider_db_errorno(
conn->error_length = strlen(conn->error_str);
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -745,6 +724,7 @@ int spider_db_errorno(
}
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -766,6 +746,7 @@ int spider_db_errorno(
}
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -782,6 +763,7 @@ int spider_db_errorno(
conn->server_lost = TRUE;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -791,6 +773,7 @@ int spider_db_errorno(
*conn->need_mon = 0;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -813,6 +796,7 @@ int spider_db_errorno(
*conn->need_mon = ER_SPIDER_HS_NUM;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -821,6 +805,7 @@ int spider_db_errorno(
#endif
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -843,33 +828,25 @@ int spider_db_set_names_internal(
int all_link_idx,
int *need_mon
) {
- bool tmp_mta_conn_mutex_lock_already;
DBUG_ENTER("spider_db_set_names_internal");
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
{
#endif
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- }
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
if (
!conn->access_charset ||
share->access_charset->cset != conn->access_charset->cset
) {
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
if (
spider_db_before_query(conn, need_mon) ||
conn->db_conn->set_character_set(share->access_charset->csname)
) {
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
DBUG_RETURN(spider_db_errorno(conn));
}
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
conn->access_charset = share->access_charset;
}
if (
@@ -884,13 +861,10 @@ int spider_db_set_names_internal(
) {
DBUG_PRINT("info",("spider all_link_idx=%d db=%s", all_link_idx,
share->tgt_dbs[all_link_idx]));
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
if (
spider_db_before_query(conn, need_mon) ||
conn->db_conn->select_db(share->tgt_dbs[all_link_idx])
) {
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
DBUG_RETURN(spider_db_errorno(conn));
}
conn->default_database.length(0);
@@ -900,12 +874,6 @@ int spider_db_set_names_internal(
conn->default_database.q_append(share->tgt_dbs[all_link_idx],
share->tgt_dbs_lengths[all_link_idx] + 1);
conn->default_database.length(share->tgt_dbs_lengths[all_link_idx]);
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- }
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
}
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
}
@@ -934,19 +902,11 @@ int spider_db_query_with_set_names(
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
DBUG_ENTER("spider_db_query_with_set_names");
-/*
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
-*/
- conn->need_mon = &spider->need_mons[link_idx];
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
if (
share->monitoring_kind[link_idx] &&
spider->need_mons[link_idx]
@@ -977,8 +937,6 @@ int spider_db_query_with_set_names(
-1,
&spider->need_mons[link_idx])
) {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
if (
share->monitoring_kind[link_idx] &&
@@ -1002,10 +960,6 @@ int spider_db_query_with_set_names(
}
DBUG_RETURN(error_num);
}
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
}
@@ -1019,15 +973,16 @@ int spider_db_query_for_bulk_update(
SPIDER_SHARE *share = spider->share;
DBUG_ENTER("spider_db_query_for_bulk_update");
-/*
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
-*/
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -1063,6 +1018,8 @@ int spider_db_query_for_bulk_update(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -1109,6 +1066,8 @@ int spider_db_query_for_bulk_update(
}
if (error_num > 0 && !conn->db_conn->is_dup_entry_error(error_num))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -1135,6 +1094,8 @@ int spider_db_query_for_bulk_update(
}
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -3644,6 +3605,7 @@ int spider_db_store_result(
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3660,6 +3622,7 @@ int spider_db_store_result(
) {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3691,6 +3654,7 @@ int spider_db_store_result(
) {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3734,6 +3698,7 @@ int spider_db_store_result(
) {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3773,6 +3738,7 @@ int spider_db_store_result(
{
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3801,6 +3767,7 @@ int spider_db_store_result(
#endif
if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3808,6 +3775,7 @@ int spider_db_store_result(
} else {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3851,6 +3819,7 @@ int spider_db_store_result(
result_list->limit_num -= current->prev->record_num;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3874,6 +3843,7 @@ int spider_db_store_result(
} else {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -3885,6 +3855,7 @@ int spider_db_store_result(
spider->quick_targets[link_idx] = spider;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -4043,6 +4014,7 @@ int spider_db_store_result(
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -4068,6 +4040,7 @@ int spider_db_store_result(
} else {
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -4078,6 +4051,7 @@ int spider_db_store_result(
result_list->hs_has_result = TRUE;
if (!conn->mta_conn_mutex_unlock_later)
{
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -4163,15 +4137,15 @@ int spider_db_bulk_store_result(
error_num = spider_db_bulk_open_handler(spider, conn, link_idx);
if (!discard_result)
{
- bool tmp_mta_conn_mutex_unlock_later;
- tmp_mta_conn_mutex_unlock_later = conn->mta_conn_mutex_unlock_later;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_unlock_later = TRUE;
if ((tmp_error_num = spider_db_store_result(spider, link_idx,
spider->get_table())))
{
error_num = tmp_error_num;
}
- conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
+ conn->mta_conn_mutex_unlock_later = FALSE;
} else {
if (spider->connection_ids[link_idx] == conn->connection_id)
spider_db_discard_result(spider, link_idx, conn);
@@ -4381,10 +4355,14 @@ int spider_db_seek_next(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -4420,6 +4398,8 @@ int spider_db_seek_next(
result_list->quick_mode,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -4447,6 +4427,8 @@ int spider_db_seek_next(
DBUG_RETURN(error_num);
}
spider->connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -4487,6 +4469,8 @@ int spider_db_seek_next(
}
} else {
spider->connection_ids[link_idx] = conn->connection_id;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_store_result(spider, link_idx, table)))
{
@@ -4613,6 +4597,7 @@ int spider_db_seek_last(
}
conn = spider->conns[roop_count];
spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -4620,6 +4605,11 @@ int spider_db_seek_last(
}
if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
@@ -4629,10 +4619,14 @@ int spider_db_seek_last(
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -4667,6 +4661,8 @@ int spider_db_seek_last(
result_list->quick_mode,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -4693,6 +4689,8 @@ int spider_db_seek_last(
DBUG_RETURN(error_num);
}
spider->connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -4813,6 +4811,7 @@ int spider_db_seek_last(
}
conn = spider->conns[roop_count];
spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -4820,6 +4819,11 @@ int spider_db_seek_last(
}
if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
@@ -4829,10 +4833,14 @@ int spider_db_seek_last(
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -4867,6 +4875,8 @@ int spider_db_seek_last(
result_list->quick_mode,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -4893,6 +4903,8 @@ int spider_db_seek_last(
DBUG_RETURN(error_num);
}
spider->connection_ids[roop_count] = conn->connection_id;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (roop_count == link_ok)
@@ -5561,8 +5573,6 @@ int spider_db_bulk_insert(
#endif
SPIDER_SHARE *share = spider->share;
THD *thd = spider->trx->thd;
- bool mta_conn_mutex_lock_already_backup;
- bool mta_conn_mutex_unlock_later_backup;
DBUG_ENTER("spider_db_bulk_insert");
if (!bulk_end)
@@ -5617,61 +5627,50 @@ int spider_db_bulk_insert(
sql_type = SPIDER_SQL_TYPE_INSERT_SQL;
conn = spider->conns[roop_count2];
dbton_handler = spider->dbton_handler[conn->dbton_id];
- mta_conn_mutex_lock_already_backup =
- conn->mta_conn_mutex_lock_already;
- mta_conn_mutex_unlock_later_backup =
- conn->mta_conn_mutex_unlock_later;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
- if (!mta_conn_mutex_lock_already_backup)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
roop_count2)))
{
+ if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
- if (!mta_conn_mutex_lock_already_backup)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
} else {
sql_type = SPIDER_SQL_TYPE_INSERT_HS;
conn = spider->hs_w_conns[roop_count2];
dbton_handler = spider->dbton_handler[conn->dbton_id];
- mta_conn_mutex_lock_already_backup =
- conn->mta_conn_mutex_lock_already;
- mta_conn_mutex_unlock_later_backup =
- conn->mta_conn_mutex_unlock_later;
- if (!mta_conn_mutex_lock_already_backup)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
#endif
conn->need_mon = &spider->need_mons[roop_count2];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count2)))
{
- conn->mta_conn_mutex_lock_already =
- mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later =
- mta_conn_mutex_unlock_later_backup;
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
if (
share->monitoring_kind[roop_count2] &&
spider->need_mons[roop_count2]
@@ -5709,15 +5708,12 @@ int spider_db_bulk_insert(
{
conn->db_conn->set_dup_key_idx(spider, roop_count2);
}
- conn->mta_conn_mutex_lock_already =
- mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later =
- mta_conn_mutex_unlock_later_backup;
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
if (
error_num != ER_DUP_ENTRY &&
error_num != ER_DUP_KEY &&
@@ -5743,8 +5739,10 @@ int spider_db_bulk_insert(
}
DBUG_RETURN(error_num);
}
- conn->mta_conn_mutex_lock_already = mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later = mta_conn_mutex_unlock_later_backup;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind != SPIDER_CONN_KIND_MYSQL)
{
@@ -5780,11 +5778,8 @@ int spider_db_bulk_insert(
}
}
#endif
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
if (first_insert_link_idx == -1)
{
first_insert_link_idx = roop_count2;
@@ -5793,14 +5788,12 @@ int spider_db_bulk_insert(
}
conn = first_insert_conn;
- mta_conn_mutex_lock_already_backup = conn->mta_conn_mutex_lock_already;
- mta_conn_mutex_unlock_later_backup = conn->mta_conn_mutex_unlock_later;
- if (!mta_conn_mutex_lock_already_backup)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[first_insert_link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
@@ -5822,15 +5815,12 @@ int spider_db_bulk_insert(
else if ((error_num = dbton_handler->
show_last_insert_id(first_insert_link_idx, last_insert_id)))
{
- conn->mta_conn_mutex_lock_already =
- mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later =
- mta_conn_mutex_unlock_later_backup;
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
table->next_number_field->set_notnull();
@@ -5840,25 +5830,21 @@ int spider_db_bulk_insert(
(error_num = table->next_number_field->store(
last_insert_id, TRUE))
) {
- conn->mta_conn_mutex_lock_already =
- mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later =
- mta_conn_mutex_unlock_later_backup;
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
}
- conn->mta_conn_mutex_lock_already = mta_conn_mutex_lock_already_backup;
- conn->mta_conn_mutex_unlock_later = mta_conn_mutex_unlock_later_backup;
- if (!mta_conn_mutex_unlock_later_backup)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
spider->store_last_insert_id = 0;
#ifdef HA_CAN_BULK_ACCESS
}
@@ -5902,8 +5888,11 @@ int spider_db_bulk_bulk_insert(
conn = spider->hs_w_conns[roop_count2];
}
#endif
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn,
@@ -5911,6 +5900,8 @@ int spider_db_bulk_bulk_insert(
{
error_num = tmp_error_num;
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
@@ -5959,9 +5950,12 @@ int spider_db_bulk_bulk_insert(
}
conn = first_insert_conn;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[first_insert_link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if (table->next_number_field &&
@@ -5988,6 +5982,8 @@ int spider_db_bulk_bulk_insert(
error_num = tmp_error_num;
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6115,6 +6111,7 @@ int spider_db_bulk_update_size_limit(
) {
conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
{
@@ -6124,6 +6121,12 @@ int spider_db_bulk_update_size_limit(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -6134,7 +6137,11 @@ int spider_db_bulk_update_size_limit(
}
if ((error_num = spider_db_query_for_bulk_update(
spider, conn, roop_count, &dup_key_found)))
+ {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
+ }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
}
spider->reset_sql_sql(SPIDER_SQL_TYPE_BULK_UPDATE_SQL);
} else {
@@ -6200,6 +6207,7 @@ int spider_db_bulk_update_end(
) {
conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
{
@@ -6209,14 +6217,14 @@ int spider_db_bulk_update_end(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
if (error_num == ER_SPIDER_COND_SKIP_NUM)
{
- if (dbton_hdl->need_lock_before_set_sql_for_exec(
- SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
continue;
}
DBUG_RETURN(error_num);
@@ -6229,7 +6237,11 @@ int spider_db_bulk_update_end(
}
if ((error_num = spider_db_query_for_bulk_update(
spider, conn, roop_count, dup_key_found)))
+ {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
goto error_query;
+ }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
}
}
if (error_num != HA_ERR_END_OF_FILE)
@@ -6254,6 +6266,7 @@ int spider_db_bulk_update_end(
) {
conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
{
@@ -6263,6 +6276,12 @@ int spider_db_bulk_update_end(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -6273,7 +6292,11 @@ int spider_db_bulk_update_end(
}
if ((error_num = spider_db_query_for_bulk_update(
spider, conn, roop_count, dup_key_found)))
+ {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
goto error_last_query;
+ }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
}
}
}
@@ -6341,6 +6364,7 @@ int spider_db_update(
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
conn->ignore_dup_key = spider->ignore_dup_key;
#endif
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_UPDATE_SQL))
{
@@ -6350,6 +6374,12 @@ int spider_db_update(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_UPDATE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_UPDATE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -6359,10 +6389,14 @@ int spider_db_update(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6397,6 +6431,8 @@ int spider_db_update(
-1,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -6435,6 +6471,8 @@ int spider_db_update(
if ((error_num = dbton_hdl->append_insert_for_recovery(
SPIDER_SQL_TYPE_INSERT_SQL, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6449,6 +6487,8 @@ int spider_db_update(
-1,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -6478,6 +6518,8 @@ int spider_db_update(
DBUG_RETURN(error_num);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6666,6 +6708,7 @@ int spider_db_direct_update(
}
#endif
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -6673,6 +6716,11 @@ int spider_db_direct_update(
}
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -6688,10 +6736,14 @@ int spider_db_direct_update(
} else {
#endif
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6729,6 +6781,8 @@ int spider_db_direct_update(
) &&
(error_num != HA_ERR_FOUND_DUPP_KEY || !spider->ignore_dup_key)
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -6795,6 +6849,8 @@ int spider_db_direct_update(
{
error_num = spider_db_errorno(conn);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6803,11 +6859,13 @@ int spider_db_direct_update(
}
}
#endif
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
#ifdef HA_CAN_BULK_ACCESS
}
#endif
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -6852,8 +6910,11 @@ int spider_db_bulk_direct_update(
conn = spider->hs_w_conns[roop_count];
}
#endif
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn,
@@ -6899,6 +6960,8 @@ int spider_db_bulk_direct_update(
{
error_num = spider_db_errorno(conn);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6907,6 +6970,8 @@ int spider_db_bulk_direct_update(
}
}
#endif
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -6963,6 +7028,7 @@ int spider_db_delete(
) {
conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_DELETE_SQL))
{
@@ -6972,6 +7038,12 @@ int spider_db_delete(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_DELETE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_DELETE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -6980,9 +7052,27 @@ int spider_db_delete(
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_query_with_set_names(
SPIDER_SQL_TYPE_DELETE_SQL, spider, conn, roop_count)))
+ {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
result_list->update_sqls[roop_count].length(0);
}
if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL)))
@@ -7094,6 +7184,7 @@ int spider_db_direct_delete(
}
#endif
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
{
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -7101,6 +7192,11 @@ int spider_db_direct_delete(
}
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
@@ -7116,10 +7212,14 @@ int spider_db_direct_delete(
} else {
#endif
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -7154,6 +7254,8 @@ int spider_db_direct_delete(
-1,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -7179,6 +7281,8 @@ int spider_db_direct_delete(
}
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
@@ -7271,6 +7375,7 @@ int spider_db_delete_all_rows(
uint dbton_id = share->use_sql_dbton_ids[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id];
conn = spider->conns[roop_count];
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_DELETE_SQL))
{
@@ -7280,6 +7385,12 @@ int spider_db_delete_all_rows(
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_DELETE_SQL, roop_count)))
{
+ if (dbton_hdl->need_lock_before_set_sql_for_exec(
+ SPIDER_SQL_TYPE_DELETE_SQL))
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(error_num);
}
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
@@ -7289,6 +7400,8 @@ int spider_db_delete_all_rows(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
conn->need_mon = &spider->need_mons[roop_count];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, roop_count, spider->trx->thd,
@@ -7311,6 +7424,8 @@ int spider_db_delete_all_rows(
/* retry */
if ((error_num = spider_db_ping(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -7339,6 +7454,8 @@ int spider_db_delete_all_rows(
}
if ((error_num = spider_db_set_names(spider, conn, roop_count)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -7373,6 +7490,8 @@ int spider_db_delete_all_rows(
-1,
&spider->need_mons[roop_count])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -7399,6 +7518,8 @@ int spider_db_delete_all_rows(
DBUG_RETURN(error_num);
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -7426,6 +7547,8 @@ int spider_db_delete_all_rows(
DBUG_RETURN(error_num);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -8807,7 +8930,14 @@ int spider_db_udf_direct_sql(
c_thd->lex->sql_command = SQLCOM_INSERT;
#endif
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (
!(error_num = spider_db_udf_direct_sql_set_names(direct_sql, trx, conn)) &&
!(error_num = spider_db_udf_direct_sql_select_db(direct_sql, conn))
@@ -8830,9 +8960,6 @@ int spider_db_udf_direct_sql(
#endif
DBUG_RETURN(error_num);
}
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
}
#endif
spider_conn_set_timeout_from_direct_sql(conn, thd, direct_sql);
@@ -8851,8 +8978,6 @@ int spider_db_udf_direct_sql(
DBUG_PRINT("info",("spider conn=%p", conn));
if (!direct_sql->table_count)
roop_count = -1;
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
do {
if (roop_count == direct_sql->table_count)
{
@@ -9064,12 +9189,14 @@ int spider_db_udf_direct_sql(
if (roop_count >= 0)
roop_count++;
} while (status == 0);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
if (need_trx_end && insert_start)
{
if (error_num)
@@ -9099,19 +9226,13 @@ int spider_db_udf_direct_sql_select_db(
SPIDER_CONN *conn
) {
int error_num, need_mon = 0;
- bool tmp_mta_conn_mutex_lock_already;
SPIDER_DB_CONN *db_conn = conn->db_conn;
DBUG_ENTER("spider_db_udf_direct_sql_select_db");
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (direct_sql->access_mode == 0)
{
#endif
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &need_mon;
- }
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
if (
!conn->default_database.length() ||
@@ -9120,8 +9241,6 @@ int spider_db_udf_direct_sql_select_db(
memcmp(direct_sql->tgt_default_db_name, conn->default_database.ptr(),
direct_sql->tgt_default_db_name_length)
) {
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
if (
(
spider_db_before_query(conn, &need_mon) ||
@@ -9135,7 +9254,6 @@ int spider_db_udf_direct_sql_select_db(
)
my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM,
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
DBUG_RETURN(error_num);
}
conn->default_database.length(0);
@@ -9145,12 +9263,6 @@ int spider_db_udf_direct_sql_select_db(
conn->default_database.q_append(direct_sql->tgt_default_db_name,
direct_sql->tgt_default_db_name_length + 1);
conn->default_database.length(direct_sql->tgt_default_db_name_length);
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- }
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
}
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
}
@@ -9164,25 +9276,17 @@ int spider_db_udf_direct_sql_set_names(
SPIDER_CONN *conn
) {
int error_num, need_mon = 0;
- bool tmp_mta_conn_mutex_lock_already;
DBUG_ENTER("spider_db_udf_direct_sql_set_names");
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (direct_sql->access_mode == 0)
{
#endif
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &need_mon;
- }
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
if (
!conn->access_charset ||
trx->udf_access_charset->cset != conn->access_charset->cset
) {
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
if (
(
spider_db_before_query(conn, &need_mon) ||
@@ -9197,17 +9301,10 @@ int spider_db_udf_direct_sql_set_names(
my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM,
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
}
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
DBUG_RETURN(error_num);
}
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
conn->access_charset = trx->udf_access_charset;
}
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
}
#endif
@@ -9271,13 +9368,18 @@ int spider_db_udf_ping_table(
spider.conn_link_idx = &tmp_conn_link_idx;
spider.db_request_phase = &db_request_phase;
spider.db_request_id = &db_request_id;
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_ping(&spider, conn, 0)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9293,6 +9395,8 @@ int spider_db_udf_ping_table(
share->server_names[0]);
DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9336,13 +9440,18 @@ int spider_db_udf_ping_table(
my_error(error_num, MYF(0));
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(&spider, conn, 0)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9360,6 +9469,8 @@ int spider_db_udf_ping_table(
-1,
&need_mon)
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
@@ -9368,6 +9479,8 @@ int spider_db_udf_ping_table(
DBUG_PRINT("info",("spider error_num=%d", error_num));
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
spider_db_discard_result(&spider, 0, conn);
@@ -9553,13 +9666,18 @@ int spider_db_udf_ping_table_mon_next(
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_ping(&spider, conn, 0)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9570,6 +9688,8 @@ int spider_db_udf_ping_table_mon_next(
}
if ((error_num = spider_db_set_names(&spider, conn, 0)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9584,6 +9704,8 @@ int spider_db_udf_ping_table_mon_next(
-1,
&need_mon)
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
@@ -9596,13 +9718,25 @@ int spider_db_udf_ping_table_mon_next(
request_key.next = NULL;
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
+ if (error_num)
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ DBUG_RETURN(error_num);
+ }
+ else if ((error_num = spider_db_errorno(conn)))
+ {
DBUG_RETURN(error_num);
+ }
my_error(HA_ERR_OUT_OF_MEM, MYF(0));
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -9683,8 +9817,22 @@ int spider_db_udf_copy_tables(
spider_conn_clear_queue_at_commit(tmp_conn);
if (!tmp_conn->trx_start)
{
+ pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex);
+ pthread_mutex_lock(&tmp_conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ tmp_conn->need_mon = &tmp_spider->need_mons[0];
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = TRUE;
+ tmp_conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_ping(tmp_spider, tmp_conn, 0))
{
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0),
tmp_spider->share->server_names[0]);
error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE;
@@ -9694,8 +9842,21 @@ int spider_db_udf_copy_tables(
(error_num = spider_db_set_names(tmp_spider, tmp_conn, 0)) ||
(error_num = spider_db_start_transaction(tmp_conn,
tmp_spider->need_mons))
- )
+ ) {
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
goto error_start_transaction;
+ }
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
}
}
} else {
@@ -9715,8 +9876,22 @@ int spider_db_udf_copy_tables(
{
tmp_spider = &spider[roop_count];
tmp_conn = tmp_spider->conns[0];
+ pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex);
+ pthread_mutex_lock(&tmp_conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ tmp_conn->need_mon = &tmp_spider->need_mons[0];
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = TRUE;
+ tmp_conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_ping(tmp_spider, tmp_conn, 0))
{
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0),
tmp_spider->share->server_names[0]);
error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE;
@@ -9729,11 +9904,23 @@ int spider_db_udf_copy_tables(
(error_num = spider_db_lock_tables(tmp_spider, 0))
)
) {
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
tmp_conn->table_lock = 0;
if (error_num == HA_ERR_OUT_OF_MEM)
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
goto error_lock_tables;
}
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
tmp_conn->table_lock = 1;
}
}
@@ -9741,11 +9928,23 @@ int spider_db_udf_copy_tables(
tmp_conn = src_tbl_conn->conn;
spider_conn_set_timeout_from_share(tmp_conn, 0,
copy_tables->trx->thd, src_tbl_conn->share);
+ pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex);
+ pthread_mutex_lock(&tmp_conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ tmp_conn->need_mon = &src_tbl_conn->need_mon;
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = TRUE;
+ tmp_conn->mta_conn_mutex_unlock_later = TRUE;
if (select_ct->exec_query(
tmp_conn,
-1,
&src_tbl_conn->need_mon)
) {
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(tmp_conn);
if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM)
my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM,
@@ -9774,6 +9973,10 @@ int spider_db_udf_copy_tables(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
goto error_db_query;
@@ -9789,6 +9992,10 @@ int spider_db_udf_copy_tables(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
goto error_db_query;
@@ -9815,6 +10022,10 @@ int spider_db_udf_copy_tables(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
goto error_db_query;
@@ -9832,6 +10043,10 @@ int spider_db_udf_copy_tables(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
error_num = ER_OUT_OF_RESOURCES;
@@ -9844,12 +10059,20 @@ int spider_db_udf_copy_tables(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
goto error_db_query;
}
result->free_result();
delete result;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
@@ -9870,6 +10093,12 @@ int spider_db_udf_copy_tables(
}
if (error_num)
{
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM)
my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM,
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
@@ -9877,6 +10106,10 @@ int spider_db_udf_copy_tables(
}
error_num = HA_ERR_END_OF_FILE;
end_of_file = TRUE;
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
+ tmp_conn->mta_conn_mutex_lock_already = FALSE;
+ tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
}
@@ -9919,9 +10152,12 @@ int spider_db_udf_copy_tables(
{
tmp_conn = dst_tbl_conn->conn;
insert_ct = dst_tbl_conn->copy_table;
+ pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex);
pthread_mutex_lock(&tmp_conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
tmp_conn->need_mon = &dst_tbl_conn->need_mon;
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later);
tmp_conn->mta_conn_mutex_lock_already = TRUE;
tmp_conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(tmp_conn, 0,
@@ -9931,6 +10167,8 @@ int spider_db_udf_copy_tables(
-1,
&dst_tbl_conn->need_mon)
) {
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
tmp_conn->mta_conn_mutex_lock_already = FALSE;
tmp_conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(tmp_conn);
@@ -9939,6 +10177,8 @@ int spider_db_udf_copy_tables(
ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0));
goto error_db_query;
} else {
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later);
tmp_conn->mta_conn_mutex_lock_already = FALSE;
tmp_conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos);
@@ -10079,8 +10319,6 @@ int spider_db_open_handler(
int link_idx
) {
int error_num;
- bool tmp_mta_conn_mutex_lock_already;
- bool tmp_mta_conn_mutex_unlock_later;
SPIDER_SHARE *share = spider->share;
uint *handler_id_ptr =
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
@@ -10095,16 +10333,14 @@ int spider_db_open_handler(
;
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
DBUG_ENTER("spider_db_open_handler");
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- }
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
- tmp_mta_conn_mutex_unlock_later = conn->mta_conn_mutex_unlock_later;
conn->mta_conn_mutex_unlock_later = TRUE;
if (!spider->handler_opened(link_idx, conn->conn_kind))
*handler_id_ptr = conn->opened_handlers;
@@ -10153,11 +10389,6 @@ int spider_db_open_handler(
{
my_printf_error(ER_SPIDER_HS_NUM, ER_SPIDER_HS_STR, MYF(0),
conn->db_conn->get_errno(), conn->db_conn->get_error());
- if (!conn->mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
spider->need_mons[link_idx] = ER_SPIDER_HS_NUM;
error_num = ER_SPIDER_HS_NUM;
goto error;
@@ -10293,23 +10524,21 @@ int spider_db_open_handler(
}
DBUG_PRINT("info",("spider conn=%p", conn));
DBUG_PRINT("info",("spider opened_handlers=%u", conn->opened_handlers));
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
- if (!tmp_mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
error:
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
- if (!tmp_mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
@@ -10359,6 +10588,7 @@ int spider_db_bulk_open_handler(
}
bool tmp_mta_conn_mutex_unlock_later;
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
tmp_mta_conn_mutex_unlock_later = conn->mta_conn_mutex_unlock_later;
conn->mta_conn_mutex_unlock_later = TRUE;
SPIDER_DB_RESULT *result;
@@ -10397,24 +10627,19 @@ int spider_db_close_handler(
uint tgt_conn_kind
) {
int error_num;
- bool tmp_mta_conn_mutex_lock_already;
- bool tmp_mta_conn_mutex_unlock_later;
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
DBUG_ENTER("spider_db_close_handler");
DBUG_PRINT("info",("spider conn=%p", conn));
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider->handler_opened(link_idx, tgt_conn_kind))
{
- if (!conn->mta_conn_mutex_lock_already)
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- }
- DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
- tmp_mta_conn_mutex_lock_already = conn->mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_lock_already = TRUE;
- tmp_mta_conn_mutex_unlock_later = conn->mta_conn_mutex_unlock_later;
- conn->mta_conn_mutex_unlock_later = TRUE;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
{
@@ -10422,7 +10647,15 @@ int spider_db_close_handler(
dbton_hdl->reset_sql(SPIDER_SQL_TYPE_HANDLER);
if ((error_num = dbton_hdl->append_close_handler_part(
SPIDER_SQL_TYPE_HANDLER, link_idx)))
+ {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
+ }
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
spider->share);
@@ -10448,24 +10681,22 @@ int spider_db_close_handler(
goto error;
conn->opened_handlers--;
DBUG_PRINT("info",("spider opened_handlers=%u", conn->opened_handlers));
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
- if (!tmp_mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
error:
- conn->mta_conn_mutex_lock_already = tmp_mta_conn_mutex_lock_already;
- conn->mta_conn_mutex_unlock_later = tmp_mta_conn_mutex_unlock_later;
- if (!tmp_mta_conn_mutex_unlock_later)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
@@ -10502,3 +10733,4 @@ bool spider_db_conn_is_network_error(
}
DBUG_RETURN(FALSE);
}
+
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 7db61d44e20..39e2c8650c4 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -139,6 +139,8 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_SQL_IN_LEN (sizeof(SPIDER_SQL_IN_STR) - 1)
#define SPIDER_SQL_NOT_IN_STR "not in("
#define SPIDER_SQL_NOT_IN_LEN (sizeof(SPIDER_SQL_NOT_IN_STR) - 1)
+#define SPIDER_SQL_NOT_LIKE_STR "not like"
+#define SPIDER_SQL_NOT_LIKE_LEN (sizeof(SPIDER_SQL_NOT_LIKE_STR) - 1)
#define SPIDER_SQL_AS_CHAR_STR " as char"
#define SPIDER_SQL_AS_CHAR_LEN (sizeof(SPIDER_SQL_AS_CHAR_STR) - 1)
#define SPIDER_SQL_CAST_STR "cast("
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 6f2960cb868..9ed29d015b3 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -1844,10 +1844,6 @@ void spider_db_mysql::print_warnings(
if (!(db_conn->server_status & SERVER_MORE_RESULTS_EXISTS))
#endif
{
-/*
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
-*/
if (
spider_param_dry_access() ||
!mysql_real_query(db_conn, SPIDER_SQL_SHOW_WARNINGS_STR,
@@ -1865,18 +1861,10 @@ void spider_db_mysql::print_warnings(
{
if (res)
mysql_free_result(res);
-/*
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-*/
DBUG_VOID_RETURN;
}
/* no record is ok */
}
-/*
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-*/
num_fields = mysql_num_fields(res);
if (num_fields != 3)
{
@@ -1895,11 +1883,6 @@ void spider_db_mysql::print_warnings(
}
if (res)
mysql_free_result(res);
- } else {
-/*
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-*/
}
}
}
@@ -2039,14 +2022,31 @@ int spider_db_mysql::consistent_snapshot(
) {
DBUG_ENTER("spider_db_mysql::consistent_snapshot");
DBUG_PRINT("info",("spider this=%p", this));
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_START_CONSISTENT_SNAPSHOT_STR,
SPIDER_SQL_START_CONSISTENT_SNAPSHOT_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2064,16 +2064,18 @@ int spider_db_mysql::start_transaction(
) {
DBUG_ENTER("spider_db_mysql::start_transaction");
DBUG_PRINT("info",("spider this=%p", this));
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
if (spider_db_query(
conn,
SPIDER_SQL_START_TRANSACTION_STR,
SPIDER_SQL_START_TRANSACTION_LEN,
-1,
need_mon)
- )
+ ) {
DBUG_RETURN(spider_db_errorno(conn));
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(0);
}
@@ -2082,14 +2084,31 @@ int spider_db_mysql::commit(
) {
DBUG_ENTER("spider_db_mysql::commit");
DBUG_PRINT("info",("spider this=%p", this));
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_COMMIT_STR,
SPIDER_SQL_COMMIT_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2102,6 +2121,13 @@ int spider_db_mysql::rollback(
int error_num;
DBUG_ENTER("spider_db_mysql::rollback");
DBUG_PRINT("info",("spider this=%p", this));
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
@@ -2118,12 +2144,18 @@ int spider_db_mysql::rollback(
)
conn->thd->clear_error();
else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(error_num);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
@@ -2160,14 +2192,31 @@ int spider_db_mysql::xa_end(
sql_str.length(0);
sql_str.q_append(SPIDER_SQL_XA_END_STR, SPIDER_SQL_XA_END_LEN);
spider_db_append_xid_str(&sql_str, xid);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
sql_str.ptr(),
sql_str.length(),
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2186,14 +2235,31 @@ int spider_db_mysql::xa_prepare(
sql_str.length(0);
sql_str.q_append(SPIDER_SQL_XA_PREPARE_STR, SPIDER_SQL_XA_PREPARE_LEN);
spider_db_append_xid_str(&sql_str, xid);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
sql_str.ptr(),
sql_str.length(),
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2212,14 +2278,31 @@ int spider_db_mysql::xa_commit(
sql_str.length(0);
sql_str.q_append(SPIDER_SQL_XA_COMMIT_STR, SPIDER_SQL_XA_COMMIT_LEN);
spider_db_append_xid_str(&sql_str, xid);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
sql_str.ptr(),
sql_str.length(),
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2238,14 +2321,31 @@ int spider_db_mysql::xa_rollback(
sql_str.length(0);
sql_str.q_append(SPIDER_SQL_XA_ROLLBACK_STR, SPIDER_SQL_XA_ROLLBACK_LEN);
spider_db_append_xid_str(&sql_str, xid);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
sql_str.ptr(),
sql_str.length(),
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -2267,50 +2367,118 @@ int spider_db_mysql::set_trx_isolation(
switch (trx_isolation)
{
case ISO_READ_UNCOMMITTED:
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_READ_UNCOMMITTED_STR,
SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
case ISO_READ_COMMITTED:
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_READ_COMMITTED_STR,
SPIDER_SQL_ISO_READ_COMMITTED_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
case ISO_REPEATABLE_READ:
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_REPEATABLE_READ_STR,
SPIDER_SQL_ISO_REPEATABLE_READ_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
case ISO_SERIALIZABLE:
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_SERIALIZABLE_STR,
SPIDER_SQL_ISO_SERIALIZABLE_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
@@ -2335,25 +2503,59 @@ int spider_db_mysql::set_autocommit(
DBUG_PRINT("info",("spider this=%p", this));
if (autocommit)
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_AUTOCOMMIT_ON_STR,
SPIDER_SQL_AUTOCOMMIT_ON_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_AUTOCOMMIT_OFF_STR,
SPIDER_SQL_AUTOCOMMIT_OFF_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -2375,25 +2577,59 @@ int spider_db_mysql::set_sql_log_off(
DBUG_PRINT("info",("spider this=%p", this));
if (sql_log_off)
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_SQL_LOG_ON_STR,
SPIDER_SQL_SQL_LOG_ON_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_SQL_LOG_OFF_STR,
SPIDER_SQL_SQL_LOG_OFF_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -2424,14 +2660,31 @@ int spider_db_mysql::set_time_zone(
sql_str.q_append(SPIDER_SQL_TIME_ZONE_STR, SPIDER_SQL_TIME_ZONE_LEN);
sql_str.q_append(tz_str->ptr(), tz_str->length());
sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
sql_str.ptr(),
sql_str.length(),
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -3948,13 +4201,27 @@ int spider_db_mysql_util::open_item_func(
case Item_func::LE_FUNC:
case Item_func::GE_FUNC:
case Item_func::GT_FUNC:
- case Item_func::LIKE_FUNC:
if (str)
{
func_name = (char*) item_func->func_name();
func_name_length = strlen(func_name);
}
break;
+ case Item_func::LIKE_FUNC:
+ if (str)
+ {
+ if (((Item_func_like *)item_func)->negated)
+ {
+ func_name = SPIDER_SQL_NOT_LIKE_STR;
+ func_name_length = SPIDER_SQL_NOT_LIKE_LEN;
+ }
+ else
+ {
+ func_name = (char*)item_func->func_name();
+ func_name_length = strlen(func_name);
+ }
+ }
+ break;
default:
THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;
@@ -4959,6 +5226,14 @@ int spider_mysql_share::discover_table_structure(
) {
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (!conn->disable_reconnect)
{
ha_spider tmp_spider;
@@ -4971,14 +5246,15 @@ int spider_mysql_share::discover_table_structure(
if ((error_num = spider_db_ping(&tmp_spider, conn, 0)))
{
DBUG_PRINT("info",("spider spider_db_ping error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
continue;
}
}
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &need_mon;
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, roop_count, trx->thd,
spider_share);
if (
@@ -4995,6 +5271,8 @@ int spider_mysql_share::discover_table_structure(
)
) {
DBUG_PRINT("info",("spider spider_get_trx error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5014,6 +5292,8 @@ int spider_mysql_share::discover_table_structure(
if (error_num || (error_num = spider_db_errorno(conn)))
{
DBUG_PRINT("info",("spider column store error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5022,6 +5302,8 @@ int spider_mysql_share::discover_table_structure(
}
/* no record */
DBUG_PRINT("info",("spider column no record error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5034,6 +5316,8 @@ int spider_mysql_share::discover_table_structure(
DBUG_PRINT("info",("spider column fetch error"));
res->free_result();
delete res;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5050,6 +5334,8 @@ int spider_mysql_share::discover_table_structure(
if (conn->db_conn->next_result())
{
DBUG_PRINT("info",("spider single result error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5062,6 +5348,8 @@ int spider_mysql_share::discover_table_structure(
if (error_num || (error_num = spider_db_errorno(conn)))
{
DBUG_PRINT("info",("spider index store error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5070,6 +5358,8 @@ int spider_mysql_share::discover_table_structure(
}
/* no record */
DBUG_PRINT("info",("spider index no record error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5082,6 +5372,8 @@ int spider_mysql_share::discover_table_structure(
DBUG_PRINT("info",("spider index fetch error"));
res->free_result();
delete res;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5093,6 +5385,8 @@ int spider_mysql_share::discover_table_structure(
if (conn->db_conn->next_result())
{
DBUG_PRINT("info",("spider dual result error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5105,6 +5399,8 @@ int spider_mysql_share::discover_table_structure(
if (error_num || (error_num = spider_db_errorno(conn)))
{
DBUG_PRINT("info",("spider table store error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5113,6 +5409,8 @@ int spider_mysql_share::discover_table_structure(
}
/* no record */
DBUG_PRINT("info",("spider table no record error"));
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5125,6 +5423,8 @@ int spider_mysql_share::discover_table_structure(
DBUG_PRINT("info",("spider table fetch error"));
res->free_result();
delete res;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5133,6 +5433,8 @@ int spider_mysql_share::discover_table_structure(
}
res->free_result();
delete res;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10333,9 +10635,12 @@ int spider_mysql_handler::show_table_status(
if (sts_mode == 1)
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
conn->disable_connect_retry = TRUE;
@@ -10361,6 +10666,8 @@ int spider_mysql_handler::show_table_status(
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10370,6 +10677,8 @@ int spider_mysql_handler::show_table_status(
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10386,12 +10695,16 @@ int spider_mysql_handler::show_table_status(
&spider->need_mons[link_idx])
) {
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10408,6 +10721,8 @@ int spider_mysql_handler::show_table_status(
if (spider_param_dry_access())
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10417,9 +10732,17 @@ int spider_mysql_handler::show_table_status(
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
+ if (error_num)
+ {
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
+ DBUG_RETURN(error_num);
+ }
+ else if ((error_num = spider_db_errorno(conn)))
DBUG_RETURN(error_num);
else
{
@@ -10432,6 +10755,8 @@ int spider_mysql_handler::show_table_status(
}
}
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10474,9 +10799,12 @@ int spider_mysql_handler::show_table_status(
DBUG_RETURN(error_num);
}
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
conn->disable_connect_retry = TRUE;
@@ -10502,6 +10830,8 @@ int spider_mysql_handler::show_table_status(
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10511,6 +10841,8 @@ int spider_mysql_handler::show_table_status(
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10527,12 +10859,16 @@ int spider_mysql_handler::show_table_status(
&spider->need_mons[link_idx])
) {
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10549,6 +10885,8 @@ int spider_mysql_handler::show_table_status(
if (spider_param_dry_access())
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10558,6 +10896,8 @@ int spider_mysql_handler::show_table_status(
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (error_num || (error_num = spider_db_errorno(conn)))
@@ -10566,6 +10906,8 @@ int spider_mysql_handler::show_table_status(
DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
}
conn->disable_connect_retry = FALSE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10650,9 +10992,12 @@ int spider_mysql_handler::show_index(
DBUG_PRINT("info",("spider crd_mode=%d", crd_mode));
if (crd_mode == 1)
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10676,6 +11021,8 @@ int spider_mysql_handler::show_index(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10684,6 +11031,8 @@ int spider_mysql_handler::show_index(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10699,11 +11048,15 @@ int spider_mysql_handler::show_index(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10721,6 +11074,8 @@ int spider_mysql_handler::show_index(
{
if (error_num || (error_num = spider_db_errorno(conn)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10729,6 +11084,8 @@ int spider_mysql_handler::show_index(
}
/* no record is ok */
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10783,9 +11140,12 @@ int spider_mysql_handler::show_index(
DBUG_RETURN(error_num);
}
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10809,6 +11169,8 @@ int spider_mysql_handler::show_index(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10817,6 +11179,8 @@ int spider_mysql_handler::show_index(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10832,11 +11196,15 @@ int spider_mysql_handler::show_index(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10854,6 +11222,8 @@ int spider_mysql_handler::show_index(
{
if (error_num || (error_num = spider_db_errorno(conn)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10862,6 +11232,8 @@ int spider_mysql_handler::show_index(
}
/* no record is ok */
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10928,9 +11300,12 @@ int spider_mysql_handler::show_records(
SPIDER_SHARE *share = spider->share;
uint pos = spider->conn_link_idx[link_idx];
DBUG_ENTER("spider_mysql_handler::show_records");
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10954,6 +11329,8 @@ int spider_mysql_handler::show_records(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10963,6 +11340,8 @@ int spider_mysql_handler::show_records(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10979,12 +11358,16 @@ int spider_mysql_handler::show_records(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_PRINT("info", ("spider error_num=%d 3", error_num));
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11001,18 +11384,29 @@ int spider_mysql_handler::show_records(
request_key.next = NULL;
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
+ if (error_num)
{
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
DBUG_RETURN(error_num);
+ }
+ else if ((error_num = spider_db_errorno(conn)))
+ {
+ DBUG_PRINT("info", ("spider error_num=%d 6", error_num));
+ DBUG_RETURN(error_num);
} else {
- DBUG_PRINT("info", ("spider error_num=%d 6",
+ DBUG_PRINT("info", ("spider error_num=%d 7",
ER_QUERY_ON_FOREIGN_DATA_SOURCE));
DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11062,9 +11456,12 @@ ha_rows spider_mysql_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -11090,6 +11487,8 @@ ha_rows spider_mysql_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11100,6 +11499,8 @@ ha_rows spider_mysql_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11118,6 +11519,8 @@ ha_rows spider_mysql_handler::explain_select(
error_num = spider_db_errorno(conn);
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11127,6 +11530,8 @@ ha_rows spider_mysql_handler::explain_select(
} else {
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11146,6 +11551,8 @@ ha_rows spider_mysql_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11153,6 +11560,8 @@ ha_rows spider_mysql_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
} else {
my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11160,6 +11569,8 @@ ha_rows spider_mysql_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11192,13 +11603,18 @@ int spider_mysql_handler::lock_tables(
}
if (str->length())
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11214,10 +11630,14 @@ int spider_mysql_handler::lock_tables(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11252,14 +11672,31 @@ int spider_mysql_handler::unlock_tables(
{
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
spider->share);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
str->ptr(),
str->length(),
-1,
&spider->need_mons[link_idx])
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -11282,13 +11719,18 @@ int spider_mysql_handler::disable_keys(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11304,11 +11746,15 @@ int spider_mysql_handler::disable_keys(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11331,13 +11777,18 @@ int spider_mysql_handler::enable_keys(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11353,11 +11804,15 @@ int spider_mysql_handler::enable_keys(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11381,13 +11836,18 @@ int spider_mysql_handler::check_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11403,11 +11863,15 @@ int spider_mysql_handler::check_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11431,13 +11895,18 @@ int spider_mysql_handler::repair_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11453,11 +11922,15 @@ int spider_mysql_handler::repair_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11480,13 +11953,18 @@ int spider_mysql_handler::analyze_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11502,11 +11980,15 @@ int spider_mysql_handler::analyze_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11529,13 +12011,18 @@ int spider_mysql_handler::optimize_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11551,11 +12038,15 @@ int spider_mysql_handler::optimize_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11581,6 +12072,14 @@ int spider_mysql_handler::flush_tables(
}
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
share);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
str->ptr(),
@@ -11588,9 +12087,17 @@ int spider_mysql_handler::flush_tables(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -11606,6 +12113,14 @@ int spider_mysql_handler::flush_logs(
DBUG_PRINT("info",("spider this=%p", this));
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
share);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_FLUSH_LOGS_STR,
@@ -11613,9 +12128,17 @@ int spider_mysql_handler::flush_logs(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index 281e3188067..d5d41f4a994 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -1780,16 +1780,18 @@ int spider_db_oracle::start_transaction(
}
DBUG_RETURN(set_trx_isolation(conn->trx_isolation, need_mon));
}
+ pthread_mutex_assert_owner(&conn->mta_conn_mutex);
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
if (spider_db_query(
conn,
SPIDER_SQL_START_TRANSACTION_STR,
SPIDER_SQL_START_TRANSACTION_LEN,
-1,
need_mon)
- )
+ ) {
DBUG_RETURN(spider_db_errorno(conn));
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
+ }
DBUG_RETURN(0);
}
@@ -1978,14 +1980,31 @@ int spider_db_oracle::set_trx_isolation(
DBUG_RETURN(exec_query(SPIDER_SQL_ISO_READ_COMMITTED_STR,
SPIDER_SQL_ISO_READ_COMMITTED_LEN, -1));
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_READ_COMMITTED_STR,
SPIDER_SQL_ISO_READ_COMMITTED_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
@@ -1996,14 +2015,31 @@ int spider_db_oracle::set_trx_isolation(
DBUG_RETURN(exec_query(SPIDER_SQL_ISO_SERIALIZABLE_STR,
SPIDER_SQL_ISO_SERIALIZABLE_LEN, -1));
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_ISO_SERIALIZABLE_STR,
SPIDER_SQL_ISO_SERIALIZABLE_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
break;
@@ -2033,14 +2069,31 @@ int spider_db_oracle::set_autocommit(
DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_ON_STR,
SPIDER_SQL_AUTOCOMMIT_ON_LEN, -1));
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_AUTOCOMMIT_ON_STR,
SPIDER_SQL_AUTOCOMMIT_ON_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} else {
@@ -2049,14 +2102,31 @@ int spider_db_oracle::set_autocommit(
DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_OFF_STR,
SPIDER_SQL_AUTOCOMMIT_OFF_LEN, -1));
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = need_mon;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_AUTOCOMMIT_OFF_STR,
SPIDER_SQL_AUTOCOMMIT_OFF_LEN,
-1,
need_mon)
- )
+ ) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
+ }
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -10449,112 +10519,6 @@ int spider_oracle_handler::show_table_status(
if (sts_mode == 1)
{
-/*
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_table_status[0 + pos].ptr(),
- oracle_share->show_table_status[0 + pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
-*/
- /* retry */
-/*
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_table_status[0 + pos].ptr(),
- oracle_share->show_table_status[0 + pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->trx->spider_thread_id;
- request_key.query_id = spider->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
- DBUG_RETURN(error_num);
- else {
- my_printf_error(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM,
- ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0),
- oracle_share->db_names_str[spider->conn_link_idx[link_idx]].ptr(),
- oracle_share->table_names_str[spider->conn_link_idx[
- link_idx]].ptr());
- DBUG_RETURN(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM);
- }
- }
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- error_num = res->fetch_table_status(
- sts_mode,
- share->records,
- share->mean_rec_length,
- share->data_file_length,
- share->max_data_file_length,
- share->index_file_length,
- auto_increment_value,
- share->create_time,
- share->update_time,
- share->check_time
- );
- res->free_result();
- delete res;
- if (error_num)
- DBUG_RETURN(error_num);
-*/
if (!share->records)
share->records = 10000;
share->mean_rec_length = 65535;
@@ -10565,9 +10529,12 @@ int spider_oracle_handler::show_table_status(
share->update_time = (time_t) 0;
share->check_time = (time_t) 0;
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10591,6 +10558,8 @@ int spider_oracle_handler::show_table_status(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10599,6 +10568,8 @@ int spider_oracle_handler::show_table_status(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10614,11 +10585,15 @@ int spider_oracle_handler::show_table_status(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10634,6 +10609,8 @@ int spider_oracle_handler::show_table_status(
request_key.next = NULL;
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (error_num || (error_num = spider_db_errorno(conn)))
@@ -10641,6 +10618,8 @@ int spider_oracle_handler::show_table_status(
else
DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10695,105 +10674,6 @@ int spider_oracle_handler::show_index(
DBUG_PRINT("info",("spider crd_mode=%d", crd_mode));
if (crd_mode == 1)
{
-/*
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_index[0 + pos].ptr(),
- oracle_share->show_index[0 + pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
-*/
- /* retry */
-/*
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_index[0 + pos].ptr(),
- oracle_share->show_index[0 + pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->trx->spider_thread_id;
- request_key.query_id = spider->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- if (error_num || (error_num = spider_db_errorno(conn)))
- {
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
-*/
- /* no record is ok */
-/*
- }
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- if (res)
- {
- error_num = res->fetch_table_cardinality(
- crd_mode,
- table,
- share->cardinality,
- share->cardinality_upd,
- share->bitmap_size
- );
- }
-*/
for (roop_count = 0, tmp_cardinality = share->cardinality;
roop_count < (int) table->s->fields;
roop_count++, tmp_cardinality++)
@@ -10805,19 +10685,13 @@ int spider_oracle_handler::show_index(
*tmp_cardinality = 1;
}
}
-/*
- if (res)
- {
- res->free_result();
- delete res;
- }
- if (error_num)
- DBUG_RETURN(error_num);
-*/
} else {
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10841,6 +10715,8 @@ int spider_oracle_handler::show_index(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10849,6 +10725,8 @@ int spider_oracle_handler::show_index(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10864,11 +10742,15 @@ int spider_oracle_handler::show_index(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10886,6 +10768,8 @@ int spider_oracle_handler::show_index(
{
if (error_num || (error_num = spider_db_errorno(conn)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10894,6 +10778,8 @@ int spider_oracle_handler::show_index(
}
/* no record is ok */
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10939,9 +10825,12 @@ int spider_oracle_handler::show_records(
SPIDER_SHARE *share = spider->share;
uint pos = spider->conn_link_idx[link_idx];
DBUG_ENTER("spider_oracle_handler::show_records");
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -10965,6 +10854,8 @@ int spider_oracle_handler::show_records(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10974,6 +10865,8 @@ int spider_oracle_handler::show_records(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -10990,12 +10883,16 @@ int spider_oracle_handler::show_records(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_PRINT("info", ("spider error_num=%d 3", error_num));
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11012,18 +10909,29 @@ int spider_oracle_handler::show_records(
request_key.next = NULL;
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
+ if (error_num)
{
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
DBUG_RETURN(error_num);
+ }
+ else if (error_num || (error_num = spider_db_errorno(conn)))
+ {
+ DBUG_PRINT("info", ("spider error_num=%d 6", error_num));
+ DBUG_RETURN(error_num);
} else {
- DBUG_PRINT("info", ("spider error_num=%d 6",
+ DBUG_PRINT("info", ("spider error_num=%d 7",
ER_QUERY_ON_FOREIGN_DATA_SOURCE));
DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11056,9 +10964,12 @@ int spider_oracle_handler::show_autoinc(
if (!oracle_share->show_autoinc)
DBUG_RETURN(0);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -11082,6 +10993,8 @@ int spider_oracle_handler::show_autoinc(
/* retry */
if ((error_num = spider_db_ping(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11091,6 +11004,8 @@ int spider_oracle_handler::show_autoinc(
}
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11107,12 +11022,16 @@ int spider_oracle_handler::show_autoinc(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_PRINT("info", ("spider error_num=%d 3", error_num));
DBUG_RETURN(spider_db_errorno(conn));
}
} else {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11129,18 +11048,29 @@ int spider_oracle_handler::show_autoinc(
request_key.next = NULL;
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
+ if (error_num)
{
+ SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
DBUG_RETURN(error_num);
+ }
+ else if ((error_num = spider_db_errorno(conn)))
+ {
+ DBUG_PRINT("info", ("spider error_num=%d 6", error_num));
+ DBUG_RETURN(error_num);
} else {
- DBUG_PRINT("info", ("spider error_num=%d 6",
+ DBUG_PRINT("info", ("spider error_num=%d 7",
ER_QUERY_ON_FOREIGN_DATA_SOURCE));
DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11250,9 +11180,12 @@ ha_rows spider_oracle_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
@@ -11278,6 +11211,8 @@ ha_rows spider_oracle_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11288,6 +11223,8 @@ ha_rows spider_oracle_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11306,6 +11243,8 @@ ha_rows spider_oracle_handler::explain_select(
error_num = spider_db_errorno(conn);
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11315,6 +11254,8 @@ ha_rows spider_oracle_handler::explain_select(
} else {
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11334,6 +11275,8 @@ ha_rows spider_oracle_handler::explain_select(
{
if (spider->check_error_mode(error_num))
my_errno = error_num;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11341,6 +11284,8 @@ ha_rows spider_oracle_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
} else {
my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE;
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11348,6 +11293,8 @@ ha_rows spider_oracle_handler::explain_select(
DBUG_RETURN(HA_POS_ERROR);
}
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11381,13 +11328,18 @@ int spider_oracle_handler::lock_tables(
}
if (str->length())
{
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11403,10 +11355,14 @@ int spider_oracle_handler::lock_tables(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
DBUG_RETURN(spider_db_errorno(conn));
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11452,13 +11408,18 @@ int spider_oracle_handler::disable_keys(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11474,11 +11435,15 @@ int spider_oracle_handler::disable_keys(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11501,13 +11466,18 @@ int spider_oracle_handler::enable_keys(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11523,11 +11493,15 @@ int spider_oracle_handler::enable_keys(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11551,13 +11525,18 @@ int spider_oracle_handler::check_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11573,11 +11552,15 @@ int spider_oracle_handler::check_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11601,13 +11584,18 @@ int spider_oracle_handler::repair_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11623,11 +11611,15 @@ int spider_oracle_handler::repair_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11650,13 +11642,18 @@ int spider_oracle_handler::analyze_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11672,11 +11669,15 @@ int spider_oracle_handler::analyze_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11699,13 +11700,18 @@ int spider_oracle_handler::optimize_table(
{
DBUG_RETURN(error_num);
}
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11721,11 +11727,15 @@ int spider_oracle_handler::optimize_table(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -11751,6 +11761,14 @@ int spider_oracle_handler::flush_tables(
}
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
share);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
str->ptr(),
@@ -11758,9 +11776,17 @@ int spider_oracle_handler::flush_tables(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
@@ -11776,6 +11802,14 @@ int spider_oracle_handler::flush_logs(
DBUG_PRINT("info",("spider this=%p", this));
spider_conn_set_timeout_from_share(conn, link_idx, spider->trx->thd,
share);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
+ pthread_mutex_lock(&conn->mta_conn_mutex);
+ SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
+ conn->need_mon = &spider->need_mons[link_idx];
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = TRUE;
+ conn->mta_conn_mutex_unlock_later = TRUE;
if (spider_db_query(
conn,
SPIDER_SQL_FLUSH_LOGS_STR,
@@ -11783,9 +11817,17 @@ int spider_oracle_handler::flush_logs(
-1,
&spider->need_mons[link_idx])
) {
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
+ conn->mta_conn_mutex_lock_already = FALSE;
+ conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
DBUG_RETURN(0);
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index a6ce2efe774..a871e186d96 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -17,6 +17,8 @@
#define SPIDER_HEX_VERSION 0x0302
#if MYSQL_VERSION_ID < 50500
+#define pthread_mutex_assert_owner(A)
+#define pthread_mutex_assert_not_owner(A)
#else
#define my_free(A,B) my_free(A)
#ifdef pthread_mutex_t
@@ -39,6 +41,8 @@
#undef pthread_mutex_destroy
#endif
#define pthread_mutex_destroy mysql_mutex_destroy
+#define pthread_mutex_assert_owner(A) mysql_mutex_assert_owner(A)
+#define pthread_mutex_assert_not_owner(A) mysql_mutex_assert_not_owner(A)
#ifdef pthread_cond_t
#undef pthread_cond_t
#endif
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 7c591cf691d..39f51fa1b59 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -5815,13 +5815,18 @@ int spider_open_all_tables(
}
conn->error_mode &= spider_param_error_read_mode(thd, 0);
conn->error_mode &= spider_param_error_write_mode(thd, 0);
+ pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &mon_val;
+ DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
if ((error_num = spider_db_before_query(conn, &mon_val)))
{
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
@@ -5834,6 +5839,8 @@ int spider_open_all_tables(
free_root(&mem_root, MYF(0));
DBUG_RETURN(error_num);
}
+ DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
+ DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index f22f7c1d6b5..eaad6488796 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -1,4 +1,4 @@
-SET(TOKUDB_VERSION 5.6.41-84.1)
+SET(TOKUDB_VERSION 5.6.49-89.0)
# PerconaFT only supports x86-64 and cmake-2.8.9+
IF(WIN32)
# tokudb never worked there
@@ -136,6 +136,7 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG)
ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}")
ENDIF()
+MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-format-attribute)
MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers)
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/PerconaFT/")
@@ -168,3 +169,5 @@ TARGET_LINK_LIBRARIES(tokudb tokufractaltree_static tokuportability_static
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -fuse-linker-plugin")
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} -flto -fuse-linker-plugin")
+
+ADD_SUBDIRECTORY(man)
diff --git a/storage/tokudb/PerconaFT/DartConfig.cmake b/storage/tokudb/PerconaFT/DartConfig.cmake
deleted file mode 100644
index 9ad189869c6..00000000000
--- a/storage/tokudb/PerconaFT/DartConfig.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-if(BUILD_TESTING)
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
- # Valgrind on OSX 10.8 generally works but outputs some warning junk
- # that is hard to parse out, so we'll just let it run alone
- set(MEMORYCHECK_COMMAND "${TokuDB_SOURCE_DIR}/scripts/tokuvalgrind")
- endif ()
- set(MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=no --soname-synonyms=somalloc=*tokuportability* --quiet --num-callers=20 --leak-check=full --show-reachable=yes --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump,*/tdb-recover --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind" CACHE INTERNAL "options for valgrind")
- set(MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" CACHE INTERNAL "suppressions file for valgrind")
- set(UPDATE_COMMAND "svn")
-endif()
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake
index 2f04a33558a..88210868eda 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuFeatureDetection.cmake
@@ -134,4 +134,4 @@ static __thread int tlsvar = 0;
int main(void) { return tlsvar; }" HAVE_GNU_TLS)
## set TOKUDB_REVISION
-set(CMAKE_TOKUDB_REVISION 0 CACHE INTEGER "Revision of tokudb.")
+set(CMAKE_TOKUDB_REVISION 0 CACHE STRING "Revision of tokudb.")
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
index 8f65895cc9c..924e24c8f2e 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake
@@ -47,20 +47,18 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
## adds a compiler flag if the compiler supports it
-macro(set_cflags_if_supported)
+macro(prepend_cflags_if_supported)
foreach(flag ${ARGN})
MY_CHECK_AND_SET_COMPILER_FLAG(${flag})
endforeach(flag)
-endmacro(set_cflags_if_supported)
+endmacro(prepend_cflags_if_supported)
if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
set (OPTIONAL_CFLAGS "${OPTIONAL_CFLAGS} -Wmissing-format-attribute")
endif()
## disable some warnings
-## missing-format-attribute causes warnings in some MySQL include files
-## if the library is built as a part of TokuDB MySQL storage engine
-set_cflags_if_supported(
+prepend_cflags_if_supported(
-Wno-missing-field-initializers
-Wstrict-null-sentinel
-Winit-self
@@ -77,7 +75,6 @@ set_cflags_if_supported(
-fno-exceptions
-Wno-error=nonnull-compare
)
-## set_cflags_if_supported_named("-Weffc++" -Weffcpp)
if (CMAKE_CXX_FLAGS MATCHES -fno-implicit-templates)
# must append this because mysql sets -fno-implicit-templates and we need to override it
@@ -89,24 +86,18 @@ endif()
## Clang has stricter POD checks. So, only enable this warning on our other builds (Linux + GCC)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
- set_cflags_if_supported(
+ prepend_cflags_if_supported(
-Wpacked
)
endif ()
option (PROFILING "Allow profiling and debug" ON)
if (PROFILING)
- set_cflags_if_supported(
+ prepend_cflags_if_supported(
-fno-omit-frame-pointer
)
endif ()
-## this hits with optimized builds somewhere in ftleaf_split, we don't
-## know why but we don't think it's a big deal
-set_cflags_if_supported(
- -Wno-error=strict-overflow
- )
-
# new flag sets in MySQL 8.0 seem to explicitly disable this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
@@ -144,7 +135,7 @@ else ()
endif ()
## set warnings
-set_cflags_if_supported(
+prepend_cflags_if_supported(
-Wextra
-Wbad-function-cast
-Wno-missing-noreturn
@@ -167,12 +158,12 @@ set_cflags_if_supported(
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# Disabling -Wcast-align with clang. TODO: fix casting and re-enable it, someday.
- set_cflags_if_supported(-Wcast-align)
+ prepend_cflags_if_supported(-Wcast-align)
endif ()
-## always want these in debug builds
-set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror ${CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror ${CMAKE_CXX_FLAGS_DEBUG}")
+## never want these
+set(CMAKE_C_FLAGS "-Wno-error ${CMAKE_C_FLAGS}")
+set(CMAKE_CXX_FLAGS "-Wno-error ${CMAKE_CXX_FLAGS}")
# pick language dialect
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
index 5467bef43b4..034d5442742 100644
--- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
+++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
@@ -225,6 +225,9 @@ uint32_t toku_get_checkpoint_period_unlocked (CACHETABLE ct) {
}
void toku_set_cleaner_period (CACHETABLE ct, uint32_t new_period) {
+ if(force_recovery) {
+ return;
+ }
ct->cl.set_period(new_period);
}
@@ -3026,9 +3029,12 @@ int toku_cleaner_thread (void *cleaner_v) {
//
ENSURE_POD(cleaner);
+extern uint force_recovery;
+
int cleaner::init(uint32_t _cleaner_iterations, pair_list* _pl, CACHETABLE _ct) {
// default is no cleaner, for now
m_cleaner_cron_init = false;
+ if (force_recovery) return 0;
int r = toku_minicron_setup(&m_cleaner_cron, 0, toku_cleaner_thread, this);
if (r == 0) {
m_cleaner_cron_init = true;
diff --git a/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc b/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc
index 6b6ff1e323f..439e0688e89 100644
--- a/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-cachetable-wrappers.cc
@@ -73,7 +73,7 @@ cachetable_put_empty_node_with_dep_nodes(
enum cachetable_dirty dependent_dirty_bits[num_dependent_nodes];
for (uint32_t i = 0; i < num_dependent_nodes; i++) {
dependent_pairs[i] = dependent_nodes[i]->ct_pair;
- dependent_dirty_bits[i] = (enum cachetable_dirty) dependent_nodes[i]->dirty;
+ dependent_dirty_bits[i] = (enum cachetable_dirty) dependent_nodes[i]->dirty();
}
toku_cachetable_put_with_dep_pairs(
@@ -253,7 +253,7 @@ toku_pin_ftnode_for_query(
// written out, it would have to be dirtied. That
// requires a write lock, and a write lock requires you to
// resolve checkpointing.
- if (!node->dirty) {
+ if (!node->dirty()) {
toku_ft_bn_update_max_msn(node, max_msn_in_path, bfe->child_to_read);
}
}
@@ -280,7 +280,7 @@ toku_pin_ftnode_with_dep_nodes(
enum cachetable_dirty dependent_dirty_bits[num_dependent_nodes];
for (uint32_t i = 0; i < num_dependent_nodes; i++) {
dependent_pairs[i] = dependent_nodes[i]->ct_pair;
- dependent_dirty_bits[i] = (enum cachetable_dirty) dependent_nodes[i]->dirty;
+ dependent_dirty_bits[i] = (enum cachetable_dirty) dependent_nodes[i]->dirty();
}
int r = toku_cachetable_get_and_pin_with_dep_pairs(
@@ -333,7 +333,7 @@ cleanup:
void toku_unpin_ftnode(FT ft, FTNODE node) {
int r = toku_cachetable_unpin(ft->cf,
node->ct_pair,
- static_cast<enum cachetable_dirty>(node->dirty),
+ static_cast<enum cachetable_dirty>(node->dirty()),
make_ftnode_pair_attr(node));
invariant_zero(r);
}
@@ -344,7 +344,7 @@ toku_unpin_ftnode_read_only(FT ft, FTNODE node)
int r = toku_cachetable_unpin(
ft->cf,
node->ct_pair,
- (enum cachetable_dirty) node->dirty,
+ (enum cachetable_dirty) node->dirty(),
make_invalid_pair_attr()
);
assert(r==0);
diff --git a/storage/tokudb/PerconaFT/ft/ft-flusher.cc b/storage/tokudb/PerconaFT/ft/ft-flusher.cc
index 3fd59f388ce..bbb2a170cb9 100644
--- a/storage/tokudb/PerconaFT/ft/ft-flusher.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-flusher.cc
@@ -139,7 +139,7 @@ maybe_destroy_child_blbs(FTNODE node, FTNODE child, FT ft)
// up to date.
if (child->n_children > 1 &&
child->height == 0 &&
- !child->dirty) {
+ !child->dirty()) {
for (int i = 0; i < child->n_children; ++i) {
if (BP_STATE(child, i) == PT_AVAIL &&
node->max_msn_applied_to_node_on_disk.msn < BLB_MAX_MSN_APPLIED(child, i).msn)
@@ -480,7 +480,7 @@ handle_split_of_child(
}
)
- node->dirty = 1;
+ node->set_dirty();
XREALLOC_N(node->n_children+1, node->bp);
// Slide the children over.
@@ -662,8 +662,8 @@ static void ftnode_finalize_split(FTNODE node, FTNODE B, MSN max_msn_applied_to_
// The new node in the split inherits the oldest known reference xid
B->oldest_referenced_xid_known = node->oldest_referenced_xid_known;
- node->dirty = 1;
- B->dirty = 1;
+ node->set_dirty();
+ B->set_dirty();
}
void
@@ -1003,8 +1003,8 @@ flush_this_child(
paranoid_invariant(child->blocknum.b!=0);
// VERIFY_NODE does not work off client thread as of now
//VERIFY_NODE(t, child);
- node->dirty = 1;
- child->dirty = 1;
+ node->set_dirty();
+ child->set_dirty();
BP_WORKDONE(node, childnum) = 0; // this buffer is drained, no work has been done by its contents
NONLEAF_CHILDINFO bnc = BNC(node, childnum);
@@ -1034,8 +1034,8 @@ merge_leaf_nodes(FTNODE a, FTNODE b)
// TODO(leif): this is no longer the way in_memory_stats is
// maintained. verify that it's ok to move this just before the unpin
// and then do that.
- a->dirty = 1;
- b->dirty = 1;
+ a->set_dirty();
+ b->set_dirty();
bn_data* a_last_bd = BLB_DATA(a, a->n_children-1);
// this bool states if the last basement node in a has any items or not
@@ -1167,8 +1167,8 @@ maybe_merge_pinned_nonleaf_nodes(
a->n_children = new_n_children;
b->n_children = 0;
- a->dirty = 1;
- b->dirty = 1;
+ a->set_dirty();
+ b->set_dirty();
*did_merge = true;
*did_rebalance = false;
@@ -1211,7 +1211,7 @@ maybe_merge_pinned_nodes(
toku_ftnode_assert_fully_in_memory(parent);
toku_ftnode_assert_fully_in_memory(a);
toku_ftnode_assert_fully_in_memory(b);
- parent->dirty = 1; // just to make sure
+ parent->set_dirty(); // just to make sure
{
MSN msna = a->max_msn_applied_to_node_on_disk;
MSN msnb = b->max_msn_applied_to_node_on_disk;
@@ -1335,8 +1335,8 @@ ft_merge_child(
}
paranoid_invariant(BP_BLOCKNUM(node, childnuma).b == childa->blocknum.b);
- childa->dirty = 1; // just to make sure
- childb->dirty = 1; // just to make sure
+ childa->set_dirty(); // just to make sure
+ childb->set_dirty(); // just to make sure
} else {
// flow will be inaccurate for a while, oh well. the children
// are leaves in this case so it's not a huge deal (we're
@@ -1345,7 +1345,7 @@ ft_merge_child(
// If we didn't merge the nodes, then we need the correct pivot.
invariant_notnull(splitk.data);
node->pivotkeys.replace_at(&splitk, childnuma);
- node->dirty = 1;
+ node->set_dirty();
}
toku_destroy_dbt(&splitk);
}
@@ -1369,7 +1369,7 @@ ft_merge_child(
call_flusher_thread_callback(ft_flush_aflter_merge);
// unlock the parent
- paranoid_invariant(node->dirty);
+ paranoid_invariant(node->dirty());
toku_unpin_ftnode(ft, node);
}
else {
@@ -1377,7 +1377,7 @@ ft_merge_child(
call_flusher_thread_callback(ft_flush_aflter_rebalance);
// unlock the parent
- paranoid_invariant(node->dirty);
+ paranoid_invariant(node->dirty());
toku_unpin_ftnode(ft, node);
toku_unpin_ftnode(ft, childb);
}
@@ -1439,9 +1439,9 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
// only do the following work if there is a flush to perform
if (toku_bnc_n_entries(BNC(parent, childnum)) > 0 || parent->height == 1) {
- if (!parent->dirty) {
+ if (!parent->dirty()) {
dirtied++;
- parent->dirty = 1;
+ parent->set_dirty();
}
// detach buffer
BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents
@@ -1486,9 +1486,9 @@ void toku_ft_flush_some_child(FT ft, FTNODE parent, struct flusher_advice *fa)
// in the buffer to flush, and as a result, flushing is not necessary
// and bnc is NULL
if (bnc != NULL) {
- if (!child->dirty) {
+ if (!child->dirty()) {
dirtied++;
- child->dirty = 1;
+ child->set_dirty();
}
// do the actual flush
toku_bnc_flush_to_child(
@@ -1787,7 +1787,7 @@ static void flush_node_fun(void *fe_v)
// read them back in, or just do the regular partial fetch. If we
// don't, that means fe->node is a parent, so we need to do this anyway.
bring_node_fully_into_memory(fe->node,fe->ft);
- fe->node->dirty = 1;
+ fe->node->set_dirty();
struct flusher_advice fa;
struct flush_status_update_extra fste;
@@ -1893,7 +1893,7 @@ void toku_ft_flush_node_on_background_thread(FT ft, FTNODE parent)
//
// can detach buffer and unpin root here
//
- parent->dirty = 1;
+ parent->set_dirty();
BP_WORKDONE(parent, childnum) = 0; // this buffer is drained, no work has been done by its contents
NONLEAF_CHILDINFO bnc = BNC(parent, childnum);
NONLEAF_CHILDINFO new_bnc = toku_create_empty_nl();
diff --git a/storage/tokudb/PerconaFT/ft/ft-internal.h b/storage/tokudb/PerconaFT/ft/ft-internal.h
index eec591d1744..130d3c302aa 100644
--- a/storage/tokudb/PerconaFT/ft/ft-internal.h
+++ b/storage/tokudb/PerconaFT/ft/ft-internal.h
@@ -76,11 +76,30 @@ enum ft_type {
FT_CHECKPOINT_INPROGRESS
};
+extern "C" {
+extern uint force_recovery;
+}
+
+extern int writing_rollback;
+
// The ft_header is not managed by the cachetable. Instead, it hangs off the cachefile as userdata.
struct ft_header {
enum ft_type type;
- int dirty;
+ int dirty_;
+
+ void set_dirty() {
+ if(force_recovery) assert(writing_rollback);
+ dirty_ = 1;
+ }
+
+ void clear_dirty() {
+ dirty_ = 0;
+ }
+
+ bool dirty() {
+ return dirty_;
+ }
// Free-running counter incremented once per checkpoint (toggling LSB).
// LSB indicates which header location is used on disk so this
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc
index df0d88a9580..d752f13c9c3 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc
@@ -656,7 +656,7 @@ void toku_ftnode_clone_callback(void *value_data,
node->layout_version_read_from_disk;
cloned_node->build_id = node->build_id;
cloned_node->height = node->height;
- cloned_node->dirty = node->dirty;
+ cloned_node->dirty_ = node->dirty_;
cloned_node->fullhash = node->fullhash;
cloned_node->n_children = node->n_children;
@@ -672,8 +672,8 @@ void toku_ftnode_clone_callback(void *value_data,
toku_ftnode_clone_partitions(node, cloned_node);
// clear dirty bit
- node->dirty = 0;
- cloned_node->dirty = 0;
+ node->clear_dirty();
+ cloned_node->clear_dirty();
node->layout_version_read_from_disk = FT_LAYOUT_VERSION;
// set new pair attr if necessary
if (node->height == 0) {
@@ -742,7 +742,7 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
// persisted, we need undo the logical row count adjustments as
// they may occur again in the future if/when the node is
// re-read from disk for another query or change.
- if (!ftnode->dirty && !write_me) {
+ if (!ftnode->dirty() && !write_me) {
int64_t lrc_delta = 0;
for (int i = 0; i < ftnode->n_children; i++) {
if (BP_STATE(ftnode, i) == PT_AVAIL) {
@@ -847,8 +847,8 @@ int toku_ftnode_fetch_callback(CACHEFILE UU(cachefile),
if (r == 0) {
*sizep = make_ftnode_pair_attr(*node);
(*node)->ct_pair = p;
- *dirtyp = (*node)->dirty; // deserialize could mark the node as dirty
- // (presumably for upgrade)
+ *dirtyp = (*node)->dirty(); // deserialize could mark the node as dirty
+ // (presumably for upgrade)
}
return r;
}
@@ -870,7 +870,7 @@ void toku_ftnode_pe_est_callback(
paranoid_invariant(ftnode_pv != NULL);
long bytes_to_free = 0;
FTNODE node = static_cast<FTNODE>(ftnode_pv);
- if (node->dirty || node->height == 0 ||
+ if (node->dirty() || node->height == 0 ||
node->layout_version_read_from_disk < FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES) {
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
@@ -947,7 +947,7 @@ int toku_ftnode_pe_callback(void *ftnode_pv,
void *pointers_to_free[node->n_children * 2];
// Don't partially evict dirty nodes
- if (node->dirty) {
+ if (node->dirty()) {
goto exit;
}
// Don't partially evict nodes whose partitions can't be read back
@@ -1400,7 +1400,7 @@ ft_init_new_root(FT ft, FTNODE oldroot, FTNODE *newrootp)
MSN msna = oldroot->max_msn_applied_to_node_on_disk;
newroot->max_msn_applied_to_node_on_disk = msna;
BP_STATE(newroot,0) = PT_AVAIL;
- newroot->dirty = 1;
+ newroot->set_dirty();
// Set the first child to have the new blocknum,
// and then swap newroot with oldroot. The new root
@@ -1488,7 +1488,7 @@ static void inject_message_in_locked_node(
// mark the node as dirty.
// enforcing invariant here.
//
- paranoid_invariant(node->dirty != 0);
+ paranoid_invariant(node->dirty() != 0);
// update some status variables
if (node->height != 0) {
@@ -1848,7 +1848,7 @@ static void push_something_in_subtree(
}
}
- if (next_loc != NEITHER_EXTREME || child->dirty || toku_bnc_should_promote(ft, bnc)) {
+ if (next_loc != NEITHER_EXTREME || child->dirty() || toku_bnc_should_promote(ft, bnc)) {
push_something_in_subtree(ft, child, -1, msg, flow_deltas, gc_info, depth + 1, next_loc, false);
toku_sync_fetch_and_add(&bnc->flow[0], flow_deltas[0]);
// The recursive call unpinned the child, but
@@ -2803,9 +2803,9 @@ static int ft_create_file(FT_HANDLE UU(ft_handle), const char *fname, int *fdp)
}
// open a file for use by the ft. if the file does not exist, error
-static int ft_open_file(const char *fname, int *fdp) {
+static int ft_open_file(const char *fname, int *fdp, bool rw) {
int fd;
- fd = ft_open_maybe_direct(fname, O_RDWR | O_BINARY, file_mode);
+ fd = ft_open_maybe_direct(fname, (rw ? O_RDWR : O_RDONLY) | O_BINARY, file_mode);
if (fd==-1) {
return get_error_errno();
}
@@ -2956,7 +2956,7 @@ toku_ft_handle_inherit_options(FT_HANDLE t, FT ft) {
// The checkpointed version (checkpoint_lsn) of the dictionary must be no later than max_acceptable_lsn .
// Requires: The multi-operation client lock must be held to prevent a checkpoint from occuring.
static int
-ft_handle_open(FT_HANDLE ft_h, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, FILENUM use_filenum, DICTIONARY_ID use_dictionary_id, LSN max_acceptable_lsn) {
+ft_handle_open(FT_HANDLE ft_h, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, FILENUM use_filenum, DICTIONARY_ID use_dictionary_id, LSN max_acceptable_lsn, bool open_rw = true) {
int r;
bool txn_created = false;
char *fname_in_cwd = NULL;
@@ -2978,7 +2978,7 @@ ft_handle_open(FT_HANDLE ft_h, const char *fname_in_env, int is_create, int only
fname_in_cwd = toku_cachetable_get_fname_in_cwd(cachetable, fname_in_env);
{
int fd = -1;
- r = ft_open_file(fname_in_cwd, &fd);
+ r = ft_open_file(fname_in_cwd, &fd, open_rw);
if (reserved_filenum.fileid == FILENUM_NONE.fileid) {
reserved_filenum = toku_cachetable_reserve_filenum(cachetable);
}
@@ -3124,15 +3124,15 @@ toku_ft_handle_open_recovery(FT_HANDLE t, const char *fname_in_env, int is_creat
// Open an ft in normal use. The FILENUM and dict_id are assigned by the ft_handle_open() function.
// Requires: The multi-operation client lock must be held to prevent a checkpoint from occuring.
int
-toku_ft_handle_open(FT_HANDLE t, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn) {
+toku_ft_handle_open(FT_HANDLE t, const char *fname_in_env, int is_create, int only_create, CACHETABLE cachetable, TOKUTXN txn, bool open_rw) {
int r;
- r = ft_handle_open(t, fname_in_env, is_create, only_create, cachetable, txn, FILENUM_NONE, DICTIONARY_ID_NONE, MAX_LSN);
+ r = ft_handle_open(t, fname_in_env, is_create, only_create, cachetable, txn, FILENUM_NONE, DICTIONARY_ID_NONE, MAX_LSN, open_rw);
return r;
}
// clone an ft handle. the cloned handle has a new dict_id but refers to the same fractal tree
int
-toku_ft_handle_clone(FT_HANDLE *cloned_ft_handle, FT_HANDLE ft_handle, TOKUTXN txn) {
+toku_ft_handle_clone(FT_HANDLE *cloned_ft_handle, FT_HANDLE ft_handle, TOKUTXN txn, bool open_rw) {
FT_HANDLE result_ft_handle;
toku_ft_handle_create(&result_ft_handle);
@@ -3147,7 +3147,7 @@ toku_ft_handle_clone(FT_HANDLE *cloned_ft_handle, FT_HANDLE ft_handle, TOKUTXN t
CACHEFILE cf = ft_handle->ft->cf;
CACHETABLE ct = toku_cachefile_get_cachetable(cf);
const char *fname_in_env = toku_cachefile_fname_in_env(cf);
- int r = toku_ft_handle_open(result_ft_handle, fname_in_env, false, false, ct, txn);
+ int r = toku_ft_handle_open(result_ft_handle, fname_in_env, false, false, ct, txn, open_rw);
if (r != 0) {
toku_ft_handle_close(result_ft_handle);
result_ft_handle = NULL;
@@ -3548,7 +3548,7 @@ unlock_ftnode_fun (void *v) {
int r = toku_cachetable_unpin_ct_prelocked_no_flush(
ft_handle->ft->cf,
node->ct_pair,
- (enum cachetable_dirty) node->dirty,
+ (enum cachetable_dirty) node->dirty(),
x->msgs_applied ? make_ftnode_pair_attr(node) : make_invalid_pair_attr()
);
assert_zero(r);
@@ -4970,6 +4970,14 @@ static void toku_pfs_keys_destroy(void) {
}
int toku_ft_layer_init(void) {
+ static bool ft_layer_init_started = false;
+
+ if(ft_layer_init_started) {
+ return 0;
+ }
+
+ ft_layer_init_started = true;
+
int r = 0;
// Portability must be initialized first
@@ -5000,6 +5008,14 @@ exit:
}
void toku_ft_layer_destroy(void) {
+ static bool ft_layer_destroy_started = false;
+
+ if(ft_layer_destroy_started) {
+ return;
+ }
+
+ ft_layer_destroy_started = true;
+
toku_mutex_destroy(&ft_open_close_lock);
toku_ft_serialize_layer_destroy();
toku_checkpoint_destroy();
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.h b/storage/tokudb/PerconaFT/ft/ft-ops.h
index df8ffe287df..7b6d0634c37 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.h
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.h
@@ -125,12 +125,12 @@ typedef int (*ft_update_func)(DB *db, const DBT *key, const DBT *old_val, const
void toku_ft_set_update(FT_HANDLE ft_h, ft_update_func update_fun);
int toku_ft_handle_open(FT_HANDLE, const char *fname_in_env,
- int is_create, int only_create, CACHETABLE ct, TOKUTXN txn) __attribute__ ((warn_unused_result));
+ int is_create, int only_create, CACHETABLE ct, TOKUTXN txn, bool open_rw=true) __attribute__ ((warn_unused_result));
int toku_ft_handle_open_recovery(FT_HANDLE, const char *fname_in_env, int is_create, int only_create, CACHETABLE ct, TOKUTXN txn,
FILENUM use_filenum, LSN max_acceptable_lsn) __attribute__ ((warn_unused_result));
// clone an ft handle. the cloned handle has a new dict_id but refers to the same fractal tree
-int toku_ft_handle_clone(FT_HANDLE *cloned_ft_handle, FT_HANDLE ft_handle, TOKUTXN txn);
+int toku_ft_handle_clone(FT_HANDLE *cloned_ft_handle, FT_HANDLE ft_handle, TOKUTXN txn, bool open_rw=true);
// close an ft handle during normal operation. the underlying ft may or may not close,
// depending if there are still references. an lsn for this close will come from the logger.
diff --git a/storage/tokudb/PerconaFT/ft/ft-recount-rows.cc b/storage/tokudb/PerconaFT/ft/ft-recount-rows.cc
index e31d80772d5..3b5501b66d3 100644
--- a/storage/tokudb/PerconaFT/ft/ft-recount-rows.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-recount-rows.cc
@@ -98,7 +98,7 @@ int toku_ft_recount_rows(FT_HANDLE ft,
if (rre._cancelled == false) {
// update ft count
toku_unsafe_set(&ft->ft->in_memory_logical_rows, rre._keys);
- ft->ft->h->dirty = 1;
+ ft->ft->h->set_dirty();
ret = 0;
}
diff --git a/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc b/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc
index a82d8a80718..ad1dda01760 100644
--- a/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-test-helpers.cc
@@ -259,7 +259,7 @@ int toku_testsetup_insert_to_nonleaf (FT_HANDLE ft_handle, BLOCKNUM blocknum, en
// is directly queueing something in a FIFO instead of
// using ft APIs.
node->max_msn_applied_to_node_on_disk = msn;
- node->dirty = 1;
+ node->set_dirty();
// Also hack max_msn_in_ft
ft_handle->ft->h->max_msn_in_ft = msn;
diff --git a/storage/tokudb/PerconaFT/ft/ft-verify.cc b/storage/tokudb/PerconaFT/ft/ft-verify.cc
index 7e3a64f441e..4f6e07e61f2 100644
--- a/storage/tokudb/PerconaFT/ft/ft-verify.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-verify.cc
@@ -512,7 +512,7 @@ toku_verify_ft_with_progress (FT_HANDLE ft_handle, int (*progress_callback)(void
if (r == 0) {
toku_ft_lock(ft_handle->ft);
ft_handle->ft->h->time_of_last_verification = time(NULL);
- ft_handle->ft->h->dirty = 1;
+ ft_handle->ft->h->set_dirty();
toku_ft_unlock(ft_handle->ft);
}
return r;
diff --git a/storage/tokudb/PerconaFT/ft/ft.cc b/storage/tokudb/PerconaFT/ft/ft.cc
index c7c2ea33c9e..1106abfbfb4 100644
--- a/storage/tokudb/PerconaFT/ft/ft.cc
+++ b/storage/tokudb/PerconaFT/ft/ft.cc
@@ -61,7 +61,7 @@ void toku_reset_root_xid_that_created(FT ft, TXNID new_root_xid_that_created) {
// (see cooperative use of dirty bit in ft_begin_checkpoint())
toku_ft_lock(ft);
ft->h->root_xid_that_created = new_root_xid_that_created;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -147,7 +147,7 @@ static void ft_begin_checkpoint (LSN checkpoint_lsn, void *header_v) {
assert(ft->h->type == FT_CURRENT);
assert(ft->checkpoint_header == NULL);
ft_copy_for_checkpoint_unlocked(ft, checkpoint_lsn);
- ft->h->dirty = 0; // this is only place this bit is cleared (in currentheader)
+ ft->h->clear_dirty(); // this is only place this bit is cleared (in currentheader)
ft->blocktable.note_start_checkpoint_unlocked();
toku_ft_unlock (ft);
}
@@ -186,7 +186,7 @@ static void ft_checkpoint (CACHEFILE cf, int fd, void *header_v) {
FT_HEADER ch = ft->checkpoint_header;
assert(ch);
assert(ch->type == FT_CHECKPOINT_INPROGRESS);
- if (ch->dirty) { // this is only place this bit is tested (in checkpoint_header)
+ if (ch->dirty()) { // this is only place this bit is tested (in checkpoint_header)
TOKULOGGER logger = toku_cachefile_logger(cf);
if (logger) {
toku_logger_fsync_if_lsn_not_fsynced(logger, ch->checkpoint_lsn);
@@ -201,7 +201,7 @@ static void ft_checkpoint (CACHEFILE cf, int fd, void *header_v) {
// write translation and header to disk (or at least to OS internal buffer)
toku_serialize_ft_to(fd, ch, &ft->blocktable, ft->cf);
- ch->dirty = 0; // this is only place this bit is cleared (in checkpoint_header)
+ ch->clear_dirty(); // this is only place this bit is cleared (in checkpoint_header)
// fsync the cachefile
toku_cachefile_fsync(cf);
@@ -255,7 +255,7 @@ static void ft_close(CACHEFILE cachefile, int fd, void *header_v, bool oplsn_val
toku_log_fclose(
logger,
&lsn,
- ft->h->dirty,
+ ft->h->dirty(),
bs,
toku_cachefile_filenum(cachefile)); // flush the log on
// close (if new header
@@ -266,7 +266,7 @@ static void ft_close(CACHEFILE cachefile, int fd, void *header_v, bool oplsn_val
}
}
}
- if (ft->h->dirty) { // this is the only place this bit is tested (in currentheader)
+ if (ft->h->dirty()) { // this is the only place this bit is tested (in currentheader)
bool do_checkpoint = true;
if (logger && logger->rollback_cachefile == cachefile) {
do_checkpoint = false;
@@ -275,7 +275,7 @@ static void ft_close(CACHEFILE cachefile, int fd, void *header_v, bool oplsn_val
ft_begin_checkpoint(lsn, header_v);
ft_checkpoint(cachefile, fd, ft);
ft_end_checkpoint(cachefile, fd, header_v);
- assert(!ft->h->dirty); // dirty bit should be cleared by begin_checkpoint and never set again (because we're closing the dictionary)
+ assert(!ft->h->dirty()); // dirty bit should be cleared by begin_checkpoint and never set again (because we're closing the dictionary)
}
}
}
@@ -371,7 +371,7 @@ ft_header_create(FT_OPTIONS options, BLOCKNUM root_blocknum, TXNID root_xid_that
uint64_t now = (uint64_t) time(NULL);
struct ft_header h = {
.type = FT_CURRENT,
- .dirty = 0,
+ .dirty_ = 0,
.checkpoint_count = 0,
.checkpoint_lsn = ZERO_LSN,
.layout_version = FT_LAYOUT_VERSION,
@@ -522,7 +522,7 @@ toku_ft_note_hot_begin(FT_HANDLE ft_handle) {
toku_ft_lock(ft);
ft->h->time_of_last_optimize_begin = now;
ft->h->count_of_optimize_in_progress++;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -546,7 +546,7 @@ toku_ft_note_hot_complete(FT_HANDLE ft_handle, bool success, MSN msn_at_start_of
if (ft->h->count_of_optimize_in_progress == ft->h->count_of_optimize_in_progress_read_from_disk)
ft->h->count_of_optimize_in_progress = 0;
}
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -959,7 +959,7 @@ void toku_ft_remove_reference(
void toku_ft_set_nodesize(FT ft, unsigned int nodesize) {
toku_ft_lock(ft);
ft->h->nodesize = nodesize;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -972,7 +972,7 @@ void toku_ft_get_nodesize(FT ft, unsigned int *nodesize) {
void toku_ft_set_basementnodesize(FT ft, unsigned int basementnodesize) {
toku_ft_lock(ft);
ft->h->basementnodesize = basementnodesize;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -985,7 +985,7 @@ void toku_ft_get_basementnodesize(FT ft, unsigned int *basementnodesize) {
void toku_ft_set_compression_method(FT ft, enum toku_compression_method method) {
toku_ft_lock(ft);
ft->h->compression_method = method;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
@@ -998,7 +998,7 @@ void toku_ft_get_compression_method(FT ft, enum toku_compression_method *methodp
void toku_ft_set_fanout(FT ft, unsigned int fanout) {
toku_ft_lock(ft);
ft->h->fanout = fanout;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
toku_ft_unlock(ft);
}
diff --git a/storage/tokudb/PerconaFT/ft/ft.h b/storage/tokudb/PerconaFT/ft/ft.h
index ff0b63b2b12..5c6caead978 100644
--- a/storage/tokudb/PerconaFT/ft/ft.h
+++ b/storage/tokudb/PerconaFT/ft/ft.h
@@ -184,11 +184,11 @@ void tokuft_update_product_name_strings(void);
extern char toku_product_name[TOKU_MAX_PRODUCT_NAME_LENGTH];
struct toku_product_name_strings_struct {
- char db_version[sizeof(toku_product_name) + sizeof("1.2.3 build ") + 256];
- char environmentdictionary[sizeof(toku_product_name) + sizeof(".environment")];
- char fileopsdirectory[sizeof(toku_product_name) + sizeof(".directory")];
- char single_process_lock[sizeof(toku_product_name) + sizeof("___lock_dont_delete_me")];
- char rollback_cachefile[sizeof(toku_product_name) + sizeof(".rollback")];
+ char db_version[sizeof(toku_product_name) + sizeof("1.2.3 build ") + 256 + 1];
+ char environmentdictionary[sizeof(toku_product_name) + sizeof(".environment") + 1];
+ char fileopsdirectory[sizeof(toku_product_name) + sizeof(".directory") + 1];
+ char single_process_lock[sizeof(toku_product_name) + sizeof("___lock_dont_delete_me") + 1];
+ char rollback_cachefile[sizeof(toku_product_name) + sizeof(".rollback") + 1];
};
extern struct toku_product_name_strings_struct toku_product_name_strings;
diff --git a/storage/tokudb/PerconaFT/ft/logger/logger.cc b/storage/tokudb/PerconaFT/ft/logger/logger.cc
index 9516f46df28..3965714e8cb 100644
--- a/storage/tokudb/PerconaFT/ft/logger/logger.cc
+++ b/storage/tokudb/PerconaFT/ft/logger/logger.cc
@@ -50,6 +50,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "util/status.h"
+int writing_rollback = 0;
+extern "C" {
+ uint force_recovery = 0;
+}
+
static const int log_format_version = TOKU_LOG_VERSION;
toku_instr_key *result_output_condition_lock_mutex_key;
@@ -232,6 +237,7 @@ void toku_logger_initialize_rollback_cache(TOKULOGGER logger, FT ft) {
}
int toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool create) {
+ writing_rollback++;
assert(logger->is_open);
assert(!logger->rollback_cachefile);
@@ -251,6 +257,7 @@ int toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool cre
} else {
toku_ft_handle_close(ft_handle);
}
+ writing_rollback--;
return r;
}
@@ -268,20 +275,20 @@ void toku_logger_close_rollback_check_empty(TOKULOGGER logger, bool clean_shutdo
FT CAST_FROM_VOIDP(ft, toku_cachefile_get_userdata(cf));
if (clean_shutdown) {
//Verify it is safe to close it.
- assert(!ft->h->dirty); //Must not be dirty.
+ assert(!ft->h->dirty()); //Must not be dirty.
ft->blocktable.free_unused_blocknums(ft->h->root_blocknum);
// Must have no data blocks (rollback logs or otherwise).
ft->blocktable.verify_no_data_blocks_except_root(ft->h->root_blocknum);
- assert(!ft->h->dirty);
+ assert(!ft->h->dirty());
} else {
- ft->h->dirty = 0;
+ ft->h->clear_dirty();
}
ft_to_close = toku_ft_get_only_existing_ft_handle(ft);
if (clean_shutdown) {
bool is_empty;
is_empty = toku_ft_is_empty_fast(ft_to_close);
assert(is_empty);
- assert(!ft->h->dirty); // it should not have been dirtied by the toku_ft_is_empty test.
+ assert(!ft->h->dirty()); // it should not have been dirtied by the toku_ft_is_empty test.
}
}
diff --git a/storage/tokudb/PerconaFT/ft/node.cc b/storage/tokudb/PerconaFT/ft/node.cc
index 8db2f895033..88f46c7812b 100644
--- a/storage/tokudb/PerconaFT/ft/node.cc
+++ b/storage/tokudb/PerconaFT/ft/node.cc
@@ -78,7 +78,7 @@ void toku_initialize_empty_ftnode(FTNODE n, BLOCKNUM blocknum, int height, int n
}
}
}
- n->dirty = 1; // special case exception, it's okay to mark as dirty because the basements are empty
+ n->set_dirty(); // special case exception, it's okay to mark as dirty because the basements are empty
toku_ft_status_note_ftnode(height, true);
}
@@ -154,7 +154,7 @@ void toku_ftnode_clone_partitions(FTNODE node, FTNODE cloned_node) {
void toku_evict_bn_from_memory(FTNODE node, int childnum, FT ft) {
// free the basement node
- assert(!node->dirty);
+ assert(!node->dirty());
BASEMENTNODE bn = BLB(node, childnum);
toku_ft_decrease_stats(&ft->in_memory_stats, bn->stat64_delta);
toku_ft_adjust_logical_row_count(ft, -BLB_LRD(node, childnum));
@@ -596,7 +596,7 @@ toku_apply_ancestors_messages_to_node (
oldest_referenced_xid_for_simple_gc,
node->oldest_referenced_xid_known,
true);
- if (!node->dirty && child_to_read >= 0) {
+ if (!node->dirty() && child_to_read >= 0) {
paranoid_invariant(BP_STATE(node, child_to_read) == PT_AVAIL);
apply_ancestors_messages_to_bn(
t,
@@ -713,7 +713,7 @@ bool toku_ft_leaf_needs_ancestors_messages(
paranoid_invariant(node->height == 0);
bool needs_ancestors_messages = false;
// child_to_read may be -1 in test cases
- if (!node->dirty && child_to_read >= 0) {
+ if (!node->dirty() && child_to_read >= 0) {
paranoid_invariant(BP_STATE(node, child_to_read) == PT_AVAIL);
needs_ancestors_messages = bn_needs_ancestors_messages(
ft,
@@ -746,7 +746,7 @@ cleanup:
void toku_ft_bn_update_max_msn(FTNODE node, MSN max_msn_applied, int child_to_read) {
invariant(node->height == 0);
- if (!node->dirty && child_to_read >= 0) {
+ if (!node->dirty() && child_to_read >= 0) {
paranoid_invariant(BP_STATE(node, child_to_read) == PT_AVAIL);
BASEMENTNODE bn = BLB(node, child_to_read);
if (max_msn_applied.msn > bn->max_msn_applied.msn) {
@@ -833,7 +833,7 @@ struct rebalance_array_info {
void toku_ftnode_leaf_rebalance(FTNODE node, unsigned int basementnodesize) {
assert(node->height == 0);
- assert(node->dirty);
+ assert(node->dirty());
uint32_t num_orig_basements = node->n_children;
// Count number of leaf entries in this leaf (num_le).
@@ -1142,7 +1142,7 @@ void toku_ft_nonleaf_append_child(FTNODE node, FTNODE child, const DBT *pivotkey
invariant(childnum > 0);
node->pivotkeys.insert_at(pivotkey, childnum - 1);
}
- node->dirty = 1;
+ node->set_dirty();
}
void
@@ -1745,7 +1745,7 @@ static void ft_append_msg_to_child_buffer(const toku::comparator &cmp, FTNODE no
int childnum, const ft_msg &msg, bool is_fresh) {
paranoid_invariant(BP_STATE(node,childnum) == PT_AVAIL);
bnc_insert_msg(BNC(node, childnum), msg, is_fresh, cmp);
- node->dirty = 1;
+ node->set_dirty();
}
// This is only exported for tests.
@@ -2090,7 +2090,7 @@ void toku_ft_leaf_apply_msg(
// be reapplied later), we mark the node as dirty and
// take the opportunity to update node->max_msn_applied_to_node_on_disk.
//
- node->dirty = 1;
+ node->set_dirty();
//
// we cannot blindly update node->max_msn_applied_to_node_on_disk,
diff --git a/storage/tokudb/PerconaFT/ft/node.h b/storage/tokudb/PerconaFT/ft/node.h
index 05c8a44ebed..61093f3ed8d 100644
--- a/storage/tokudb/PerconaFT/ft/node.h
+++ b/storage/tokudb/PerconaFT/ft/node.h
@@ -155,6 +155,12 @@ private:
size_t _total_size;
};
+extern int writing_rollback;
+
+extern "C" {
+extern uint force_recovery;
+}
+
// TODO: class me up
struct ftnode {
// max_msn_applied that will be written to disk
@@ -173,9 +179,22 @@ struct ftnode {
uint32_t build_id;
// height is always >= 0. 0 for leaf, >0 for nonleaf.
int height;
- int dirty;
+ int dirty_;
uint32_t fullhash;
+ void set_dirty() {
+ if(force_recovery) assert(writing_rollback);
+ dirty_ = 1;
+ }
+
+ void clear_dirty() {
+ dirty_ = 0;
+ }
+
+ bool dirty() {
+ return dirty_;
+ }
+
// for internal nodes, if n_children==fanout+1 then the tree needs to be
// rebalanced. for leaf nodes, represents number of basement nodes
int n_children;
diff --git a/storage/tokudb/PerconaFT/ft/serialize/block_table.cc b/storage/tokudb/PerconaFT/ft/serialize/block_table.cc
index 811f86c30a7..e3606c11294 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/block_table.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/block_table.cc
@@ -196,9 +196,9 @@ static void ft_set_dirty(FT ft, bool for_checkpoint) {
invariant(ft->h->type == FT_CURRENT);
if (for_checkpoint) {
invariant(ft->checkpoint_header->type == FT_CHECKPOINT_INPROGRESS);
- ft->checkpoint_header->dirty = 1;
+ ft->checkpoint_header->set_dirty();
} else {
- ft->h->dirty = 1;
+ ft->h->set_dirty();
}
}
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-node-deserialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft-node-deserialize.cc
index 02a9dfd085c..de58fb42a8b 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft-node-deserialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft-node-deserialize.cc
@@ -60,7 +60,7 @@ initialize_ftnode(FTNODE node, BLOCKNUM blocknum)
{
node->fullhash = 0xDEADBEEF; // <CER> Is this 'spoof' ok?
node->blocknum = blocknum;
- node->dirty = 0;
+ node->clear_dirty();
node->bp = NULL;
// <CER> Can we use this initialization as a correctness assert in
// a later function?
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
index 0d6573972d7..0813855bf55 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
@@ -340,7 +340,7 @@ int deserialize_ft_versioned(int fd, struct rbuf *rb, FT *ftp, uint32_t version)
{
struct ft_header h = {
.type = FT_CURRENT,
- .dirty = 0,
+ .dirty_ = 0,
.checkpoint_count = checkpoint_count,
.checkpoint_lsn = checkpoint_lsn,
.layout_version = FT_LAYOUT_VERSION,
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
index f3b31eb31be..e6648b76bf0 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
@@ -827,7 +827,7 @@ int toku_serialize_ftnode_to(int fd,
node, n_uncompressed_bytes, n_to_write, io_time, for_checkpoint);
toku_free(compressed_buf);
- node->dirty = 0; // See #1957. Must set the node to be clean after
+ node->clear_dirty(); // See #1957. Must set the node to be clean after
// serializing it so that it doesn't get written again on
// the next checkpoint or eviction.
if (node->height == 0) {
@@ -1544,7 +1544,7 @@ static FTNODE alloc_ftnode_for_deserialize(uint32_t fullhash, BLOCKNUM blocknum)
FTNODE XMALLOC(node);
node->fullhash = fullhash;
node->blocknum = blocknum;
- node->dirty = 0;
+ node->clear_dirty();
node->oldest_referenced_xid_known = TXNID_NONE;
node->bp = nullptr;
node->ct_pair = nullptr;
@@ -1951,7 +1951,7 @@ static int deserialize_and_upgrade_internal_node(FTNODE node,
// Assign the highest msn from our upgrade message buffers
node->max_msn_applied_to_node_on_disk = highest_msn;
// Since we assigned MSNs to this node's messages, we need to dirty it.
- node->dirty = 1;
+ node->set_dirty();
// Must compute the checksum now (rather than at the end, while we
// still have the pointer to the buffer).
@@ -2908,9 +2908,9 @@ int toku_serialize_rollback_log_to(int fd,
toku_free(compressed_buf);
if (!is_serialized) {
toku_static_serialized_rollback_log_destroy(&serialized_local);
- log->dirty = 0; // See #1957. Must set the node to be clean after
- // serializing it so that it doesn't get written again
- // on the next checkpoint or eviction.
+ log->dirty = false; // See #1957. Must set the node to be clean after
+ // serializing it so that it doesn't get written again
+ // on the next checkpoint or eviction.
}
return 0;
}
diff --git a/storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h b/storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h
index eb8c953b08c..31ffd7e1617 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h
+++ b/storage/tokudb/PerconaFT/ft/serialize/rbtree_mhs.h
@@ -193,6 +193,7 @@ namespace MhsRbTree {
BlockPair(OUUInt64 o, OUUInt64 s) : _offset(o), _size(s) {}
BlockPair(const BlockPair &o)
: _offset(o._offset), _size(o._size) {}
+ BlockPair& operator=(const BlockPair&) = default;
int operator<(const BlockPair &rhs) const {
return _offset < rhs._offset;
diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc
index c1c4cb4f16e..a13e6d26d15 100644
--- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-close.cc
@@ -195,13 +195,13 @@ static void test_multiple_cachefiles(bool use_same_hash) {
char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")];
strcpy(fname1, TOKU_TEST_FILENAME);
- strncat(fname1, "_1", sizeof("_1"));
+ strcat(fname1, "_1");
char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")];
strcpy(fname2, TOKU_TEST_FILENAME);
- strncat(fname2, "_2", sizeof("_2"));
+ strcat(fname2, "_2");
char fname3[strlen(TOKU_TEST_FILENAME) + sizeof("_3")];
strcpy(fname3, TOKU_TEST_FILENAME);
- strncat(fname3, "_3", sizeof("_3"));
+ strcat(fname3, "_3");
unlink(fname1);
unlink(fname2);
@@ -280,10 +280,10 @@ static void test_evictor(void) {
char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")];
strcpy(fname1, TOKU_TEST_FILENAME);
- strncat(fname1, "_1", sizeof("_1"));
+ strcat(fname1, "_1");
char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")];
strcpy(fname2, TOKU_TEST_FILENAME);
- strncat(fname2, "_2", sizeof("_2"));
+ strcat(fname2, "_2");
unlink(fname1);
unlink(fname2);
diff --git a/storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc b/storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc
index 7abd2267a7e..1d6bc2fba7a 100644
--- a/storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/ft-bfe-query.cc
@@ -337,7 +337,7 @@ static void test_prefetching(void) {
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1;
sn.n_children = 3;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
uint64_t key1 = 100;
diff --git a/storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc b/storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc
index 00ff8cf204b..1a708b8e3cc 100644
--- a/storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/ft-clock-test.cc
@@ -133,7 +133,7 @@ static void test1(int fd, FT ft_h, FTNODE *dn) {
for (int i = 0; i < (*dn)->n_children; i++) {
invariant(BP_STATE(*dn, i) == PT_AVAIL);
}
- (*dn)->dirty = 1;
+ (*dn)->set_dirty();
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
@@ -246,7 +246,7 @@ static void test_serialize_nonleaf(void) {
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1;
sn.n_children = 2;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(2, sn.bp);
DBT pivotkey;
@@ -384,7 +384,7 @@ static void test_serialize_leaf(void) {
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 2;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey;
diff --git a/storage/tokudb/PerconaFT/ft/tests/ft-serialize-benchmark.cc b/storage/tokudb/PerconaFT/ft/tests/ft-serialize-benchmark.cc
index d50488ae197..bd5df7862cd 100644
--- a/storage/tokudb/PerconaFT/ft/tests/ft-serialize-benchmark.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/ft-serialize-benchmark.cc
@@ -95,7 +95,7 @@ static void test_serialize_leaf(int valsize,
sn->layout_version_original = FT_LAYOUT_VERSION;
sn->height = 0;
sn->n_children = 8;
- sn->dirty = 1;
+ sn->set_dirty();
sn->oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn->n_children, sn->bp);
sn->pivotkeys.create_empty();
@@ -173,7 +173,7 @@ static void test_serialize_leaf(int valsize,
for (int i = 0; i < ser_runs; i++) {
gettimeofday(&t[0], NULL);
ndd = NULL;
- sn->dirty = 1;
+ sn->set_dirty();
r = toku_serialize_ftnode_to(
fd, make_blocknum(20), sn, &ndd, true, ft->ft, false);
invariant(r == 0);
@@ -265,7 +265,7 @@ static void test_serialize_nonleaf(int valsize,
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1;
sn.n_children = 8;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
sn.pivotkeys.create_empty();
diff --git a/storage/tokudb/PerconaFT/ft/tests/ft-serialize-test.cc b/storage/tokudb/PerconaFT/ft/tests/ft-serialize-test.cc
index 0cddaf19651..4fca8efad35 100644
--- a/storage/tokudb/PerconaFT/ft/tests/ft-serialize-test.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/ft-serialize-test.cc
@@ -238,7 +238,7 @@ static void test_serialize_leaf_check_msn(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 2;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey;
@@ -381,7 +381,7 @@ static void test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = nrows;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
@@ -538,7 +538,7 @@ static void test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 1;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
XMALLOC_N(sn.n_children, sn.bp);
@@ -693,7 +693,7 @@ static void test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 1;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
@@ -845,7 +845,7 @@ static void test_serialize_leaf_with_empty_basement_nodes(
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 7;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
DBT pivotkeys[6];
@@ -989,7 +989,7 @@ static void test_serialize_leaf_with_multiple_empty_basement_nodes(
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 4;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
DBT pivotkeys[3];
@@ -1100,7 +1100,7 @@ static void test_serialize_nonleaf(enum ftnode_verify_type bft, bool do_clone) {
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1;
sn.n_children = 2;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(2, sn.bp);
DBT pivotkey;
diff --git a/storage/tokudb/PerconaFT/ft/tests/ft-test-header.cc b/storage/tokudb/PerconaFT/ft/tests/ft-test-header.cc
index a23a3a60879..c668b9410c9 100644
--- a/storage/tokudb/PerconaFT/ft/tests/ft-test-header.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/ft-test-header.cc
@@ -57,7 +57,7 @@ static void test_header (void) {
assert(r==0);
// now insert some info into the header
FT ft = t->ft;
- ft->h->dirty = 1;
+ ft->h->set_dirty();
// cast away const because we actually want to fiddle with the header
// in this test
*((int *) &ft->h->layout_version_original) = 13;
diff --git a/storage/tokudb/PerconaFT/ft/tests/make-tree.cc b/storage/tokudb/PerconaFT/ft/tests/make-tree.cc
index 761d672539b..fe950b60972 100644
--- a/storage/tokudb/PerconaFT/ft/tests/make-tree.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/make-tree.cc
@@ -88,7 +88,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
leafnode->max_msn_applied_to_node_on_disk = msn;
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/mempool-115.cc b/storage/tokudb/PerconaFT/ft/tests/mempool-115.cc
index e3a3bfa28dc..bf9a1aa1484 100644
--- a/storage/tokudb/PerconaFT/ft/tests/mempool-115.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/mempool-115.cc
@@ -102,7 +102,7 @@ public:
sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0;
sn.n_children = 2;
- sn.dirty = 1;
+ sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey;
diff --git a/storage/tokudb/PerconaFT/ft/tests/msnfilter.cc b/storage/tokudb/PerconaFT/ft/tests/msnfilter.cc
index c37dcd089f8..6d13eabfd93 100644
--- a/storage/tokudb/PerconaFT/ft/tests/msnfilter.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/msnfilter.cc
@@ -161,7 +161,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val
}
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/recovery-test5123.cc b/storage/tokudb/PerconaFT/ft/tests/recovery-test5123.cc
index 8ac1cd62c50..02dc63fca7e 100644
--- a/storage/tokudb/PerconaFT/ft/tests/recovery-test5123.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/recovery-test5123.cc
@@ -49,9 +49,9 @@ static void test_5123(void) {
test_setup(TOKU_TEST_FILENAME, &logger, &ct);
int r;
- TXNID_PAIR one = {.parent_id64 = (TXNID)1, TXNID_NONE};
- TXNID_PAIR two = {.parent_id64 = (TXNID)2, TXNID_NONE};
- TXNID_PAIR three = {.parent_id64 = (TXNID)3, TXNID_NONE};
+ TXNID_PAIR one = { (TXNID)1, TXNID_NONE};
+ TXNID_PAIR two = { (TXNID)2, TXNID_NONE};
+ TXNID_PAIR three = { (TXNID)3, TXNID_NONE};
toku_log_xbegin(logger, NULL, false, one, TXNID_PAIR_NONE);
toku_log_xbegin(logger, NULL, false, three, TXNID_PAIR_NONE);
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc
index 06a26614885..5c73d281b98 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc
@@ -245,7 +245,7 @@ doit (bool after_child_pin) {
true
);
assert(node->height == 1);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
if (after_child_pin) {
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
@@ -265,7 +265,7 @@ doit (bool after_child_pin) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
if (after_child_pin) {
assert(BLB_NBYTESINDATA(node,0) > 0);
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc
index 1029dfef320..cab370274cb 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc
@@ -270,7 +270,7 @@ doit (int state) {
true
);
assert(node->height == 1);
- assert(!node->dirty);
+ assert(!node->dirty());
BLOCKNUM left_child, right_child;
// cases where we expect the checkpoint to contain the merge
if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) {
@@ -301,7 +301,7 @@ doit (int state) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node);
@@ -318,7 +318,7 @@ doit (int state) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node);
@@ -336,7 +336,7 @@ doit (int state) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node);
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc
index 208ebe3ca31..87f66512642 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc
@@ -284,7 +284,7 @@ doit (int state) {
true
);
assert(node->height == 1);
- assert(!node->dirty);
+ assert(!node->dirty());
BLOCKNUM left_child, right_child;
assert(node->n_children == 2);
@@ -304,7 +304,7 @@ doit (int state) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node);
@@ -319,7 +319,7 @@ doit (int state) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node);
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc
index 2b29de409b1..d5f7fe50f46 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc
@@ -260,7 +260,7 @@ doit (bool after_split) {
true
);
assert(node->height == 1);
- assert(!node->dirty);
+ assert(!node->dirty());
BLOCKNUM left_child, right_child;
if (after_split) {
assert(node->n_children == 2);
@@ -287,7 +287,7 @@ doit (bool after_split) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node);
@@ -302,7 +302,7 @@ doit (bool after_split) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node);
@@ -318,7 +318,7 @@ doit (bool after_split) {
true
);
assert(node->height == 0);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node);
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-dirty-flushes-on-cleaner.cc b/storage/tokudb/PerconaFT/ft/tests/test-dirty-flushes-on-cleaner.cc
index 460134ec353..e1937538471 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-dirty-flushes-on-cleaner.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-dirty-flushes-on-cleaner.cc
@@ -199,7 +199,7 @@ doit (void) {
&node,
true
);
- assert(node->dirty);
+ assert(node->dirty());
assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL);
@@ -229,7 +229,7 @@ doit (void) {
&node,
true
);
- assert(node->dirty);
+ assert(node->dirty());
assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL);
@@ -250,7 +250,7 @@ doit (void) {
&node,
true
);
- assert(node->dirty);
+ assert(node->dirty());
// we expect that this flushes its buffer, that
// a merge is not done, and that the lookup
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-flushes-on-cleaner.cc b/storage/tokudb/PerconaFT/ft/tests/test-flushes-on-cleaner.cc
index 89d7130e5f7..f9d4d1646b8 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-flushes-on-cleaner.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-flushes-on-cleaner.cc
@@ -203,7 +203,7 @@ doit (bool keep_other_bn_in_memory) {
&node,
true
);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 2);
// a hack to get the basement nodes evicted
for (int i = 0; i < 20; i++) {
@@ -249,7 +249,7 @@ doit (bool keep_other_bn_in_memory) {
&node,
true
);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL);
if (keep_other_bn_in_memory) {
@@ -273,7 +273,7 @@ doit (bool keep_other_bn_in_memory) {
&node,
true
);
- assert(!node->dirty);
+ assert(!node->dirty());
// we expect that this flushes its buffer, that
// a merge is not done, and that the lookup
diff --git a/storage/tokudb/PerconaFT/ft/tests/test-pick-child-to-flush.cc b/storage/tokudb/PerconaFT/ft/tests/test-pick-child-to-flush.cc
index 83dfd0244f4..29d07483f99 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test-pick-child-to-flush.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test-pick-child-to-flush.cc
@@ -194,7 +194,7 @@ doit (void) {
toku_pin_node_with_min_bfe(&node, node_internal, t);
toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2);
- assert(!node->dirty);
+ assert(!node->dirty());
assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) > 0);
assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) > 0);
@@ -216,7 +216,7 @@ doit (void) {
toku_pin_node_with_min_bfe(&node, node_internal, t);
toku_ftnode_assert_fully_in_memory(node);
- assert(node->dirty);
+ assert(node->dirty());
assert(node->n_children == 2);
// child 0 should have empty buffer because it flushed
// child 1 should still have message in buffer
@@ -226,14 +226,14 @@ doit (void) {
r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
assert_zero(r);
toku_pin_node_with_min_bfe(&node, node_internal, t);
- assert(!node->dirty);
+ assert(!node->dirty());
curr_child_to_flush = 1;
num_flushes_called = 0;
toku_ft_flush_some_child(t->ft, node, &fa);
assert(num_flushes_called == 1);
toku_pin_node_with_min_bfe(&node, node_internal, t);
- assert(node->dirty);
+ assert(node->dirty());
toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2);
// both buffers should be empty now
@@ -244,14 +244,14 @@ doit (void) {
r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
assert_zero(r);
toku_pin_node_with_min_bfe(&node, node_internal, t);
- assert(!node->dirty);
+ assert(!node->dirty());
curr_child_to_flush = 0;
num_flushes_called = 0;
toku_ft_flush_some_child(t->ft, node, &fa);
assert(num_flushes_called == 1);
toku_pin_node_with_min_bfe(&node, node_internal, t);
- assert(node->dirty); // nothing was flushed, but since we were trying to flush to a leaf, both become dirty
+ assert(node->dirty()); // nothing was flushed, but since we were trying to flush to a leaf, both become dirty
toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2);
// both buffers should be empty now
@@ -280,17 +280,17 @@ doit (void) {
assert(num_flushes_called == 2);
toku_pin_node_with_min_bfe(&node, node_internal, t);
- assert(node->dirty);
+ assert(node->dirty());
toku_unpin_ftnode(t->ft, node);
toku_pin_node_with_min_bfe(&node, node_leaf[0], t);
- assert(node->dirty);
+ assert(node->dirty());
toku_unpin_ftnode(t->ft, node);
toku_pin_node_with_min_bfe(&node, node_leaf[1], t);
if (i == 0) {
- assert(!node->dirty);
+ assert(!node->dirty());
}
else {
- assert(node->dirty);
+ assert(node->dirty());
}
toku_unpin_ftnode(t->ft, node);
}
diff --git a/storage/tokudb/PerconaFT/ft/tests/test3884.cc b/storage/tokudb/PerconaFT/ft/tests/test3884.cc
index cfb76424668..5de55b0daff 100644
--- a/storage/tokudb/PerconaFT/ft/tests/test3884.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/test3884.cc
@@ -105,7 +105,7 @@ setup_ftnode_header(struct ftnode *node)
node->layout_version = FT_LAYOUT_VERSION;
node->layout_version_original = FT_LAYOUT_VERSION;
node->height = 0;
- node->dirty = 1;
+ node->set_dirty();
node->oldest_referenced_xid_known = TXNID_NONE;
}
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-bad-msn.cc b/storage/tokudb/PerconaFT/ft/tests/verify-bad-msn.cc
index b10885c2e62..1ba5f1c2503 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-bad-msn.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-bad-msn.cc
@@ -93,7 +93,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
// leafnode->max_msn_applied_to_node = msn;
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-bad-pivots.cc b/storage/tokudb/PerconaFT/ft/tests/verify-bad-pivots.cc
index c1d08ce41a6..42415a07765 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-bad-pivots.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-bad-pivots.cc
@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-dup-in-leaf.cc b/storage/tokudb/PerconaFT/ft/tests/verify-dup-in-leaf.cc
index 22a29c0ff69..e31b13c4f4d 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-dup-in-leaf.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-dup-in-leaf.cc
@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-dup-pivots.cc b/storage/tokudb/PerconaFT/ft/tests/verify-dup-pivots.cc
index 80189dd9804..009eda63999 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-dup-pivots.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-dup-pivots.cc
@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-misrouted-msgs.cc b/storage/tokudb/PerconaFT/ft/tests/verify-misrouted-msgs.cc
index a84aac1f063..5c639d8d28a 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-misrouted-msgs.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-misrouted-msgs.cc
@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-leaf.cc b/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-leaf.cc
index ca413f52567..d55ec7a736f 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-leaf.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-leaf.cc
@@ -80,7 +80,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-pivots.cc b/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-pivots.cc
index 6efa06913c2..ff231001c77 100644
--- a/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-pivots.cc
+++ b/storage/tokudb/PerconaFT/ft/tests/verify-unsorted-pivots.cc
@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL);
// don't forget to dirty the node
- leafnode->dirty = 1;
+ leafnode->set_dirty();
}
static void
diff --git a/storage/tokudb/PerconaFT/ft/txn/rollback.cc b/storage/tokudb/PerconaFT/ft/txn/rollback.cc
index 0c793842f3c..105f980dc0d 100644
--- a/storage/tokudb/PerconaFT/ft/txn/rollback.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/rollback.cc
@@ -43,6 +43,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/logger/log-internal.h"
#include "ft/txn/rollback-ct-callbacks.h"
+extern int writing_rollback;
+
static void rollback_unpin_remove_callback(CACHEKEY* cachekey, bool for_checkpoint, void* extra) {
FT CAST_FROM_VOIDP(ft, extra);
ft->blocktable.free_blocknum(cachekey, ft, for_checkpoint);
@@ -155,6 +157,7 @@ static void rollback_log_create (
ROLLBACK_LOG_NODE *result
)
{
+ writing_rollback++;
ROLLBACK_LOG_NODE XMALLOC(log);
rollback_empty_log_init(log);
@@ -169,6 +172,7 @@ static void rollback_log_create (
get_write_callbacks_for_rollback_log(ft),
toku_rollback_node_save_ct_pair);
txn->roll_info.current_rollback = log->blocknum;
+ writing_rollback --;
}
void toku_rollback_log_unpin(TOKUTXN txn, ROLLBACK_LOG_NODE log) {
diff --git a/storage/tokudb/PerconaFT/ft/txn/txn.cc b/storage/tokudb/PerconaFT/ft/txn/txn.cc
index 7327cbd9d24..7152833d88d 100644
--- a/storage/tokudb/PerconaFT/ft/txn/txn.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/txn.cc
@@ -723,7 +723,11 @@ time_t toku_txn_get_start_time(struct tokutxn *txn) {
return txn->start_time;
}
+extern uint force_recovery;
int toku_txn_reads_txnid(TXNID txnid, TOKUTXN txn, bool is_provisional UU()) {
+ if(force_recovery) {
+ return TOKUDB_ACCEPT;
+ }
int r = 0;
TXNID oldest_live_in_snapshot = toku_get_oldest_in_live_root_txn_list(txn);
if (oldest_live_in_snapshot == TXNID_NONE && txnid < txn->snapshot_txnid64) {
diff --git a/storage/tokudb/PerconaFT/ftcxx/cursor.hpp b/storage/tokudb/PerconaFT/ftcxx/cursor.hpp
index 9ecc4d173c6..bde5dbf2c19 100644
--- a/storage/tokudb/PerconaFT/ftcxx/cursor.hpp
+++ b/storage/tokudb/PerconaFT/ftcxx/cursor.hpp
@@ -398,8 +398,8 @@ namespace ftcxx {
{}
bool operator()(const DBT *key, const DBT *val) {
- _key = std::move(Slice(*key).owned());
- _val = std::move(Slice(*val).owned());
+ _key = Slice(*key).owned();
+ _val = Slice(*val).owned();
// Don't bulk fetch.
return false;
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.cc b/storage/tokudb/PerconaFT/locktree/lock_request.cc
index 0a95dc417d6..cc6fcafcd5d 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.cc
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.cc
@@ -93,6 +93,10 @@ void lock_request::destroy(void) {
toku_cond_destroy(&m_wait_cond);
}
+void lock_request::clearmem(char c) {
+ memset(this, c, sizeof(* this));
+}
+
// set the lock request parameters. this API allows a lock request to be reused.
void lock_request::set(locktree *lt, TXNID txnid, const DBT *left_key, const DBT *right_key, lock_request::type lock_type, bool big_txn, void *extra) {
invariant(m_state != state::PENDING);
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.h b/storage/tokudb/PerconaFT/locktree/lock_request.h
index 8b22241e276..e16e77ed6f4 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.h
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.h
@@ -89,6 +89,7 @@ public:
// effect: Destroys a lock request.
void destroy(void);
+ void clearmem(char c);
// effect: Resets the lock request parameters, allowing it to be reused.
// requires: Lock request was already created at some point
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
index 5c28701c49e..83436a651e1 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
@@ -83,7 +83,7 @@ namespace toku {
}
request.destroy();
- memset(&request, 0xab, sizeof request);
+ request.clearmem(0xab);
toku_pthread_yield();
if ((i % 10) == 0)
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
index 8458bae6b8c..6748ae30ee1 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
@@ -96,7 +96,7 @@ namespace toku {
}
request.destroy();
- memset(&request, 0xab, sizeof request);
+ request.clearmem(0xab);
toku_pthread_yield();
if ((i % 10) == 0)
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
index 4b6dadd440f..cd3dc7b37ef 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
@@ -98,7 +98,7 @@ namespace toku {
}
request.destroy();
- memset(&request, 0xab, sizeof request);
+ request.clearmem(0xab);
toku_pthread_yield();
if ((i % 10) == 0)
diff --git a/storage/tokudb/PerconaFT/portability/portability.cc b/storage/tokudb/PerconaFT/portability/portability.cc
index 81115a516aa..556a34fb861 100644
--- a/storage/tokudb/PerconaFT/portability/portability.cc
+++ b/storage/tokudb/PerconaFT/portability/portability.cc
@@ -60,7 +60,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#if defined(HAVE_SYS_SYSCALL_H)
# include <sys/syscall.h>
#endif
-#if defined(HAVE_SYS_SYSCTL_H)
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(_SC_PHYS_PAGES)
# include <sys/sysctl.h>
#endif
#if defined(HAVE_PTHREAD_H)
diff --git a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
index 786a6ef0546..0f287429542 100644
--- a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
+++ b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
@@ -359,7 +359,16 @@ void toku_instr_rwlock_wrlock_wait_end(
void toku_instr_rwlock_unlock(toku_pthread_rwlock_t &rwlock) {
if (rwlock.psi_rwlock)
+
+// Due to change introduced in e4148f2a22922687f7652c4e3d21a22da07c9e78
+// PSI rwlock version and interface changed
+// PSI_CURRENT_RWLOCK_VERSION is not defined in MySQL 5.6 and is defined
+// as 1 in 5.7 and < 8.0.17
+#if defined(PSI_CURRENT_RWLOCK_VERSION) && (PSI_CURRENT_RWLOCK_VERSION == 2)
+ PSI_RWLOCK_CALL(unlock_rwlock)(rwlock.psi_rwlock, PSI_RWLOCK_UNLOCK);
+#else
PSI_RWLOCK_CALL(unlock_rwlock)(rwlock.psi_rwlock);
+#endif
}
#endif // TOKU_MYSQL_WITH_PFS
diff --git a/storage/tokudb/PerconaFT/scripts/tokuvalgrind b/storage/tokudb/PerconaFT/scripts/tokuvalgrind
deleted file mode 120000
index 74517aa2975..00000000000
--- a/storage/tokudb/PerconaFT/scripts/tokuvalgrind
+++ /dev/null
@@ -1 +0,0 @@
-tokugrind \ No newline at end of file
diff --git a/storage/tokudb/PerconaFT/src/tests/test.h b/storage/tokudb/PerconaFT/src/tests/test.h
index ff464f55890..c5214961afd 100644
--- a/storage/tokudb/PerconaFT/src/tests/test.h
+++ b/storage/tokudb/PerconaFT/src/tests/test.h
@@ -428,14 +428,14 @@ static int env_del_multiple_test_no_array(
/* Some macros for evaluating blocks or functions within the scope of a
* transaction. */
#define IN_TXN_COMMIT(env, parent, txn, flags, expr) ({ \
- DB_TXN *(txn); \
+ DB_TXN *txn; \
{ int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \
(expr); \
{ int chk_r = (txn)->commit((txn), 0); CKERR(chk_r); } \
})
#define IN_TXN_ABORT(env, parent, txn, flags, expr) ({ \
- DB_TXN *(txn); \
+ DB_TXN *txn; \
{ int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \
(expr); \
{ int chk_r = (txn)->abort(txn); CKERR(chk_r); } \
diff --git a/storage/tokudb/PerconaFT/src/tests/test_mostly_seq.cc b/storage/tokudb/PerconaFT/src/tests/test_mostly_seq.cc
index ecd88f3c5fe..55b2943e67f 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_mostly_seq.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_mostly_seq.cc
@@ -68,7 +68,7 @@ seqinsert (int n, float p) {
int v = i;
DBT key, val;
r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0);
- if (random() <= RAND_MAX * p) {
+ if (random() <= static_cast<float>(RAND_MAX) * p) {
k = htonl(i-1);
v = i-1;
r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0);
diff --git a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
index e232f327d10..1d8833adcba 100644
--- a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
+++ b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h
@@ -432,17 +432,17 @@ tsv_print_perf_totals(const struct cli_args *cli_args, uint64_t *counters[], con
}
const struct perf_formatter perf_formatters[] = {
- [HUMAN] = {
+ { /* HUMAN */
.header = human_print_perf_header,
.iteration = human_print_perf_iteration,
.totals = human_print_perf_totals
},
- [CSV] = {
+ { /* CSV */
.header = csv_print_perf_header,
.iteration = csv_print_perf_iteration,
.totals = csv_print_perf_totals
},
- [TSV] = {
+ { /* TSV */
.header = tsv_print_perf_header,
.iteration = tsv_print_perf_iteration,
.totals = tsv_print_perf_totals
diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc
index 58d39c50c23..1378c05b4c4 100644
--- a/storage/tokudb/PerconaFT/src/ydb.cc
+++ b/storage/tokudb/PerconaFT/src/ydb.cc
@@ -40,6 +40,9 @@ extern const char *toku_patent_string;
const char *toku_copyright_string = "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.";
#include <my_global.h>
+
+extern int writing_rollback;
+
#include <db.h>
#include <errno.h>
#include <string.h>
@@ -88,6 +91,8 @@ const char *toku_copyright_string = "Copyright (c) 2006, 2015, Percona and/or it
int toku_close_trace_file (void) { return 0; }
#endif
+extern uint force_recovery;
+
// Set when env is panicked, never cleared.
static int env_is_panicked = 0;
@@ -224,6 +229,9 @@ env_fs_redzone(DB_ENV *env, uint64_t total) {
// Check the available space in the file systems used by tokuft and erect barriers when available space gets low.
static int
env_fs_poller(void *arg) {
+ if(force_recovery == 6) {
+ return 0;
+ }
DB_ENV *env = (DB_ENV *) arg;
int r;
@@ -308,6 +316,9 @@ env_fs_init(DB_ENV *env) {
// Initialize the minicron that polls file system space
static int
env_fs_init_minicron(DB_ENV *env) {
+ if(force_recovery == 6) {
+ return 0;
+ }
int r = toku_minicron_setup(&env->i->fs_poller, env->i->fs_poll_time*1000, env_fs_poller, env);
if (r == 0)
env->i->fs_poller_is_init = true;
@@ -710,7 +721,7 @@ static int validate_env(DB_ENV *env,
}
// Test for fileops directory
- if (r == 0) {
+ if (r == 0 && force_recovery != 6) {
path = toku_construct_full_name(
2, env->i->dir, toku_product_name_strings.fileopsdirectory);
assert(path);
@@ -753,7 +764,7 @@ static int validate_env(DB_ENV *env,
}
// Test for recovery log
- if ((r == 0) && (env->i->open_flags & DB_INIT_LOG)) {
+ if ((r == 0) && (env->i->open_flags & DB_INIT_LOG) && force_recovery != 6) {
// if using transactions, test for existence of log
r = ydb_recover_log_exists(env); // return 0 or ENOENT
if (expect_newenv && (r != ENOENT))
@@ -814,6 +825,27 @@ unlock_single_process(DB_ENV *env) {
// (The set of necessary files is defined in the function validate_env() above.)
static int
env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
+
+ if(force_recovery == 6) {
+ {
+ const int len = strlen(toku_product_name_strings.rollback_cachefile);
+ toku_product_name_strings.rollback_cachefile[len] = '2';
+ toku_product_name_strings.rollback_cachefile[len+1] = 0;
+ }
+
+ {
+ const int len = strlen(toku_product_name_strings.single_process_lock);
+ toku_product_name_strings.single_process_lock[len] = '2';
+ toku_product_name_strings.single_process_lock[len+1] = 0;
+ }
+
+ {
+ const int len = strlen(toku_product_name_strings.environmentdictionary);
+ toku_product_name_strings.environmentdictionary[len] = '2';
+ toku_product_name_strings.environmentdictionary[len+1] = 0;
+ }
+ }
+
HANDLE_PANICKED_ENV(env);
int r;
bool newenv; // true iff creating a new environment
@@ -904,7 +936,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
bool need_rollback_cachefile;
need_rollback_cachefile = false;
- if (flags & (DB_INIT_TXN | DB_INIT_LOG)) {
+ if (flags & (DB_INIT_TXN | DB_INIT_LOG) && force_recovery != 6) {
need_rollback_cachefile = true;
}
@@ -917,7 +949,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
r = ydb_maybe_upgrade_env(env, &last_lsn_of_clean_shutdown_read_from_log, &upgrade_in_progress);
if (r!=0) goto cleanup;
- if (upgrade_in_progress) {
+ if (upgrade_in_progress || force_recovery == 6) {
// Delete old rollback file. There was a clean shutdown, so it has nothing useful,
// and there is no value in upgrading it. It is simpler to just create a new one.
char* rollback_filename = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.rollback_cachefile);
@@ -935,9 +967,13 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
unused_flags &= ~DB_INIT_TXN & ~DB_INIT_LOG;
+ if(force_recovery == 6) {
+ flags |= DB_INIT_LOG | DB_INIT_TXN;
+ }
+
// do recovery only if there exists a log and recovery is requested
// otherwise, a log is created when the logger is opened later
- if (!newenv) {
+ if (!newenv && force_recovery == 0) {
if (flags & DB_INIT_LOG) {
// the log does exist
if (flags & DB_RECOVER) {
@@ -1006,7 +1042,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
assert (using_txns);
toku_logger_set_cachetable(env->i->logger, env->i->cachetable);
if (!toku_logger_rollback_is_open(env->i->logger)) {
- bool create_new_rollback_file = newenv | upgrade_in_progress;
+ bool create_new_rollback_file = newenv | upgrade_in_progress | (force_recovery == 6);
r = toku_logger_open_rollback(env->i->logger, env->i->cachetable, create_new_rollback_file);
if (r != 0) {
r = toku_ydb_do_error(env, r, "Cant open rollback\n");
@@ -1025,6 +1061,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
assert_zero(r);
r = toku_db_use_builtin_key_cmp(env->i->persistent_environment);
assert_zero(r);
+ writing_rollback++;
r = toku_db_open_iname(env->i->persistent_environment, txn, toku_product_name_strings.environmentdictionary, DB_CREATE, mode);
if (r != 0) {
r = toku_ydb_do_error(env, r, "Cant open persistent env\n");
@@ -1057,6 +1094,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
assert_zero(r);
}
capture_persistent_env_contents(env, txn);
+ writing_rollback--;
}
{
r = toku_db_create(&env->i->directory, env, 0);
@@ -1075,8 +1113,10 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
txn = NULL;
}
cp = toku_cachetable_get_checkpointer(env->i->cachetable);
- r = toku_checkpoint(cp, env->i->logger, NULL, NULL, NULL, NULL, STARTUP_CHECKPOINT);
- assert_zero(r);
+ if (!force_recovery) {
+ r = toku_checkpoint(cp, env->i->logger, NULL, NULL, NULL, NULL, STARTUP_CHECKPOINT);
+ }
+ writing_rollback--;
env_fs_poller(env); // get the file system state at startup
r = env_fs_init_minicron(env);
if (r != 0) {
diff --git a/storage/tokudb/PerconaFT/src/ydb_db.cc b/storage/tokudb/PerconaFT/src/ydb_db.cc
index 6b4452325f4..5707415b72d 100644
--- a/storage/tokudb/PerconaFT/src/ydb_db.cc
+++ b/storage/tokudb/PerconaFT/src/ydb_db.cc
@@ -324,6 +324,7 @@ toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTYP
// DB_THREAD is implicitly supported and DB_BLACKHOLE is supported at the ft-layer
unused_flags &= ~DB_THREAD;
unused_flags &= ~DB_BLACKHOLE;
+ unused_flags &= ~DB_RDONLY;
// check for unknown or conflicting flags
if (unused_flags) return EINVAL; // unknown flags
@@ -405,7 +406,7 @@ int toku_db_lt_on_create_callback(toku::locktree *lt, void *extra) {
FT_HANDLE ft_handle = info->ft_handle;
FT_HANDLE cloned_ft_handle;
- r = toku_ft_handle_clone(&cloned_ft_handle, ft_handle, ttxn);
+ r = toku_ft_handle_clone(&cloned_ft_handle, ft_handle, ttxn, info->open_rw);
if (r == 0) {
assert(lt->get_userdata() == NULL);
lt->set_userdata(cloned_ft_handle);
@@ -466,6 +467,7 @@ int toku_db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, uint32_t
flags&=~DB_READ_COMMITTED;
flags&=~DB_SERIALIZABLE;
flags&=~DB_IS_HOT_INDEX;
+ flags&=~DB_RDONLY;
// unknown or conflicting flags are bad
int unknown_flags = flags & ~DB_THREAD;
unknown_flags &= ~DB_BLACKHOLE;
@@ -480,11 +482,12 @@ int toku_db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, uint32_t
db->i->open_flags = flags;
db->i->open_mode = mode;
+ bool open_rw = mode & (S_IWUSR | S_IWOTH | S_IWGRP);
FT_HANDLE ft_handle = db->i->ft_handle;
int r = toku_ft_handle_open(ft_handle, iname_in_env,
is_db_create, is_db_excl,
db->dbenv->i->cachetable,
- txn ? db_txn_struct_i(txn)->tokutxn : nullptr);
+ txn ? db_txn_struct_i(txn)->tokutxn : nullptr, open_rw);
if (r != 0) {
goto out;
}
@@ -506,6 +509,7 @@ int toku_db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, uint32_t
struct lt_on_create_callback_extra on_create_extra = {
.txn = txn,
.ft_handle = db->i->ft_handle,
+ .open_rw = false
};
db->i->lt = db->dbenv->i->ltm.get_lt(db->i->dict_id,
toku_ft_get_comparator(db->i->ft_handle),
diff --git a/storage/tokudb/PerconaFT/src/ydb_db.h b/storage/tokudb/PerconaFT/src/ydb_db.h
index ab8fcd2a401..c260e9d0fbe 100644
--- a/storage/tokudb/PerconaFT/src/ydb_db.h
+++ b/storage/tokudb/PerconaFT/src/ydb_db.h
@@ -67,6 +67,7 @@ void ydb_db_layer_get_status(YDB_DB_LAYER_STATUS statp);
struct lt_on_create_callback_extra {
DB_TXN *txn;
FT_HANDLE ft_handle;
+ bool open_rw;
};
int toku_db_lt_on_create_callback(toku::locktree *lt, void *extra);
void toku_db_lt_on_destroy_callback(toku::locktree *lt);
diff --git a/storage/tokudb/PerconaFT/tools/tokuftdump.cc b/storage/tokudb/PerconaFT/tools/tokuftdump.cc
index 2838ae5182e..44edb15162a 100644
--- a/storage/tokudb/PerconaFT/tools/tokuftdump.cc
+++ b/storage/tokudb/PerconaFT/tools/tokuftdump.cc
@@ -181,7 +181,7 @@ static void dump_header(FT ft) {
printf(" time_of_creation= %" PRIu64 " %s\n", ft->h->time_of_creation, timestr);
format_time(ft->h->time_of_last_modification, timestr);
printf(" time_of_last_modification=%" PRIu64 " %s\n", ft->h->time_of_last_modification, timestr);
- printf(" dirty=%d\n", ft->h->dirty);
+ printf(" dirty=%d\n", ft->h->dirty());
printf(" checkpoint_count=%" PRId64 "\n", ft->h->checkpoint_count);
printf(" checkpoint_lsn=%" PRId64 "\n", ft->h->checkpoint_lsn.lsn);
printf(" nodesize=%u\n", ft->h->nodesize);
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index ff81fbfe4a7..39bc286a617 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -1333,7 +1333,7 @@ int ha_tokudb::open_main_dictionary(
NULL,
DB_BTREE,
open_flags,
- 0);
+ S_IWUSR);
if (error) {
goto exit;
}
@@ -1396,7 +1396,7 @@ int ha_tokudb::open_secondary_dictionary(
}
- error = (*ptr)->open(*ptr, txn, newname, NULL, DB_BTREE, open_flags, 0);
+ error = (*ptr)->open(*ptr, txn, newname, NULL, DB_BTREE, open_flags, S_IWUSR);
if (error) {
my_errno = error;
goto cleanup;
diff --git a/storage/tokudb/man/CMakeLists.txt b/storage/tokudb/man/CMakeLists.txt
new file mode 100644
index 00000000000..192d8117119
--- /dev/null
+++ b/storage/tokudb/man/CMakeLists.txt
@@ -0,0 +1,2 @@
+SET(MAN1_TOKUDB tokuftdump.1 tokuft_logprint.1)
+INSTALL(FILES ${MAN1_TOKUDB} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT tokudb-engine)
diff --git a/man/tokuft_logprint.1 b/storage/tokudb/man/tokuft_logprint.1
index d6f69e0aeeb..d6f69e0aeeb 100644
--- a/man/tokuft_logprint.1
+++ b/storage/tokudb/man/tokuft_logprint.1
diff --git a/man/tokuftdump.1 b/storage/tokudb/man/tokuftdump.1
index 79129a1a2e1..79129a1a2e1 100644
--- a/man/tokuftdump.1
+++ b/storage/tokudb/man/tokuftdump.1
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb-slave.opt
index b351df53683..127c28fabfd 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb-slave.opt
@@ -1,5 +1 @@
--log-warnings=0 --slave-transaction-retries=0
-
-
-
-
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result
index b18f970d2ce..14b6052a7d3 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_auto_increment_tokudb.result
@@ -1115,5 +1115,13 @@ SELECT * FROM t1;
a
0
DROP TABLE t1;
+#
+# MDEV-19622 Assertion failures in
+# ha_partition::set_auto_increment_if_higher upon UPDATE on Aria table
+#
+CREATE OR REPLACE TABLE t1 (pk INT AUTO_INCREMENT, a INT, KEY(pk)) ENGINE=myisam PARTITION BY HASH(a);
+INSERT INTO t1 VALUES (1,1),(2,2);
+UPDATE t1 SET pk = 0;
+DROP TABLE t1;
##############################################################################
SET GLOBAL tokudb_prelock_empty = @tokudb_prelock_empty_saved;
diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_syntax_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_syntax_tokudb.result
index c84b4601332..e7bb6c7d70f 100644
--- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_syntax_tokudb.result
+++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_syntax_tokudb.result
@@ -770,7 +770,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -779,7 +779,7 @@ f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LES...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -797,7 +797,7 @@ PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES
(SUBPARTITION subpart11 , SUBPARTITION subpart12 ), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near ' PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31 , SUBPART' at line 7
+(SUBPARTITION subpart31 , SUBP...' at line 7
CREATE TABLE t1 ( f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
f_char1 CHAR(20),
@@ -987,7 +987,7 @@ SUBPARTITIONS -1
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1032,7 +1032,7 @@ SUBPARTITIONS 2.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1055,7 +1055,7 @@ SUBPARTITIONS -2.0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1078,7 +1078,7 @@ SUBPARTITIONS 0.0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1101,7 +1101,7 @@ SUBPARTITIONS 1.6
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1.6
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1123,7 +1123,7 @@ SUBPARTITIONS 999999999999999999999999999999.999999999999999999999999999999
(PARTITION part1 VALUES LESS THAN (10),
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '999999999999999999999999999999.999999999999999999999999999999
-(PARTITION part1 V' at line 9
+(PARTITION part...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1146,7 +1146,7 @@ SUBPARTITIONS 0.000000000000000000000000000001
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.000000000000000000000000000001
(PARTITION part1 VALUES LESS THAN (10),
-PARTITI' at line 9
+PART...' at line 9
# 4.2.3 partition/subpartition numbers FLOAT notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1170,7 +1170,7 @@ SUBPARTITIONS 2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1193,7 +1193,7 @@ SUBPARTITIONS 0.2E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.2E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1216,7 +1216,7 @@ SUBPARTITIONS -2.0E+0
PARTITION part2 VALUES LESS THAN (2147483646));
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 '-2.0E+0
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1239,7 +1239,7 @@ SUBPARTITIONS 0.16E+1
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.16E+1
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1262,7 +1262,7 @@ SUBPARTITIONS 0.0E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '0.0E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1285,7 +1285,7 @@ SUBPARTITIONS 1E+300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E+300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1308,7 +1308,7 @@ SUBPARTITIONS 1E-300
PARTITION part2 VALUES LESS THAN (2147483646));
ERROR 42000: Only integers allowed as number here near '1E-300
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN ' at line 9
+PARTITION part2 VALUES LESS TH...' at line 9
# 4.2.4 partition/subpartition numbers STRING notation
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1332,7 +1332,7 @@ SUBPARTITIONS '2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1355,7 +1355,7 @@ SUBPARTITIONS '2.0'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2.0'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (' at line 9
+PARTITION part2 VALUES LESS THA...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1378,7 +1378,7 @@ SUBPARTITIONS '0.2E+1'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''0.2E+1'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1401,7 +1401,7 @@ SUBPARTITIONS '2A'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''2A'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1424,7 +1424,7 @@ SUBPARTITIONS 'A2'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''A2'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1447,7 +1447,7 @@ SUBPARTITIONS ''
PARTITION part2 VALUES LESS THAN (2147483646));
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 '''
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1470,7 +1470,7 @@ SUBPARTITIONS 'GARBAGE'
PARTITION part2 VALUES LESS THAN (2147483646));
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 ''GARBAGE'
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.5 partition/subpartition numbers other notations
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
@@ -1494,7 +1494,7 @@ SUBPARTITIONS 2A
PARTITION part2 VALUES LESS THAN (2147483646));
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 '2A
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1517,7 +1517,7 @@ SUBPARTITIONS A2
PARTITION part2 VALUES LESS THAN (2147483646));
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 'A2
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (214' at line 9
+PARTITION part2 VALUES LESS THAN (...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1540,7 +1540,7 @@ SUBPARTITIONS GARBAGE
PARTITION part2 VALUES LESS THAN (2147483646));
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 'GARBAGE
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN' at line 9
+PARTITION part2 VALUES LESS T...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1563,7 +1563,7 @@ SUBPARTITIONS "2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (21' at line 9
+PARTITION part2 VALUES LESS THAN ...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1586,7 +1586,7 @@ SUBPARTITIONS "2A"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"2A"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1609,7 +1609,7 @@ SUBPARTITIONS "A2"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"A2"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THAN (2' at line 9
+PARTITION part2 VALUES LESS THAN...' at line 9
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1632,7 +1632,7 @@ SUBPARTITIONS "GARBAGE"
PARTITION part2 VALUES LESS THAN (2147483646));
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 '"GARBAGE"
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS TH' at line 9
+PARTITION part2 VALUES LESS...' at line 9
# 4.2.6 (negative) partition/subpartition numbers per @variables
SET @aux = 5;
CREATE TABLE t1 (
@@ -1657,7 +1657,7 @@ SUBPARTITIONS @aux = 5
PARTITION part2 VALUES LESS THAN (2147483646));
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 '@aux = 5
(PARTITION part1 VALUES LESS THAN (10),
-PARTITION part2 VALUES LESS THA' at line 9
+PARTITION part2 VALUES LESS ...' at line 9
#------------------------------------------------------------------------
# 4.3 Mixups of assigned partition/subpartition numbers and names
#------------------------------------------------------------------------
@@ -1750,7 +1750,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1769,7 +1769,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part3 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart31, SUBPAR' at line 13
+(SUBPARTITION subpart31, SUB...' at line 13
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1812,7 +1812,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1831,7 +1831,7 @@ PARTITION part3 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2000)
-(SUBPARTITION subpart21 ' at line 11
+(SUBPARTITION subpart21 ...' at line 11
CREATE TABLE t1 (
f_int1 INTEGER DEFAULT 0,
f_int2 INTEGER DEFAULT 0,
@@ -1848,7 +1848,7 @@ PARTITION part2 VALUES LESS THAN (2147483646)
);
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '),
PARTITION part2 VALUES LESS THAN (2147483646)
-(SUBPARTITION subpart21, SUBPAR' at line 11
+(SUBPARTITION subpart21, SUB...' at line 11
#========================================================================
# 5. Checks of logical partition/subpartition name
diff --git a/storage/tokudb/tokudb_status.h b/storage/tokudb/tokudb_status.h
index 5cca54e52c9..07772bdc92a 100644
--- a/storage/tokudb/tokudb_status.h
+++ b/storage/tokudb/tokudb_status.h
@@ -201,7 +201,7 @@ int create(
name,
NULL,
DB_BTREE, DB_CREATE | DB_EXCL,
- 0);
+ S_IWUSR);
}
if (error == 0) {
*status_db_ptr = status_db;
@@ -230,7 +230,7 @@ int open(
NULL,
DB_BTREE,
DB_THREAD,
- 0);
+ S_IWUSR);
}
if (error == 0) {
uint32_t pagesize = 0;
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index 07ee23fae5c..bed5946541c 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -99,11 +99,6 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-class-memaccess")
IF(NOT MSVC)
- CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
- IF(HAVE_POSIX_MEMALIGN)
- ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
- ENDIF()
-
# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
# workaround for old gcc on x86, gcc atomic ops only work under -march=i686
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc
index 5235fe434a9..7d97881f552 100644
--- a/storage/xtradb/btr/btr0cur.cc
+++ b/storage/xtradb/btr/btr0cur.cc
@@ -3,7 +3,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2015, 2017, MariaDB Corporation.
+Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1542,17 +1542,23 @@ fail_err:
}
ulint max_size = page_get_max_insert_size_after_reorganize(page, 1);
+ if (max_size < rec_size) {
+ goto fail;
+ }
+
+ const ulint n_recs = page_get_n_recs(page);
+ if (UNIV_UNLIKELY(n_recs >= 8189)) {
+ ut_ad(srv_page_size == 65536);
+ goto fail;
+ }
if (page_has_garbage(page)) {
- if ((max_size < rec_size
- || max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT)
- && page_get_n_recs(page) > 1
+ if (max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
+ && n_recs > 1
&& page_get_max_insert_size(page, 1) < rec_size) {
goto fail;
}
- } else if (max_size < rec_size) {
- goto fail;
}
/* If there have been many consecutive inserts to the
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 93ad1b12b00..1a4c7e802c4 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -92,17 +92,14 @@ buf_mark_space_corrupt(
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
-inline void* aligned_malloc(size_t size, size_t align) {
+static void* aligned_malloc(size_t size, size_t align) {
void *result;
#ifdef _MSC_VER
result = _aligned_malloc(size, align);
-#elif defined (HAVE_POSIX_MEMALIGN)
+#else
if(posix_memalign(&result, align, size)) {
- result = 0;
+ result = NULL;
}
-#else
- /* Use unaligned malloc as fallback */
- result = malloc(size);
#endif
return result;
}
@@ -4942,9 +4939,8 @@ buf_page_io_complete(buf_page_t* bpage)
err = buf_page_check_corrupt(bpage, space);
}
-database_corrupted:
-
if (err != DB_SUCCESS) {
+database_corrupted:
/* Not a real corruption if it was triggered by
error injection */
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure",
@@ -4959,6 +4955,11 @@ database_corrupted:
goto page_not_corrupt;
);
+ if (uncompressed && bpage->zip.data) {
+ memset(reinterpret_cast<buf_block_t*>(bpage)
+ ->frame, 0, srv_page_size);
+ }
+
if (err == DB_PAGE_CORRUPTED) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Database page corruption on disk"
diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc
index 8851dd292da..a405c3edf5e 100644
--- a/storage/xtradb/buf/buf0dblwr.cc
+++ b/storage/xtradb/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -554,12 +554,18 @@ buf_dblwr_process()
continue;
}
- if (!fil_check_adress_in_tablespace(space_id, page_no)) {
+ if (!space()->size) {
+ fil_space_get_size(space_id);
+ }
+
+ if (UNIV_UNLIKELY(space()->size <= page_no)) {
ib_logf(IB_LOG_LEVEL_WARN,
- "A copy of page " ULINTPF ":" ULINTPF
+ "A copy of page " ULINTPF
" in the doublewrite buffer slot " ULINTPF
- " is not within space bounds",
- space_id, page_no, page_no_dblwr);
+ " is beyond the end of the tablespace "
+ " %s (" ULINTPF " pages)",
+ page_no, page_no_dblwr,
+ space()->name, space()->size);
continue;
}
@@ -963,6 +969,7 @@ try_again:
ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event);
mutex_exit(&buf_dblwr->mutex);
+ os_aio_simulated_wake_handler_threads();
os_event_wait_low(buf_dblwr->b_event, sig_count);
goto try_again;
}
@@ -1112,6 +1119,7 @@ try_again:
checkpoint. */
ib_int64_t sig_count = os_event_reset(buf_dblwr->b_event);
mutex_exit(&buf_dblwr->mutex);
+ os_aio_simulated_wake_handler_threads();
os_event_wait_low(buf_dblwr->b_event, sig_count);
goto try_again;
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index 349e7d45ab8..20dec30d106 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -176,7 +176,7 @@ get_buf_dump_dir()
/* The dump file should be created in the default data directory if
innodb_data_home_dir is set as an empty string. */
- if (strcmp(srv_data_home, "") == 0) {
+ if (!*srv_data_home) {
dump_dir = fil_path_to_mysql_datadir;
} else {
dump_dir = srv_data_home;
@@ -208,9 +208,11 @@ buf_dump(
ulint i;
int ret;
+ mysql_mutex_lock(&LOCK_global_system_variables);
ut_snprintf(full_filename, sizeof(full_filename),
"%s%c%s", get_buf_dump_dir(), SRV_PATH_SEPARATOR,
srv_buf_dump_filename);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
ut_snprintf(tmp_filename, sizeof(tmp_filename),
format_name, full_filename);
@@ -514,9 +516,11 @@ buf_load()
/* Ignore any leftovers from before */
buf_load_abort_flag = FALSE;
+ mysql_mutex_lock(&LOCK_global_system_variables);
ut_snprintf(full_filename, sizeof(full_filename),
"%s%c%s", get_buf_dump_dir(), SRV_PATH_SEPARATOR,
srv_buf_dump_filename);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
buf_load_status(STATUS_NOTICE,
"Loading buffer pool(s) from %s", full_filename);
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index 9c427395231..2a656d748b1 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
@@ -1297,8 +1297,11 @@ buf_flush_try_neighbors(
/* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
- if (high > fil_space_get_size(space)) {
- high = fil_space_get_size(space);
+ if (fil_space_t *s = fil_space_acquire_for_io(space)) {
+ high = s->max_page_number_for_io(high);
+ fil_space_release_for_io(s);
+ } else {
+ return 0;
}
ulint count = 0;
diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc
index 13bf5e79f2d..9a577bc3010 100644
--- a/storage/xtradb/buf/buf0lru.cc
+++ b/storage/xtradb/buf/buf0lru.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -1049,7 +1049,7 @@ buf_LRU_check_size_of_non_data_objects(
+ UT_LIST_GET_LEN(buf_pool->LRU))
< buf_pool->curr_size / 3) {
- if (!buf_lru_switched_on_innodb_mon) {
+ if (!buf_lru_switched_on_innodb_mon && srv_monitor_event) {
/* Over 67 % of the buffer pool is occupied by lock
heaps or the adaptive hash index. This may be a memory
diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc
index 1ef9162cab9..a962b94c0c2 100644
--- a/storage/xtradb/buf/buf0rea.cc
+++ b/storage/xtradb/buf/buf0rea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -344,19 +344,22 @@ buf_read_ahead_random(
return(0);
}
- /* Remember the tablespace version before we ask te tablespace size
- below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
- do not try to read outside the bounds of the tablespace! */
+ if (fil_space_t *s = fil_space_acquire_for_io(space)) {
+ /* Remember the tablespace version along with the
+ tablespace size: if DISCARD + IMPORT changes the
+ actual .ibd file meanwhile, we do not try to read
+ outside the bounds of the tablespace! */
+ tablespace_version = s->tablespace_version;
- tablespace_version = fil_space_get_version(space);
-
- low = (offset / buf_read_ahead_random_area)
- * buf_read_ahead_random_area;
- high = (offset / buf_read_ahead_random_area + 1)
- * buf_read_ahead_random_area;
- if (high > fil_space_get_size(space)) {
+ low = (offset / buf_read_ahead_random_area)
+ * buf_read_ahead_random_area;
+ high = (offset / buf_read_ahead_random_area + 1)
+ * buf_read_ahead_random_area;
+ high = s->max_page_number_for_io(high);
- high = fil_space_get_size(space);
+ fil_space_release_for_io(s);
+ } else {
+ return 0;
}
if (buf_pool->n_pend_reads
@@ -495,22 +498,16 @@ buf_read_page(
ulint offset,
trx_t* trx)
{
- ib_int64_t tablespace_version;
- ulint count;
dberr_t err = DB_SUCCESS;
- tablespace_version = fil_space_get_version(space_id);
-
FilSpace space(space_id, true);
if (space()) {
-
- /* We do the i/o in the synchronous aio mode to save thread
- switches: hence TRUE */
- count = buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space_id,
- zip_size, FALSE,
- tablespace_version, offset, trx);
-
+ ulint count = buf_read_page_low(&err, /*sync=*/true,
+ BUF_READ_ANY_PAGE,
+ space_id, zip_size, FALSE,
+ space()->tablespace_version,
+ offset, trx);
srv_stats.buf_pool_reads.add(count);
}
@@ -683,13 +680,23 @@ buf_read_ahead_linear(
return(0);
}
- /* Remember the tablespace version before we ask te tablespace size
- below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
- do not try to read outside the bounds of the tablespace! */
+ uint32_t space_high_limit = 0;
- tablespace_version = fil_space_get_version(space);
+ if (fil_space_t *s = fil_space_acquire_for_io(space)) {
+ /* Remember the tablespace version along with the
+ tablespace size: if DISCARD + IMPORT changes the
+ actual .ibd file meanwhile, we do not try to read
+ outside the bounds of the tablespace! */
+ tablespace_version = s->tablespace_version;
+
+ space_high_limit = s->max_page_number_for_io(ULINT_UNDEFINED);
+
+ fil_space_release_for_io(s);
+ } else {
+ return 0;
+ }
- if (high > fil_space_get_size(space)) {
+ if (high > space_high_limit) {
/* The area is not whole, return */
return(0);
@@ -825,7 +832,7 @@ buf_read_ahead_linear(
return(0);
}
- if (high > fil_space_get_size(space)) {
+ if (high > space_high_limit) {
/* The area is not whole, return */
return(0);
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 2bea154749f..6d0500589b1 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -604,7 +604,10 @@ dict_table_close(
mutex_exit(&dict_sys->mutex);
- if (drop_aborted) {
+ /* dict_table_try_drop_aborted() can generate undo logs.
+ So it should be avoided after shutdown of background
+ threads */
+ if (drop_aborted && srv_undo_sources) {
dict_table_try_drop_aborted(NULL, table_id, 0);
}
}
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index f4bbc5c8f06..82480b13827 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -416,15 +416,14 @@ dict_mem_table_col_rename_low(
}
}
- dict_index_t* new_index = dict_foreign_find_index(
+ /* New index can be null if XtraDB already dropped
+ the foreign index when FOREIGN_KEY_CHECKS is
+ disabled */
+ foreign->foreign_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
foreign->n_fields, NULL, true, false,
NULL, NULL, NULL);
- /* There must be an equivalent index in this case. */
- ut_ad(new_index != NULL);
-
- foreign->foreign_index = new_index;
} else {
@@ -447,7 +446,41 @@ dict_mem_table_col_rename_low(
foreign = *it;
- ut_ad(foreign->referenced_index != NULL);
+ if (!foreign->referenced_index) {
+ /* Referenced index could have been dropped
+ when foreign_key_checks is disabled. In that case,
+ rename the corresponding referenced_col_names and
+ find the equivalent referenced index also */
+ for (unsigned f = 0; f < foreign->n_fields; f++) {
+
+ const char*& rc =
+ foreign->referenced_col_names[f];
+
+ if (strcmp(rc, from)) {
+ continue;
+ }
+
+ if (to_len <= strlen(rc)) {
+ memcpy(const_cast<char*>(rc), to,
+ to_len + 1);
+ } else {
+ rc = static_cast<char*>(
+ mem_heap_dup(
+ foreign->heap,
+ to, to_len + 1));
+ }
+ }
+
+ /* New index can be null if InnoDB already dropped
+ the referenced index when FOREIGN_KEY_CHECKS is
+ disabled */
+ foreign->referenced_index = dict_foreign_find_index(
+ foreign->referenced_table, NULL,
+ foreign->referenced_col_names,
+ foreign->n_fields, NULL, true, false,
+ NULL, NULL, NULL);
+ return;
+ }
for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
@@ -820,3 +853,22 @@ operator<< (std::ostream& out, const dict_foreign_set& fk_set)
return(out);
}
+/** Check whether fulltext index gets affected by foreign
+key constraint. */
+bool dict_foreign_t::affects_fulltext() const
+{
+ if (foreign_table == referenced_table || !foreign_table->fts)
+ return false;
+
+ for (ulint i = 0; i < n_fields; i++)
+ {
+ if (dict_table_is_fts_column(
+ foreign_table->fts->indexes,
+ dict_index_get_nth_col_no(foreign_index, i))
+ != ULINT_UNDEFINED)
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 874c6b4dd2e..b38b8778f5b 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -44,15 +44,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "ha_prototypes.h" // IB_LOG_
#include <my_crypt.h>
-/** Mutex for keys */
-static ib_mutex_t fil_crypt_key_mutex;
-
static bool fil_crypt_threads_inited = false;
-#ifdef UNIV_PFS_MUTEX
-static mysql_pfs_key_t fil_crypt_key_mutex_key;
-#endif
-
/** Is encryption enabled/disabled */
UNIV_INTERN ulong srv_encrypt_tables = 0;
@@ -133,9 +126,6 @@ UNIV_INTERN
void
fil_space_crypt_init()
{
- mutex_create(fil_crypt_key_mutex_key,
- &fil_crypt_key_mutex, SYNC_NO_ORDER_CHECK);
-
fil_crypt_throttle_sleep_event = os_event_create();
mutex_create(fil_crypt_stat_mutex_key,
@@ -152,7 +142,6 @@ fil_space_crypt_cleanup()
{
os_event_free(fil_crypt_throttle_sleep_event);
fil_crypt_throttle_sleep_event = NULL;
- mutex_free(&fil_crypt_key_mutex);
mutex_free(&crypt_stat_mutex);
}
@@ -706,47 +695,8 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data;
ut_ad(space->n_pending_ios > 0);
ulint zip_size = fsp_flags_get_zip_size(space->flags);
- byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, src_frame, zip_size, dst_frame);
-
-#ifdef UNIV_DEBUG
- if (tmp) {
- /* Verify that encrypted buffer is not corrupted */
- dberr_t err = DB_SUCCESS;
- byte* src = src_frame;
- bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
- byte tmp_mem[UNIV_PAGE_SIZE_MAX];
- ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
-
- if (page_compressed_encrypted) {
- memcpy(uncomp_mem, src, srv_page_size);
- ulint unzipped1 = fil_page_decompress(
- tmp_mem, uncomp_mem);
- ut_ad(unzipped1);
- if (unzipped1 != srv_page_size) {
- src = uncomp_mem;
- }
- }
-
- ut_ad(!buf_page_is_corrupted(true, src, zip_size, space));
- ut_ad(fil_space_decrypt(crypt_data, tmp_mem, size, tmp, &err));
- ut_ad(err == DB_SUCCESS);
-
- /* Need to decompress the page if it was also compressed */
- if (page_compressed_encrypted) {
- byte buf[UNIV_PAGE_SIZE_MAX];
- memcpy(buf, tmp_mem, srv_page_size);
- ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
- ut_ad(unzipped2);
- }
-
- memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
- ut_ad(!memcmp(src, tmp_mem, size));
- }
-#endif /* UNIV_DEBUG */
-
- return tmp;
+ return fil_encrypt_buf(crypt_data, space->id, offset, lsn,
+ src_frame, zip_size, dst_frame);
}
/******************************************************************
@@ -1490,6 +1440,109 @@ fil_crypt_return_iops(
fil_crypt_update_total_stat(state);
}
+/** Remove space from key rotation list if there are no pending operations. */
+static void fil_space_remove_from_keyrotation(fil_space_t *space)
+{
+ ut_ad(mutex_own(&fil_system->mutex));
+
+ if (space->n_pending_ops == 0 && space->is_in_rotation_list)
+ {
+ space->is_in_rotation_list= false;
+ ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
+ UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space);
+ }
+}
+
+/** Return the next tablespace from key rotation list.
+@param space previous tablespace (NULL to start from the beginning)
+@return pointer to the next tablespace (with n_pending_ops incremented)
+@retval NULL if this was the last */
+static fil_space_t *fil_space_keyrotate_next(fil_space_t *space)
+{
+ ut_ad(mutex_own(&fil_system->mutex));
+
+ if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0)
+ {
+ if (space)
+ {
+ space->n_pending_ops--;
+ fil_space_remove_from_keyrotation(space);
+ }
+
+ return NULL;
+ }
+
+ if (!space)
+ {
+ space= UT_LIST_GET_FIRST(fil_system->rotation_list);
+ /* We can trust that space is not NULL because we
+ checked list length above */
+ }
+ else
+ {
+ space->n_pending_ops--;
+ fil_space_t *old = space;
+ space= UT_LIST_GET_NEXT(rotation_list, space);
+ fil_space_remove_from_keyrotation(old);
+ }
+
+ /* Skip spaces that are being created by fil_ibd_create(),
+ or dropped. Note that rotation_list contains only
+ space->purpose == FIL_TABLESPACE. */
+ while (space && (!UT_LIST_GET_LEN(space->chain) || space->is_stopping()))
+ {
+ fil_space_t *old = space;
+ space= UT_LIST_GET_NEXT(rotation_list, space);
+ fil_space_remove_from_keyrotation(old);
+ }
+
+ if (space)
+ space->n_pending_ops++;
+
+ return space;
+}
+
+/** Return the next tablespace.
+@param space previous tablespace (NULL to start from the beginning)
+@return pointer to the next tablespace (with n_pending_ops incremented)
+@retval NULL if this was the last */
+static fil_space_t *fil_space_next(fil_space_t *space)
+{
+ mutex_enter(&fil_system->mutex);
+ ut_ad(!space || space->n_pending_ops);
+
+ if (!srv_fil_crypt_rotate_key_age)
+ space= fil_space_keyrotate_next(space);
+ else if (!space)
+ {
+ space= UT_LIST_GET_FIRST(fil_system->space_list);
+ /* We can trust that space is not NULL because at least the
+ system tablespace is always present and loaded first. */
+ space->n_pending_ops++;
+ }
+ else
+ {
+ ut_ad(space->n_pending_ops > 0);
+ /* Move on to the next fil_space_t */
+ space->n_pending_ops--;
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ /* Skip abnormal tablespaces or those that are being created by
+ fil_ibd_create(), or being dropped. */
+ while (space &&
+ (UT_LIST_GET_LEN(space->chain) == 0 ||
+ space->is_stopping() || space->purpose != FIL_TABLESPACE))
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ if (space)
+ space->n_pending_ops++;
+ }
+
+ mutex_exit(&fil_system->mutex);
+
+ return space;
+}
+
/***********************************************************************
Search for a space needing rotation
@param[in,out] key_state Key state
@@ -1524,14 +1577,7 @@ fil_crypt_find_space_to_rotate(
state->space = NULL;
}
- /* If key rotation is enabled (default) we iterate all tablespaces.
- If key rotation is not enabled we iterate only the tablespaces
- added to keyrotation list. */
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_space_keyrotate_next(state->space);
- }
+ state->space = fil_space_next(state->space);
while (!state->should_shutdown() && state->space) {
fil_crypt_read_crypt_data(state->space);
@@ -1544,14 +1590,15 @@ fil_crypt_find_space_to_rotate(
return true;
}
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_space_keyrotate_next(state->space);
- }
+ state->space = fil_space_next(state->space);
+ }
+
+ if (state->space) {
+ fil_space_release(state->space);
+ state->space = NULL;
}
- /* if we didn't find any space return iops */
+ /* no work to do; release our allocation of I/O capacity */
fil_crypt_return_iops(state);
return false;
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 4a982df3fda..be11b1089a9 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -684,7 +684,7 @@ fil_node_open_file(
#ifdef UNIV_HOTBACKUP
add_size:
#endif /* UNIV_HOTBACKUP */
- space->size += node->size;
+ space->committed_size = space->size += node->size;
}
ulint atomic_writes = FSP_FLAGS_GET_ATOMIC_WRITES(space->flags);
@@ -1158,6 +1158,9 @@ retry:
ut_a(success);
/* InnoDB data files cannot shrink. */
ut_a(space->size >= size);
+ if (size > space->committed_size) {
+ space->committed_size = size;
+ }
/* There could be multiple concurrent I/O requests for
this tablespace (multiple threads trying to extend
@@ -1815,25 +1818,6 @@ fil_space_get_zip_size(
return(flags);
}
-/*******************************************************************//**
-Checks if the pair space, page_no refers to an existing page in a tablespace
-file space. The tablespace must be cached in the memory cache.
-@return TRUE if the address is meaningful */
-UNIV_INTERN
-ibool
-fil_check_adress_in_tablespace(
-/*===========================*/
- ulint id, /*!< in: space id */
- ulint page_no)/*!< in: page number */
-{
- if (fil_space_get_size(id) > page_no) {
-
- return(TRUE);
- }
-
- return(FALSE);
-}
-
/****************************************************************//**
Initializes the tablespace memory cache. */
UNIV_INTERN
@@ -6879,137 +6863,3 @@ fil_space_release(fil_space_t* space)
space->n_pending_ops--;
mutex_exit(&fil_system->mutex);
}
-
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-UNIV_INTERN
-fil_space_t*
-fil_space_next(fil_space_t* prev_space)
-{
- fil_space_t* space=prev_space;
-
- mutex_enter(&fil_system->mutex);
-
- if (prev_space == NULL) {
- space = UT_LIST_GET_FIRST(fil_system->space_list);
-
- /* We can trust that space is not NULL because at least the
- system tablespace is always present and loaded first. */
- space->n_pending_ops++;
- } else {
- ut_ad(space->n_pending_ops > 0);
-
- /* Move on to the next fil_space_t */
- space->n_pending_ops--;
- space = UT_LIST_GET_NEXT(space_list, space);
-
- /* Skip spaces that are being created by
- fil_ibd_create(), or dropped, or !tablespace. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping()
- || space->purpose != FIL_TABLESPACE)) {
- space = UT_LIST_GET_NEXT(space_list, space);
- }
-
- if (space != NULL) {
- space->n_pending_ops++;
- }
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(space);
-}
-
-/**
-Remove space from key rotation list if there are no more
-pending operations.
-@param[in] space Tablespace */
-static
-void
-fil_space_remove_from_keyrotation(
- fil_space_t* space)
-{
- ut_ad(mutex_own(&fil_system->mutex));
- ut_ad(space);
-
- if (space->n_pending_ops == 0 && space->is_in_rotation_list) {
- space->is_in_rotation_list = false;
- ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0);
- UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space);
- }
-}
-
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-UNIV_INTERN
-fil_space_t*
-fil_space_keyrotate_next(
- fil_space_t* prev_space)
-{
- fil_space_t* space = prev_space;
- fil_space_t* old = NULL;
-
- mutex_enter(&fil_system->mutex);
-
- if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) {
- if (space) {
- ut_ad(space->n_pending_ops > 0);
- space->n_pending_ops--;
- fil_space_remove_from_keyrotation(space);
- }
- mutex_exit(&fil_system->mutex);
- return(NULL);
- }
-
- if (prev_space == NULL) {
- space = UT_LIST_GET_FIRST(fil_system->rotation_list);
-
- /* We can trust that space is not NULL because we
- checked list length above */
- } else {
- ut_ad(space->n_pending_ops > 0);
-
- /* Move on to the next fil_space_t */
- space->n_pending_ops--;
-
- old = space;
- space = UT_LIST_GET_NEXT(rotation_list, space);
-
- fil_space_remove_from_keyrotation(old);
- }
-
- /* Skip spaces that are being created by fil_ibd_create(),
- or dropped. Note that rotation_list contains only
- space->purpose == FIL_TABLESPACE. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping())) {
-
- old = space;
- space = UT_LIST_GET_NEXT(rotation_list, space);
- fil_space_remove_from_keyrotation(old);
- }
-
- if (space != NULL) {
- space->n_pending_ops++;
- }
-
- mutex_exit(&fil_system->mutex);
-
- return(space);
-}
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index edc1fa913e7..656d1d46a6a 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2018, MariaDB Corporation.
+Copyright (C) 2013, 2020, 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
@@ -243,24 +243,12 @@ success:
/* Set up the actual payload lenght */
mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size);
-#ifdef UNIV_DEBUG
- /* Verify */
ut_ad(fil_page_is_compressed(out_buf) || fil_page_is_compressed_encrypted(out_buf));
ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC);
ut_ad(mach_read_from_2(out_buf+FIL_PAGE_DATA) == write_size);
ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) == (ulint)comp_method ||
mach_read_from_2(out_buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE) == (ulint)comp_method);
- /* Verify that page can be decompressed */
- {
- page_t tmp_buf[UNIV_PAGE_SIZE_MAX];
- page_t page[UNIV_PAGE_SIZE_MAX];
- memcpy(page, out_buf, srv_page_size);
- ut_ad(fil_page_decompress(tmp_buf, page));
- ut_ad(!buf_page_is_corrupted(false, page, 0, NULL));
- }
-#endif /* UNIV_DEBUG */
-
write_size+=header_len;
if (block_size <= 0) {
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index 5604a1b48c5..e9d26a5932b 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -450,7 +450,7 @@ xdes_get_descriptor_with_space_hdr(
page_t* descr_page;
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_SPACE_X_LOCK));
ut_ad(mtr_memo_contains_page(mtr, sp_header, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_offset(sp_header) == FSP_HEADER_OFFSET);
/* Read free limit and space size */
@@ -534,7 +534,7 @@ xdes_lst_get_descriptor(
ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_SPACE_X_LOCK));
descr = fut_get_ptr(space, zip_size, lst_node, RW_X_LATCH, mtr)
- XDES_FLST_NODE;
@@ -690,7 +690,7 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
ut_ad(mtr);
- mtr_x_lock(fil_space_get_latch(space_id, &flags), mtr);
+ mtr_x_space_lock(fil_space_get_latch(space_id, &flags), mtr);
zip_size = fsp_flags_get_zip_size(flags);
block = buf_page_create(space_id, 0, zip_size, mtr);
@@ -817,7 +817,7 @@ fsp_header_inc_size(
ut_ad(mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), mtr);
header = fsp_get_space_header(space,
fsp_flags_get_zip_size(flags),
@@ -846,7 +846,7 @@ fsp_header_get_tablespace_size(void)
mtr_start(&mtr);
- mtr_x_lock(fil_space_get_latch(0, NULL), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(0, NULL), &mtr);
header = fsp_get_space_header(0, 0, &mtr);
@@ -1073,7 +1073,6 @@ fsp_fill_free_list(
ulint frag_n_used;
ulint actual_increase;
ulint i;
- mtr_t ibuf_mtr;
ut_ad(page_offset(header) == FSP_HEADER_OFFSET);
@@ -1141,26 +1140,17 @@ fsp_fill_free_list(
MLOG_2BYTES, mtr);
}
- /* Initialize the ibuf bitmap page in a separate
- mini-transaction because it is low in the latching
- order, and we must be able to release its latch
- before returning from the fsp routine */
-
- mtr_start(&ibuf_mtr);
-
block = buf_page_create(space,
- i + FSP_IBUF_BITMAP_OFFSET,
- zip_size, &ibuf_mtr);
+ i + FSP_IBUF_BITMAP_OFFSET,
+ zip_size, mtr);
buf_page_get(space, zip_size,
i + FSP_IBUF_BITMAP_OFFSET,
- RW_X_LATCH, &ibuf_mtr);
+ RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
- fsp_init_file_page(block, &ibuf_mtr);
+ fsp_init_file_page(block, mtr);
- ibuf_bitmap_page_init(block, &ibuf_mtr);
-
- mtr_commit(&ibuf_mtr);
+ ibuf_bitmap_page_init(block, mtr);
}
descr = xdes_get_descriptor_with_space_hdr(header, space, i,
@@ -2047,7 +2037,7 @@ fseg_create_general(
header = byte_offset + buf_block_get_frame(block);
}
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2,
@@ -2194,7 +2184,7 @@ fseg_n_reserved_pages(
latch = fil_space_get_latch(space, &flags);
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
inode = fseg_inode_get(header, space, zip_size, mtr);
@@ -2617,7 +2607,7 @@ fseg_alloc_free_page_general(
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
inode = fseg_inode_get(seg_header, space, zip_size, mtr);
@@ -2734,7 +2724,7 @@ fsp_reserve_free_extents(
latch = fil_space_get_latch(space, &flags);
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
space_header = fsp_get_space_header(space, zip_size, mtr);
try_again:
@@ -2873,7 +2863,7 @@ fsp_get_available_space_in_free_extents(
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
mutex_exit(&dict_sys->mutex);
@@ -3169,7 +3159,7 @@ fseg_free_page(
latch = fil_space_get_latch(space, &flags);
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
seg_inode = fseg_inode_get(seg_header, space, zip_size, mtr);
@@ -3203,7 +3193,7 @@ fseg_page_is_free(
zip_size = dict_tf_get_zip_size(flags);
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
seg_inode = fseg_inode_get(seg_header, space, zip_size, &mtr);
@@ -3328,7 +3318,7 @@ fseg_free_step(
latch = fil_space_get_latch(space, &flags);
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
@@ -3415,7 +3405,7 @@ fseg_free_step_not_header(
latch = fil_space_get_latch(space, &flags);
zip_size = fsp_flags_get_zip_size(flags);
- mtr_x_lock(latch, mtr);
+ mtr_x_space_lock(latch, mtr);
inode = fseg_inode_get(header, space, zip_size, mtr);
@@ -3541,7 +3531,7 @@ fseg_validate_low(
ulint zip_size;
mtr_start(&mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), &mtr);
zip_size = fsp_flags_get_zip_size(flags);
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3564,7 +3554,7 @@ fseg_validate_low(
ulint zip_size;
mtr_start(&mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), &mtr);
zip_size = fsp_flags_get_zip_size(flags);
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3590,7 +3580,7 @@ fseg_validate_low(
ulint zip_size;
mtr_start(&mtr);
- mtr_x_lock(fil_space_get_latch(space, &flags), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), &mtr);
zip_size = fsp_flags_get_zip_size(flags);
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3628,7 +3618,7 @@ fseg_validate(
space = page_get_space_id(page_align(header));
- mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), mtr);
zip_size = fsp_flags_get_zip_size(flags);
inode = fseg_inode_get(header, space, zip_size, mtr);
@@ -3704,7 +3694,7 @@ fseg_print(
space = page_get_space_id(page_align(header));
- mtr_x_lock(fil_space_get_latch(space, &flags), mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, &flags), mtr);
zip_size = fsp_flags_get_zip_size(flags);
inode = fseg_inode_get(header, space, zip_size, mtr);
@@ -3753,10 +3743,10 @@ fsp_validate(
/* Start first a mini-transaction mtr2 to lock out all other threads
from the fsp system */
mtr_start(&mtr2);
- mtr_x_lock(latch, &mtr2);
+ mtr_x_space_lock(latch, &mtr2);
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -3783,7 +3773,7 @@ fsp_validate(
/* Validate FSP_FREE list */
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
node_addr = flst_get_first(header + FSP_FREE, &mtr);
@@ -3792,7 +3782,7 @@ fsp_validate(
while (!fil_addr_is_null(node_addr)) {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
descr_count++;
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3807,7 +3797,7 @@ fsp_validate(
/* Validate FSP_FREE_FRAG list */
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
node_addr = flst_get_first(header + FSP_FREE_FRAG, &mtr);
@@ -3816,7 +3806,7 @@ fsp_validate(
while (!fil_addr_is_null(node_addr)) {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
descr_count++;
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3834,7 +3824,7 @@ fsp_validate(
/* Validate FSP_FULL_FRAG list */
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
node_addr = flst_get_first(header + FSP_FULL_FRAG, &mtr);
@@ -3843,7 +3833,7 @@ fsp_validate(
while (!fil_addr_is_null(node_addr)) {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
descr_count++;
descr = xdes_lst_get_descriptor(space, zip_size,
@@ -3858,7 +3848,7 @@ fsp_validate(
/* Validate segments */
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -3873,7 +3863,7 @@ fsp_validate(
n = 0;
do {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
seg_inode_page = fut_get_ptr(
space, zip_size, node_addr, RW_X_LATCH, &mtr)
@@ -3902,7 +3892,7 @@ fsp_validate(
}
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -3918,7 +3908,7 @@ fsp_validate(
do {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
seg_inode_page = fut_get_ptr(
space, zip_size, node_addr, RW_X_LATCH, &mtr)
@@ -4002,11 +3992,11 @@ fsp_print(
mtr_start(&mtr2);
- mtr_x_lock(latch, &mtr2);
+ mtr_x_space_lock(latch, &mtr2);
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -4038,7 +4028,7 @@ fsp_print(
/* Print segments */
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -4053,7 +4043,7 @@ fsp_print(
do {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
seg_inode_page = fut_get_ptr(
space, zip_size, node_addr, RW_X_LATCH, &mtr)
@@ -4075,7 +4065,7 @@ fsp_print(
}
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
header = fsp_get_space_header(space, zip_size, &mtr);
@@ -4090,7 +4080,7 @@ fsp_print(
do {
mtr_start(&mtr);
- mtr_x_lock(latch, &mtr);
+ mtr_x_space_lock(latch, &mtr);
seg_inode_page = fut_get_ptr(
space, zip_size, node_addr, RW_X_LATCH, &mtr)
@@ -4147,7 +4137,8 @@ fsp_page_is_free_func(
ut_ad(mtr);
- mtr_x_lock_func(fil_space_get_latch(space, &flags), file, line, mtr);
+ mtr_x_space_lock_func(fil_space_get_latch(space, &flags), file, line,
+ mtr);
ulint zip_size = fsp_flags_get_zip_size(flags);
xdes_t* descr = xdes_get_descriptor(space, zip_size, page_no, mtr);
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 6dbe5e0e2a0..2a1341c4cf0 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -443,9 +443,9 @@ fts_read_stopword(
/******************************************************************//**
Load user defined stopword from designated user table
-@return TRUE if load operation is successful */
+@return whether the operation is successful */
static
-ibool
+bool
fts_load_user_stopword(
/*===================*/
fts_t* fts, /*!< in: FTS struct */
@@ -453,27 +453,26 @@ fts_load_user_stopword(
name */
fts_stopword_t* stopword_info) /*!< in: Stopword info */
{
- pars_info_t* info;
- que_t* graph;
- dberr_t error = DB_SUCCESS;
- ibool ret = TRUE;
- trx_t* trx;
- ibool has_lock = fts->dict_locked;
-
- trx = trx_allocate_for_background();
- trx->op_info = "Load user stopword table into FTS cache";
-
- if (!has_lock) {
+ if (!fts->dict_locked) {
mutex_enter(&dict_sys->mutex);
}
- /* Validate the user table existence and in the right
- format */
+ /* Validate the user table existence in the right format */
+ bool ret= false;
stopword_info->charset = fts_valid_stopword_table(stopword_table_name);
if (!stopword_info->charset) {
- ret = FALSE;
- goto cleanup;
- } else if (!stopword_info->cached_stopword) {
+cleanup:
+ if (!fts->dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+
+ return ret;
+ }
+
+ trx_t* trx = trx_allocate_for_background();
+ trx->op_info = "Load user stopword table into FTS cache";
+
+ if (!stopword_info->cached_stopword) {
/* Create the stopword RB tree with the stopword column
charset. All comparison will use this charset */
stopword_info->cached_stopword = rbt_create_arg_cmp(
@@ -482,14 +481,14 @@ fts_load_user_stopword(
}
- info = pars_info_create();
+ pars_info_t* info = pars_info_create();
pars_info_bind_id(info, TRUE, "table_stopword", stopword_table_name);
pars_info_bind_function(info, "my_func", fts_read_stopword,
stopword_info);
- graph = fts_parse_sql_no_dict_lock(
+ que_t* graph = fts_parse_sql_no_dict_lock(
NULL,
info,
"DECLARE FUNCTION my_func;\n"
@@ -508,14 +507,13 @@ fts_load_user_stopword(
"CLOSE c;");
for (;;) {
- error = fts_eval_sql(trx, graph);
+ dberr_t error = fts_eval_sql(trx, graph);
if (error == DB_SUCCESS) {
fts_sql_commit(trx);
stopword_info->status = STOPWORD_USER_TABLE;
break;
} else {
-
fts_sql_rollback(trx);
ut_print_timestamp(stderr);
@@ -537,14 +535,9 @@ fts_load_user_stopword(
}
que_graph_free(graph);
-
-cleanup:
- if (!has_lock) {
- mutex_exit(&dict_sys->mutex);
- }
-
trx_free_for_background(trx);
- return(ret);
+ ret = true;
+ goto cleanup;
}
/******************************************************************//**
@@ -1134,14 +1127,14 @@ fts_cache_clear(
index_cache->doc_stats = NULL;
}
- mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
- cache->sync_heap->arg = NULL;
-
cache->total_size = 0;
mutex_enter((ib_mutex_t*) &cache->deleted_lock);
cache->deleted_doc_ids = NULL;
mutex_exit((ib_mutex_t*) &cache->deleted_lock);
+
+ mem_heap_free(static_cast<mem_heap_t*>(cache->sync_heap->arg));
+ cache->sync_heap->arg = NULL;
}
/*********************************************************************//**
@@ -3495,8 +3488,8 @@ fts_add_doc_by_id(
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
- fts_load_stopword(table, NULL, NULL,
- NULL, TRUE, TRUE);
+ fts_load_stopword(table, NULL,
+ NULL, true, true);
}
fts_cache_add_doc(
@@ -7244,21 +7237,19 @@ This function loads the stopword into the FTS cache. It also
records/fetches stopword configuration to/from FTS configure
table, depending on whether we are creating or reloading the
FTS.
-@return TRUE if load operation is successful */
+@return true if load operation is successful */
UNIV_INTERN
-ibool
+bool
fts_load_stopword(
/*==============*/
const dict_table_t*
table, /*!< in: Table with FTS */
trx_t* trx, /*!< in: Transactions */
- const char* global_stopword_table, /*!< in: Global stopword table
- name */
const char* session_stopword_table, /*!< in: Session stopword table
name */
- ibool stopword_is_on, /*!< in: Whether stopword
+ bool stopword_is_on, /*!< in: Whether stopword
option is turned on/off */
- ibool reload) /*!< in: Whether it is
+ bool reload) /*!< in: Whether it is
for reloading FTS table */
{
fts_table_t fts_table;
@@ -7274,9 +7265,8 @@ fts_load_stopword(
cache = table->fts->cache;
- if (!reload && !(cache->stopword_info.status
- & STOPWORD_NOT_INIT)) {
- return(TRUE);
+ if (!reload && !(cache->stopword_info.status & STOPWORD_NOT_INIT)) {
+ return true;
}
if (!trx) {
@@ -7321,12 +7311,11 @@ fts_load_stopword(
goto cleanup;
}
- if (strlen((char*) str.f_str) > 0) {
+ if (*str.f_str) {
stopword_to_use = (const char*) str.f_str;
}
} else {
- stopword_to_use = (session_stopword_table)
- ? session_stopword_table : global_stopword_table;
+ stopword_to_use = session_stopword_table;
}
if (stopword_to_use
@@ -7363,7 +7352,7 @@ cleanup:
sizeof(fts_tokenizer_word_t), fts_utf8_string_cmp);
}
- return(error == DB_SUCCESS);
+ return error == DB_SUCCESS;
}
/**********************************************************************//**
@@ -7569,7 +7558,7 @@ fts_init_index(
} else {
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
- fts_load_stopword(table, NULL, NULL, NULL, TRUE, TRUE);
+ fts_load_stopword(table, NULL, NULL, true, true);
}
for (ulint i = 0; i < ib_vector_size(cache->get_docs); ++i) {
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index 8fce8efac2b..0c51e702907 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 2020, 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
@@ -146,6 +146,8 @@ struct fts_query_t {
fts_word_freq_t */
bool multi_exist; /*!< multiple FTS_EXIST oper */
+ byte visiting_sub_exp; /*!< count of nested
+ fts_ast_visit_sub_exp() */
};
/** For phrase matching, first we collect the documents and the positions
@@ -2856,6 +2858,8 @@ fts_query_get_token(
return(new_ptr);
}
+static dberr_t fts_ast_visit_sub_exp(fts_ast_node_t*, fts_ast_callback, void*);
+
/*****************************************************************//**
Visit every node of the AST. */
static
@@ -2945,7 +2949,7 @@ Process (nested) sub-expression, create a new result set to store the
sub-expression result by processing nodes under current sub-expression
list. Merge the sub-expression result with that of parent expression list.
@return DB_SUCCESS if all well */
-UNIV_INTERN
+static
dberr_t
fts_ast_visit_sub_exp(
/*==================*/
@@ -2965,6 +2969,14 @@ fts_ast_visit_sub_exp(
ut_a(node->type == FTS_AST_SUBEXP_LIST);
+ /* To avoid stack overflow, we limit the mutual recursion
+ depth between fts_ast_visit(), fts_query_visitor() and
+ fts_ast_visit_sub_exp(). */
+ if (query->visiting_sub_exp++ > 31) {
+ query->error = DB_OUT_OF_MEMORY;
+ DBUG_RETURN(query->error);
+ }
+
cur_oper = query->oper;
/* Save current result set */
@@ -2987,6 +2999,7 @@ fts_ast_visit_sub_exp(
/* Reinstate parent node state */
query->multi_exist = multi_exist;
query->oper = cur_oper;
+ query->visiting_sub_exp--;
/* Merge the sub-expression result with the parent result set. */
subexpr_doc_ids = query->doc_ids;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 770f3dc2440..08aae20f3d3 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,11 +1,10 @@
/*****************************************************************************
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1939,8 +1938,7 @@ innobase_srv_conc_enter_innodb(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
if (srv_thread_concurrency) {
if (trx->n_tickets_to_enter_innodb > 0) {
@@ -1978,8 +1976,7 @@ innobase_srv_conc_exit_innodb(
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) return;
#endif /* WITH_WSREP */
/* This is to avoid making an unnecessary function call. */
@@ -2922,6 +2919,9 @@ innobase_trx_init(
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
+#ifdef WITH_WSREP
+ trx->wsrep = wsrep_on(thd);
+#endif
/* Transaction on start caches the fake_changes state and uses it for
complete transaction lifetime.
@@ -4645,20 +4645,9 @@ innobase_commit_low(
trx_t* trx) /*!< in: transaction handle */
{
#ifdef WITH_WSREP
- THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
- if (thd && wsrep_on(thd)) {
-#ifdef WSREP_PROC_INFO
- char info[64];
- info[sizeof(info) - 1] = '\0';
- snprintf(info, sizeof(info) - 1,
- "innobase_commit_low():trx_commit_for_mysql(%lld)",
- (long long) wsrep_thd_trx_seqno(thd));
- tmp = thd_proc_info(thd, info);
-
-#else
- tmp = thd_proc_info(thd, "innobase_commit_low()");
-#endif /* WSREP_PROC_INFO */
+ if (trx->is_wsrep()) {
+ tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()");
}
#endif /* WITH_WSREP */
if (trx_is_started(trx)) {
@@ -4666,7 +4655,7 @@ innobase_commit_low(
trx_commit_for_mysql(trx);
}
#ifdef WITH_WSREP
- if (thd && wsrep_on(thd)) { thd_proc_info(thd, tmp); }
+ if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); }
#endif /* WITH_WSREP */
}
@@ -8676,19 +8665,19 @@ ha_innobase::write_row(
sql_command = thd_sql_command(user_thd);
- if ((sql_command == SQLCOM_ALTER_TABLE
- || sql_command == SQLCOM_OPTIMIZE
- || sql_command == SQLCOM_CREATE_INDEX
+ if (num_write_row >= 10000
+ && (sql_command == SQLCOM_ALTER_TABLE
+ || sql_command == SQLCOM_OPTIMIZE
+ || sql_command == SQLCOM_CREATE_INDEX
#ifdef WITH_WSREP
- || (wsrep_on(user_thd) && wsrep_load_data_splitting &&
- sql_command == SQLCOM_LOAD &&
- !thd_test_options(
- user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+ || (sql_command == SQLCOM_LOAD &&
+ trx->is_wsrep() && wsrep_load_data_splitting &&
+ !thd_test_options(
+ user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
#endif /* WITH_WSREP */
- || sql_command == SQLCOM_DROP_INDEX)
- && num_write_row >= 10000) {
+ || sql_command == SQLCOM_DROP_INDEX)) {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd) && sql_command == SQLCOM_LOAD) {
+ if (sql_command == SQLCOM_LOAD && trx->is_wsrep()) {
WSREP_DEBUG("forced trx split for LOAD: %s",
wsrep_thd_query(user_thd));
}
@@ -8727,9 +8716,8 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd) &&
- wsrep_load_data_splitting &&
- sql_command == SQLCOM_LOAD &&
+ if (sql_command == SQLCOM_LOAD && trx->is_wsrep() &&
+ wsrep_load_data_splitting &&
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
@@ -8759,9 +8747,8 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
- if (wsrep_on(user_thd) &&
- wsrep_load_data_splitting &&
- sql_command == SQLCOM_LOAD &&
+ if (sql_command == SQLCOM_LOAD && trx->is_wsrep() &&
+ wsrep_load_data_splitting &&
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
@@ -8906,21 +8893,19 @@ no_commit:
prebuilt->autoinc_offset,
prebuilt->autoinc_increment);
- if (wsrep_on(current_thd) &&
+ if (trx->is_wsrep() &&
auto_inc_inserted &&
wsrep_drupal_282555_workaround &&
- wsrep_thd_retry_counter(current_thd) == 0 &&
- !thd_test_options(current_thd,
+ wsrep_thd_retry_counter(user_thd) == 0 &&
+ !thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT |
OPTION_BEGIN)) {
WSREP_DEBUG(
"retrying insert: %s",
- (*wsrep_thd_query(current_thd)) ?
- wsrep_thd_query(current_thd) :
- (char *)"void");
+ wsrep_thd_query(user_thd));
error= DB_SUCCESS;
wsrep_thd_set_conflict_state(
- current_thd, MUST_ABORT);
+ user_thd, MUST_ABORT);
innobase_srv_conc_exit_innodb(prebuilt->trx);
/* jump straight to func exit over
* later wsrep hooks */
@@ -8989,18 +8974,16 @@ report_error:
user_thd);
#ifdef WITH_WSREP
- if (!error_result
- && wsrep_on(user_thd)
- && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
+ if (!error_result && trx->is_wsrep()
+ && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE
&& !wsrep_consistency_check(user_thd)
&& !wsrep_thd_ignore_table(user_thd)) {
if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ goto func_exit;
}
}
-wsrep_error:
#endif /* WITH_WSREP */
if (error_result == HA_FTS_INVALID_DOCID) {
@@ -9508,9 +9491,8 @@ func_exit:
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
+ if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd))
{
DBUG_PRINT("wsrep", ("update row key"));
@@ -9519,11 +9501,9 @@ func_exit:
new_row)) {
WSREP_DEBUG("WSREP: UPDATE_ROW_KEY FAILED");
DBUG_PRINT("wsrep", ("row key failed"));
- err = HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
-wsrep_error:
#endif /* WITH_WSREP */
DBUG_RETURN(err);
@@ -9570,25 +9550,20 @@ ha_innobase::delete_row(
/* Tell the InnoDB server that there might be work for
utility threads: */
-
innobase_active_small();
#ifdef WITH_WSREP
- if (error == DB_SUCCESS &&
+ if (error == DB_SUCCESS && trx->is_wsrep() &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
- wsrep_on(user_thd) &&
!wsrep_thd_ignore_table(user_thd))
{
if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
- NULL)) {
+ NULL)) {
DBUG_PRINT("wsrep", ("delete fail"));
- error = (dberr_t) HA_ERR_INTERNAL_ERROR;
- goto wsrep_error;
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
}
-wsrep_error:
#endif /* WITH_WSREP */
-
DBUG_RETURN(convert_error_code_to_mysql(
error, prebuilt->table->flags, user_thd));
}
@@ -10844,8 +10819,7 @@ wsrep_append_foreign_key(
int cache_key_len;
bool const copy = true;
- if (!wsrep_on(trx->mysql_thd) ||
- wsrep_thd_exec_mode(thd) != LOCAL_STATE)
+ if (!trx->is_wsrep() || wsrep_thd_exec_mode(thd) != LOCAL_STATE)
return DB_SUCCESS;
if (!thd || !foreign ||
@@ -12000,10 +11974,17 @@ innobase_fts_load_stopword(
trx_t* trx, /*!< in: transaction */
THD* thd) /*!< in: current thread */
{
- return(fts_load_stopword(table, trx,
- innobase_server_stopword_table,
- THDVAR(thd, ft_user_stopword_table),
- THDVAR(thd, ft_enable_stopword), FALSE));
+ const char *stopword_table= THDVAR(thd, ft_user_stopword_table);
+ if (!stopword_table)
+ {
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ if (innobase_server_stopword_table)
+ stopword_table= thd_strdup(thd, innobase_server_stopword_table);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ }
+
+ return fts_load_stopword(table, trx, stopword_table,
+ THDVAR(thd, ft_enable_stopword), false);
}
/*****************************************************************//**
@@ -15468,12 +15449,11 @@ ha_innobase::external_lock(
THD* thd, /*!< in: handle to the user thread */
int lock_type) /*!< in: lock type */
{
- trx_t* trx;
-
DBUG_ENTER("ha_innobase::external_lock");
DBUG_PRINT("enter",("lock_type: %d", lock_type));
update_thd(thd);
+ trx_t* trx = prebuilt->trx;
/* Statement based binlogging does not work in isolation level
READ UNCOMMITTED and READ COMMITTED since the necessary
@@ -15487,22 +15467,19 @@ ha_innobase::external_lock(
&& thd_binlog_format(thd) == BINLOG_FORMAT_STMT
&& thd_binlog_filter_ok(thd)
&& thd_sqlcom_can_generate_row_events(thd)) {
- bool skip = 0;
+ bool skip = false;
+#ifdef WITH_WSREP
+ skip = trx->is_wsrep()
+ && wsrep_thd_exec_mode(thd) != LOCAL_STATE;
+#endif /* WITH_WSREP */
/* used by test case */
DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = true;);
if (!skip) {
-#ifdef WITH_WSREP
- if (!wsrep_on(thd) || wsrep_thd_exec_mode(thd) == LOCAL_STATE)
- {
-#endif /* WITH_WSREP */
- my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
- " InnoDB is limited to row-logging when "
- "transaction isolation level is "
- "READ COMMITTED or READ UNCOMMITTED.");
- DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
-#ifdef WITH_WSREP
- }
-#endif /* WITH_WSREP */
+ my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0),
+ " InnoDB is limited to row-logging when "
+ "transaction isolation level is "
+ "READ COMMITTED or READ UNCOMMITTED.");
+ DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE);
}
}
@@ -15533,8 +15510,6 @@ ha_innobase::external_lock(
}
- trx = prebuilt->trx;
-
prebuilt->sql_stat_start = TRUE;
prebuilt->hint_need_to_fetch_extra_cols = 0;
@@ -17716,7 +17691,6 @@ innodb_stopword_table_validate(
char buff[STRING_BUFFER_USUAL_SIZE];
int len = sizeof(buff);
trx_t* trx;
- int ret = 1;
ut_a(save != NULL);
ut_a(value != NULL);
@@ -17729,14 +17703,22 @@ innodb_stopword_table_validate(
/* Validate the stopword table's (if supplied) existence and
of the right format */
- if (!stopword_table_name
- || fts_valid_stopword_table(stopword_table_name)) {
- *static_cast<const char**>(save) = stopword_table_name;
- ret = 0;
- }
+ int ret = stopword_table_name && !fts_valid_stopword_table(
+ stopword_table_name);
row_mysql_unlock_data_dictionary(trx);
+ if (!ret) {
+ if (stopword_table_name == buff) {
+ ut_ad(static_cast<size_t>(len) < sizeof buff);
+ stopword_table_name = thd_strmake(thd,
+ stopword_table_name,
+ len);
+ }
+
+ *static_cast<const char**>(save) = stopword_table_name;
+ }
+
return(ret);
}
@@ -17744,9 +17726,10 @@ innodb_stopword_table_validate(
static char* innodb_ft_aux_table;
/** Update innodb_ft_aux_table_id on SET GLOBAL innodb_ft_aux_table.
+@param[in,out] thd connection
@param[out] save new value of innodb_ft_aux_table
@param[in] value user-specified value */
-static int innodb_ft_aux_table_validate(THD*, st_mysql_sys_var*,
+static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*,
void* save, st_mysql_value* value)
{
char buf[STRING_BUFFER_USUAL_SIZE];
@@ -17760,6 +17743,15 @@ static int innodb_ft_aux_table_validate(THD*, st_mysql_sys_var*,
dict_table_close(table, FALSE, FALSE);
if (id) {
innodb_ft_aux_table_id = id;
+ if (table_name == buf) {
+ ut_ad(static_cast<size_t>(len)
+ < sizeof buf);
+ table_name = thd_strmake(thd,
+ table_name,
+ len);
+ }
+
+
*static_cast<const char**>(save) = table_name;
return 0;
}
@@ -18458,52 +18450,43 @@ exit:
return;
}
-#ifdef __WIN__
-/*************************************************************//**
-Validate if passed-in "value" is a valid value for
-innodb_buffer_pool_filename. On Windows, file names with colon (:)
-are not allowed.
-
+/** Validate SET GLOBAL innodb_buffer_pool_filename.
+On Windows, file names with colon (:) are not allowed.
+@param thd connection
+@param save &srv_buf_dump_filename
+@param value new value to be validated
@return 0 for valid name */
-static
-int
-innodb_srv_buf_dump_filename_validate(
-/*==================================*/
- THD* thd, /*!< in: thread handle */
- struct st_mysql_sys_var* var, /*!< in: pointer to system
- variable */
- void* save, /*!< out: immediate result
- for update function */
- struct st_mysql_value* value) /*!< in: incoming string */
+static int innodb_srv_buf_dump_filename_validate(THD *thd, st_mysql_sys_var*,
+ void *save,
+ st_mysql_value *value)
{
- const char* buf_name;
- char buff[OS_FILE_MAX_PATH];
- int len= sizeof(buff);
-
- ut_a(save != NULL);
- ut_a(value != NULL);
-
- buf_name = value->val_str(value, buff, &len);
-
- if (buf_name) {
- if (is_filename_allowed(buf_name, len, FALSE)){
- *static_cast<const char**>(save) = buf_name;
- return(0);
- } else {
- push_warning_printf(thd,
- Sql_condition::WARN_LEVEL_WARN,
- ER_WRONG_ARGUMENTS,
- "InnoDB: innodb_buffer_pool_filename "
- "cannot have colon (:) in the file name.");
+ char buff[OS_FILE_MAX_PATH];
+ int len= sizeof buff;
- }
- }
+ if (const char *buf_name= value->val_str(value, buff, &len))
+ {
+#ifdef __WIN__
+ if (!is_filename_allowed(buf_name, len, FALSE))
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: innodb_buffer_pool_filename "
+ "cannot have colon (:) in the file name.");
+ return 1;
+ }
+#endif /* __WIN__ */
+ if (buf_name == buff)
+ {
+ ut_ad(static_cast<size_t>(len) < sizeof buff);
+ buf_name= thd_strmake(thd, buf_name, len);
+ }
+
+ *static_cast<const char**>(save)= buf_name;
+ return 0;
+ }
- return(1);
+ return 1;
}
-#else /* __WIN__ */
-# define innodb_srv_buf_dump_filename_validate NULL
-#endif /* __WIN__ */
#ifdef UNIV_DEBUG
static char* srv_buffer_pool_evict;
@@ -19392,11 +19375,14 @@ static
void
innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save)
{
- *static_cast<my_bool*>(var) = *static_cast<const my_bool*>(save);
- mysql_mutex_unlock(&LOCK_global_system_variables);
- /* Wakeup server monitor thread. */
- os_event_set(srv_monitor_event);
- mysql_mutex_lock(&LOCK_global_system_variables);
+ *static_cast<my_bool*>(var)= *static_cast<const my_bool*>(save);
+ if (srv_monitor_event)
+ {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ /* Wakeup server monitor thread. */
+ os_event_set(srv_monitor_event);
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ }
}
/** Update the system variable innodb_encryption_threads.
@@ -21006,7 +20992,7 @@ static MYSQL_SYSVAR_UINT(data_file_size_debug,
srv_sys_space_size_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"InnoDB system tablespace size to be set in recovery.",
- NULL, NULL, 0, 0, UINT_MAX32, 0);
+ NULL, NULL, 0, 0, 256U << 20, 0);
static MYSQL_SYSVAR_ULONG(fil_make_page_dirty_debug,
srv_fil_make_page_dirty_debug, PLUGIN_VAR_OPCMDARG,
@@ -21082,7 +21068,7 @@ static TYPELIB page_compression_algorithms_typelib=
};
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG,
- "Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, or bzip2",
+ "Compression algorithm used on page compression. One of: none, zlib, lz4, lzo, lzma, bzip2, or snappy",
innodb_compression_algorithm_validate, NULL,
/* We use here the largest number of supported compression method to
enable all those methods that are available. Availability of compression
@@ -21133,7 +21119,7 @@ static MYSQL_SYSVAR_UINT(encryption_threads, srv_n_fil_crypt_threads,
"scrubbing",
NULL,
innodb_encryption_threads_update,
- srv_n_fil_crypt_threads, 0, UINT_MAX32, 0);
+ 0, 0, 255, 0);
static MYSQL_SYSVAR_UINT(encryption_rotate_key_age,
srv_fil_crypt_rotate_key_age,
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 2ce30488d8c..41cd0ab37c6 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -3388,6 +3388,12 @@ err_exit:
trx_free_for_mysql(ctx->trx);
trx_commit_for_mysql(ctx->prebuilt->trx);
+ for (uint i = 0; i < ctx->num_to_add_fk; i++) {
+ if (ctx->add_fk[i]) {
+ dict_foreign_free(ctx->add_fk[i]);
+ }
+ }
+
delete ctx;
ha_alter_info->handler_ctx = NULL;
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 8eb53502da8..9813e993411 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -2553,7 +2553,7 @@ i_s_metrics_fill(
time_diff = 0;
}
- /* Unless MONITOR__NO_AVERAGE is marked, we will need
+ /* Unless MONITOR_NO_AVERAGE is set, we must
to calculate the average value. If this is a monitor set
owner marked by MONITOR_SET_OWNER, divide
the value by another counter (number of calls) designated
@@ -2561,8 +2561,9 @@ i_s_metrics_fill(
Otherwise average the counter value by the time between the
time that the counter is enabled and time it is disabled
or time it is sampled. */
- if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE)
- && (monitor_info->monitor_type & MONITOR_SET_OWNER)
+ if ((monitor_info->monitor_type
+ & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER))
+ == MONITOR_SET_OWNER
&& monitor_info->monitor_related_id) {
mon_type_t value_start
= MONITOR_VALUE_SINCE_START(
@@ -2578,18 +2579,18 @@ i_s_metrics_fill(
fields[METRIC_AVG_VALUE_START]->set_null();
}
- if (MONITOR_VALUE(monitor_info->monitor_related_id)) {
- OK(fields[METRIC_AVG_VALUE_RESET]->store(
- MONITOR_VALUE(count)
- / MONITOR_VALUE(
- monitor_info->monitor_related_id),
- FALSE));
+ if (mon_type_t related_value =
+ MONITOR_VALUE(monitor_info->monitor_related_id)) {
+ OK(fields[METRIC_AVG_VALUE_RESET]
+ ->store(MONITOR_VALUE(count)
+ / related_value, false));
+ fields[METRIC_AVG_VALUE_RESET]->set_notnull();
} else {
fields[METRIC_AVG_VALUE_RESET]->set_null();
}
- } else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE)
- && !(monitor_info->monitor_type
- & MONITOR_DISPLAY_CURRENT)) {
+ } else if (!(monitor_info->monitor_type
+ & (MONITOR_NO_AVERAGE
+ | MONITOR_DISPLAY_CURRENT))) {
if (time_diff) {
OK(fields[METRIC_AVG_VALUE_START]->store(
(double) MONITOR_VALUE_SINCE_START(
@@ -3367,6 +3368,8 @@ no_fts:
conv_str.f_len = sizeof word;
conv_str.f_str = word;
+ rw_lock_s_lock(&cache->lock);
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
@@ -3377,6 +3380,7 @@ no_fts:
index_cache, thd, &conv_str, tables));
}
+ rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index 264d1677afa..6f11daa7363 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -63,6 +63,7 @@ UNIV_INTERN my_bool srv_ibuf_disable_background_merge;
#include "que0que.h"
#include "srv0start.h" /* srv_shutdown_state */
#include "ha_prototypes.h"
+#include "ut0crc32.h"
#include "rem0cmp.h"
/* STRUCTURE OF AN INSERT BUFFER RECORD
@@ -587,7 +588,7 @@ ibuf_init_at_db_start(void)
mutex_enter(&ibuf_mutex);
- mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, NULL), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(IBUF_SPACE_ID, NULL), &mtr);
header_page = ibuf_header_page_get(&mtr);
@@ -2138,7 +2139,7 @@ ibuf_add_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
- mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
zip_size = fsp_flags_get_zip_size(flags);
header_page = ibuf_header_page_get(&mtr);
@@ -2222,7 +2223,7 @@ ibuf_remove_free_page(void)
/* Acquire the fsp latch before the ibuf header, obeying the latching
order */
- mtr_x_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(IBUF_SPACE_ID, &flags), &mtr);
zip_size = fsp_flags_get_zip_size(flags);
header_page = ibuf_header_page_get(&mtr);
@@ -2925,42 +2926,28 @@ ibuf_contract_after_insert(
} while (size > 0 && sum_sizes < entry_size);
}
-/*********************************************************************//**
-Determine if an insert buffer record has been encountered already.
-@return TRUE if a new record, FALSE if possible duplicate */
-static
-ibool
-ibuf_get_volume_buffered_hash(
-/*==========================*/
- const rec_t* rec, /*!< in: ibuf record in post-4.1 format */
- const byte* types, /*!< in: fields */
- const byte* data, /*!< in: start of user record data */
- ulint comp, /*!< in: 0=ROW_FORMAT=REDUNDANT,
- nonzero=ROW_FORMAT=COMPACT */
- ulint* hash, /*!< in/out: hash array */
- ulint size) /*!< in: number of elements in hash array */
+/** Determine if a change buffer record has been encountered already.
+@param rec change buffer record in the MySQL 5.5 format
+@param hash hash table of encountered records
+@param size number of elements in hash
+@retval true if a distinct record
+@retval false if this may be duplicating an earlier record */
+static bool ibuf_get_volume_buffered_hash(const rec_t *rec, ulint *hash,
+ ulint size)
{
- ulint len;
- ulint fold;
- ulint bitmask;
-
- len = ibuf_rec_get_size(
- rec, types,
- rec_get_n_fields_old(rec) - IBUF_REC_FIELD_USER, comp);
- fold = ut_fold_binary(data, len);
-
- hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
- bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
-
- if (*hash & bitmask) {
-
- return(FALSE);
- }
-
- /* We have not seen this record yet. Insert it. */
- *hash |= bitmask;
-
- return(TRUE);
+ ut_ad(rec_get_n_fields_old(rec) > IBUF_REC_FIELD_USER);
+ const ulint start= rec_get_field_start_offs(rec, IBUF_REC_FIELD_USER);
+ const ulint len= rec_get_data_size_old(rec) - start;
+ const uint32_t fold= ut_crc32(rec + start, len);
+ hash+= (fold / (CHAR_BIT * sizeof *hash)) % size;
+ ulint bitmask= static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
+
+ if (*hash & bitmask)
+ return false;
+
+ /* We have not seen this record yet. Remember it. */
+ *hash|= bitmask;
+ return true;
}
#ifdef UNIV_DEBUG
@@ -3052,11 +3039,7 @@ ibuf_get_volume_buffered_count_func(
case IBUF_OP_DELETE_MARK:
/* There must be a record to delete-mark.
See if this record has been already buffered. */
- if (n_recs && ibuf_get_volume_buffered_hash(
- rec, types + IBUF_REC_INFO_SIZE,
- types + len,
- types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT,
- hash, size)) {
+ if (n_recs && ibuf_get_volume_buffered_hash(rec, hash, size)) {
(*n_recs)++;
}
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index e8a82f2e3e4..39fceeef384 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1528,7 +1528,7 @@ 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 {
+struct buf_tmp_buffer_t {
private:
int32 reserved; /*!< true if this slot is reserved
*/
@@ -1558,7 +1558,7 @@ public:
return !my_atomic_fas32_explicit(&reserved, true,
MY_MEMORY_ORDER_RELAXED);
}
-} buf_tmp_buffer_t;
+};
/** The common buffer control block structure
for compressed and uncompressed frames */
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index 7256f7f119b..d8df624b5f2 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -1026,16 +1026,18 @@ dict_table_x_lock_indexes(
/*======================*/
dict_table_t* table) /*!< in: table */
{
- dict_index_t* index;
-
ut_ad(mutex_own(&dict_sys->mutex));
+ dict_index_t* clust_index = dict_table_get_first_index(table);
+
/* Loop through each index of the table and lock them */
- for (index = dict_table_get_first_index(table);
+ for (dict_index_t* index = dict_table_get_next_index(clust_index);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index));
}
+
+ rw_lock_x_lock(dict_index_get_lock(clust_index));
}
/*********************************************************************//**
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 1dcc3ebdd0c..f39c89d8e4b 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -864,6 +864,10 @@ struct dict_foreign_t{
does not generate new indexes
implicitly */
dict_index_t* referenced_index;/*!< referenced index */
+
+ /** Check whether the fulltext index gets affected by
+ foreign key constraint */
+ bool affects_fulltext() const;
};
std::ostream&
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index a4274f4d8a6..78878fa75fc 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -300,6 +300,8 @@ struct fil_space_t {
/*!< recovered tablespace size in pages;
0 if no size change was read from the redo log,
or if the size change was implemented */
+ /** the committed size of the tablespace in pages */
+ ulint committed_size;
ulint flags; /*!< FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
see fsp0fsp.h,
fsp_flags_is_valid(),
@@ -364,6 +366,15 @@ struct fil_space_t {
{
return stop_new_ops;
}
+
+ /** Clamp a page number for batched I/O, such as read-ahead.
+ @param offset page number limit
+ @return offset clamped to the tablespace size */
+ ulint max_page_number_for_io(ulint offset) const
+ {
+ const ulint limit= committed_size;
+ return limit > offset ? offset : limit;
+ }
};
/** Value of fil_space_t::magic_n */
@@ -574,16 +585,6 @@ ulint
fil_space_get_zip_size(
/*===================*/
ulint id); /*!< in: space id */
-/*******************************************************************//**
-Checks if the pair space, page_no refers to an existing page in a tablespace
-file space. The tablespace must be cached in the memory cache.
-@return TRUE if the address is meaningful */
-UNIV_INTERN
-ibool
-fil_check_adress_in_tablespace(
-/*===========================*/
- ulint id, /*!< in: space id */
- ulint page_no);/*!< in: page number */
/****************************************************************//**
Initializes the tablespace memory cache. */
UNIV_INTERN
@@ -704,34 +705,6 @@ UNIV_INTERN
void
fil_space_release_for_io(fil_space_t* space);
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in,out] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last */
-UNIV_INTERN
-fil_space_t*
-fil_space_next(
- fil_space_t* prev_space)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in,out] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system->space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-UNIV_INTERN
-fil_space_t*
-fil_space_keyrotate_next(
- fil_space_t* prev_space)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Wrapper with reference-counting for a fil_space_t. */
class FilSpace
{
diff --git a/storage/xtradb/include/fts0ast.h b/storage/xtradb/include/fts0ast.h
index b7d467e0082..b7870cbc7bc 100644
--- a/storage/xtradb/include/fts0ast.h
+++ b/storage/xtradb/include/fts0ast.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -204,19 +204,6 @@ fts_ast_visit(
operator, currently we only
ignore FTS_IGNORE operator */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/*****************************************************************//**
-Process (nested) sub-expression, create a new result set to store the
-sub-expression result by processing nodes under current sub-expression
-list. Merge the sub-expression result with that of parent expression list.
-@return DB_SUCCESS if all went well */
-UNIV_INTERN
-dberr_t
-fts_ast_visit_sub_exp(
-/*==================*/
- fts_ast_node_t* node, /*!< in: instance to traverse*/
- fts_ast_callback visitor, /*!< in: callback */
- void* arg) /*!< in: callback arg */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
/********************************************************************
Create a lex instance.*/
UNIV_INTERN
diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h
index 714f811db27..4d07ac1612f 100644
--- a/storage/xtradb/include/fts0fts.h
+++ b/storage/xtradb/include/fts0fts.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -899,21 +899,19 @@ fts_valid_stopword_table(
name */
/****************************************************************//**
This function loads specified stopword into FTS cache
-@return TRUE if success */
+@return true if success */
UNIV_INTERN
-ibool
+bool
fts_load_stopword(
/*==============*/
const dict_table_t*
table, /*!< in: Table with FTS */
trx_t* trx, /*!< in: Transaction */
- const char* global_stopword_table, /*!< in: Global stopword table
- name */
const char* session_stopword_table, /*!< in: Session stopword table
name */
- ibool stopword_is_on, /*!< in: Whether stopword
+ bool stopword_is_on, /*!< in: Whether stopword
option is turned on/off */
- ibool reload); /*!< in: Whether it is during
+ bool reload); /*!< in: Whether it is during
reload of FTS table */
/****************************************************************//**
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index 878a42ea81b..a6b6e08b68b 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -1013,8 +1014,6 @@ std::string
lock_get_info(
const lock_t*);
-#define wsrep_on_trx(trx) ((trx)->mysql_thd && wsrep_on((trx)->mysql_thd))
-
#ifndef UNIV_NONINL
#include "lock0lock.ic"
#endif
diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h
index 2d3da4d2a25..7d115eed5fd 100644
--- a/storage/xtradb/include/mtr0mtr.h
+++ b/storage/xtradb/include/mtr0mtr.h
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2013, 2020, 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
@@ -57,6 +58,7 @@ first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
#endif /* UNIV_DEBUG */
#define MTR_MEMO_S_LOCK 55
#define MTR_MEMO_X_LOCK 56
+#define MTR_MEMO_SPACE_X_LOCK 57
/** @name Log item types
The log items are declared 'byte' so that the compiler can warn if val
@@ -293,6 +295,8 @@ This macro locks an rw-lock in s-mode. */
This macro locks an rw-lock in x-mode. */
#define mtr_x_lock(B, MTR) mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))
+#define mtr_x_space_lock(B, MTR) mtr_x_space_lock_func(B, __FILE__, __LINE__,\
+ MTR)
/*********************************************************************//**
NOTE! Use the macro above!
Locks a lock in s-mode. */
@@ -315,6 +319,14 @@ mtr_x_lock_func(
const char* file, /*!< in: file name */
ulint line, /*!< in: line number */
mtr_t* mtr); /*!< in: mtr */
+
+/** Acquire exclusive tablespace latch.
+@param lock fil_space_t::latch
+@param file source code file name of the caller
+@param line source code line number of the caller
+@param mtr mini-transaction */
+inline void mtr_x_space_lock_func(prio_rw_lock_t *lock,
+ const char *file, ulint line, mtr_t *mtr);
#endif /* !UNIV_HOTBACKUP */
/***************************************************//**
diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic
index a44728463ae..0aea0994267 100644
--- a/storage/xtradb/include/mtr0mtr.ic
+++ b/storage/xtradb/include/mtr0mtr.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -78,7 +79,7 @@ mtr_memo_push(
ut_ad(object);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
- ut_ad(type <= MTR_MEMO_X_LOCK);
+ ut_ad(type <= MTR_MEMO_SPACE_X_LOCK);
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
@@ -293,4 +294,16 @@ mtr_x_lock_func(
mtr_memo_push(mtr, lock, MTR_MEMO_X_LOCK);
}
+
+/** Acquire exclusive tablespace latch.
+@param lock fil_space_t::latch
+@param file source code file name of the caller
+@param line source code line number of the caller
+@param mtr mini-transaction */
+inline void mtr_x_space_lock_func(prio_rw_lock_t *lock,
+ const char *file, ulint line, mtr_t *mtr)
+{
+ rw_lock_x_lock_inline(lock, 0, file, line);
+ mtr_memo_push(mtr, lock, MTR_MEMO_SPACE_X_LOCK);
+}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h
index 2efc2d302a1..b377aa68ac7 100644
--- a/storage/xtradb/include/page0page.h
+++ b/storage/xtradb/include/page0page.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -749,21 +749,6 @@ page_mem_alloc_free(
free record list */
ulint need); /*!< in: number of bytes allocated */
/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-UNIV_INTERN
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no);/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-/************************************************************//**
Puts a record to free list. */
UNIV_INLINE
void
diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h
index 2e25a27192e..19b4793fc7b 100644
--- a/storage/xtradb/include/sync0rw.h
+++ b/storage/xtradb/include/sync0rw.h
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -763,13 +764,6 @@ struct rw_lock_t {
/* last s-lock file/line is not guaranteed to be correct */
const char* last_s_file_name;/*!< File name where last s-locked */
const char* last_x_file_name;/*!< File name where last x-locked */
- ibool writer_is_wait_ex;
- /*!< This is TRUE if the writer field is
- RW_LOCK_WAIT_EX; this field is located far
- from the memory update hotspot fields which
- are at the start of this struct, thus we can
- peek this field without causing much memory
- bus traffic */
unsigned cline:14; /*!< Line where created */
unsigned last_s_line:14; /*!< Line number where last time s-locked */
unsigned last_x_line:14; /*!< Line number where last time x-locked */
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index e833bd0341f..2d7baff6b04 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -815,15 +815,21 @@ struct trx_t{
ro_trx_list the first time they try to acquire a lock ie. by default
we treat all read-only transactions as non-locking. */
trx_state_t state;
-
trx_lock_t lock; /*!< Information about the transaction
locks and state. Protected by
trx->mutex or lock_sys->mutex
or both */
- ulint is_recovered; /*!< 0=normal transaction,
- 1=recovered, must be rolled back,
+ bool is_recovered; /*!< false=normal transaction,
+ true=recovered, must be rolled back,
protected by trx_sys->mutex when
trx->in_rw_trx_list holds */
+#ifdef WITH_WSREP
+ /** whether wsrep_on(mysql_thd) held at the start of transaction */
+ bool wsrep;
+ bool is_wsrep() const { return UNIV_UNLIKELY(wsrep); }
+#else /* WITH_WSREP */
+ bool is_wsrep() const { return false; }
+#endif /* WITH_WSREP */
/* These fields are not protected by any mutex. */
const char* op_info; /*!< English text describing the
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 011921d9a39..61a8639691a 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 45
+#define INNODB_VERSION_BUGFIX 49
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 86.1
+#define PERCONA_INNODB_VERSION 89.0
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index c110c83cbe7..4d40111ac20 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -1770,7 +1770,7 @@ wsrep_kill_victim(
ut_ad(trx_mutex_own(lock->trx));
/* quit for native mysql */
- if (!wsrep_on(trx->mysql_thd)) return;
+ if (!trx->is_wsrep()) return;
my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE);
my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
@@ -1856,7 +1856,7 @@ lock_rec_other_has_conflicting(
#ifdef WITH_WSREP
if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) {
- if (wsrep_on_trx(trx)) {
+ if (trx->is_wsrep()) {
trx_mutex_enter(lock->trx);
/* Below function will roll back either trx
or lock->trx depending on priority of the
@@ -2318,8 +2318,7 @@ lock_rec_create(
ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted);
#ifdef WITH_WSREP
- if (c_lock &&
- wsrep_on_trx(trx) &&
+ if (c_lock && trx->is_wsrep() &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
@@ -5009,7 +5008,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
- if (c_lock && wsrep_on_trx(trx)) {
+ if (c_lock && trx->is_wsrep()) {
if (wsrep_thd_is_wsrep(trx->mysql_thd)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
UT_LIST_INSERT_AFTER(
@@ -5248,7 +5247,7 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
#ifdef WITH_WSREP
- if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
+ if (trx->lock.was_chosen_as_deadlock_victim && trx->is_wsrep()) {
return(DB_DEADLOCK);
}
diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc
index fe43ef3cc73..70ade1191d7 100644
--- a/storage/xtradb/lock/lock0wait.cc
+++ b/storage/xtradb/lock/lock0wait.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, 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
@@ -255,8 +255,7 @@ wsrep_is_BF_lock_timeout(
const trx_t* trx,
bool locked = true)
{
- if (wsrep_on_trx(trx)
- && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
+ if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
fprintf(stderr, "WSREP: BF lock wait long for trx " TRX_ID_FMT "\n", trx->id);
srv_print_innodb_monitor = TRUE;
srv_print_innodb_lock_monitor = TRUE;
@@ -447,7 +446,7 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout) {
#ifdef WITH_WSREP
- if (!wsrep_on_trx(trx) ||
+ if (!trx->is_wsrep() ||
(!wsrep_is_BF_lock_timeout(trx) &&
trx->error_state != DB_DEADLOCK)) {
#endif /* WITH_WSREP */
diff --git a/storage/xtradb/mtr/mtr0mtr.cc b/storage/xtradb/mtr/mtr0mtr.cc
index 77af6e9eb60..ce1002a00f0 100644
--- a/storage/xtradb/mtr/mtr0mtr.cc
+++ b/storage/xtradb/mtr/mtr0mtr.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2020, 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
@@ -88,6 +89,15 @@ mtr_memo_slot_release_func(
case MTR_MEMO_X_LOCK:
rw_lock_x_unlock((prio_rw_lock_t*) object);
break;
+ case MTR_MEMO_SPACE_X_LOCK:
+ {
+ fil_space_t* space = reinterpret_cast<fil_space_t*>(
+ static_cast<char*>(object)
+ - my_offsetof(fil_space_t, latch));
+ space->committed_size = space->size;
+ rw_lock_x_unlock(&space->latch);
+ }
+ break;
#ifdef UNIV_DEBUG
default:
ut_ad(slot->type == MTR_MEMO_MODIFY);
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 1e0f28d393f..66af4a39f7c 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -2716,6 +2716,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
+ case EOPNOTSUPP:
/* fall back to the code below */
break;
}
diff --git a/storage/xtradb/page/page0cur.cc b/storage/xtradb/page/page0cur.cc
index e9ac4b4bb04..94e861ab554 100644
--- a/storage/xtradb/page/page0cur.cc
+++ b/storage/xtradb/page/page0cur.cc
@@ -2,6 +2,7 @@
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2020, 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
@@ -941,6 +942,52 @@ page_cur_parse_insert_rec(
return(ptr + end_seg_len);
}
+/************************************************************//**
+Allocates a block of memory from the heap of an index page.
+@return pointer to start of allocated buffer, or NULL if allocation fails */
+static
+byte*
+page_mem_alloc_heap(
+/*================*/
+ page_t* page, /*!< in/out: index page */
+ page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
+ space available for inserting the record,
+ or NULL */
+ ulint need, /*!< in: total number of bytes needed */
+ ulint* heap_no)/*!< out: this contains the heap number
+ of the allocated record
+ if allocation succeeds */
+{
+ byte* block;
+ ulint avl_space;
+
+ ut_ad(page && heap_no);
+
+ avl_space = page_get_max_insert_size(page, 1);
+
+ if (avl_space >= need) {
+ const ulint h = page_dir_get_n_heap(page);
+ if (UNIV_UNLIKELY(h >= 8191)) {
+ /* At the minimum record size of 5+2 bytes,
+ we can only reach this condition when using
+ innodb_page_size=64k. */
+ ut_ad(srv_page_size == 65536);
+ return(NULL);
+ }
+ *heap_no = h;
+
+ block = page_header_get_ptr(page, PAGE_HEAP_TOP);
+
+ page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
+ block + need);
+ page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
+
+ return(block);
+ }
+
+ return(NULL);
+}
+
/***********************************************************//**
Inserts a record next to page cursor on an uncompressed page.
Returns pointer to inserted record if succeed, i.e., enough
diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc
index 16587f872ef..ee31c9dbd87 100644
--- a/storage/xtradb/page/page0page.cc
+++ b/storage/xtradb/page/page0page.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2018, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -240,44 +240,6 @@ page_set_max_trx_id(
}
}
-/************************************************************//**
-Allocates a block of memory from the heap of an index page.
-@return pointer to start of allocated buffer, or NULL if allocation fails */
-UNIV_INTERN
-byte*
-page_mem_alloc_heap(
-/*================*/
- page_t* page, /*!< in/out: index page */
- page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
- space available for inserting the record,
- or NULL */
- ulint need, /*!< in: total number of bytes needed */
- ulint* heap_no)/*!< out: this contains the heap number
- of the allocated record
- if allocation succeeds */
-{
- byte* block;
- ulint avl_space;
-
- ut_ad(page && heap_no);
-
- avl_space = page_get_max_insert_size(page, 1);
-
- if (avl_space >= need) {
- block = page_header_get_ptr(page, PAGE_HEAP_TOP);
-
- page_header_set_ptr(page, page_zip, PAGE_HEAP_TOP,
- block + need);
- *heap_no = page_dir_get_n_heap(page);
-
- page_dir_set_n_heap(page, page_zip, 1 + *heap_no);
-
- return(block);
- }
-
- return(NULL);
-}
-
#ifndef UNIV_HOTBACKUP
/**********************************************************//**
Writes a log record of page creation. */
diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc
index 0c7f9b6feff..d85594c5ce3 100644
--- a/storage/xtradb/page/page0zip.cc
+++ b/storage/xtradb/page/page0zip.cc
@@ -4927,35 +4927,28 @@ page_zip_verify_checksum(
ib_uint32_t crc32 = 0 /* silence bogus warning */;
ib_uint32_t innodb = 0 /* silence bogus warning */;
- stored = static_cast<ib_uint32_t>(mach_read_from_4(
- static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
+ const srv_checksum_algorithm_t curr_algo =
+ static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
-#if FIL_PAGE_LSN % 8
-#error "FIL_PAGE_LSN must be 64 bit aligned"
-#endif
+ if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
+ return true;
+ }
- /* Check if page is empty */
- if (stored == 0
- && *reinterpret_cast<const ib_uint64_t*>(static_cast<const char*>(
- data)
- + FIL_PAGE_LSN) == 0) {
- /* make sure that the page is really empty */
- for (ulint i = 0; i < size; i++) {
- if (*((const char*) data + i) != 0) {
- return(FALSE);
- }
+ bool all_zeroes = true;
+ for (size_t i = 0; i < size; i++) {
+ if (static_cast<const byte*>(data)[i] != 0) {
+ all_zeroes = false;
+ break;
}
- /* Empty page */
- return(TRUE);
}
- const srv_checksum_algorithm_t curr_algo =
- static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
-
- if (curr_algo == SRV_CHECKSUM_ALGORITHM_NONE) {
- return(TRUE);
+ if (all_zeroes) {
+ return true;
}
+ stored = static_cast<ib_uint32_t>(mach_read_from_4(
+ static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
+
calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
data, size, curr_algo));
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 5a3a86ae02c..f3375f838ba 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -561,14 +561,6 @@ protected:
/** Space id of the file being iterated over. */
ulint m_space;
- /** Minimum page number for which the free list has not been
- initialized: the pages >= this limit are, by definition, free;
- note that in a single-table tablespace where size < 64 pages,
- this number is 64, i.e., we have initialized the space about
- the first extent, but have not physically allocted those pages
- to the file. @see FSP_LIMIT. */
- ulint m_free_limit;
-
/** Current size of the space in pages */
ulint m_size;
@@ -647,7 +639,6 @@ AbstractCallback::init(
ut_a(m_space == ULINT_UNDEFINED);
m_size = mach_read_from_4(page + FSP_SIZE);
- m_free_limit = mach_read_from_4(page + FSP_FREE_LIMIT);
m_space = mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SPACE_ID);
return set_current_xdes(0, page);
@@ -1353,8 +1344,8 @@ uncompressed:
return(DB_ERROR);
} else if (m_table->n_cols != m_n_cols) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Number of columns don't match, table has %u"
- " columns but the tablespace meta-data file has "
+ "Number of columns don't match, table has %u "
+ "columns but the tablespace meta-data file has "
ULINTPF " columns",
m_table->n_cols, m_n_cols);
@@ -1924,6 +1915,23 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
+ if (m_index && block->page.offset == m_index->m_page_no) {
+ byte *b = FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + FSEG_HDR_SPACE
+ + page;
+ mach_write_to_4(b, block->page.space);
+
+ memcpy(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + FSEG_HDR_SPACE
+ + page, b, 4);
+ if (UNIV_LIKELY_NULL(block->page.zip.data)) {
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_TOP
+ + FSEG_HDR_SPACE], b, 4);
+ memcpy(&block->page.zip.data[FIL_PAGE_DATA
+ + PAGE_BTR_SEG_LEAF
+ + FSEG_HDR_SPACE], b, 4);
+ }
+ }
+
#ifdef UNIV_ZIP_DEBUG
ut_a(!is_compressed_table()
|| page_zip_validate(m_page_zip_ptr, page, m_index->m_srv_index));
diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc
index 50da7fb40ad..c78f5bc8dc4 100644
--- a/storage/xtradb/row/row0ins.cc
+++ b/storage/xtradb/row/row0ins.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -516,7 +516,7 @@ row_ins_cascade_calc_update_vec(
n_fields_updated = 0;
- *fts_col_affected = FALSE;
+ *fts_col_affected = foreign->affects_fulltext();
if (table->fts) {
doc_id_pos = dict_table_get_nth_col_pos(
@@ -637,16 +637,6 @@ row_ins_cascade_calc_update_vec(
padded_data, min_size);
}
- /* Check whether the current column has
- FTS index on it */
- if (table->fts
- && dict_table_is_fts_column(
- table->fts->indexes,
- dict_col_get_no(col))
- != ULINT_UNDEFINED) {
- *fts_col_affected = TRUE;
- }
-
/* If Doc ID is updated, check whether the
Doc ID is valid */
if (table->fts
@@ -983,7 +973,6 @@ row_ins_foreign_check_on_constraint(
upd_t* update;
ulint n_to_update;
dberr_t err;
- ulint i;
trx_t* trx;
mem_heap_t* tmp_heap = NULL;
doc_id_t doc_id = FTS_NULL_DOC_ID;
@@ -1197,7 +1186,7 @@ row_ins_foreign_check_on_constraint(
UNIV_MEM_INVALID(update->fields,
update->n_fields * sizeof *update->fields);
- for (i = 0; i < foreign->n_fields; i++) {
+ for (ulint i = 0; i < foreign->n_fields; i++) {
upd_field_t* ufield = &update->fields[i];
ufield->field_no = dict_table_get_nth_col_pos(
@@ -1206,32 +1195,14 @@ row_ins_foreign_check_on_constraint(
ufield->orig_len = 0;
ufield->exp = NULL;
dfield_set_null(&ufield->new_val);
-
- if (table->fts && dict_table_is_fts_column(
- table->fts->indexes,
- dict_index_get_nth_col_no(index, i))
- != ULINT_UNDEFINED) {
- fts_col_affacted = TRUE;
- }
}
- if (fts_col_affacted) {
- fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
- }
- } else if (table->fts && cascade->is_delete) {
- /* DICT_FOREIGN_ON_DELETE_CASCADE case */
- for (i = 0; i < foreign->n_fields; i++) {
- if (table->fts && dict_table_is_fts_column(
- table->fts->indexes,
- dict_index_get_nth_col_no(index, i))
- != ULINT_UNDEFINED) {
- fts_col_affacted = TRUE;
- }
- }
-
- if (fts_col_affacted) {
+ if (foreign->affects_fulltext()) {
fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
+ } else if (table->fts && cascade->is_delete
+ && foreign->affects_fulltext()) {
+ fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL);
}
if (!node->is_delete
@@ -1651,7 +1622,7 @@ run_again:
if (check_ref) {
err = DB_SUCCESS;
#ifdef WITH_WSREP
- if (!wsrep_on(trx->mysql_thd)) {
+ if (!trx->is_wsrep()) {
goto end_scan;
}
enum wsrep_key_type key_type;
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index b5bd626db63..587fcda27b1 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -3209,6 +3209,16 @@ row_discard_tablespace_for_mysql(
err = DB_ERROR;
} else {
+ bool fts_exist = (dict_table_has_fts_index(table)
+ || DICT_TF2_FLAG_IS_SET(
+ table, DICT_TF2_FTS_HAS_DOC_ID));
+
+ if (fts_exist) {
+ row_mysql_unlock_data_dictionary(trx);
+ fts_optimize_remove_table(table);
+ row_mysql_lock_data_dictionary(trx);
+ }
+
/* Do foreign key constraint checks. */
err = row_discard_tablespace_foreign_key_checks(trx, table);
@@ -3216,6 +3226,11 @@ row_discard_tablespace_for_mysql(
if (err == DB_SUCCESS) {
err = row_discard_tablespace(trx, table);
}
+
+ if (fts_exist && err != DB_SUCCESS) {
+ fts_optimize_add_table(table);
+ }
+
}
return(row_discard_tablespace_end(trx, table, err));
diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc
index c9c7f1dd9c1..a968fc83243 100644
--- a/storage/xtradb/row/row0sel.cc
+++ b/storage/xtradb/row/row0sel.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3740,9 +3740,16 @@ bool row_search_with_covering_prefix(
return false;
}
+ /* We can avoid a clustered index lookup if
+ all of the following hold:
+ (1) all columns are in the secondary index
+ (2) all values for columns that are prefix-only
+ indexes are shorter than the prefix size
+ This optimization can avoid many IOs for certain schemas. */
for (ulint i = 0; i < prebuilt->n_template; i++) {
mysql_row_templ_t* templ = prebuilt->mysql_template + i;
ulint j = templ->rec_prefix_field_no;
+ ut_ad(!templ->mbminlen == !templ->mbmaxlen);
/** Condition (1) : is the field in the index. */
if (j == ULINT_UNDEFINED) {
@@ -3752,34 +3759,29 @@ bool row_search_with_covering_prefix(
/** Condition (2): If this is a prefix index then
row's value size shorter than prefix length. */
- if (!templ->rec_field_is_prefix) {
+ if (!templ->rec_field_is_prefix
+ || rec_offs_nth_sql_null(offsets, j)) {
continue;
}
- ulint rec_size = rec_offs_nth_size(offsets, j);
const dict_field_t* field = dict_index_get_nth_field(index, j);
- ulint max_chars = field->prefix_len / templ->mbmaxlen;
- ut_a(field->prefix_len > 0);
-
- if (rec_size < max_chars) {
- /* Record in bytes shorter than the index
- prefix length in char. */
+ if (!field->prefix_len) {
continue;
}
- if (rec_size * templ->mbminlen >= field->prefix_len) {
+ const ulint rec_size = rec_offs_nth_size(offsets, j);
+
+ if (rec_size >= field->prefix_len) {
/* Shortest representation string by the
byte length of the record is longer than the
maximum possible index prefix. */
return false;
}
-
- size_t num_chars = rec_field_len_in_chars(
- field->col, j, rec, offsets);
-
- if (num_chars >= max_chars) {
+ if (templ->mbminlen != templ->mbmaxlen
+ && rec_field_len_in_chars(field->col, j, rec, offsets)
+ >= field->prefix_len / templ->mbmaxlen) {
/* No of chars to store the record exceeds
the index prefix character length. */
return false;
diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc
index 6324c1d71a1..a5e5988113d 100644
--- a/storage/xtradb/row/row0upd.cc
+++ b/storage/xtradb/row/row0upd.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -1814,7 +1814,7 @@ row_upd_store_row(
inline bool wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx)
{
- if (!wsrep_on_trx(trx)) {
+ if (!trx->is_wsrep()) {
return false;
}
return que_node_get_type(node->common.parent) != QUE_NODE_UPDATE
diff --git a/storage/xtradb/srv/srv0conc.cc b/storage/xtradb/srv/srv0conc.cc
index 1a198fceaec..1a2a6e0342f 100644
--- a/storage/xtradb/srv/srv0conc.cc
+++ b/storage/xtradb/srv/srv0conc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -218,8 +218,7 @@ srv_conc_enter_innodb_with_atomics(
for (;;) {
ulint sleep_in_us;
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_trx_is_aborting(trx->mysql_thd)) {
+ if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
if (wsrep_debug)
fprintf(stderr,
"srv_conc_enter due to MUST_ABORT");
@@ -430,8 +429,7 @@ retry:
return;
}
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_thd_is_brute_force(trx->mysql_thd)) {
+ if (trx->is_wsrep() && wsrep_thd_is_brute_force(trx->mysql_thd)) {
srv_conc_force_enter_innodb(trx);
return;
}
@@ -514,8 +512,7 @@ retry:
srv_conc.n_waiting++;
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- wsrep_trx_is_aborting(trx->mysql_thd)) {
+ if (trx->is_wsrep() && wsrep_trx_is_aborting(trx->mysql_thd)) {
os_fast_mutex_unlock(&srv_conc_mutex);
if (wsrep_debug)
fprintf(stderr, "srv_conc_enter due to MUST_ABORT");
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 8e534714ce8..91234a0cca8 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/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, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -673,7 +673,6 @@ current_time % 60 == 0 and no tasks will be performed when
current_time % 5 != 0. */
# define SRV_MASTER_CHECKPOINT_INTERVAL (7)
-# define SRV_MASTER_PURGE_INTERVAL (10)
#ifdef MEM_PERIODIC_CHECK
# define SRV_MASTER_MEM_VALIDATE_INTERVAL (13)
#endif /* MEM_PERIODIC_CHECK */
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index 6ea430699d4..0ad755c1e3a 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1240,6 +1240,10 @@ check_first_page:
}
}
+ if (fil_space_t* s = fil_space_get(0)) {
+ s->committed_size = s->size;
+ }
+
return(DB_SUCCESS);
}
@@ -1408,6 +1412,10 @@ srv_undo_tablespace_open(
if (fil_node_create(name, (ulint) n_pages, space, FALSE)) {
err = DB_SUCCESS;
}
+
+ if (fil_space_t* s = fil_space_get(space)) {
+ s->committed_size = n_pages;
+ }
}
return(err);
diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc
index c085e8ebcf5..4de46089790 100644
--- a/storage/xtradb/sync/sync0arr.cc
+++ b/storage/xtradb/sync/sync0arr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1164,7 +1164,7 @@ sync_array_print_long_waits(
sync_array_exit(arr);
}
- if (noticed) {
+ if (noticed && srv_monitor_event) {
ibool old_val;
fprintf(stderr,
diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc
index 97f08d1fa0c..7624d92a831 100644
--- a/storage/xtradb/trx/trx0roll.cc
+++ b/storage/xtradb/trx/trx0roll.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2019, MariaDB Corporation.
+Copyright (c) 2016, 2020, 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
@@ -379,8 +379,7 @@ trx_rollback_to_savepoint_for_mysql_low(
trx->op_info = "";
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd) &&
- trx->lock.was_chosen_as_deadlock_victim) {
+ if (trx->is_wsrep()) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif
@@ -1083,12 +1082,6 @@ trx_roll_try_truncate(
if (trx->update_undo) {
trx_undo_truncate_end(trx, trx->update_undo, limit);
}
-
-#ifdef WITH_WSREP_OUT
- if (wsrep_on(trx->mysql_thd)) {
- trx->lock.was_chosen_as_deadlock_victim = FALSE;
- }
-#endif /* WITH_WSREP */
}
/***********************************************************************//**
diff --git a/storage/xtradb/trx/trx0rseg.cc b/storage/xtradb/trx/trx0rseg.cc
index 1d0eb6d29fd..8ce6fb6729f 100644
--- a/storage/xtradb/trx/trx0rseg.cc
+++ b/storage/xtradb/trx/trx0rseg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -65,7 +65,7 @@ trx_rseg_header_create(
ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space, NULL),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_SPACE_X_LOCK));
/* Allocate a new file segment for the rollback segment */
block = fseg_create(space, 0, TRX_RSEG + TRX_RSEG_FSEG_HEADER, mtr);
@@ -312,7 +312,7 @@ trx_rseg_create(ulint space)
/* To obey the latching order, acquire the file space
x-latch before the trx_sys->mutex. */
- mtr_x_lock(fil_space_get_latch(space, NULL), &mtr);
+ mtr_x_space_lock(fil_space_get_latch(space, NULL), &mtr);
slot_no = trx_sysf_rseg_find_free(&mtr);
diff --git a/storage/xtradb/trx/trx0sys.cc b/storage/xtradb/trx/trx0sys.cc
index fcdce291cf0..94a79a1f944 100644
--- a/storage/xtradb/trx/trx0sys.cc
+++ b/storage/xtradb/trx/trx0sys.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -554,7 +554,7 @@ trx_sysf_create(
then enter the kernel: we must do it in this order to conform
to the latching order rules. */
- mtr_x_lock(fil_space_get_latch(TRX_SYS_SPACE, NULL), mtr);
+ mtr_x_space_lock(fil_space_get_latch(TRX_SYS_SPACE, NULL), mtr);
/* Create the trx sys file block in a new allocated file segment */
block = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index a65132cf572..bfbd15d62a2 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2019, MariaDB Corporation.
+Copyright (c) 2015, 2020, 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
@@ -1555,11 +1555,7 @@ trx_commit_in_memory(
ut_ad(!trx->in_ro_trx_list);
ut_ad(!trx->in_rw_trx_list);
-#ifdef WITH_WSREP
- if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
- trx->lock.was_chosen_as_deadlock_victim = FALSE;
- }
-#endif
+ trx->lock.was_chosen_as_deadlock_victim = FALSE;
trx->dict_operation = TRX_DICT_OP_NONE;
trx->error_state = DB_SUCCESS;
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 3bcd29bbb8b..cabc940065b 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 2020, 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
@@ -407,7 +407,9 @@ my_copy_fix_mb(CHARSET_INFO *cs,
src, src + src_length,
nchars, status);
DBUG_ASSERT(well_formed_nchars <= nchars);
- memmove(dst, src, (well_formed_length= status->m_source_end_pos - src));
+ well_formed_length= status->m_source_end_pos - src;
+ if (well_formed_length)
+ memmove(dst, src, well_formed_length);
if (!status->m_well_formed_error_pos)
return well_formed_length;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 1c382de5e28..3254be51740 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1598,7 +1598,8 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
int shift= 0, digits= 0, negative, addon;
/* Skip leading spaces and tabs */
- for ( ; str < end && (*str == ' ' || *str == '\t') ; str++);
+ for ( ; str < end && my_isspace(&my_charset_latin1, *str) ; )
+ str++;
if (str >= end)
goto ret_edom;
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index f229bbf7323..c5182911c4a 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -827,7 +827,7 @@ my_strtoll10_mb2(CHARSET_INFO *cs __attribute__((unused)),
const char *nptr, char **endptr, int *error)
{
const uchar *s, *end, *start, *n_end, *true_end;
- uchar c;
+ uchar UNINIT_VAR(c);
unsigned long i, j, k;
ulonglong li;
int negative;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 44dc3d2e02d..8f3b1224404 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -5159,8 +5159,8 @@ static size_t my_caseup_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
}
-static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
- ulong *nr1, ulong *nr2)
+static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
+ ulong *nr1, ulong *nr2)
{
my_wc_t wc;
int res;
@@ -5179,17 +5179,15 @@ static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t sle
}
-static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen,
- ulong *nr1, ulong *nr2)
+static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen,
+ ulong *nr1, ulong *nr2)
{
- const uchar *e= s+slen;
/*
Remove end space. We have to do this to be able to compare
'A ' and 'A' as identical
*/
- while (e > s && e[-1] == ' ')
- e--;
- my_hash_sort_utf8_nopad(cs, s, e - s, nr1, nr2);
+ const uchar *e= skip_trailing_space(s, slen);
+ my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2);
}
@@ -5540,7 +5538,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
my_wildcmp_utf8,
my_strcasecmp_utf8,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
@@ -5556,7 +5554,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_mysql500_ci_handler =
my_wildcmp_utf8,
my_strcasecmp_utf8,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
@@ -5588,7 +5586,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_nopad_ci_handler =
my_wildcmp_utf8,
my_strcasecmp_utf8,
my_instr_mb,
- my_hash_sort_utf8_nopad,
+ my_hash_sort_utf8mb3_nopad,
my_propagate_complex
};
@@ -7224,7 +7222,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
my_wildcmp_utf8,
my_strcasecmp_utf8,
my_instr_mb,
- my_hash_sort_utf8,
+ my_hash_sort_utf8mb3,
my_propagate_complex
};
@@ -7625,13 +7623,11 @@ static void
my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
- const uchar *e= s + slen;
/*
Remove end space. We do this to be able to compare
'A ' and 'A' as identical
*/
- while (e > s && e[-1] == ' ')
- e--;
+ const uchar *e= skip_trailing_space(s, slen);
my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2);
}
diff --git a/strings/decimal.c b/strings/decimal.c
index 21af3dc8882..2dd7c960a3e 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -812,6 +812,24 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
while (s < end_of_string && my_isdigit(&my_charset_latin1, *s))
s++;
intg= (int) (s-s1);
+ /*
+ If the integer part is long enough and it has multiple leading zeros,
+ let's trim them, so this expression can return 1 without overflowing:
+ CAST(CONCAT(REPEAT('0',90),'1') AS DECIMAL(10))
+ */
+ if (intg > DIG_PER_DEC1 && s1[0] == '0' && s1[1] == '0')
+ {
+ /*
+ Keep at least one digit, to avoid an empty string.
+ So we trim '0000' to '0' rather than to ''.
+ Otherwise the below code (converting digits to to->buf)
+ would fail on a fatal error.
+ */
+ const char *iend= s - 1;
+ for ( ; s1 < iend && *s1 == '0'; s1++)
+ { }
+ intg= (int) (s-s1);
+ }
if (s < end_of_string && *s=='.')
{
endp= s+1;
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 3ce9b0c503f..3c455c3572c 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -890,7 +890,7 @@ int json_read_keyname_chr(json_engine_t *j)
case S_QUOTE:
for (;;) /* Skip spaces until ':'. */
{
- if ((c_len= json_next_char(&j->s) > 0))
+ if ((c_len= json_next_char(&j->s)) > 0)
{
if (j->s.c_next == ':')
{
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index ea556cea127..c6ba5666dde 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -98,18 +98,25 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
if (endptr)
{
end= *endptr;
- while (s != end && (*s == ' ' || *s == '\t'))
+ /* Skip leading spaces */
+ for ( ; s < end && my_isspace(&my_charset_latin1, *s) ; )
s++;
+
if (s == end)
goto no_conv;
}
else
{
endptr= &dummy; /* Easier end test */
- while (*s == ' ' || *s == '\t')
- s++;
- if (!*s)
- goto no_conv;
+ /* Skip leading spaces */
+ for ( ; ; s++)
+ {
+ if (!*s)
+ goto no_conv;
+ if (!my_isspace(&my_charset_latin1, *s))
+ break;
+ }
+
/* This number must be big to guard against a lot of pre-zeros */
end= s+65535; /* Can't be longer than this */
}
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index ad3517e4252..fd2de08a38a 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
+ Copyright (c) 2009, 2020, 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
@@ -153,12 +153,15 @@ static const char *check_longlong(const char *fmt, uint *have_longlong)
*/
static char *backtick_string(CHARSET_INFO *cs, char *to, const char *end,
- char *par, size_t par_len, char quote_char)
+ char *par, size_t par_len, char quote_char,
+ my_bool cut)
{
+ char *last[3]= {0,0,0};
uint char_len;
char *start= to;
char *par_end= par + par_len;
size_t buff_length= (size_t) (end - to);
+ uint index= 0;
if (buff_length <= par_len)
goto err;
@@ -167,6 +170,11 @@ static char *backtick_string(CHARSET_INFO *cs, char *to, const char *end,
for ( ; par < par_end; par+= char_len)
{
uchar c= *(uchar *) par;
+ if (cut)
+ {
+ last[index]= start;
+ index= (index + 1) % 3;
+ }
char_len= my_charlen_fix(cs, par, par_end);
if (char_len == 1 && c == (uchar) quote_char )
{
@@ -178,9 +186,30 @@ static char *backtick_string(CHARSET_INFO *cs, char *to, const char *end,
goto err;
start= strnmov(start, par, char_len);
}
-
+
if (start + 1 >= end)
goto err;
+
+ if (cut)
+ {
+ uint dots= 0;
+ start= NULL;
+ for (; dots < 3; dots++)
+ {
+ if (index == 0)
+ index= 2;
+ else
+ index--;
+ if (!last[index])
+ break;
+ start= last[index];
+ }
+ if (start == NULL)
+ goto err; // there was no characters at all
+ for (; dots; dots--)
+ *start++= '.';
+
+ }
*start++= quote_char;
return start;
@@ -195,21 +224,59 @@ err:
*/
static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
- size_t width, char *par, uint print_type)
+ size_t width, char *par, uint print_type,
+ my_bool nice_cut)
{
int well_formed_error;
- size_t plen, left_len= (size_t) (end - to) + 1;
+ uint dots= 0;
+ size_t plen, left_len= (size_t) (end - to) + 1, slen=0;
if (!par)
par = (char*) "(null)";
- plen= strnlen(par, width);
- if (left_len <= plen)
- plen = left_len - 1;
+ if (nice_cut)
+ {
+ plen= slen= strnlen(par, width + 1);
+ if (plen > width)
+ plen= width;
+ if (left_len <= plen)
+ plen = left_len - 1;
+ if ((slen > plen))
+ {
+ if (plen < 3)
+ {
+ dots= (uint) plen;
+ plen= 0;
+ }
+ else
+ {
+ dots= 3;
+ plen-= 3;
+ }
+ }
+ }
+ else
+ {
+ plen= slen= strnlen(par, width);
+ dots= 0;
+ if (left_len <= plen)
+ plen = left_len - 1;
+ }
+
plen= my_well_formed_length(cs, par, par + plen, width, &well_formed_error);
if (print_type & ESCAPED_ARG)
- to= backtick_string(cs, to, end, par, plen, '`');
+ {
+ to= backtick_string(cs, to, end, par, plen + dots, '`', MY_TEST(dots));
+ dots= 0;
+ }
else
to= strnmov(to,par,plen);
+
+ if (dots)
+ {
+ for (; dots; dots--)
+ *(to++)= '.';
+ *(to)= 0;
+ }
return to;
}
@@ -390,6 +457,7 @@ start:
switch (args_arr[i].arg_type) {
case 's':
case 'b':
+ case 'T':
args_arr[i].str_arg= va_arg(ap, char *);
break;
case 'f':
@@ -424,12 +492,14 @@ start:
size_t width= 0, length= 0;
switch (print_arr[i].arg_type) {
case 's':
+ case 'T':
{
char *par= args_arr[print_arr[i].arg_idx].str_arg;
width= (print_arr[i].flags & WIDTH_ARG)
? (size_t)args_arr[print_arr[i].width].longlong_arg
: print_arr[i].width;
- to= process_str_arg(cs, to, end, width, par, print_arr[i].flags);
+ to= process_str_arg(cs, to, end, width, par, print_arr[i].flags,
+ (print_arr[i].arg_type == 'T'));
break;
}
case 'b':
@@ -496,7 +566,7 @@ start:
*to++= '"';
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
to= process_str_arg(cs, to, real_end, width, errmsg_buff,
- print_arr[i].flags);
+ print_arr[i].flags, 1);
if (real_end > to) *to++= '"';
}
break;
@@ -620,10 +690,10 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
fmt= check_longlong(fmt, &have_longlong);
- if (*fmt == 's') /* String parameter */
+ if (*fmt == 's' || *fmt == 'T') /* String parameter */
{
reg2 char *par= va_arg(ap, char *);
- to= process_str_arg(cs, to, end, width, par, print_type);
+ to= process_str_arg(cs, to, end, width, par, print_type, (*fmt == 'T'));
continue;
}
else if (*fmt == 'b') /* Buffer parameter */
@@ -634,7 +704,13 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
}
else if (*fmt == 'f' || *fmt == 'g')
{
+#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
+ __msan_check_mem_is_initialized(ap, sizeof(double));
+#endif
double d= va_arg(ap, double);
+#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
+ __msan_unpoison(&d, sizeof(double));
+#endif
to= process_dbl_arg(to, end, width, d, *fmt);
continue;
}
@@ -675,7 +751,8 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
*to++= ' ';
*to++= '"';
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
- to= process_str_arg(cs, to, real_end, width, errmsg_buff, print_type);
+ to= process_str_arg(cs, to, real_end, width, errmsg_buff,
+ print_type, 1);
if (real_end > to) *to++= '"';
}
continue;
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 6ab84b59b29..038e7163901 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -100,7 +100,7 @@ IF(UNIX)
ENDIF()
CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_SHAREDIR}/pkgconfig COMPONENT Development)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_LIBDIR}/pkgconfig COMPONENT Development)
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
@@ -123,21 +123,6 @@ IF(UNIX)
${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
- IF(INSTALL_SYSTEMD_SYSUSERSDIR)
- CONFIGURE_FILE(sysusers.conf.in
- ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
- DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} COMPONENT Server)
- ENDIF()
-
- IF(INSTALL_SYSTEMD_TMPFILESDIR)
- get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
- CONFIGURE_FILE(tmpfiles.conf.in
- ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
- DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} COMPONENT Server)
- ENDIF()
-
# @ in directory name broken between CMake version 2.8.12.2 and 3.3
# http://public.kitware.com/Bug/view.php?id=14782
IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
@@ -164,6 +149,26 @@ IF(UNIX)
ENDIF()
ENDIF()
+ # Allow installing sysusers and tmpusers without requiring SYSTEMD on the
+ # system. This is useful for distributions running other init systems to
+ # parse these files and create appropriate users & tmpfiles.
+ IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_SYSUSERS) AND INSTALL_SYSTEMD_SYSUSERSDIR)
+ CONFIGURE_FILE(sysusers.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
+ DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR}
+ RENAME mariadb.conf COMPONENT Server)
+ ENDIF()
+
+ IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_TMPUSERS) AND INSTALL_SYSTEMD_TMPFILESDIR)
+ get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
+ CONFIGURE_FILE(tmpfiles.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
+ DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR}
+ RENAME mariadb.conf COMPONENT Server)
+ ENDIF()
+
IF (INSTALL_SYSCONFDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d
RENAME mysql COMPONENT SupportFiles)
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
index bc84a5c5c4c..7d321f28491 100644
--- a/support-files/mariadb.pc.in
+++ b/support-files/mariadb.pc.in
@@ -20,4 +20,4 @@ Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
URL: @CPACK_PACKAGE_URL@
Version: @VERSION@
Libs: -L${libdir} @LIBS_FOR_CLIENTS@
-Cflags: -I${includedir} -I${includedir}/.. @CFLAGS_FOR_CLIENTS@
+Cflags: -I${includedir} @CFLAGS_FOR_CLIENTS@
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index e7976a8f3e2..245c506c117 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -75,7 +75,7 @@ PermissionsStartOnly=true
# Do not panic if galera_recovery script is not available. (MDEV-10538)
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION"
ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
- VAR=`@bindir@/galera_recovery`; [ $? -eq 0 ] \
+ VAR=`cd @bindir@/..; @bindir@/galera_recovery`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1"
# Needed to create system tables etc.
@@ -128,14 +128,21 @@ UMask=007
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=false
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# Galera might need a longer timeout, check the KB if you want to change this:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
##
## Options previously available to be set via [mysqld_safe]
## that now needs to be set by systemd config files as mysqld_safe
## isn't executed.
##
-# Number of files limit. previously [mysqld_safe] open-file-limit
-LimitNOFILE=16364
+# Number of files limit. previously [mysqld_safe] open-files-limit
+LimitNOFILE=16384
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index 7a79a143778..a487e22521b 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -84,14 +84,14 @@ PermissionsStartOnly=true
ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I"
ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
- VAR=`@bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \
+ VAR=`cd @bindir@/..; @bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \
&& systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1"
# Alternate: (remove ConditionPathExists above)
# use [mysqld.INSTANCENAME] as sections in my.cnf
#
#ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \
-# VAR=`@bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \
+# VAR=`cd @bindir@/..; @bindir@/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \
# && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1"
# Needed to create system tables etc.
@@ -154,14 +154,21 @@ UMask=007
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=false
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# if you need a longer timeout, check the KB:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
##
## Options previously available to be set via [mysqld_safe]
## that now needs to be set by systemd config files as mysqld_safe
## isn't executed.
##
-# Number of files limit. previously [mysqld_safe] open-file-limit
-LimitNOFILE=16364
+# Number of files limit. previously [mysqld_safe] open-files-limit
+LimitNOFILE=16384
# Maximium core size. previously [mysqld_safe] core-file-size
# LimitCore=
diff --git a/support-files/rpm/my.cnf b/support-files/rpm/my.cnf
index 913b88f8328..5cda317d29e 100644
--- a/support-files/rpm/my.cnf
+++ b/support-files/rpm/my.cnf
@@ -1,11 +1,11 @@
#
-# This group is read both both by the client and the server
+# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
#
-# include all files from the config directory
+# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d
diff --git a/support-files/use_galera_new_cluster.conf b/support-files/use_galera_new_cluster.conf
index 4d8ad253ce5..79d191094d4 100644
--- a/support-files/use_galera_new_cluster.conf
+++ b/support-files/use_galera_new_cluster.conf
@@ -15,6 +15,7 @@ ConditionPathExists=
Type=oneshot
Restart=no
+# Don't install or try to prepare for galera SST.
ExecStartPre=
# Override the multi instance service for a bootstrap start instance
@@ -22,4 +23,5 @@ ExecStart=
ExecStart=/usr/bin/echo "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster"
ExecStart=/usr/bin/false
+# This isn't a service meant to execute anything but a message
ExecStartPost=
diff --git a/tests/big_record.pl b/tests/big_record.pl
index cb1f8998468..b08f7ea60e2 100755
--- a/tests/big_record.pl
+++ b/tests/big_record.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/tests/drop_test.pl b/tests/drop_test.pl
index 329f65eb65d..6ed05abb7ab 100755
--- a/tests/drop_test.pl
+++ b/tests/drop_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000 MySQL AB
# Use is subject to license terms
diff --git a/tests/export.pl b/tests/export.pl
index f99798ecac8..dace79feb30 100755
--- a/tests/export.pl
+++ b/tests/export.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/fork2_test.pl b/tests/fork2_test.pl
index 356055733fa..55e494dcedc 100755
--- a/tests/fork2_test.pl
+++ b/tests/fork2_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index 623377ab5cd..bd048e8fcb0 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
use strict;
# Copyright (c) 2001, 2006 MySQL AB
diff --git a/tests/fork_big2.pl b/tests/fork_big2.pl
index c844d290834..d0c17af8cb1 100644
--- a/tests/fork_big2.pl
+++ b/tests/fork_big2.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (c) 2002, 2003, 2005, 2006 MySQL AB
# Use is subject to license terms
diff --git a/tests/grant.pl b/tests/grant.pl
index cd651643316..b50481a93fc 100755
--- a/tests/grant.pl
+++ b/tests/grant.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/tests/index_corrupt.pl b/tests/index_corrupt.pl
index 6b04ce8a59c..e40bb7afdbb 100755
--- a/tests/index_corrupt.pl
+++ b/tests/index_corrupt.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2005 MySQL AB
# Use is subject to license terms
diff --git a/tests/insert_and_repair.pl b/tests/insert_and_repair.pl
index 18091c92718..a8e74e5f30e 100755
--- a/tests/insert_and_repair.pl
+++ b/tests/insert_and_repair.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/lock_test.pl b/tests/lock_test.pl
index 98c4ad6377d..8a8a0322467 100755
--- a/tests/lock_test.pl
+++ b/tests/lock_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000 MySQL AB
# Use is subject to license terms
diff --git a/tests/mail_to_db.pl b/tests/mail_to_db.pl
index e50415d96f3..bab9e7eb74a 100755
--- a/tests/mail_to_db.pl
+++ b/tests/mail_to_db.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright Abandoned 1998 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index c544e20f2fe..93f23236dbc 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB
+ Copyright (c) 2008, 2020, 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
@@ -8457,7 +8457,8 @@ static void test_mem_overun()
char buffer[10000], field[10];
MYSQL_STMT *stmt;
MYSQL_RES *field_res;
- int rc, i, length;
+ int rc, length;
+ unsigned i;
myheader("test_mem_overun");
@@ -8471,7 +8472,7 @@ static void test_mem_overun()
strxmov(buffer, "create table t_mem_overun(", NullS);
for (i= 0; i < 1000; i++)
{
- sprintf(field, "c%d int", i);
+ sprintf(field, "c%u int", i);
strxmov(buffer, buffer, field, ", ", NullS);
}
length= strlen(buffer);
@@ -19843,6 +19844,208 @@ static void test_bulk_replace()
}
#endif
+
+static void test_ps_params_in_ctes()
+{
+ int rc;
+ const char *query;
+ MYSQL_BIND ps_params[1];
+ int int_data[1];
+ MYSQL_STMT *stmt;
+
+ rc= mysql_query(mysql, "create table t1(a int, b int, key(a))");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "insert into t1 (a) values "
+ "(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)");
+ myquery(rc);
+
+ query=
+ "explain "
+ "with T as "
+ "( "
+ " select * from t1 where t1.a=? limit 2 "
+ ") "
+ "select * from T as TA, T as TB;";
+
+ stmt= mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
+ check_execute(stmt, rc);
+
+ int_data[0]=2;
+
+ ps_params[0].buffer_type= MYSQL_TYPE_LONG;
+ ps_params[0].buffer= (char *) &int_data[0];
+ ps_params[0].length= 0;
+ ps_params[0].is_null= 0;
+
+ rc= mysql_stmt_bind_param(stmt, ps_params);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "drop table t1");
+ myquery(rc);
+}
+
+
+#ifndef EMBEDDED_LIBRARY
+#define MDEV19838_MAX_PARAM_COUNT 32
+#define MDEV19838_FIELDS_COUNT 17
+static void test_mdev19838()
+{
+ int rc;
+ MYSQL_BIND bind[MDEV19838_MAX_PARAM_COUNT];
+ unsigned int i, paramCount = 1;
+ char charvalue[] = "012345678901234567890123456789012345";
+ MYSQL_STMT *stmt;
+
+ myheader("test_mdev19838");
+
+ rc = mysql_query(mysql, "CREATE TABLE mdev19838("
+ "f1 char(36),"
+ "f2 char(36),"
+ "f3 char(36),"
+ "f4 char(36),"
+ "f5 char(36),"
+ "f6 char(36),"
+ "f7 char(36),"
+ "f8 char(36),"
+ "f9 char(36),"
+ "f10 char(36),"
+ "f11 char(36),"
+ "f12 char(36),"
+ "f13 char(36),"
+ "f14 char(36),"
+ "f15 char(36),"
+ "f16 char(36),"
+ "f17 char(36)"
+ ")");
+ myquery(rc);
+
+ stmt = mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ memset(bind, 0, sizeof(bind));
+
+ for (i = 0; i < MDEV19838_MAX_PARAM_COUNT; ++i)
+ {
+ bind[i].buffer = charvalue;
+ bind[i].buffer_type = MYSQL_TYPE_STRING;
+ bind[i].buffer_length = strlen(charvalue) + 1;
+ bind[i].length = &bind[i].length_value;
+ bind[i].length_value = bind[i].buffer_length - 1;
+ }
+
+ for (paramCount = 1; paramCount < MDEV19838_FIELDS_COUNT; ++paramCount)
+ {
+ mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, &paramCount);
+
+ rc = mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
+ "(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)"
+ " VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
+
+ /* Expecting an error */
+ DIE_UNLESS(rc != 0);
+
+ mysql_stmt_close(stmt);
+ stmt = mysql_stmt_init(mysql);
+ check_stmt(stmt);
+ }
+
+ paramCount = 0;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, &paramCount);
+ rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838(f1)"
+ " VALUES (?)", -1);
+ /* Expecting an error */
+ DIE_UNLESS(rc != 0);
+ mysql_stmt_close(stmt);
+
+ stmt = mysql_stmt_init(mysql);
+ check_stmt(stmt);
+ /* Correct number of parameters */
+ paramCount = MDEV19838_FIELDS_COUNT;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, &paramCount);
+ mysql_stmt_bind_param(stmt, bind);
+
+ rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
+ "(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)"
+ " VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
+ check_execute(stmt, rc);
+
+ /* MYSQL_TYPE_TINY = 1. This parameter byte can be read as "parameters send" flag byte.
+ Checking that wrong packet is still detected */
+ bind[0].buffer_type = MYSQL_TYPE_TINY;
+ bind[0].length_value = 1;
+ bind[0].buffer_length = 1;
+
+ for (paramCount = 8; paramCount > 0; --paramCount)
+ {
+ mysql_stmt_close(stmt);
+ stmt = mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, &paramCount);
+
+ rc = mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
+ "(f1, f2, f3, f4, f5, f6, f7, f8, f9)"
+ " VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?)", -1);
+
+ /* Expecting an error */
+ DIE_UNLESS(rc != 0);
+ }
+
+ /* Test of query w/out parameters, with parameter sent and not sent */
+ for (paramCount = MDEV19838_MAX_PARAM_COUNT; paramCount != (unsigned int)-1; --paramCount)
+ {
+ mysql_stmt_close(stmt);
+ stmt = mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ mysql_stmt_attr_set(stmt, STMT_ATTR_PREBIND_PARAMS, &paramCount);
+
+ if (paramCount > 0)
+ {
+ rc = mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+ }
+
+ rc = mariadb_stmt_execute_direct(stmt, "INSERT INTO mdev19838"
+ "(f1)"
+ " VALUES "
+ "(0x1111111111111111)", -1);
+
+ /*
+ We allow junk at the end of the packet in case of
+ no parameters. So it will succeed.
+ */
+ DIE_UNLESS(rc == 0);
+ }
+
+ mysql_stmt_close(stmt);
+
+ rc = mysql_query(mysql, "drop table mdev19838");
+ myquery(rc);
+}
+#endif // EMBEDDED_LIBRARY
+
static struct my_tests_st my_tests[]= {
{ "disable_query_logs", disable_query_logs },
{ "test_view_sp_list_fields", test_view_sp_list_fields },
@@ -20127,6 +20330,10 @@ static struct my_tests_st my_tests[]= {
{ "test_bulk_delete", test_bulk_delete },
{ "test_bulk_replace", test_bulk_replace },
#endif
+ { "test_ps_params_in_ctes", test_ps_params_in_ctes },
+#ifndef EMBEDDED_LIBRARY
+ { "test_mdev19838", test_mdev19838 },
+#endif
{ 0, 0 }
};
diff --git a/tests/pmail.pl b/tests/pmail.pl
index 359256c25b3..cf46f5a054d 100755
--- a/tests/pmail.pl
+++ b/tests/pmail.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000, 2005 MySQL AB
# Use is subject to license terms
diff --git a/tests/rename_test.pl b/tests/rename_test.pl
index d7097df1e4e..aa0befa125d 100755
--- a/tests/rename_test.pl
+++ b/tests/rename_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/table_types.pl b/tests/table_types.pl
index c633a153098..782b8f254bf 100755
--- a/tests/table_types.pl
+++ b/tests/table_types.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000, 2003 MySQL AB
# Use is subject to license terms
diff --git a/tests/test_delayed_insert.pl b/tests/test_delayed_insert.pl
index cb5b86a228d..f0702e6378b 100755
--- a/tests/test_delayed_insert.pl
+++ b/tests/test_delayed_insert.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/truncate.pl b/tests/truncate.pl
index 98791a15b2c..21d469662d9 100755
--- a/tests/truncate.pl
+++ b/tests/truncate.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2002 MySQL AB
# Use is subject to license terms
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
index 1d97340784d..984b033e7aa 100644
--- a/unittest/mysys/CMakeLists.txt
+++ b/unittest/mysys/CMakeLists.txt
@@ -15,7 +15,7 @@
MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
byte_order
- LINK_LIBRARIES mysys)
+ queues stacktrace LINK_LIBRARIES mysys)
MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl)
ADD_DEFINITIONS(${SSL_DEFINES})
diff --git a/unittest/mysys/my_vsnprintf-t.c b/unittest/mysys/my_vsnprintf-t.c
index 6ba0a42cf7e..1a0b4080a2d 100644
--- a/unittest/mysys/my_vsnprintf-t.c
+++ b/unittest/mysys/my_vsnprintf-t.c
@@ -61,7 +61,7 @@ static void test_many(const char **res, const char *fmt, ...)
int main(void)
{
- plan(39);
+ plan(47);
test1("Constant string",
"Constant string");
@@ -101,11 +101,33 @@ int main(void)
test1("Precision works for strings <abcde>",
"Precision works for strings <%.5s>", "abcdef!");
+ test1("Precision works for strings <ab...>",
+ "Precision works for strings <%.5T>", "abcdef!");
test1("Flag '`' (backtick) works: `abcd` `op``q` (mysql extension)",
"Flag '`' (backtick) works: %`s %`.4s (mysql extension)",
"abcd", "op`qrst");
+ test1("Flag '`' (backtick) works: `abcd` `op``q...` (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.7T (mysql extension)",
+ "abcd", "op`qrstuuuuuuuuu");
+
+ test1("Flag '`' (backtick) works: `abcd` `.` (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.1T (mysql extension)",
+ "abcd", "op`qrstuuuuuuuuu");
+
+ test1("Flag '`' (backtick) works: `abcd` `...` (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.3T (mysql extension)",
+ "abcd", "op`qrstuuuuuuuuu");
+
+ test1("Flag '`' (backtick) works: `abcd` `op...` (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.5T (mysql extension)",
+ "abcd", "op`qrstuuuuuuuuu");
+
+ test1("Flag '`' (backtick) works: `abcd` `op``...` (mysql extension)",
+ "Flag '`' (backtick) works: %`T %`.6T (mysql extension)",
+ "abcd", "op`qrstuuuuuuuuu");
+
test1("Length modifiers work: 1 * -1 * 2 * 3",
"Length modifiers work: %d * %ld * %lld * %zd", 1, -1L, 2LL, (size_t)3);
@@ -128,12 +150,18 @@ int main(void)
test1("Asterisk '*' as a precision works: <qwerty>",
"Asterisk '*' as a precision works: <%.*s>", 6, "qwertyuiop");
+ test1("Asterisk '*' as a precision works: <qwe...>",
+ "Asterisk '*' as a precision works: <%.*T>", 6, "qwertyuiop");
+
test1("Positional arguments for a width: < 4>",
"Positional arguments for a width: <%1$*2$d>", 4, 5);
test1("Positional arguments for a precision: <qwerty>",
"Positional arguments for a precision: <%1$.*2$s>", "qwertyuiop", 6);
+ test1("Positional arguments for a precision: <qwe...>",
+ "Positional arguments for a precision: <%1$.*2$T>", "qwertyuiop", 6);
+
test1("Positional arguments and a width: <0000ab>",
"Positional arguments and a width: <%1$06x>", 0xab);
@@ -168,14 +196,14 @@ int main(void)
test1("M with positional: 0 \"Internal error/check (Not system error)\"",
"M with positional: %1$M", 0);
- test1("M with width: 0 \"Internal error/ch",
+ test1("M with width: 0 \"Internal error...",
"M with width: %.20M", 0);
- test1("M with width positional: 0 \"Internal error/ch",
+ test1("M with width positional: 0 \"Internal error...",
"M with width positional: %2$.*1$M", 20, 0);
- test_w_len("M small buf: 0 \"In",
+ test_w_len("M small buf: 0 \"..",
19, "M small buf: %M", 0);
- test_w_len("M small buf positional: 0 \"In",
+ test_w_len("M small buf positional: 0 \"..",
30, "M small buf positional: %1$M", 0);
return exit_status();
diff --git a/unittest/mysys/queues-t.c b/unittest/mysys/queues-t.c
new file mode 100644
index 00000000000..23cb0da1a32
--- /dev/null
+++ b/unittest/mysys/queues-t.c
@@ -0,0 +1,139 @@
+/* Copyright (c) 2020, 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-1335 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <queues.h>
+#include <my_rnd.h>
+#include "tap.h"
+
+int cmp(void *arg __attribute__((unused)), uchar *a, uchar *b)
+{
+ return *a < *b ? -1 : *a > *b;
+}
+
+#define rnd(R) ((uint)(my_rnd(R) * INT_MAX32))
+
+#define el(Q,I) ((uint)*queue_element(Q, I))
+
+my_bool verbose;
+
+my_bool check_queue(QUEUE *queue)
+{
+ char b[1024]={0}, *s, *e=b+sizeof(b)-2;
+ my_bool ok=1;
+ uint i;
+
+ s= b + my_snprintf(b, e-b, "%x", el(queue, 1));
+ for (i=2; i <= queue->elements; i++)
+ {
+ s+= my_snprintf(s, e-s, ", %x", el(queue, i));
+ ok &= el(queue, i) <= el(queue, i>>1);
+ }
+ if (!ok || verbose)
+ diag("%s", b);
+ return ok;
+}
+
+int main(int argc __attribute__((unused)), char *argv[])
+{
+ QUEUE q, *queue=&q;
+ MY_INIT(argv[0]);
+ plan(19);
+
+ verbose=1;
+
+ init_queue(queue, 256, 0, 1, cmp, NULL, 0, 0);
+ queue_insert(queue, (uchar*)"\x99");
+ queue_insert(queue, (uchar*)"\x19");
+ queue_insert(queue, (uchar*)"\x36");
+ queue_insert(queue, (uchar*)"\x17");
+ queue_insert(queue, (uchar*)"\x12");
+ queue_insert(queue, (uchar*)"\x05");
+ queue_insert(queue, (uchar*)"\x25");
+ queue_insert(queue, (uchar*)"\x09");
+ queue_insert(queue, (uchar*)"\x15");
+ queue_insert(queue, (uchar*)"\x06");
+ queue_insert(queue, (uchar*)"\x11");
+ queue_insert(queue, (uchar*)"\x01");
+ queue_insert(queue, (uchar*)"\x04");
+ queue_insert(queue, (uchar*)"\x13");
+ queue_insert(queue, (uchar*)"\x24");
+ ok(check_queue(queue), "after insert");
+ queue_remove(queue, 5);
+ ok(check_queue(queue), "after remove 5th");
+
+ queue_element(queue, 1) = (uchar*)"\x01";
+ queue_element(queue, 2) = (uchar*)"\x10";
+ queue_element(queue, 3) = (uchar*)"\x04";
+ queue_element(queue, 4) = (uchar*)"\x09";
+ queue_element(queue, 5) = (uchar*)"\x13";
+ queue_element(queue, 6) = (uchar*)"\x03";
+ queue_element(queue, 7) = (uchar*)"\x08";
+ queue_element(queue, 8) = (uchar*)"\x07";
+ queue_element(queue, 9) = (uchar*)"\x06";
+ queue_element(queue,10) = (uchar*)"\x12";
+ queue_element(queue,11) = (uchar*)"\x05";
+ queue_element(queue,12) = (uchar*)"\x02";
+ queue_element(queue,13) = (uchar*)"\x11";
+ queue->elements= 13;
+ ok(!check_queue(queue), "manually filled (queue property violated)");
+
+ queue_fix(queue);
+ ok(check_queue(queue), "fixed");
+
+ ok(*queue_remove_top(queue) == 0x13, "remove top 13");
+ ok(*queue_remove_top(queue) == 0x12, "remove top 12");
+ ok(*queue_remove_top(queue) == 0x11, "remove top 11");
+ ok(*queue_remove_top(queue) == 0x10, "remove top 10");
+ ok(*queue_remove_top(queue) == 0x09, "remove top 9");
+ ok(*queue_remove_top(queue) == 0x08, "remove top 8");
+ ok(*queue_remove_top(queue) == 0x07, "remove top 7");
+ ok(*queue_remove_top(queue) == 0x06, "remove top 6");
+ ok(*queue_remove_top(queue) == 0x05, "remove top 5");
+ ok(*queue_remove_top(queue) == 0x04, "remove top 4");
+ ok(*queue_remove_top(queue) == 0x03, "remove top 3");
+ ok(*queue_remove_top(queue) == 0x02, "remove top 2");
+ ok(*queue_remove_top(queue) == 0x01, "remove top 1");
+
+ /* random test */
+ {
+ int i, res;
+ struct my_rnd_struct rand;
+ my_rnd_init(&rand, (ulong)(intptr)&i, (ulong)(intptr)argv);
+ verbose=0;
+
+ for (res= i=1; i <= 250; i++)
+ {
+ uchar *s=alloca(2);
+ *s= rnd(&rand) % 251;
+ queue_insert(queue, s);
+ res &= check_queue(queue);
+ }
+ ok(res, "inserted 250");
+
+ while (queue->elements)
+ {
+ queue_remove(queue, (rnd(&rand) % queue->elements) + 1);
+ res &= check_queue(queue);
+ }
+ ok(res, "removed 250");
+ }
+
+ delete_queue(queue);
+ my_end(0);
+ return exit_status();
+}
+
diff --git a/unittest/mysys/stacktrace-t.c b/unittest/mysys/stacktrace-t.c
new file mode 100644
index 00000000000..8fa0db15b36
--- /dev/null
+++ b/unittest/mysys/stacktrace-t.c
@@ -0,0 +1,67 @@
+
+/* Copyright (c) 2020, 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 02110-1335 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <stdio.h>
+#include <my_stacktrace.h>
+#include <tap.h>
+
+char b_bss[10];
+
+void test_my_safe_print_str()
+{
+ char b_stack[10];
+ char *b_heap= strdup("LEGAL");
+ memcpy(b_stack, "LEGAL", 6);
+ memcpy(b_bss, "LEGAL", 6);
+
+#ifndef __SANITIZE_ADDRESS__
+ fprintf(stderr, "\n===== stack =====\n");
+ my_safe_print_str(b_stack, 65535);
+ fprintf(stderr, "\n===== heap =====\n");
+ my_safe_print_str(b_heap, 65535);
+ fprintf(stderr, "\n===== BSS =====\n");
+ my_safe_print_str(b_bss, 65535);
+ fprintf(stderr, "\n===== data =====\n");
+ my_safe_print_str("LEGAL", 65535);
+ fprintf(stderr, "\n===== Above is a junk, but it is expected. =====\n");
+#endif /*__SANITIZE_ADDRESS__*/
+ fprintf(stderr, "\n===== Nornal length test =====\n");
+ my_safe_print_str("LEGAL", 5);
+ fprintf(stderr, "\n===== NULL =====\n");
+ my_safe_print_str(0, 5);
+#ifndef __SANITIZE_ADDRESS__
+ fprintf(stderr, "\n===== (const char*) 1 =====\n");
+ my_safe_print_str((const char*)1, 5);
+#endif /*__SANITIZE_ADDRESS__*/
+
+ free(b_heap);
+
+ ok(1, "test_my_safe_print_str");
+}
+
+
+int main(int argc __attribute__((unused)), char **argv)
+{
+ MY_INIT(argv[0]);
+ plan(1);
+
+ test_my_safe_print_str();
+
+ my_end(0);
+ return exit_status();
+}
diff --git a/unittest/unit.pl b/unittest/unit.pl
index fb9a16fbe49..dc72a57d20c 100644
--- a/unittest/unit.pl
+++ b/unittest/unit.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2006 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 6c028c48c46..f40474f3eec 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -879,7 +879,7 @@ static my_bool socket_peek_read(Vio *vio, uint *bytes)
@param timeout Interval (in milliseconds) to wait for an I/O event.
A negative timeout value means an infinite timeout.
- @remark sock_errno is set to SOCKET_ETIMEDOUT on timeout.
+ @remark socket_errno is set to SOCKET_ETIMEDOUT on timeout.
@return A three-state value which indicates the operation status.
@retval -1 Failure, socket_errno indicates the error.
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt
index 130f74118ca..ded44af5276 100644
--- a/win/packaging/CMakeLists.txt
+++ b/win/packaging/CMakeLists.txt
@@ -212,10 +212,22 @@ IF(SIGNCODE)
ENDIF()
ADD_CUSTOM_TARGET(
- win_package
+ win_package_zip
${SIGN_COMMAND}
COMMAND ${CMAKE_CPACK_COMMAND} ${CPACK_CONFIG_PARAM} --config ${CMAKE_CURRENT_SOURCE_DIR}/CPackZipConfig.cmake
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)
+
+ADD_CUSTOM_TARGET(
+ win_package_debuginfo
COMMAND ${CMAKE_CPACK_COMMAND} ${CPACK_CONFIG_PARAM} --config ${CMAKE_CURRENT_SOURCE_DIR}/CPackZipDebugInfoConfig.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
+ADD_CUSTOM_TARGET(win_package DEPENDS win_package_zip win_package_debuginfo)
+SET_TARGET_PROPERTIES(
+ win_package win_package_zip win_package_debuginfo
+ PROPERTIES
+ EXCLUDE_FROM_ALL TRUE
+ EXCLUDE_FROM_DEFAULT_BUILD TRUE
+)
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
index 4005bd6e73b..d3bea12ffd9 100644
--- a/win/packaging/ca/CustomAction.cpp
+++ b/win/packaging/ca/CustomAction.cpp
@@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#undef NOMINMAX
#include <winsock2.h>
+#include <ws2tcpip.h>
#include <windows.h>
#include <winreg.h>
#include <msi.h>
@@ -33,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
#include <stdlib.h>
#include <winservice.h>
+
#define ONE_MB 1048576
UINT ExecRemoveDataDirectory(wchar_t *dir)
{
@@ -255,36 +257,89 @@ bool ExecRemoveService(const wchar_t *name)
return ret;
}
-/*
- Check if port is free by trying to bind to the port
-*/
-bool IsPortFree(short port)
+/* Find whether TCP port is in use by trying to bind to the port. */
+static bool IsPortInUse(unsigned short port)
{
- WORD wVersionRequested;
- WSADATA wsaData;
-
- wVersionRequested = MAKEWORD(2, 2);
+ struct addrinfo* ai, * a;
+ struct addrinfo hints {};
- WSAStartup(wVersionRequested, &wsaData);
+ char port_buf[NI_MAXSERV];
+ SOCKET ip_sock = INVALID_SOCKET;
+ hints.ai_flags = AI_PASSIVE;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_family = AF_UNSPEC;
+ snprintf(port_buf, NI_MAXSERV, "%u", (unsigned)port);
- struct sockaddr_in sin;
- SOCKET sock;
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if(sock == -1)
+ if (getaddrinfo(NULL, port_buf, &hints, &ai))
{
return false;
}
- sin.sin_port = htons(port);
- sin.sin_addr.s_addr = 0;
- sin.sin_addr.s_addr = INADDR_ANY;
- sin.sin_family = AF_INET;
- if(bind(sock, (struct sockaddr *)&sin,sizeof(struct sockaddr_in) ) == -1)
+
+ /*
+ Prefer IPv6 socket to IPv4, since we'll use IPv6 dual socket,
+ which coveres both IP versions.
+ */
+ for (a = ai; a; a = a->ai_next)
+ {
+ if (a->ai_family == AF_INET6 &&
+ (ip_sock = socket(a->ai_family, a->ai_socktype, a->ai_protocol)) != INVALID_SOCKET)
+ {
+ break;
+ }
+ }
+
+ if (ip_sock == INVALID_SOCKET)
+ {
+ for (a = ai; a; a = a->ai_next)
+ {
+ if (ai->ai_family == AF_INET &&
+ (ip_sock = socket(a->ai_family, a->ai_socktype, a->ai_protocol)) != INVALID_SOCKET)
+ {
+ break;
+ }
+ }
+ }
+
+ if (ip_sock == INVALID_SOCKET)
{
return false;
}
- closesocket(sock);
+
+ /* Use SO_EXCLUSIVEADDRUSE to prevent multiple binding. */
+ int arg = 1;
+ setsockopt(ip_sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&arg, sizeof(arg));
+
+ /* Allow dual socket, so that IPv4 and IPv6 are both covered.*/
+ if (a->ai_family == AF_INET6)
+ {
+ arg = 0;
+ setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg, sizeof(arg));
+ }
+
+ bool in_use = false;
+ if (bind(ip_sock, a->ai_addr, (int)a->ai_addrlen) == SOCKET_ERROR)
+ {
+ DWORD last_error = WSAGetLastError();
+ in_use = (last_error == WSAEADDRINUSE || last_error == WSAEACCES);
+ }
+
+ freeaddrinfo(ai);
+ closesocket(ip_sock);
+ return in_use;
+}
+
+
+/*
+ Check if TCP port is free
+*/
+bool IsPortFree(unsigned short port)
+{
+ WORD wVersionRequested = MAKEWORD(2, 2);
+ WSADATA wsaData;
+ WSAStartup(wVersionRequested, &wsaData);
+ bool in_use = IsPortInUse(port);
WSACleanup();
- return true;
+ return !in_use;
}
@@ -634,7 +689,7 @@ extern "C" UINT __stdcall CheckDatabaseProperties (MSIHANDLE hInstall)
goto LExit;
}
- short port = (short)_wtoi(Port);
+ unsigned short port = (unsigned short)_wtoi(Port);
if (!IsPortFree(port))
{
ErrorMsg =
diff --git a/win/packaging/create_msi.cmake.in b/win/packaging/create_msi.cmake.in
index 21c59dd4f38..c589f98becc 100644
--- a/win/packaging/create_msi.cmake.in
+++ b/win/packaging/create_msi.cmake.in
@@ -70,10 +70,12 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(Win64 " Win64='yes'")
SET(Platform x64)
SET(PlatformProgramFilesFolder ProgramFiles64Folder)
+ SET(CA_QUIET_EXEC CAQuietExec64)
ELSE()
SET(CANDLE_ARCH -arch x86)
SET(Platform x86)
SET(PlatformProgramFilesFolder ProgramFilesFolder)
+ SET(CA_QUIET_EXEC CAQuietExec)
SET(Win64)
ENDIF()
diff --git a/win/packaging/custom_ui.wxs b/win/packaging/custom_ui.wxs
deleted file mode 100644
index 70fa3ba3abd..00000000000
--- a/win/packaging/custom_ui.wxs
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <Property Id="PortTemplate" Value="####" />
- <Property Id="PORT" Value="3306"></Property>
- <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
- <Property Id="CREATEDBINSTANCE"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Property>
- <UI>
- <Dialog Id="DatabaseCreationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="ServiceNameLabel" Type="Text" X="20" Y="73" Width="70" Height="15" TabSkip="no" Text="Service Name:" />
- <Control Id="ServiceName" Type="Edit" X="90" Y="73" Width="120" Height="15" Property="SERVICENAME" Text="{20}" />
-
- <Control Id="RootPasswordLabel" Type="Text" X="20" Y="90" Width="120" Height="15" TabSkip="no" Text="&amp;Root password:" />
- <Control Id="RootPassword" Type="Edit" X="20" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD" Password="yes" Text="{20}" />
-
- <Control Id="RootPasswordConfirmLabel" Type="Text" X="150" Y="90" Width="150" Height="15" TabSkip="no" Text="&amp;Confirm Root password:" />
- <Control Id="RootPasswordConfirm" Type="Edit" X="150" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD_CONFIRM" Password="yes" Text="{20}" />
- <Control Id="BannerLine0" Type="Line" X="0" Y="128" Width="370" Height="0" />
-
- <Control Id="PortLabel" Type="Text" X="20" Y="137" Width="40" Height="15" TabSkip="no" Text="TCP port:" />
-
- <Control Id="Port" Type="MaskedEdit" X="60" Y="136" Width="30" Height="15" Property="PORT" Text="[PortTemplate]"/>
- <!--<Control Id="FirewallExceptionCheckBox" Type="CheckBox" X="150" Y="136" Height="15" Property="FIREWALL_EXCEPTION" Width="200" CheckBoxValue="1"
- Text="Create Firewall exception for this port"/>-->
-
- <Control Id="BannerLine2" Type="Line" X="0" Y="155" Width="370" Height="0" />
-
- <Control Id="FolderLabel" Type="Text" X="20" Y="181" Width="100" Height="15" TabSkip="no" Text="Database location:" />
- <Control Id="Folder" Type="PathEdit" X="20" Y="204" Width="200" Height="18" Property="DATABASELOCATION" Indirect="no" />
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
- <!--
- <Publish Event="ValidateProductID" Value="0">1</Publish>
- <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
- -->
- <!--<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>-->
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Create default [ProductName] instance</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
-
- <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
- <Control Id="ServiceRemoveText" Type="Text" X="20" Y="73" Width="300" Height="15" TabSkip="no">
- <Text>Service '[SERVICENAME]' will be removed</Text>
- </Control>
- <Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="15" Property="CLEANUP_DATA" Width="15" CheckBoxValue="0"/>
- <Control Id="RemoveDataText" Type="Text" X="37" Y="101" Width="300" Height="200" TabSkip="no">
- <Text>Remove default database directory '[DATABASELOCATION]'</Text>
- </Control>
-
- <!-- Navigation buttons-->
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
- <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
- <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>Remove default [ProductName] database</Text>
- </Control>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
- <Text>{\WixUI_Font_Title}Default instance properties</Text>
- </Control>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- </Dialog>
- </UI>
- <UI Id="MyWixUI_Mondo">
- <UIRef Id="WixUI_FeatureTree" />
- <UIRef Id="WixUI_ErrorProgressText" />
- <DialogRef Id="DatabaseCreationDlg" />
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseCreationDlg" Order="999"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="DatabaseCreationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish>
- <Publish Dialog="DatabaseCreationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseCreationDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="3" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
- <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999"><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">!DBInstance=3</Publish>
- <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
- </UI>
-
- <DirectoryRef Id='TARGETDIR'>
- <Directory Id="CommonAppDataFolder">
- <Directory Id="DatabasesRoot" Name="MariaDB">
- <Directory Id="DATABASELOCATION" Name="MariaDB Server 5.1">
- </Directory>
- </Directory>
- </Directory>
- </DirectoryRef>
-
- <Feature Id='DBInstance'
- Title='Database instance'
- Description='Install database instance'
- ConfigurableDirectory='DATABASELOCATION'
- AllowAdvertise='no'
- Level='1'>
- <Component Id="C.datadir" Guid="*" Directory="DATABASELOCATION">
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='DatabaseLocation' Value='[DATABASELOCATION]' Type='string' KeyPath='yes'/>
- <CreateFolder />
- </Component>
- <Component Id="C.service" Guid="*" Directory="DATABASELOCATION">
- <Condition>SERVICENAME</Condition>
- <RegistryValue Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='ServiceName' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
- <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='uninstall' Wait='yes'></ServiceControl>
- <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='no'></ServiceControl>
- <ServiceControl Id='DBInstanceServiceRemove' Name='[SERVICENAME]' Remove='uninstall' Wait='yes'></ServiceControl>
- </Component>
- </Feature>
-
- <CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
- Value="&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; &quot;--password=[ROOT_PASSWORD]&quot; &quot;--datadir=[DATABASELOCATION]&quot;"
- Execute="immediate"/>
- <CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
- Execute="deferred" Return="check" Impersonate="no"/>
-
- <UI>
- <ProgressText Action="QtExecDeferredExampleWithProperty">Running mysql_install_db.exe</ProgressText>
- </UI>
-
- <!-- Use Wix toolset "remember property" pattern to store properties between major upgrades etc -->
- <InstallExecuteSequence>
- <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
- <Custom Action="QtExecDeferredExampleWithProperty" After="InstallFiles"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
- </InstallExecuteSequence>
-
- <Property Id='SERVICENAME'>
- <RegistrySearch Id='ServiceNameProperty' Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='ServiceName' Type='raw' />
- </Property>
- <SetProperty After='AppSearch' Id="SERVICENAME" Value="MariaDB_51"><![CDATA[NOT SERVICENAME]]></SetProperty>
- <Property Id="DATABASELOCATION">
- <RegistrySearch Id='DatabaseLocationProperty' Root='HKLM'
- Key='SOFTWARE\[Manufacturer]\[ProductName]'
- Name='´DatabaseLocation' Type='raw' />
- </Property>
- <SetProperty After='AppSearch' Id="DATABASELOCATION" Value="[CommonAppDataFolder]\MariaDB\[ProductName]"><![CDATA[NOT DATABASELOCATION]]></SetProperty>
- <CustomAction Id='SaveCmdLineValue_SERVICENAME' Property='CMDLINE_SERVICENAME'
- Value='[SERVICENAME]' Execute='firstSequence' />
- <CustomAction Id='SetFromCmdLineValue_SERVICENAME' Property='SERVICENAME' Value='[CMDLINE_SERVICENAME]' Execute='firstSequence' />
- <CustomAction Id='SaveCmdLineValue_DATABASELOCATION' Property='CMDLINE_DATABASELOCATION'
- Value='[DATABASELOCATION]' Execute='firstSequence' />
- <CustomAction Id='SetFromCmdLineValue_DATABASELOCATION' Property='DATABASELOCATION' Value='[CMDLINE_DATABASELOCATION]' Execute='firstSequence' />
-
- <InstallUISequence>
- <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
- <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
- </InstallUISequence>
- <InstallExecuteSequence>
- <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
- <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
- <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
- </InstallExecuteSequence>
- </Fragment>
-</Wix> \ No newline at end of file
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
index 3aba129fdf3..4c8e1a5a973 100644
--- a/win/packaging/extra.wxs.in
+++ b/win/packaging/extra.wxs.in
@@ -666,7 +666,7 @@
<CustomAction Id="CreateDatabaseRollbackCommand" Property="CreateDatabaseRollback"
Value="[SERVICENAME]\[DATADIR]"
Execute="immediate"/>
- <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec"
+ <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="@CA_QUIET_EXEC@"
Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="CreateDatabaseRollback" BinaryKey="wixca.dll" DllEntry="CreateDatabaseRollback"
Execute="rollback" Return="check" Impersonate="no"/>
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index a3d884adb56..6290ada9704 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_10.2_32_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_11.0_32_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in
index 4244b47d0d8..58d95210783 100644
--- a/win/packaging/heidisql.wxi.in
+++ b/win/packaging/heidisql.wxi.in
@@ -33,20 +33,25 @@
<RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
<Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/>
</Component>
+
+
<Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
<File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
</Component>
+ <Component Id="component.HeidiSQL_libmysql_6.1.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libmysql_6.1.dll" Name="libmysql-6.1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql-6.1.dll" />
+ </Component>
<Component Id="component.HeidiSQL_libmariadb.dll" Guid="*" Win64="no">
<File Id="heidisql.libmariadb.dll" Name="libmariadb.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmariadb.dll" />
</Component>
- <Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no">
- <File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" />
+ <Component Id="component.HeidiSQL_libssl_1_1.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libssl_1_1.dll" Name="libssl-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libssl-1_1.dll" />
</Component>
- <Component Id="component.HeidiSQL_libpq.dll" Guid="*" Win64="no">
- <File Id="heidisql.libpq.dll" Name="libpq.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq.dll" />
+ <Component Id="component.HeidiSQL_libpq_10.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libpq_10.dll" Name="libpq-10.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq-10.dll" />
</Component>
- <Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no">
- <File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" />
+ <Component Id="component.HeidiSQL_libcrypto_1_1.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libcrypto_1_1.dll" Name="libcrypto-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libcrypto-1_1.dll" />
</Component>
<Component Id="component.HeidiSQL_libintl_8.dll" Guid="*" Win64="no">
<File Id="heidisql.libintl_8.dll" Name="libintl-8.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl-8.dll" />
@@ -54,6 +59,9 @@
<Component Id="component.HeidiSQL_libiconv_2.dll" Guid="*" Win64="no">
<File Id="heidisql.libiconv_2.dll" Name="libiconv-2.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libiconv-2.dll" />
</Component>
+ <Component Id="component.HeidiSQL_sqlite3.dll" Guid="*" Win64="no">
+ <File Id="heidisql.sqlite3.dll" Name="sqlite3.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\sqlite3.dll" />
+ </Component>
<Directory Id="D.HeidiSQL.plugins" Name="plugins">
<?foreach dll in $(var.pluginlist) ?>
@@ -76,11 +84,13 @@
<ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
<ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
<ComponentRef Id="component.HeidiSQL_libmariadb.dll"/>
- <ComponentRef Id="component.HeidiSQL_libeay32.dll" />
- <ComponentRef Id="component.HeidiSQL_libpq.dll" />
- <ComponentRef Id="component.HeidiSQL_ssleay32.dll" />
+ <ComponentRef Id="component.HeidiSQL_libssl_1_1.dll" />
+ <ComponentRef Id="component.HeidiSQL_libpq_10.dll" />
+ <ComponentRef Id="component.HeidiSQL_libcrypto_1_1.dll" />
<ComponentRef Id="component.HeidiSQL_libintl_8.dll" />
<ComponentRef Id="component.HeidiSQL_libiconv_2.dll" />
+ <ComponentRef Id="component.HeidiSQL_sqlite3.dll" />
+ <ComponentRef Id="component.HeidiSQL_libmysql_6.1.dll" />
<?foreach dll in $(var.pluginlist)?>
<ComponentRef Id="component.HeidiSQL_$(var.dll)" />
<?endforeach?>